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

Support of BusVoltagePerTargetV relalted to a transformer #299

Merged
merged 10 commits into from
Jun 3, 2021

Conversation

annetill
Copy link
Member

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

We don't support it.

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

We support it.

What is the current behavior? (You can also link to an open issue here)

We through an exception.

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

We support it. We first compute the reference voltages like in a classical load flow with the transformer control outer loop active. Then we have to rebuild the equation system, as it was before the transformer steps were rounded and the PV buses deactivated. From that equation system, we compute the sensitivity values.

But:

  • The equation system is not updated, but rebuild from scratch ;
  • I don't use the equation system listener.
    So it could be improved.

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)

…o tap changers.

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@annetill annetill requested a review from flo-dup April 29, 2021 15:06
@geofjamg geofjamg self-requested a review May 17, 2021 20:40
annetill added 3 commits May 28, 2021 11:34
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@annetill annetill requested a review from sylvlecl May 28, 2021 11:58
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Copy link
Contributor

@sylvlecl sylvlecl left a comment

Choose a reason for hiding this comment

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

Nice!
I think we need to add some test/handling for post contingencies sensitivities though.

@@ -180,6 +180,12 @@ public void analyse(Network network, List<PropagatedContingency> contingencies,
.collect(Collectors.toSet());

// create AC engine
boolean hasTransformerBusTargetVoltage = hasTransformerBusTargetVoltage(factorHolder, network);
if (hasTransformerBusTargetVoltage) {
// if we have at least one bus target voltage linked to a ratio tap changer, we activate the transformer
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should do the opposite, I mean compute the sensitivities ONLY if voltage control has been turned on.

Otherwise, the behaviour can be weird, because taps will be changed whereas we did not explicitly ask them to, we only asked to compute sensitivities. The resulting voltages will be different from a loadflow with the same parameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

So you think that the user should give a bus target voltage related to a transformer AND explicitly says that transformer control is enabled?
What I don't get in your point is: what is for you the starting point to compute sensitivity values? In AC, it is quite important. In the code, the starting point is after transformer rounding. You prefer having both modes: after the rounding if we have the control enabled in the parameters or just from the initial network?

Copy link
Contributor

Choose a reason for hiding this comment

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

No no I think it's perfectly OK to compute sensitivities after the rounding.

What I mean is that:

  1. if you run a simple loadflow with voltage control disabled, you will get voltage values without tap changes, OK
  2. if you run a sensitivity analysis with the same parameters (=voltage control disabled), now you will get different values for voltages (and sensitivities around those different values), because taps will have moved

I think it's weird, if you run the computation with the same parameters, I would expect to obtain the same voltage values.
If voltage control is disabled, I think I would expect to have 0 as sensitivity value (if we do this, maybe we could add a WARN log ?).

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 I can do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Second thought: for sensitivity calculation linked to a phase shifter, we don’t use the loadflow parameters. We can compute the sensitivity even if the regulation is not active. So it is still coherent to rely on the loadflow parameter on our use case, I think yes but what is our opinion?

// if we have at least one bus target voltage linked to a ratio tap changer, we have to rebuild the AC equation
// system obtained just before the transformer steps rounding.
if (hasTransformerBusTargetVoltage) {
for (LfBus bus : lfNetwork.getBuses()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure how it will behave on contingencies :
I guess the mode will be turned OFF again ? so maybe it does not work for the post contingency sensitivities ?

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 will add a test but it will be similar to the generator behaviour.

@@ -347,6 +346,41 @@ void testBusVoltagePerTargetV() {
@Test
void testBusVoltagePerTargetVTwt() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :)
I think we should add a test with a contingency

assertEquals(4, result.getSensitivityValues().size());
assertEquals(0d, getValue(result, "T2wT", "BUS_1"), LoadFlowAssert.DELTA_V);
assertEquals(0.035205d, getValue(result, "T2wT", "BUS_2"), LoadFlowAssert.DELTA_V);
assertEquals(1d, getValue(result, "T2wT", "BUS_3"), LoadFlowAssert.DELTA_V);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a thought:
I had a doubt (not obvious when reading the code), that sensitivities are correctly "scaled back" from per-unit.
Finally it seems correct, but it looks like the logic is handled directly in the equation we solve for computing the sensitivity : I think at some point we should make more clear where is the limit between per-united values and "nominal" values (probably having a kind of conversion after having computed the sensitivities in per-unit).

Copy link
Member Author

Choose a reason for hiding this comment

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

It is done in calculateSensitivityValues but it is not well done for BUS_VOLTAGE and I have some doubt about sensi += Math.toRadians(factor.getEquationTerm().der(phi1Var)); line but no link with that PR :-)

Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
annetill and others added 2 commits June 3, 2021 15:09
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 3, 2021

Kudos, SonarCloud Quality Gate passed!

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

97.0% 97.0% Coverage
0.0% 0.0% Duplication

@annetill annetill merged commit 6f7a2d1 into master Jun 3, 2021
@annetill annetill deleted the sensi_v_tap_changer_2 branch June 3, 2021 13:44
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.

4 participants