Skip to content

Commit

Permalink
Use of extension GeneratorFortescue from powsybl-core (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: Georges Steiner <[email protected]>
  • Loading branch information
g-steiner authored Jul 18, 2024
1 parent 429981b commit 9da345e
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.powsybl.cgmes.conversion.CgmesImportPostProcessor;
import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.extensions.GeneratorFortescueAdder;
import com.powsybl.iidm.network.extensions.GeneratorShortCircuitAdder;
import com.powsybl.iidm.network.extensions.WindingConnectionType;
import com.powsybl.sc.extensions.*;
Expand Down Expand Up @@ -99,12 +100,15 @@ private void processExternalNetworkInjection(Network network, TripleStore triple
.add();

generator.newExtension(GeneratorFortescueAdder.class)
.withRo(roOverR * rq)
.withXo(xoOverX * xq)
.withRi(0.)
.withXi(0.)
.withToGround(grounded)
.withGeneratorType(GeneratorFortescue.GeneratorType.FEEDER)
.withRz(roOverR * rq)
.withXz(xoOverX * xq)
.withRn(0.)
.withXn(0.)
.withGrounded(grounded)
.add();

generator.newExtension(GeneratorFortescueTypeAdder.class)
.withGeneratorType(GeneratorFortescueType.GeneratorType.FEEDER)
.add();
}
}
Expand Down Expand Up @@ -154,14 +158,17 @@ private void processSynchronousMachines(Network network, TripleStore tripleStore
.add();

generator.newExtension(GeneratorFortescueAdder.class)
.withRo(r0)
.withXo(x0)
.withRi(0.)
.withXi(0.)
.withGeneratorType(GeneratorFortescue.GeneratorType.ROTATING_MACHINE)
.withToGround(earthing)
.withRz(r0)
.withXz(x0)
.withRn(0.)
.withXn(0.)
.withGrounded(earthing)
.withGroundingR(0.) // TODO : check if info available
.add();

generator.newExtension(GeneratorFortescueTypeAdder.class)
.withGeneratorType(GeneratorFortescueType.GeneratorType.ROTATING_MACHINE)
.add();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ private FortescueConstants() {
public static final WindingConnectionType DEFAULT_LEG2_CONNECTION_TYPE = WindingConnectionType.Y_GROUNDED; // TODO : check if default connection acceptable
public static final WindingConnectionType DEFAULT_LEG3_CONNECTION_TYPE = WindingConnectionType.DELTA; // TODO : check if default connection acceptable

public static final GeneratorFortescue.GeneratorType DEFAULT_GENERATOR_FORTESCUE_TYPE = GeneratorFortescue.GeneratorType.ROTATING_MACHINE;
public static final GeneratorFortescueType.GeneratorType DEFAULT_GENERATOR_FORTESCUE_TYPE = GeneratorFortescueType.GeneratorType.ROTATING_MACHINE;
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2022, Jean-Baptiste Heyberger & Geoffroy Jamgotchian
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.sc.extensions;

import com.powsybl.commons.extensions.AbstractExtension;
import com.powsybl.iidm.network.Generator;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at gmail.com>
*/
public class GeneratorFortescueType extends AbstractExtension<Generator> {

public static final String NAME = "generatorFortescueType";

public enum GeneratorType {
UNKNOWN,
ROTATING_MACHINE,
FEEDER;
}

private final GeneratorType generatorType;

@Override
public String getName() {
return NAME;
}

public GeneratorFortescueType(Generator generator, GeneratorType generatorType) {
super(generator);
this.generatorType = generatorType;

}

public GeneratorType getGeneratorType() {
return generatorType;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2022, Jean-Baptiste Heyberger & Geoffroy Jamgotchian
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.sc.extensions;

import com.powsybl.commons.extensions.AbstractExtensionAdder;
import com.powsybl.iidm.network.Generator;

import static com.powsybl.sc.extensions.FortescueConstants.*;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at gmail.com>
*/
public class GeneratorFortescueTypeAdder extends AbstractExtensionAdder<Generator, GeneratorFortescueType> {

private GeneratorFortescueType.GeneratorType generatorType = DEFAULT_GENERATOR_FORTESCUE_TYPE;

public GeneratorFortescueTypeAdder(Generator generator) {
super(generator);
}

@Override
public Class<? super GeneratorFortescueType> getExtensionClass() {
return GeneratorFortescueType.class;
}

@Override
protected GeneratorFortescueType createExtension(Generator generator) {
return new GeneratorFortescueType(generator, generatorType);
}

public GeneratorFortescueTypeAdder withGeneratorType(GeneratorFortescueType.GeneratorType generatorType) {
this.generatorType = generatorType;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (c) 2022, Jean-Baptiste Heyberger & Geoffroy Jamgotchian
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.sc.extensions;

import com.google.auto.service.AutoService;
import com.powsybl.commons.extensions.ExtensionAdderProvider;
import com.powsybl.iidm.network.Generator;

/**
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at gmail.com>
*/
@AutoService(ExtensionAdderProvider.class)
public class GeneratorFortescueTypeAdderImplProvider implements ExtensionAdderProvider<Generator, GeneratorFortescueType, GeneratorFortescueTypeAdder> {

@Override
public String getImplementationName() {
return "Default";
}

@Override
public String getExtensionName() {
return GeneratorFortescueType.NAME;
}

@Override
public Class<GeneratorFortescueTypeAdder> getAdderClass() {
return GeneratorFortescueTypeAdder.class;
}

@Override
public GeneratorFortescueTypeAdder newAdder(Generator generator) {
return new GeneratorFortescueTypeAdder(generator);
}
}
6 changes: 6 additions & 0 deletions sc-implementation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
<artifactId>log4j-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-iidm-extensions</artifactId>
<version>6.4.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.extensions.GeneratorShortCircuit;
import com.powsybl.sc.extensions.GeneratorFortescue;
import com.powsybl.sc.extensions.GeneratorFortescueType;
import com.powsybl.sc.extensions.GeneratorShortCircuit2;
import com.powsybl.sc.extensions.ThreeWindingsTransformerFortescue;
import com.powsybl.sc.extensions.TwoWindingsTransformerFortescue;
Expand Down Expand Up @@ -413,10 +413,10 @@ public double getKg(Generator gen) {

// Check if not feeder
boolean isFeeder = false;
GeneratorFortescue extensions2 = gen.getExtension(GeneratorFortescue.class);
GeneratorFortescueType extensions2 = gen.getExtension(GeneratorFortescueType.class);
if (extensions2 != null) {
GeneratorFortescue.GeneratorType genType = extensions2.getGeneratorType();
if (genType == GeneratorFortescue.GeneratorType.FEEDER) {
GeneratorFortescueType.GeneratorType genType = extensions2.getGeneratorType();
if (genType == GeneratorFortescueType.GeneratorType.FEEDER) {
isFeeder = true;
}
}
Expand Down
Loading

0 comments on commit 9da345e

Please sign in to comment.