-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CGMES: remove extension for Control Areas, use IIDM Area #3149
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Outdated
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Outdated
Show resolved
Hide resolved
...s/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/export/CgmesExportContext.java
Outdated
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Outdated
Show resolved
Hide resolved
...s-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/EquipmentExportTest.java
Outdated
Show resolved
Hide resolved
...s-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/EquipmentExportTest.java
Show resolved
Hide resolved
...gmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/ExportXmlCompare.java
Outdated
Show resolved
Hide resolved
...version/src/test/java/com/powsybl/cgmes/conversion/test/export/StateVariablesExportTest.java
Outdated
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
…is used Signed-off-by: Luma <[email protected]>
.../cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/TieFlowConversion.java
Outdated
Show resolved
Hide resolved
.../cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/elements/TieFlowConversion.java
Outdated
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/Conversion.java
Show resolved
Hide resolved
...onversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java
Outdated
Show resolved
Hide resolved
...onversion/src/main/java/com/powsybl/cgmes/conversion/export/SteadyStateHypothesisExport.java
Outdated
Show resolved
Hide resolved
cgmes/cgmes-conversion/src/main/java/com/powsybl/cgmes/conversion/CgmesExport.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Luma <[email protected]>
…l area attributes Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
.../cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/TieFlowConversionTest.java
Outdated
Show resolved
Hide resolved
.../cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/TieFlowConversionTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
// Remove Areas | ||
expected.getAreaStream().map(Area::getId).toList().forEach(a -> expected.getArea(a).remove()); | ||
actual.getAreaStream().map(Area::getId).toList().forEach(a -> actual.getArea(a).remove()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually remove that, areas can now be compared.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
areas kept during comparison, change 9ca9e0a
// Explicit creation of a default control area | ||
new CgmesExport().createDefaultControlAreaInterchange(network); | ||
|
||
// Check that exported files now have a control area definition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you actually check that the default control area is present in the iidm network (so before exporting)?
That would highlight the fact that the area isn't created during the export process (thus a CGMES export is not necessary to create the default area).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked, change fda0105
...cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportTest.java
Outdated
Show resolved
Hide resolved
network.write("CGMES", null, tmpDirWithCA.resolve(baseName)); | ||
Network networkWithCA = Network.read(new GenericReadOnlyDataSource(tmpDirWithCA, baseName)); | ||
assertEquals(1, networkWithCA.getAreaCount()); | ||
Area areaExported = networkWithCA.getAreas().iterator().next(); | ||
assertEquals(1, areaExported.getAreaBoundaryStream().count()); | ||
assertEquals(-50, areaExported.getInterchangeTarget().orElse(Double.NaN)); | ||
// No default value for tolerance | ||
assertNull(areaExported.getProperty(CgmesNames.P_TOLERANCE)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, I recommend to not export and reimport, but rather read the exported files:
network.write("CGMES", null, tmpDirWithCA.resolve(baseName)); | |
Network networkWithCA = Network.read(new GenericReadOnlyDataSource(tmpDirWithCA, baseName)); | |
assertEquals(1, networkWithCA.getAreaCount()); | |
Area areaExported = networkWithCA.getAreas().iterator().next(); | |
assertEquals(1, areaExported.getAreaBoundaryStream().count()); | |
assertEquals(-50, areaExported.getInterchangeTarget().orElse(Double.NaN)); | |
// No default value for tolerance | |
assertNull(areaExported.getProperty(CgmesNames.P_TOLERANCE)); | |
eqFile = ConversionUtil.writeCgmesProfile(network, "EQ", tmpDir); | |
String sshFile = ConversionUtil.writeCgmesProfile(network, "SSH", tmpDir); | |
assertTrue(eqFile.contains("<cim:ControlArea rdf:ID=\"_dangling-line_N_CA\">")); | |
assertTrue(sshFile.contains("<cim:ControlArea.netInterchange>-50</cim:ControlArea.netInterchange>")); | |
// No default value for tolerance | |
assertFalse(sshFile.contains("cim:ControlArea.pTolerance")); |
...cgmes-conversion/src/test/java/com/powsybl/cgmes/conversion/test/export/CgmesExportTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Co-authored-by: rcourtier <[email protected]> Signed-off-by: Luma <[email protected]>
Co-authored-by: rcourtier <[email protected]> Signed-off-by: Luma <[email protected]>
Signed-off-by: Luma <[email protected]>
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
What kind of change does this PR introduce?
Update
What is the current behavior?
Information from CGMES control areas is stored using an extension to the Network Model (
CgmesControlArea
).What is the new behavior (if this is a feature change)?
Information from CGMES control areas is stored using native IIDM objects of class
Area
.CGMES
pTolerance
attribute is stored as a property.The ENTSO-E attribute
IdentifiedObject.energyIdentCodeEic
is stored as an alias.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)
Previously, during export, if the
CgmesControlArea
extension was not present in the exported network, a new one was created and a control area representing the whole network was added to it, with the terminals of all dangling lines defined as its tie flows. As a result, the CGMES export always had a control area of type interchange.After this PR, no control area is automatically created during export. The export process itself will not add, remove or change the attributes of the objects in the IIDM model.
If the user wants to define a control area interchange based on the whole network, it can do it programmatically using the following line of code:
It is located in the
CgmesExport
exporter because the creation of a default area involves potential access to reference data (boundaries) and using some export parameters that the user may have already configured. The relevant data: the sourcing actor (that determines its region and the corresponding EIC code), the consideration of boundary nodes (and associated tie flows) as AC or DC. Also, the user can provide some of the parameters explicitly, if needed. As an example, including the final call to CGMES export:Other information: