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 shared voltage control modelling #408

Merged
merged 10 commits into from
Dec 30, 2021
Merged

Conversation

geofjamg
Copy link
Member

@geofjamg geofjamg commented Dec 26, 2021

Signed-off-by: Geoffroy Jamgotchian [email protected]

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)
Shared voltage control is modeled using one PQV bus at controlled bus and (Ngen - 1) reactive distribution equations at all controller buses except one. These equations allows to define reactive power distribution across all voltage controller buses.
The problem with such a modeling is that when one controller bus of the shared control switch PQ (reactive limit bound reached), as reactive power equations have been defined 2 by 2 using an arbitrary reference controller bus we have to remove all reactive power distribution equations and re-create all of them using potentially a new reference controller bus.
This is a heavy operation and it should be simpler if we can just active/deactivate some predefined equations. Furthermore for later performance optimization we will try to define alternative equations (i.e couple of equation that when one is activate the other is deactivate automatically and vice versa) so that we only have to update Jacobian matrix when a bus is switched PV/PQ ou PQ/PV and not fully rebuild it.

TODO: same for transformer voltage control has to be done in this PR

What is the new behavior (if this is a feature change)?
We only need to deactivate/activate right predefined equations when switch a PV to PQ or PQ to PV bus. There is no more equation removal.

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)

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@geofjamg geofjamg changed the title Refactor shared control modelling [WIP] Refactor shared control modelling Dec 26, 2021
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@geofjamg geofjamg changed the title [WIP] Refactor shared control modelling [WIP] Refactor shared voltage control modelling Dec 27, 2021
@geofjamg geofjamg requested a review from annetill December 27, 2021 21:51
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@@ -72,8 +65,7 @@ private static void createGeneratorControlEquations(LfBus bus, LfNetworkParamete
if (voltageControl.isVoltageControlLocal()) {
createLocalVoltageControlEquation(bus, networkParameters, equationSystem, creationParameters);
} else if (bus.isVoltageControlled()) {
// remote controlled: set voltage equation on this controlled bus
createVoltageControlledBusEquations(voltageControl, networkParameters, equationSystem, creationParameters);
createRemoteVoltageControlEquations(voltageControl, networkParameters, equationSystem, creationParameters);
Copy link
Member

Choose a reason for hiding this comment

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

If I remember well we have also a case where we create distribution equations for remote and local controllers. We fall in that second case. You can keep remote in the name of the method, but maybe I can add it in the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the code there is nothing specific to local controller even if it works with hybride remote/local controller. The only local mode is handled in the previous if.

@@ -152,4 +152,8 @@ default boolean isParticipating() {
* Find bus + parallel branches neighbors.
*/
Map<LfBus, List<LfBranch>> findNeighbors();

double getRemoteControlReactivePercent();
Copy link
Member

Choose a reason for hiding this comment

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

Can you add voltage in the name of the method because we also have shunt remote voltage control and reactive 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.

Done


// update bus reactive keys
double reactiveKeysSum = Arrays.stream(reactiveKeys).sum();
for (int i = 0; i < controllerBuses.size(); i++) {
Copy link
Member

Choose a reason for hiding this comment

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

How do you know here that the sum is never equal to zero after updating the keys?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it might happen, when all generators of the control, go PQ.
=> I added a check

Copy link
Member

@annetill annetill left a comment

Choose a reason for hiding this comment

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

Maybe just some changes/comments, but the idea is good and looks right. I have run the LF on all my real test cases (IOP, RGCE, matpower cases) and all is okay. But during my test on a TYNDP file, I fall in an exception Caused by: com.powsybl.commons.PowsyblException: Generators [_9064117a-2da4-46db-b1ee-f60810974a76, _ee520ab7-786a-499b-a3ae-d96fb5b12596] connected to bus '_55207717-1417-458c-9b5f-e67a3eedc46a_0' must control the voltage of the same bus. Can we do something for that and just log a warn or do we assume the exception? I don't remember this issue with this file indeed.

@geofjamg
Copy link
Member Author

Do you also have it on main branch?

@annetill
Copy link
Member

Do you also have it on main branch?

Yes. I have planned to work on stand by automaton of SVC tonight and tomorrow. And I think it will be better to have this PR merged before... even if it means a new rebase for the PR of shunt voltage control ! Do you think it is possible?

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@geofjamg
Copy link
Member Author

Maybe just some changes/comments, but the idea is good and looks right. I have run the LF on all my real test cases (IOP, RGCE, matpower cases) and all is okay. But during my test on a TYNDP file, I fall in an exception Caused by: com.powsybl.commons.PowsyblException: Generators [_9064117a-2da4-46db-b1ee-f60810974a76, _ee520ab7-786a-499b-a3ae-d96fb5b12596] connected to bus '_55207717-1417-458c-9b5f-e67a3eedc46a_0' must control the voltage of the same bus. Can we do something for that and just log a warn or do we assume the exception? I don't remember this issue with this file indeed.

This is manageable but we have probably to rethink our controller modeling. A controller bus is supposed in our design, to be part of only one voltage control (only one voltageController attribute in AbstractLfBus for instance). So there is quite a lot of rework to support it. Let's create an issue and do it in another PR?

What I do not understand is how we didn't had this case before. Is it something new in our test cases? Or do we just not skip it before?

@geofjamg
Copy link
Member Author

Do you also have it on main branch?

Yes. I have planned to work on stand by automaton of SVC tonight and tomorrow. And I think it will be better to have this PR merged before... even if it means a new rebase for the PR of shunt voltage control ! Do you think it is possible?

I'm not 100% confident with this PR. Is it really linked to SVC devs? Maybe you could just start from this branch to easily rebase when merged.

Signed-off-by: Geoffroy Jamgotchian <[email protected]>
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
@sonarqubecloud
Copy link

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

94.7% 94.7% Coverage
0.0% 0.0% Duplication

@geofjamg geofjamg changed the title [WIP] Refactor shared voltage control modelling Refactor shared voltage control modelling Dec 29, 2021
@geofjamg
Copy link
Member Author

Do you also have it on main branch?

Yes. I have planned to work on stand by automaton of SVC tonight and tomorrow. And I think it will be better to have this PR merged before... even if it means a new rebase for the PR of shunt voltage control ! Do you think it is possible?

I'm not 100% confident with this PR. Is it really linked to SVC devs? Maybe you could just start from this branch to easily rebase when merged.

Looks good in fact.

@geofjamg geofjamg requested a review from annetill December 29, 2021 21:38
Copy link
Member

@annetill annetill left a comment

Choose a reason for hiding this comment

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

It looks good indeed. Do you want me to run all the tests again?

@geofjamg
Copy link
Member Author

It looks good indeed. Do you want me to run all the tests again?

If you already did it, no.

@annetill annetill merged commit 5dbd806 into main Dec 30, 2021
@annetill annetill deleted the refactor_shared_control_2 branch December 30, 2021 08:46
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