Skip to content

Commit 8bc7e5c

Browse files
authored
Merge pull request #163 from itesla/temporary_limit_value
Add convenient method to get temporary limit value
2 parents 4f12cba + ca40c12 commit 8bc7e5c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

iidm-network-api/src/main/java/eu/itesla_project/iidm/network/CurrentLimits.java

+8
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,12 @@ interface TemporaryLimit {
8282
* @return the temporary limit
8383
*/
8484
TemporaryLimit getTemporaryLimit(int acceptableDuration);
85+
86+
/**
87+
* Get a temporary limit value from its acceptable duration. Return NaN if there is non temporay limit with this
88+
* acceptable duration.
89+
* @param acceptableDuration acceptable duration in second
90+
* @return the temporary limit value or NaN if there is no temporary limit for this acceptable duration
91+
*/
92+
float getTemporaryLimitValue(int acceptableDuration);
8593
}

iidm-network-impl/src/main/java/eu/itesla_project/iidm/network/impl/CurrentLimitsImpl.java

+6
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,10 @@ public Collection<TemporaryLimit> getTemporaryLimits() {
7878
public TemporaryLimit getTemporaryLimit(int acceptableDuration) {
7979
return temporaryLimits.get(acceptableDuration);
8080
}
81+
82+
@Override
83+
public float getTemporaryLimitValue(int acceptableDuration) {
84+
TemporaryLimit tl = getTemporaryLimit(acceptableDuration);
85+
return tl != null ? tl.getValue() : Float.NaN;
86+
}
8187
}

0 commit comments

Comments
 (0)