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

First try at creating builders from existing object #1793

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

miovd
Copy link
Contributor

@miovd miovd commented Jul 16, 2021

Signed-off-by: RALAMBOTIANA MIORA miora.ralambotiana@rte-france.com

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • 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 ? If so, link to this issue using '#XXX' and skip the rest

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature: create components from existing components (e.g. a new generator initialized with all the values of an existing generator)

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
No

Other information:

Documentation not complete: adders for partial contained objects must be documented (if everyone agrees)

…t implementation, not in merging view)

Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: RALAMBOTIANA MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd requested review from annetill and mathbagu July 26, 2021 09:04
@sonarcloud
Copy link

sonarcloud bot commented Jul 26, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

89.8% 89.8% Coverage
0.0% 0.0% Duplication

@miovd miovd marked this pull request as ready for review July 26, 2021 09:12
@geofjamg
Copy link
Member

Nice feature!

Maybe we should be more clear about what is copied from the reference element and what is not.
For instance, with lines I think that we could also copy the voltageLevelId1 and voltageLevelId2 so the only thing that would need to be specified would be the node1 and node2, because this is the only builder parameter that have to be unique.

So

l2 = n.newLine(l1)
  .setId("l2")
  .setNode1(3)
  .setNode(4)
  .add();

Would create a l2 which is exactly like l2 (in parallel) but with a different connection point.

In case of bus/breaker this is different, it is allowed to have multiple elements connected to same bus so we would only need to specify a new id.

l2 = n.newLine(l1)
 .setId("l2")
 .add();

@miovd miovd changed the title First try at creating builders from existing object [WIP] First try at creating builders from existing object Aug 26, 2021
@miovd miovd closed this Sep 10, 2021
@miovd miovd reopened this Sep 10, 2021
@miovd miovd removed the request for review from mathbagu May 12, 2022 08:56
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>

# Conflicts:
#	iidm/iidm-api/src/main/java/com/powsybl/iidm/network/VoltageLevel.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/AbstractVoltageLevel.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NetworkImpl.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/ThreeWindingsTransformerAdderImpl.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/TwoWindingsTransformerAdderImpl.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/VoltageLevelAdderImpl.java
#	iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/VscConverterStationAdderImpl.java
#	iidm/iidm-mergingview/src/test/java/com/powsybl/iidm/mergingview/BatteryAdapterTest.java
#	iidm/iidm-mergingview/src/test/java/com/powsybl/iidm/mergingview/TwoWindingsTransformerAdapterTest.java
#	iidm/iidm-mergingview/src/test/java/com/powsybl/iidm/mergingview/VscConverterStationAdapterTest.java
#	iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractGeneratorTest.java
#	iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractLineTest.java
#	iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractThreeWindingsTransformerTest.java
#	iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractTwoWindingsTransformerTest.java
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd changed the title [WIP] First try at creating builders from existing object First try at creating builders from existing object Oct 5, 2022
@sonarcloud
Copy link

sonarcloud bot commented Oct 5, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

72.5% 72.5% Coverage
0.0% 0.0% Duplication

@miovd
Copy link
Contributor Author

miovd commented Oct 11, 2022

Nice feature!

Maybe we should be more clear about what is copied from the reference element and what is not. For instance, with lines I think that we could also copy the voltageLevelId1 and voltageLevelId2 so the only thing that would need to be specified would be the node1 and node2, because this is the only builder parameter that have to be unique.

So

l2 = n.newLine(l1)
  .setId("l2")
  .setNode1(3)
  .setNode(4)
  .add();

Would create a l2 which is exactly like l2 (in parallel) but with a different connection point.

In case of bus/breaker this is different, it is allowed to have multiple elements connected to same bus so we would only need to specify a new id.

l2 = n.newLine(l1)
 .setId("l2")
 .add();

I have modified the PR for the builder to copy everything in any case from the existing object (which would be what a user expects). No field is left blank, the user has to rewrite the ones they need/want to define.

@bc-rte bc-rte mentioned this pull request Sep 4, 2024
7 tasks
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.

2 participants