-
Notifications
You must be signed in to change notification settings - Fork 43
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
Adder by copy for lines #3208
base: main
Are you sure you want to change the base?
Adder by copy for lines #3208
Conversation
Signed-off-by: Naledi EL CHEIKH <[email protected]>
…while copy of line Signed-off-by: Naledi EL CHEIKH <[email protected]>
iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/LineAdderImpl.java
Outdated
Show resolved
Hide resolved
… and tests Signed-off-by: Naledi EL CHEIKH <[email protected]>
… and tests Signed-off-by: Naledi EL CHEIKH <[email protected]>
Signed-off-by: Naledi EL CHEIKH <[email protected]>
Signed-off-by: Naledi EL CHEIKH <[email protected]>
Signed-off-by: Naledi EL CHEIKH <[email protected]>
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Branch.java
Outdated
Show resolved
Hide resolved
iidm/iidm-api/src/main/java/com/powsybl/iidm/network/util/LoadingLimitsUtil.java
Outdated
Show resolved
Hide resolved
iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/SubnetworkImpl.java
Outdated
Show resolved
Hide resolved
iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractCurrentLimitsTest.java
Outdated
Show resolved
Hide resolved
iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractIdenticalLinesTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Naledi EL CHEIKH <[email protected]>
Signed-off-by: Naledi EL CHEIKH <[email protected]>
return newLine(null, line).setR(line.getR()) | ||
.setX(line.getX()) | ||
.setG1(line.getG1()) | ||
.setG2(line.getG2()) | ||
.setB1(line.getB1()) | ||
.setB2(line.getB2()) | ||
.setVoltageLevel1(line.getTerminal1().getVoltageLevel().getId()) | ||
.setVoltageLevel2(line.getTerminal2().getVoltageLevel().getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setters should be called in the adder's constructor (or in a utility method, but called in the constructor).
In the current state, these variables are not set when newLine(Line)
is called from a subnetwork.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BranchUtil
is in the iidm-impl
module here. I think it would be better to have this method in the iidm-api
module, so it could be reused by custom IIDM implementations (such as powsybl-network-store).
I think you can define it as a static method directly in LineAdder
.
Another think. It would be better to call it in LineAdderImpl(NetworkImpl network, String subnetwork, Line copiedLine)
. It would be counterintuitive that this method initializes the limits, but not the line attributes.
Signed-off-by: Naledi EL CHEIKH <[email protected]>
Quality Gate passedIssues Measures |
Could you also add a test with a line in a subnetwork? |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
It allows the lines to be initialized from another already existing one.
What is the current behavior?
Lines are not allowed to be duplicated.
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Custom IIDM implementation maintainers should add the following method in their
Network
implementations:LineAdder newLine(Line line)
.Other information: