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 export] UUID of fullModel on each file should be unique #2888

Merged
merged 11 commits into from
Feb 6, 2024

Conversation

colinepiloquet
Copy link
Member

@colinepiloquet colinepiloquet commented Feb 2, 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?

No

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When introducing the naming strategy for CGMES export, the creation of the FullModel UUIDs of each file (EQ, TP, SSH, SV) was changed to be persistent. They are always the same and based on the type of file.

What is the new behavior (if this is a feature change)?
The creation of this UUID is now back as before so that we get a unique ID for each export for each file.

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

  • Yes
  • No

@zamarrenolm
Copy link
Member

zamarrenolm commented Feb 5, 2024

The network was passed to the writeHeader method to provide a unique id based on the network id itself, the instance file profile, and the fact that the ID was made for "FullModel" output:

 modelId = "urn:uuid:" + context.getNamingStrategy().getCgmesId(refTyped(network), ref(subset), Part.FULL_MODEL);

The call to refTyped(network) was intended to return a unique ID based on the network id PLUS the network object type, in this case "Network", suffixed as "_N".

If we want stable IDs for network models and instance files we must keep the existing way.

if we need to export revisions of the same network model / instance files we could use the version attribute of the FullModel.

// The ref to build a unique model id must contain:
// the network, the subset (EQ, SSH, SV, ...), and the FULL_MODEL part
// If we use name-based UUIDs this ensures that the UUID for the model will be specific enough
CgmesObjectReference[] modelRef = {refTyped(network), ref(subset), Part.FULL_MODEL};
Copy link
Member

Choose a reason for hiding this comment

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

This is not enough to have a unique id for several time step and different model version (when we re-import model after fixes):

  • We need the case date somwhere ;
  • We need the model version.
    Where are these informations to generate a unique id?

Copy link
Member

Choose a reason for hiding this comment

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

If the full model identifier has to be dependent on the scenarioTime and the version, we can pass these references to the naming strategy, instead of building new random identifiers for every export.

Copy link
Member

Choose a reason for hiding this comment

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

Both attributes are available in the method that is building the identifier for the full model object.

Copy link
Member

Choose a reason for hiding this comment

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

We could just add items to the list of object references that will be used as a seed for stable identifiers in the naming strategy:

        CgmesObjectReference[] modelRef = {
                refTyped(network),
                ref(subset),
                ref(DATE_TIME_FORMATTER.format(context.getScenarioTime())),
                ref(format(modelDescription.getVersion())),
                Part.FULL_MODEL};
        String modelId = "urn:uuid:" + context.getNamingStrategy().getCgmesId(modelRef);

Copy link
Member

Choose a reason for hiding this comment

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

Business processes involving CGMES exports typically will require the exchanged data to be unique by:

  • Effective date time (or scenario time).
  • Business process (market, operation, ...).
  • Sourcing actor (who is producing the file).
  • Model part (our CGMES subset).
  • Version of the file (sequential, as an integer).

If we consider that the IIDM network id includes information about the sourcing actor (is different for each sourcing actor), then with the lines above we would be covering the requirement for unique identifiers, with the exception of business process: we would be generating the same ID for all business processess.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will open a new PR with the introduction of a parameter for the business process.

Copy link
Member Author

Choose a reason for hiding this comment

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

However, we do not use the sourcing actor really no? I am not sure that it is necessary

Copy link
Member

Choose a reason for hiding this comment

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

for the purpose of generating unique model ids, I think we can rely on the IIDM network identifier to give different results for different sourcing actors; no need to explicitly use an additional reference to a sourcing actor

zamarrenolm and others added 5 commits February 5, 2024 16:05
Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
This reverts commit 7cbce1d.

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
…e FullModel UUID

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
colinepiloquet and others added 3 commits February 5, 2024 16:11
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Signed-off-by: Luma <zamarrenolm@aia.es>
Copy link

sonarcloud bot commented Feb 6, 2024

@zamarrenolm zamarrenolm merged commit a22b33e into main Feb 6, 2024
6 checks passed
@zamarrenolm zamarrenolm deleted the fix_fullmodel_uuid_cgmes branch February 6, 2024 16:09
olperr1 pushed a commit that referenced this pull request Feb 15, 2024
* CGMES post-processor to remove grounds (#2877)

Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* UUID of fullModel should be unique

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* Revert "UUID of fullModel should be unique"

This reverts commit 7cbce1d.

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* Add scenario time and version in CgmesObjectReference used to generate FullModel UUID

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* [Shortcircuit API] Fix javadoc (#2887)

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* Fix checkstyle

Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>

* unit test

Signed-off-by: Luma <zamarrenolm@aia.es>

* fix sonar issue

Signed-off-by: Luma <zamarrenolm@aia.es>

---------

Signed-off-by: Luma <zamarrenolm@aia.es>
Signed-off-by: Coline PILOQUET <coline.piloquet@rte-france.com>
Co-authored-by: Luma <zamarrenolm@aia.es>
(cherry picked from commit a22b33e)
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.

3 participants