-
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
Network update: wrong load Q0 when loadPowerFactorConstant is true and P0 equals zero #798
Conversation
Signed-off-by: Caio Luke <caio.luke@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@@ -97,7 +97,7 @@ void updateState(double diffLoadTargetP, boolean loadPowerFactorConstant) { | |||
for (int i = 0; i < loadsRefs.size(); i++) { | |||
Load load = loadsRefs.get(i).get(); | |||
double updatedP0 = (load.getP0() / PerUnit.SB + diffLoadTargetP * participationFactors[i]) * PerUnit.SB; | |||
double updatedQ0 = loadPowerFactorConstant ? getPowerFactor(load) * updatedP0 : load.getQ0(); | |||
double updatedQ0 = loadPowerFactorConstant && updatedP0 != 0.0 ? getPowerFactor(load) * updatedP0 : load.getQ0(); |
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 it is more consistent to have :
double updatedQ0 = loadPowerFactorConstant ? (load.getQ0() / PerUnit.SB + diffLoadTargetP * getPowerFactor(load) * participationFactors[i]) * PerUnit.SB : load.getQ0();
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 okay
Kudos, SonarCloud Quality Gate passed! |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Terminal reactive balance post processing is wrong.
What is the new behavior (if this is a feature change)?
In the function LfLoadImpl::updateState, the updatedQ0 value will take in account if a load's P0 is 0 to correctly update the terminal's balance.
Does this PR introduce a breaking change or deprecate an API?
Other information: