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

CGMES export: improve default ratedS value #2598

Merged
merged 7 commits into from
Jun 21, 2023
Merged

Conversation

marqueslanauja
Copy link
Contributor

@marqueslanauja marqueslanauja commented Jun 2, 2023

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?

Feature

What is the current behavior?

100 is exported as default ratedS value for synchronous machines.

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

A more precise value is calculated by using Pmin, Pmax, Qmin and Qmax.

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: José Antonio Marqués <marquesja@aia.es>
@marqueslanauja marqueslanauja changed the title Export ratedS Cgmes Exporter: Improve the exported ratedS value Jun 2, 2023
@@ -47,4 +49,9 @@ public static void write(String id, String generatorName, String equipmentContai

private SynchronousMachineEq() {
}

private static double defaultRatedS(double minP, double maxP, double minQ, double maxQ) {
Copy link
Member

@annetill annetill Jun 15, 2023

Choose a reason for hiding this comment

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

We have asked some help at ENTSOE side. We have tried and it works. See below the code we have to do:

            List<Double> values = new ArrayList<>();
            values.add(Math.abs(g.getMinP()));
            values.add(Math.abs(g.getMaxP()));
            ReactiveLimits limits = g.getReactiveLimits();
            if (limits.getKind() == ReactiveLimitsKind.MIN_MAX) {
                values.add(Math.abs(g.getReactiveLimits(MinMaxReactiveLimits.class).getMinQ()));
                values.add(Math.abs(g.getReactiveLimits(MinMaxReactiveLimits.class).getMaxQ()));
            } else { // reactive capability curve
                ReactiveCapabilityCurve curve = g.getReactiveLimits(ReactiveCapabilityCurve.class);
                for (ReactiveCapabilityCurve.Point p : curve.getPoints()) {
                    values.add(Math.abs(p.getP()));
                    values.add(Math.abs(p.getMinQ()));
                    values.add(Math.abs(p.getMaxQ()));
                }
            }
            values.sort(Double::compareTo);
            double max = values.get(values.size() - 1);
            g.setRatedS(max);

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we prepared the changes taking into account the minP, maxP, minQ, maxQ as described by ENTSO-E in the Quality of CGMES datasets and calculations v3.3 . See the relevant doc for rule SMRatedSunrealistic:
Screenshot 2023-05-29 at 10 47 03
Screenshot 2023-05-29 at 10 46 36

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I added two conditions in my code:

values.add(Math.sqrt(p.getP() * p.getP() + p.getMinQ() * p.getMinQ()));
values.add(Math.sqrt(p.getP()` * p.getP() + p.getMaxQ() * p.getMaxQ()));

This is to follow the rule RCCXValues4 from QoCDC.


private static double defaultRatedS(double minP, double maxP, double minQ, double maxQ) {
double[] array = {Math.abs(minP), Math.abs(maxP), Math.abs(minQ), Math.abs(maxQ)};
return Arrays.stream(array).max().orElseThrow() * 10.0;
Copy link
Member

Choose a reason for hiding this comment

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

We do not need to apply a factor to obtain a default reasonable value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I removed factor.

Signed-off-by: José Antonio Marqués <marquesja@aia.es>
@zamarrenolm zamarrenolm changed the title Cgmes Exporter: Improve the exported ratedS value CGMES export: improve default ratedS value Jun 15, 2023
@zamarrenolm zamarrenolm marked this pull request as ready for review June 19, 2023 15:08
Copy link
Member

@colinepiloquet colinepiloquet left a comment

Choose a reason for hiding this comment

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

I tested it on my side and it works good, thanks.

@sonarqubecloud
Copy link

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 c2ccb73 into main Jun 21, 2023
@annetill annetill deleted the cgmes_export_ratedS branch June 21, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants