Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
25ff548
Modify FlowsLimitsHolder API to manage multiple active OperationalLim…
NathanDissoubray Jan 22, 2026
b71f560
Update Impls that are easy to update
NathanDissoubray Jan 22, 2026
0fa38a1
Modify OperationalLimitsGroup(s)Impl
NathanDissoubray Jan 22, 2026
497d475
Add a addSelected method and to keep same expected results with setSe…
NathanDissoubray Jan 23, 2026
673f9c4
Modify checkLimitViolation to get multiple Overload instead of a sing…
NathanDissoubray Jan 26, 2026
b36f24a
Implement methods for security needed to handle multiple limits, apar…
NathanDissoubray Jan 26, 2026
940fd40
Rename getAllSelectedOperationalLimitsGroup -> ...Groups
NathanDissoubray Jan 27, 2026
0df8345
Add methods to get Active,Apparent,Current limits from an id
NathanDissoubray Jan 27, 2026
6270e7f
Rename getSelectedOrThrow to getOperationalLimitsGroupOrThrow in OpLi…
NathanDissoubray Jan 27, 2026
cc5aa65
Remove TODO
NathanDissoubray Jan 27, 2026
5c3db00
Add back constructor of OperationalLimitsGroupImpl with a string and …
NathanDissoubray Jan 27, 2026
81c500b
Remove unneeded blank line
NathanDissoubray Jan 27, 2026
f6092a4
Replace usage of string collection by a predicate in OperationalLimit…
NathanDissoubray Jan 28, 2026
8bf6b68
Add missing . in error message
NathanDissoubray Jan 28, 2026
261f236
Simplify calls to functions getting a given side for the limits
NathanDissoubray Jan 28, 2026
1bf8ee0
Remove notification of deselection on setSelected if the group is alr…
NathanDissoubray Jan 28, 2026
b6459c9
LimitsComputer adaptations
olperr1 Jan 28, 2026
f11157f
Modify getLoadingLimits and getAllSelectedLoadingLimits to a simpler …
NathanDissoubray Jan 29, 2026
6be65dc
Replace collect(Collectors.toList()) by toList()
NathanDissoubray Jan 29, 2026
c4e921b
Clean function name and predicate useage in OperationalLimitsGroupsIm…
NathanDissoubray Jan 29, 2026
6d1859a
Checkstyle
NathanDissoubray Jan 29, 2026
ed032a9
Overload have the id of the limits group they are related to
NathanDissoubray Jan 29, 2026
6fabc50
Add method to return all the ids of the side of a branch from the bra…
NathanDissoubray Jan 29, 2026
c25731f
Add javadoc
NathanDissoubray Jan 29, 2026
1b3884f
Change some private functions in LimitViolationUtils to public, make …
NathanDissoubray Jan 30, 2026
82a2468
Rewrite checkLimitViolation to handle multiple groups
NathanDissoubray Jan 30, 2026
96a14bf
Fix logic error with naming of group in overload construction
NathanDissoubray Jan 30, 2026
5f2837d
Fix forgotten filtering of overloading on permanent limits
NathanDissoubray Jan 30, 2026
1e35b7c
Add ability to deselect multiple groups at once
NathanDissoubray Jan 30, 2026
30d4ba7
Add functions to add and deselect groups directly from a branch
NathanDissoubray Jan 30, 2026
a60ce89
Modify the DefaultLimitViolationDetector to use methods in LimitViola…
NathanDissoubray Feb 3, 2026
d02cb0f
Modify LimitViolationDetector to use LimitViolationDetection
NathanDissoubray Feb 3, 2026
36a9434
Modify LimitViolationDetector on temporary to also use LimitViolation…
NathanDissoubray Feb 3, 2026
293bb09
Add operationalGroupId and the value of the permanent limit in the pe…
NathanDissoubray Feb 3, 2026
4a72244
Add a test to check multiple activated limits group
NathanDissoubray Feb 4, 2026
547983d
Write some parameterized tests for the multiple active groups
NathanDissoubray Feb 4, 2026
5c64fa5
Add more test case to parameterized test
NathanDissoubray Feb 4, 2026
7c56b77
Merge branch 'main' into 3703-2-multiple_active_operational_limits_group
NathanDissoubray Feb 5, 2026
2d0e7ea
serde modify both xsd to take multiple selected limits group
NathanDissoubray Feb 5, 2026
eb0899e
Modify branch to have add and deselect use side like get
NathanDissoubray Feb 6, 2026
f5815f3
Serde for multiple selected operational groups
NathanDissoubray Feb 6, 2026
cd566fd
Fix some tests
NathanDissoubray Feb 6, 2026
121c11d
Update test ressources in iidm 1.16
NathanDissoubray Feb 6, 2026
4e978e2
Fix psse tests
NathanDissoubray Feb 9, 2026
98753d9
Fix tests in iidm-modification
NathanDissoubray Feb 9, 2026
a06a184
Fix tests in matpower-converter
NathanDissoubray Feb 9, 2026
96026ef
Fix issue with Sonar wildcard
NathanDissoubray Feb 9, 2026
c7e28db
Fix more sonar issues
NathanDissoubray Feb 9, 2026
4e795d3
Remove last temporary limit set to 0 to check that the acceptable dur…
NathanDissoubray Feb 9, 2026
b9578e7
Add read the doc to explain multiple selected operational limits group
NathanDissoubray Feb 9, 2026
97c5781
Exchange light and dark mode RTD images
NathanDissoubray Feb 9, 2026
ceae8b1
Fix identation level of example in RTD
NathanDissoubray Feb 9, 2026
f4d3a9b
Fix images (again)
NathanDissoubray Feb 9, 2026
23043e0
Change size of text on RTD example images
NathanDissoubray Feb 9, 2026
d98b869
Merge branch 'main' into 3703-2-multiple_active_operational_limits_group
NathanDissoubray Feb 9, 2026
a570829
Add more tests for some functions in branch, for current, active and …
NathanDissoubray Feb 12, 2026
0fa0140
Checkstyle
NathanDissoubray Feb 12, 2026
97070d9
Use variable instead of string inside network creation of Eurostag
NathanDissoubray Feb 12, 2026
429a75f
Remove duplicated lines
NathanDissoubray Feb 12, 2026
2c3e4a1
Revert "Fix issue with Sonar wildcard"
NathanDissoubray Feb 17, 2026
a3dc713
Add some deselection tests
NathanDissoubray Feb 17, 2026
7c0b8f2
Merge branch 'main' into 3703-2-multiple_active_operational_limits_group
NathanDissoubray Feb 17, 2026
297cbae
Change checkPermanentLimit to check for all the selected groups, not …
NathanDissoubray Feb 17, 2026
c170096
Add checkAllTemporaryLimits to Utils, Branch and TieLine
NathanDissoubray Feb 18, 2026
dec6fd4
Change getOverloadDuration to work with multiple selected op group
NathanDissoubray Feb 18, 2026
9cd09b2
Add test for getDuration
NathanDissoubray Feb 19, 2026
669a546
Add a function to set all groups of a flows holder as selected
NathanDissoubray Feb 19, 2026
085e95d
Move function as default in interface and remove unused util function…
NathanDissoubray Feb 19, 2026
b5537f3
Modify cgmes export to take into account all selected limits, add tes…
NathanDissoubray Feb 19, 2026
0543682
Properly copy all selected groups when transforming a 3WT to 3-2WT
NathanDissoubray Feb 19, 2026
979c8b8
Make an helper function to get limit holder from side in abstractbranch
NathanDissoubray Feb 20, 2026
2728f1d
Add a selection of groups with a predicate
NathanDissoubray Feb 20, 2026
dd17d18
Add a test to check the add by predicate
NathanDissoubray Feb 20, 2026
6a72ec5
Modify getOverload to take into account the firstTemporary limit
NathanDissoubray Feb 24, 2026
e48daad
Add tests for checkTemporaryLimit on branch
NathanDissoubray Feb 24, 2026
e93a8a3
Add some javadoc
NathanDissoubray Feb 25, 2026
0930db6
Merge branch 'main' into 3703-2-multiple_active_operational_limits_group
NathanDissoubray Feb 25, 2026
d518bc3
Add checkTemporaryLimits test for 3WT
NathanDissoubray Feb 25, 2026
db9a6ae
Add tests for limitReduction on checkAllTemporaryLimits
NathanDissoubray Feb 25, 2026
2980db0
Fix some javadoc and RTD
NathanDissoubray Feb 27, 2026
506160b
Reword LimitViolation javadoc for acceptableDuraion to not only be va…
NathanDissoubray Feb 27, 2026
2cefa50
Add null check to AbstractLimitsReducer constructor
NathanDissoubray Feb 27, 2026
9da540a
Suggested code review javadoc changes
NathanDissoubray Mar 3, 2026
d97523e
Move checkAllTemporaryLimits(side, type) as default in Branch
NathanDissoubray Mar 3, 2026
ca22381
Move 3wt getOverloadDuration to interface as default, change implemen…
NathanDissoubray Mar 3, 2026
aa47c30
Move getAllSelectedLimits as default in ThreeWindingsTransformer
NathanDissoubray Mar 3, 2026
a94b8b9
Change parameter order for write/read allSelectedGroupsIds
NathanDissoubray Mar 3, 2026
1c45a7d
Remove TODOs
NathanDissoubray Mar 3, 2026
43827a4
Add clarification regarding setting loading limits on tie lines
NathanDissoubray Mar 3, 2026
f3b4a1b
Select default group if not already selected
NathanDissoubray Mar 3, 2026
1b5c25f
Notify deselect only if group was selected
NathanDissoubray Mar 3, 2026
ee59a57
Reword javadoc of addSelectedByPredicate
NathanDissoubray Mar 3, 2026
775c410
Reword "of the selected" to "of the last selected" in javadoc
NathanDissoubray Mar 3, 2026
d154b19
Create a wrapper to consume limitViolations
NathanDissoubray Mar 3, 2026
83a9088
Checkstyle
NathanDissoubray Mar 3, 2026
8a30778
Correction on wrapper of consumer in LimitViolationDetector
NathanDissoubray Mar 3, 2026
810f7bb
Add a method for ordered ids of operational limit groups
NathanDissoubray Mar 3, 2026
f85761a
Modify addSelected and deselect to log errors / warn and only throw e…
NathanDissoubray Mar 4, 2026
bf3d0de
Add test on limit reduction applier to check reduction on multiple se…
NathanDissoubray Mar 4, 2026
0ff4bbc
Serialize LimitViolation's operationalLimitsGroupId
NathanDissoubray Mar 4, 2026
69dd53e
Add test for v1.4 of shortcircuit SerDe with an OperationalLimitsGroupId
NathanDissoubray Mar 5, 2026
44fbe7e
Modify tests on v1.9 of LimitViolation SerDe to test write / read of …
NathanDissoubray Mar 5, 2026
0eeceb5
Refactor some code to avoid repetition in LimitViolationUtils
NathanDissoubray Mar 5, 2026
6743348
Same refactoring for permanent limits
NathanDissoubray Mar 5, 2026
4ebba72
Same for permanent result
NathanDissoubray Mar 5, 2026
91deb28
Merge branch 'main' into 3703-2-multiple_active_operational_limits_group
NathanDissoubray Mar 6, 2026
8232a85
Adapt code after DanglingLine to BoundaryLine renaming
NathanDissoubray Mar 6, 2026
7385208
Rename some forgotten dangling into boundary
NathanDissoubray Mar 6, 2026
6b26366
Add test to export of network with multiple selected groups
NathanDissoubray Mar 6, 2026
7e8039d
Remove TODO
NathanDissoubray Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

import static com.powsybl.iidm.network.util.LoadingLimitsUtil.initializeFromLoadingLimits;

Expand Down Expand Up @@ -141,6 +143,12 @@ public interface Branch<I extends Branch<I>> extends Identifiable<I> {
*/
Optional<OperationalLimitsGroup> getSelectedOperationalLimitsGroup1();

/**
* Get all the selected {@link OperationalLimitsGroup} on side 1.
* @return all the selected {@link OperationalLimitsGroup} on side 1, might be empty if none is selected
*/
Collection<OperationalLimitsGroup> getAllSelectedOperationalLimitsGroup1();

/**
* <p>Create a new {@link OperationalLimitsGroup} on side 1 with the given ID.</p>
* <p>If a group of the given ID already exists, it is replaced silently.</p>
Expand Down Expand Up @@ -178,6 +186,14 @@ default Optional<CurrentLimits> getCurrentLimits1() {
return getSelectedOperationalLimitsGroup1().flatMap(OperationalLimitsGroup::getCurrentLimits);
}

/**
* Get all the {@link CurrentLimits} of all the selected {@link OperationalLimitsGroup} on side 1.
* @return a collection of {@link CurrentLimits} for all the selected {@link OperationalLimitsGroup} on side 1, might be empty if none is selected
*/
default Collection<CurrentLimits> getAllSelectedCurrentLimits1() {
return getAllSelectedLoadingLimits1(OperationalLimitsGroup::getCurrentLimits);
}

/**
* Get the {@link CurrentLimits} of the selected {@link OperationalLimitsGroup} on side 1.
* @return {@link CurrentLimits} of the selected {@link OperationalLimitsGroup} on side 1 if any, <code>null</code> otherwise.
Expand All @@ -194,6 +210,14 @@ default Optional<ActivePowerLimits> getActivePowerLimits1() {
return getSelectedOperationalLimitsGroup1().flatMap(OperationalLimitsGroup::getActivePowerLimits);
}

/**
* Get all the {@link ActivePowerLimits} of all the selected {@link OperationalLimitsGroup} on side 1.
* @return a collection of {@link ActivePowerLimits} for all the selected {@link OperationalLimitsGroup} on side 1, might be empty if none is selected
*/
default Collection<ActivePowerLimits> getAllSelectedActivePowerLimits1() {
return getAllSelectedLoadingLimits1(OperationalLimitsGroup::getActivePowerLimits);
}

/**
* Get the {@link ActivePowerLimits} of the selected {@link OperationalLimitsGroup} on side 1.
* @return {@link ActivePowerLimits} of the selected {@link OperationalLimitsGroup} on side 1 if any, <code>null</code> otherwise.
Expand All @@ -210,6 +234,10 @@ default Optional<ApparentPowerLimits> getApparentPowerLimits1() {
return getSelectedOperationalLimitsGroup1().flatMap(OperationalLimitsGroup::getApparentPowerLimits);
}

default Collection<ApparentPowerLimits> getAllSelectedApparentPowerLimits1() {
return getAllSelectedLoadingLimits1(OperationalLimitsGroup::getApparentPowerLimits);
}

/**
* Get the {@link ApparentPowerLimits} of the selected {@link OperationalLimitsGroup} on side 1.
* @return {@link ApparentPowerLimits} of the selected {@link OperationalLimitsGroup} on side 1 if any, <code>null</code> otherwise.
Expand All @@ -218,6 +246,20 @@ default ApparentPowerLimits getNullableApparentPowerLimits1() {
return getApparentPowerLimits1().orElse(null);
}

/**
* Helper function to return an operational limit of a given type using the provided function on the side one
* @param operationalLimitToLoadingLimitFunction the function that will return an optional {@link LoadingLimits} from an {@link OperationalLimitsGroup}
* @return a collection of loadingLimits, all the same type
* @param <T> the type of loadingLimit
*/
private <T extends LoadingLimits> Collection<T> getAllSelectedLoadingLimits1(Function<OperationalLimitsGroup, Optional<T>> operationalLimitToLoadingLimitFunction) {
return getAllSelectedOperationalLimitsGroup1()
.stream()
.map(operationalLimitToLoadingLimitFunction)
.flatMap(Optional::stream)
.collect(Collectors.toList());
}

/**
* <p>Create an adder to add a new {@link CurrentLimits} in the selected {@link OperationalLimitsGroup} on side 1.</p>
* <p>If there's no selected group, the adder will also create a new group with the default name and set it as selected.
Expand Down Expand Up @@ -358,6 +400,12 @@ default ApparentPowerLimitsAdder newApparentPowerLimits1(ApparentPowerLimits app
*/
Optional<OperationalLimitsGroup> getSelectedOperationalLimitsGroup2();

/**
* Get all the selected {@link OperationalLimitsGroup} on side 2.
* @return all the selected {@link OperationalLimitsGroup} on side 2, might be empty if none is selected
*/
Collection<OperationalLimitsGroup> getAllSelectedOperationalLimitsGroup2();

/**
* <p>Create a new {@link OperationalLimitsGroup} on side 2 with the given ID.</p>
* <p>If a group of the given ID already exists, it is replaced silently.</p>
Expand Down Expand Up @@ -395,6 +443,14 @@ default Optional<CurrentLimits> getCurrentLimits2() {
return getSelectedOperationalLimitsGroup2().flatMap(OperationalLimitsGroup::getCurrentLimits);
}

/**
* Get all the {@link CurrentLimits} of all the selected {@link OperationalLimitsGroup} on side 2.
* @return a collection of {@link CurrentLimits} for all the selected {@link OperationalLimitsGroup} on side 2, might be empty if none is selected
*/
default Collection<CurrentLimits> getAllSelectedCurrentLimits2() {
return getAllSelectedLoadingLimits2(OperationalLimitsGroup::getCurrentLimits);
}

/**
* Get the {@link CurrentLimits} of the selected {@link OperationalLimitsGroup} on side 2.
* @return {@link CurrentLimits} of the selected {@link OperationalLimitsGroup} on side 2 if any, <code>null</code> otherwise.
Expand All @@ -411,6 +467,14 @@ default Optional<ActivePowerLimits> getActivePowerLimits2() {
return getSelectedOperationalLimitsGroup2().flatMap(OperationalLimitsGroup::getActivePowerLimits);
}

/**
* Get all the {@link ActivePowerLimits} of all the selected {@link OperationalLimitsGroup} on side 2.
* @return a collection of {@link ActivePowerLimits} for all the selected {@link OperationalLimitsGroup} on side 2, might be empty if none is selected
*/
default Collection<ActivePowerLimits> getAllSelectedActivePowerLimits2() {
return getAllSelectedLoadingLimits2(OperationalLimitsGroup::getActivePowerLimits);
}

/**
* Get the {@link ActivePowerLimits} of the selected {@link OperationalLimitsGroup} on side 2.
* @return {@link ActivePowerLimits} of the selected {@link OperationalLimitsGroup} on side 2 if any, <code>null</code> otherwise.
Expand All @@ -427,6 +491,10 @@ default Optional<ApparentPowerLimits> getApparentPowerLimits2() {
return getSelectedOperationalLimitsGroup2().flatMap(OperationalLimitsGroup::getApparentPowerLimits);
}

default Collection<ApparentPowerLimits> getAllSelectedApparentPowerLimits2() {
return getAllSelectedLoadingLimits2(OperationalLimitsGroup::getApparentPowerLimits);
}

/**
* Get the {@link ApparentPowerLimits} of the selected {@link OperationalLimitsGroup} on side 2.
* @return {@link ApparentPowerLimits} of the selected {@link OperationalLimitsGroup} on side 2 if any, <code>null</code> otherwise.
Expand All @@ -435,6 +503,20 @@ default ApparentPowerLimits getNullableApparentPowerLimits2() {
return getApparentPowerLimits2().orElse(null);
}

/**
* Helper function to return an operational limit of a given type using the provided function on the side two
* @param operationalLimitToLoadingLimitFunction the function that will return an optional {@link LoadingLimits} from an {@link OperationalLimitsGroup}
* @return a collection of loadingLimits, all the same type
* @param <T> the type of loadingLimit
*/
private <T extends LoadingLimits> Collection<T> getAllSelectedLoadingLimits2(Function<OperationalLimitsGroup, Optional<T>> operationalLimitToLoadingLimitFunction) {
return getAllSelectedOperationalLimitsGroup2()
.stream()
.map(operationalLimitToLoadingLimitFunction)
.flatMap(Optional::stream)
.collect(Collectors.toList());
}

/**
* <p>Create an adder to add a new {@link CurrentLimits} in the selected {@link OperationalLimitsGroup} on side 2.</p>
* <p>If there's no selected group, the adder will also create a new group with the default name and set it as selected.
Expand Down Expand Up @@ -521,20 +603,42 @@ default Optional<CurrentLimits> getCurrentLimits(TwoSides side) {
};
}

default Collection<CurrentLimits> getAllSelectedCurrentLimits(TwoSides side) {
return switch (side) {
case ONE -> getAllSelectedCurrentLimits1();
case TWO -> getAllSelectedCurrentLimits2();
};
}

default Optional<ActivePowerLimits> getActivePowerLimits(TwoSides side) {
return switch (side) {
case ONE -> getActivePowerLimits1();
case TWO -> getActivePowerLimits2();
};
}

default Collection<ActivePowerLimits> getAllSelectedActivePowerLimits(TwoSides side) {
return switch (side) {
case ONE -> getAllSelectedActivePowerLimits1();
case TWO -> getAllSelectedActivePowerLimits2();
};
}

default Optional<ApparentPowerLimits> getApparentPowerLimits(TwoSides side) {
return switch (side) {
case ONE -> getApparentPowerLimits1();
case TWO -> getApparentPowerLimits2();
};
}

default Collection<ApparentPowerLimits> getAllSelectedApparentPowerLimits(TwoSides side) {
return switch (side) {
case ONE -> getAllSelectedApparentPowerLimits1();
case TWO -> getAllSelectedApparentPowerLimits2();
};
}

//TODO deprecate this ?
default Optional<? extends LoadingLimits> getLimits(LimitType type, TwoSides side) {
return switch (type) {
case CURRENT -> getCurrentLimits(side);
Expand All @@ -545,6 +649,16 @@ default Optional<? extends LoadingLimits> getLimits(LimitType type, TwoSides sid
};
}

default Collection<? extends LoadingLimits> getAllSelectedLimits(LimitType type, TwoSides side) {
return switch (type) {
case CURRENT -> getAllSelectedCurrentLimits(side);
case ACTIVE_POWER -> getAllSelectedActivePowerLimits(side);
case APPARENT_POWER -> getAllSelectedApparentPowerLimits(side);
default ->
throw new UnsupportedOperationException(String.format("Getting %s limits is not supported.", type.name()));
};
}

default CurrentLimits getNullableCurrentLimits(TwoSides side) {
return switch (side) {
case ONE -> getNullableCurrentLimits1();
Expand Down
Loading