Skip to content

Commit

Permalink
Fix Matpower phase shifter import (#1910)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Anne Tilloy <[email protected]>
  • Loading branch information
geofjamg authored and miovd committed Jan 5, 2022
1 parent 5d410ac commit 54bd551
Show file tree
Hide file tree
Showing 5 changed files with 767 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,19 @@ private static void createBranches(MatpowerModel model, ContainersMapping contai
.setG(0)
.setB(mBranch.getB() / zb)
.add();
if (mBranch.getPhaseShiftAngle() != 0) {
newTwt.newPhaseTapChanger()
.setTapPosition(0)
.beginStep()
.setRho(1)
.setAlpha(-mBranch.getPhaseShiftAngle())
.setR(0)
.setX(0)
.setG(0)
.setB(0)
.endStep()
.add();
}
LOGGER.trace("Created TwoWindingsTransformer {} {} {}", newTwt.getId(), bus1Id, bus2Id);
} else {
Line newLine = network.newLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public void testCase14() throws IOException {
testCase(MatpowerModelFactory.create14());
}

@Test
public void testCase14WithPhaseShifter() throws IOException {
testCase(MatpowerModelFactory.create14WithPhaseShifter());
}

@Test
public void testCase30() throws IOException {
testCase(MatpowerModelFactory.create30());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<iidm:network xmlns:iidm="http://www.powsybl.org/schema/iidm/1_6" xmlns:slt="http://www.powsybl.org/schema/iidm/ext/slack_terminal/1_3" id="ieee14-phase-shifter" caseDate="2020-01-01T00:00:00.000Z" forecastDistance="0" sourceFormat="MATPOWER">
<iidm:substation id="SUB-8">
<iidm:voltageLevel id="VL-1" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-1" v="1.06" angle="0.0"/>
</iidm:busBreakerTopology>
<iidm:generator id="GEN-1" energySource="OTHER" minP="0.0" maxP="332.4" voltageRegulatorOn="true" targetP="232.4" targetV="1.06" targetQ="-16.9" bus="BUS-1" connectableBus="BUS-1">
<iidm:minMaxReactiveLimits minQ="0.0" maxQ="10.0"/>
</iidm:generator>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-9">
<iidm:voltageLevel id="VL-2" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-2" v="1.045" angle="-4.98"/>
</iidm:busBreakerTopology>
<iidm:generator id="GEN-2" energySource="OTHER" minP="0.0" maxP="140.0" voltageRegulatorOn="true" targetP="40.0" targetV="1.045" targetQ="42.4" bus="BUS-2" connectableBus="BUS-2">
<iidm:minMaxReactiveLimits minQ="-40.0" maxQ="50.0"/>
</iidm:generator>
<iidm:load id="LOAD-2" loadType="UNDEFINED" p0="21.7" q0="12.7" bus="BUS-2" connectableBus="BUS-2"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-10">
<iidm:voltageLevel id="VL-3" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-3" v="1.01" angle="-12.72"/>
</iidm:busBreakerTopology>
<iidm:generator id="GEN-3" energySource="OTHER" minP="0.0" maxP="100.0" voltageRegulatorOn="true" targetP="0.0" targetV="1.01" targetQ="23.4" bus="BUS-3" connectableBus="BUS-3">
<iidm:minMaxReactiveLimits minQ="0.0" maxQ="40.0"/>
</iidm:generator>
<iidm:load id="LOAD-3" loadType="UNDEFINED" p0="94.2" q0="19.0" bus="BUS-3" connectableBus="BUS-3"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-4">
<iidm:voltageLevel id="VL-4" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-4" v="1.019" angle="-10.33"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-4" loadType="UNDEFINED" p0="47.8" q0="-3.9" bus="BUS-4" connectableBus="BUS-4"/>
</iidm:voltageLevel>
<iidm:voltageLevel id="VL-7" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-7" v="1.062" angle="-13.37"/>
</iidm:busBreakerTopology>
</iidm:voltageLevel>
<iidm:voltageLevel id="VL-9" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-9" v="1.056" angle="-14.94"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-9" loadType="UNDEFINED" p0="29.5" q0="16.6" bus="BUS-9" connectableBus="BUS-9"/>
<iidm:shunt id="SHUNT-9" sectionCount="1" voltageRegulatorOn="false" bus="BUS-9" connectableBus="BUS-9">
<iidm:shuntLinearModel bPerSection="19.0" maximumSectionCount="1"/>
</iidm:shunt>
</iidm:voltageLevel>
<iidm:twoWindingsTransformer id="TWT-4-7" r="0.0" x="0.0020912" g="0.0" b="0.0" ratedU1="0.978" ratedU2="1.0" bus1="BUS-4" connectableBus1="BUS-4" voltageLevelId1="VL-4" bus2="BUS-7" connectableBus2="BUS-7" voltageLevelId2="VL-7">
<iidm:phaseTapChanger lowTapPosition="0" tapPosition="0" regulationMode="FIXED_TAP">
<iidm:step r="0.0" x="0.0" g="0.0" b="0.0" rho="1.0" alpha="5.0"/>
</iidm:phaseTapChanger>
</iidm:twoWindingsTransformer>
<iidm:twoWindingsTransformer id="TWT-4-9" r="0.0" x="0.0055618" g="0.0" b="0.0" ratedU1="0.969" ratedU2="1.0" bus1="BUS-4" connectableBus1="BUS-4" voltageLevelId1="VL-4" bus2="BUS-9" connectableBus2="BUS-9" voltageLevelId2="VL-9"/>
</iidm:substation>
<iidm:substation id="SUB-11">
<iidm:voltageLevel id="VL-5" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-5" v="1.02" angle="-8.78"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-5" loadType="UNDEFINED" p0="7.6" q0="1.6" bus="BUS-5" connectableBus="BUS-5"/>
</iidm:voltageLevel>
<iidm:voltageLevel id="VL-6" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-6" v="1.07" angle="-14.22"/>
</iidm:busBreakerTopology>
<iidm:generator id="GEN-6" energySource="OTHER" minP="0.0" maxP="100.0" voltageRegulatorOn="true" targetP="0.0" targetV="1.07" targetQ="12.2" bus="BUS-6" connectableBus="BUS-6">
<iidm:minMaxReactiveLimits minQ="-6.0" maxQ="24.0"/>
</iidm:generator>
<iidm:load id="LOAD-6" loadType="UNDEFINED" p0="11.2" q0="7.5" bus="BUS-6" connectableBus="BUS-6"/>
</iidm:voltageLevel>
<iidm:twoWindingsTransformer id="TWT-5-6" r="0.0" x="0.0025202000000000002" g="0.0" b="0.0" ratedU1="0.932" ratedU2="1.0" bus1="BUS-5" connectableBus1="BUS-5" voltageLevelId1="VL-5" bus2="BUS-6" connectableBus2="BUS-6" voltageLevelId2="VL-6"/>
</iidm:substation>
<iidm:substation id="SUB-6">
<iidm:voltageLevel id="VL-8" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-8" v="1.09" angle="-13.36"/>
</iidm:busBreakerTopology>
<iidm:generator id="GEN-8" energySource="OTHER" minP="0.0" maxP="100.0" voltageRegulatorOn="true" targetP="0.0" targetV="1.09" targetQ="17.4" bus="BUS-8" connectableBus="BUS-8">
<iidm:minMaxReactiveLimits minQ="-6.0" maxQ="24.0"/>
</iidm:generator>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-7">
<iidm:voltageLevel id="VL-10" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-10" v="1.051" angle="-15.1"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-10" loadType="UNDEFINED" p0="9.0" q0="5.8" bus="BUS-10" connectableBus="BUS-10"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-5">
<iidm:voltageLevel id="VL-11" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-11" v="1.057" angle="-14.79"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-11" loadType="UNDEFINED" p0="3.5" q0="1.8" bus="BUS-11" connectableBus="BUS-11"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-3">
<iidm:voltageLevel id="VL-12" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-12" v="1.055" angle="-15.07"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-12" loadType="UNDEFINED" p0="6.1" q0="1.6" bus="BUS-12" connectableBus="BUS-12"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-2">
<iidm:voltageLevel id="VL-13" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-13" v="1.05" angle="-15.16"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-13" loadType="UNDEFINED" p0="13.5" q0="5.8" bus="BUS-13" connectableBus="BUS-13"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:substation id="SUB-1">
<iidm:voltageLevel id="VL-14" nominalV="1.0" topologyKind="BUS_BREAKER">
<iidm:busBreakerTopology>
<iidm:bus id="BUS-14" v="1.036" angle="-16.04"/>
</iidm:busBreakerTopology>
<iidm:load id="LOAD-14" loadType="UNDEFINED" p0="14.9" q0="5.0" bus="BUS-14" connectableBus="BUS-14"/>
</iidm:voltageLevel>
</iidm:substation>
<iidm:line id="LINE-1-2" r="1.9380000000000002E-4" x="5.917E-4" g1="0.0" b1="2.64" g2="0.0" b2="2.64" bus1="BUS-1" connectableBus1="BUS-1" voltageLevelId1="VL-1" bus2="BUS-2" connectableBus2="BUS-2" voltageLevelId2="VL-2"/>
<iidm:line id="LINE-1-5" r="5.403000000000001E-4" x="0.0022304" g1="0.0" b1="2.46" g2="0.0" b2="2.46" bus1="BUS-1" connectableBus1="BUS-1" voltageLevelId1="VL-1" bus2="BUS-5" connectableBus2="BUS-5" voltageLevelId2="VL-5"/>
<iidm:line id="LINE-2-3" r="4.699E-4" x="0.0019797" g1="0.0" b1="2.19" g2="0.0" b2="2.19" bus1="BUS-2" connectableBus1="BUS-2" voltageLevelId1="VL-2" bus2="BUS-3" connectableBus2="BUS-3" voltageLevelId2="VL-3"/>
<iidm:line id="LINE-2-4" r="5.811000000000001E-4" x="0.0017632000000000001" g1="0.0" b1="1.7000000000000002" g2="0.0" b2="1.7000000000000002" bus1="BUS-2" connectableBus1="BUS-2" voltageLevelId1="VL-2" bus2="BUS-4" connectableBus2="BUS-4" voltageLevelId2="VL-4"/>
<iidm:line id="LINE-2-5" r="5.695E-4" x="0.0017388000000000002" g1="0.0" b1="1.73" g2="0.0" b2="1.73" bus1="BUS-2" connectableBus1="BUS-2" voltageLevelId1="VL-2" bus2="BUS-5" connectableBus2="BUS-5" voltageLevelId2="VL-5"/>
<iidm:line id="LINE-3-4" r="6.701E-4" x="0.0017102999999999999" g1="0.0" b1="0.64" g2="0.0" b2="0.64" bus1="BUS-3" connectableBus1="BUS-3" voltageLevelId1="VL-3" bus2="BUS-4" connectableBus2="BUS-4" voltageLevelId2="VL-4"/>
<iidm:line id="LINE-4-5" r="1.3350000000000002E-4" x="4.2110000000000004E-4" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-4" connectableBus1="BUS-4" voltageLevelId1="VL-4" bus2="BUS-5" connectableBus2="BUS-5" voltageLevelId2="VL-5"/>
<iidm:line id="LINE-6-11" r="9.498E-4" x="0.001989" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-6" connectableBus1="BUS-6" voltageLevelId1="VL-6" bus2="BUS-11" connectableBus2="BUS-11" voltageLevelId2="VL-11"/>
<iidm:line id="LINE-6-12" r="0.0012291000000000001" x="0.0025581" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-6" connectableBus1="BUS-6" voltageLevelId1="VL-6" bus2="BUS-12" connectableBus2="BUS-12" voltageLevelId2="VL-12"/>
<iidm:line id="LINE-6-13" r="6.615E-4" x="0.0013027" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-6" connectableBus1="BUS-6" voltageLevelId1="VL-6" bus2="BUS-13" connectableBus2="BUS-13" voltageLevelId2="VL-13"/>
<iidm:line id="LINE-7-8" r="0.0" x="0.0017615" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-7" connectableBus1="BUS-7" voltageLevelId1="VL-7" bus2="BUS-8" connectableBus2="BUS-8" voltageLevelId2="VL-8"/>
<iidm:line id="LINE-7-9" r="0.0" x="0.0011001" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-7" connectableBus1="BUS-7" voltageLevelId1="VL-7" bus2="BUS-9" connectableBus2="BUS-9" voltageLevelId2="VL-9"/>
<iidm:line id="LINE-9-10" r="3.181E-4" x="8.45E-4" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-9" connectableBus1="BUS-9" voltageLevelId1="VL-9" bus2="BUS-10" connectableBus2="BUS-10" voltageLevelId2="VL-10"/>
<iidm:line id="LINE-9-14" r="0.0012711" x="0.0027038" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-9" connectableBus1="BUS-9" voltageLevelId1="VL-9" bus2="BUS-14" connectableBus2="BUS-14" voltageLevelId2="VL-14"/>
<iidm:line id="LINE-10-11" r="8.205E-4" x="0.0019207" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-10" connectableBus1="BUS-10" voltageLevelId1="VL-10" bus2="BUS-11" connectableBus2="BUS-11" voltageLevelId2="VL-11"/>
<iidm:line id="LINE-12-13" r="0.0022092" x="0.0019988000000000002" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-12" connectableBus1="BUS-12" voltageLevelId1="VL-12" bus2="BUS-13" connectableBus2="BUS-13" voltageLevelId2="VL-13"/>
<iidm:line id="LINE-13-14" r="0.0017093" x="0.0034802" g1="0.0" b1="0.0" g2="0.0" b2="0.0" bus1="BUS-13" connectableBus1="BUS-13" voltageLevelId1="VL-13" bus2="BUS-14" connectableBus2="BUS-14" voltageLevelId2="VL-14"/>
<iidm:extension id="VL-1">
<slt:slackTerminal id="GEN-1"/>
</iidm:extension>
</iidm:network>
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public static MatpowerModel create14() {
return readModelJsonFromResources("ieee14.json");
}

public static MatpowerModel create14WithPhaseShifter() {
return readModelJsonFromResources("ieee14-phase-shifter.json");
}

public static MatpowerModel create30() {
return readModelJsonFromResources("ieee30.json");
}
Expand Down
Loading

0 comments on commit 54bd551

Please sign in to comment.