From b0c2d983f7996133eb5ef96c9fab623fcf4c6bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Thu, 21 Mar 2024 15:05:23 +0100 Subject: [PATCH 01/10] copy of the imported PSSE model to make the updates and export (deep copy) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../powsybl/psse/converter/BusConverter.java | 18 +++---- .../FixedShuntCompensatorConverter.java | 14 ++--- .../psse/converter/GeneratorConverter.java | 16 +++--- .../powsybl/psse/converter/LineConverter.java | 12 ++--- .../powsybl/psse/converter/LoadConverter.java | 16 +++--- .../powsybl/psse/converter/PsseExporter.java | 41 +++++---------- .../SwitchedShuntCompensatorConverter.java | 16 +++--- .../psse/converter/TransformerConverter.java | 52 +++++++++---------- .../psse/converter/PsseExporterTest.java | 46 ++++++++++++++++ .../com/powsybl/psse/model/pf/PsseBus.java | 18 +++++++ .../powsybl/psse/model/pf/PsseFixedShunt.java | 10 ++++ .../powsybl/psse/model/pf/PsseGenerator.java | 28 ++++++++++ .../com/powsybl/psse/model/pf/PsseLoad.java | 24 +++++++++ .../model/pf/PsseNonTransformerBranch.java | 21 ++++++++ .../psse/model/pf/PssePowerFlowModel.java | 33 ++++++++++++ .../com/powsybl/psse/model/pf/PsseRates.java | 20 +++++++ .../psse/model/pf/PsseSwitchedShunt.java | 42 +++++++++++++++ .../psse/model/pf/PsseTransformer.java | 43 +++++++++++++++ .../psse/model/pf/PsseTransformerWinding.java | 20 +++++++ 19 files changed, 377 insertions(+), 113 deletions(-) diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/BusConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/BusConverter.java index 7a1c4e65664..4308ce28a8b 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/BusConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/BusConverter.java @@ -6,7 +6,6 @@ */ package com.powsybl.psse.converter; -import java.util.Collections; import java.util.Objects; import com.powsybl.iidm.network.Bus; @@ -38,20 +37,17 @@ void create(VoltageLevel voltageLevel) { } // At the moment we do not consider new buses - static void updateBuses(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateBuses(Network network, PssePowerFlowModel psseModel) { psseModel.getBuses().forEach(psseBus -> { - updatePsseModel.addBuses(Collections.singletonList(psseBus)); - PsseBus updatePsseBus = updatePsseModel.getBuses().get(updatePsseModel.getBuses().size() - 1); - - String busId = AbstractConverter.getBusId(updatePsseBus.getI()); + String busId = AbstractConverter.getBusId(psseBus.getI()); Bus bus = network.getBusBreakerView().getBus(busId); if (bus == null) { - updatePsseBus.setVm(0.0); - updatePsseBus.setVa(0.0); - updatePsseBus.setIde(4); + psseBus.setVm(0.0); + psseBus.setVa(0.0); + psseBus.setIde(4); } else { - updatePsseBus.setVm(bus.getV() / bus.getVoltageLevel().getNominalV()); - updatePsseBus.setVa(bus.getAngle()); + psseBus.setVm(bus.getV() / bus.getVoltageLevel().getNominalV()); + psseBus.setVa(bus.getAngle()); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/FixedShuntCompensatorConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/FixedShuntCompensatorConverter.java index e6f196a2c2a..6bb3acba4f4 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/FixedShuntCompensatorConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/FixedShuntCompensatorConverter.java @@ -6,7 +6,6 @@ */ package com.powsybl.psse.converter; -import java.util.Collections; import java.util.Objects; import com.powsybl.iidm.network.*; @@ -61,18 +60,15 @@ private static String getShuntId(String busId, String fixedShuntId) { } // At the moment we do not consider new fixedShunts - static void updateFixedShunts(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateFixedShunts(Network network, PssePowerFlowModel psseModel) { psseModel.getFixedShunts().forEach(psseFixedShunt -> { - updatePsseModel.addFixedShunts(Collections.singletonList(psseFixedShunt)); - PsseFixedShunt updatePsseFixedShunt = updatePsseModel.getFixedShunts().get(updatePsseModel.getFixedShunts().size() - 1); - - String fixedShuntId = getShuntId(getBusId(updatePsseFixedShunt.getI()), updatePsseFixedShunt.getId()); + String fixedShuntId = getShuntId(getBusId(psseFixedShunt.getI()), psseFixedShunt.getId()); ShuntCompensator fixedShunt = network.getShuntCompensator(fixedShuntId); if (fixedShunt == null) { - updatePsseFixedShunt.setStatus(0); + psseFixedShunt.setStatus(0); } else { - updatePsseFixedShunt.setStatus(getStatus(fixedShunt)); - updatePsseFixedShunt.setBl(getQ(fixedShunt)); + psseFixedShunt.setStatus(getStatus(fixedShunt)); + psseFixedShunt.setBl(getQ(fixedShunt)); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java index fdcecb460a6..fd50b489c52 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java @@ -6,7 +6,6 @@ */ package com.powsybl.psse.converter; -import java.util.Collections; import java.util.Objects; import org.slf4j.Logger; @@ -120,19 +119,16 @@ private static String getGeneratorId(String busId, String generatorId) { } // At the moment we do not consider new generators - static void updateGenerators(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateGenerators(Network network, PssePowerFlowModel psseModel) { psseModel.getGenerators().forEach(psseGen -> { - updatePsseModel.addGenerators(Collections.singletonList(psseGen)); - PsseGenerator updatePsseGen = updatePsseModel.getGenerators().get(updatePsseModel.getGenerators().size() - 1); - - String genId = getGeneratorId(getBusId(updatePsseGen.getI()), updatePsseGen.getId()); + String genId = getGeneratorId(getBusId(psseGen.getI()), psseGen.getId()); Generator gen = network.getGenerator(genId); if (gen == null) { - updatePsseGen.setStat(0); + psseGen.setStat(0); } else { - updatePsseGen.setStat(getStatus(gen)); - updatePsseGen.setPg(getP(gen)); - updatePsseGen.setQg(getQ(gen)); + psseGen.setStat(getStatus(gen)); + psseGen.setPg(getP(gen)); + psseGen.setQg(getQ(gen)); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LineConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LineConverter.java index 7cd13263e96..b9a38cc12fa 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LineConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LineConverter.java @@ -23,7 +23,6 @@ import static com.powsybl.psse.model.PsseVersion.Major.V35; -import java.util.Collections; import java.util.Objects; /** @@ -118,17 +117,14 @@ private static String getLineId(PsseNonTransformerBranch psseLine) { } // At the moment we do not consider new lines and antenna lines are exported as open - static void updateLines(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateLines(Network network, PssePowerFlowModel psseModel) { psseModel.getNonTransformerBranches().forEach(psseLine -> { - updatePsseModel.addNonTransformerBranches(Collections.singletonList(psseLine)); - PsseNonTransformerBranch updatePsseLine = updatePsseModel.getNonTransformerBranches().get(updatePsseModel.getNonTransformerBranches().size() - 1); - - String lineId = getLineId(updatePsseLine); + String lineId = getLineId(psseLine); Line line = network.getLine(lineId); if (line == null) { - updatePsseLine.setSt(0); + psseLine.setSt(0); } else { - updatePsseLine.setSt(getStatus(line)); + psseLine.setSt(getStatus(line)); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LoadConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LoadConverter.java index f4ebf754670..1e8b476232e 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LoadConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/LoadConverter.java @@ -6,7 +6,6 @@ */ package com.powsybl.psse.converter; -import java.util.Collections; import java.util.Objects; import com.powsybl.iidm.network.Load; @@ -92,19 +91,16 @@ private static String getLoadId(String busId, String loadId) { } // At the moment we do not consider new loads - static void updateLoads(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateLoads(Network network, PssePowerFlowModel psseModel) { psseModel.getLoads().forEach(psseLoad -> { - updatePsseModel.addLoads(Collections.singletonList(psseLoad)); - PsseLoad updatePsseLoad = updatePsseModel.getLoads().get(updatePsseModel.getLoads().size() - 1); - - String loadId = getLoadId(getBusId(updatePsseLoad.getI()), updatePsseLoad.getId()); + String loadId = getLoadId(getBusId(psseLoad.getI()), psseLoad.getId()); Load load = network.getLoad(loadId); if (load == null) { - updatePsseLoad.setStatus(0); + psseLoad.setStatus(0); } else { - updatePsseLoad.setStatus(getStatus(load)); - updatePsseLoad.setPl(getP(load)); - updatePsseLoad.setQl(getQ(load)); + psseLoad.setStatus(getStatus(load)); + psseLoad.setPl(getP(load)); + psseLoad.setQl(getQ(load)); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/PsseExporter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/PsseExporter.java index c33a1f6c5aa..4cead8d50ff 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/PsseExporter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/PsseExporter.java @@ -108,36 +108,23 @@ public void export(Network network, Properties parameters, DataSource dataSource } } + // New equipment is not supported + // Antennas (Branches connected only at one end) are exported as out of service (both sides open) private static PssePowerFlowModel createUpdatePsseModel(Network network, PssePowerFlowModel psseModel) { - PssePowerFlowModel updatePsseModel = new PssePowerFlowModel(psseModel.getCaseIdentification()); - - copyPermanentBlocks(psseModel, updatePsseModel); - updateModifiedBlocks(network, psseModel, updatePsseModel); - return updatePsseModel; + // Only the updated blocks are copied, non-updated blocks are referenced + PssePowerFlowModel referencedAndCopiedPsseModel = psseModel.referenceAndCopyPssePowerFlowModel(); + updateModifiedBlocks(network, referencedAndCopiedPsseModel); + return referencedAndCopiedPsseModel; } - private static void copyPermanentBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { - updatePsseModel.addAreas(psseModel.getAreas()); - updatePsseModel.addTwoTerminalDcTransmissionLines(psseModel.getTwoTerminalDcTransmissionLines()); - updatePsseModel.addVoltageSourceConverterDcTransmissionLines(psseModel.getVoltageSourceConverterDcTransmissionLines()); - updatePsseModel.addTransformerImpedanceCorrections(psseModel.getTransformerImpedanceCorrections()); - updatePsseModel.addMultiTerminalDcTransmissionLines(psseModel.getMultiTerminalDcTransmissionLines()); - updatePsseModel.addLineGrouping(psseModel.getLineGrouping()); - updatePsseModel.addZones(psseModel.getZones()); - updatePsseModel.addInterareaTransfer(psseModel.getInterareaTransfer()); - updatePsseModel.addOwners(psseModel.getOwners()); - updatePsseModel.addFacts(psseModel.getFacts()); - updatePsseModel.addGneDevice(psseModel.getGneDevice()); - updatePsseModel.addInductionMachines(psseModel.getInductionMachines()); - } + private static void updateModifiedBlocks(Network network, PssePowerFlowModel referencedAndCopiedPsseModel) { - private static void updateModifiedBlocks(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { - BusConverter.updateBuses(network, psseModel, updatePsseModel); - LoadConverter.updateLoads(network, psseModel, updatePsseModel); - FixedShuntCompensatorConverter.updateFixedShunts(network, psseModel, updatePsseModel); - GeneratorConverter.updateGenerators(network, psseModel, updatePsseModel); - LineConverter.updateLines(network, psseModel, updatePsseModel); - TransformerConverter.updateTransformers(network, psseModel, updatePsseModel); - SwitchedShuntCompensatorConverter.updateSwitchedShunts(network, psseModel, updatePsseModel); + BusConverter.updateBuses(network, referencedAndCopiedPsseModel); + LoadConverter.updateLoads(network, referencedAndCopiedPsseModel); + FixedShuntCompensatorConverter.updateFixedShunts(network, referencedAndCopiedPsseModel); + GeneratorConverter.updateGenerators(network, referencedAndCopiedPsseModel); + LineConverter.updateLines(network, referencedAndCopiedPsseModel); + TransformerConverter.updateTransformers(network, referencedAndCopiedPsseModel); + SwitchedShuntCompensatorConverter.updateSwitchedShunts(network, referencedAndCopiedPsseModel); } } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/SwitchedShuntCompensatorConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/SwitchedShuntCompensatorConverter.java index 70feee192f3..b9b823d7aba 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/SwitchedShuntCompensatorConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/SwitchedShuntCompensatorConverter.java @@ -7,7 +7,6 @@ package com.powsybl.psse.converter; import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -267,19 +266,16 @@ private static String getShuntId(String busId, String id) { } // At the moment we do not consider new switchedShunts - static void updateSwitchedShunts(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { - PsseVersion version = PsseVersion.fromRevision(updatePsseModel.getCaseIdentification().getRev()); + static void updateSwitchedShunts(Network network, PssePowerFlowModel psseModel) { + PsseVersion version = PsseVersion.fromRevision(psseModel.getCaseIdentification().getRev()); psseModel.getSwitchedShunts().forEach(psseSwitchedShunt -> { - updatePsseModel.addSwitchedShunts(Collections.singletonList(psseSwitchedShunt)); - PsseSwitchedShunt updatePsseSwitchedShunt = updatePsseModel.getSwitchedShunts().get(updatePsseModel.getSwitchedShunts().size() - 1); - - String switchedShuntId = getShuntId(getBusId(updatePsseSwitchedShunt.getI()), defineShuntId(updatePsseSwitchedShunt, version)); + String switchedShuntId = getShuntId(getBusId(psseSwitchedShunt.getI()), defineShuntId(psseSwitchedShunt, version)); ShuntCompensator switchedShunt = network.getShuntCompensator(switchedShuntId); if (switchedShunt == null) { - updatePsseSwitchedShunt.setStat(0); + psseSwitchedShunt.setStat(0); } else { - updatePsseSwitchedShunt.setStat(getStatus(switchedShunt)); - updatePsseSwitchedShunt.setBinit(getQ(switchedShunt)); + psseSwitchedShunt.setStat(getStatus(switchedShunt)); + psseSwitchedShunt.setBinit(getQ(switchedShunt)); } }); } diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/TransformerConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/TransformerConverter.java index 43db9ef1d17..cf444338052 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/TransformerConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/TransformerConverter.java @@ -7,7 +7,6 @@ package com.powsybl.psse.converter; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Objects; @@ -839,31 +838,28 @@ private static String getTransformerId(int i, int j, int k, String ckt) { } // At the moment we do not consider new transformers and antenna twoWindingsTransformers are exported as open - static void updateTransformers(Network network, PssePowerFlowModel psseModel, PssePowerFlowModel updatePsseModel) { + static void updateTransformers(Network network, PssePowerFlowModel psseModel) { psseModel.getTransformers().forEach(psseTransformer -> { - updatePsseModel.addTransformers(Collections.singletonList(psseTransformer)); - PsseTransformer updatePsseTransformer = updatePsseModel.getTransformers().get(updatePsseModel.getTransformers().size() - 1); - - if (isTwoWindingsTransformer(updatePsseTransformer)) { - updateTwoWindingsTransformer(network, updatePsseTransformer); + if (isTwoWindingsTransformer(psseTransformer)) { + updateTwoWindingsTransformer(network, psseTransformer); } else { - updateThreeWindingsTransformer(network, updatePsseTransformer); + updateThreeWindingsTransformer(network, psseTransformer); } }); } - private static void updateTwoWindingsTransformer(Network network, PsseTransformer updatePsseTransformer) { - String transformerId = getTransformerId(updatePsseTransformer.getI(), updatePsseTransformer.getJ(), updatePsseTransformer.getCkt()); + private static void updateTwoWindingsTransformer(Network network, PsseTransformer psseTransformer) { + String transformerId = getTransformerId(psseTransformer.getI(), psseTransformer.getJ(), psseTransformer.getCkt()); TwoWindingsTransformer tw2t = network.getTwoWindingsTransformer(transformerId); if (tw2t == null) { - updatePsseTransformer.setStat(0); + psseTransformer.setStat(0); } else { double baskv1 = tw2t.getTerminal1().getVoltageLevel().getNominalV(); - double nomV1 = getNomV(updatePsseTransformer.getWinding1(), tw2t.getTerminal1().getVoltageLevel()); - updatePsseTransformer.getWinding1().setWindv(defineWindV(getRatio(tw2t.getRatioTapChanger(), tw2t.getPhaseTapChanger()), baskv1, nomV1, updatePsseTransformer.getCw())); - updatePsseTransformer.getWinding1().setAng(getAngle(tw2t.getPhaseTapChanger())); + double nomV1 = getNomV(psseTransformer.getWinding1(), tw2t.getTerminal1().getVoltageLevel()); + psseTransformer.getWinding1().setWindv(defineWindV(getRatio(tw2t.getRatioTapChanger(), tw2t.getPhaseTapChanger()), baskv1, nomV1, psseTransformer.getCw())); + psseTransformer.getWinding1().setAng(getAngle(tw2t.getPhaseTapChanger())); - updatePsseTransformer.setStat(getStatus(tw2t)); + psseTransformer.setStat(getStatus(tw2t)); } } @@ -875,28 +871,28 @@ private static int getStatus(TwoWindingsTransformer tw2t) { } } - private static void updateThreeWindingsTransformer(Network network, PsseTransformer updatePsseTransformer) { - String transformerId = getTransformerId(updatePsseTransformer.getI(), updatePsseTransformer.getJ(), updatePsseTransformer.getK(), updatePsseTransformer.getCkt()); + private static void updateThreeWindingsTransformer(Network network, PsseTransformer psseTransformer) { + String transformerId = getTransformerId(psseTransformer.getI(), psseTransformer.getJ(), psseTransformer.getK(), psseTransformer.getCkt()); ThreeWindingsTransformer tw3t = network.getThreeWindingsTransformer(transformerId); if (tw3t == null) { - updatePsseTransformer.setStat(0); + psseTransformer.setStat(0); } else { double baskv1 = tw3t.getLeg1().getTerminal().getVoltageLevel().getNominalV(); - double nomV1 = getNomV(updatePsseTransformer.getWinding1(), tw3t.getLeg1().getTerminal().getVoltageLevel()); - updatePsseTransformer.getWinding1().setWindv(defineWindV(getRatio(tw3t.getLeg1().getRatioTapChanger(), tw3t.getLeg1().getPhaseTapChanger()), baskv1, nomV1, updatePsseTransformer.getCw())); - updatePsseTransformer.getWinding1().setAng(getAngle(tw3t.getLeg1().getPhaseTapChanger())); + double nomV1 = getNomV(psseTransformer.getWinding1(), tw3t.getLeg1().getTerminal().getVoltageLevel()); + psseTransformer.getWinding1().setWindv(defineWindV(getRatio(tw3t.getLeg1().getRatioTapChanger(), tw3t.getLeg1().getPhaseTapChanger()), baskv1, nomV1, psseTransformer.getCw())); + psseTransformer.getWinding1().setAng(getAngle(tw3t.getLeg1().getPhaseTapChanger())); double baskv2 = tw3t.getLeg2().getTerminal().getVoltageLevel().getNominalV(); - double nomV2 = getNomV(updatePsseTransformer.getWinding2(), tw3t.getLeg2().getTerminal().getVoltageLevel()); - updatePsseTransformer.getWinding2().setWindv(defineWindV(getRatio(tw3t.getLeg2().getRatioTapChanger(), tw3t.getLeg2().getPhaseTapChanger()), baskv2, nomV2, updatePsseTransformer.getCw())); - updatePsseTransformer.getWinding2().setAng(getAngle(tw3t.getLeg2().getPhaseTapChanger())); + double nomV2 = getNomV(psseTransformer.getWinding2(), tw3t.getLeg2().getTerminal().getVoltageLevel()); + psseTransformer.getWinding2().setWindv(defineWindV(getRatio(tw3t.getLeg2().getRatioTapChanger(), tw3t.getLeg2().getPhaseTapChanger()), baskv2, nomV2, psseTransformer.getCw())); + psseTransformer.getWinding2().setAng(getAngle(tw3t.getLeg2().getPhaseTapChanger())); double baskv3 = tw3t.getLeg3().getTerminal().getVoltageLevel().getNominalV(); - double nomV3 = getNomV(updatePsseTransformer.getWinding3(), tw3t.getLeg3().getTerminal().getVoltageLevel()); - updatePsseTransformer.getWinding3().setWindv(defineWindV(getRatio(tw3t.getLeg3().getRatioTapChanger(), tw3t.getLeg3().getPhaseTapChanger()), baskv3, nomV3, updatePsseTransformer.getCw())); - updatePsseTransformer.getWinding3().setAng(getAngle(tw3t.getLeg3().getPhaseTapChanger())); + double nomV3 = getNomV(psseTransformer.getWinding3(), tw3t.getLeg3().getTerminal().getVoltageLevel()); + psseTransformer.getWinding3().setWindv(defineWindV(getRatio(tw3t.getLeg3().getRatioTapChanger(), tw3t.getLeg3().getPhaseTapChanger()), baskv3, nomV3, psseTransformer.getCw())); + psseTransformer.getWinding3().setAng(getAngle(tw3t.getLeg3().getPhaseTapChanger())); - updatePsseTransformer.setStat(getStatus(tw3t)); + psseTransformer.setStat(getStatus(tw3t)); } } diff --git a/psse/psse-converter/src/test/java/com/powsybl/psse/converter/PsseExporterTest.java b/psse/psse-converter/src/test/java/com/powsybl/psse/converter/PsseExporterTest.java index ab098fd3178..b7e8561eed5 100644 --- a/psse/psse-converter/src/test/java/com/powsybl/psse/converter/PsseExporterTest.java +++ b/psse/psse-converter/src/test/java/com/powsybl/psse/converter/PsseExporterTest.java @@ -6,13 +6,21 @@ */ package com.powsybl.psse.converter; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ser.FilterProvider; +import com.fasterxml.jackson.databind.ser.PropertyWriter; +import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.google.common.collect.ImmutableList; +import com.google.common.io.ByteStreams; import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.commons.datasource.DataSource; import com.powsybl.commons.datasource.FileDataSource; import com.powsybl.commons.datasource.ReadOnlyDataSource; import com.powsybl.commons.datasource.ResourceDataSource; import com.powsybl.commons.datasource.ResourceSet; +import com.powsybl.commons.test.TestUtil; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Load; @@ -20,10 +28,20 @@ import com.powsybl.iidm.network.ShuntCompensator; import com.powsybl.iidm.network.TwoWindingsTransformer; import com.powsybl.iidm.network.impl.NetworkFactoryImpl; + +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; import java.time.ZonedDateTime; + +import com.powsybl.psse.converter.extensions.PsseModelExtension; +import com.powsybl.psse.model.PsseVersion; +import com.powsybl.psse.model.PsseVersioned; +import com.powsybl.psse.model.Revision; +import com.powsybl.psse.model.pf.PssePowerFlowModel; import org.junit.jupiter.api.Test; import static com.powsybl.commons.test.ComparisonUtils.compareTxt; +import static com.powsybl.psse.model.PsseVersion.fromRevision; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; @@ -79,6 +97,11 @@ void importExportTest24() throws IOException { Network network = importTest("IEEE_24_bus", "IEEE_24_bus.raw", false); changeIEEE24BusNetwork(network); exportTest(network, "IEEE_24_bus_updated_exported", "IEEE_24_bus_updated_exported.raw"); + + // check that the psseModel associated with the network has not been changed + PssePowerFlowModel psseModel = network.getExtension(PsseModelExtension.class).getPsseModel(); + String jsonRef = loadJsonReference("IEEE_24_bus.json"); + assertEquals(jsonRef, toJsonString(psseModel)); } private static void changeIEEE24BusNetwork(Network network) { @@ -113,6 +136,29 @@ private static void changeIEEE24BusNetwork(Network network) { tw2t.getTerminal2().disconnect(); } + private static String toJsonString(PssePowerFlowModel rawData) throws JsonProcessingException { + PsseVersion version = fromRevision(rawData.getCaseIdentification().getRev()); + SimpleBeanPropertyFilter filter = new SimpleBeanPropertyFilter() { + @Override + protected boolean include(PropertyWriter writer) { + Revision rev = writer.getAnnotation(Revision.class); + return rev == null || PsseVersioned.isValidVersion(version, rev); + } + }; + FilterProvider filters = new SimpleFilterProvider().addFilter("PsseVersionFilter", filter); + String json = new ObjectMapper().writerWithDefaultPrettyPrinter().with(filters).writeValueAsString(rawData); + return TestUtil.normalizeLineSeparator(json); + } + + private String loadJsonReference(String fileName) { + try { + InputStream is = getClass().getResourceAsStream("/" + fileName); + return TestUtil.normalizeLineSeparator(new String(ByteStreams.toByteArray(is), StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + @Test void importExportTest30() throws IOException { Network network = importTest("IEEE_30_bus", "IEEE_30_bus.raw", false); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseBus.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseBus.java index fd28d087c87..5f179ec76c1 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseBus.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseBus.java @@ -170,4 +170,22 @@ public void setEvlo(double evlo) { checkVersion("evlo"); this.evlo = evlo; } + + public PsseBus copy() { + PsseBus copy = new PsseBus(); + copy.i = this.i; + copy.name = this.name; + copy.baskv = this.baskv; + copy.ide = this.ide; + copy.area = this.area; + copy.zone = this.zone; + copy.owner = this.owner; + copy.vm = this.vm; + copy.va = this.va; + copy.nvhi = this.nvhi; + copy.nvlo = this.nvlo; + copy.evhi = this.evhi; + copy.evlo = this.evlo; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseFixedShunt.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseFixedShunt.java index d04a12bbd66..2eaee1c676f 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseFixedShunt.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseFixedShunt.java @@ -68,4 +68,14 @@ public double getBl() { public void setBl(double bl) { this.bl = bl; } + + public PsseFixedShunt copy() { + PsseFixedShunt copy = new PsseFixedShunt(); + copy.i = this.i; + copy.id = this.id; + copy.status = this.status; + copy.gl = this.gl; + copy.bl = this.bl; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseGenerator.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseGenerator.java index 0d08e622804..f6bb501d0bc 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseGenerator.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseGenerator.java @@ -274,4 +274,32 @@ public void setBaslod(int baslod) { public PsseOwnership getOwnership() { return ownership; } + + public PsseGenerator copy() { + PsseGenerator copy = new PsseGenerator(); + copy.i = this.i; + copy.id = this.id; + copy.pg = this.pg; + copy.qg = this.qg; + copy.qt = this.qt; + copy.qb = this.qb; + copy.vs = this.vs; + copy.ireg = this.ireg; + copy.mbase = this.mbase; + copy.zr = this.zr; + copy.zx = this.zx; + copy.rt = this.rt; + copy.xt = this.xt; + copy.gtap = this.gtap; + copy.stat = this.stat; + copy.rmpct = this.rmpct; + copy.pt = this.pt; + copy.pb = this.pb; + copy.ownership = this.ownership; + copy.wmod = this.wmod; + copy.wpf = this.wpf; + copy.nreg = this.nreg; + copy.baslod = this.baslod; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseLoad.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseLoad.java index d217e0f3f2c..b930f041ed0 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseLoad.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseLoad.java @@ -228,4 +228,28 @@ public void setLoadtype(String loadtype) { checkVersion("loadtype"); this.loadtype = loadtype; } + + public PsseLoad copy() { + PsseLoad copy = new PsseLoad(); + copy.i = this.i; + copy.id = this.id; + copy.status = this.status; + copy.area = this.area; + copy.zone = this.zone; + copy.owner = this.owner; + copy.pl = this.pl; + copy.ql = this.ql; + copy.ip = this.ip; + copy.iq = this.iq; + copy.yp = this.yp; + copy.yq = this.yq; + copy.owner = this.owner; + copy.scale = this.scale; + copy.intrpt = this.intrpt; + copy.dgenp = this.dgenp; + copy.dgenq = this.dgenq; + copy.dgenm = this.dgenm; + copy.loadtype = this.loadtype; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseNonTransformerBranch.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseNonTransformerBranch.java index 6093948e251..29e829c527e 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseNonTransformerBranch.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseNonTransformerBranch.java @@ -196,4 +196,25 @@ public PsseOwnership getOwnership() { public PsseRates getRates() { return rates; } + + public PsseNonTransformerBranch copy() { + PsseNonTransformerBranch copy = new PsseNonTransformerBranch(); + copy.i = this.i; + copy.j = this.j; + copy.ckt = this.ckt; + copy.r = this.r; + copy.x = this.x; + copy.b = this.b; + copy.rates = this.rates.copy(); + copy.gi = this.gi; + copy.bi = this.bi; + copy.gj = this.gj; + copy.bj = this.bj; + copy.st = this.st; + copy.met = this.met; + copy.len = this.len; + copy.ownership = this.ownership; + copy.name = this.name; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java index 78b96314afc..e13be21e68e 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java @@ -219,6 +219,39 @@ public List getInductionMachines() { return Collections.unmodifiableList(inductionMachines); } + public PssePowerFlowModel referenceAndCopyPssePowerFlowModel() { + PssePowerFlowModel newPsseModel = new PssePowerFlowModel(this.getCaseIdentification()); + referencePermanentBlocks(this, newPsseModel); + copyModifiedBlocks(this, newPsseModel); + return newPsseModel; + } + + private static void referencePermanentBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel newPsseModel) { + newPsseModel.addAreas(psseModel.getAreas()); + newPsseModel.addTwoTerminalDcTransmissionLines(psseModel.getTwoTerminalDcTransmissionLines()); + newPsseModel.addVoltageSourceConverterDcTransmissionLines(psseModel.getVoltageSourceConverterDcTransmissionLines()); + newPsseModel.addTransformerImpedanceCorrections(psseModel.getTransformerImpedanceCorrections()); + newPsseModel.addMultiTerminalDcTransmissionLines(psseModel.getMultiTerminalDcTransmissionLines()); + newPsseModel.addLineGrouping(psseModel.getLineGrouping()); + newPsseModel.addZones(psseModel.getZones()); + newPsseModel.addInterareaTransfer(psseModel.getInterareaTransfer()); + newPsseModel.addOwners(psseModel.getOwners()); + newPsseModel.addFacts(psseModel.getFacts()); + newPsseModel.addGneDevice(psseModel.getGneDevice()); + newPsseModel.addInductionMachines(psseModel.getInductionMachines()); + } + + private static void copyModifiedBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel newPsseModel) { + psseModel.getBuses().forEach(psseBus -> newPsseModel.buses.add(psseBus.copy())); + psseModel.getLoads().forEach(psseLoad -> newPsseModel.loads.add(psseLoad.copy())); + + psseModel.getFixedShunts().forEach(psseFixedShunt -> newPsseModel.fixedShunts.add(psseFixedShunt.copy())); + psseModel.getGenerators().forEach(psseGenerator -> newPsseModel.generators.add(psseGenerator.copy())); + psseModel.getNonTransformerBranches().forEach(nonTransformerBranch -> newPsseModel.nonTransformerBranches.add(nonTransformerBranch.copy())); + psseModel.getTransformers().forEach(psseTransformer -> newPsseModel.transformers.add(psseTransformer.copy())); + psseModel.getSwitchedShunts().forEach(psseSwitchedShunt -> newPsseModel.switchedShunts.add(psseSwitchedShunt.copy())); + } + private List modelled(List elements) { for (PsseVersioned v : elements) { v.setModel(this); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseRates.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseRates.java index e6afcb8c932..2ca7b45b9b1 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseRates.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseRates.java @@ -238,4 +238,24 @@ public void setRate12(double rate12) { checkVersion("rate12"); this.rate12 = rate12; } + + public PsseRates copy() { + PsseRates copy = new PsseRates(); + copy.ratea = this.ratea; + copy.rateb = this.rateb; + copy.ratec = this.ratec; + copy.rate1 = this.rate1; + copy.rate2 = this.rate2; + copy.rate3 = this.rate3; + copy.rate4 = this.rate4; + copy.rate5 = this.rate5; + copy.rate6 = this.rate6; + copy.rate7 = this.rate7; + copy.rate8 = this.rate8; + copy.rate9 = this.rate9; + copy.rate10 = this.rate10; + copy.rate11 = this.rate11; + copy.rate12 = this.rate12; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSwitchedShunt.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSwitchedShunt.java index a46b2203d02..5046d27e065 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSwitchedShunt.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSwitchedShunt.java @@ -468,4 +468,46 @@ public int getS8() { public void setS8(int s8) { this.s8 = s8; } + + public PsseSwitchedShunt copy() { + PsseSwitchedShunt copy = new PsseSwitchedShunt(); + copy.i = this.i; + copy.modsw = this.modsw; + copy.adjm = this.adjm; + copy.stat = this.stat; + copy.vswhi = this.vswhi; + copy.vswlo = this.vswlo; + copy.swrem = this.swrem; + copy.rmpct = this.rmpct; + copy.rmidnt = this.rmidnt; + copy.binit = this.binit; + copy.n1 = this.n1; + copy.b1 = this.b1; + copy.n2 = this.n2; + copy.b2 = this.b2; + copy.n3 = this.n3; + copy.b3 = this.b3; + copy.n4 = this.n4; + copy.b4 = this.b4; + copy.n5 = this.n5; + copy.b5 = this.b5; + copy.n6 = this.n6; + copy.b6 = this.b6; + copy.n7 = this.n7; + copy.b7 = this.b7; + copy.n8 = this.n8; + copy.b8 = this.b8; + copy.id = this.id; + copy.swreg = this.swreg; + copy.nreg = this.nreg; + copy.s1 = this.s1; + copy.s2 = this.s2; + copy.s3 = this.s3; + copy.s4 = this.s4; + copy.s5 = this.s5; + copy.s6 = this.s6; + copy.s7 = this.s7; + copy.s8 = this.s8; + return copy; + } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformer.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformer.java index d4abae2e6e1..da76f937139 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformer.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformer.java @@ -364,6 +364,33 @@ public void setImpedances(TransformerImpedances impedances) { this.impedances = impedances; } + public PsseTransformer copy() { + PsseTransformer copy = new PsseTransformer(); + copy.i = this.i; + copy.j = this.j; + copy.k = this.k; + copy.ckt = this.ckt; + copy.cw = this.cw; + copy.cz = this.cz; + copy.cm = this.cm; + copy.mag1 = this.mag1; + copy.mag2 = this.mag2; + copy.nmetr = this.nmetr; + copy.name = this.name; + copy.stat = this.stat; + copy.ownership = this.ownership; + copy.vecgrp = this.vecgrp; + copy.zcod = this.zcod; + copy.impedances = this.impedances.copy(); + copy.winding1 = this.winding1.copy(); + copy.winding1Rates = this.winding1Rates.copy(); + copy.winding2 = this.winding2.copy(); + copy.winding2Rates = this.winding2Rates.copy(); + copy.winding3 = this.winding3.copy(); + copy.winding3Rates = this.winding3Rates.copy(); + return copy; + } + public static class TransformerImpedances { @Parsed(field = {"r12", "r1_2"}) private double r12 = 0; @@ -405,5 +432,21 @@ public static class TransformerImpedances { @NullString(nulls = {"null"}) @Parsed private double anstar = 0; + + public TransformerImpedances copy() { + TransformerImpedances copy = new TransformerImpedances(); + copy.r12 = this.r12; + copy.x12 = this.x12; + copy.sbase12 = this.sbase12; + copy.r23 = this.r23; + copy.x23 = this.x23; + copy.sbase23 = this.sbase23; + copy.r31 = this.r31; + copy.x31 = this.x31; + copy.sbase31 = this.sbase31; + copy.vmstar = this.vmstar; + copy.anstar = this.anstar; + return copy; + } } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformerWinding.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformerWinding.java index 7bf58b8afad..b646f75fc53 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformerWinding.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseTransformerWinding.java @@ -145,4 +145,24 @@ public double getCx() { public double getCnxa() { return cnxa; } + + public PsseTransformerWinding copy() { + PsseTransformerWinding copy = new PsseTransformerWinding(); + copy.windv = this.windv; + copy.nomv = this.nomv; + copy.ang = this.ang; + copy.cod = this.cod; + copy.cont = this.cont; + copy.node = this.node; + copy.rma = this.rma; + copy.rmi = this.rmi; + copy.vma = this.vma; + copy.vmi = this.vmi; + copy.ntp = this.ntp; + copy.tab = this.tab; + copy.cr = this.cr; + copy.cx = this.cx; + copy.cnxa = this.cnxa; + return copy; + } } From 362d13fc16d0fb9acb2b519459d0243d468fc0e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Thu, 11 Apr 2024 10:07:47 +0200 Subject: [PATCH 02/10] Import and update substation data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../src/main/resources/IEEE_14_bus.json | 3 +- .../IEEE_14_bus_nodeBreaker_rev35.raw | 131 ++ .../src/main/resources/IEEE_24_bus.json | 3 +- .../model/io/RecordGroupIOLegacyText.java | 8 + .../psse/model/pf/PssePowerFlowModel.java | 11 + .../powsybl/psse/model/pf/PsseSubstation.java | 803 +++++++ .../psse/model/pf/io/PowerFlowRawData35.java | 5 +- .../psse/model/pf/io/PowerFlowRawxData35.java | 4 + .../model/pf/io/PowerFlowRecordGroup.java | 10 +- .../psse/model/pf/io/SubstationData.java | 329 +++ .../powsybl/psse/model/PsseRawDataTest.java | 50 + .../resources/IEEE_14_bus_Q_record_rev35.json | 3 +- .../test/resources/IEEE_14_bus_completed.json | 3 +- .../IEEE_14_bus_completed_rev35.json | 3 +- .../IEEE_14_bus_nodeBreaker_rev35.json | 1971 +++++++++++++++++ .../IEEE_14_bus_nodeBreaker_rev35.rawx | 193 ++ ...IEEE_14_bus_nodeBreaker_rev35_exported.raw | 131 ++ ...EEE_14_bus_nodeBreaker_rev35_exported.rawx | 156 ++ .../src/test/resources/IEEE_14_bus_rev35.json | 3 +- .../resources/IEEE_14_isolated_buses.json | 3 +- .../src/test/resources/IEEE_24_bus_rev35.json | 3 +- 21 files changed, 3814 insertions(+), 12 deletions(-) create mode 100644 psse/psse-model-test/src/main/resources/IEEE_14_bus_nodeBreaker_rev35.raw create mode 100644 psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java create mode 100644 psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java create mode 100644 psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.json create mode 100644 psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.rawx create mode 100644 psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw create mode 100644 psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx diff --git a/psse/psse-model-test/src/main/resources/IEEE_14_bus.json b/psse/psse-model-test/src/main/resources/IEEE_14_bus.json index 25b1e4b1d90..1724dc8df07 100644 --- a/psse/psse-model-test/src/main/resources/IEEE_14_bus.json +++ b/psse/psse-model-test/src/main/resources/IEEE_14_bus.json @@ -1348,5 +1348,6 @@ "facts" : [ ], "switchedShunts" : [ ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model-test/src/main/resources/IEEE_14_bus_nodeBreaker_rev35.raw b/psse/psse-model-test/src/main/resources/IEEE_14_bus_nodeBreaker_rev35.raw new file mode 100644 index 00000000000..b05e6eab619 --- /dev/null +++ b/psse/psse-model-test/src/main/resources/IEEE_14_bus_nodeBreaker_rev35.raw @@ -0,0 +1,131 @@ + 0, 100.0, 35, 0, 0, 60.00 / October 01, 2013 18:37:53 + 08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case + +0 / END OF SYSTEM-WIDE DATA, BEGIN BUS DATA + 1,'Bus 1 ', 138.0000,3, 1, 1, 1,1.06000, 0.0000 + 2,'Bus 2 ', 138.0000,2, 1, 1, 1,1.04500, -4.9826 + 3,'Bus 3 ', 138.0000,2, 1, 1, 1,1.01000, -12.7250 + 4,'Bus 4 ', 138.0000,1, 1, 1, 1,1.01767, -10.3128 + 5,'Bus 5 ', 138.0000,1, 1, 1, 1,1.01951, -8.7738 + 6,'Bus 6 ', 138.0000,2, 1, 1, 1,1.07000, -14.2209 + 7,'Bus 7 ', 138.0000,1, 1, 1, 1,1.06152, -13.3596 + 8,'Bus 8 ', 138.0000,2, 1, 1, 1,1.09000, -13.3596 + 9,'Bus 9 ', 138.0000,1, 1, 1, 1,1.05593, -14.9385 + 10,'Bus 10 ', 138.0000,1, 1, 1, 1,1.05099, -15.0972 + 11,'Bus 11 ', 138.0000,1, 1, 1, 1,1.05691, -14.7906 + 12,'Bus 12 ', 138.0000,1, 1, 1, 1,1.05519, -15.0755 + 13,'Bus 13 ', 138.0000,1, 1, 1, 1,1.05038, -15.1562 + 14,'Bus 14 ', 138.0000,1, 1, 1, 1,1.03553, -16.0336 +0 / END OF BUS DATA, BEGIN LOAD DATA + 2,'1 ',1, 1, 1, 21.700, 12.700, 0.000, 0.000, 0.000, -0.000, 1,1 + 3,'1 ',1, 1, 1, 94.200, 19.000, 0.000, 0.000, 0.000, -0.000, 1,1 + 4,'1 ',1, 1, 1, 47.800, -3.900, 0.000, 0.000, 0.000, -0.000, 1,1 + 5,'1 ',1, 1, 1, 7.600, 1.600, 0.000, 0.000, 0.000, -0.000, 1,1 + 6,'1 ',1, 1, 1, 11.200, 7.500, 0.000, 0.000, 0.000, -0.000, 1,1 + 9,'1 ',1, 1, 1, 29.500, 16.600, 0.000, 0.000, 0.000, -0.000, 1,1 + 10,'1 ',1, 1, 1, 9.000, 5.800, 0.000, 0.000, 0.000, -0.000, 1,1 + 11,'1 ',1, 1, 1, 3.500, 1.800, 0.000, 0.000, 0.000, -0.000, 1,1 + 12,'1 ',1, 1, 1, 6.100, 1.600, 0.000, 0.000, 0.000, -0.000, 1,1 + 13,'1 ',1, 1, 1, 13.500, 5.800, 0.000, 0.000, 0.000, -0.000, 1,1 + 14,'1 ',1, 1, 1, 14.900, 5.000, 0.000, 0.000, 0.000, -0.000, 1,1 +0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA + 9,' 1', 1, 0.000, 19.000 +0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA + 1,'1 ', 232.392, -16.549, 0.000, 0.000,1.06000, 0, 0, 615.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 10000.000,-10000.000, 0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000 + 2,'1 ', 40.000, 43.556, 50.000, -40.000,1.04500, 0, 0, 60.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 10000.000,-10000.000, 0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000 + 3,'1 ', 0.000, 25.075, 40.000, 0.000,1.01000, 0, 0, 60.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 10000.000,-10000.000, 0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000 + 6,'1 ', 0.000, 12.730, 24.000, -6.000,1.07000, 0, 0, 25.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 10000.000,-10000.000, 0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000 + 8,'1 ', 0.000, 17.623, 24.000, -6.000,1.09000, 0, 0, 25.000, 0.00000, 1.00000, 0.00000, 0.00000,1.00000,1, 100.0, 10000.000,-10000.000, 0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000,0, 1.0000 +0 / END OF GENERATOR DATA, BEGIN BRANCH DATA + 1, 2,'1 ', 0.01938, 0.05917,0.05280, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 1, 5,'1 ', 0.05403, 0.22304,0.04920, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 2, 3,'1 ', 0.04699, 0.19797,0.04380, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 2, 4,'1 ', 0.05811, 0.17632,0.03400, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 2, 5,'1 ', 0.05695, 0.17388,0.03460, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 3, 4,'1 ', 0.06701, 0.17103,0.01280, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 4, 5,'1 ', 0.01335, 0.04211,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 6, 11,'1 ', 0.09498, 0.19890,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 6, 12,'1 ', 0.12291, 0.25581,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 6, 13,'1 ', 0.06615, 0.13027,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 7, 8,'1 ', 0.00000, 0.17615,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 7, 9,'1 ', 0.00000, 0.11001,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 9, 10,'1 ', 0.03181, 0.08450,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 9, 14,'1 ', 0.12711, 0.27038,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 10, 11,'1 ', 0.08205, 0.19207,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 12, 13,'1 ', 0.22092, 0.19988,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 13, 14,'1 ', 0.17093, 0.34802,0.00000, '', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000,1,1, 0.0, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 +0 / END OF BRANCH DATA, BEGIN SYSTEM SWITCHING DEVICE DATA +0 / END OF SYSTEM SWITCHING DEVICE DATA, BEGIN TRANSFORMER DATA + 4, 7, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 0.00000, 0.20912, 100.00 +0.97800, 0.000, 0.000, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000,159, 0, 0.00000, 0.00000 +1.00000, 0.000 + 4, 9, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 0.00000, 0.55618, 100.00 +0.96900, 0.000, 0.000, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000,159, 0, 0.00000, 0.00000 +1.00000, 0.000 + 5, 6, 0,'1 ',1,1,1, 0.00000, 0.00000,2,' ',1, 1,1.0000, 0,1.0000, 0,1.0000, 0,1.0000 + 0.00000, 0.25202, 100.00 +0.93200, 0.000, 0.000, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00,0, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000,159, 0, 0.00000, 0.00000 +1.00000, 0.000 +0 / END OF TRANSFORMER DATA, BEGIN AREA DATA + 1, 2, 0.000, 999.990,'IEEE14 ' +0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA +0 / END OF TWO-TERMINAL DC DATA, BEGIN VOLTAGE SOURCE CONVERTER DATA +0 / END OF VOLTAGE SOURCE CONVERTER DATA, BEGIN IMPEDANCE CORRECTION DATA +0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA +0 / END OF MULTI-TERMINAL DC DATA, BEGIN MULTI-SECTION LINE DATA +0 / END OF MULTI-SECTION LINE DATA, BEGIN ZONE DATA +0 / END OF ZONE DATA, BEGIN INTER-AREA TRANSFER DATA +0 / END OF INTER-AREA TRANSFER DATA, BEGIN OWNER DATA + 1,'1' +0 / END OF OWNER DATA, BEGIN FACTS CONTROL DEVICE DATA +0 / END OF FACTS CONTROL DEVICE DATA, BEGIN SWITCHED SHUNT DATA +0 /END OF SWITCHED SHUNT DATA, BEGIN GNE DEVICE DATA +0 /END OF GNE DEVICE DATA, BEGIN INDUCTION MACHINE DATA +0 /END OF INDUCTION MACHINE DATA, BEGIN SUBSTATION DATA + 1, 'STATION 1', 0.0, 0.0, 0.1 + / BEGIN SUBSTATION NODE DATA + 1, 'NB1', 1, 1, 1.0, 0.0 + 2, 'NB2', 1, 1, 1.0, 0.0 + 3, 'NL2', 1, 1, 1.0, 0.0 + 4, 'NL5', 1, 1, 1.0, 0.0 + 5, 'NG1', 1, 1, 1.0, 0.0 + 0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA + 1, 2, '1 ', 'Sw-BusBars', 2, 1, 1, 0, 0, 0, 0 + 1, 3, '1 ', 'Sw-BranchToBus2', 2, 1, 1, 0, 0, 0, 0 + 2, 4, '1 ', 'Sw-BranchToBus5', 2, 1, 1, 0, 0, 0, 0 + 2, 5, '1 ', 'Sw-Gen1', 2, 1, 1, 0, 0, 0, 0 + 0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION TERMINAL DATA + 1, 5, 'M', '1 ' + 1, 3, 'B', 2, '1 ' + 1, 4, 'B', 5, '1 ' + 0 / END OF SUBSTATION TERMINAL DATA + 2, 'STATION 5', 0.0, 0.0, 0.1 + / BEGIN SUBSTATION NODE DATA + 1, 'NB1', 2, 1, 1.0, 0.0 + 2, 'NB2', 2, 1, 1.0, 0.0 + 3, 'NL3', 2, 1, 1.0, 0.0 + 4, 'NL4', 2, 1, 1.0, 0.0 + 5, 'NL5', 2, 1, 1.0, 0.0 + 6, 'NL1', 2, 1, 1.0, 0.0 + 7, 'NG1', 2, 1, 1.0, 0.0 + 8, 'NLd1', 2, 1, 1.0, 0.0 + 0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA + 1, 2, '1 ', 'Sw-BusBars', 2, 1, 1, 0, 0, 0, 0 + 1, 6, '1 ', 'Sw-BranchToBus1', 2, 1, 1, 0, 0, 0, 0 + 1, 7, '1 ', 'Sw-Gen1', 2, 1, 1, 0, 0, 0, 0 + 1, 8, '1 ', 'Sw-Load1', 2, 1, 1, 0, 0, 0, 0 + 2, 3, '1 ', 'Sw-BranchToBus3', 2, 1, 1, 0, 0, 0, 0 + 2, 4, '1 ', 'Sw-BranchToBus4', 2, 1, 1, 0, 0, 0, 0 + 2, 5, '1 ', 'Sw-BranchToBus5', 2, 1, 1, 0, 0, 0, 0 + 0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION TERMINAL DATA + 2, 7, 'M', '1 ' + 2, 8, 'L', '1 ' + 2, 6, 'B', 1, '1 ' + 2, 3, 'B', 3, '1 ' + 2, 4, 'B', 4, '1 ' + 2, 5, 'B', 5, '1 ' + 0 / END OF SUBSTATION TERMINAL DATA +0 /END OF SUBSTATION DATA +Q diff --git a/psse/psse-model-test/src/main/resources/IEEE_24_bus.json b/psse/psse-model-test/src/main/resources/IEEE_24_bus.json index a57e4700cf9..3054262fe1a 100644 --- a/psse/psse-model-test/src/main/resources/IEEE_24_bus.json +++ b/psse/psse-model-test/src/main/resources/IEEE_24_bus.json @@ -2526,5 +2526,6 @@ "b8" : 0.0 } ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/io/RecordGroupIOLegacyText.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/io/RecordGroupIOLegacyText.java index 524dea028e5..fd70af4d8ff 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/io/RecordGroupIOLegacyText.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/io/RecordGroupIOLegacyText.java @@ -95,6 +95,14 @@ public static void writeEnd(String legacyTextName, OutputStream outputStream) { write(String.format("0 / END OF %s DATA", legacyTextName), outputStream); } + public static void writeComment(String comment, OutputStream outputStream) { + write(String.format(" / %s%n", comment), outputStream); + } + + public static void writeEndComment(String comment, OutputStream outputStream) { + write(String.format("0 / %s%n", comment), outputStream); + } + public static void writeQ(OutputStream outputStream) { write(String.format("%nQ%n"), outputStream); } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java index e1398adf866..ceb17920567 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PssePowerFlowModel.java @@ -60,6 +60,8 @@ public class PssePowerFlowModel { private final List inductionMachines = new ArrayList<>(); + private final List substations = new ArrayList<>(); + public PssePowerFlowModel(PsseCaseIdentification caseIdentification) { this.caseIdentification = Objects.requireNonNull(caseIdentification); } @@ -220,6 +222,14 @@ public List getInductionMachines() { return Collections.unmodifiableList(inductionMachines); } + public void addSubstations(List substations) { + this.substations.addAll(substations); + } + + public List getSubstations() { + return Collections.unmodifiableList(substations); + } + public PssePowerFlowModel referenceAndCopyPssePowerFlowModel() { PssePowerFlowModel newPsseModel = new PssePowerFlowModel(this.getCaseIdentification()); referencePermanentBlocks(this, newPsseModel); @@ -243,6 +253,7 @@ private static void referencePermanentBlocks(PssePowerFlowModel psseModel, PsseP } private static void copyModifiedBlocks(PssePowerFlowModel psseModel, PssePowerFlowModel newPsseModel) { + psseModel.getSubstations().forEach(psseSubstation -> newPsseModel.substations.add(psseSubstation.copy())); psseModel.getBuses().forEach(psseBus -> newPsseModel.buses.add(psseBus.copy())); psseModel.getLoads().forEach(psseLoad -> newPsseModel.loads.add(psseLoad.copy())); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java new file mode 100644 index 00000000000..c5992dac222 --- /dev/null +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java @@ -0,0 +1,803 @@ +/** + * Copyright (c) 2024, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.psse.model.pf; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.univocity.parsers.annotations.Nested; +import com.univocity.parsers.annotations.NullString; +import com.univocity.parsers.annotations.Parsed; + +/** + * + * @author Luma Zamarreño {@literal } + * @author José Antonio Marqués {@literal } + */ + +@JsonIgnoreProperties({"record"}) +@JsonPropertyOrder({"is", "name", "lati", "long", "srg"}) + +public class PsseSubstation { + + public PsseSubstation(PsseSubstationRecord record, + List nodes, List switchingDevices, + List equipmentTerminals) { + this.record = record; + this.nodes = nodes; + this.switchingDevices = switchingDevices; + this.equipmentTerminals = equipmentTerminals; + } + + private final PsseSubstationRecord record; + private final List nodes; + private final List switchingDevices; + private final List equipmentTerminals; + + public int getIs() { + return record.is; + } + + public String getName() { + return record.name; + } + + public double getLati() { + return record.lati; + } + + public double getLong() { + return record.longi; + } + + public double getSrg() { + return record.srg; + } + + public PsseSubstationRecord getRecord() { + return record; + } + + public List getNodes() { + return nodes; + } + + public List getSwitchingDevices() { + return switchingDevices; + } + + public List getEquipmentTerminals() { + return equipmentTerminals; + } + + public PsseSubstation copy() { + PsseSubstationRecord copyRecord = this.record.copy(); + + List copyNodes = new ArrayList<>(); + this.nodes.forEach(node -> copyNodes.add(node.copy())); + + List copySwitchingDevices = new ArrayList<>(); + this.switchingDevices.forEach(switchingDevice -> copySwitchingDevices.add(switchingDevice.copy())); + + List copyEquipmentTerminals = new ArrayList<>(); + this.equipmentTerminals.forEach(equipmentTerminal -> copyEquipmentTerminals.add(equipmentTerminal.copy())); + + return new PsseSubstation(copyRecord, copyNodes, copySwitchingDevices, copyEquipmentTerminals); + } + + public static class PsseSubstationRecord { + @Parsed(field = {"is", "isub"}) + private int is; + @Parsed(defaultNullRead = " ") + private String name; + + @Parsed + private double lati = 0.0; + + @Parsed(field = {"long"}) + private double longi = 0.0; + + @Parsed + private double srg = 0.0; + + public int getIs() { + return is; + } + + public void setIs(int is) { + this.is = is; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getLati() { + return lati; + } + + public void setLati(double lati) { + this.lati = lati; + } + + public double getLong() { + return longi; + } + + public void setLong(double longi) { + this.longi = longi; + } + + public double getSrg() { + return srg; + } + + public void setSrg(double srg) { + this.srg = srg; + } + + public PsseSubstationRecord copy() { + PsseSubstationRecord copy = new PsseSubstationRecord(); + copy.is = this.is; + copy.name = this.name; + copy.lati = this.lati; + copy.longi = this.longi; + copy.srg = this.srg; + return copy; + } + } + + public static class PsseSubstationNode { + + @Parsed(field = {"ni", "inode"}) + private int ni; + + @Parsed(defaultNullRead = " ") + private String name; + + @Parsed(field = {"i", "ibus"}) + private int i; + + @Parsed(field = {"stat", "status"}) + private int status = 1; + + @Parsed + private double vm = 1.0; + + @Parsed + private double va = 0.0; + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public double getVm() { + return vm; + } + + public void setVm(double vm) { + this.vm = vm; + } + + public double getVa() { + return va; + } + + public void setVa(double va) { + this.va = va; + } + + public PsseSubstationNode copy() { + PsseSubstationNode copy = new PsseSubstationNode(); + copy.ni = this.ni; + copy.name = this.name; + copy.i = this.i; + copy.status = this.status; + copy.vm = this.vm; + copy.va = this.va; + return copy; + } + } + + public static class PsseSubstationSwitchingDevice { + + @Parsed(field = {"ni", "inode"}) + private int ni; + + @Parsed(field = {"nj", "jnode"}) + private int nj = 0; + + @Parsed(field = {"ckt", "swdid"}, defaultNullRead = "1 ") + private String ckt; + + @Parsed(defaultNullRead = " ") + private String name; + + @Parsed + private int type = 1; + + @Parsed(field = {"status", "stat"}) + private int status = 1; + + @Parsed + private int nstat = 1; + + @Parsed(field = {"x", "xpu"}) + private double x = 0.0001; + + @Parsed + private double rate1 = 0.0; + + @Parsed + private double rate2 = 0.0; + + @Parsed + private double rate3 = 0.0; + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public int getNj() { + return nj; + } + + public void setNj(int nj) { + this.nj = nj; + } + + public String getCkt() { + return ckt; + } + + public void setCkt(String ckt) { + this.ckt = ckt; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getNstat() { + return nstat; + } + + public void setNstat(int nstat) { + this.nstat = nstat; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getRate1() { + return rate1; + } + + public void setRate1(double rate1) { + this.rate1 = rate1; + } + + public double getRate2() { + return rate2; + } + + public void setRate2(double rate2) { + this.rate2 = rate2; + } + + public double getRate3() { + return rate3; + } + + public void setRate3(double rate3) { + this.rate3 = rate3; + } + + public PsseSubstationSwitchingDevice copy() { + PsseSubstationSwitchingDevice copy = new PsseSubstationSwitchingDevice(); + copy.ni = this.ni; + copy.nj = this.nj; + copy.ckt = this.ckt; + copy.name = this.name; + copy.type = this.type; + copy.status = this.status; + copy.nstat = this.nstat; + copy.x = this.x; + copy.rate1 = this.rate1; + copy.rate2 = this.rate2; + copy.rate3 = this.rate3; + return copy; + } + } + + public static class PsseSubstationEquipmentTerminal { + + @Parsed(field = {"i", "ibus"}) + private int i; + + @Parsed(field = {"ni", "inode"}) + private int ni; + + @Parsed + private String type; + + @Parsed(field = {"id", "eqid"}, defaultNullRead = "1 ") + private String id; + + @NullString(nulls = {"null"}) + @Parsed(field = {"j", "jbus"}) + private int j = 0; + + @NullString(nulls = {"null"}) + @Parsed(field = {"k", "kbus"}) + private int k = 0; + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getJ() { + return j; + } + + public void setJ(int j) { + this.j = j; + } + + public int getK() { + return k; + } + + public void setK(int k) { + this.k = k; + } + + public PsseSubstationEquipmentTerminal copy() { + PsseSubstationEquipmentTerminal copy = new PsseSubstationEquipmentTerminal(); + copy.i = this.i; + copy.ni = this.ni; + copy.type = this.type; + copy.id = this.id; + copy.j = this.j; + copy.k = this.k; + return copy; + } + + public PsseSubstationEquipmentTerminalOneBus convertToEquipmentTerminalOneBus() { + PsseSubstationEquipmentTerminalOneBus oneBus = new PsseSubstationEquipmentTerminalOneBus(); + oneBus.i = i; + oneBus.ni = ni; + oneBus.type = type; + oneBus.id = id; + return oneBus; + } + + public PsseSubstationEquipmentTerminalTwoBuses convertToEquipmentTerminalTwoBuses() { + PsseSubstationEquipmentTerminalTwoBuses twoBuses = new PsseSubstationEquipmentTerminalTwoBuses(); + twoBuses.i = i; + twoBuses.ni = ni; + twoBuses.type = type; + twoBuses.id = id; + twoBuses.j = j; + return twoBuses; + } + + public PsseSubstationEquipmentTerminalThreeBuses convertToEquipmentTerminalThreeBuses() { + PsseSubstationEquipmentTerminalThreeBuses threeBuses = new PsseSubstationEquipmentTerminalThreeBuses(); + threeBuses.i = i; + threeBuses.ni = ni; + threeBuses.type = type; + threeBuses.id = id; + threeBuses.j = j; + threeBuses.k = k; + return threeBuses; + } + } + + public static class PsseSubstationEquipmentTerminalCommonStart { + + @Parsed + private int i; + + @Parsed + private int ni; + + @Parsed + private String type; + + public String getType() { + return type; + } + } + + public static class PsseSubstationEquipmentTerminalOneBus { + + @Parsed + private int i; + + @Parsed + private int ni; + + @Parsed + private String type; + + @Parsed(defaultNullRead = "1 ") + private String id; + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { + PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); + equipmentTerminal.i = i; + equipmentTerminal.ni = ni; + equipmentTerminal.type = type; + equipmentTerminal.id = id; + equipmentTerminal.j = 0; + equipmentTerminal.k = 0; + return equipmentTerminal; + } + } + + public static class PsseSubstationEquipmentTerminalTwoBuses { + + @Parsed + private int i; + + @Parsed + private int ni; + + @Parsed + private String type; + + @Parsed + private int j = 0; + + @Parsed(defaultNullRead = "1 ") + private String id; + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getJ() { + return j; + } + + public void setJ(int j) { + this.j = j; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { + PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); + equipmentTerminal.i = i; + equipmentTerminal.ni = ni; + equipmentTerminal.type = type; + equipmentTerminal.id = id; + equipmentTerminal.j = j; + equipmentTerminal.k = 0; + return equipmentTerminal; + } + } + + public static class PsseSubstationEquipmentTerminalThreeBuses { + + @Parsed + private int i; + + @Parsed + private int ni; + + @Parsed + private String type; + + @Parsed + private int j = 0; + + @Parsed + private int k = 0; + + @Parsed(defaultNullRead = "1 ") + private String id; + + public int getI() { + return i; + } + + public void setI(int i) { + this.i = i; + } + + public int getNi() { + return ni; + } + + public void setNi(int ni) { + this.ni = ni; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public int getJ() { + return j; + } + + public void setJ(int j) { + this.j = j; + } + + public int getK() { + return k; + } + + public void setK(int k) { + this.k = k; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { + PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); + equipmentTerminal.i = i; + equipmentTerminal.ni = ni; + equipmentTerminal.type = type; + equipmentTerminal.id = id; + equipmentTerminal.j = j; + equipmentTerminal.k = k; + return equipmentTerminal; + } + } + + public static class PsseSubstationNodex { + + public PsseSubstationNodex() { + } + + public PsseSubstationNodex(int isub, PsseSubstationNode node) { + this.isub = isub; + this.node = node; + } + + @Parsed + private int isub; + @Nested + private PsseSubstationNode node; + + public int getIsub() { + return isub; + } + + public PsseSubstationNode getNode() { + return node; + } + } + + public static class PsseSubstationSwitchingDevicex { + + public PsseSubstationSwitchingDevicex() { + + } + + public PsseSubstationSwitchingDevicex(int isub, PsseSubstationSwitchingDevice switchingDevice) { + this.isub = isub; + this.switchingDevice = switchingDevice; + } + + @Parsed + private int isub; + @Nested + private PsseSubstationSwitchingDevice switchingDevice; + + public int getIsub() { + return isub; + } + + public PsseSubstationSwitchingDevice getSwitchingDevice() { + return switchingDevice; + } + } + + public static class PsseSubstationEquipmentTerminalx { + + public PsseSubstationEquipmentTerminalx() { + + } + + public PsseSubstationEquipmentTerminalx(int isub, PsseSubstationEquipmentTerminal equipmentTerminal) { + this.isub = isub; + this.equipmentTerminal = equipmentTerminal; + } + + @Parsed + private int isub; + @Nested + private PsseSubstationEquipmentTerminal equipmentTerminal; + + public int getIsub() { + return isub; + } + + public PsseSubstationEquipmentTerminal getEquipmentTerminal() { + return equipmentTerminal; + } + } + + public static boolean isOneBus(String type) { + return type.equals("L") || type.equals("F") || type.equals("M") + || type.equals("S") || type.equals("I") || type.equals("D") + || type.equals("V") || type.equals("N") || type.equals("A"); + } + + public static boolean isTwoBuses(String type) { + return type.equals("B") || type.equals("2"); + } + + public static boolean isThreeBuses(String type) { + return type.equals("3"); + } +} diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawData35.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawData35.java index 764d282756f..9a54a934446 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawData35.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawData35.java @@ -67,7 +67,8 @@ public PssePowerFlowModel read(ReadOnlyDataSource dataSource, String ext, Contex model.addSwitchedShunts(new SwitchedShuntData().read(reader, context)); model.addGneDevice(new GneDeviceData().read(reader, context)); model.addInductionMachines(new InductionMachineData().read(reader, context)); - reader.skip(SUBSTATION); + + model.addSubstations(new SubstationData().read(reader, context)); return model; } @@ -125,7 +126,7 @@ private void write(PssePowerFlowModel model, Context context, BufferedOutputStre new GneDeviceData().write(model.getGneDevice(), context, outputStream); new InductionMachineData().write(model.getInductionMachines(), context, outputStream); - writeEmpty(SUBSTATION, outputStream); + new SubstationData().write(model.getSubstations(), context, outputStream); writeQ(outputStream); } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawxData35.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawxData35.java index 24b35c358ed..a7f72389290 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawxData35.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRawxData35.java @@ -72,6 +72,8 @@ private PssePowerFlowModel read(InputStream stream, Context context) throws IOEx model.addGneDevice(new GneDeviceData().read(null, context)); model.addInductionMachines(new InductionMachineData().read(null, context)); + model.addSubstations(new SubstationData().read(null, context)); + return model; } @@ -119,6 +121,8 @@ private void write(PssePowerFlowModel model, Context context, BufferedOutputStre new GneDeviceData().write(model.getGneDevice(), context, null); new InductionMachineData().write(model.getInductionMachines(), context, null); + new SubstationData().write(model.getSubstations(), context, null); + generator.writeEndObject(); // network generator.writeEndObject(); // root generator.flush(); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java index 6abd36abd8a..935ef89253b 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java @@ -44,8 +44,14 @@ public enum PowerFlowRecordGroup implements RecordGroupIdentification { SWITCHED_SHUNT("swshunt", "SWITCHED SHUNT"), GNE_DEVICE("gne", "GNE DEVICE"), INDUCTION_MACHINE("indmach", "INDUCTION MACHINE"), - SUBSTATION("sub"); - + SUBSTATION("sub", "SUBSTATION"), + INTERNAL_SUBSTATION_NODE("subnode"), + INTERNAL_SUBSTATION_SWITCHING_DEVICE("subswd"), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL("subterm"), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_COMMON_START("subterm"), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS("subterm"), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES("subterm"), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES("subterm"); private final String rawxNodeName; private final String rawName; diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java new file mode 100644 index 00000000000..eb9c0796456 --- /dev/null +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -0,0 +1,329 @@ +/** + * Copyright (c) 2024, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * SPDX-License-Identifier: MPL-2.0 + */ +package com.powsybl.psse.model.pf.io; + +import com.powsybl.psse.model.PsseException; +import com.powsybl.psse.model.io.*; +import com.powsybl.psse.model.pf.PsseSubstation; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +import static com.powsybl.psse.model.pf.PsseSubstation.*; +import static com.powsybl.psse.model.pf.io.PowerFlowRecordGroup.*; + +/** + * + * @author Luma Zamarreño {@literal } + * @author José Antonio Marqués {@literal } + */ +class SubstationData extends AbstractRecordGroup { + + SubstationData() { + super(SUBSTATION); + withIO(FileFormat.LEGACY_TEXT, new IOLegacyText(this)); + withIO(FileFormat.JSON, new IOJson(this)); + } + + @Override + protected Class psseTypeClass() { + return PsseSubstation.class; + } + + private static class IOLegacyText extends RecordGroupIOLegacyText { + + IOLegacyText(AbstractRecordGroup recordGroup) { + super(recordGroup); + } + + @Override + public List read(LegacyTextReader reader, Context context) throws IOException { + + SubstationRecordData recordData = new SubstationRecordData(); + List substationList = new ArrayList<>(); + + if (!reader.isQRecordFound()) { + String line = reader.readRecordLine(); + while (!reader.endOfBlock(line)) { + PsseSubstationRecord record = recordData.readFromStrings(Collections.singletonList(line), context).get(0); + + List nodeList = new SubstationNodeData().read(reader, context); + List switchingDeviceList = new SubstationSwitchingDeviceData().read(reader, context); + List equipmentTerminalList = readEquipmentTerminalData(reader, context); + + PsseSubstation substation = new PsseSubstation(record, nodeList, switchingDeviceList, equipmentTerminalList); + substationList.add(substation); + + line = reader.readRecordLine(); + } + } + + return substationList; + } + + private List readEquipmentTerminalData(LegacyTextReader reader, Context context) throws IOException { + SubstationEquipmentTerminalDataCommonStart commonStartData = new SubstationEquipmentTerminalDataCommonStart(); + List equipmentTerminalOneBusRecords = new ArrayList<>(); + List equipmentTerminalTwoBusesRecords = new ArrayList<>(); + List equipmentTerminalThreeBusesRecords = new ArrayList<>(); + + String line = reader.readRecordLine(); + while (!reader.endOfBlock(line)) { + PsseSubstationEquipmentTerminalCommonStart commonStart = commonStartData.readFromStrings(Collections.singletonList(line), context).get(0); + if (isOneBus(commonStart.getType())) { + equipmentTerminalOneBusRecords.add(line); + } else if (isTwoBuses(commonStart.getType())) { + equipmentTerminalTwoBusesRecords.add(line); + } else if (isThreeBuses(commonStart.getType())) { + equipmentTerminalThreeBusesRecords.add(line); + } else { + throw new PsseException("Unexpected equipment terminal type: " + commonStart.getType()); + } + line = reader.readRecordLine(); + } + + List equipmentTerminalOneBusList = new SubstationEquipmentTerminalDataOneBus().readFromStrings(equipmentTerminalOneBusRecords, context); + List equipmentTerminalTwoBusesList = new SubstationEquipmentTerminalDataTwoBuses().readFromStrings(equipmentTerminalTwoBusesRecords, context); + List equipmentTerminalThreeBusesList = new SubstationEquipmentTerminalDataThreeBuses().readFromStrings(equipmentTerminalThreeBusesRecords, context); + + List equipmentTerminalList = equipmentTerminalOneBusList.stream().map(PsseSubstationEquipmentTerminalOneBus::convertToEquipmentTerminal).collect(Collectors.toList()); + equipmentTerminalList.addAll(equipmentTerminalTwoBusesList.stream().map(PsseSubstationEquipmentTerminalTwoBuses::convertToEquipmentTerminal).toList()); + equipmentTerminalList.addAll(equipmentTerminalThreeBusesList.stream().map(PsseSubstationEquipmentTerminalThreeBuses::convertToEquipmentTerminal).toList()); + + return equipmentTerminalList; + } + + @Override + public void write(List substationList, Context context, OutputStream outputStream) { + + writeBegin(outputStream); + + substationList.forEach(substation -> { + + SubstationRecordData recordData = new SubstationRecordData(); + write(recordData.buildRecords(Collections.singletonList(substation.getRecord()), context.getFieldNames(SUBSTATION), recordData.quotedFields(), context), outputStream); + + writeComment(" BEGIN SUBSTATION NODE DATA", outputStream); + + SubstationNodeData nodeData = new SubstationNodeData(); + write(nodeData.buildRecords(substation.getNodes(), context.getFieldNames(INTERNAL_SUBSTATION_NODE), nodeData.quotedFields(), context), outputStream); + writeEndComment(" END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA", outputStream); + + SubstationSwitchingDeviceData switchingDeviceData = new SubstationSwitchingDeviceData(); + write(switchingDeviceData.buildRecords(substation.getSwitchingDevices(), context.getFieldNames(INTERNAL_SUBSTATION_SWITCHING_DEVICE), nodeData.quotedFields(), context), outputStream); + writeEndComment(" END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA", outputStream); + + write(writeEquipmentTerminalData(substation.getEquipmentTerminals(), context), outputStream); + writeEndComment(" END OF SUBSTATION EQUIPMENT TERMINAL DATA", outputStream); + }); + + writeEnd(outputStream); + } + + private List writeEquipmentTerminalData(List equipmentTerminalList, Context context) { + + List eqOneBus = equipmentTerminalList.stream().filter(eq -> isOneBus(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalOneBus).collect(Collectors.toList()); + List eqTwoBuses = equipmentTerminalList.stream().filter(eq -> isTwoBuses(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalTwoBuses).collect(Collectors.toList()); + List eqThreeBuses = equipmentTerminalList.stream().filter(eq -> isThreeBuses(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalThreeBuses).collect(Collectors.toList()); + + SubstationEquipmentTerminalDataOneBus oneBusData = new SubstationEquipmentTerminalDataOneBus(); + List strings = oneBusData.buildRecords(eqOneBus, context.getFieldNames(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS), oneBusData.quotedFields(), context); + + SubstationEquipmentTerminalDataTwoBuses twoBusesData = new SubstationEquipmentTerminalDataTwoBuses(); + strings.addAll(twoBusesData.buildRecords(eqTwoBuses, context.getFieldNames(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES), twoBusesData.quotedFields(), context)); + + SubstationEquipmentTerminalDataThreeBuses threeBusesData = new SubstationEquipmentTerminalDataThreeBuses(); + strings.addAll(threeBusesData.buildRecords(eqThreeBuses, context.getFieldNames(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES), threeBusesData.quotedFields(), context)); + + return strings; + } + + private static class SubstationNodeData extends AbstractRecordGroup { + SubstationNodeData() { + super(INTERNAL_SUBSTATION_NODE, "ni", "name", "i", "status", "vm", "va"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationNode.class; + } + } + + private static class SubstationSwitchingDeviceData extends AbstractRecordGroup { + SubstationSwitchingDeviceData() { + super(INTERNAL_SUBSTATION_SWITCHING_DEVICE, "ni", "nj", "ckt", "name", "type", "status", "nstat", "x", "rate1", "rate2", "rate3"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationSwitchingDevice.class; + } + } + + private static class SubstationEquipmentTerminalDataCommonStart extends AbstractRecordGroup { + SubstationEquipmentTerminalDataCommonStart() { + super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_COMMON_START, "i", "ni", "type"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminalCommonStart.class; + } + } + + private static class SubstationEquipmentTerminalDataOneBus extends AbstractRecordGroup { + SubstationEquipmentTerminalDataOneBus() { + super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS, "i", "ni", "type", "id"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminalOneBus.class; + } + } + + private static class SubstationEquipmentTerminalDataTwoBuses extends AbstractRecordGroup { + SubstationEquipmentTerminalDataTwoBuses() { + super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES, "i", "ni", "type", "j", "id"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminalTwoBuses.class; + } + } + + private static class SubstationEquipmentTerminalDataThreeBuses extends AbstractRecordGroup { + SubstationEquipmentTerminalDataThreeBuses() { + super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES, "i", "ni", "type", "j", "k", "id"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminalThreeBuses.class; + } + } + } + + private static class IOJson extends RecordGroupIOJson { + IOJson(AbstractRecordGroup recordGroup) { + super(recordGroup); + } + + @Override + public List read(LegacyTextReader reader, Context context) throws IOException { + if (reader != null) { + throw new PsseException("Unexpected reader. Should be null"); + } + List recordList = new SubstationRecordData().read(null, context); + List nodexList = new SubstationNodexData().read(null, context); + List switchingDevicexList = new SubstationSwitchingDevicexData().read(null, context); + List equipmentTerminalxList = new SubstationEquipmentTerminalxData().read(null, context); + return convertToSubstationList(recordList, nodexList, switchingDevicexList, equipmentTerminalxList); + } + + @Override + public void write(List substationList, Context context, OutputStream outputStream) { + if (outputStream != null) { + throw new PsseException("Unexpected outputStream. Should be null"); + } + List recordList = substationList.stream().map(PsseSubstation::getRecord).collect(Collectors.toList()); + new SubstationRecordData().write(recordList, context, null); + + List nodexList = new ArrayList<>(); + substationList.forEach(substation -> substation.getNodes().forEach(node -> nodexList.add( + new PsseSubstationNodex(substation.getRecord().getIs(), node)))); + new SubstationNodexData().write(nodexList, context, null); + + List switchingDevicexList = new ArrayList<>(); + substationList.forEach(substation -> substation.getSwitchingDevices().forEach(switchingDevice -> switchingDevicexList.add( + new PsseSubstationSwitchingDevicex(substation.getRecord().getIs(), switchingDevice)))); + new SubstationSwitchingDevicexData().write(switchingDevicexList, context, null); + + List equipmentTerminalxList = new ArrayList<>(); + substationList.forEach(substation -> substation.getEquipmentTerminals().forEach(equipmentTerminal -> equipmentTerminalxList.add( + new PsseSubstationEquipmentTerminalx(substation.getRecord().getIs(), equipmentTerminal)))); + new SubstationEquipmentTerminalxData().write(equipmentTerminalxList, context, null); + } + + private static List convertToSubstationList(List recordList, + List nodexList, List switchingDevicexList, + List equipmentTerminalxList) { + + List substationList = new ArrayList<>(); + for (PsseSubstationRecord record : recordList) { + List nodeList = nodexList.stream().filter(n -> n.getIsub() == record.getIs()).map(PsseSubstationNodex::getNode).collect(Collectors.toList()); + List switchingDeviceList = switchingDevicexList.stream().filter(sd -> sd.getIsub() == record.getIs()).map(PsseSubstationSwitchingDevicex::getSwitchingDevice).collect(Collectors.toList()); + List equipmentTerminalList = equipmentTerminalxList.stream().filter(eq -> eq.getIsub() == record.getIs()).map(PsseSubstationEquipmentTerminalx::getEquipmentTerminal).collect(Collectors.toList()); + + substationList.add(new PsseSubstation(record, nodeList, switchingDeviceList, equipmentTerminalList)); + } + return substationList; + } + + private static class SubstationNodexData extends AbstractRecordGroup { + SubstationNodexData() { + super(INTERNAL_SUBSTATION_NODE); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationNodex.class; + } + } + + private static class SubstationSwitchingDevicexData extends AbstractRecordGroup { + SubstationSwitchingDevicexData() { + super(INTERNAL_SUBSTATION_SWITCHING_DEVICE); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationSwitchingDevicex.class; + } + } + + private static class SubstationEquipmentTerminalxData extends AbstractRecordGroup { + SubstationEquipmentTerminalxData() { + super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminalx.class; + } + } + } + + private static class SubstationRecordData extends AbstractRecordGroup { + SubstationRecordData() { + super(SUBSTATION, "is", "name", "lati", "long", "srg"); + withQuotedFields(QUOTED_FIELDS); + } + + @Override + public Class psseTypeClass() { + return PsseSubstationRecord.class; + } + } + + private static final String[] QUOTED_FIELDS = {"name", "type", "id", "ckt", "eqid"}; +} diff --git a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java index f74693548ba..39840c4b02a 100644 --- a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java +++ b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java @@ -100,6 +100,14 @@ private ReadOnlyDataSource ieee14CompletedRawx35() { return new ResourceDataSource("IEEE_14_bus_completed_rev35", new ResourceSet("/", "IEEE_14_bus_completed_rev35.rawx")); } + private ReadOnlyDataSource ieee14NodeBreakerRaw35() { + return new ResourceDataSource("IEEE_14_bus_nodeBreaker_rev35", new ResourceSet("/", "IEEE_14_bus_nodeBreaker_rev35.raw")); + } + + private ReadOnlyDataSource ieee14NodeBreakerRawx35() { + return new ResourceDataSource("IEEE_14_bus_nodeBreaker_rev35", new ResourceSet("/", "IEEE_14_bus_nodeBreaker_rev35.rawx")); + } + private ReadOnlyDataSource ieee14InvalidRaw() { return new ResourceDataSource("IEEE_14_bus_invalid", new ResourceSet("/", "IEEE_14_bus_invalid.raw")); } @@ -695,6 +703,22 @@ void ieee14BusCompletedRev35RawxTest() throws IOException { assertEquals(expectedJson, toJson(rawData)); } + @Test + void ieee14BusNodeBreakerRev35Test() throws IOException { + String expectedJson = loadReference("/IEEE_14_bus_nodeBreaker_rev35.json"); + PssePowerFlowModel rawData = new PowerFlowRawData35().read(ieee14NodeBreakerRaw35(), "raw", new Context()); + assertNotNull(rawData); + assertEquals(expectedJson, toJson(rawData)); + } + + @Test + void ieee14BusNodeBreakerRev35RawxTest() throws IOException { + String expectedJson = loadReference("/IEEE_14_bus_nodeBreaker_rev35.json"); + PssePowerFlowModel rawData = new PowerFlowRawxData35().read(ieee14NodeBreakerRawx35(), "rawx", new Context()); + assertNotNull(rawData); + assertEquals(expectedJson, toJson(rawData)); + } + @Test void ieee14BusNonInductionMachineDataTest() throws IOException { String expectedJson = loadReference("/IEEE_14_bus.json"); @@ -758,6 +782,32 @@ void ieee14BusCompletedRev35RawxWriteTest() throws IOException { } } + @Test + void ieee14BusNodeBreakerRev35WriteTest() throws IOException { + Context context = new Context(); + PowerFlowRawData35 rawData35 = new PowerFlowRawData35(); + PssePowerFlowModel rawData = rawData35.read(ieee14NodeBreakerRaw35(), "raw", context); + assertNotNull(rawData); + + rawData35.write(rawData, context, new FileDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); + try (InputStream is = Files.newInputStream(fileSystem.getPath("/work/", "IEEE_14_bus_nodeBreaker_rev35_exported.raw"))) { + compareTxt(getClass().getResourceAsStream("/" + "IEEE_14_bus_nodeBreaker_rev35_exported.raw"), is); + } + } + + @Test + void ieee14BusNodeBreakerRev35RawxWriteTest() throws IOException { + Context context = new Context(); + PowerFlowRawxData35 rawxData35 = new PowerFlowRawxData35(); + PssePowerFlowModel rawData = rawxData35.read(ieee14NodeBreakerRawx35(), "rawx", context); + assertNotNull(rawData); + + rawxData35.write(rawData, context, new FileDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); + try (InputStream is = Files.newInputStream(fileSystem.getPath("/work/", "IEEE_14_bus_nodeBreaker_rev35_exported.rawx"))) { + compareTxt(getClass().getResourceAsStream("/" + "IEEE_14_bus_nodeBreaker_rev35_exported.rawx"), is); + } + } + @Test void invalidIeee14BusTest() throws IOException { Context context = new Context(); diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_Q_record_rev35.json b/psse/psse-model/src/test/resources/IEEE_14_bus_Q_record_rev35.json index 4d918533689..ba28f3d54ac 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_Q_record_rev35.json +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_Q_record_rev35.json @@ -1665,5 +1665,6 @@ "facts" : [ ], "switchedShunts" : [ ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_completed.json b/psse/psse-model/src/test/resources/IEEE_14_bus_completed.json index 533387594b7..ae1f9824f40 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_completed.json +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_completed.json @@ -1920,5 +1920,6 @@ "ia1" : 0.0, "ia2" : 0.0, "xamult" : 1.0 - } ] + } ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_completed_rev35.json b/psse/psse-model/src/test/resources/IEEE_14_bus_completed_rev35.json index d4fb7b755fc..303f6b2282a 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_completed_rev35.json +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_completed_rev35.json @@ -2254,5 +2254,6 @@ "ia1" : 0.0, "ia2" : 0.0, "xamult" : 1.0 - } ] + } ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.json b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.json new file mode 100644 index 00000000000..f4f5a121ae5 --- /dev/null +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.json @@ -0,0 +1,1971 @@ +{ + "caseIdentification" : { + "ic" : 0, + "sbase" : 100.0, + "rev" : 35, + "xfrrat" : 0.0, + "nxfrat" : 0.0, + "basfrq" : 60.0, + "title1" : " 08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case", + "title2" : "" + }, + "buses" : [ { + "i" : 1, + "name" : "Bus 1 ", + "baskv" : 138.0, + "ide" : 3, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.06, + "va" : 0.0, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 2, + "name" : "Bus 2 ", + "baskv" : 138.0, + "ide" : 2, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.045, + "va" : -4.9826, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 3, + "name" : "Bus 3 ", + "baskv" : 138.0, + "ide" : 2, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.01, + "va" : -12.725, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 4, + "name" : "Bus 4 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.01767, + "va" : -10.3128, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 5, + "name" : "Bus 5 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.01951, + "va" : -8.7738, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 6, + "name" : "Bus 6 ", + "baskv" : 138.0, + "ide" : 2, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.07, + "va" : -14.2209, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 7, + "name" : "Bus 7 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.06152, + "va" : -13.3596, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 8, + "name" : "Bus 8 ", + "baskv" : 138.0, + "ide" : 2, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.09, + "va" : -13.3596, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 9, + "name" : "Bus 9 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.05593, + "va" : -14.9385, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 10, + "name" : "Bus 10 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.05099, + "va" : -15.0972, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 11, + "name" : "Bus 11 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.05691, + "va" : -14.7906, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 12, + "name" : "Bus 12 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.05519, + "va" : -15.0755, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 13, + "name" : "Bus 13 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.05038, + "va" : -15.1562, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + }, { + "i" : 14, + "name" : "Bus 14 ", + "baskv" : 138.0, + "ide" : 1, + "area" : 1, + "zone" : 1, + "owner" : 1, + "vm" : 1.03553, + "va" : -16.0336, + "nvhi" : 1.1, + "nvlo" : 0.9, + "evhi" : 1.1, + "evlo" : 0.9 + } ], + "loads" : [ { + "i" : 2, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 21.7, + "ql" : 12.7, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 3, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 94.2, + "ql" : 19.0, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 4, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 47.8, + "ql" : -3.9, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 5, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 7.6, + "ql" : 1.6, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 6, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 11.2, + "ql" : 7.5, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 9, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 29.5, + "ql" : 16.6, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 10, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 9.0, + "ql" : 5.8, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 11, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 3.5, + "ql" : 1.8, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 12, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 6.1, + "ql" : 1.6, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 13, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 13.5, + "ql" : 5.8, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + }, { + "i" : 14, + "id" : "1 ", + "status" : 1, + "area" : 1, + "zone" : 1, + "pl" : 14.9, + "ql" : 5.0, + "ip" : 0.0, + "iq" : 0.0, + "yp" : 0.0, + "yq" : -0.0, + "owner" : 1, + "scale" : 1, + "intrpt" : 0, + "dgenp" : 0.0, + "dgenq" : 0.0, + "dgenm" : 0.0, + "loadtype" : " " + } ], + "fixedShunts" : [ { + "i" : 9, + "id" : " 1", + "status" : 1, + "gl" : 0.0, + "bl" : 19.0 + } ], + "generators" : [ { + "i" : 1, + "id" : "1 ", + "pg" : 232.392, + "qg" : -16.549, + "qt" : 0.0, + "qb" : 0.0, + "vs" : 1.06, + "ireg" : 0, + "mbase" : 615.0, + "zr" : 0.0, + "zx" : 1.0, + "rt" : 0.0, + "xt" : 0.0, + "gtap" : 1.0, + "stat" : 1, + "rmpct" : 100.0, + "pt" : 10000.0, + "pb" : -10000.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "wmod" : 0, + "wpf" : 1.0, + "nreg" : 0, + "baslod" : 0 + }, { + "i" : 2, + "id" : "1 ", + "pg" : 40.0, + "qg" : 43.556, + "qt" : 50.0, + "qb" : -40.0, + "vs" : 1.045, + "ireg" : 0, + "mbase" : 60.0, + "zr" : 0.0, + "zx" : 1.0, + "rt" : 0.0, + "xt" : 0.0, + "gtap" : 1.0, + "stat" : 1, + "rmpct" : 100.0, + "pt" : 10000.0, + "pb" : -10000.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "wmod" : 0, + "wpf" : 1.0, + "nreg" : 0, + "baslod" : 0 + }, { + "i" : 3, + "id" : "1 ", + "pg" : 0.0, + "qg" : 25.075, + "qt" : 40.0, + "qb" : 0.0, + "vs" : 1.01, + "ireg" : 0, + "mbase" : 60.0, + "zr" : 0.0, + "zx" : 1.0, + "rt" : 0.0, + "xt" : 0.0, + "gtap" : 1.0, + "stat" : 1, + "rmpct" : 100.0, + "pt" : 10000.0, + "pb" : -10000.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "wmod" : 0, + "wpf" : 1.0, + "nreg" : 0, + "baslod" : 0 + }, { + "i" : 6, + "id" : "1 ", + "pg" : 0.0, + "qg" : 12.73, + "qt" : 24.0, + "qb" : -6.0, + "vs" : 1.07, + "ireg" : 0, + "mbase" : 25.0, + "zr" : 0.0, + "zx" : 1.0, + "rt" : 0.0, + "xt" : 0.0, + "gtap" : 1.0, + "stat" : 1, + "rmpct" : 100.0, + "pt" : 10000.0, + "pb" : -10000.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "wmod" : 0, + "wpf" : 1.0, + "nreg" : 0, + "baslod" : 0 + }, { + "i" : 8, + "id" : "1 ", + "pg" : 0.0, + "qg" : 17.623, + "qt" : 24.0, + "qb" : -6.0, + "vs" : 1.09, + "ireg" : 0, + "mbase" : 25.0, + "zr" : 0.0, + "zx" : 1.0, + "rt" : 0.0, + "xt" : 0.0, + "gtap" : 1.0, + "stat" : 1, + "rmpct" : 100.0, + "pt" : 10000.0, + "pb" : -10000.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "wmod" : 0, + "wpf" : 1.0, + "nreg" : 0, + "baslod" : 0 + } ], + "nonTransformerBranches" : [ { + "i" : 1, + "j" : 2, + "ckt" : "1 ", + "r" : 0.01938, + "x" : 0.05917, + "b" : 0.0528, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 1, + "j" : 5, + "ckt" : "1 ", + "r" : 0.05403, + "x" : 0.22304, + "b" : 0.0492, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 2, + "j" : 3, + "ckt" : "1 ", + "r" : 0.04699, + "x" : 0.19797, + "b" : 0.0438, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 2, + "j" : 4, + "ckt" : "1 ", + "r" : 0.05811, + "x" : 0.17632, + "b" : 0.034, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 2, + "j" : 5, + "ckt" : "1 ", + "r" : 0.05695, + "x" : 0.17388, + "b" : 0.0346, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 3, + "j" : 4, + "ckt" : "1 ", + "r" : 0.06701, + "x" : 0.17103, + "b" : 0.0128, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 4, + "j" : 5, + "ckt" : "1 ", + "r" : 0.01335, + "x" : 0.04211, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 6, + "j" : 11, + "ckt" : "1 ", + "r" : 0.09498, + "x" : 0.1989, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 6, + "j" : 12, + "ckt" : "1 ", + "r" : 0.12291, + "x" : 0.25581, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 6, + "j" : 13, + "ckt" : "1 ", + "r" : 0.06615, + "x" : 0.13027, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 7, + "j" : 8, + "ckt" : "1 ", + "r" : 0.0, + "x" : 0.17615, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 7, + "j" : 9, + "ckt" : "1 ", + "r" : 0.0, + "x" : 0.11001, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 9, + "j" : 10, + "ckt" : "1 ", + "r" : 0.03181, + "x" : 0.0845, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 9, + "j" : 14, + "ckt" : "1 ", + "r" : 0.12711, + "x" : 0.27038, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 10, + "j" : 11, + "ckt" : "1 ", + "r" : 0.08205, + "x" : 0.19207, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 12, + "j" : 13, + "ckt" : "1 ", + "r" : 0.22092, + "x" : 0.19988, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + }, { + "i" : 13, + "j" : 14, + "ckt" : "1 ", + "r" : 0.17093, + "x" : 0.34802, + "b" : 0.0, + "rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "gi" : 0.0, + "bi" : 0.0, + "gj" : 0.0, + "bj" : 0.0, + "st" : 1, + "met" : 1, + "len" : 0.0, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "name" : " " + } ], + "transformers" : [ { + "anstar" : 0.0, + "ckt" : "1 ", + "cm" : 1, + "cw" : 1, + "cz" : 1, + "i" : 4, + "j" : 7, + "k" : 0, + "mag1" : 0.0, + "mag2" : 0.0, + "name" : " ", + "nmetr" : 2, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "r12" : 0.0, + "r23" : 0.0, + "r31" : 0.0, + "sbase12" : 100.0, + "sbase23" : "NaN", + "sbase31" : "NaN", + "stat" : 1, + "vecgrp" : " ", + "vmstar" : 1.0, + "winding1" : { + "windv" : 0.978, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : 1.5, + "rmi" : 0.51, + "vma" : 1.5, + "vmi" : 0.51, + "ntp" : 159, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding1Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding2" : { + "windv" : 1.0, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding2Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding3" : { + "windv" : "NaN", + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding3Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "x12" : 0.20912, + "x23" : "NaN", + "x31" : "NaN", + "zcod" : 0 + }, { + "anstar" : 0.0, + "ckt" : "1 ", + "cm" : 1, + "cw" : 1, + "cz" : 1, + "i" : 4, + "j" : 9, + "k" : 0, + "mag1" : 0.0, + "mag2" : 0.0, + "name" : " ", + "nmetr" : 2, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "r12" : 0.0, + "r23" : 0.0, + "r31" : 0.0, + "sbase12" : 100.0, + "sbase23" : "NaN", + "sbase31" : "NaN", + "stat" : 1, + "vecgrp" : " ", + "vmstar" : 1.0, + "winding1" : { + "windv" : 0.969, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : 1.5, + "rmi" : 0.51, + "vma" : 1.5, + "vmi" : 0.51, + "ntp" : 159, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding1Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding2" : { + "windv" : 1.0, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding2Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding3" : { + "windv" : "NaN", + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding3Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "x12" : 0.55618, + "x23" : "NaN", + "x31" : "NaN", + "zcod" : 0 + }, { + "anstar" : 0.0, + "ckt" : "1 ", + "cm" : 1, + "cw" : 1, + "cz" : 1, + "i" : 5, + "j" : 6, + "k" : 0, + "mag1" : 0.0, + "mag2" : 0.0, + "name" : " ", + "nmetr" : 2, + "ownership" : { + "o1" : 1, + "f1" : 1.0, + "o2" : 0, + "f2" : 1.0, + "o3" : 0, + "f3" : 1.0, + "o4" : 0, + "f4" : 1.0 + }, + "r12" : 0.0, + "r23" : 0.0, + "r31" : 0.0, + "sbase12" : 100.0, + "sbase23" : "NaN", + "sbase31" : "NaN", + "stat" : 1, + "vecgrp" : " ", + "vmstar" : 1.0, + "winding1" : { + "windv" : 0.932, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : 1.5, + "rmi" : 0.51, + "vma" : 1.5, + "vmi" : 0.51, + "ntp" : 159, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding1Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding2" : { + "windv" : 1.0, + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding2Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "winding3" : { + "windv" : "NaN", + "nomv" : 0.0, + "ang" : 0.0, + "cod" : 0, + "cont" : 0, + "node" : 0, + "rma" : "NaN", + "rmi" : "NaN", + "vma" : "NaN", + "vmi" : "NaN", + "ntp" : 33, + "tab" : 0, + "cr" : 0.0, + "cx" : 0.0, + "cnxa" : 0.0 + }, + "winding3Rates" : { + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0, + "rate4" : 0.0, + "rate5" : 0.0, + "rate6" : 0.0, + "rate7" : 0.0, + "rate8" : 0.0, + "rate9" : 0.0, + "rate10" : 0.0, + "rate11" : 0.0, + "rate12" : 0.0 + }, + "x12" : 0.25202, + "x23" : "NaN", + "x31" : "NaN", + "zcod" : 0 + } ], + "areas" : [ { + "i" : 1, + "isw" : 2, + "pdes" : 0.0, + "ptol" : 999.99, + "arname" : "IEEE14 " + } ], + "twoTerminalDcTransmissionLines" : [ ], + "voltageSourceConverterDcTransmissionLines" : [ ], + "transformerImpedanceCorrections" : [ ], + "multiTerminalDcTransmissionLines" : [ ], + "lineGrouping" : [ ], + "zones" : [ ], + "interareaTransfer" : [ ], + "owners" : [ { + "i" : 1, + "owname" : "1" + } ], + "facts" : [ ], + "switchedShunts" : [ ], + "gneDevice" : [ ], + "inductionMachines" : [ ], + "substations" : [ { + "is" : 1, + "name" : "STATION 1", + "lati" : 0.0, + "long" : 0.0, + "srg" : 0.1, + "nodes" : [ { + "ni" : 1, + "name" : "NB1", + "i" : 1, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 2, + "name" : "NB2", + "i" : 1, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 3, + "name" : "NL2", + "i" : 1, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 4, + "name" : "NL5", + "i" : 1, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 5, + "name" : "NG1", + "i" : 1, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + } ], + "switchingDevices" : [ { + "ni" : 1, + "nj" : 2, + "ckt" : "1 ", + "name" : "Sw-BusBars", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 1, + "nj" : 3, + "ckt" : "1 ", + "name" : "Sw-BranchToBus2", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 2, + "nj" : 4, + "ckt" : "1 ", + "name" : "Sw-BranchToBus5", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 2, + "nj" : 5, + "ckt" : "1 ", + "name" : "Sw-Gen1", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + } ], + "equipmentTerminals" : [ { + "i" : 1, + "ni" : 5, + "type" : "M", + "id" : "1 ", + "j" : 0, + "k" : 0 + }, { + "i" : 1, + "ni" : 3, + "type" : "B", + "id" : "1 ", + "j" : 2, + "k" : 0 + }, { + "i" : 1, + "ni" : 4, + "type" : "B", + "id" : "1 ", + "j" : 5, + "k" : 0 + } ] + }, { + "is" : 2, + "name" : "STATION 5", + "lati" : 0.0, + "long" : 0.0, + "srg" : 0.1, + "nodes" : [ { + "ni" : 1, + "name" : "NB1", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 2, + "name" : "NB2", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 3, + "name" : "NL3", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 4, + "name" : "NL4", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 5, + "name" : "NL5", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 6, + "name" : "NL1", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 7, + "name" : "NG1", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + }, { + "ni" : 8, + "name" : "NLd1", + "i" : 2, + "status" : 1, + "vm" : 1.0, + "va" : 0.0 + } ], + "switchingDevices" : [ { + "ni" : 1, + "nj" : 2, + "ckt" : "1 ", + "name" : "Sw-BusBars", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 1, + "nj" : 6, + "ckt" : "1 ", + "name" : "Sw-BranchToBus1", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 1, + "nj" : 7, + "ckt" : "1 ", + "name" : "Sw-Gen1", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 1, + "nj" : 8, + "ckt" : "1 ", + "name" : "Sw-Load1", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 2, + "nj" : 3, + "ckt" : "1 ", + "name" : "Sw-BranchToBus3", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 2, + "nj" : 4, + "ckt" : "1 ", + "name" : "Sw-BranchToBus4", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + }, { + "ni" : 2, + "nj" : 5, + "ckt" : "1 ", + "name" : "Sw-BranchToBus5", + "type" : 2, + "status" : 1, + "nstat" : 1, + "x" : 0.0, + "rate1" : 0.0, + "rate2" : 0.0, + "rate3" : 0.0 + } ], + "equipmentTerminals" : [ { + "i" : 2, + "ni" : 7, + "type" : "M", + "id" : "1 ", + "j" : 0, + "k" : 0 + }, { + "i" : 2, + "ni" : 8, + "type" : "L", + "id" : "1 ", + "j" : 0, + "k" : 0 + }, { + "i" : 2, + "ni" : 6, + "type" : "B", + "id" : "1 ", + "j" : 1, + "k" : 0 + }, { + "i" : 2, + "ni" : 3, + "type" : "B", + "id" : "1 ", + "j" : 3, + "k" : 0 + }, { + "i" : 2, + "ni" : 4, + "type" : "B", + "id" : "1 ", + "j" : 4, + "k" : 0 + }, { + "i" : 2, + "ni" : 5, + "type" : "B", + "id" : "1 ", + "j" : 5, + "k" : 0 + } ] + } ] +} \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.rawx b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.rawx new file mode 100644 index 00000000000..ef3155f2880 --- /dev/null +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35.rawx @@ -0,0 +1,193 @@ +{ + "network":{ + "caseid":{ + "fields":["ic", "sbase", "rev", "xfrrat", "nxfrat", "basfrq", "title1", "title2"], + "data":[0, 100.00, 35, 0, 0, 60.00, + " 08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case", ""] + }, + "bus":{ + "fields":["ibus", "name", "baskv", "ide", "area", "zone", "owner", "vm", "va"], + "data":[ + [1, "Bus 1 ", 138.0000, 3, 1, 1, 1, 1.06000, 0.0000], + [2, "Bus 2 ", 138.0000, 2, 1, 1, 1, 1.04500, -4.9826], + [3, "Bus 3 ", 138.0000, 2, 1, 1, 1, 1.01000, -12.7250], + [4, "Bus 4 ", 138.0000, 1, 1, 1, 1, 1.01767, -10.3128], + [5, "Bus 5 ", 138.0000, 1, 1, 1, 1, 1.01951, -8.7738], + [6, "Bus 6 ", 138.0000, 2, 1, 1, 1, 1.07000, -14.2209], + [7, "Bus 7 ", 138.0000, 1, 1, 1, 1, 1.06152, -13.3596], + [8, "Bus 8 ", 138.0000, 2, 1, 1, 1, 1.09000, -13.3596], + [9, "Bus 9 ", 138.0000, 1, 1, 1, 1, 1.05593, -14.9385], + [10, "Bus 10 ", 138.0000, 1, 1, 1, 1, 1.05099, -15.0972], + [11, "Bus 11 ", 138.0000, 1, 1, 1, 1, 1.05691, -14.7906], + [12, "Bus 12 ", 138.0000, 1, 1, 1, 1, 1.05519, -15.0755], + [13, "Bus 13 ", 138.0000, 1, 1, 1, 1, 1.05038, -15.1562], + [14, "Bus 14 ", 138.0000, 1, 1, 1, 1, 1.03553, -16.0336] + ] + }, + "load":{ + "fields":["ibus", "loadid", "stat", "area", "zone", "pl", "ql", "ip", "iq", "yp", "yq", "owner", "scale"], + "data":[ + [2, "1 ", 1, 1, 1, 21.700, 12.700, 0.000, 0.000, 0.000, -0.000, 1, 1], + [3, "1 ", 1, 1, 1, 94.200, 19.000, 0.000, 0.000, 0.000, -0.000, 1, 1], + [4, "1 ", 1, 1, 1, 47.800, -3.900, 0.000, 0.000, 0.000, -0.000, 1, 1], + [5, "1 ", 1, 1, 1, 7.600, 1.600, 0.000, 0.000, 0.000, -0.000, 1, 1], + [6, "1 ", 1, 1, 1, 11.200, 7.500, 0.000, 0.000, 0.000, -0.000, 1, 1], + [9, "1 ", 1, 1, 1, 29.500, 16.600, 0.000, 0.000, 0.000, -0.000, 1, 1], + [10, "1 ", 1, 1, 1, 9.000, 5.800, 0.000, 0.000, 0.000, -0.000, 1, 1], + [11, "1 ", 1, 1, 1, 3.500, 1.800, 0.000, 0.000, 0.000, -0.000, 1, 1], + [12, "1 ", 1, 1, 1, 6.100, 1.600, 0.000, 0.000, 0.000, -0.000, 1, 1], + [13, "1 ", 1, 1, 1, 13.500, 5.800, 0.000, 0.000, 0.000, -0.000, 1, 1], + [14, "1 ", 1, 1, 1, 14.900, 5.000, 0.000, 0.000, 0.000, -0.000, 1, 1] + ] + }, + "fixshunt":{ + "fields":["ibus", "shntid", "stat", "gl", "bl"], + "data":[ + [9, " 1", 1, 0.000, 19.000] + ] + }, + "generator":{ + "fields":["ibus", "machid", "pg", "qg", "qt", "qb", "vs", "ireg", "mbase", "zr", "zx", "rt", "xt", "gtap", "stat", + "rmpct", "pt", "pb", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4", "wmod", "wpf"], + "data":[ + [1, "1 ", 232.392, -16.549, 0.000, 0.000, 1.06000, 0, 615.000, 0.00000, 1.00000, 0.00000, 0.00000, 1.00000, 1, + 100.0, 10000.000, -10000.000, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [2, "1 ", 40.000, 43.556, 50.000, -40.000, 1.04500, 0, 60.000, 0.00000, 1.00000, 0.00000, 0.00000, 1.00000, 1, + 100.0, 10000.000, -10000.000, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [3, "1 ", 0.000, 25.075, 40.000, 0.000, 1.01000, 0, 60.000, 0.00000, 1.00000, 0.00000, 0.00000, 1.00000, 1, + 100.0, 10000.000, -10000.000, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000,0, 1.0000], + [6, "1 ", 0.000, 12.730, 24.000, -6.000, 1.07000, 0, 25.000, 0.00000, 1.00000, 0.00000, 0.00000, 1.00000, 1, + 100.0, 10000.000, -10000.000, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000,0, 1.0000], + [8, "1 ", 0.000, 17.623, 24.000, -6.000, 1.09000, 0, 25.000, 0.00000, 1.00000, 0.00000, 0.00000, 1.00000, 1, + 100.0, 10000.000, -10000.000, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000] + ] + }, + "acline":{ + "fields":["ibus", "jbus", "ckt", "rpu", "xpu", "bpu", "rate1", "rate2", "rate3", "gi", "bi", "gj", "bj", "stat", + "met", "len", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4"], + "data":[ + [1, 2, "1 ", 0.01938, 0.05917, 0.05280, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [1, 5, "1 ", 0.05403, 0.22304, 0.04920, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [2, 3, "1 ", 0.04699, 0.19797, 0.04380, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [2, 4, "1 ", 0.05811, 0.17632, 0.03400, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [2, 5, "1 ", 0.05695, 0.17388, 0.03460, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [3, 4, "1 ", 0.06701, 0.17103, 0.01280, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [4, 5, "1 ", 0.01335, 0.04211, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [6, 11, "1 ", 0.09498, 0.19890, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [6, 12, "1 ", 0.12291, 0.25581, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [6, 13, "1 ", 0.06615, 0.13027, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [7, 8, "1 ", 0.00000, 0.17615, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [7, 9, "1 ", 0.00000, 0.11001, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [9, 10, "1 ", 0.03181, 0.08450, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [9, 14, "1 ", 0.12711, 0.27038, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [10, 11, "1 ", 0.08205, 0.19207, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [12, 13, "1 ", 0.22092, 0.19988, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000], + [13, 14, "1 ", 0.17093, 0.34802, 0.00000, 0.00, 0.00, 0.00, 0.00000, 0.00000, 0.00000, 0.00000, 1, + 1, 0.0, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000] + ] + }, + "transformer":{ + "fields":["ibus", "jbus", "kbus", "ckt", "cw", "cz", "cm", "mag1", "mag2", "nmet", "name", "stat", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4", + "r1_2", "x1_2", "sbase1_2", + "windv1", "nomv1", "ang1", "wdg1rate1", "wdg1rate2", "wdg1rate3", "cod1", "cont1", "rma1", "rmi1", "vma1", "vmi1", "ntp1", "tab1", "cr1", "cx1", + "windv2", "nomv2"], + "data":[ + [4, 7, 0, "1 ", 1, 1, 1, 0.00000, 0.00000, 2, " ", 1, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, + 0.00000, 0.20912, 100.00, + 0.97800, 0.000, 0.000, 0.00, 0.00, 0.00, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000, 159, 0, 0.00000, 0.00000, + 1.00000, 0.000], + [4, 9, 0, "1 ", 1, 1, 1, 0.00000, 0.00000, 2, " ", 1, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, + 0.00000, 0.55618, 100.00, + 0.96900, 0.000, 0.000, 0.00, 0.00, 0.00, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000, 159, 0, 0.00000, 0.00000, + 1.00000, 0.000], + [5, 6, 0, "1 ", 1, 1, 1, 0.00000, 0.00000, 2, " ", 1, 1, 1.0000, 0, 1.0000, 0, 1.0000, 0, 1.0000, + 0.00000, 0.25202, 100.00, + 0.93200, 0.000, 0.000, 0.00, 0.00, 0.00, 0, 0, 1.50000, 0.51000, 1.50000, 0.51000, 159, 0, 0.00000, 0.00000, + 1.00000, 0.000] + ] + }, + "area":{ + "fields":["iarea", "isw", "pdes", "ptol", "arname"], + "data":[ + [1, 2, 0.000, 999.990, "IEEE14 "] + ] + }, + "owner":{ + "fields":["iowner", "owname"], + "data":[ + [1, "1"] + ] + }, + "sub":{ + "fields":["isub", "name", "lati", "long", "srg"], + "data":[ + [1, "STATION 1", 0.0, 0.0, 0.1], + [2, "STATION 5", 0.0, 0.0, 0.1] + ] + }, + "subnode":{ + "fields":["isub", "inode", "name", "ibus", "stat", "vm", "va"], + "data":[ + [1, 1, "NB1", 1, 1, 1.0, 0.0], + [1, 2, "NB2", 1, 1, 1.0, 0.0], + [1, 3, "NL2", 1, 1, 1.0, 0.0], + [1, 4, "NL5", 1, 1, 1.0, 0.0], + [1, 5, "NG1", 1, 1, 1.0, 0.0], + [2, 1, "NB1", 2, 1, 1.0, 0.0], + [2, 2, "NB2", 2, 1, 1.0, 0.0], + [2, 3, "NL3", 2, 1, 1.0, 0.0], + [2, 4, "NL4", 2, 1, 1.0, 0.0], + [2, 5, "NL5", 2, 1, 1.0, 0.0], + [2, 6, "NL1", 2, 1, 1.0, 0.0], + [2, 7, "NG1", 2, 1, 1.0, 0.0], + [2, 8, "NLd1", 2, 1, 1.0, 0.0] + ] + }, + "subswd":{ + "fields":["isub", "inode", "jnode", "swdid", "name", "type", "stat", "nstat", "xpu", "rate1", "rate2", "rate3"], + "data":[ + [1, 1, 2, "1 ", "Sw-BusBars", 2, 1, 1, 0, 0, 0, 0], + [1, 1, 3, "1 ", "Sw-BranchToBus2", 2, 1, 1, 0, 0, 0, 0], + [1, 2, 4, "1 ", "Sw-BranchToBus5", 2, 1, 1, 0, 0, 0, 0], + [1, 2, 5, "1 ", "Sw-Gen1", 2, 1, 1, 0, 0, 0, 0], + [2, 1, 2, "1 ", "Sw-BusBars", 2, 1, 1, 0, 0, 0, 0], + [2, 1, 6, "1 ", "Sw-BranchToBus1", 2, 1, 1, 0, 0, 0, 0], + [2, 1, 7, "1 ", "Sw-Gen1", 2, 1, 1, 0, 0, 0, 0], + [2, 1, 8, "1 ", "Sw-Load1", 2, 1, 1, 0, 0, 0, 0], + [2, 2, 3, "1 ", "Sw-BranchToBus3", 2, 1, 1, 0, 0, 0, 0], + [2, 2, 4, "1 ", "Sw-BranchToBus4", 2, 1, 1, 0, 0, 0, 0], + [2, 2, 5, "1 ", "Sw-BranchToBus5", 2, 1, 1, 0, 0, 0, 0] + ] + }, + "subterm":{ + "fields":["isub", "inode", "type", "eqid", "ibus", "jbus", "kbus"], + "data":[ + [1, 5, "M", "1 ", 1, null, null], + [1, 3, "B", "1 ", 1, 2, null], + [1, 4, "B", "1 ", 1, 5, null], + [2, 7, "M", "1 ", 2, null, null], + [2, 8, "L", "1 ", 2, null, null], + [2, 6, "B", "1 ", 2, 1, null], + [2, 3, "B", "1 ", 2, 3, null], + [2, 4, "B", "1 ", 2, 4, null], + [2, 5, "B", "1 ", 2, 5, null] + ] + } + } +} \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw new file mode 100644 index 00000000000..a9775c5957c --- /dev/null +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw @@ -0,0 +1,131 @@ +0,100.0,35,0.0,0.0,60.0 + 08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case + +0 / END OF SYSTEM-WIDE DATA, BEGIN BUS DATA +1,'Bus 1 ',138.0,3,1,1,1,1.06,0.0 +2,'Bus 2 ',138.0,2,1,1,1,1.045,-4.9826 +3,'Bus 3 ',138.0,2,1,1,1,1.01,-12.725 +4,'Bus 4 ',138.0,1,1,1,1,1.01767,-10.3128 +5,'Bus 5 ',138.0,1,1,1,1,1.01951,-8.7738 +6,'Bus 6 ',138.0,2,1,1,1,1.07,-14.2209 +7,'Bus 7 ',138.0,1,1,1,1,1.06152,-13.3596 +8,'Bus 8 ',138.0,2,1,1,1,1.09,-13.3596 +9,'Bus 9 ',138.0,1,1,1,1,1.05593,-14.9385 +10,'Bus 10 ',138.0,1,1,1,1,1.05099,-15.0972 +11,'Bus 11 ',138.0,1,1,1,1,1.05691,-14.7906 +12,'Bus 12 ',138.0,1,1,1,1,1.05519,-15.0755 +13,'Bus 13 ',138.0,1,1,1,1,1.05038,-15.1562 +14,'Bus 14 ',138.0,1,1,1,1,1.03553,-16.0336 +0 / END OF BUS DATA, BEGIN LOAD DATA +2,'1 ',1,1,1,21.7,12.7,0.0,0.0,0.0,-0.0,1,1 +3,'1 ',1,1,1,94.2,19.0,0.0,0.0,0.0,-0.0,1,1 +4,'1 ',1,1,1,47.8,-3.9,0.0,0.0,0.0,-0.0,1,1 +5,'1 ',1,1,1,7.6,1.6,0.0,0.0,0.0,-0.0,1,1 +6,'1 ',1,1,1,11.2,7.5,0.0,0.0,0.0,-0.0,1,1 +9,'1 ',1,1,1,29.5,16.6,0.0,0.0,0.0,-0.0,1,1 +10,'1 ',1,1,1,9.0,5.8,0.0,0.0,0.0,-0.0,1,1 +11,'1 ',1,1,1,3.5,1.8,0.0,0.0,0.0,-0.0,1,1 +12,'1 ',1,1,1,6.1,1.6,0.0,0.0,0.0,-0.0,1,1 +13,'1 ',1,1,1,13.5,5.8,0.0,0.0,0.0,-0.0,1,1 +14,'1 ',1,1,1,14.9,5.0,0.0,0.0,0.0,-0.0,1,1 +0 / END OF LOAD DATA, BEGIN FIXED SHUNT DATA +9,' 1',1,0.0,19.0 +0 / END OF FIXED SHUNT DATA, BEGIN GENERATOR DATA +1,'1 ',232.392,-16.549,0.0,0.0,1.06,0,0,615.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 +2,'1 ',40.0,43.556,50.0,-40.0,1.045,0,0,60.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 +3,'1 ',0.0,25.075,40.0,0.0,1.01,0,0,60.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 +6,'1 ',0.0,12.73,24.0,-6.0,1.07,0,0,25.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 +8,'1 ',0.0,17.623,24.0,-6.0,1.09,0,0,25.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 +0 / END OF GENERATOR DATA, BEGIN BRANCH DATA +1,2,'1 ',0.01938,0.05917,0.0528,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +1,5,'1 ',0.05403,0.22304,0.0492,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +2,3,'1 ',0.04699,0.19797,0.0438,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +2,4,'1 ',0.05811,0.17632,0.034,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +2,5,'1 ',0.05695,0.17388,0.0346,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +3,4,'1 ',0.06701,0.17103,0.0128,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +4,5,'1 ',0.01335,0.04211,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +6,11,'1 ',0.09498,0.1989,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +6,12,'1 ',0.12291,0.25581,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +6,13,'1 ',0.06615,0.13027,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +7,8,'1 ',0.0,0.17615,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +7,9,'1 ',0.0,0.11001,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +9,10,'1 ',0.03181,0.0845,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +9,14,'1 ',0.12711,0.27038,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +10,11,'1 ',0.08205,0.19207,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +12,13,'1 ',0.22092,0.19988,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +13,14,'1 ',0.17093,0.34802,0.0,' ',0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 +0 / END OF BRANCH DATA, BEGIN SYSTEM SWITCHING DEVICE DATA +0 / END OF SYSTEM SWITCHING DEVICE DATA, BEGIN TRANSFORMER DATA +4,7,0,'1 ',1,1,1,0.0,0.0,2,' ',1,1,1.0,0,1.0,0,1.0,0,1.0 +0.0,0.20912,100.0 +0.978,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0 +1.0,0.0 +4,9,0,'1 ',1,1,1,0.0,0.0,2,' ',1,1,1.0,0,1.0,0,1.0,0,1.0 +0.0,0.55618,100.0 +0.969,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0 +1.0,0.0 +5,6,0,'1 ',1,1,1,0.0,0.0,2,' ',1,1,1.0,0,1.0,0,1.0,0,1.0 +0.0,0.25202,100.0 +0.932,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0 +1.0,0.0 +0 / END OF TRANSFORMER DATA, BEGIN AREA DATA +1,2,0.0,999.99,'IEEE14 ' +0 / END OF AREA DATA, BEGIN TWO-TERMINAL DC DATA +0 / END OF TWO-TERMINAL DC DATA, BEGIN VOLTAGE SOURCE CONVERTER DATA +0 / END OF VOLTAGE SOURCE CONVERTER DATA, BEGIN IMPEDANCE CORRECTION DATA +0 / END OF IMPEDANCE CORRECTION DATA, BEGIN MULTI-TERMINAL DC DATA +0 / END OF MULTI-TERMINAL DC DATA, BEGIN MULTI-SECTION LINE DATA +0 / END OF MULTI-SECTION LINE DATA, BEGIN ZONE DATA +0 / END OF ZONE DATA, BEGIN INTER-AREA TRANSFER DATA +0 / END OF INTER-AREA TRANSFER DATA, BEGIN OWNER DATA +1,'1' +0 / END OF OWNER DATA, BEGIN FACTS CONTROL DEVICE DATA +0 / END OF FACTS CONTROL DEVICE DATA, BEGIN SWITCHED SHUNT DATA +0 / END OF SWITCHED SHUNT DATA, BEGIN GNE DEVICE DATA +0 / END OF GNE DEVICE DATA, BEGIN INDUCTION MACHINE DATA +0 / END OF INDUCTION MACHINE DATA, BEGIN SUBSTATION DATA +1,'STATION 1',0.0,0.0,0.1 + / BEGIN SUBSTATION NODE DATA +1,'NB1',1,1,1.0,0.0 +2,'NB2',1,1,1.0,0.0 +3,'NL2',1,1,1.0,0.0 +4,'NL5',1,1,1.0,0.0 +5,'NG1',1,1,1.0,0.0 +0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA +1,2,'1 ','Sw-BusBars','2',1,1,0.0,0.0,0.0,0.0 +1,3,'1 ','Sw-BranchToBus2','2',1,1,0.0,0.0,0.0,0.0 +2,4,'1 ','Sw-BranchToBus5','2',1,1,0.0,0.0,0.0,0.0 +2,5,'1 ','Sw-Gen1','2',1,1,0.0,0.0,0.0,0.0 +0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA +1,5,'M','1 ' +1,3,'B',2,'1 ' +1,4,'B',5,'1 ' +0 / END OF SUBSTATION EQUIPMENT TERMINAL DATA +2,'STATION 5',0.0,0.0,0.1 + / BEGIN SUBSTATION NODE DATA +1,'NB1',2,1,1.0,0.0 +2,'NB2',2,1,1.0,0.0 +3,'NL3',2,1,1.0,0.0 +4,'NL4',2,1,1.0,0.0 +5,'NL5',2,1,1.0,0.0 +6,'NL1',2,1,1.0,0.0 +7,'NG1',2,1,1.0,0.0 +8,'NLd1',2,1,1.0,0.0 +0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA +1,2,'1 ','Sw-BusBars','2',1,1,0.0,0.0,0.0,0.0 +1,6,'1 ','Sw-BranchToBus1','2',1,1,0.0,0.0,0.0,0.0 +1,7,'1 ','Sw-Gen1','2',1,1,0.0,0.0,0.0,0.0 +1,8,'1 ','Sw-Load1','2',1,1,0.0,0.0,0.0,0.0 +2,3,'1 ','Sw-BranchToBus3','2',1,1,0.0,0.0,0.0,0.0 +2,4,'1 ','Sw-BranchToBus4','2',1,1,0.0,0.0,0.0,0.0 +2,5,'1 ','Sw-BranchToBus5','2',1,1,0.0,0.0,0.0,0.0 +0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA +2,7,'M','1 ' +2,8,'L','1 ' +2,6,'B',1,'1 ' +2,3,'B',3,'1 ' +2,4,'B',4,'1 ' +2,5,'B',5,'1 ' +0 / END OF SUBSTATION EQUIPMENT TERMINAL DATA +0 / END OF SUBSTATION DATA +Q diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx new file mode 100644 index 00000000000..1e99ebc3e3a --- /dev/null +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx @@ -0,0 +1,156 @@ +{ + "network" : { + "caseid" : { + "fields" : [ "ic", "sbase", "rev", "xfrrat", "nxfrat", "basfrq", "title1", "title2" ], + "data" : [ 0,100.0,35,0.0,0.0,60.0," 08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case","" ] + }, + "bus" : { + "fields" : [ "ibus", "name", "baskv", "ide", "area", "zone", "owner", "vm", "va" ], + "data" : [ + [ 1,"Bus 1 ",138.0,3,1,1,1,1.06,0.0 ], + [ 2,"Bus 2 ",138.0,2,1,1,1,1.045,-4.9826 ], + [ 3,"Bus 3 ",138.0,2,1,1,1,1.01,-12.725 ], + [ 4,"Bus 4 ",138.0,1,1,1,1,1.01767,-10.3128 ], + [ 5,"Bus 5 ",138.0,1,1,1,1,1.01951,-8.7738 ], + [ 6,"Bus 6 ",138.0,2,1,1,1,1.07,-14.2209 ], + [ 7,"Bus 7 ",138.0,1,1,1,1,1.06152,-13.3596 ], + [ 8,"Bus 8 ",138.0,2,1,1,1,1.09,-13.3596 ], + [ 9,"Bus 9 ",138.0,1,1,1,1,1.05593,-14.9385 ], + [ 10,"Bus 10 ",138.0,1,1,1,1,1.05099,-15.0972 ], + [ 11,"Bus 11 ",138.0,1,1,1,1,1.05691,-14.7906 ], + [ 12,"Bus 12 ",138.0,1,1,1,1,1.05519,-15.0755 ], + [ 13,"Bus 13 ",138.0,1,1,1,1,1.05038,-15.1562 ], + [ 14,"Bus 14 ",138.0,1,1,1,1,1.03553,-16.0336 ] + ] + }, + "load" : { + "fields" : [ "ibus", "loadid", "stat", "area", "zone", "pl", "ql", "ip", "iq", "yp", "yq", "owner", "scale" ], + "data" : [ + [ 2,"1 ",1,1,1,21.7,12.7,0.0,0.0,0.0,-0.0,1,1 ], + [ 3,"1 ",1,1,1,94.2,19.0,0.0,0.0,0.0,-0.0,1,1 ], + [ 4,"1 ",1,1,1,47.8,-3.9,0.0,0.0,0.0,-0.0,1,1 ], + [ 5,"1 ",1,1,1,7.6,1.6,0.0,0.0,0.0,-0.0,1,1 ], + [ 6,"1 ",1,1,1,11.2,7.5,0.0,0.0,0.0,-0.0,1,1 ], + [ 9,"1 ",1,1,1,29.5,16.6,0.0,0.0,0.0,-0.0,1,1 ], + [ 10,"1 ",1,1,1,9.0,5.8,0.0,0.0,0.0,-0.0,1,1 ], + [ 11,"1 ",1,1,1,3.5,1.8,0.0,0.0,0.0,-0.0,1,1 ], + [ 12,"1 ",1,1,1,6.1,1.6,0.0,0.0,0.0,-0.0,1,1 ], + [ 13,"1 ",1,1,1,13.5,5.8,0.0,0.0,0.0,-0.0,1,1 ], + [ 14,"1 ",1,1,1,14.9,5.0,0.0,0.0,0.0,-0.0,1,1 ] + ] + }, + "fixshunt" : { + "fields" : [ "ibus", "shntid", "stat", "gl", "bl" ], + "data" : [ + [ 9," 1",1,0.0,19.0 ] + ] + }, + "generator" : { + "fields" : [ "ibus", "machid", "pg", "qg", "qt", "qb", "vs", "ireg", "mbase", "zr", "zx", "rt", "xt", "gtap", "stat", "rmpct", "pt", "pb", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4", "wmod", "wpf" ], + "data" : [ + [ 1,"1 ",232.392,-16.549,0.0,0.0,1.06,0,615.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 ], + [ 2,"1 ",40.0,43.556,50.0,-40.0,1.045,0,60.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 ], + [ 3,"1 ",0.0,25.075,40.0,0.0,1.01,0,60.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 ], + [ 6,"1 ",0.0,12.73,24.0,-6.0,1.07,0,25.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 ], + [ 8,"1 ",0.0,17.623,24.0,-6.0,1.09,0,25.0,0.0,1.0,0.0,0.0,1.0,1,100.0,10000.0,-10000.0,1,1.0,0,1.0,0,1.0,0,1.0,0,1.0 ] + ] + }, + "acline" : { + "fields" : [ "ibus", "jbus", "ckt", "rpu", "xpu", "bpu", "rate1", "rate2", "rate3", "gi", "bi", "gj", "bj", "stat", "met", "len", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4" ], + "data" : [ + [ 1,2,"1 ",0.01938,0.05917,0.0528,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 1,5,"1 ",0.05403,0.22304,0.0492,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 2,3,"1 ",0.04699,0.19797,0.0438,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 2,4,"1 ",0.05811,0.17632,0.034,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 2,5,"1 ",0.05695,0.17388,0.0346,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 3,4,"1 ",0.06701,0.17103,0.0128,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 4,5,"1 ",0.01335,0.04211,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 6,11,"1 ",0.09498,0.1989,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 6,12,"1 ",0.12291,0.25581,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 6,13,"1 ",0.06615,0.13027,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 7,8,"1 ",0.0,0.17615,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 7,9,"1 ",0.0,0.11001,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 9,10,"1 ",0.03181,0.0845,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 9,14,"1 ",0.12711,0.27038,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 10,11,"1 ",0.08205,0.19207,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 12,13,"1 ",0.22092,0.19988,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ], + [ 13,14,"1 ",0.17093,0.34802,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1,1,0.0,1,1.0,0,1.0,0,1.0,0,1.0 ] + ] + }, + "transformer" : { + "fields" : [ "ibus", "jbus", "kbus", "ckt", "cw", "cz", "cm", "mag1", "mag2", "nmet", "name", "stat", "o1", "f1", "o2", "f2", "o3", "f3", "o4", "f4", "r1_2", "x1_2", "sbase1_2", "windv1", "nomv1", "ang1", "wdg1rate1", "wdg1rate2", "wdg1rate3", "cod1", "cont1", "rma1", "rmi1", "vma1", "vmi1", "ntp1", "tab1", "cr1", "cx1", "windv2", "nomv2" ], + "data" : [ + [ 4,7,0,"1 ",1,1,1,0.0,0.0,2," ",1,1,1.0,0,1.0,0,1.0,0,1.0,0.0,0.20912,100.0,0.978,0.0,0.0,0.0,0.0,0.0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0,1.0,0.0 ], + [ 4,9,0,"1 ",1,1,1,0.0,0.0,2," ",1,1,1.0,0,1.0,0,1.0,0,1.0,0.0,0.55618,100.0,0.969,0.0,0.0,0.0,0.0,0.0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0,1.0,0.0 ], + [ 5,6,0,"1 ",1,1,1,0.0,0.0,2," ",1,1,1.0,0,1.0,0,1.0,0,1.0,0.0,0.25202,100.0,0.932,0.0,0.0,0.0,0.0,0.0,0,0,1.5,0.51,1.5,0.51,159,0,0.0,0.0,1.0,0.0 ] + ] + }, + "area" : { + "fields" : [ "iarea", "isw", "pdes", "ptol", "arname" ], + "data" : [ + [ 1,2,0.0,999.99,"IEEE14 " ] + ] + }, + "owner" : { + "fields" : [ "iowner", "owname" ], + "data" : [ + [ 1,"1" ] + ] + }, + "sub" : { + "fields" : [ "isub", "name", "lati", "long", "srg" ], + "data" : [ + [ 1,"STATION 1",0.0,0.0,0.1 ], + [ 2,"STATION 5",0.0,0.0,0.1 ] + ] + }, + "subnode" : { + "fields" : [ "isub", "inode", "name", "ibus", "stat", "vm", "va" ], + "data" : [ + [ 1,1,"NB1",1,1,1.0,0.0 ], + [ 1,2,"NB2",1,1,1.0,0.0 ], + [ 1,3,"NL2",1,1,1.0,0.0 ], + [ 1,4,"NL5",1,1,1.0,0.0 ], + [ 1,5,"NG1",1,1,1.0,0.0 ], + [ 2,1,"NB1",2,1,1.0,0.0 ], + [ 2,2,"NB2",2,1,1.0,0.0 ], + [ 2,3,"NL3",2,1,1.0,0.0 ], + [ 2,4,"NL4",2,1,1.0,0.0 ], + [ 2,5,"NL5",2,1,1.0,0.0 ], + [ 2,6,"NL1",2,1,1.0,0.0 ], + [ 2,7,"NG1",2,1,1.0,0.0 ], + [ 2,8,"NLd1",2,1,1.0,0.0 ] + ] + }, + "subswd" : { + "fields" : [ "isub", "inode", "jnode", "swdid", "name", "type", "stat", "nstat", "xpu", "rate1", "rate2", "rate3" ], + "data" : [ + [ 1,1,2,1 ,"Sw-BusBars","2",1,1,0.0,0.0,0.0,0.0 ], + [ 1,1,3,1 ,"Sw-BranchToBus2","2",1,1,0.0,0.0,0.0,0.0 ], + [ 1,2,4,1 ,"Sw-BranchToBus5","2",1,1,0.0,0.0,0.0,0.0 ], + [ 1,2,5,1 ,"Sw-Gen1","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,2,1 ,"Sw-BusBars","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,6,1 ,"Sw-BranchToBus1","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,7,1 ,"Sw-Gen1","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,8,1 ,"Sw-Load1","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,3,1 ,"Sw-BranchToBus3","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,4,1 ,"Sw-BranchToBus4","2",1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,5,1 ,"Sw-BranchToBus5","2",1,1,0.0,0.0,0.0,0.0 ] + ] + }, + "subterm" : { + "fields" : [ "isub", "inode", "type", "eqid", "ibus", "jbus", "kbus" ], + "data" : [ + [ 1,5,"M","1 ",1,0,0 ], + [ 1,3,"B","1 ",1,2,0 ], + [ 1,4,"B","1 ",1,5,0 ], + [ 2,7,"M","1 ",2,0,0 ], + [ 2,8,"L","1 ",2,0,0 ], + [ 2,6,"B","1 ",2,1,0 ], + [ 2,3,"B","1 ",2,3,0 ], + [ 2,4,"B","1 ",2,4,0 ], + [ 2,5,"B","1 ",2,5,0 ] + ] + } + } +} \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_rev35.json b/psse/psse-model/src/test/resources/IEEE_14_bus_rev35.json index 4d918533689..ba28f3d54ac 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_rev35.json +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_rev35.json @@ -1665,5 +1665,6 @@ "facts" : [ ], "switchedShunts" : [ ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_14_isolated_buses.json b/psse/psse-model/src/test/resources/IEEE_14_isolated_buses.json index 6b4cd164594..467b0ed2327 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_isolated_buses.json +++ b/psse/psse-model/src/test/resources/IEEE_14_isolated_buses.json @@ -1532,5 +1532,6 @@ "b8" : 0.0 } ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file diff --git a/psse/psse-model/src/test/resources/IEEE_24_bus_rev35.json b/psse/psse-model/src/test/resources/IEEE_24_bus_rev35.json index 11b82df7568..93b0fb1454d 100644 --- a/psse/psse-model/src/test/resources/IEEE_24_bus_rev35.json +++ b/psse/psse-model/src/test/resources/IEEE_24_bus_rev35.json @@ -3138,5 +3138,6 @@ "s8" : 1 } ], "gneDevice" : [ ], - "inductionMachines" : [ ] + "inductionMachines" : [ ], + "substations" : [ ] } \ No newline at end of file From 5e9384724ea317552cbc985c10cfd75c425ead14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Thu, 11 Apr 2024 15:18:44 +0200 Subject: [PATCH 03/10] Remove duplicated code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../powsybl/psse/model/pf/PsseSubstation.java | 237 ------------------ .../model/pf/io/PowerFlowRecordGroup.java | 13 +- .../psse/model/pf/io/SubstationData.java | 34 ++- 3 files changed, 24 insertions(+), 260 deletions(-) diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java index c5992dac222..2d181de3def 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java @@ -458,36 +458,6 @@ public PsseSubstationEquipmentTerminal copy() { copy.k = this.k; return copy; } - - public PsseSubstationEquipmentTerminalOneBus convertToEquipmentTerminalOneBus() { - PsseSubstationEquipmentTerminalOneBus oneBus = new PsseSubstationEquipmentTerminalOneBus(); - oneBus.i = i; - oneBus.ni = ni; - oneBus.type = type; - oneBus.id = id; - return oneBus; - } - - public PsseSubstationEquipmentTerminalTwoBuses convertToEquipmentTerminalTwoBuses() { - PsseSubstationEquipmentTerminalTwoBuses twoBuses = new PsseSubstationEquipmentTerminalTwoBuses(); - twoBuses.i = i; - twoBuses.ni = ni; - twoBuses.type = type; - twoBuses.id = id; - twoBuses.j = j; - return twoBuses; - } - - public PsseSubstationEquipmentTerminalThreeBuses convertToEquipmentTerminalThreeBuses() { - PsseSubstationEquipmentTerminalThreeBuses threeBuses = new PsseSubstationEquipmentTerminalThreeBuses(); - threeBuses.i = i; - threeBuses.ni = ni; - threeBuses.type = type; - threeBuses.id = id; - threeBuses.j = j; - threeBuses.k = k; - return threeBuses; - } } public static class PsseSubstationEquipmentTerminalCommonStart { @@ -506,213 +476,6 @@ public String getType() { } } - public static class PsseSubstationEquipmentTerminalOneBus { - - @Parsed - private int i; - - @Parsed - private int ni; - - @Parsed - private String type; - - @Parsed(defaultNullRead = "1 ") - private String id; - - public int getI() { - return i; - } - - public void setI(int i) { - this.i = i; - } - - public int getNi() { - return ni; - } - - public void setNi(int ni) { - this.ni = ni; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { - PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); - equipmentTerminal.i = i; - equipmentTerminal.ni = ni; - equipmentTerminal.type = type; - equipmentTerminal.id = id; - equipmentTerminal.j = 0; - equipmentTerminal.k = 0; - return equipmentTerminal; - } - } - - public static class PsseSubstationEquipmentTerminalTwoBuses { - - @Parsed - private int i; - - @Parsed - private int ni; - - @Parsed - private String type; - - @Parsed - private int j = 0; - - @Parsed(defaultNullRead = "1 ") - private String id; - - public int getI() { - return i; - } - - public void setI(int i) { - this.i = i; - } - - public int getNi() { - return ni; - } - - public void setNi(int ni) { - this.ni = ni; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getJ() { - return j; - } - - public void setJ(int j) { - this.j = j; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { - PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); - equipmentTerminal.i = i; - equipmentTerminal.ni = ni; - equipmentTerminal.type = type; - equipmentTerminal.id = id; - equipmentTerminal.j = j; - equipmentTerminal.k = 0; - return equipmentTerminal; - } - } - - public static class PsseSubstationEquipmentTerminalThreeBuses { - - @Parsed - private int i; - - @Parsed - private int ni; - - @Parsed - private String type; - - @Parsed - private int j = 0; - - @Parsed - private int k = 0; - - @Parsed(defaultNullRead = "1 ") - private String id; - - public int getI() { - return i; - } - - public void setI(int i) { - this.i = i; - } - - public int getNi() { - return ni; - } - - public void setNi(int ni) { - this.ni = ni; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public int getJ() { - return j; - } - - public void setJ(int j) { - this.j = j; - } - - public int getK() { - return k; - } - - public void setK(int k) { - this.k = k; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public PsseSubstationEquipmentTerminal convertToEquipmentTerminal() { - PsseSubstationEquipmentTerminal equipmentTerminal = new PsseSubstationEquipmentTerminal(); - equipmentTerminal.i = i; - equipmentTerminal.ni = ni; - equipmentTerminal.type = type; - equipmentTerminal.id = id; - equipmentTerminal.j = j; - equipmentTerminal.k = k; - return equipmentTerminal; - } - } - public static class PsseSubstationNodex { public PsseSubstationNodex() { diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java index 935ef89253b..1f31eeaf95e 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java @@ -48,13 +48,18 @@ public enum PowerFlowRecordGroup implements RecordGroupIdentification { INTERNAL_SUBSTATION_NODE("subnode"), INTERNAL_SUBSTATION_SWITCHING_DEVICE("subswd"), INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL("subterm"), - INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_COMMON_START("subterm"), - INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS("subterm"), - INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES("subterm"), - INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES("subterm"); + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_COMMON_START(), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS(), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES(), + INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES(); private final String rawxNodeName; private final String rawName; + PowerFlowRecordGroup() { + this.rawxNodeName = name(); + this.rawName = name(); + } + PowerFlowRecordGroup(String rawxNodeName) { this.rawxNodeName = rawxNodeName; this.rawName = name(); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java index eb9c0796456..cc349b4f4c9 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -91,13 +91,9 @@ private List readEquipmentTerminalData(LegacyTe line = reader.readRecordLine(); } - List equipmentTerminalOneBusList = new SubstationEquipmentTerminalDataOneBus().readFromStrings(equipmentTerminalOneBusRecords, context); - List equipmentTerminalTwoBusesList = new SubstationEquipmentTerminalDataTwoBuses().readFromStrings(equipmentTerminalTwoBusesRecords, context); - List equipmentTerminalThreeBusesList = new SubstationEquipmentTerminalDataThreeBuses().readFromStrings(equipmentTerminalThreeBusesRecords, context); - - List equipmentTerminalList = equipmentTerminalOneBusList.stream().map(PsseSubstationEquipmentTerminalOneBus::convertToEquipmentTerminal).collect(Collectors.toList()); - equipmentTerminalList.addAll(equipmentTerminalTwoBusesList.stream().map(PsseSubstationEquipmentTerminalTwoBuses::convertToEquipmentTerminal).toList()); - equipmentTerminalList.addAll(equipmentTerminalThreeBusesList.stream().map(PsseSubstationEquipmentTerminalThreeBuses::convertToEquipmentTerminal).toList()); + List equipmentTerminalList = new SubstationEquipmentTerminalDataOneBus().readFromStrings(equipmentTerminalOneBusRecords, context); + equipmentTerminalList.addAll(new SubstationEquipmentTerminalDataTwoBuses().readFromStrings(equipmentTerminalTwoBusesRecords, context)); + equipmentTerminalList.addAll(new SubstationEquipmentTerminalDataThreeBuses().readFromStrings(equipmentTerminalThreeBusesRecords, context)); return equipmentTerminalList; } @@ -131,9 +127,9 @@ public void write(List substationList, Context context, OutputSt private List writeEquipmentTerminalData(List equipmentTerminalList, Context context) { - List eqOneBus = equipmentTerminalList.stream().filter(eq -> isOneBus(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalOneBus).collect(Collectors.toList()); - List eqTwoBuses = equipmentTerminalList.stream().filter(eq -> isTwoBuses(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalTwoBuses).collect(Collectors.toList()); - List eqThreeBuses = equipmentTerminalList.stream().filter(eq -> isThreeBuses(eq.getType())).map(PsseSubstationEquipmentTerminal::convertToEquipmentTerminalThreeBuses).collect(Collectors.toList()); + List eqOneBus = equipmentTerminalList.stream().filter(eq -> isOneBus(eq.getType())).collect(Collectors.toList()); + List eqTwoBuses = equipmentTerminalList.stream().filter(eq -> isTwoBuses(eq.getType())).collect(Collectors.toList()); + List eqThreeBuses = equipmentTerminalList.stream().filter(eq -> isThreeBuses(eq.getType())).collect(Collectors.toList()); SubstationEquipmentTerminalDataOneBus oneBusData = new SubstationEquipmentTerminalDataOneBus(); List strings = oneBusData.buildRecords(eqOneBus, context.getFieldNames(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS), oneBusData.quotedFields(), context); @@ -183,39 +179,39 @@ public Class psseTypeClass() { } } - private static class SubstationEquipmentTerminalDataOneBus extends AbstractRecordGroup { + private static class SubstationEquipmentTerminalDataOneBus extends AbstractRecordGroup { SubstationEquipmentTerminalDataOneBus() { super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS, "i", "ni", "type", "id"); withQuotedFields(QUOTED_FIELDS); } @Override - public Class psseTypeClass() { - return PsseSubstationEquipmentTerminalOneBus.class; + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminal.class; } } - private static class SubstationEquipmentTerminalDataTwoBuses extends AbstractRecordGroup { + private static class SubstationEquipmentTerminalDataTwoBuses extends AbstractRecordGroup { SubstationEquipmentTerminalDataTwoBuses() { super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES, "i", "ni", "type", "j", "id"); withQuotedFields(QUOTED_FIELDS); } @Override - public Class psseTypeClass() { - return PsseSubstationEquipmentTerminalTwoBuses.class; + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminal.class; } } - private static class SubstationEquipmentTerminalDataThreeBuses extends AbstractRecordGroup { + private static class SubstationEquipmentTerminalDataThreeBuses extends AbstractRecordGroup { SubstationEquipmentTerminalDataThreeBuses() { super(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_THREE_BUSES, "i", "ni", "type", "j", "k", "id"); withQuotedFields(QUOTED_FIELDS); } @Override - public Class psseTypeClass() { - return PsseSubstationEquipmentTerminalThreeBuses.class; + public Class psseTypeClass() { + return PsseSubstationEquipmentTerminal.class; } } } From cab4aa15aad300da70136c6350047bdb87f28ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Thu, 11 Apr 2024 15:40:00 +0200 Subject: [PATCH 04/10] Fix code smells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../powsybl/psse/model/pf/PsseSubstation.java | 18 +++++++++--------- .../psse/model/pf/io/PowerFlowRecordGroup.java | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java index 2d181de3def..06cc80eaf8a 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java @@ -30,39 +30,39 @@ public class PsseSubstation { public PsseSubstation(PsseSubstationRecord record, List nodes, List switchingDevices, List equipmentTerminals) { - this.record = record; + this.srecord = record; this.nodes = nodes; this.switchingDevices = switchingDevices; this.equipmentTerminals = equipmentTerminals; } - private final PsseSubstationRecord record; + private final PsseSubstationRecord srecord; private final List nodes; private final List switchingDevices; private final List equipmentTerminals; public int getIs() { - return record.is; + return srecord.is; } public String getName() { - return record.name; + return srecord.name; } public double getLati() { - return record.lati; + return srecord.lati; } public double getLong() { - return record.longi; + return srecord.longi; } public double getSrg() { - return record.srg; + return srecord.srg; } public PsseSubstationRecord getRecord() { - return record; + return srecord; } public List getNodes() { @@ -78,7 +78,7 @@ public List getEquipmentTerminals() { } public PsseSubstation copy() { - PsseSubstationRecord copyRecord = this.record.copy(); + PsseSubstationRecord copyRecord = this.srecord.copy(); List copyNodes = new ArrayList<>(); this.nodes.forEach(node -> copyNodes.add(node.copy())); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java index 1f31eeaf95e..058b9aee342 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/PowerFlowRecordGroup.java @@ -48,6 +48,7 @@ public enum PowerFlowRecordGroup implements RecordGroupIdentification { INTERNAL_SUBSTATION_NODE("subnode"), INTERNAL_SUBSTATION_SWITCHING_DEVICE("subswd"), INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL("subterm"), + // only needed in raw format, not used in rawx format INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_COMMON_START(), INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS(), INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_TWO_BUSES(), From 67ff326dff210c2cc2e5cb361e9cd8b60dbeaa6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Thu, 11 Apr 2024 15:59:55 +0200 Subject: [PATCH 05/10] Fix code smells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../com/powsybl/psse/model/pf/PsseSubstation.java | 4 ++-- .../powsybl/psse/model/pf/io/SubstationData.java | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java index 06cc80eaf8a..8d9a172ac20 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java @@ -27,10 +27,10 @@ public class PsseSubstation { - public PsseSubstation(PsseSubstationRecord record, + public PsseSubstation(PsseSubstationRecord srecord, List nodes, List switchingDevices, List equipmentTerminals) { - this.srecord = record; + this.srecord = srecord; this.nodes = nodes; this.switchingDevices = switchingDevices; this.equipmentTerminals = equipmentTerminals; diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java index cc349b4f4c9..2c0d8a8f232 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -54,13 +54,13 @@ public List read(LegacyTextReader reader, Context context) throw if (!reader.isQRecordFound()) { String line = reader.readRecordLine(); while (!reader.endOfBlock(line)) { - PsseSubstationRecord record = recordData.readFromStrings(Collections.singletonList(line), context).get(0); + PsseSubstationRecord srecord = recordData.readFromStrings(Collections.singletonList(line), context).get(0); List nodeList = new SubstationNodeData().read(reader, context); List switchingDeviceList = new SubstationSwitchingDeviceData().read(reader, context); List equipmentTerminalList = readEquipmentTerminalData(reader, context); - PsseSubstation substation = new PsseSubstation(record, nodeList, switchingDeviceList, equipmentTerminalList); + PsseSubstation substation = new PsseSubstation(srecord, nodeList, switchingDeviceList, equipmentTerminalList); substationList.add(substation); line = reader.readRecordLine(); @@ -262,12 +262,12 @@ private static List convertToSubstationList(List equipmentTerminalxList) { List substationList = new ArrayList<>(); - for (PsseSubstationRecord record : recordList) { - List nodeList = nodexList.stream().filter(n -> n.getIsub() == record.getIs()).map(PsseSubstationNodex::getNode).collect(Collectors.toList()); - List switchingDeviceList = switchingDevicexList.stream().filter(sd -> sd.getIsub() == record.getIs()).map(PsseSubstationSwitchingDevicex::getSwitchingDevice).collect(Collectors.toList()); - List equipmentTerminalList = equipmentTerminalxList.stream().filter(eq -> eq.getIsub() == record.getIs()).map(PsseSubstationEquipmentTerminalx::getEquipmentTerminal).collect(Collectors.toList()); + for (PsseSubstationRecord srecord : recordList) { + List nodeList = nodexList.stream().filter(n -> n.getIsub() == srecord.getIs()).map(PsseSubstationNodex::getNode).collect(Collectors.toList()); + List switchingDeviceList = switchingDevicexList.stream().filter(sd -> sd.getIsub() == srecord.getIs()).map(PsseSubstationSwitchingDevicex::getSwitchingDevice).collect(Collectors.toList()); + List equipmentTerminalList = equipmentTerminalxList.stream().filter(eq -> eq.getIsub() == srecord.getIs()).map(PsseSubstationEquipmentTerminalx::getEquipmentTerminal).collect(Collectors.toList()); - substationList.add(new PsseSubstation(record, nodeList, switchingDeviceList, equipmentTerminalList)); + substationList.add(new PsseSubstation(srecord, nodeList, switchingDeviceList, equipmentTerminalList)); } return substationList; } From d1a5e2f9b79f58eaf3f64197acacf6a1c80857a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Wed, 22 May 2024 12:39:15 +0200 Subject: [PATCH 06/10] pretty code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../powsybl/psse/model/pf/PsseSubstation.java | 20 ++++++++-------- .../psse/model/pf/io/SubstationData.java | 23 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java index 8d9a172ac20..fad9c203e98 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/PsseSubstation.java @@ -27,42 +27,42 @@ public class PsseSubstation { - public PsseSubstation(PsseSubstationRecord srecord, + public PsseSubstation(PsseSubstationRecord substationRecord, List nodes, List switchingDevices, List equipmentTerminals) { - this.srecord = srecord; + this.substationRecord = substationRecord; this.nodes = nodes; this.switchingDevices = switchingDevices; this.equipmentTerminals = equipmentTerminals; } - private final PsseSubstationRecord srecord; + private final PsseSubstationRecord substationRecord; private final List nodes; private final List switchingDevices; private final List equipmentTerminals; public int getIs() { - return srecord.is; + return substationRecord.is; } public String getName() { - return srecord.name; + return substationRecord.name; } public double getLati() { - return srecord.lati; + return substationRecord.lati; } public double getLong() { - return srecord.longi; + return substationRecord.longi; } public double getSrg() { - return srecord.srg; + return substationRecord.srg; } public PsseSubstationRecord getRecord() { - return srecord; + return substationRecord; } public List getNodes() { @@ -78,7 +78,7 @@ public List getEquipmentTerminals() { } public PsseSubstation copy() { - PsseSubstationRecord copyRecord = this.srecord.copy(); + PsseSubstationRecord copyRecord = this.substationRecord.copy(); List copyNodes = new ArrayList<>(); this.nodes.forEach(node -> copyNodes.add(node.copy())); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java index 2c0d8a8f232..0e90c9be0f8 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; import static com.powsybl.psse.model.pf.PsseSubstation.*; import static com.powsybl.psse.model.pf.io.PowerFlowRecordGroup.*; @@ -54,13 +53,13 @@ public List read(LegacyTextReader reader, Context context) throw if (!reader.isQRecordFound()) { String line = reader.readRecordLine(); while (!reader.endOfBlock(line)) { - PsseSubstationRecord srecord = recordData.readFromStrings(Collections.singletonList(line), context).get(0); + PsseSubstationRecord substationRecord = recordData.readFromStrings(Collections.singletonList(line), context).get(0); List nodeList = new SubstationNodeData().read(reader, context); List switchingDeviceList = new SubstationSwitchingDeviceData().read(reader, context); List equipmentTerminalList = readEquipmentTerminalData(reader, context); - PsseSubstation substation = new PsseSubstation(srecord, nodeList, switchingDeviceList, equipmentTerminalList); + PsseSubstation substation = new PsseSubstation(substationRecord, nodeList, switchingDeviceList, equipmentTerminalList); substationList.add(substation); line = reader.readRecordLine(); @@ -127,9 +126,9 @@ public void write(List substationList, Context context, OutputSt private List writeEquipmentTerminalData(List equipmentTerminalList, Context context) { - List eqOneBus = equipmentTerminalList.stream().filter(eq -> isOneBus(eq.getType())).collect(Collectors.toList()); - List eqTwoBuses = equipmentTerminalList.stream().filter(eq -> isTwoBuses(eq.getType())).collect(Collectors.toList()); - List eqThreeBuses = equipmentTerminalList.stream().filter(eq -> isThreeBuses(eq.getType())).collect(Collectors.toList()); + List eqOneBus = equipmentTerminalList.stream().filter(eq -> isOneBus(eq.getType())).toList(); + List eqTwoBuses = equipmentTerminalList.stream().filter(eq -> isTwoBuses(eq.getType())).toList(); + List eqThreeBuses = equipmentTerminalList.stream().filter(eq -> isThreeBuses(eq.getType())).toList(); SubstationEquipmentTerminalDataOneBus oneBusData = new SubstationEquipmentTerminalDataOneBus(); List strings = oneBusData.buildRecords(eqOneBus, context.getFieldNames(INTERNAL_SUBSTATION_EQUIPMENT_TERMINAL_ONE_BUS), oneBusData.quotedFields(), context); @@ -238,7 +237,7 @@ public void write(List substationList, Context context, OutputSt if (outputStream != null) { throw new PsseException("Unexpected outputStream. Should be null"); } - List recordList = substationList.stream().map(PsseSubstation::getRecord).collect(Collectors.toList()); + List recordList = substationList.stream().map(PsseSubstation::getRecord).toList(); new SubstationRecordData().write(recordList, context, null); List nodexList = new ArrayList<>(); @@ -262,12 +261,12 @@ private static List convertToSubstationList(List equipmentTerminalxList) { List substationList = new ArrayList<>(); - for (PsseSubstationRecord srecord : recordList) { - List nodeList = nodexList.stream().filter(n -> n.getIsub() == srecord.getIs()).map(PsseSubstationNodex::getNode).collect(Collectors.toList()); - List switchingDeviceList = switchingDevicexList.stream().filter(sd -> sd.getIsub() == srecord.getIs()).map(PsseSubstationSwitchingDevicex::getSwitchingDevice).collect(Collectors.toList()); - List equipmentTerminalList = equipmentTerminalxList.stream().filter(eq -> eq.getIsub() == srecord.getIs()).map(PsseSubstationEquipmentTerminalx::getEquipmentTerminal).collect(Collectors.toList()); + for (PsseSubstationRecord substationRecord : recordList) { + List nodeList = nodexList.stream().filter(n -> n.getIsub() == substationRecord.getIs()).map(PsseSubstationNodex::getNode).toList(); + List switchingDeviceList = switchingDevicexList.stream().filter(sd -> sd.getIsub() == substationRecord.getIs()).map(PsseSubstationSwitchingDevicex::getSwitchingDevice).toList(); + List equipmentTerminalList = equipmentTerminalxList.stream().filter(eq -> eq.getIsub() == substationRecord.getIs()).map(PsseSubstationEquipmentTerminalx::getEquipmentTerminal).toList(); - substationList.add(new PsseSubstation(srecord, nodeList, switchingDeviceList, equipmentTerminalList)); + substationList.add(new PsseSubstation(substationRecord, nodeList, switchingDeviceList, equipmentTerminalList)); } return substationList; } From eefa3e6a88373e2facaac97b1c8048d03381c9de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Wed, 22 May 2024 13:13:36 +0200 Subject: [PATCH 07/10] Add new test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../java/com/powsybl/psse/model/PsseRawDataTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java index 89aeaace841..6d7b24f73e0 100644 --- a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java +++ b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java @@ -711,6 +711,15 @@ void ieee14BusNodeBreakerRev35Test() throws IOException { assertEquals(expectedJson, toJson(rawData)); } + @Test + void ieee14BusNodeBreakerRev35CopyTest() throws IOException { + String expectedJson = loadReference("/IEEE_14_bus_nodeBreaker_rev35.json"); + PssePowerFlowModel rawData = new PowerFlowRawData35().read(ieee14NodeBreakerRaw35(), "raw", new Context()); + assertNotNull(rawData); + PssePowerFlowModel copiedRawData = rawData.referenceAndCopyPssePowerFlowModel(); + assertEquals(expectedJson, toJson(copiedRawData)); + } + @Test void ieee14BusNodeBreakerRev35RawxTest() throws IOException { String expectedJson = loadReference("/IEEE_14_bus_nodeBreaker_rev35.json"); From 8bd69c7f30732709537813e9937c9bea0445ea8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Marqu=C3=A9s?= Date: Tue, 11 Jun 2024 12:34:38 +0200 Subject: [PATCH 08/10] switching device type must be an integer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Antonio Marqués --- .../psse/model/pf/io/SubstationData.java | 7 +++--- ...IEEE_14_bus_nodeBreaker_rev35_exported.raw | 22 +++++++++---------- ...EEE_14_bus_nodeBreaker_rev35_exported.rawx | 22 +++++++++---------- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java index 0e90c9be0f8..416760eff72 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -114,7 +114,7 @@ public void write(List substationList, Context context, OutputSt writeEndComment(" END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA", outputStream); SubstationSwitchingDeviceData switchingDeviceData = new SubstationSwitchingDeviceData(); - write(switchingDeviceData.buildRecords(substation.getSwitchingDevices(), context.getFieldNames(INTERNAL_SUBSTATION_SWITCHING_DEVICE), nodeData.quotedFields(), context), outputStream); + write(switchingDeviceData.buildRecords(substation.getSwitchingDevices(), context.getFieldNames(INTERNAL_SUBSTATION_SWITCHING_DEVICE), switchingDeviceData.quotedFields(), context), outputStream); writeEndComment(" END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA", outputStream); write(writeEquipmentTerminalData(substation.getEquipmentTerminals(), context), outputStream); @@ -157,7 +157,7 @@ public Class psseTypeClass() { private static class SubstationSwitchingDeviceData extends AbstractRecordGroup { SubstationSwitchingDeviceData() { super(INTERNAL_SUBSTATION_SWITCHING_DEVICE, "ni", "nj", "ckt", "name", "type", "status", "nstat", "x", "rate1", "rate2", "rate3"); - withQuotedFields(QUOTED_FIELDS); + withQuotedFields(QUOTED_FIELDS_SWITCHING_DEVICES); } @Override @@ -286,7 +286,7 @@ public Class psseTypeClass() { private static class SubstationSwitchingDevicexData extends AbstractRecordGroup { SubstationSwitchingDevicexData() { super(INTERNAL_SUBSTATION_SWITCHING_DEVICE); - withQuotedFields(QUOTED_FIELDS); + withQuotedFields(QUOTED_FIELDS_SWITCHING_DEVICES); } @Override @@ -321,4 +321,5 @@ public Class psseTypeClass() { } private static final String[] QUOTED_FIELDS = {"name", "type", "id", "ckt", "eqid"}; + private static final String[] QUOTED_FIELDS_SWITCHING_DEVICES = {"name", "ckt"}; } diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw index a9775c5957c..e09d9ad305a 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.raw @@ -92,10 +92,10 @@ 4,'NL5',1,1,1.0,0.0 5,'NG1',1,1,1.0,0.0 0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA -1,2,'1 ','Sw-BusBars','2',1,1,0.0,0.0,0.0,0.0 -1,3,'1 ','Sw-BranchToBus2','2',1,1,0.0,0.0,0.0,0.0 -2,4,'1 ','Sw-BranchToBus5','2',1,1,0.0,0.0,0.0,0.0 -2,5,'1 ','Sw-Gen1','2',1,1,0.0,0.0,0.0,0.0 +1,2,'1 ','Sw-BusBars',2,1,1,0.0,0.0,0.0,0.0 +1,3,'1 ','Sw-BranchToBus2',2,1,1,0.0,0.0,0.0,0.0 +2,4,'1 ','Sw-BranchToBus5',2,1,1,0.0,0.0,0.0,0.0 +2,5,'1 ','Sw-Gen1',2,1,1,0.0,0.0,0.0,0.0 0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA 1,5,'M','1 ' 1,3,'B',2,'1 ' @@ -112,13 +112,13 @@ 7,'NG1',2,1,1.0,0.0 8,'NLd1',2,1,1.0,0.0 0 / END OF SUBSTATION NODE DATA, BEGIN SUBSTATION SWITCHING DEVICE DATA -1,2,'1 ','Sw-BusBars','2',1,1,0.0,0.0,0.0,0.0 -1,6,'1 ','Sw-BranchToBus1','2',1,1,0.0,0.0,0.0,0.0 -1,7,'1 ','Sw-Gen1','2',1,1,0.0,0.0,0.0,0.0 -1,8,'1 ','Sw-Load1','2',1,1,0.0,0.0,0.0,0.0 -2,3,'1 ','Sw-BranchToBus3','2',1,1,0.0,0.0,0.0,0.0 -2,4,'1 ','Sw-BranchToBus4','2',1,1,0.0,0.0,0.0,0.0 -2,5,'1 ','Sw-BranchToBus5','2',1,1,0.0,0.0,0.0,0.0 +1,2,'1 ','Sw-BusBars',2,1,1,0.0,0.0,0.0,0.0 +1,6,'1 ','Sw-BranchToBus1',2,1,1,0.0,0.0,0.0,0.0 +1,7,'1 ','Sw-Gen1',2,1,1,0.0,0.0,0.0,0.0 +1,8,'1 ','Sw-Load1',2,1,1,0.0,0.0,0.0,0.0 +2,3,'1 ','Sw-BranchToBus3',2,1,1,0.0,0.0,0.0,0.0 +2,4,'1 ','Sw-BranchToBus4',2,1,1,0.0,0.0,0.0,0.0 +2,5,'1 ','Sw-BranchToBus5',2,1,1,0.0,0.0,0.0,0.0 0 / END OF SUBSTATION SWITCHING DEVICE DATA, BEGIN SUBSTATION EQUIPMENT TERMINAL DATA 2,7,'M','1 ' 2,8,'L','1 ' diff --git a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx index 1e99ebc3e3a..2ce9bec6784 100644 --- a/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx +++ b/psse/psse-model/src/test/resources/IEEE_14_bus_nodeBreaker_rev35_exported.rawx @@ -125,17 +125,17 @@ "subswd" : { "fields" : [ "isub", "inode", "jnode", "swdid", "name", "type", "stat", "nstat", "xpu", "rate1", "rate2", "rate3" ], "data" : [ - [ 1,1,2,1 ,"Sw-BusBars","2",1,1,0.0,0.0,0.0,0.0 ], - [ 1,1,3,1 ,"Sw-BranchToBus2","2",1,1,0.0,0.0,0.0,0.0 ], - [ 1,2,4,1 ,"Sw-BranchToBus5","2",1,1,0.0,0.0,0.0,0.0 ], - [ 1,2,5,1 ,"Sw-Gen1","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,1,2,1 ,"Sw-BusBars","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,1,6,1 ,"Sw-BranchToBus1","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,1,7,1 ,"Sw-Gen1","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,1,8,1 ,"Sw-Load1","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,2,3,1 ,"Sw-BranchToBus3","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,2,4,1 ,"Sw-BranchToBus4","2",1,1,0.0,0.0,0.0,0.0 ], - [ 2,2,5,1 ,"Sw-BranchToBus5","2",1,1,0.0,0.0,0.0,0.0 ] + [ 1,1,2,1 ,"Sw-BusBars",2,1,1,0.0,0.0,0.0,0.0 ], + [ 1,1,3,1 ,"Sw-BranchToBus2",2,1,1,0.0,0.0,0.0,0.0 ], + [ 1,2,4,1 ,"Sw-BranchToBus5",2,1,1,0.0,0.0,0.0,0.0 ], + [ 1,2,5,1 ,"Sw-Gen1",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,2,1 ,"Sw-BusBars",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,6,1 ,"Sw-BranchToBus1",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,7,1 ,"Sw-Gen1",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,1,8,1 ,"Sw-Load1",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,3,1 ,"Sw-BranchToBus3",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,4,1 ,"Sw-BranchToBus4",2,1,1,0.0,0.0,0.0,0.0 ], + [ 2,2,5,1 ,"Sw-BranchToBus5",2,1,1,0.0,0.0,0.0,0.0 ] ] }, "subterm" : { From 299d8e41add8902055cf0bee32e5aa1c67e767c1 Mon Sep 17 00:00:00 2001 From: marquesja1 Date: Mon, 5 Aug 2024 15:43:20 +0200 Subject: [PATCH 09/10] Fix FileDataSource Signed-off-by: marquesja1 --- .../src/test/java/com/powsybl/psse/model/PsseRawDataTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java index 921529d4bae..d4157bcfb6e 100644 --- a/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java +++ b/psse/psse-model/src/test/java/com/powsybl/psse/model/PsseRawDataTest.java @@ -798,7 +798,7 @@ void ieee14BusNodeBreakerRev35WriteTest() throws IOException { PssePowerFlowModel rawData = rawData35.read(ieee14NodeBreakerRaw35(), "raw", context); assertNotNull(rawData); - rawData35.write(rawData, context, new FileDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); + rawData35.write(rawData, context, new DirectoryDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); try (InputStream is = Files.newInputStream(fileSystem.getPath("/work/", "IEEE_14_bus_nodeBreaker_rev35_exported.raw"))) { assertTxtEquals(getClass().getResourceAsStream("/" + "IEEE_14_bus_nodeBreaker_rev35_exported.raw"), is); } @@ -811,7 +811,7 @@ void ieee14BusNodeBreakerRev35RawxWriteTest() throws IOException { PssePowerFlowModel rawData = rawxData35.read(ieee14NodeBreakerRawx35(), "rawx", context); assertNotNull(rawData); - rawxData35.write(rawData, context, new FileDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); + rawxData35.write(rawData, context, new DirectoryDataSource(fileSystem.getPath("/work/"), "IEEE_14_bus_nodeBreaker_rev35_exported")); try (InputStream is = Files.newInputStream(fileSystem.getPath("/work/", "IEEE_14_bus_nodeBreaker_rev35_exported.rawx"))) { assertTxtEquals(getClass().getResourceAsStream("/" + "IEEE_14_bus_nodeBreaker_rev35_exported.rawx"), is); } From e59802b572aa4d2aa33f0390a306d30a09f34d16 Mon Sep 17 00:00:00 2001 From: marquesja1 Date: Tue, 6 Aug 2024 12:48:05 +0200 Subject: [PATCH 10/10] Minor adjustments after testing a real case Signed-off-by: marquesja1 --- .../psse/converter/GeneratorConverter.java | 2 +- .../powsybl/psse/model/io/LegacyTextReader.java | 16 ++++++++++++++++ .../psse/model/pf/io/CaseIdentificationData.java | 2 +- .../io/MultiTerminalDcTransmissionLineData.java | 4 ++-- .../powsybl/psse/model/pf/io/SubstationData.java | 8 ++++---- .../psse/model/pf/io/TransformerData.java | 4 ++-- .../pf/io/TwoTerminalDcTransmissionLineData.java | 4 ++-- ...ageSourceConverterDcTransmissionLineData.java | 4 ++-- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java index 266a824fff6..a2e4ce5dc7a 100644 --- a/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java +++ b/psse/psse-converter/src/main/java/com/powsybl/psse/converter/GeneratorConverter.java @@ -104,7 +104,7 @@ private static Terminal defineRegulatingTerminal(PsseGenerator psseGenerator, Ne regulatingTerminal = bus.getConnectedTerminalStream().findFirst().orElse(null); } } - if (regulatingTerminal == null) { + if (regulatingTerminal == null && psseGenerator.getI() != psseGenerator.getIreg()) { String generatorId = getGeneratorId(defaultRegulatingBusId, psseGenerator); LOGGER.warn("Generator {}. Regulating terminal is not assigned as the bus is isolated", generatorId); } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/io/LegacyTextReader.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/io/LegacyTextReader.java index 7b6561bc915..8e85526258e 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/io/LegacyTextReader.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/io/LegacyTextReader.java @@ -90,6 +90,14 @@ public String readLine() throws IOException { return reader.readLine(); } + public String readUntilFindingARecordLineNotEmpty() throws IOException { + String line = readRecordLine(); + while (emptyLine(line)) { + line = readRecordLine(); + } + return line; + } + // Read a line that contains a record // Removes comments and normalizes spaces in unquoted areas public String readRecordLine() throws IOException { @@ -97,6 +105,9 @@ public String readRecordLine() throws IOException { if (line == null) { throw new PsseException("PSSE. Unexpected end of file"); } + if (isRecordLineDefiningTheAttributeFields(line)) { + return ""; // an empty line must be returned + } StringBuilder newLine = new StringBuilder(); Matcher m = FileFormat.LEGACY_TEXT_QUOTED_OR_WHITESPACE.matcher(removeComment(line)); while (m.find()) { @@ -112,6 +123,11 @@ public String readRecordLine() throws IOException { return newLine.toString().trim(); } + // all the lines beginning with "@!" are record lines defining the attribute fields + private static boolean isRecordLineDefiningTheAttributeFields(String line) { + return line.length() >= 2 && line.substring(0, 2).equals("@!"); + } + private static String removeComment(String line) { // Only outside quotes return line.replaceAll("('[^']*')|(^/[^/]*)|(/[^/]*)", "$1$2"); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/CaseIdentificationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/CaseIdentificationData.java index fc881ae2513..f77c021ec13 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/CaseIdentificationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/CaseIdentificationData.java @@ -47,7 +47,7 @@ protected CaseIdentificationLegacyText(AbstractRecordGroup read(LegacyTextReader reader, C List linkRecords = new ArrayList<>(); if (!reader.isQRecordFound()) { - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { PsseMultiTerminalDcMain main = mainData.readFromStrings(Collections.singletonList(line), context).get(0); addNextNrecords(reader, converterRecords, main.getNconv()); addNextNrecords(reader, busRecords, main.getNdcbs()); addNextNrecords(reader, linkRecords, main.getNdcln()); - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); PsseMultiTerminalDcTransmissionLine multiTerminal = new PsseMultiTerminalDcTransmissionLine(main); multiTerminalList.add(multiTerminal); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java index 416760eff72..0df6723a0ca 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/SubstationData.java @@ -51,7 +51,7 @@ public List read(LegacyTextReader reader, Context context) throw List substationList = new ArrayList<>(); if (!reader.isQRecordFound()) { - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { PsseSubstationRecord substationRecord = recordData.readFromStrings(Collections.singletonList(line), context).get(0); @@ -62,7 +62,7 @@ public List read(LegacyTextReader reader, Context context) throw PsseSubstation substation = new PsseSubstation(substationRecord, nodeList, switchingDeviceList, equipmentTerminalList); substationList.add(substation); - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); } } @@ -75,7 +75,7 @@ private List readEquipmentTerminalData(LegacyTe List equipmentTerminalTwoBusesRecords = new ArrayList<>(); List equipmentTerminalThreeBusesRecords = new ArrayList<>(); - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { PsseSubstationEquipmentTerminalCommonStart commonStart = commonStartData.readFromStrings(Collections.singletonList(line), context).get(0); if (isOneBus(commonStart.getType())) { @@ -87,7 +87,7 @@ private List readEquipmentTerminalData(LegacyTe } else { throw new PsseException("Unexpected equipment terminal type: " + commonStart.getType()); } - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); } List equipmentTerminalList = new SubstationEquipmentTerminalDataOneBus().readFromStrings(equipmentTerminalOneBusRecords, context); diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TransformerData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TransformerData.java index 58c02fbfcb1..782f3e95b19 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TransformerData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TransformerData.java @@ -64,7 +64,7 @@ public List read(LegacyTextReader reader, Context context) thro List impedanceRecords = new ArrayList<>(); List windingRecords = new ArrayList<>(); if (!reader.isQRecordFound()) { - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { mainRecords.add(line); impedanceRecords.add(reader.readRecordLine()); @@ -73,7 +73,7 @@ public List read(LegacyTextReader reader, Context context) thro if (is3Winding(line)) { windingRecords.add(reader.readRecordLine()); } - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TwoTerminalDcTransmissionLineData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TwoTerminalDcTransmissionLineData.java index ef52d97c4c8..9e2ecc80b51 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TwoTerminalDcTransmissionLineData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/TwoTerminalDcTransmissionLineData.java @@ -56,12 +56,12 @@ public List read(LegacyTextReader reader, Con List mainRecords = new ArrayList<>(); List converterRecords = new ArrayList<>(); if (!reader.isQRecordFound()) { - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { mainRecords.add(line); converterRecords.add(reader.readRecordLine()); converterRecords.add(reader.readRecordLine()); - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); } } diff --git a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/VoltageSourceConverterDcTransmissionLineData.java b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/VoltageSourceConverterDcTransmissionLineData.java index 821088b81d9..5e7b4876a44 100644 --- a/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/VoltageSourceConverterDcTransmissionLineData.java +++ b/psse/psse-model/src/main/java/com/powsybl/psse/model/pf/io/VoltageSourceConverterDcTransmissionLineData.java @@ -52,12 +52,12 @@ public List read(LegacyTextReader List mainRecords = new ArrayList<>(); List converterRecords = new ArrayList<>(); if (!reader.isQRecordFound()) { - String line = reader.readRecordLine(); + String line = reader.readUntilFindingARecordLineNotEmpty(); while (!reader.endOfBlock(line)) { mainRecords.add(line); converterRecords.add(reader.readRecordLine()); converterRecords.add(reader.readRecordLine()); - line = reader.readRecordLine(); + line = reader.readUntilFindingARecordLineNotEmpty(); } }