Skip to content

Commit cbc84ac

Browse files
committed
Add test for version 1.0.
Signed-off-by: Coline Piloquet <coline.piloquet@rte-france.com>
1 parent f789925 commit cbc84ac

File tree

2 files changed

+84
-1
lines changed

2 files changed

+84
-1
lines changed

iidm/iidm-serde/src/test/java/com/powsybl/iidm/serde/extensions/TwoWindingsTransformerFortescueXmlSerDeTest.java

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414
import com.powsybl.iidm.network.extensions.WindingConnectionType;
1515
import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory;
1616
import com.powsybl.iidm.serde.AbstractIidmSerDeTest;
17+
import com.powsybl.iidm.serde.ExportOptions;
18+
import com.powsybl.iidm.serde.IidmVersion;
1719
import org.junit.jupiter.api.Test;
1820

1921
import java.io.IOException;
2022
import java.time.ZonedDateTime;
2123

22-
import static org.junit.jupiter.api.Assertions.*;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
25+
import static org.junit.jupiter.api.Assertions.assertNotNull;
26+
import static org.junit.jupiter.api.Assertions.assertSame;
27+
import static org.junit.jupiter.api.Assertions.assertTrue;
2328

2429
/**
2530
* @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>}
@@ -91,4 +96,37 @@ void testXmlSerializerWithMagnetizingReactance() throws IOException {
9196
assertEquals(fortescue.isFreeFluxes(), fortescue2.isFreeFluxes());
9297
assertEquals(fortescue.getXm(), fortescue2.getXm());
9398
}
99+
100+
@Test
101+
void testV10() throws IOException {
102+
Network network = EurostagTutorialExample1Factory.create();
103+
network.setCaseDate(ZonedDateTime.parse("2016-12-07T11:18:52.881+01:00"));
104+
var twt = network.getTwoWindingsTransformer("NGEN_NHV1");
105+
assertNotNull(twt);
106+
TwoWindingsTransformerFortescue fortescue = twt.newExtension(TwoWindingsTransformerFortescueAdder.class)
107+
.withRz(0.1d)
108+
.withXz(2d)
109+
.withFreeFluxes(false)
110+
.withXm(0.5d)
111+
.withConnectionType1(WindingConnectionType.Y_GROUNDED)
112+
.withConnectionType2(WindingConnectionType.DELTA)
113+
.withGroundingR1(0.02d)
114+
.withGroundingX1(0.3d)
115+
.withGroundingR2(0.04d)
116+
.withGroundingX2(0.95d)
117+
.add();
118+
119+
Network network2 = allFormatsRoundTripTest(network, "/fortescue/twoWindingsTransformerFortescueRef_V1_0.xml",
120+
new ExportOptions()
121+
.addExtensionVersion(TwoWindingsTransformerFortescue.NAME, "1.0")
122+
.setVersion(IidmVersion.V_1_14.toString(".")));
123+
124+
TwoWindingsTransformer twt2 = network2.getTwoWindingsTransformer("NGEN_NHV1");
125+
assertNotNull(twt2);
126+
TwoWindingsTransformerFortescue fortescue2 = twt2.getExtension(TwoWindingsTransformerFortescue.class);
127+
assertNotNull(fortescue2);
128+
129+
assertEquals(fortescue.isFreeFluxes(), fortescue2.isFreeFluxes());
130+
assertTrue(Double.isNaN(fortescue2.getXm()));
131+
}
94132
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<iidm:network xmlns:iidm="http://www.powsybl.org/schema/iidm/1_14" xmlns:t2f="http://www.powsybl.org/schema/iidm/ext/two_windings_transformer_fortescue/1_0" id="sim1" caseDate="2016-12-07T11:18:52.881+01:00" forecastDistance="0" sourceFormat="test" minimumValidationLevel="STEADY_STATE_HYPOTHESIS">
3+
<iidm:substation id="P1" country="FR" tso="RTE" geographicalTags="A">
4+
<iidm:voltageLevel id="VLGEN" nominalV="24.0" topologyKind="BUS_BREAKER">
5+
<iidm:busBreakerTopology>
6+
<iidm:bus id="NGEN"/>
7+
</iidm:busBreakerTopology>
8+
<iidm:generator id="GEN" energySource="OTHER" minP="-9999.99" maxP="9999.99" voltageRegulatorOn="true" targetP="607.0" targetV="24.5" targetQ="301.0" bus="NGEN" connectableBus="NGEN">
9+
<iidm:minMaxReactiveLimits minQ="-9999.99" maxQ="9999.99"/>
10+
</iidm:generator>
11+
</iidm:voltageLevel>
12+
<iidm:voltageLevel id="VLHV1" nominalV="380.0" topologyKind="BUS_BREAKER">
13+
<iidm:busBreakerTopology>
14+
<iidm:bus id="NHV1"/>
15+
</iidm:busBreakerTopology>
16+
</iidm:voltageLevel>
17+
<iidm:twoWindingsTransformer id="NGEN_NHV1" r="0.26658461538461536" x="11.104492831516762" g="0.0" b="0.0" ratedU1="24.0" ratedU2="400.0" bus1="NGEN" connectableBus1="NGEN" voltageLevelId1="VLGEN" bus2="NHV1" connectableBus2="NHV1" voltageLevelId2="VLHV1"/>
18+
</iidm:substation>
19+
<iidm:substation id="P2" country="FR" tso="RTE" geographicalTags="B">
20+
<iidm:voltageLevel id="VLHV2" nominalV="380.0" topologyKind="BUS_BREAKER">
21+
<iidm:busBreakerTopology>
22+
<iidm:bus id="NHV2"/>
23+
</iidm:busBreakerTopology>
24+
</iidm:voltageLevel>
25+
<iidm:voltageLevel id="VLLOAD" nominalV="150.0" topologyKind="BUS_BREAKER">
26+
<iidm:busBreakerTopology>
27+
<iidm:bus id="NLOAD"/>
28+
</iidm:busBreakerTopology>
29+
<iidm:load id="LOAD" loadType="UNDEFINED" p0="600.0" q0="200.0" bus="NLOAD" connectableBus="NLOAD"/>
30+
</iidm:voltageLevel>
31+
<iidm:twoWindingsTransformer id="NHV2_NLOAD" r="0.04724999999999999" x="4.049724365620455" g="0.0" b="0.0" ratedU1="400.0" ratedU2="158.0" bus1="NHV2" connectableBus1="NHV2" voltageLevelId1="VLHV2" bus2="NLOAD" connectableBus2="NLOAD" voltageLevelId2="VLLOAD">
32+
<iidm:ratioTapChanger lowTapPosition="0" tapPosition="1" targetDeadband="0.0" loadTapChangingCapabilities="true" regulating="true" regulationMode="VOLTAGE" regulationValue="158.0">
33+
<iidm:terminalRef id="NHV2_NLOAD" side="TWO"/>
34+
<iidm:step r="0.0" x="0.0" g="0.0" b="0.0" rho="0.8505666905244191"/>
35+
<iidm:step r="0.0" x="0.0" g="0.0" b="0.0" rho="1.0006666666666666"/>
36+
<iidm:step r="0.0" x="0.0" g="0.0" b="0.0" rho="1.150766642808914"/>
37+
</iidm:ratioTapChanger>
38+
</iidm:twoWindingsTransformer>
39+
</iidm:substation>
40+
<iidm:line id="NHV1_NHV2_1" r="3.0" x="33.0" g1="0.0" b1="1.93E-4" g2="0.0" b2="1.93E-4" bus1="NHV1" connectableBus1="NHV1" voltageLevelId1="VLHV1" bus2="NHV2" connectableBus2="NHV2" voltageLevelId2="VLHV2"/>
41+
<iidm:line id="NHV1_NHV2_2" r="3.0" x="33.0" g1="0.0" b1="1.93E-4" g2="0.0" b2="1.93E-4" bus1="NHV1" connectableBus1="NHV1" voltageLevelId1="VLHV1" bus2="NHV2" connectableBus2="NHV2" voltageLevelId2="VLHV2"/>
42+
<iidm:extension id="NGEN_NHV1">
43+
<t2f:twoWindingsTransformerFortescue rz="0.1" xz="2.0" freeFluxes="false" connectionType1="Y_GROUNDED" connectionType2="DELTA" groundingR1="0.02" groundingX1="0.3" groundingR2="0.04" groundingX2="0.95"/>
44+
</iidm:extension>
45+
</iidm:network>

0 commit comments

Comments
 (0)