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

Fix non linear shunt conversion performances issue #3218

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

rcourtier
Copy link
Member

@rcourtier rcourtier commented Nov 20, 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?

Fix performances issue.

What is the current behavior?

Query of cim:NonlinearShuntCompensatorPoint is slow as it is using a FILTER clause which isn't good performance wise.

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

Query and java code have been rewritten to convert nonLinearShuntCompensatorPoint without using the FILTER clause, thus improving the performances.

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)

Breaking change:
Interface CgmesModel has a new method that should be implemented if you have classes implementing this interface:

  • PropertyBags nonlinearShuntCompensatorPoints()

Other information:

Time of CGMES import of activsg70k grid has been reduced by 25%.

@rcourtier rcourtier force-pushed the fix_shunt_conversion_performances_issue branch 2 times, most recently from e04b8a0 to c78b224 Compare November 20, 2024 15:39
@rcourtier rcourtier marked this pull request as ready for review November 20, 2024 15:58
@rcourtier rcourtier self-assigned this Nov 20, 2024
@olperr1 olperr1 added Deprecated Methods have been deprecated Breaking Change API is broken and removed Breaking Change API is broken labels Nov 22, 2024
@rcourtier rcourtier force-pushed the fix_shunt_conversion_performances_issue branch from 864a514 to f8226eb Compare November 22, 2024 09:12
PropertyBags shuntCompensatorPoints();

// Non-linear shunt compensator points grouped by shunt compensator
Map<String, PropertyBags> groupedShuntCompensatorPoints();
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this method should be exposed in the API instead of the old nonlinearShuntCompensatorPoints(String id) method.
When we look at the usage, the new method is always called to retrieve the data for a single id and it is not trivial to refactor the code to call the method only once for all the IDs.
So I think this method is more an implementation detail of CgmesModelTripleStore.

Note that using the new method also introduces breaking changes that are not really needed.

Copy link
Member

@zamarrenolm zamarrenolm Nov 22, 2024

Choose a reason for hiding this comment

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

Providing this method makes the API of the CGMES model consistent with other cached data, like grouped transformer ends. The only implementation of the CGMES model is the one based in the triple store (apart from the fake one used in some unit tests).

Copy link
Member Author

@rcourtier rcourtier Nov 25, 2024

Choose a reason for hiding this comment

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

I'll refactor the other methods to have a consistent behaviour:
Provide in the API (CgmesModel) the methods:

  • PropertyBags xxx() that should return all data (e.g. returns all PowerTransformerEnd)
  • PropertyBags xxx(String commonObjectId) that should return the data for a specific commonObjectId (e.g. returns the PowerTransformerEnd for a specific PowerTransformer id)

In the implementation (AbstractCgmesModel) have the same methods where:

  • PropertyBags xxx() runs the query
  • PropertyBags xxx(String commonObjectId) that:
    • If called for the 1st time runs the full query, builds a Map and caches it
    • Returns the PropertyBags associated to commonObjectId from the cached Map

Copy link
Member

Choose a reason for hiding this comment

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

Seen with @rcourtier:

  • The nonlinearShuntCompensatorPoints(String id) was restored and groupedShuntCompensatorPoints() is no more exposed in the CgmesModel interface.
  • A general refactoring of CgmesModel, providing more consistency, will be done in another PR.

@rcourtier rcourtier removed the Deprecated Methods have been deprecated label Nov 25, 2024
@rcourtier rcourtier requested a review from olperr1 November 25, 2024 09:42
…LinearShuntCompensator in order to improve performances

Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
Signed-off-by: Romain Courtier <romain.courtier@rte-france.com>
@rcourtier rcourtier force-pushed the fix_shunt_conversion_performances_issue branch from a1b2997 to 881e15c Compare November 29, 2024 09:46
@olperr1 olperr1 merged commit dab6fc8 into main Nov 29, 2024
7 checks passed
@olperr1 olperr1 deleted the fix_shunt_conversion_performances_issue branch November 29, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants