AmplNetworkReader { private Void readBattery(String[] tokens) { int num = Integer.parseInt(tokens[1]); int busNum = Integer.parseInt(tokens[2]); double p0 = readDouble(tokens[3]); double q0 = readDouble(tokens[4]); double p = readDouble(tokens[5]); double q = readDouble(tokens[6]); String id = mapper.getId(AmplSubset.BATTERY, num); Battery b = network.getBattery(id); if (b == null) { throw new AmplException("Invalid battery id '" + id + "'"); } b.setP0(p0); b.setQ0(q0); Terminal t = b.getTerminal(); t.setP(p).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 readBattery() throws IOException { Network network = BatteryNetworkFactory.create(); StringToIntMapper<AmplSubset> mapper = AmplUtil.createMapper(network); ReadOnlyDataSource dataSource = new ResourceDataSource("battery-test", new ResourceSet("/outputs/", "battery-test_batteries.txt")); AmplNetworkReader reader = new AmplNetworkReader(dataSource, network, mapper); testBatteries(network, reader); }