powsybl-core icon indicating copy to clipboard operation
powsybl-core copied to clipboard

[WIP] Generic Area model in iIDM

Open m-guibert opened this issue 11 months ago • 2 comments

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

m-guibert avatar Mar 27 '24 10:03 m-guibert

In the current state, there is a problem with the Subnetworks. 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 AreaTypes and Areas should maybe be cloned at detach (in the original network or in the detached network).

olperr1 avatar May 22 '24 16:05 olperr1

In the current state, there is a problem with the Subnetworks. 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.

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 AreaTypes and Areas 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

vmouradian avatar May 27 '24 14:05 vmouradian