diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java index 5302d4b77..f54c6594c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java @@ -19,14 +19,26 @@ public final class BuildersUtil { private BuildersUtil() { } + /** + * Returns the ActionConnectionPoint (bus or bus bar section) identified by the staticId parameter + * Verifies the point is properly energized, if not returns null + * @param network the network containing the ActionConnectionPoint + * @param staticId the identifiable id + * @return the energized action connection point if found, null instead + */ public static Identifiable getActionConnectionPoint(Network network, String staticId) { BusbarSection busbarSection = network.getBusbarSection(staticId); return busbarSection != null && !Double.isNaN(busbarSection.getV()) ? busbarSection - : getVoltageOnBus(network.getBusBreakerView().getBus(staticId)); + : getEnergizedBus(network.getBusBreakerView().getBus(staticId)); } - private static Bus getVoltageOnBus(Bus bus) { + /** + * Verifies and returns the bus if it is properly energized, if not returns null + * @param bus the reviewed bus + * @return the energized bus if found, null instead + */ + private static Bus getEnergizedBus(Bus bus) { return bus != null && bus.isInMainConnectedComponent() && !Double.isNaN(bus.getV()) ? bus : null; } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java index 9bb2d8d2a..2478c7364 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java @@ -12,7 +12,7 @@ import java.util.Optional; /** - * Interface for buses used by automatons for measure or event for various actions + * Interface for buses and bsu bar sections used by automatons for measure or event for various actions * @author Laurent Issertial {@literal } */ public interface ActionConnectionPoint extends Model {