diff --git a/matpower/matpower-converter/src/main/java/com/powsybl/matpower/converter/MatpowerExporter.java b/matpower/matpower-converter/src/main/java/com/powsybl/matpower/converter/MatpowerExporter.java index 6b4c8a9e5f7..be93d93f9dd 100644 --- a/matpower/matpower-converter/src/main/java/com/powsybl/matpower/converter/MatpowerExporter.java +++ b/matpower/matpower-converter/src/main/java/com/powsybl/matpower/converter/MatpowerExporter.java @@ -17,7 +17,6 @@ import com.powsybl.iidm.network.extensions.SlackTerminal; import com.powsybl.iidm.network.util.HvdcUtils; import com.powsybl.matpower.model.*; - import org.apache.commons.math3.complex.Complex; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,6 +25,8 @@ import java.io.OutputStream; import java.io.UncheckedIOException; import java.util.*; +import java.util.function.DoubleUnaryOperator; +import java.util.stream.Stream; /** * @author Geoffroy Jamgotchian @@ -220,11 +221,137 @@ private static void createBuses(Network network, MatpowerModel model, Context co createTransformerStarBuses(network, model, context); } + private static boolean isEmergencyLimit(LoadingLimits.TemporaryLimit limit) { + return limit.getAcceptableDuration() <= 60; + } + + private static Optional findShortTermLimit(Stream limitStream) { + return limitStream.filter(limit -> !isEmergencyLimit(limit)) + .max(Comparator.comparing(LoadingLimits.TemporaryLimit::getAcceptableDuration)); + } + + private static Optional findEmergencyLimit(Stream limitStream) { + return limitStream.filter(MatpowerExporter::isEmergencyLimit) + .min(Comparator.comparing(LoadingLimits.TemporaryLimit::getAcceptableDuration)); + } + + private static Optional previousLimit(Collection limits, LoadingLimits.TemporaryLimit limit) { + return limits.stream().filter(l -> l.getAcceptableDuration() > limit.getAcceptableDuration()) + .min(Comparator.comparing(LoadingLimits.TemporaryLimit::getAcceptableDuration)); + } + + private static Optional nextLimit(Collection limits, LoadingLimits.TemporaryLimit limit) { + return limits.stream().filter(l -> l.getAcceptableDuration() < limit.getAcceptableDuration()) + .max(Comparator.comparing(LoadingLimits.TemporaryLimit::getAcceptableDuration)); + } + + private static double toApparentPower(double current, VoltageLevel vl) { + return current * vl.getNominalV() / 1000d; + } + + private static void createLimits(MBranch mBranch, LoadingLimits limits, DoubleUnaryOperator converter) { + // rateA is mapped to permanent limit + if (!Double.isNaN(limits.getPermanentLimit())) { + mBranch.setRateA(converter.applyAsDouble(limits.getPermanentLimit())); + } + // rateB is mapped to the shortest term limit, if not an emergency limit (tempo <= 60s) + LoadingLimits.TemporaryLimit limitB = findShortTermLimit(limits.getTemporaryLimits().stream()) + .filter(limit -> !isEmergencyLimit(limit) && limit.getValue() != Double.MAX_VALUE) + .orElse(null); + if (limitB != null) { + mBranch.setRateB(converter.applyAsDouble(limitB.getValue())); + } + // rateC is mapped to the emergency limit (tempo <= 60s) + findEmergencyLimit(limits.getTemporaryLimits().stream()) + .flatMap(limit -> previousLimit(limits.getTemporaryLimits(), limit)) + .filter(limit -> limitB == null || limit.getAcceptableDuration() != limitB.getAcceptableDuration()) + .ifPresent(limitC -> mBranch.setRateC(converter.applyAsDouble(limitC.getValue()))); + } + + private static void createLimits(List limitsHolders, VoltageLevel vl, MBranch mBranch) { + limitsHolders.stream().flatMap(limitsHolder -> Stream.concat(limitsHolder.getApparentPowerLimits().stream(), // apparrent power limits first then current limits + limitsHolder.getCurrentLimits().stream())) + .filter(limits -> !Double.isNaN(limits.getPermanentLimit())) // skip when there is no permanent + .max(Comparator.comparingInt(loadingLimit -> loadingLimit.getTemporaryLimits().size())) // many tempary limits first + .ifPresent(limits -> { + if (limits.getLimitType() == LimitType.CURRENT) { + createLimits(mBranch, limits, current -> toApparentPower(current, vl)); // convert from A to MVA + } else { + createLimits(mBranch, limits, DoubleUnaryOperator.identity()); + } + }); + } + + /** + * Arbitrary adapted on side one. + */ + private static class FlowsLimitsHolderBranchAdapter implements FlowsLimitsHolder { + + private final Branch branch; + + private final Branch.Side side; + + public FlowsLimitsHolderBranchAdapter(Branch branch, Branch.Side side) { + this.branch = branch; + this.side = side; + } + + @Override + public Optional getCurrentLimits() { + return branch.getCurrentLimits(side); + } + + @Override + public CurrentLimits getNullableCurrentLimits() { + return branch.getNullableCurrentLimits(side); + } + + @Override + public Optional getActivePowerLimits() { + return branch.getActivePowerLimits(side); + } + + @Override + public ActivePowerLimits getNullableActivePowerLimits() { + return branch.getNullableActivePowerLimits(side); + } + + @Override + public Optional getApparentPowerLimits() { + return branch.getApparentPowerLimits(side); + } + + @Override + public ApparentPowerLimits getNullableApparentPowerLimits() { + return branch.getNullableApparentPowerLimits(side); + } + + @Override + public CurrentLimitsAdder newCurrentLimits() { + throw new UnsupportedOperationException(); + } + + @Override + public ApparentPowerLimitsAdder newApparentPowerLimits() { + throw new UnsupportedOperationException(); + } + + @Override + public ActivePowerLimitsAdder newActivePowerLimits() { + throw new UnsupportedOperationException(); + } + } + private void createLines(Network network, MatpowerModel model, Context context) { for (Line l : network.getLines()) { Terminal t1 = l.getTerminal1(); Terminal t2 = l.getTerminal2(); - createMBranch(t1, t2, l.getR(), l.getX(), l.getB1(), l.getB2(), context).ifPresent(model::addBranch); + createMBranch(t1, t2, l.getR(), l.getX(), l.getB1(), l.getB2(), context) + .ifPresent(branch -> { + createLimits(List.of(new FlowsLimitsHolderBranchAdapter(l, Branch.Side.ONE), new FlowsLimitsHolderBranchAdapter(l, Branch.Side.TWO)), + t1.getVoltageLevel(), branch); + model.addBranch(branch); + }); } } @@ -265,6 +392,8 @@ private void createTransformers2(Network network, MatpowerModel model, Context c mBranch.setR(r / zb); mBranch.setX(x / zb); mBranch.setB(b * zb); + createLimits(List.of(new FlowsLimitsHolderBranchAdapter(twt, Branch.Side.ONE), new FlowsLimitsHolderBranchAdapter(twt, Branch.Side.TWO)), + t1.getVoltageLevel(), mBranch); model.addBranch(mBranch); } } @@ -274,7 +403,12 @@ private void createTieLines(Network network, MatpowerModel model, Context contex for (TieLine l : network.getTieLines()) { Terminal t1 = l.getDanglingLine1().getTerminal(); Terminal t2 = l.getDanglingLine2().getTerminal(); - createMBranch(t1, t2, l.getR(), l.getX(), l.getB1(), l.getB2(), context).ifPresent(model::addBranch); + createMBranch(t1, t2, l.getR(), l.getX(), l.getB1(), l.getB2(), context) + .ifPresent(branch -> { + createLimits(List.of(new FlowsLimitsHolderBranchAdapter(l, Branch.Side.ONE), new FlowsLimitsHolderBranchAdapter(l, Branch.Side.TWO)), + t1.getVoltageLevel(), branch); + model.addBranch(branch); + }); } } @@ -336,6 +470,7 @@ private void createDanglingLineBranches(Network network, MatpowerModel model, Co mBranch.setR(dl.getR() / zb); mBranch.setX(dl.getX() / zb); mBranch.setB(dl.getB() * zb); + createLimits(List.of(dl), t.getVoltageLevel(), mBranch); model.addBranch(mBranch); } } @@ -389,6 +524,7 @@ private static MBranch createTransformerLeg(ThreeWindingsTransformer twt, ThreeW mBranch.setX(x / zb); mBranch.setB(b * zb); mBranch.setRatio(1d / rho); + createLimits(List.of(leg), leg.getTerminal().getVoltageLevel(), mBranch); return mBranch; } diff --git a/matpower/matpower-converter/src/test/java/com/powsybl/matpower/converter/MatpowerExporterTest.java b/matpower/matpower-converter/src/test/java/com/powsybl/matpower/converter/MatpowerExporterTest.java index 7ca1c21f0ba..2689fee1000 100644 --- a/matpower/matpower-converter/src/test/java/com/powsybl/matpower/converter/MatpowerExporterTest.java +++ b/matpower/matpower-converter/src/test/java/com/powsybl/matpower/converter/MatpowerExporterTest.java @@ -14,6 +14,7 @@ import com.powsybl.commons.datasource.FileDataSource; import com.powsybl.commons.datasource.MemDataSource; import com.powsybl.commons.test.AbstractConverterTest; +import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.NetworkFactory; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; @@ -128,6 +129,60 @@ void testNonRegulatingGenOnPVBus() throws IOException { exportToMatAndCompareTo(network, "/sim1-with-non-regulating-gen.json"); } + @Test + void testWithCurrentLimits() throws IOException { + var network = EurostagTutorialExample1Factory.createWithFixedCurrentLimits(); + exportToMatAndCompareTo(network, "/sim1-with-current-limits.json"); + } + + @Test + void testWithCurrentLimits2() throws IOException { + var network = EurostagTutorialExample1Factory.create(); + Line line = network.getLine("NHV1_NHV2_1"); + line.newCurrentLimits1() + .setPermanentLimit(1000) + .beginTemporaryLimit() + .setName("20'") + .setAcceptableDuration(20 * 60) + .setValue(1100) + .endTemporaryLimit() + .beginTemporaryLimit() + .setName("10'") + .setAcceptableDuration(10 * 60) + .setValue(1200) + .endTemporaryLimit() + .beginTemporaryLimit() + .setName("1'") + .setAcceptableDuration(60) + .setValue(1300) + .endTemporaryLimit() + .beginTemporaryLimit() + .setName("N/A") + .setAcceptableDuration(0) + .setValue(Double.MAX_VALUE) + .endTemporaryLimit() + .add(); + exportToMatAndCompareTo(network, "/sim1-with-current-limits2.json"); + } + + @Test + void testWithApparentPowerLimits() throws IOException { + var network = EurostagTutorialExample1Factory.createWithFixedCurrentLimits(); + var l = network.getLine("NHV1_NHV2_1"); + l.newApparentPowerLimits1() + .setPermanentLimit(1000) + .beginTemporaryLimit() + .setName("1'") + .setAcceptableDuration(60) + .setValue(1500) + .endTemporaryLimit() + .add(); + l.newCurrentLimits2() + .setPermanentLimit(1000) + .add(); + exportToMatAndCompareTo(network, "/sim1-with-apparent-power-limits.json"); + } + @Test void testNanTargetQIssue() throws IOException { var network = EurostagTutorialExample1Factory.create(); diff --git a/matpower/matpower-converter/src/test/resources/be.json b/matpower/matpower-converter/src/test/resources/be.json index 424e0f796e7..60fd21b94ad 100644 --- a/matpower/matpower-converter/src/test/resources/be.json +++ b/matpower/matpower-converter/src/test/resources/be.json @@ -234,9 +234,9 @@ "r" : 0.003822222222222222, "x" : 0.06755555555555556, "b" : 0.021470821875, - "rateA" : 0.0, + "rateA" : 324.675, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 354.15, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -248,9 +248,9 @@ "r" : 0.010277530864197533, "x" : 0.1402469135802469, "b" : 0.010131024374999999, - "rateA" : 0.0, + "rateA" : 265.5, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 295.2, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -262,9 +262,9 @@ "r" : 8.192122993395951E-4, "x" : 0.04571631170550064, "b" : -0.010613320515218202, - "rateA" : 0.0, + "rateA" : 143.891, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 154.891, "ratio" : 1.0277920081967213, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -276,9 +276,9 @@ "r" : 0.0018325490000000002, "x" : 0.021670694575077892, "b" : 0.0, - "rateA" : 0.0, + "rateA" : 383.805, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 406.305, "ratio" : 0.9453778319888644, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -290,9 +290,9 @@ "r" : 0.0016923075000000005, "x" : 0.009074315000000001, "b" : 0.0, - "rateA" : 0.0, + "rateA" : 356.516, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 364.116, "ratio" : 1.0526315789473684, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -304,9 +304,9 @@ "r" : 0.004345679012345679, "x" : 0.13471604938271606, "b" : 0.0419873625, - "rateA" : 0.0, + "rateA" : 324.675, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 354.15, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -318,9 +318,9 @@ "r" : 7.271468144044322E-4, "x" : 0.008310249307479225, "b" : 0.216389176, - "rateA" : 0.0, + "rateA" : 520.98, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 548.34, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -332,9 +332,9 @@ "r" : 2.9085872576177285E-4, "x" : 0.004362880886426592, "b" : 0.0952655896, - "rateA" : 0.0, + "rateA" : 685.52, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 712.88, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -346,9 +346,9 @@ "r" : 0.00908641975308642, "x" : 0.1362962962962963, "b" : 0.010973981249999999, - "rateA" : 0.0, + "rateA" : 265.5, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 295.2, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -360,9 +360,9 @@ "r" : 1.6620498614958447E-4, "x" : 0.0013850415512465374, "b" : 0.0363824464, - "rateA" : 0.0, + "rateA" : 465.88, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 493.62, "ratio" : 0.0, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -374,9 +374,9 @@ "r" : 5.6153875E-4, "x" : 0.010752580000000001, "b" : 0.0039, - "rateA" : 0.0, + "rateA" : 356.516, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 367.916, "ratio" : 1.0526315789473684, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -388,9 +388,9 @@ "r" : 6.692314049586775E-4, "x" : 0.0122915, "b" : 0.0, - "rateA" : 0.0, + "rateA" : 383.805, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 406.305, "ratio" : 0.9777777777777777, "phaseShiftAngle" : 0.0, "status" : 1.0, @@ -402,9 +402,9 @@ "r" : 0.00302312925170068, "x" : 0.013600453514739229, "b" : 0.0, - "rateA" : 0.0, + "rateA" : 375.27840000000003, "rateB" : 0.0, - "rateC" : 0.0, + "rateC" : 396.27840000000003, "ratio" : 1.0, "phaseShiftAngle" : 0.0, "status" : 1.0, diff --git a/matpower/matpower-converter/src/test/resources/fourSubstationFactory.json b/matpower/matpower-converter/src/test/resources/fourSubstationFactory.json index 2395ba5e8a0..f70f6e17ab7 100644 --- a/matpower/matpower-converter/src/test/resources/fourSubstationFactory.json +++ b/matpower/matpower-converter/src/test/resources/fourSubstationFactory.json @@ -157,8 +157,8 @@ "r" : 6.249999375E-6, "x" : 0.008187500015, "b" : 0.0, - "rateA" : 0.0, - "rateB" : 0.0, + "rateA" : 372.4, + "rateB" : 656.0, "rateC" : 0.0, "ratio" : 0.0, "phaseShiftAngle" : 0.0, diff --git a/matpower/matpower-converter/src/test/resources/sim1-with-apparent-power-limits.json b/matpower/matpower-converter/src/test/resources/sim1-with-apparent-power-limits.json new file mode 100644 index 00000000000..d2f353ef93c --- /dev/null +++ b/matpower/matpower-converter/src/test/resources/sim1-with-apparent-power-limits.json @@ -0,0 +1,168 @@ +{ + "caseName" : "sim1", + "baseMva" : 100.0, + "version" : "2", + "buses" : [ { + "number" : 1, + "type" : "PV", + "name" : "VLGEN_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 24.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + }, { + "number" : 2, + "type" : "REF", + "name" : "VLHV1_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 1.3157894736842106, + "minimumVoltageMagnitude" : 1.0526315789473684 + }, { + "number" : 3, + "type" : "PQ", + "name" : "VLHV2_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 1.3157894736842106, + "minimumVoltageMagnitude" : 0.7894736842105263 + }, { + "number" : 4, + "type" : "PQ", + "name" : "VLLOAD_0", + "realPowerDemand" : 600.0, + "reactivePowerDemand" : 200.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 150.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + } ], + "generators" : [ { + "number" : 1, + "realPowerOutput" : 607.0, + "reactivePowerOutput" : 301.0, + "maximumReactivePowerOutput" : 9999.99, + "minimumReactivePowerOutput" : -9999.99, + "voltageMagnitudeSetpoint" : 1.0208333333333333, + "totalMbase" : 0.0, + "status" : 1, + "maximumRealPowerOutput" : 9999.99, + "minimumRealPowerOutput" : -9999.99, + "pc1" : 0.0, + "pc2" : 0.0, + "qc1Min" : 0.0, + "qc1Max" : 0.0, + "qc2Min" : 0.0, + "qc2Max" : 0.0, + "rampAgc" : 0.0, + "rampTenMinutes" : 0.0, + "rampThirtyMinutes" : 0.0, + "rampQ" : 0.0, + "apf" : 0.0 + }, { + "number" : 1, + "realPowerOutput" : 607.0, + "reactivePowerOutput" : 301.0, + "maximumReactivePowerOutput" : 1.7976931348623157E308, + "minimumReactivePowerOutput" : -1.7976931348623157E308, + "voltageMagnitudeSetpoint" : 1.0208333333333333, + "totalMbase" : 0.0, + "status" : 1, + "maximumRealPowerOutput" : 9999.99, + "minimumRealPowerOutput" : -9999.99, + "pc1" : 0.0, + "pc2" : 0.0, + "qc1Min" : 0.0, + "qc1Max" : 0.0, + "qc2Min" : 0.0, + "qc2Max" : 0.0, + "rampAgc" : 0.0, + "rampTenMinutes" : 0.0, + "rampThirtyMinutes" : 0.0, + "rampQ" : 0.0, + "apf" : 0.0 + } ], + "branches" : [ { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 1000.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 418.0, + "rateB" : 456.0, + "rateC" : 0.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 1, + "to" : 2, + "r" : 1.846153846153846E-4, + "x" : 0.007690091988585015, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9500000000000001, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 3, + "to" : 4, + "r" : 2.0999999999999998E-4, + "x" : 0.017998774958313132, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9986679988158019, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + } ] +} \ No newline at end of file diff --git a/matpower/matpower-converter/src/test/resources/sim1-with-current-limits.json b/matpower/matpower-converter/src/test/resources/sim1-with-current-limits.json new file mode 100644 index 00000000000..3e1d315274f --- /dev/null +++ b/matpower/matpower-converter/src/test/resources/sim1-with-current-limits.json @@ -0,0 +1,168 @@ +{ + "caseName" : "sim1", + "baseMva" : 100.0, + "version" : "2", + "buses" : [ { + "number" : 1, + "type" : "PV", + "name" : "VLGEN_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 24.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + }, { + "number" : 2, + "type" : "REF", + "name" : "VLHV1_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 1.3157894736842106, + "minimumVoltageMagnitude" : 1.0526315789473684 + }, { + "number" : 3, + "type" : "PQ", + "name" : "VLHV2_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 1.3157894736842106, + "minimumVoltageMagnitude" : 0.7894736842105263 + }, { + "number" : 4, + "type" : "PQ", + "name" : "VLLOAD_0", + "realPowerDemand" : 600.0, + "reactivePowerDemand" : 200.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 150.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + } ], + "generators" : [ { + "number" : 1, + "realPowerOutput" : 607.0, + "reactivePowerOutput" : 301.0, + "maximumReactivePowerOutput" : 9999.99, + "minimumReactivePowerOutput" : -9999.99, + "voltageMagnitudeSetpoint" : 1.0208333333333333, + "totalMbase" : 0.0, + "status" : 1, + "maximumRealPowerOutput" : 9999.99, + "minimumRealPowerOutput" : -9999.99, + "pc1" : 0.0, + "pc2" : 0.0, + "qc1Min" : 0.0, + "qc1Max" : 0.0, + "qc2Min" : 0.0, + "qc2Max" : 0.0, + "rampAgc" : 0.0, + "rampTenMinutes" : 0.0, + "rampThirtyMinutes" : 0.0, + "rampQ" : 0.0, + "apf" : 0.0 + }, { + "number" : 1, + "realPowerOutput" : 607.0, + "reactivePowerOutput" : 301.0, + "maximumReactivePowerOutput" : 1.7976931348623157E308, + "minimumReactivePowerOutput" : -1.7976931348623157E308, + "voltageMagnitudeSetpoint" : 1.0208333333333333, + "totalMbase" : 0.0, + "status" : 1, + "maximumRealPowerOutput" : 9999.99, + "minimumRealPowerOutput" : -9999.99, + "pc1" : 0.0, + "pc2" : 0.0, + "qc1Min" : 0.0, + "qc1Max" : 0.0, + "qc2Min" : 0.0, + "qc2Max" : 0.0, + "rampAgc" : 0.0, + "rampTenMinutes" : 0.0, + "rampThirtyMinutes" : 0.0, + "rampQ" : 0.0, + "apf" : 0.0 + } ], + "branches" : [ { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 418.0, + "rateB" : 456.0, + "rateC" : 570.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 418.0, + "rateB" : 456.0, + "rateC" : 0.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 1, + "to" : 2, + "r" : 1.846153846153846E-4, + "x" : 0.007690091988585015, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9500000000000001, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 3, + "to" : 4, + "r" : 2.0999999999999998E-4, + "x" : 0.017998774958313132, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9986679988158019, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + } ] +} \ No newline at end of file diff --git a/matpower/matpower-converter/src/test/resources/sim1-with-current-limits2.json b/matpower/matpower-converter/src/test/resources/sim1-with-current-limits2.json new file mode 100644 index 00000000000..0c2aa9e6516 --- /dev/null +++ b/matpower/matpower-converter/src/test/resources/sim1-with-current-limits2.json @@ -0,0 +1,146 @@ +{ + "caseName" : "sim1", + "baseMva" : 100.0, + "version" : "2", + "buses" : [ { + "number" : 1, + "type" : "PV", + "name" : "VLGEN_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 24.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + }, { + "number" : 2, + "type" : "REF", + "name" : "VLHV1_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + }, { + "number" : 3, + "type" : "PQ", + "name" : "VLHV2_0", + "realPowerDemand" : 0.0, + "reactivePowerDemand" : 0.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 380.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + }, { + "number" : 4, + "type" : "PQ", + "name" : "VLLOAD_0", + "realPowerDemand" : 600.0, + "reactivePowerDemand" : 200.0, + "shuntConductance" : 0.0, + "shuntSusceptance" : 0.0, + "areaNumber" : 1, + "voltageMagnitude" : 1.0, + "voltageAngle" : 0.0, + "baseVoltage" : 150.0, + "lossZone" : 1, + "maximumVoltageMagnitude" : 0.0, + "minimumVoltageMagnitude" : 0.0 + } ], + "generators" : [ { + "number" : 1, + "realPowerOutput" : 607.0, + "reactivePowerOutput" : 301.0, + "maximumReactivePowerOutput" : 9999.99, + "minimumReactivePowerOutput" : -9999.99, + "voltageMagnitudeSetpoint" : 1.0208333333333333, + "totalMbase" : 0.0, + "status" : 1, + "maximumRealPowerOutput" : 9999.99, + "minimumRealPowerOutput" : -9999.99, + "pc1" : 0.0, + "pc2" : 0.0, + "qc1Min" : 0.0, + "qc1Max" : 0.0, + "qc2Min" : 0.0, + "qc2Max" : 0.0, + "rampAgc" : 0.0, + "rampTenMinutes" : 0.0, + "rampThirtyMinutes" : 0.0, + "rampQ" : 0.0, + "apf" : 0.0 + } ], + "branches" : [ { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 380.0, + "rateB" : 418.0, + "rateC" : 494.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 2, + "to" : 3, + "r" : 0.002077562326869806, + "x" : 0.022853185595567867, + "b" : 0.557384, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.0, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 1, + "to" : 2, + "r" : 1.846153846153846E-4, + "x" : 0.007690091988585015, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9500000000000001, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + }, { + "from" : 3, + "to" : 4, + "r" : 2.0999999999999998E-4, + "x" : 0.017998774958313132, + "b" : 0.0, + "rateA" : 0.0, + "rateB" : 0.0, + "rateC" : 0.0, + "ratio" : 0.9986679988158019, + "phaseShiftAngle" : 0.0, + "status" : 1.0, + "angMin" : 0.0, + "angMax" : 0.0 + } ] +} \ No newline at end of file