AmplNetworkReader { private Void readShunt(String[] tokens) { int num = Integer.parseInt(tokens[1]); int busNum = Integer.parseInt(tokens[2]); double q = readDouble(tokens[4]); int sections = Integer.parseInt(tokens[5]); String id = mapper.getId(AmplSubset.SHUNT, num); ShuntCompensator sc = network.getShuntCompensator(id); if (sc == null) { throw new AmplException("Invalid shunt compensator id '" + id + "'"); } if (sc.getModelType() == ShuntCompensatorModelType.NON_LINEAR) { } else { sc.setSectionCount(Math.max(0, Math.min(sc.getMaximumSectionCount(), sections))); } Terminal t = sc.getTerminal(); t.setQ(q); 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 readShunt() throws IOException { Network network = ShuntTestCaseFactory.createNonLinear(); ShuntCompensator sc = network.getShuntCompensator("SHUNT"); sc.setSectionCount(2); assertTrue(Double.isNaN(sc.getTerminal().getQ())); StringToIntMapper<AmplSubset> mapper = AmplUtil.createMapper(network); ReadOnlyDataSource dataSource = new ResourceDataSource("shunt-test-case", new ResourceSet("/outputs/", "shunt-test-case_shunts.txt")); AmplNetworkReader reader = new AmplNetworkReader(dataSource, network, 1, mapper); reader.readShunts(); ShuntCompensator sc2 = network.getShuntCompensator("SHUNT"); assertEquals(30.0, sc2.getTerminal().getQ(), 0.0); }