Skip to content

Commit

Permalink
Merge branch 'main' into specific-param-from-config
Browse files Browse the repository at this point in the history
  • Loading branch information
olperr1 authored Oct 10, 2024
2 parents 8c9964a + 78f0d22 commit 00b963d
Show file tree
Hide file tree
Showing 69 changed files with 640 additions and 256 deletions.
2 changes: 1 addition & 1 deletion docs/dynamic_simulation/dynamic-models-dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Ultimately, all groovy scripts call dedicated builders that can be used directly
* BaseShuntBuilder
* HvdcPBuilder
* HvdcVscBuilder
* GeneratorFictitiousBuilder
* BaseGeneratorBuilder
* SignalNGeneratorBuilder
* SynchronizedGeneratorBuilder
* SynchronousGeneratorBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ private static Stream<Arguments> provideEquipmentModelData() {
return Stream.of(
Arguments.of("/dynamicModels/bus.groovy", StandardBus.class, EurostagTutorialExample1Factory.create(), "NGEN", "BBM_NGEN", "SB", "Bus"),
Arguments.of("/dynamicModels/hvdcP.groovy", BaseHvdc.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcPV"),
Arguments.of("/dynamicModels/hvdcVsc.groovy", BaseHvdc.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcVSC"),
Arguments.of("/dynamicModels/hvdcVsc.groovy", BaseHvdc.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcVsc"),
Arguments.of("/dynamicModels/hvdcPDangling.groovy", HvdcDangling.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcPVDanglingDiagramPQ"),
Arguments.of("/dynamicModels/hvdcVscDangling.groovy", HvdcDangling.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcVSCDanglingUdc"),
Arguments.of("/dynamicModels/hvdcVscDangling.groovy", HvdcDangling.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcVscDanglingUdc"),
Arguments.of("/dynamicModels/loadAB.groovy", BaseLoad.class, EurostagTutorialExample1Factory.create(), "LOAD", "LOAD", "LAB", "LoadAlphaBetaRestorative"),
Arguments.of("/dynamicModels/loadABControllable.groovy", BaseLoadControllable.class, EurostagTutorialExample1Factory.create(), "LOAD", "LOAD", "LAB", "LoadAlphaBeta"),
Arguments.of("/dynamicModels/loadTransformer.groovy", LoadOneTransformer.class, EurostagTutorialExample1Factory.create(), "LOAD", "LOAD", "LOT", "LoadOneTransformer"),
Expand Down Expand Up @@ -183,14 +183,6 @@ private static Stream<Arguments> provideWarningsModel() {
'dynamicModelId' field is not set, staticId GEN will be used instead
Model GEN cannot be instantiated
"""),
Arguments.of("/warnings/missingDangling.groovy", HvdcTestNetwork.createVsc(),
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
+ DSL model builder for HvdcPVDangling
'dangling' field is not set
Model BBM_HVDC_L cannot be instantiated
"""),
Arguments.of("/warnings/missingDanglingProperty.groovy", HvdcTestNetwork.createVsc(),
"""
+ DSL tests
Expand Down Expand Up @@ -289,7 +281,7 @@ private static Stream<Arguments> provideWarningsModel() {
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
+ DSL model builder for HvdcVSC
+ DSL model builder for HvdcVsc
'staticId' field value 'L' not found for equipment type(s) VSC HVDC_LINE
Model BBM_HVDC cannot be instantiated
""")
Expand Down
2 changes: 1 addition & 1 deletion dynawo-dsl/src/test/resources/dynamicModels/hvdcVsc.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package dynamicModels

HvdcVSC {
HvdcVsc {
staticId "L"
dynamicModelId "BBM_HVDC_L"
parameterSetId "HVDC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package dynamicModels

import com.powsybl.iidm.network.TwoSides

HvdcVSCDanglingUdc {
HvdcVscDanglingUdc {
staticId "L"
dynamicModelId "BBM_HVDC_L"
parameterSetId "HVDC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package warnings


HvdcVSC {
HvdcVsc {
dynamicModelId "BBM_HVDC"
parameterSetId "hvdc"
staticId "L"
Expand Down
15 changes: 0 additions & 15 deletions dynawo-dsl/src/test/resources/warnings/missingDangling.groovy

This file was deleted.

5 changes: 5 additions & 0 deletions dynawo-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
public abstract class AbstractDynawoTest {

private static final String DOCKER_IMAGE_ID = "powsybl/java-dynawo:2.1.0";
private static final String DOCKER_IMAGE_ID = "powsybl/java-dynawo:2.2.0";

@TempDir
Path localDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import static com.powsybl.commons.report.ReportNode.NO_OP;
import static com.powsybl.commons.report.ReportNode.newRootReportNode;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;

/**
Expand All @@ -54,7 +55,7 @@ class DynawoSimulationTest extends AbstractDynawoTest {
@BeforeEach
void setUp() throws Exception {
super.setUp();
provider = new DynawoSimulationProvider(new DynawoSimulationConfig(Path.of("/dynawo"), true));
provider = new DynawoSimulationProvider(new DynawoSimulationConfig(Path.of("/dynaflow-launcher"), true));
parameters = new DynamicSimulationParameters()
.setStartTime(0)
.setStopTime(100);
Expand All @@ -72,12 +73,12 @@ void testIeee14() {
assertEquals(27, result.getCurves().size());
DoubleTimeSeries ts1 = result.getCurve("_GEN____1_SM_generator_UStatorPu");
assertEquals("_GEN____1_SM_generator_UStatorPu", ts1.getMetadata().getName());
assertEquals(587, ts1.toArray().length);
assertEquals(585, ts1.toArray().length);
assertEquals(14, result.getFinalStateValues().size());
assertEquals(1.046227, result.getFinalStateValues().get("NETWORK__BUS___10_TN_Upu_value"));
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(23, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
checkTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
}

@Test
Expand Down Expand Up @@ -145,7 +146,7 @@ void testSvarc() {
assertTrue(result.getCurves().isEmpty());
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(1, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 0, "G1", "PMIN : activation");
checkTimeLineEvent(timeLine.get(0), 0, "G1", "PMIN : activation");
}

@Test
Expand Down Expand Up @@ -175,7 +176,7 @@ void testHvdc() {
assertTrue(result.getCurves().isEmpty());
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(7, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 30.0, "_BUS____5-BUS____6-1_PS", "Tap +1");
checkTimeLineEvent(timeLine.get(0), 30.0, "_BUS____5-BUS____6-1_PS", "Tap +1");
}

@Test
Expand All @@ -200,8 +201,7 @@ void testSmib() {
dynawoSimulationParameters.setModelsParameters(modelsParameters)
.setNetworkParameters(networkParameters)
.setSolverParameters(solverParameters)
.setSolverType(DynawoSimulationParameters.SolverType.IDA)
.setWriteFinalState(false);
.setSolverType(DynawoSimulationParameters.SolverType.IDA);

DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, outputVariablesSupplier,
VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP)
Expand Down Expand Up @@ -237,9 +237,9 @@ void testSimulationError() {
.join();

assertEquals(DynamicSimulationResult.Status.FAILURE, result.getStatus());
assertEquals("time step <= 0.1 s for more than 10 iterations ( DYNSolverCommonFixedTimeStep.cpp:419 )", result.getStatusText());
assertTrue(result.getTimeLine().isEmpty());
assertTrue(result.getCurves().isEmpty());
assertThat(result.getStatusText()).contains("time step <= 0.1 s for more than 10 iterations");
assertThat(result.getTimeLine()).isEmpty();
assertThat(result.getCurves()).isEmpty();
}

@Test
Expand Down Expand Up @@ -267,10 +267,10 @@ void testIeee14DynawoSuppliers() {
assertEquals(0, result.getCurves().size());
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(11, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
checkTimeLineEvent(timeLine.get(0), 0, "_GEN____8_SM", "PMIN : activation");
}

private void checkFirstTimeLineEvent(TimelineEvent event, double time, String modelName, String message) {
private void checkTimeLineEvent(TimelineEvent event, double time, String modelName, String message) {
assertEquals(time, event.time());
assertEquals(modelName, event.modelName());
assertEquals(message, event.message());
Expand Down Expand Up @@ -299,11 +299,11 @@ void testIEEE14SignalN() {
.join();

assertEquals(DynamicSimulationResult.Status.SUCCESS, result.getStatus());
assertTrue(result.getStatusText().isEmpty());
assertEquals(0, result.getCurves().size());
assertThat(result.getStatusText()).isEmpty();
assertThat(result.getCurves()).isEmpty();
List<TimelineEvent> timeLine = result.getTimeLine();
assertEquals(1, timeLine.size());
checkFirstTimeLineEvent(timeLine.get(0), 10, "_BUS____1-BUS____5-1_AC", "LINE : opening on side 2");
assertThat(timeLine).hasSize(13);
checkTimeLineEvent(timeLine.get(12), 10, "_BUS____1-BUS____5-1_AC", "LINE : opening on side 2");
}

private Supplier<DynamicSimulationResult> setupIEEE14Simulation() {
Expand Down
8 changes: 8 additions & 0 deletions dynawo-integration-tests/src/test/resources/hvdc/models.par
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
<reference type="DOUBLE" name="load_UPhase0" origData="IIDM" origName="angle_pu"/>
</set>
<set id="4">
<par type="DOUBLE" name="hvdc_Q1Nom" value="400"/>
<par type="DOUBLE" name="hvdc_Q2Nom" value="400"/>
<par type="DOUBLE" name="hvdc_Lambda1Pu" value="0"/>
<par type="DOUBLE" name="hvdc_Lambda2Pu" value="0"/>
<reference type="DOUBLE" name="hvdc_P20Pu" origData="IIDM" origName="p2_pu"/>
<reference type="DOUBLE" name="hvdc_Q20Pu" origData="IIDM" origName="q2_pu"/>
<reference type="DOUBLE" name="hvdc_U20Pu" origData="IIDM" origName="v2_pu"/>
Expand All @@ -88,6 +92,10 @@
<par type="DOUBLE" name="acemulation_PRefSet0Pu" value="0"/>
</set>
<set id="5">
<par type="DOUBLE" name="hvdc_Q1Nom" value="400"/>
<par type="DOUBLE" name="hvdc_Q2Nom" value="400"/>
<par type="DOUBLE" name="hvdc_Lambda1Pu" value="0"/>
<par type="DOUBLE" name="hvdc_Lambda2Pu" value="0"/>
<reference type="DOUBLE" name="hvdc_P20Pu" origData="IIDM" origName="p2_pu"/>
<reference type="DOUBLE" name="hvdc_Q20Pu" origData="IIDM" origName="q2_pu"/>
<reference type="DOUBLE" name="hvdc_U20Pu" origData="IIDM" origName="v2_pu"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,55 +174,55 @@
"limitName" : "UInfUmin",
"limit" : 66.92999999999999,
"limitReduction" : 1.0,
"value" : 66.04302591364225
"value" : 66.04302591577434
}, {
"subjectId" : "_BUS____4_VL",
"subjectName" : "BUS 4_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 66.92999999999999,
"limitReduction" : 1.0,
"value" : 65.72762039108571
"value" : 65.72762039320641
}, {
"subjectId" : "_BUS____5_VL",
"subjectName" : "BUS 5_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 66.92999999999999,
"limitReduction" : 1.0,
"value" : 65.52250008634476
"value" : 65.52250008834531
}, {
"subjectId" : "_BUS___14_VL",
"subjectName" : "BUS 14_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 13.386000000000001,
"limitReduction" : 1.0,
"value" : 13.348620218077935
"value" : 13.348620218406515
}, {
"subjectId" : "_BUS____2_VL",
"subjectName" : "BUS 2_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 66.92999999999999,
"limitReduction" : 1.0,
"value" : 66.79275331121715
"value" : 66.79275331228723
}, {
"subjectId" : "_BUS___10_VL",
"subjectName" : "BUS 10_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 13.386000000000001,
"limitReduction" : 1.0,
"value" : 13.3776580871495
"value" : 13.377658087264606
}, {
"subjectId" : "_BUS____9_VL",
"subjectName" : "BUS 9_VL",
"limitType" : "LOW_VOLTAGE",
"limitName" : "UInfUmin",
"limit" : 13.386000000000001,
"limitReduction" : 1.0,
"value" : 13.38439596457008
"value" : 13.384395964628164
} ],
"actionsTaken" : [ ]
},
Expand Down Expand Up @@ -299,15 +299,15 @@
"limitName" : "UInfUmin",
"limit" : 66.92999999999999,
"limitReduction" : 1.0,
"value" : 66.39712313695317
"value" : 66.39712316522031
}, {
"subjectId" : "_BUS____4-BUS____5-1_AC",
"subjectName" : "BUS 4-BUS 5-1",
"limitType" : "CURRENT",
"limitName" : "PATL",
"limit" : 836.74,
"limitReduction" : 1.0,
"value" : 843.5741007221512,
"value" : 843.5741006594511,
"side" : "ONE"
}, {
"subjectId" : "_BUS____3-BUS____4-1_AC",
Expand All @@ -316,7 +316,7 @@
"limitName" : "PATL",
"limit" : 836.74,
"limitReduction" : 1.0,
"value" : 839.9381833149292,
"value" : 839.9381832777893,
"side" : "ONE"
} ],
"actionsTaken" : [ ]
Expand Down
Loading

0 comments on commit 00b963d

Please sign in to comment.