@Test public void testLoad() { Network network = EurostagTutorialExample1Factory.createWithLFResults(); NetworkReducerObserverImpl observer = new NetworkReducerObserverImpl(); NetworkReducer reducer = NetworkReducer.builder() .withNetworkPredicate(IdentifierNetworkPredicate.of("P1")) .withObservers(observer) .build(); reducer.reduce(network); assertEquals(1, network.getSubstationCount()); assertEquals(2, network.getVoltageLevelCount()); assertEquals(1, network.getTwoWindingsTransformerCount()); assertEquals(0, network.getLineCount()); assertEquals(1, network.getGeneratorCount()); assertEquals(2, network.getLoadCount()); assertEquals(0, network.getDanglingLineCount()); Load load1 = network.getLoad(NHV1_NHV2_1); assertNotNull(load1); assertEquals(LoadType.FICTITIOUS, load1.getLoadType()); assertEquals(302.4440612792969, load1.getP0(), 0.0); assertEquals(98.74027252197266, load1.getQ0(), 0.0); assertEquals(302.4440612792969, load1.getTerminal().getP(), 0.0); assertEquals(98.74027252197266, load1.getTerminal().getQ(), 0.0); Load load2 = network.getLoad(NHV1_NHV2_2); assertNotNull(load2); assertEquals(LoadType.FICTITIOUS, load2.getLoadType()); assertEquals(302.4440612792969, load2.getP0(), 0.0); assertEquals(98.74027252197266, load2.getQ0(), 0.0); assertEquals(302.4440612792969, load2.getTerminal().getP(), 0.0); assertEquals(98.74027252197266, load2.getTerminal().getQ(), 0.0); assertEquals(1, observer.getSubstationRemovedCount()); assertEquals(2, observer.getVoltageLevelRemovedCount()); assertEquals(2, observer.getLineReplacedCount()); assertEquals(2, observer.getLineRemovedCount()); assertEquals(0, observer.getTwoWindingsTransformerReplacedCount()); assertEquals(1, observer.getTwoWindingsTransformerRemovedCount()); assertEquals(0, observer.getThreeWindingsTransformerReplacedCount()); assertEquals(0, observer.getThreeWindingsTransformerRemovedCount()); assertEquals(0, observer.getHvdcLineReplacedCount()); assertEquals(0, observer.getHvdcLineRemovedCount()); }
@Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers); }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers);  }
DefaultNetworkReducer extends AbstractNetworkReducer { @Override protected void reduce(Substation substation) { substation.remove(); observers.forEach(o -> o.substationRemoved(substation)); } DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, NetworkReducerObserver... observers);  DefaultNetworkReducer(NetworkPredicate predicate, ReductionOptions options, List<NetworkReducerObserver> observers);   }