Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to powsybl ws dependencies 2.17.0 #89

Merged
merged 11 commits into from
Jan 15, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ public void visitGenerator(Generator generator) {
assertNull(voltageLevel1.getNodeBreakerView().getTerminal(4));
List<Integer> traversedNodes = new ArrayList<>();
voltageLevel1.getNodeBreakerView().traverse(2, (node1, sw, node2) -> {
traversedNodes.add(node1);
if (!traversedNodes.contains(node1)) {
traversedNodes.add(node1);
}
return TraverseResult.CONTINUE;
});
assertEquals(Arrays.asList(2, 3, 0, 1, 6), traversedNodes);
assertEquals(Arrays.asList(2, 3, 0, 1, 6, 5), traversedNodes);
}
}

Expand Down Expand Up @@ -681,9 +683,9 @@ void testSubstationUpdate() {
s.setTso("New TSO");
s.addGeographicalTag("paris");

verify(mockedListener, times(1)).onUpdate(s, "country", Country.FR, Country.BB);
verify(mockedListener, times(1)).onUpdate(s, "tso", null, "New TSO");
verify(mockedListener, times(1)).onElementAdded(s, "geographicalTags", "paris");
verify(mockedListener, times(1)).onUpdate(s, "country", INITIAL_VARIANT_ID, Country.FR, Country.BB);
verify(mockedListener, times(1)).onUpdate(s, "tso", INITIAL_VARIANT_ID, null, "New TSO");
verify(mockedListener, times(1)).onPropertyAdded(s, "geographicalTags", "paris");

service.flush(readNetwork);
}
Expand Down Expand Up @@ -733,14 +735,14 @@ void substationTest() {
assertEquals(Country.BE, s1.getCountry().get());
assertEquals("TSO_BE", s1.getTso());

verify(mockedListener, times(1)).onUpdate(s1, "country", Country.FR, Country.BE);
verify(mockedListener, times(1)).onUpdate(s1, "tso", "TSO_FR", "TSO_BE");
verify(mockedListener, times(1)).onElementAdded(s1, "geographicalTags", "BELGIUM");
verify(mockedListener, times(1)).onUpdate(s1, "country", INITIAL_VARIANT_ID, Country.FR, Country.BE);
verify(mockedListener, times(1)).onUpdate(s1, "tso", INITIAL_VARIANT_ID, "TSO_FR", "TSO_BE");
verify(mockedListener, times(1)).onPropertyAdded(s1, "geographicalTags", "BELGIUM");

s1.setProperty("testProperty", "original");
verify(mockedListener, times(1)).onElementAdded(s1, "properties[testProperty]", "original");
verify(mockedListener, times(1)).onPropertyAdded(s1, "properties[testProperty]", "original");
s1.setProperty("testProperty", "modified");
verify(mockedListener, times(1)).onElementReplaced(s1, "properties[testProperty]", "original", "modified");
verify(mockedListener, times(1)).onPropertyReplaced(s1, "properties[testProperty]", "original", "modified");
}
}

Expand Down Expand Up @@ -785,9 +787,9 @@ void voltageLevelTest() {
assertEquals(370, vl1.getLowVoltageLimit(), 0.1);
assertEquals(390, vl1.getHighVoltageLimit(), 0.1);

verify(mockedListener, times(1)).onUpdate(vl1, "nominalV", 400d, 380d);
verify(mockedListener, times(1)).onUpdate(vl1, "lowVoltageLimit", 385d, 370d);
verify(mockedListener, times(1)).onUpdate(vl1, "highVoltageLimit", 415d, 390d);
verify(mockedListener, times(1)).onUpdate(vl1, "nominalV", INITIAL_VARIANT_ID, 400d, 380d);
verify(mockedListener, times(1)).onUpdate(vl1, "lowVoltageLimit", INITIAL_VARIANT_ID, 385d, 370d);
verify(mockedListener, times(1)).onUpdate(vl1, "highVoltageLimit", INITIAL_VARIANT_ID, 415d, 390d);
}
}

Expand Down Expand Up @@ -865,12 +867,12 @@ void lineTest() {
assertEquals(8, line.getB1(), 0.1);
assertEquals(16, line.getB2(), 0.1);

verify(mockedListener, times(1)).onUpdate(line, "r", 1d, 5d);
verify(mockedListener, times(1)).onUpdate(line, "x", 3d, 6d);
verify(mockedListener, times(1)).onUpdate(line, "g1", 4d, 12d);
verify(mockedListener, times(1)).onUpdate(line, "g2", 8d, 24d);
verify(mockedListener, times(1)).onUpdate(line, "b1", 2d, 8d);
verify(mockedListener, times(1)).onUpdate(line, "b2", 4d, 16d);
verify(mockedListener, times(1)).onUpdate(line, "r", INITIAL_VARIANT_ID, 1d, 5d);
verify(mockedListener, times(1)).onUpdate(line, "x", INITIAL_VARIANT_ID, 3d, 6d);
verify(mockedListener, times(1)).onUpdate(line, "g1", INITIAL_VARIANT_ID, 4d, 12d);
verify(mockedListener, times(1)).onUpdate(line, "g2", INITIAL_VARIANT_ID, 8d, 24d);
verify(mockedListener, times(1)).onUpdate(line, "b1", INITIAL_VARIANT_ID, 2d, 8d);
verify(mockedListener, times(1)).onUpdate(line, "b2", INITIAL_VARIANT_ID, 4d, 16d);
}
}

Expand Down Expand Up @@ -927,8 +929,8 @@ void batteryTest() {

battery.setMaxP(90);
battery.setMinP(50);
verify(mockedListener, times(1)).onUpdate(battery, "maxP", 70d, 90d);
verify(mockedListener, times(1)).onUpdate(battery, "minP", 40d, 50d);
verify(mockedListener, times(1)).onUpdate(battery, "maxP", INITIAL_VARIANT_ID, 70d, 90d);
verify(mockedListener, times(1)).onUpdate(battery, "minP", INITIAL_VARIANT_ID, 40d, 50d);
}
}

Expand Down Expand Up @@ -1082,18 +1084,18 @@ void danglingLineTest() {
danglingLine.getGeneration().setVoltageRegulationOn(false);

// Check update notification
verify(mockedListener, times(1)).onUpdate(danglingLine, "r", 27d, 25d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "x", 44d, 48d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "g", 89d, 83d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "b", 11d, 15d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "r", INITIAL_VARIANT_ID, 27d, 25d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "x", INITIAL_VARIANT_ID, 44d, 48d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "g", INITIAL_VARIANT_ID, 89d, 83d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "b", INITIAL_VARIANT_ID, 11d, 15d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "p0", INITIAL_VARIANT_ID, 533d, 520d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "q0", INITIAL_VARIANT_ID, 242d, 250d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "minP", 10d, 20d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "maxP", 500d, 900d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "minP", INITIAL_VARIANT_ID, 10d, 20d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "maxP", INITIAL_VARIANT_ID, 500d, 900d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "targetP", INITIAL_VARIANT_ID, 100d, 300d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "targetQ", INITIAL_VARIANT_ID, 200d, 1100d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "targetV", INITIAL_VARIANT_ID, 300d, 350d);
verify(mockedListener, times(1)).onUpdate(danglingLine, "voltageRegulationOn", true, false);
verify(mockedListener, times(1)).onUpdate(danglingLine, "voltageRegulationOn", INITIAL_VARIANT_ID, true, false);

readNetwork.removeListener(mockedListener);

Expand Down Expand Up @@ -1506,14 +1508,14 @@ void twoWindingsTransformerTest() {
assertEquals(120, twoWindingsTransformer.getRatedU2(), 0.1);
assertEquals(100, twoWindingsTransformer.getRatedS(), 0.1);

verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "r", 250d, 280d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "x", 100d, 130d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "g", 52d, 82d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "b", 12d, 42d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedU1", 65d, 95d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedU2", 90d, 120d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedS", 50d, 100d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "fictitious", false, true);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "r", INITIAL_VARIANT_ID, 250d, 280d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "x", INITIAL_VARIANT_ID, 100d, 130d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "g", INITIAL_VARIANT_ID, 52d, 82d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "b", INITIAL_VARIANT_ID, 12d, 42d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedU1", INITIAL_VARIANT_ID, 65d, 95d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedU2", INITIAL_VARIANT_ID, 90d, 120d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "ratedS", INITIAL_VARIANT_ID, 50d, 100d);
verify(mockedListener, times(1)).onUpdate(twoWindingsTransformer, "fictitious", INITIAL_VARIANT_ID, false, true);

readNetwork.removeListener(mockedListener);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public class Mappings {
private static final String SELECTED_OPERATIONAL_LIMITS_GROUP_ID_COLUMN = "selectedOperationalLimitsGroupId";
private static final String SELECTED_OPERATIONAL_LIMITS_GROUP_ID1_COLUMN = "selectedOperationalLimitsGroupId1";
private static final String SELECTED_OPERATIONAL_LIMITS_GROUP_ID2_COLUMN = "selectedOperationalLimitsGroupId2";
private static final String VOLTAGE_REGULATOR_ON = "voltageRegulatorOn";
private static final String MINQ = "minQ";
private static final String MAXQ = "maxQ";
private static final String TIE_LINE_ID = "tieLineId";
Expand Down Expand Up @@ -216,7 +215,6 @@ private void createGeneratorMappings() {
generatorMappings.addColumnMapping("p", new ColumnMapping<>(Double.class, GeneratorAttributes::getP, GeneratorAttributes::setP));
generatorMappings.addColumnMapping("q", new ColumnMapping<>(Double.class, GeneratorAttributes::getQ, GeneratorAttributes::setQ));
generatorMappings.addColumnMapping(FICTITIOUS, new ColumnMapping<>(Boolean.class, GeneratorAttributes::isFictitious, GeneratorAttributes::setFictitious));
generatorMappings.addColumnMapping(VOLTAGE_REGULATOR_ON, new ColumnMapping<>(Boolean.class, GeneratorAttributes::isVoltageRegulatorOn, GeneratorAttributes::setVoltageRegulatorOn));
generatorMappings.addColumnMapping("targetP", new ColumnMapping<>(Double.class, GeneratorAttributes::getTargetP, GeneratorAttributes::setTargetP));
generatorMappings.addColumnMapping("targetQ", new ColumnMapping<>(Double.class, GeneratorAttributes::getTargetQ, GeneratorAttributes::setTargetQ));
generatorMappings.addColumnMapping("targetV", new ColumnMapping<>(Double.class, GeneratorAttributes::getTargetV, GeneratorAttributes::setTargetV));
Expand Down Expand Up @@ -483,7 +481,6 @@ private void createShuntCompensatorMappings() {
shuntCompensatorMappings.addColumnMapping("p", new ColumnMapping<>(Double.class, ShuntCompensatorAttributes::getP, ShuntCompensatorAttributes::setP));
shuntCompensatorMappings.addColumnMapping("q", new ColumnMapping<>(Double.class, ShuntCompensatorAttributes::getQ, ShuntCompensatorAttributes::setQ));
shuntCompensatorMappings.addColumnMapping(FICTITIOUS, new ColumnMapping<>(Boolean.class, ShuntCompensatorAttributes::isFictitious, ShuntCompensatorAttributes::setFictitious));
shuntCompensatorMappings.addColumnMapping(VOLTAGE_REGULATOR_ON, new ColumnMapping<>(Boolean.class, ShuntCompensatorAttributes::isVoltageRegulatorOn, ShuntCompensatorAttributes::setVoltageRegulatorOn));
shuntCompensatorMappings.addColumnMapping("targetV", new ColumnMapping<>(Double.class, ShuntCompensatorAttributes::getTargetV, ShuntCompensatorAttributes::setTargetV));
shuntCompensatorMappings.addColumnMapping("targetDeadband", new ColumnMapping<>(Double.class, ShuntCompensatorAttributes::getTargetDeadband, ShuntCompensatorAttributes::setTargetDeadband));
shuntCompensatorMappings.addColumnMapping("linearModel", new ColumnMapping<>(ShuntCompensatorModelAttributes.class, (ShuntCompensatorAttributes attributes) ->
Expand Down Expand Up @@ -517,7 +514,6 @@ private void createVscConverterStationMappings() {
vscConverterStationMappings.addColumnMapping(VOLTAGE_LEVEL_ID, new ColumnMapping<>(String.class, VscConverterStationAttributes::getVoltageLevelId, VscConverterStationAttributes::setVoltageLevelId));
vscConverterStationMappings.addColumnMapping("bus", new ColumnMapping<>(String.class, VscConverterStationAttributes::getBus, VscConverterStationAttributes::setBus));
vscConverterStationMappings.addColumnMapping(CONNECTABLE_BUS, new ColumnMapping<>(String.class, VscConverterStationAttributes::getConnectableBus, VscConverterStationAttributes::setConnectableBus));
vscConverterStationMappings.addColumnMapping(VOLTAGE_REGULATOR_ON, new ColumnMapping<>(Boolean.class, VscConverterStationAttributes::getVoltageRegulatorOn, VscConverterStationAttributes::setVoltageRegulatorOn));
vscConverterStationMappings.addColumnMapping("p", new ColumnMapping<>(Double.class, VscConverterStationAttributes::getP, VscConverterStationAttributes::setP));
vscConverterStationMappings.addColumnMapping("q", new ColumnMapping<>(Double.class, VscConverterStationAttributes::getQ, VscConverterStationAttributes::setQ));
vscConverterStationMappings.addColumnMapping("lossFactor", new ColumnMapping<>(Float.class, VscConverterStationAttributes::getLossFactor, VscConverterStationAttributes::setLossFactor));
Expand Down
Loading
Loading