Skip to content

Commit

Permalink
Exception for out of bound regulating generators: turn off voltage re…
Browse files Browse the repository at this point in the history
…gulation (when specificCompatibility is set)
  • Loading branch information
CBiasuzzi committed Apr 16, 2018
1 parent 9504677 commit b83b1c7
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,19 @@ private void createGenerators(EsgNetwork esgNetwork) {
LOGGER.warn("inverted qmin {} and qmax {} values for generator {}", g.getReactiveLimits().getMinQ(pgen), g.getReactiveLimits().getMaxQ(pgen), g.getId());
qgen = -g.getTerminal().getQ();
}
boolean isVoltageRegulatorOn = g.isVoltageRegulatorOn();
// Exception for out of bound regulating generators
if (config.isSpecificCompatibility() && (g.getTargetP() < 0.0001) && (g.getMinP() > 0.0001)) {
isVoltageRegulatorOn = false;
LOGGER.warn("out of bound regulating generator {}, targetP {}, minP {} : turn off its voltage regulation", g.getId(), g.getTargetP(), g.getMinP());
}
// in case qmin and qmax are inverted, take out the unit from the voltage regulation if it has a target Q
// and open widely the Q interval
float qgmin = (config.isNoGeneratorMinMaxQ() || isQminQmaxInverted) ? -9999 : g.getReactiveLimits().getMinQ(pgen);
float qgmax = (config.isNoGeneratorMinMaxQ() || isQminQmaxInverted) ? 9999 : g.getReactiveLimits().getMaxQ(pgen);
EsgRegulatingMode mode = (isQminQmaxInverted && !Float.isNaN(qgen)) ? EsgRegulatingMode.NOT_REGULATING :
(g.isVoltageRegulatorOn() && g.getTargetV() >= 0.1 ? EsgRegulatingMode.REGULATING : EsgRegulatingMode.NOT_REGULATING);
float vregge = (isQminQmaxInverted && !Float.isNaN(qgen)) ? Float.NaN : (g.isVoltageRegulatorOn() ? g.getTargetV() : Float.NaN);
(isVoltageRegulatorOn && g.getTargetV() >= 0.1 ? EsgRegulatingMode.REGULATING : EsgRegulatingMode.NOT_REGULATING);
float vregge = (isQminQmaxInverted && !Float.isNaN(qgen)) ? Float.NaN : (isVoltageRegulatorOn ? g.getTargetV() : Float.NaN);
float qgensh = 1.f;

//fails, when noSwitch is true !!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@
*/
public class EurostagEchExportTest {

private void test(Network network, String reference, LocalDate editDate, EsgSpecialParameters specialParameters) throws IOException {
private void test(Network network, String reference, LocalDate editDate, EsgSpecialParameters specialParameters, EurostagEchExportConfig config) throws IOException {
StringWriter writer = new StringWriter();
EsgGeneralParameters parameters = new EsgGeneralParameters();
parameters.setEditDate(editDate);
new EurostagEchExport(network).write(writer, parameters, specialParameters);
new EurostagEchExport(network, config).write(writer, parameters, specialParameters);
writer.close();
assertEquals(CharStreams.toString(new InputStreamReader(getClass().getResourceAsStream(reference), StandardCharsets.UTF_8)), writer.toString());
}

private void test(Network network, String reference, LocalDate editDate, EsgSpecialParameters specialParameters) throws IOException {
test(network, reference, editDate, specialParameters, new EurostagEchExportConfig());
}


@Test
public void test() throws IOException {
Network network = EurostagTutorialExample1Factory.create();
Expand Down Expand Up @@ -157,4 +162,22 @@ public void testCptRpt() throws IOException {
test(network, "/eurostag-tutorial-example1_cptrpt.ech", LocalDate.parse("2016-03-01"), specialParameters);
}

@Test
public void testVoltageRegulationException() throws IOException {
Network network = EurostagTutorialExample1Factory.create();

//voltage regulator exception: if specificCompatibility && (g.getTargetP() < 0.0001) && (g.getMinP() > 0.0001)
// turn off g's voltage regulation
Generator g = network.getGenerator("GEN");
g.setMinP(300f);
g.setTargetP(0);

EsgSpecialParameters specialParameters = new EsgSpecialParameters();
EurostagEchExportConfig exTemp = new EurostagEchExportConfig();
EurostagEchExportConfig exportConfig= new EurostagEchExportConfig(exTemp.isNoGeneratorMinMaxQ(), exTemp.isNoSwitch(), exTemp.getForbiddenCharactersString(),
exTemp.getForbiddenCharactersReplacement(), exTemp.isSvcAsFixedInjectionInLF(), true, exTemp.isExportMainCCOnly());

test(network, "/eurostag-tutorial-example1_vre.ech", LocalDate.parse("2016-03-01"), specialParameters, exportConfig);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
HEADER 01/03/16 5.1

B

9 1 0 0 1 1 20 0.005 4 100. 1 1

SP INPVPQ 2
SP THMAX 0.100000
SP EMAXF 0.100000
SP ZMIN 0.000200
SP RAMIN 0.800000
SP RAMAX 1.200000
SP TOLPLO 0.001000

GC sim1/InitialState

AA FA
AA FR

1FAFAKENOD1 380. 1. 0. 0. 0.
1FAFAKENOD2 380. 1. 0. 0. 0.
1FRNGEN 24. 1. 0. 0. 0.
5 NGEN 0.
1FRNHV1 380. 1. 0. 0. 0.
1FRNHV2 380. 1. 0. 0. 0.
1FRNLOAD 150. 1. 0. 0. 0.

3 NHV1 NHV2 1 0.002078 0.022853 0. 0.278692 100. 0. 0.
3 NHV1 NHV2 2 0.002078 0.022853 0. 0.278692 100. 0. 0.

48NGEN NHV1 1 100.0.018462 0. 0. 1. 0. 0.
48 1 1 N
48 1 22.8 380. 0.769231 0.
48NHV2 NLOAD 1 100. 0.021 0. 0. 1. 0. 0.
48 2 2 NLOAD 158. V
48 1 446.4633 150. 1.8 0.
48 2 379.4938 150. 1.8 0.
48 3 329.9946 150. 1.8 0.

CH LOAD Y NLOAD 0. 0. 600. 0. 0. 200. 0. 0.

G GEN Y NGEN 300. 0. 9999.99 -9999.99 301. 9999.99 N NGEN 1. 0. 0.

0 comments on commit b83b1c7

Please sign in to comment.