Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte committed May 15, 2024
1 parent 75b3d6d commit 7d3572b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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, <code>null</code> 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, <code>null</code> instead
*/
private static Bus getEnergizedBus(Bus bus) {
return bus != null && bus.isInMainConnectedComponent() && !Double.isNaN(bus.getV()) ? bus : null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <laurent.issertial at rte-france.com>}
*/
public interface ActionConnectionPoint extends Model {
Expand Down

0 comments on commit 7d3572b

Please sign in to comment.