-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
…o tap changers. Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
src/main/java/com/powsybl/openloadflow/sensi/AcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
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>
src/main/java/com/powsybl/openloadflow/ac/equations/AcEquationSystemUpdater.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/AbstractSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
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.
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 |
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.
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.
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.
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?
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.
No no I think it's perfectly OK to compute sensitivities after the rounding.
What I mean is that:
- if you run a simple loadflow with voltage control disabled, you will get voltage values without tap changes, OK
- 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 ?).
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.
Yes I can do that.
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.
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()) { |
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.
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 ?
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.
I will add a test but it will be similar to the generator behaviour.
@@ -347,6 +346,41 @@ void testBusVoltagePerTargetV() { | |||
@Test | |||
void testBusVoltagePerTargetVTwt() { |
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.
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); |
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.
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).
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.
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>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Kudos, SonarCloud Quality Gate passed! |
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the restWe 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:
So it could be improved.
Does this PR introduce a breaking change or deprecate an API? If yes, check the following:
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)