-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix shunt compensator component type (#419)
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
- Loading branch information
Showing
2 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
single-line-diagram-core/src/test/java/com/powsybl/sld/builders/NetworkGraphBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2022, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.sld.builders; | ||
|
||
import com.powsybl.iidm.network.*; | ||
import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
/** | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
public class NetworkGraphBuilderTest { | ||
|
||
@Test | ||
public void isCapacitorTest() { | ||
Network network = EurostagTutorialExample1Factory.create(); | ||
VoltageLevel vlload = network.getVoltageLevel("VLLOAD"); | ||
ShuntCompensator sc = vlload.newShuntCompensator() | ||
.setId("SC") | ||
.setConnectableBus("NLOAD") | ||
.newLinearModel() | ||
.setBPerSection(0.05) | ||
.setMaximumSectionCount(1) | ||
.add() | ||
.setSectionCount(0) | ||
.add(); | ||
assertTrue(NetworkGraphBuilder.isCapacitor(sc)); | ||
sc.getModel(ShuntCompensatorLinearModel.class).setBPerSection(-0.03); | ||
assertFalse(NetworkGraphBuilder.isCapacitor(sc)); | ||
ShuntCompensator sc2 = vlload.newShuntCompensator() | ||
.setId("SC2") | ||
.setConnectableBus("NLOAD") | ||
.newNonLinearModel() | ||
.beginSection() | ||
.setB(0.05) | ||
.endSection() | ||
.beginSection() | ||
.setB(-0.02) | ||
.endSection() | ||
.add() | ||
.setSectionCount(0) | ||
.add(); | ||
assertTrue(NetworkGraphBuilder.isCapacitor(sc2)); | ||
sc2.getModel(ShuntCompensatorNonLinearModel.class).getAllSections().get(1).setB(-0.07); | ||
assertFalse(NetworkGraphBuilder.isCapacitor(sc2)); | ||
} | ||
} |