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

Refactor voltage level topology implementation #3196

Merged
merged 3 commits into from
Nov 7, 2024
Merged

Conversation

geofjamg
Copy link
Member

@geofjamg geofjamg commented Nov 5, 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?

Refactoring

What is the current behavior?

The 2 topology models bus/breaker and node/breaker are implemented by 2 inherited classes from AbstractVoltageLevel.

What is the new behavior (if this is a feature change)?
A new TopologyModel concept has been added so that we only have one voltage level implementation class delegating every specific code to a topology model to a dedicated class.
Main advantages:

  • cleaner design promoting composition over weak inheritance.
  • for next devs, easy topology model convertion (switch from bus/breaker to node/breaker or inverse)

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:

Noticeable changes:

  • Abstract class AbstractVoltageLevel was replaced by non-abstract class VoltageLevelImpl.
  • BusBreakerVoltageLevel and NodeBreakerVoltageLevel were removed. Their topology management methods were respectively moved in new classes BusBreakerTopologyModel and NodeBreakerTopologyModel, implementing a new ModelTopology interface.
  • In the network index, voltage levels were mapped to either BusBreakerVoltageLevel.class or NodeBreakerVoltageLevel.class. They are now all mapped to VoltageLevelImpl.class.
  • The following methods from VoltageLevelExt were removed. These operations can be performed on the TopologyModel, accessible via voltageLevel.getTopologyModel():
    • attach(TerminalExt, boolean)
    • detach(TerminalExt)
    • connect(TerminalExt, Predicate<? super SwitchImpl>)
    • disconnect(TerminalExt, Predicate<? super SwitchImpl>)
    • invalidateCache()
    • invalidateCache(boolean)

Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@olperr1 olperr1 self-requested a review November 6, 2024 12:33
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
@geofjamg geofjamg requested a review from olperr1 November 7, 2024 08:11
Copy link

sonarqubecloud bot commented Nov 7, 2024

@olperr1 olperr1 merged commit dcb2338 into main Nov 7, 2024
7 checks passed
@olperr1 olperr1 deleted the topology_model branch November 7, 2024 09:17
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.

2 participants