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

Add voltage level details to display production and consumption figures #622

Merged
merged 19 commits into from
Jul 3, 2024

Conversation

So-Fras
Copy link
Member

@So-Fras So-Fras commented Jun 14, 2024

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?

What is the current behavior?

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

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
So-Fras added 3 commits June 24, 2024 15:42
… to voltage level details

Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
@So-Fras So-Fras changed the title [WIP] Add attribute in SvgParameters to display production and demand figures Add attribute in SvgParameters to display production and demand figures Jun 24, 2024
@So-Fras So-Fras marked this pull request as ready for review June 24, 2024 13:46
So-Fras and others added 4 commits June 24, 2024 15:49
Signed-off-by: Sophie Frasnedo <93923177+So-Fras@users.noreply.github.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
@So-Fras So-Fras changed the title Add attribute in SvgParameters to display production and demand figures Add voltage level details to display production and consumption figures Jun 25, 2024
@So-Fras So-Fras requested a review from flo-dup June 25, 2024 12:21
Copy link
Contributor

@flo-dup flo-dup left a comment

Choose a reason for hiding this comment

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

Just realizing we could have done this by buses quite easily... next step!

So-Fras and others added 4 commits July 3, 2024 15:15
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
List<String> voltageLevelDetails = new ArrayList<>();
VoltageLevel voltageLevel = network.getVoltageLevel(vlNode.getEquipmentId());

double activeProductionValue = voltageLevel.getGeneratorStream().mapToDouble(generator -> !Double.isNaN(-generator.getTerminal().getP()) ? -generator.getTerminal().getP() : 0).sum();
Copy link
Contributor

Choose a reason for hiding this comment

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

This stream operation (and the 3 others) can be simplified that way. Besides it will avoid the complexity issue raised by sonar.

Suggested change
double activeProductionValue = voltageLevel.getGeneratorStream().mapToDouble(generator -> !Double.isNaN(-generator.getTerminal().getP()) ? -generator.getTerminal().getP() : 0).sum();
double activeProductionValue = voltageLevel.getGeneratorStream().mapToDouble(generator -> -generator.getTerminal().getP()).filter(p -> !Double.isNaN(p)).sum();

So-Fras added 2 commits July 3, 2024 15:44
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Signed-off-by: Sophie Frasnedo <sophie.frasnedo@rte-france.com>
Copy link

sonarqubecloud bot commented Jul 3, 2024

@flo-dup flo-dup merged commit ce1243f into main Jul 3, 2024
7 checks passed
@flo-dup flo-dup deleted the add_production_demand_info branch July 3, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants