private static PowsyblException createIsolationException(Substation substation) { return new PowsyblException("The substation " + substation.getId() + " is still connected to another substation"); } }
/** * Keep this substation if the IDs list contains the ID of this substation or one of its voltage levels. * @param substation The substation to test * @return true if the IDs list contains the ID of this substation or one of its voltage levels, false otherwise */ @Override public boolean test(Substation substation) { Objects.requireNonNull(substation); if (ids.contains(substation.getId())) { return true; } return substation.getVoltageLevelStream() .map(VoltageLevel::getId) .anyMatch(ids::contains); }
/** * Keep this voltage level if the IDs list contains the ID of this voltage level. * @param voltageLevel The voltage level to test * @return true if the IDs list contains the ID of this voltage level, false otherwise */ @Override public boolean test(VoltageLevel voltageLevel) { Objects.requireNonNull(voltageLevel); return ids.contains(voltageLevel.getId()) || ids.contains(voltageLevel.getSubstation().getId()); } }
@Before public void setup() throws IOException { network = Mockito.mock(Network.class); Substation s = Mockito.mock(Substation.class); Mockito.when(s.getId()).thenReturn("s1"); Mockito.when(network.getSubstations()).thenReturn(Collections.singletonList(s)); ComputationManager computationManager = Mockito.mock(ComputationManager.class); storage = createStorage(); afs = new AppFileSystem("mem", false, storage); ad = new AppData(computationManager, computationManager, Collections.singletonList(computationManager1 -> Collections.singletonList(afs)), getFileExtensions(), getProjectFileExtensions(), getServiceExtensions()); afs.setData(ad); }
.setTopologyKind(TopologyKind.BUS_BREAKER) .add(); LOGGER.trace("Creating voltage level '{}' in substation '{}'", lvVl.getId(), s.getId());