AmplNetworkReader { private Void readSvc(String[] tokens) { int num = Integer.parseInt(tokens[1]); int busNum = Integer.parseInt(tokens[2]); boolean vregul = Boolean.parseBoolean(tokens[3]); double targetV = readDouble(tokens[4]); double q = readDouble(tokens[5]); String id = mapper.getId(AmplSubset.STATIC_VAR_COMPENSATOR, num); StaticVarCompensator svc = network.getStaticVarCompensator(id); if (svc == null) { throw new AmplException("Invalid StaticVarCompensator id '" + id + "'"); } if (vregul) { svc.setRegulationMode(RegulationMode.VOLTAGE); } else { if (q == 0) { svc.setRegulationMode(RegulationMode.OFF); } else { svc.setReactivePowerSetpoint(-q); svc.setRegulationMode(RegulationMode.REACTIVE_POWER); } } Terminal t = svc.getTerminal(); t.setQ(q); double nominalV = t.getVoltageLevel().getNominalV(); svc.setVoltageSetpoint(targetV * nominalV); busConnection(t, busNum); 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);  }
@Test public void readSvc() throws IOException { Network network = SvcTestCaseFactory.create(); StringToIntMapper<AmplSubset> mapper = AmplUtil.createMapper(network); ReadOnlyDataSource dataSource = new ResourceDataSource("svc-test", new ResourceSet("/outputs/", "svc-test_static_var_compensators.txt")); AmplNetworkReader reader = new AmplNetworkReader(dataSource, network, mapper); testSvc(network, reader); }