Skip to content

Commit

Permalink
update to powsybl-ws-dependencies 2.7.0 (#17)
Browse files Browse the repository at this point in the history
Signed-off-by: BOUHOURS Antoine <[email protected]>
  • Loading branch information
antoinebhs authored Feb 2, 2024
1 parent cbecc92 commit 4ea840f
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 86 deletions.
2 changes: 1 addition & 1 deletion network-store-iidm-tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-xml-converter</artifactId>
<artifactId>powsybl-iidm-serde</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion network-store-integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- test scope -->
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-xml-converter</artifactId>
<artifactId>powsybl-iidm-serde</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
package com.powsybl.network.store.integration;

import com.powsybl.iidm.network.*;
import org.joda.time.DateTime;

import java.time.ZonedDateTime;
import java.util.Objects;

/**
Expand All @@ -28,7 +28,7 @@ public static Network create(NetworkFactory networkFactory) {
Objects.requireNonNull(networkFactory);

Network network = networkFactory.createNetwork("networkTestCase", "code");
network.setCaseDate(DateTime.parse("2016-06-29T14:54:03.427+02:00"));
network.setCaseDate(ZonedDateTime.parse("2016-06-29T14:54:03.427+02:00"));
Substation s1 = network.newSubstation()
.setId("S1")
.setCountry(Country.FR)
Expand Down Expand Up @@ -340,20 +340,20 @@ public static Network create(NetworkFactory networkFactory) {
.setRatedU(9)
.add()
.add();
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE).setP(375);
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO).setP(225);
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE).setP(200);
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE).setQ(48);
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO).setQ(28);
threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE).setQ(18);
threeWindingsTransformer.getTerminal(ThreeSides.ONE).setP(375);
threeWindingsTransformer.getTerminal(ThreeSides.TWO).setP(225);
threeWindingsTransformer.getTerminal(ThreeSides.THREE).setP(200);
threeWindingsTransformer.getTerminal(ThreeSides.ONE).setQ(48);
threeWindingsTransformer.getTerminal(ThreeSides.TWO).setQ(28);
threeWindingsTransformer.getTerminal(ThreeSides.THREE).setQ(18);

threeWindingsTransformer.getLeg1().newPhaseTapChanger()
.setLowTapPosition(0)
.setTapPosition(0)
.setRegulating(true)
.setRegulationMode(PhaseTapChanger.RegulationMode.CURRENT_LIMITER)
.setRegulationValue(25)
.setRegulationTerminal(threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE))
.setRegulationTerminal(threeWindingsTransformer.getTerminal(ThreeSides.ONE))
.setTargetDeadband(22)
.beginStep()
.setAlpha(-10)
Expand Down Expand Up @@ -384,7 +384,7 @@ public static Network create(NetworkFactory networkFactory) {
.setLowTapPosition(0)
.setTapPosition(0)
.setRegulating(false)
.setRegulationTerminal(threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE))
.setRegulationTerminal(threeWindingsTransformer.getTerminal(ThreeSides.ONE))
.setTargetDeadband(22)
.setTargetV(220)
.beginStep()
Expand Down Expand Up @@ -462,10 +462,10 @@ public static Network create(NetworkFactory networkFactory) {
.setRatedS(50)
.add();

twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setP(375);
twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setP(225);
twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).setQ(48);
twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).setQ(28);
twoWindingsTransformer.getTerminal(TwoSides.ONE).setP(375);
twoWindingsTransformer.getTerminal(TwoSides.TWO).setP(225);
twoWindingsTransformer.getTerminal(TwoSides.ONE).setQ(48);
twoWindingsTransformer.getTerminal(TwoSides.TWO).setQ(28);

ShuntCompensator shunt1 = vl1.newShuntCompensator()
.setId("SHUNT1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import com.powsybl.commons.datasource.ResourceSet;
import com.powsybl.commons.extensions.Extension;
import com.powsybl.commons.reporter.ReporterModel;
import com.powsybl.entsoe.util.*;
import com.powsybl.entsoe.util.EntsoeArea;
import com.powsybl.entsoe.util.EntsoeAreaImpl;
import com.powsybl.entsoe.util.EntsoeGeographicalCode;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.extensions.*;
import com.powsybl.iidm.network.test.*;
Expand Down Expand Up @@ -1338,22 +1340,22 @@ public void threeWindingsTransformerTest() {
assertEquals(19, threeWindingsTransformer.getLeg3().getB(), 0.1);
assertEquals(9, threeWindingsTransformer.getLeg3().getRatedU(), 0.1);

assertEquals(375, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE).getP(), 0.1);
assertEquals(225, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO).getP(), 0.1);
assertEquals(200, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE).getP(), 0.1);
assertEquals(375, threeWindingsTransformer.getTerminal(ThreeSides.ONE).getP(), 0.1);
assertEquals(225, threeWindingsTransformer.getTerminal(ThreeSides.TWO).getP(), 0.1);
assertEquals(200, threeWindingsTransformer.getTerminal(ThreeSides.THREE).getP(), 0.1);

assertEquals(48, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE).getQ(), 0.1);
assertEquals(28, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO).getQ(), 0.1);
assertEquals(18, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE).getQ(), 0.1);
assertEquals(48, threeWindingsTransformer.getTerminal(ThreeSides.ONE).getQ(), 0.1);
assertEquals(28, threeWindingsTransformer.getTerminal(ThreeSides.TWO).getQ(), 0.1);
assertEquals(18, threeWindingsTransformer.getTerminal(ThreeSides.THREE).getQ(), 0.1);

assertEquals(1, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE).getNodeBreakerView().getNode());
assertEquals(2, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO).getNodeBreakerView().getNode());
assertEquals(3, threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE).getNodeBreakerView().getNode());
assertEquals(1, threeWindingsTransformer.getTerminal(ThreeSides.ONE).getNodeBreakerView().getNode());
assertEquals(2, threeWindingsTransformer.getTerminal(ThreeSides.TWO).getNodeBreakerView().getNode());
assertEquals(3, threeWindingsTransformer.getTerminal(ThreeSides.THREE).getNodeBreakerView().getNode());

assertEquals(3, threeWindingsTransformer.getTerminals().size());
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.ONE)));
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.TWO)));
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeWindingsTransformer.Side.THREE)));
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeSides.ONE)));
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeSides.TWO)));
assertTrue(threeWindingsTransformer.getTerminals().contains(threeWindingsTransformer.getTerminal(ThreeSides.THREE)));

PhaseTapChanger phaseTapChanger = threeWindingsTransformer.getLeg1().getPhaseTapChanger();
assertEqualsPhaseTapChangerStep(phaseTapChanger.getStep(0), -10, 1.5, 0.5, 1., 0.99, 4.);
Expand Down Expand Up @@ -1447,15 +1449,15 @@ public void twoWindingsTransformerTest() {
assertEquals(90, twoWindingsTransformer.getRatedU2(), 0.1);
assertEquals(50, twoWindingsTransformer.getRatedS(), 0.1);

assertEquals(375, twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).getP(), 0.1);
assertEquals(225, twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).getP(), 0.1);
assertEquals(375, twoWindingsTransformer.getTerminal(TwoSides.ONE).getP(), 0.1);
assertEquals(225, twoWindingsTransformer.getTerminal(TwoSides.TWO).getP(), 0.1);

assertEquals(48, twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE).getQ(), 0.1);
assertEquals(28, twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO).getQ(), 0.1);
assertEquals(48, twoWindingsTransformer.getTerminal(TwoSides.ONE).getQ(), 0.1);
assertEquals(28, twoWindingsTransformer.getTerminal(TwoSides.TWO).getQ(), 0.1);

assertEquals(2, twoWindingsTransformer.getTerminals().size());
assertTrue(twoWindingsTransformer.getTerminals().contains(twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.ONE)));
assertTrue(twoWindingsTransformer.getTerminals().contains(twoWindingsTransformer.getTerminal(TwoWindingsTransformer.Side.TWO)));
assertTrue(twoWindingsTransformer.getTerminals().contains(twoWindingsTransformer.getTerminal(TwoSides.ONE)));
assertTrue(twoWindingsTransformer.getTerminals().contains(twoWindingsTransformer.getTerminal(TwoSides.TWO)));

service.flush(readNetwork); // flush the network
}
Expand Down Expand Up @@ -2375,8 +2377,8 @@ public void testUcteNetwork() {
assertEquals(3.5, tieLine2.getDanglingLine2().getG(), ESP);
assertEquals(5.5, tieLine2.getDanglingLine2().getR(), ESP);
assertEquals(6.5, tieLine2.getDanglingLine2().getX(), ESP);
assertEquals("DL1", tieLine2.getDanglingLine(Branch.Side.ONE).getId());
assertEquals("DL2", tieLine2.getDanglingLine(Branch.Side.TWO).getId());
assertEquals("DL1", tieLine2.getDanglingLine(TwoSides.ONE).getId());
assertEquals("DL2", tieLine2.getDanglingLine(TwoSides.TWO).getId());

Line regularLine = readNetwork.getLine("F_SU1_12 F_SU2_11 2");

Expand Down Expand Up @@ -2761,17 +2763,17 @@ public void visitBusbarSection(BusbarSection section) {
}

@Override
public void visitLine(Line line, Branch.Side side) {
public void visitLine(Line line, TwoSides side) {
visitedConnectables.add(line.getId());
}

@Override
public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, Branch.Side side) {
public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, TwoSides side) {
visitedConnectables.add(transformer.getId());
}

@Override
public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeWindingsTransformer.Side side) {
public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeSides side) {
visitedConnectables.add(transformer.getId());
}

Expand Down Expand Up @@ -4035,33 +4037,33 @@ public void testVisit2WTConnectedInOneVLOnlyIssue() {
String filePath = "/BrranchConnectedInOneVLOnlyIssue.uct";
ReadOnlyDataSource dataSource = getResource(filePath, filePath);
Network network = new UcteImporter().importData(dataSource, new NetworkFactoryImpl(), null);
Set<Branch.Side> visitedLineSides = new HashSet<>();
Set<Branch.Side> visited2WTSides = new HashSet<>();
Set<ThreeWindingsTransformer.Side> visited3WTSides = new HashSet<>();
Set<TwoSides> visitedLineSides = new HashSet<>();
Set<TwoSides> visited2WTSides = new HashSet<>();
Set<ThreeSides> visited3WTSides = new HashSet<>();
network.getVoltageLevelStream().findFirst().get().visitEquipments(new DefaultTopologyVisitor() {
@Override
public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, Branch.Side side) {
public void visitTwoWindingsTransformer(TwoWindingsTransformer transformer, TwoSides side) {
visited2WTSides.add(side);
}

@Override
public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeWindingsTransformer.Side side) {
public void visitThreeWindingsTransformer(ThreeWindingsTransformer transformer, ThreeSides side) {
visited3WTSides.add(side);
}

@Override
public void visitLine(Line line, Branch.Side side) {
public void visitLine(Line line, TwoSides side) {
visitedLineSides.add(side);
}
});

assertEquals(2, visitedLineSides.size());
assertTrue(visitedLineSides.contains(Branch.Side.ONE));
assertTrue(visitedLineSides.contains(Branch.Side.TWO));
assertTrue(visitedLineSides.contains(TwoSides.ONE));
assertTrue(visitedLineSides.contains(TwoSides.TWO));

assertEquals(2, visited2WTSides.size());
assertTrue(visited2WTSides.contains(Branch.Side.ONE));
assertTrue(visited2WTSides.contains(Branch.Side.TWO));
assertTrue(visited2WTSides.contains(TwoSides.ONE));
assertTrue(visited2WTSides.contains(TwoSides.TWO));

assertEquals(0, visited3WTSides.size());
}
Expand Down Expand Up @@ -4637,7 +4639,8 @@ public void testImportWithReport() {
ReporterModel report = new ReporterModel("test", "test");

service.importNetwork(getResource("test.xiidm", "/"), report);
assertTrue(report.getSubReporters().isEmpty());
// There are validationWarnings and xiidmImportDone by default with SerDe
assertFalse(report.getSubReporters().isEmpty());

service.importNetwork(getResource("uctNetwork.uct", "/"), report);
assertFalse(report.getSubReporters().isEmpty());
Expand Down
4 changes: 0 additions & 4 deletions network-store-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down
Loading

0 comments on commit 4ea840f

Please sign in to comment.