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 default model factory #311

Merged
merged 17 commits into from
Dec 13, 2023
Merged

Refactor default model factory #311

merged 17 commits into from
Dec 13, 2023

Conversation

Lisrte
Copy link
Contributor

@Lisrte Lisrte commented Nov 20, 2023

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?

Refactor

What is the current behavior?

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

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

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)

Other information:

Use the default model factory for EquipmentConnectionPoint
Use MacroConnectionsAdder instead of AbstractBlackBoxModel methods for macro connections creation

Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: Lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
@Lisrte Lisrte marked this pull request as draft November 21, 2023 12:49
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
Signed-off-by: Lisrte <laurent.issertial@rte-france.com>
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
@Lisrte Lisrte marked this pull request as ready for review November 24, 2023 10:40
Signed-off-by: lisrte <laurent.issertial@rte-france.com>
@flo-dup flo-dup enabled auto-merge (squash) December 11, 2023 10:24
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Copy link
Contributor

@flo-dup flo-dup left a comment

Choose a reason for hiding this comment

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

Nice refactor! just a few comments


private static final String EVENT_PREFIX = "Disconnect_";
private static final String DYNAMIC_MODEL_LIB = "EventSetPointBoolean";
private static final String DEFAULT_MODEL_LIB = "EventConnectedStatus";
protected static final String DISCONNECTION_VAR_CONNECT = "event_state1";

private final boolean disconnect;
private final LateInitField<Boolean> equipmentHasDynamicModel = new LateInitField<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why didn't you use a Boolean? Maybe I'm missing something, but I don't see what LateInitField has more

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so you want to emphasize the late initialized fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed LateInitField so that it is final.

*/
public interface ContextDependentEvent {

Identifiable<?> getEquipment();
Copy link
Contributor

Choose a reason for hiding this comment

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

just realizing we could put getEquipment in Event also.
Shouldn't we put it in Event and extends Event here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ko, EventModel is not in powsybl-dynawo. We might want to add getEquipment in powsybl-dynamic-simulation API

Comment on lines 80 to 83
@Override
public Bus getConnectesBus() {
return BusUtils.getConnectableBus(equipment);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We could put this in AbstractEquipmentBlackBoxModel don't 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.

Ko, equipment is an Identifiable there, not a Injection

Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Copy link

sonarcloud bot commented Dec 13, 2023

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
91.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@flo-dup flo-dup merged commit c96f529 into main Dec 13, 2023
6 checks passed
@flo-dup flo-dup deleted the refactor_default_model_factory branch December 13, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants