/** * Throw a {@link com.powsybl.commons.PowsyblException} if this voltage level contains at least one {@link Branch} or * one {@link ThreeWindingsTransformer} or one {@link HvdcConverterStation}. */ static void checkRemovability(VoltageLevel voltageLevel) { Network network = voltageLevel.getSubstation().getNetwork(); for (Connectable connectable : voltageLevel.getConnectables()) { ConnectableType type = connectable.getType(); if (MULTIPLE_TERMINALS_CONNECTABLE_TYPES.contains(type)) { // Reject lines, 2WT and 3WT throw new AssertionError("The voltage level '" + voltageLevel.getId() + "' cannot be removed because of a remaining " + type); } else if ((type == ConnectableType.HVDC_CONVERTER_STATION) && (network.getHvdcLine((HvdcConverterStation) connectable) != null)) { // Reject all converter stations connected to a HVDC line throw new AssertionError("The voltage level '" + voltageLevel.getId() + "' cannot be removed because of a remaining HVDC line"); } } } }
/** * Throw a {@link com.powsybl.commons.PowsyblException} if this substation contains at least one {@link Branch} or * one {@link ThreeWindingsTransformer} or one {@link HvdcConverterStation} linked to a voltage level outside this * substation. */ static void checkRemovability(Substation substation) { for (VoltageLevel vl : substation.getVoltageLevels()) { for (Connectable connectable : vl.getConnectables()) { if (connectable instanceof Branch) { checkRemovability(substation, (Branch) connectable); } else if (connectable instanceof ThreeWindingsTransformer) { checkRemovability(substation, (ThreeWindingsTransformer) connectable); } else if (connectable instanceof HvdcConverterStation) { checkRemovability(substation, (HvdcConverterStation) connectable); } } } }