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

Network update: wrong load Q0 when loadPowerFactorConstant is true and P0 equals zero #798

Merged
merged 4 commits into from
Jun 14, 2023

Conversation

caioluke
Copy link
Member

Please check if the PR fulfills these requirements

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

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?

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

Signed-off-by: Caio Luke <caio.luke@artelys.com>
@caioluke caioluke added the bug Something isn't working label Jun 12, 2023
@caioluke caioluke requested a review from annetill June 12, 2023 12:49
@caioluke caioluke self-assigned this Jun 12, 2023
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@annetill annetill changed the title [WIP] Terminal post processing does not account for load Q0 when loadPowerFactorConstant is true Network update: wrong load Q0 when loadPowerFactorConstant is true and P0 equals zero Jun 13, 2023
@@ -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();
Copy link
Member

@Hadrien-Godard Hadrien-Godard Jun 13, 2023

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();

Copy link
Member

Choose a reason for hiding this comment

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

yes okay

annetill added 2 commits June 13, 2023 20:36
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
@sonarcloud
Copy link

sonarcloud bot commented Jun 14, 2023

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

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@annetill annetill merged commit 42aa220 into main Jun 14, 2023
@annetill annetill deleted the fix_terminal_update_Q_from_load branch June 14, 2023 09:13
jeandemanged pushed a commit that referenced this pull request Jun 16, 2023
…d P0 equals zero (#798)

Signed-off-by: Caio Luke <caio.luke@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
(cherry picked from commit 42aa220)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR: next-release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants