Skip to content

Commit bb188b8

Browse files
author
LE SAULNIER Kevin
committed
fix: PR remarks
Signed-off-by: LE SAULNIER Kevin <[email protected]>
1 parent fa3e3b1 commit bb188b8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/main/java/org/gridsuite/securityanalysis/server/entities/AbstractLimitViolationEntity.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,9 @@ protected static Integer calculateActualOverloadDuration(LimitViolation limitVio
137137
String equipmentId = limitViolation.getSubjectId();
138138
LoadingLimits.TemporaryLimit tempLimit = null;
139139

140-
Line line = network.getLine(equipmentId);
141-
if (line != null) {
142-
tempLimit = getBranchLimitViolationAboveCurrentValue(line, limitViolation);
143-
} else {
144-
TwoWindingsTransformer twoWindingsTransformer = network.getTwoWindingsTransformer(equipmentId);
145-
if (twoWindingsTransformer != null) {
146-
tempLimit = getBranchLimitViolationAboveCurrentValue(twoWindingsTransformer, limitViolation);
147-
}
140+
Branch<?> branch = network.getBranch(equipmentId);
141+
if (branch != null) {
142+
tempLimit = getBranchLimitViolationAboveCurrentValue(branch, limitViolation);
148143
}
149144
return (tempLimit != null) ? tempLimit.getAcceptableDuration() : Integer.MAX_VALUE;
150145
}
@@ -159,7 +154,7 @@ protected static Integer calculateUpcomingOverloadDuration(LimitViolation limitV
159154

160155
private static LoadingLimits.TemporaryLimit getBranchLimitViolationAboveCurrentValue(Branch<?> branch, LimitViolation limitViolation) {
161156
// limits are returned from the store by DESC duration / ASC value
162-
Optional<CurrentLimits> currentLimits = limitViolation.getSideAsTwoSides().equals(TwoSides.ONE) ? branch.getCurrentLimits1() : branch.getCurrentLimits2();
157+
Optional<CurrentLimits> currentLimits = branch.getCurrentLimits(limitViolation.getSideAsTwoSides());
163158
if (currentLimits.isEmpty() || limitViolation.getValue() < currentLimits.get().getPermanentLimit()) {
164159
return null;
165160
} else {

0 commit comments

Comments
 (0)