|
14 | 14 | import com.powsybl.iidm.network.extensions.WindingConnectionType; |
15 | 15 | import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; |
16 | 16 | import com.powsybl.iidm.serde.AbstractIidmSerDeTest; |
| 17 | +import com.powsybl.iidm.serde.ExportOptions; |
| 18 | +import com.powsybl.iidm.serde.IidmVersion; |
17 | 19 | import org.junit.jupiter.api.Test; |
18 | 20 |
|
19 | 21 | import java.io.IOException; |
20 | 22 | import java.time.ZonedDateTime; |
21 | 23 |
|
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; |
23 | 28 |
|
24 | 29 | /** |
25 | 30 | * @author Geoffroy Jamgotchian {@literal <geoffroy.jamgotchian at rte-france.com>} |
@@ -91,4 +96,37 @@ void testXmlSerializerWithMagnetizingReactance() throws IOException { |
91 | 96 | assertEquals(fortescue.isFreeFluxes(), fortescue2.isFreeFluxes()); |
92 | 97 | assertEquals(fortescue.getXm(), fortescue2.getXm()); |
93 | 98 | } |
| 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 | + } |
94 | 132 | } |
0 commit comments