powsybl / powsybl-core

A framework to build power system oriented software
https://www.powsybl.org
Mozilla Public License 2.0
124 stars 40 forks source link

CGMES metadata models: allow clear of supersedes #3099

Closed zamarrenolm closed 2 months ago

zamarrenolm commented 2 months ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Supersedes set in CGMES metadata models (SSH) can not be emptied by the user. This creates a problem when trying to export CGMES data for a network that is read from CGMES inputs that already specify superseding info.

In CGM quick export, the previous supersede and the one added automatically during export are present in the output.

In manual export, the user may add a supersede to the model, to prepare the export, but the previous supersede can not be removed. The exported files contains two supersede items.

What is the new behavior (if this is a feature change)?

The CGMES metada model supersedes set in the network extension can be emptied with the method CgmesMetadataModel::clearDependencies.

The quick CGM export clears the existing SSH supersedes before adding the current one.

For the manual export of single files, the user is now being able to clear previous supersedes before adding the requested one:

network.getExtension(CgmesMetadataModels.class)
    .getModelForSubset(CgmesSubset.STEADY_STATE_HYPOTHESIS).orElseThrow()
        .clearSupersedes()
        .addSupersedes("manual-supersede");
network.write("CGMES", exportParams, ...);

Does this PR introduce a breaking change or deprecate an API?

If yes, please check if the following requirements are fulfilled

What changes might users need to make in their application due to this PR? (migration steps)

If you had define a custom CgmesMetadataModel implementation, you need to define a new method: CgmesMetadataModelImpl clearSupersedes().

Other information:

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud