@Test public void readPhaseTapChanger() throws IOException { Network network = PhaseShifterTestCaseFactory.create(); StringToIntMapper<AmplSubset> mapper = AmplUtil.createMapper(network); TwoWindingsTransformer twt = network.getTwoWindingsTransformer("PS1"); PhaseTapChanger ptc = twt.getPhaseTapChanger(); assertEquals(1, ptc.getTapPosition()); ReadOnlyDataSource dataSource = new ResourceDataSource("ptc-test", new ResourceSet("/outputs/", "ptc-test_ptc.txt")); AmplNetworkReader reader = new AmplNetworkReader(dataSource, network, mapper); reader.readPhaseTapChangers(); assertEquals(2, ptc.getTapPosition()); }
private Void readPhaseTapChanger(String[] tokens) { int num = Integer.parseInt(tokens[1]); int tap = Integer.parseInt(tokens[2]); String id = mapper.getId(AmplSubset.PHASE_TAP_CHANGER, num); if (id.endsWith(AmplConstants.LEG1_SUFFIX) || id.endsWith(AmplConstants.LEG2_SUFFIX) || id.endsWith(AmplConstants.LEG3_SUFFIX)) { ThreeWindingsTransformer twt = getThreeWindingsTransformer(network, id); PhaseTapChanger ptc = getThreeWindingsTransformerLeg(twt, id).getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } else { TwoWindingsTransformer twt = network.getTwoWindingsTransformer(id); if (twt == null) { throw new AmplException("Invalid two windings transformer id '" + id + "'"); } PhaseTapChanger ptc = twt.getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } return null; }
AmplNetworkReader { private Void readPhaseTapChanger(String[] tokens) { int num = Integer.parseInt(tokens[1]); int tap = Integer.parseInt(tokens[2]); String id = mapper.getId(AmplSubset.PHASE_TAP_CHANGER, num); if (id.endsWith(AmplConstants.LEG1_SUFFIX) || id.endsWith(AmplConstants.LEG2_SUFFIX) || id.endsWith(AmplConstants.LEG3_SUFFIX)) { ThreeWindingsTransformer twt = getThreeWindingsTransformer(network, id); PhaseTapChanger ptc = getThreeWindingsTransformerLeg(twt, id).getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } else { TwoWindingsTransformer twt = network.getTwoWindingsTransformer(id); if (twt == null) { throw new AmplException("Invalid two windings transformer id '" + id + "'"); } PhaseTapChanger ptc = twt.getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } return null; } }
AmplNetworkReader { private Void readPhaseTapChanger(String[] tokens) { int num = Integer.parseInt(tokens[1]); int tap = Integer.parseInt(tokens[2]); String id = mapper.getId(AmplSubset.PHASE_TAP_CHANGER, num); if (id.endsWith(AmplConstants.LEG1_SUFFIX) || id.endsWith(AmplConstants.LEG2_SUFFIX) || id.endsWith(AmplConstants.LEG3_SUFFIX)) { ThreeWindingsTransformer twt = getThreeWindingsTransformer(network, id); PhaseTapChanger ptc = getThreeWindingsTransformerLeg(twt, id).getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } else { TwoWindingsTransformer twt = network.getTwoWindingsTransformer(id); if (twt == null) { throw new AmplException("Invalid two windings transformer id '" + id + "'"); } PhaseTapChanger ptc = twt.getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } return null; } AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, int variantIndex, StringToIntMapper<AmplSubset> mapper);  AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, StringToIntMapper<AmplSubset> mapper); }
AmplNetworkReader { private Void readPhaseTapChanger(String[] tokens) { int num = Integer.parseInt(tokens[1]); int tap = Integer.parseInt(tokens[2]); String id = mapper.getId(AmplSubset.PHASE_TAP_CHANGER, num); if (id.endsWith(AmplConstants.LEG1_SUFFIX) || id.endsWith(AmplConstants.LEG2_SUFFIX) || id.endsWith(AmplConstants.LEG3_SUFFIX)) { ThreeWindingsTransformer twt = getThreeWindingsTransformer(network, id); PhaseTapChanger ptc = getThreeWindingsTransformerLeg(twt, id).getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } else { TwoWindingsTransformer twt = network.getTwoWindingsTransformer(id); if (twt == null) { throw new AmplException("Invalid two windings transformer id '" + id + "'"); } PhaseTapChanger ptc = twt.getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } return null; } AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, int variantIndex, StringToIntMapper<AmplSubset> mapper);  AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, StringToIntMapper<AmplSubset> mapper); AmplNetworkReader readGenerators(); AmplNetworkReader readBatteries(); AmplNetworkReader readLoads(); AmplNetworkReader readRatioTapChangers(); AmplNetworkReader readPhaseTapChangers(); AmplNetworkReader readShunts(); AmplNetworkReader readBuses(); AmplNetworkReader readBranches(); AmplNetworkReader readHvdcLines(); AmplNetworkReader readStaticVarcompensator(); AmplNetworkReader readLccConverterStations(); AmplNetworkReader readVscConverterStations(); AmplNetworkReader readMetrics(Map<String, String> metrics); }
AmplNetworkReader { private Void readPhaseTapChanger(String[] tokens) { int num = Integer.parseInt(tokens[1]); int tap = Integer.parseInt(tokens[2]); String id = mapper.getId(AmplSubset.PHASE_TAP_CHANGER, num); if (id.endsWith(AmplConstants.LEG1_SUFFIX) || id.endsWith(AmplConstants.LEG2_SUFFIX) || id.endsWith(AmplConstants.LEG3_SUFFIX)) { ThreeWindingsTransformer twt = getThreeWindingsTransformer(network, id); PhaseTapChanger ptc = getThreeWindingsTransformerLeg(twt, id).getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } else { TwoWindingsTransformer twt = network.getTwoWindingsTransformer(id); if (twt == null) { throw new AmplException("Invalid two windings transformer id '" + id + "'"); } PhaseTapChanger ptc = twt.getPhaseTapChanger(); ptc.setTapPosition(ptc.getLowTapPosition() + tap - 1); } return null; } AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, int variantIndex, StringToIntMapper<AmplSubset> mapper);  AmplNetworkReader(ReadOnlyDataSource dataSource, Network network, StringToIntMapper<AmplSubset> mapper); AmplNetworkReader readGenerators(); AmplNetworkReader readBatteries(); AmplNetworkReader readLoads(); AmplNetworkReader readRatioTapChangers(); AmplNetworkReader readPhaseTapChangers(); AmplNetworkReader readShunts(); AmplNetworkReader readBuses(); AmplNetworkReader readBranches(); AmplNetworkReader readHvdcLines(); AmplNetworkReader readStaticVarcompensator(); AmplNetworkReader readLccConverterStations(); AmplNetworkReader readVscConverterStations(); AmplNetworkReader readMetrics(Map<String, String> metrics);  }