Skip to content

Commit

Permalink
Fix VoltageAngleLimit retrieval by id from a subnetwork (#2743)
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Perrin <[email protected]>
(cherry picked from commit 965a415)
  • Loading branch information
olperr1 committed Oct 6, 2023
1 parent f851a55 commit d015bf4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ public Stream<VoltageAngleLimit> getVoltageAngleLimitsStream() {
public VoltageAngleLimit getVoltageAngleLimit(String id) {
VoltageAngleLimitImpl val = (VoltageAngleLimitImpl) getNetwork().getVoltageAngleLimit(id);
boolean valInSubnetwork = val != null
&& id.equals(val.getTerminalFrom().getVoltageLevel().getParentNetwork().getId())
&& id.equals(val.getTerminalTo().getVoltageLevel().getParentNetwork().getId());
&& contains(val.getTerminalFrom().getVoltageLevel())
&& contains(val.getTerminalTo().getVoltageLevel());
return valInSubnetwork ? val : null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@ public void testAngleVoltageLimitCreation() {
vla3.remove();
vla4.remove();

// Test VoltageAngleLimit retrieval
assertEquals(vla0, network.getVoltageAngleLimit("vla0"));
assertEquals(vla1, network.getVoltageAngleLimit("vla1"));
assertEquals(vla2, network.getVoltageAngleLimit("vla2"));
assertNull(subnetwork1.getVoltageAngleLimit("vla0"));
assertEquals(vla1, subnetwork1.getVoltageAngleLimit("vla1"));
assertNull(subnetwork1.getVoltageAngleLimit("vla2"));
assertNull(subnetwork2.getVoltageAngleLimit("vla0"));
assertNull(subnetwork2.getVoltageAngleLimit("vla1"));
assertEquals(vla2, subnetwork2.getVoltageAngleLimit("vla2"));

// Detach all
assertTrue(subnetwork1.isDetachable());
assertTrue(subnetwork2.isDetachable());
Expand Down

0 comments on commit d015bf4

Please sign in to comment.