powsybl-core
powsybl-core copied to clipboard
[WIP] Generic Area model in iIDM
Please check if the PR fulfills these requirements
- [ ] The commit message follows our guidelines
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
Does this PR already have an issue describing the problem?
Fixes #2883
Does this PR introduce a breaking change or deprecate an API?
- [ ] Yes
- [x] No
In the current state, there is a problem with the Subnetwork
s. Since Area
and AreaType
don't have a real parentNetwork
management, they will always be attached to the root network. The NetworkFactory.merge(...)
and Network.detach()
methods won't work as we could expect.
For instance, if we add the following code at the end of the AbstractAreaTest.checkSubnetworkNewAreas()
unit test:
Network detachedNetwork = subnetwork.detach();
Assertions.assertAll(
() -> assertTrue(Iterables.contains(detachedNetwork.getAreaTypes(), areaType)),
() -> assertTrue(Iterables.contains(detachedNetwork.getAreas(), area)),
() -> assertFalse(Iterables.contains(network.getAreaTypes(), areaType)),
() -> assertFalse(Iterables.contains(network.getAreas(), area))
);
Since area
and areaType
were created in the subnetwork, we expect that they will be still accessible from it when it is detached. But all these assertions fail.
Note that a special management should be introduced. If an AreaType
or an Area
is created (or imported) from a subnetwork, it would be available for the whole network and it would be possible to use it from another subnetwork.
The used AreaType
s and Area
s should maybe be cloned at detach (in the original network or in the detached network).
In the current state, there is a problem with the
Subnetwork
s. SinceArea
andAreaType
don't have a realparentNetwork
management, they will always be attached to the root network. TheNetworkFactory.merge(...)
andNetwork.detach()
methods won't work as we could expect.Note that a special management should be introduced. If an
AreaType
or anArea
is created (or imported) from a subnetwork, it would be available for the whole network and it would be possible to use it from another subnetwork. The usedAreaType
s andArea
s should maybe be cloned at detach (in the original network or in the detached network).
The implementation has been updated for the subnetworks, and Areas are handled for the detach. Areas are considered related to a subnetwork if they contain voltagelevels that are contained in the subnetwork
Quality Gate passed
Issues
3 New issues
0 Accepted issues
Measures
0 Security Hotspots
96.3% Coverage on New Code
1.5% Duplication on New Code