Skip to content
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 metadata models extension #2898

Merged
merged 30 commits into from
Mar 26, 2024
Merged

CGMES metadata models extension #2898

merged 30 commits into from
Mar 26, 2024

Conversation

zamarrenolm
Copy link
Member

@zamarrenolm zamarrenolm commented Feb 13, 2024

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?

What kind of change does this PR introduce?

Feature + bug because of dependencies management during export.

What is the current behavior?

Multiple extensions to keep CGMES metadata:

  • cgmesSshMetadata
  • cgmesSvMetedata

What is the new behavior (if this is a feature change)?
CGMES metadata is kept in a single IIDM Network extension.

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

  • Yes
  • No

If yes, please check if the following requirements are fulfilled

  • The Breaking Change or Deprecated label has been added
  • The migration steps are described in the following section

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

Other information:

Bring to current development branch the initial work made in #2034

Signed-off-by: Luma <zamarrenolm@aia.es>
@zamarrenolm zamarrenolm self-assigned this Feb 13, 2024
Signed-off-by: Luma <zamarrenolm@aia.es>
@rcourtier rcourtier self-requested a review February 23, 2024 15:20
@flo-dup
Copy link
Contributor

flo-dup commented Mar 7, 2024

After discussing with @annetill, the backward compatibility for extensions CgmesSshMetadata and CgmesSvMetedata does not need to be addressed. It seems that there's no usecase which needed to keep iidm files with those extensions (see slack question in the #powsybl channel). You can thus delete these extensions and their SerDe. If a (strong) need is expressed later, we'll deal with it with a corrective release.

…sion for storing metadata

Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
@zamarrenolm zamarrenolm marked this pull request as ready for review March 8, 2024 02:29
@zamarrenolm
Copy link
Member Author

To support the use-case of CGM export we need to be able to build an SV model with "dependent on" references to its IGM updated SSH models and also to the original IGM TP models.

In a CGM IIDM Network we have each IGM as a Subnetwork.

When a user wants to make a CGM export, first he has to export the SSH of each Subnetwork, then he has to export the SV at the Network level.

To keep the required information in the extension (the data about the exported SSH), we plan to update the extension every time an export is made. To avoid the extension growing indefinitely, we will only keep the last model for each part and modelling authority.

@zamarrenolm zamarrenolm marked this pull request as draft March 11, 2024 08:15
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
@zamarrenolm
Copy link
Member Author

After an internal discussion we prefer not to use the metadata extension to store results of export.

Instead, to support the use case of CGM SSH, SV export, we will use an export context.

@zamarrenolm zamarrenolm marked this pull request as ready for review March 12, 2024 14:03
@zamarrenolm zamarrenolm marked this pull request as draft March 13, 2024 14:18
@@ -257,6 +257,11 @@ public PropertyBags fullModel(String cgmesProfile) {
return namedQuery("fullModel", cgmesProfile);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it has been removed in the last commit

@annetill annetill marked this pull request as ready for review March 14, 2024 15:29
public PropertyBags fullModel(String cgmesProfile) {
return new PropertyBags();
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you not implement the fullModels method here? I am not sure how these classes are used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was used to obtain the CGMES metadata model for a specific part. Now we want to make a single query to the CGMES database to obtain all the metadata models. We do not need anymore the method fullModel(String cgmesProfile). We have replaced it by fullModels().

@@ -28,6 +28,37 @@ SELECT *
OPTIONAL { ?FullModel md:Model.description ?description }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the fullModel query should be removed too no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is not used anymore. I have removed it.

@@ -0,0 +1,128 @@
/**
* Copyright (c) 2022, RTE (http://www.rte-france.com)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it not be 2024? The identifier is missing too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed.

Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Luma <zamarrenolm@aia.es>
<xs:element name="cgmesMetadataModels">
<xs:complexType>
<xs:sequence>
<xs:element name="model" type="cmm:Model" maxOccurs="unbounded"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a unbounded list of elements with a part enum, it would be clearer to restrict to 4 optional named elements (SV / SSH / TP / EQ).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the extension to be generic enough to store metadata for other parts. The complete list is defined in CgmesSubset. What do you think about defining the part as a simple enum type with the proper values? (like the Side in the branch observability IIDM extension)

EQUIPMENT
TOPOLOGY
STATE_VARIABLES
STEADY_STATE_HYPOTHESIS
DYNAMIC
DIAGRAM_LAYOUT
GEOGRAPHICAL_LOCATION
EQUIPMENT_BOUNDARY
TOPOLOGY_BOUNDARY
UNKNOWN

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are storing in the extension only the information about the models that have been read during the import of the network. We could limit it even more, and store only some of the models we have read.
I think that having a limited list of named elements instead of a property would make future modifications more difficult. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I wasn't aware there are more! Ok to keep the list with a part enum then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And about defining the part as a simple enum type in the xsd, it's a good idea yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the part is now an enum in the xsd

Copy link
Member

@rolnico rolnico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the other comment, could you also add some javadoc? At least to the public methods that have been modified

Comment on lines +64 to +67
private final CgmesMetadataModel exportedEQModel = new CgmesMetadataModel(CgmesSubset.EQUIPMENT, DEFAULT_MODELING_AUTHORITY_SET_VALUE);
private final CgmesMetadataModel exportedTPModel = new CgmesMetadataModel(CgmesSubset.TOPOLOGY, DEFAULT_MODELING_AUTHORITY_SET_VALUE);
private final CgmesMetadataModel exportedSVModel = new CgmesMetadataModel(CgmesSubset.STATE_VARIABLES, DEFAULT_MODELING_AUTHORITY_SET_VALUE);
private final CgmesMetadataModel exportedSSHModel = new CgmesMetadataModel(CgmesSubset.STEADY_STATE_HYPOTHESIS, DEFAULT_MODELING_AUTHORITY_SET_VALUE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep those models hardcoded here? If another model is added, we'll have to add it here, add the corresponding methods (like getExportedEQModel()), etc.

Would it not be better to store them for example in a map, using the CgmesSubset enum as a key? It would allow to have only a getExporterModel(CgmesSubset cmgesSubset) method instead of one for each model.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the "models" attributes will be removed in #2927. I don't think that is necessary to refactor that part now.

Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Copy link
Member

@annetill annetill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice, thanks all!

Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Copy link

@rolnico
Copy link
Member

rolnico commented Mar 26, 2024

My comments will be covered by a future PR

@annetill annetill merged commit 8ef9e67 into main Mar 26, 2024
6 checks passed
@annetill annetill deleted the cgmes_metadata_models branch March 26, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants