Skip to content

Commit

Permalink
Merge branch 'main' into ayolab/remove-hack-and-update-report-management
Browse files Browse the repository at this point in the history
  • Loading branch information
ayolab authored Sep 16, 2024
2 parents e443292 + 289e24b commit 182ff26
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 79 deletions.
14 changes: 14 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-client</artifactId>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. The overloads and this property below have to be removed at next gridsuite-dependencies.version upgrade -->
<version>1.17.1</version>
</dependency>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. This section have to be removed at next gridsuite-dependencies.version upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-iidm-impl</artifactId>
<version>1.17.1</version>
</dependency>
<!-- FIXME: network-store modules' version is overloaded in the dependencies section. This section have to be removed at next gridsuite-dependencies.version upgrade -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-network-store-model</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,15 @@ private VscConverterStation createConverterStation(Network network,
ConverterStationCreationInfos converterStationCreationInfos,
ReportNode subReportNode,
String logFieldName) {
ReportNode converterStationReporter = subReportNode.newReportNode().withMessageTemplate("converterStationCreationContainer" + logFieldName, logFieldName).add();
ReportNode converterStationReporter = subReportNode.newReportNode()
.withMessageTemplate("converterStationCreated", "${fieldName} with id=${id} created")
.withUntypedValue("fieldName", logFieldName)
.withUntypedValue("id", converterStationCreationInfos.getEquipmentId())
.add();
VoltageLevel voltageLevel = ModificationUtils.getInstance().getVoltageLevel(network, converterStationCreationInfos.getVoltageLevelId());
VscConverterStation vscConverterStation = voltageLevel.getTopologyKind() == TopologyKind.NODE_BREAKER ?
createConverterStationInNodeBreaker(network, voltageLevel, converterStationCreationInfos, converterStationReporter) :
createConverterStationInBusBreaker(voltageLevel, converterStationCreationInfos, converterStationReporter);
converterStationReporter.newReportNode()
.withMessageTemplate("converterStationCreationLog" + logFieldName, "New converter station with id=${id} created")
.withUntypedValue("id", converterStationCreationInfos.getEquipmentId())
.withSeverity(TypedValue.INFO_SEVERITY)
.add();

if (!converterStationCreationInfos.isTerminalConnected()) {
vscConverterStation.getTerminal().disconnect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class ModificationControllerTest {
private static final String URI_NETWORK_WITH_TEE_POINT_MODIF = URI_NETWORK_MODIF_BASE + "?networkUuid=" + TEST_NETWORK_WITH_TEE_POINT_ID + URI_NETWORK_MODIF_PARAMS;

private static final String URI_LINE_CATALOG = URI_NETWORK_MODIF_BASE + "/catalog/line_types";
private static final String LINE_TYPES_CATALOG_JSON_FILE_1 = "/line_types_catalog_1.json";
private static final String LINE_TYPES_CATALOG_JSON_FILE_1 = "/lines-catalog.json";
private static final String LINE_TYPES_CATALOG_JSON_FILE_2 = "/line_types_catalog_2.json";

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public void testCreateWithErrors() throws Exception {
.setId("cantdisconnect")
.setVoltageLevel1("v1")
.setVoltageLevel2("v3")
.setNode1(0)
.setNode2(0)
.setNode1(3)
.setNode2(7)
.setX(12)
.setR(7)
.add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public void testCreateWithErrors() throws Exception {
.setId("cantdisconnect")
.setVoltageLevel1("v1")
.setVoltageLevel2("v3")
.setNode1(0)
.setNode2(0)
.setNode1(100)
.setNode2(100)
.setX(12)
.setR(7)
.add();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ protected Network createNetwork(UUID networkUuid) {

private Line createLineAndSwitches(SwitchKind switchKind, boolean isFictitious) {
VoltageLevel vl2 = getNetwork().getVoltageLevel("vl2");
createSwitch(vl2, "br12", "br12", switchKind, false, false, isFictitious, 3, 2);
createSwitch(vl2, "br22", "br22", switchKind, false, false, isFictitious, 2, 6);
createSwitch(vl2, "br12", "br12", switchKind, false, false, isFictitious, 0, 3);
createSwitch(vl2, "br22", "br22", switchKind, false, false, isFictitious, 0, 3);

return getNetwork().newLine()
.setId("line1")
Expand All @@ -70,7 +70,7 @@ private Line createLineAndSwitches(SwitchKind switchKind, boolean isFictitious)
.setG2(0.0)
.setB1(0.0)
.setB2(0.0)
.setNode1(2)
.setNode1(3)
.setNode2(3)
.add();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testWrongSectionCount() {
@Test
public void testWrongSectionCountChangeSectionCount() {
VoltageLevel v5 = getNetwork().getVoltageLevel("v5");
createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);

var shuntCompensator = getNetwork().getShuntCompensator("v7shunt");
var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class);
Expand All @@ -119,7 +119,7 @@ public void testWrongSectionCountChangeSectionCount() {
@Test
public void testWrongSectionCountChangeMaximumSectionCount() {
VoltageLevel v5 = getNetwork().getVoltageLevel("v5");
createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);

var shuntCompensator = getNetwork().getShuntCompensator("v7shunt");
var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class);
Expand Down Expand Up @@ -157,7 +157,7 @@ public void testNegativeQmaxAtNominalV() {
@Test
public void testCreateModificationWithShuntCompensatorType() {
VoltageLevel v5 = getNetwork().getVoltageLevel("v5");
createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);

var shuntCompensator = getNetwork().getShuntCompensator("v7shunt");
var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class);
Expand All @@ -180,7 +180,7 @@ public void testCreateModificationWithShuntCompensatorType() {
@Test
public void testCreateModificationWithSusceptancePerSection() {
VoltageLevel v5 = getNetwork().getVoltageLevel("v5");
createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);

var shuntCompensator = getNetwork().getShuntCompensator("v7shunt");
var model = shuntCompensator.getModel(ShuntCompensatorLinearModel.class);
Expand Down Expand Up @@ -223,9 +223,9 @@ public void testCreateModificationWithSections() {
@Test
public void testCreateModificationWithQAtNominalV() {
VoltageLevel v5 = getNetwork().getVoltageLevel("v5");
createShuntCompensator(v5, "v7shunt", "v7shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v5, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
VoltageLevel v6 = getNetwork().getVoltageLevel("v6");
createShuntCompensator(v6, "v8shunt", "v8shunt", 6, 225., 10, true, 1, 1, 2, 1, "feeder_v8shunt", 50, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v6, "v8shunt", "v8shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v8shunt", 50, ConnectablePosition.Direction.BOTTOM);

ShuntCompensatorModificationInfos modificationInfos1 = ShuntCompensatorModificationInfos.builder()
.stashed(false)
Expand Down Expand Up @@ -261,7 +261,7 @@ public void testCreateModificationWithQAtNominalV() {
@Override
protected ModificationInfos buildModification() {
VoltageLevel v2 = getNetwork().getVoltageLevel("v2");
createShuntCompensator(v2, "v7shunt", "v7shunt", 15, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);
createShuntCompensator(v2, "v7shunt", "v7shunt", 25, 225., 10, true, 1, 1, 2, 1, "feeder_v7shunt", 40, ConnectablePosition.Direction.BOTTOM);

return ShuntCompensatorModificationInfos.builder()
.stashed(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,42 +143,48 @@ public void testModifyTwtWithWarning() throws Exception {
protected void createEquipments() {
Substation s1 = getNetwork().getSubstation("s1");
Substation s3 = getNetwork().getSubstation("s3");
TwoWindingsTransformer twt1 = createTwoWindingsTransformer(s1, TWT_ID_1, TWT_ID_1, 30, 40, 50, 60, 10, 20, 100, 110,
TwoWindingsTransformer twt1 = createTwoWindingsTransformer(s1, TWT_ID_1, TWT_ID_1, 30, 40, 50,
60, 10, 20, 100, 100,
"v1", "v2",
"trf1", 11, ConnectablePosition.Direction.TOP,
"trf1", 22, ConnectablePosition.Direction.BOTTOM);
twt1.setRatedS(11);
addRatioTapChangerSteps(twt1.newRatioTapChanger().setTargetV(50).setLowTapPosition(0).setTapPosition(1).setTargetDeadband(55));

TwoWindingsTransformer twt2 = createTwoWindingsTransformer(s1, TWT_ID_2, TWT_ID_2, 35, 45, 55, 65, 15, 25, 105, 115,
TwoWindingsTransformer twt2 = createTwoWindingsTransformer(s1, TWT_ID_2, TWT_ID_2, 35, 45, 55,
65, 15, 25, 101, 100,
"v1", "v4",
"trf1", 33, ConnectablePosition.Direction.TOP,
"trf1", 44, ConnectablePosition.Direction.BOTTOM);
twt2.setRatedS(10);
addRatioTapChangerSteps(twt2.newRatioTapChanger().setTargetV(53).setLowTapPosition(3).setTapPosition(4).setTargetDeadband(58));

TwoWindingsTransformer twt3 = createTwoWindingsTransformer(s1, TWT_ID_3, TWT_ID_3, 40, 50, 60, 70, 20, 30, 110, 120,
TwoWindingsTransformer twt3 = createTwoWindingsTransformer(s1, TWT_ID_3, TWT_ID_3, 40, 50, 60,
70, 20, 30, 101, 101,
"v2", "v4",
"trf1", 10, ConnectablePosition.Direction.TOP,
"trf1", 20, ConnectablePosition.Direction.BOTTOM);
twt3.setRatedS(25);
addRatioTapChangerSteps(twt3.newRatioTapChanger().setTargetV(56).setLowTapPosition(0).setTapPosition(1).setTargetDeadband(61));

TwoWindingsTransformer twt4 = createTwoWindingsTransformer(s3, TWT_ID_4, TWT_ID_4, 45, 55, 65, 75, 25, 35, 115, 125,
TwoWindingsTransformer twt4 = createTwoWindingsTransformer(s3, TWT_ID_4, TWT_ID_4, 45, 55, 65,
75, 25, 35, 100, 100,
"v5", "v6",
"trf1", 30, ConnectablePosition.Direction.TOP,
"trf1", 40, ConnectablePosition.Direction.BOTTOM);
twt4.setRatedS(15);
addPhaseTapChangerSteps(twt4.newPhaseTapChanger().setRegulationValue(45).setLowTapPosition(1).setTapPosition(2).setTargetDeadband(34));

TwoWindingsTransformer twt5 = createTwoWindingsTransformer(s3, TWT_ID_5, TWT_ID_5, 50, 60, 70, 80, 30, 40, 120, 130,
TwoWindingsTransformer twt5 = createTwoWindingsTransformer(s3, TWT_ID_5, TWT_ID_5, 50, 60, 70,
80, 30, 40, 101, 101,
"v5", "v6",
"trf1", 15, ConnectablePosition.Direction.TOP,
"trf1", 26, ConnectablePosition.Direction.BOTTOM);
twt5.setRatedS(30);
addPhaseTapChangerSteps(twt5.newPhaseTapChanger().setRegulationValue(46).setLowTapPosition(2).setTapPosition(2).setTargetDeadband(35));

TwoWindingsTransformer twt6 = createTwoWindingsTransformer(s3, TWT_ID_6, TWT_ID_6, 55, 65, 75, 85, 35, 45, 125, 135,
TwoWindingsTransformer twt6 = createTwoWindingsTransformer(s3, TWT_ID_6, TWT_ID_6, 55, 65, 75, 85,
35, 45, 102, 102,
"v5", "v6",
"trf1", 38, ConnectablePosition.Direction.TOP,
"trf1", 49, ConnectablePosition.Direction.BOTTOM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,14 @@ protected void testUpdateModificationMessage(ModificationInfos modificationInfos
@Test
@SneakyThrows
public void testChangeConnectionStatus() {
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, false, "Could not disconnect equipment 'trf1' on side ONE");
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, false, "Could not disconnect equipment 'trf1' on side TWO");
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, true, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.ONE, true, false, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, true, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf1"), TwoSides.TWO, true, false, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.ONE, true, true, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.ONE, true, false, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.TWO, true, true, null);
changeConnectionState(getNetwork().getTwoWindingsTransformer("trf2"), TwoSides.TWO, true, false, "Could not disconnect equipment 'trf2' on side TWO");
}

@SneakyThrows
Expand Down
Loading

0 comments on commit 182ff26

Please sign in to comment.