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 apparent power attribute (ratedS) on transformers in IIDM #1199

Merged
merged 6 commits into from
Mar 5, 2020

Conversation

tadam50
Copy link
Contributor

@tadam50 tadam50 commented Mar 3, 2020

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • 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 ? If so, link to this issue using '#XXX' and skip the rest
fix #1144

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature

Other information:

@tadam50 tadam50 requested review from miovd and mathbagu March 3, 2020 09:44
@tadam50 tadam50 self-assigned this Mar 3, 2020
@miovd miovd changed the base branch from master to evolution_xiidm/1.2 March 3, 2020 11:16
@miovd miovd added this to PR in progress in Evolutions IIDM via automation Mar 3, 2020
Copy link
Contributor

@miovd miovd left a comment

Choose a reason for hiding this comment

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

After a discussion with our experts, it seems more logical to have ratedS linked to ends of transformers for ThreeWindingsTransformer

Hence, instead of being in the ThreeWindingsTransformer, please put the ratedS attribute on ThreeWindingsTransformer.Leg

More general remarks:

  • don't forget default implementation when adding methods in interfaces to prevent breaking changes
    e.g.
default double getRatedS1() {
  throw new UnsupportedOperationException();
}
  • contrary to ratedS in generators, apparent power is optional for transformers: it can be NaN. The only check should be to ensure it is strictly positive if not NaN

@tadam50 tadam50 requested a review from miovd March 3, 2020 16:51
@miovd miovd changed the base branch from evolution_xiidm/1.2 to master March 4, 2020 08:08
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
…gsTransformerXML

Signed-off-by: Thomas ADAM <tadam@silicom.fr>
…ormer to Leg

Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
@@ -24,6 +24,8 @@

TwoWindingsTransformerAdder setRatedU2(double ratedU2);

TwoWindingsTransformerAdder setRatedS(double ratedS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add default implementation


protected static void readRatedS(String name, NetworkXmlReaderContext context, RatedSConsumer consumer) {
double ratedS = XmlUtil.readOptionalDoubleAttribute(context.getReader(), name);
consumer.accept(ratedS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than using a custom interface, you can use DoubleConsumer here and delete RatedSConsumer

…oubleConsumer

Signed-off-by: Thomas ADAM <tadam@silicom.fr>
@@ -137,15 +146,15 @@ public ThreeWindingsTransformerAdderImpl add() {
if (legNumber == 1) {
voltageLevel1 = checkAndGetVoltageLevel();
terminal1 = checkAndGetTerminal();
leg1 = new LegImpl(r, x, g, b, ratedU, legNumber);
leg1 = new LegImpl(r, x, g, b, ratedU, legNumber, ratedS);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should put ratedS close to ratedU?

public void invalidRatedS() {
ThreeWindingsTransformer transformer = createThreeWindingsTransformer();
ThreeWindingsTransformer.Leg leg1 = transformer.getLeg1();
leg1.setRatedS(Double.NaN);
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems useless to set ratedS to NaN.

Signed-off-by: Thomas ADAM <tadam@silicom.fr>
@sonarcloud
Copy link

sonarcloud bot commented Mar 5, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

80.6% 80.6% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Evolutions IIDM
  
Merged PR
Development

Successfully merging this pull request may close these issues.

Add apparent power attribute (ratedS) on transformers in IIDM
3 participants