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 discrete voltage control #413

Merged
merged 44 commits into from
Jan 12, 2022
Merged

Conversation

geofjamg
Copy link
Member

@geofjamg geofjamg commented Jan 5, 2022

Signed-off-by: Geoffroy Jamgotchian geoffroy.jamgotchian@gmail.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
No

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Refactoring

What is the current behavior? (You can also link to an open issue here)
To change a discrete voltage control mode, we need to remove and re-create equations

What is the new behavior (if this is a feature change)?
We only need to active/deactivate some equations

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

  • 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:

(if any of the questions/checkboxes don't apply, please delete them entirely)

geofjamg and others added 17 commits November 8, 2021 09:34
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
# Conflicts:
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystem.java
#	src/main/java/com/powsybl/openloadflow/network/AbstractElement.java
#	src/main/java/com/powsybl/openloadflow/network/AbstractLfNetworkListener.java
#	src/main/java/com/powsybl/openloadflow/network/LfNetworkListener.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
# Conflicts:
#	src/main/java/com/powsybl/openloadflow/ac/TransformerVoltageControlOuterLoop.java
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystem.java
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemUpdater.java
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationType.java
#	src/main/java/com/powsybl/openloadflow/network/impl/AbstractLfBus.java
#	src/test/java/com/powsybl/openloadflow/equations/EquationSystemTest.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg requested a review from annetill January 5, 2022 21:49
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg changed the title [WIP] Refactor discrete voltage control Refactor discrete voltage control Jan 5, 2022
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
LfBranch controllerBranch = controllerBranches.get(i);

// activate all rho1 equations if voltage control is off
equationSystem.getEquation(controllerBranch.getNum(), AcEquationType.BRANCH_TARGET_RHO1)
Copy link
Member

Choose a reason for hiding this comment

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

Just to be sure that I understand well: here, later, I will have to take into account the local status of the branch controller, especially if the transformer is at its limits? But for now, we only use the status of the controlled bus.
In my previous tests, I have met a contingency that makes me lost one of the controller branches. This is supported by that PR ?

@geofjamg geofjamg changed the title Refactor discrete voltage control [WIP] Refactor discrete voltage control Jan 6, 2022
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@@ -755,4 +755,66 @@ void testSAmodeACAllBranchMonitoredFlowTransfer() {
assertEquals(1.66, brl14l13.getP1(), 1e-2);
assertEquals(0.66, brl14l13.getFlowTransfer(), 1e-2);
}

@Test
void testSAWithRemoteSharedControl() {
Copy link
Member

Choose a reason for hiding this comment

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

This is not working, look at the logs.

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed it. We now have to unit test post contingency reactive power using monitors.

@Test
void testSAWithTransformerRemoteSharedControl() {
// FIXME
Network network = VoltageControlNetworkFactory.createWithTransformerSharedRemoteControl();
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure that it is working because in post contingency, we have no transformer voltage control at all. It is totally removed.

geofjamg and others added 4 commits January 6, 2022 21:47
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
geofjamg and others added 4 commits January 6, 2022 22:18
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
// post-contingency tests
PostContingencyResult postContingencyResult = result.getPostContingencyResults().stream().filter(r -> r.getContingency().getId().equals("T2wT")).findFirst().get();
assertEquals("T2wT", postContingencyResult.getContingency().getId());
assertEquals(0.0, postContingencyResult.getBranchResult("T2wT2").getQ2(), 1e-2); // FIXME
Copy link
Member

Choose a reason for hiding this comment

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

I have tried to solve it before #316

geofjamg and others added 10 commits January 10, 2022 10:56
# Conflicts:
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystem.java
#	src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemUpdater.java
#	src/main/java/com/powsybl/openloadflow/network/VoltageControl.java
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
}

@Test
void testSAWithShuntRemoteSharedControl() {
Copy link
Member

Choose a reason for hiding this comment

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

@geofjamg here I don't understand the post contingency value at transformer tr3. Furthermore, if simul shunt is at false, I have a KLU issue...

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't have the KLU issue on my side

annetill and others added 4 commits January 11, 2022 19:48
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
@geofjamg geofjamg changed the title [WIP] Refactor discrete voltage control Refactor discrete voltage control Jan 12, 2022
@geofjamg
Copy link
Member Author

geofjamg commented Jan 12, 2022

@annetill there is a lot remaining issues with transformer voltage control in SA, but maybe we could just merge this PR as it is (which is far better that main branch) and improve with new PRs? (The initial goal of this PR was just to avoid removing equations)

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
}

@Test
void testSaWithTransformerRemoteSharedControl() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe we should remove the "remote" word as it does not make sense for transformer voltage control?

Copy link
Member

Choose a reason for hiding this comment

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

Why? It is a remote control...

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

LoadFlowParameters lfParameters = new LoadFlowParameters()
.setTransformerVoltageControlOn(true);

List<Contingency> contingencies = allBranches(network);
Copy link
Member Author

Choose a reason for hiding this comment

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

When we change this line to only simulate T2wT2 contingency, we don't have same result, which probably means we don't restore state correctly after contingencies

Copy link
Member

Choose a reason for hiding this comment

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

We should keep this as an issue that will be resolved in a dedicate PR.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in this PR, see last commit.

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

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

89.3% 89.3% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg merged commit 1fc9e92 into main Jan 12, 2022
@geofjamg geofjamg deleted the refactor_discrete_voltage_control branch January 12, 2022 12:26
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