diff --git a/README.md b/README.md
index 2898af07e..ad67b3cec 100644
--- a/README.md
+++ b/README.md
@@ -88,10 +88,10 @@ for (Generator gen : network.generators) {
}
for (Line line : network.lines) {
- CurrentLimitAutomaton {
+ OverloadManagementSystem {
dynamicModelId "BBM_" + line.id
parameterSetId "CLA"
- controlledQuadripole line.id
+ controlledBranch line.id
iMeasurement line.id
iMeasurementSide TwoSides.TWO
}
diff --git a/dynawaltz-dsl/pom.xml b/dynawaltz-dsl/pom.xml
index 826d1a34b..285f8161d 100644
--- a/dynawaltz-dsl/pom.xml
+++ b/dynawaltz-dsl/pom.xml
@@ -21,6 +21,7 @@
DSL for DynaWaltz
+ true
javadoc
@@ -30,10 +31,6 @@
org.codehaus.gmavenplus
gmavenplus-plugin
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy
index 2380df6e7..8e00fe363 100644
--- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy
+++ b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy
@@ -14,7 +14,7 @@ import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension
import com.powsybl.dynawaltz.DynaWaltzProvider
import com.powsybl.dynawaltz.builders.BuilderConfig
import com.powsybl.dynawaltz.builders.ModelBuilder
-import com.powsybl.dynawaltz.builders.ModelConfigs
+import com.powsybl.dynawaltz.builders.ModelConfigsHandler
import com.powsybl.iidm.network.Network
import java.util.function.Consumer
@@ -27,7 +27,7 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio
private final List builderConfigs
DynaWaltzDynamicModelGroovyExtension() {
- builderConfigs = ModelConfigs.getInstance().getBuilderConfigs()
+ builderConfigs = ModelConfigsHandler.getInstance().getBuilderConfigs()
}
@Override
@@ -40,6 +40,7 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio
builderConfigs.stream().flatMap { it -> it.libs}.toList() as List
}
+
@Override
void load(Binding binding, Consumer consumer, Reporter reporter) {
builderConfigs.forEach {conf ->
diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy
index cfe89d56f..1310c7024 100644
--- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy
+++ b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy
@@ -14,7 +14,7 @@ import com.powsybl.dynamicsimulation.groovy.EventModelGroovyExtension
import com.powsybl.dynawaltz.DynaWaltzProvider
import com.powsybl.dynawaltz.builders.EventBuilderConfig
import com.powsybl.dynawaltz.builders.ModelBuilder
-import com.powsybl.dynawaltz.builders.ModelConfigs
+import com.powsybl.dynawaltz.builders.ModelConfigsHandler
import com.powsybl.iidm.network.Network
import java.util.function.Consumer
@@ -27,7 +27,7 @@ class DynaWaltzEventModelGroovyExtension implements EventModelGroovyExtension {
private final List builderConfigs
DynaWaltzEventModelGroovyExtension() {
- builderConfigs = ModelConfigs.getInstance().getEventBuilderConfigs()
+ builderConfigs = ModelConfigsHandler.getInstance().getEventBuilderConfigs()
}
@Override
diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java
index 7d23dba53..949001571 100644
--- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java
+++ b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java
@@ -15,11 +15,11 @@
import com.powsybl.dynawaltz.DynaWaltzProvider;
import com.powsybl.dynawaltz.models.BlackBoxModel;
import com.powsybl.dynawaltz.models.EquipmentBlackBoxModel;
-import com.powsybl.dynawaltz.models.automatons.*;
-import com.powsybl.dynawaltz.models.automatons.currentlimits.CurrentLimitAutomaton;
-import com.powsybl.dynawaltz.models.automatons.currentlimits.CurrentLimitTwoLevelsAutomaton;
-import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterIAutomaton;
-import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterPAutomaton;
+import com.powsybl.dynawaltz.models.automationsystems.*;
+import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystem;
+import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystem;
+import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystem;
+import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystem;
import com.powsybl.dynawaltz.models.buses.InfiniteBus;
import com.powsybl.dynawaltz.models.buses.StandardBus;
import com.powsybl.dynawaltz.models.generators.*;
@@ -66,8 +66,8 @@ void testEquipmentDynamicModels(String groovyScriptName, Class extends Equipme
}
@ParameterizedTest(name = "{0}")
- @MethodSource("provideAutomatonModelData")
- void testAutomatonDynamicModels(String groovyScriptName, Class extends BlackBoxModel> modelClass, Network network, String dynamicId, String parameterId, String lib) {
+ @MethodSource("provideAutomationSystemModelData")
+ void testAutomationSystemDynamicModels(String groovyScriptName, Class extends BlackBoxModel> modelClass, Network network, String dynamicId, String parameterId, String lib) {
DynamicModelsSupplier supplier = new GroovyDynamicModelsSupplier(getResourceAsStream(groovyScriptName), EXTENSIONS);
List dynamicModels = supplier.get(network);
assertEquals(1, dynamicModels.size());
@@ -135,16 +135,16 @@ private static Stream provideEquipmentModelData() {
);
}
- private static Stream provideAutomatonModelData() {
+ private static Stream provideAutomationSystemModelData() {
return Stream.of(
- Arguments.of("/dynamicModels/currentLimit.groovy", CurrentLimitAutomaton.class, EurostagTutorialExample1Factory.create(), "AM_NHV1_NHV2_1", "CLA", "CurrentLimitAutomaton"),
- Arguments.of("/dynamicModels/currentLimitTwoLevels.groovy", CurrentLimitTwoLevelsAutomaton.class, EurostagTutorialExample1Factory.create(), "AM_NHV1_NHV2_1", "CLA", "CurrentLimitAutomatonTwoLevels"),
- Arguments.of("/dynamicModels/tapChanger.groovy", TapChangerAutomaton.class, EurostagTutorialExample1Factory.create(), "TC", "tc", "TapChangerAutomaton"),
- Arguments.of("/dynamicModels/tapChangerBlockingBusBar.groovy", TapChangerBlockingAutomaton.class, FourSubstationsNodeBreakerFactory.create(), "ZAB", "ZAB", "TapChangerBlockingAutomaton2"),
- Arguments.of("/dynamicModels/tapChangerBlocking.groovy", TapChangerBlockingAutomaton.class, EurostagTutorialExample1Factory.create(), "ZAB", "ZAB", "TapChangerBlockingAutomaton3"),
- Arguments.of("/dynamicModels/phaseShifterI.groovy", PhaseShifterIAutomaton.class, EurostagTutorialExample1Factory.create(), "PS_NGEN_NHV1", "ps", "PhaseShifterI"),
- Arguments.of("/dynamicModels/phaseShifterP.groovy", PhaseShifterPAutomaton.class, EurostagTutorialExample1Factory.create(), "PS_NGEN_NHV1", "ps", "PhaseShifterP"),
- Arguments.of("/dynamicModels/underVoltage.groovy", UnderVoltageAutomaton.class, EurostagTutorialExample1Factory.create(), "UV_GEN", "uv", "UnderVoltageAutomaton")
+ Arguments.of("/dynamicModels/overloadManagement", DynamicOverloadManagementSystem.class, EurostagTutorialExample1Factory.create(), "AM_NHV1_NHV2_1", "CLA", "CurrentLimitAutomaton"),
+ Arguments.of("/dynamicModels/overloadManagementTwoLevels.groovy", DynamicTwoLevelsOverloadManagementSystem.class, EurostagTutorialExample1Factory.create(), "AM_NHV1_NHV2_1", "CLA", "CurrentLimitAutomatonTwoLevels"),
+ Arguments.of("/dynamicModels/tapChanger.groovy", TapChangerAutomationSystem.class, EurostagTutorialExample1Factory.create(), "TC", "tc", "TapChangerAutomaton"),
+ Arguments.of("/dynamicModels/tapChangerBlockingBusBar.groovy", TapChangerBlockingAutomationSystem.class, FourSubstationsNodeBreakerFactory.create(), "ZAB", "ZAB", "TapChangerBlockingAutomaton2"),
+ Arguments.of("/dynamicModels/tapChangerBlocking.groovy", TapChangerBlockingAutomationSystem.class, EurostagTutorialExample1Factory.create(), "ZAB", "ZAB", "TapChangerBlockingAutomaton3"),
+ Arguments.of("/dynamicModels/phaseShifterI.groovy", PhaseShifterIAutomationSystem.class, EurostagTutorialExample1Factory.create(), "PS_NGEN_NHV1", "ps", "PhaseShifterI"),
+ Arguments.of("/dynamicModels/phaseShifterP.groovy", PhaseShifterPAutomationSystem.class, EurostagTutorialExample1Factory.create(), "PS_NGEN_NHV1", "ps", "PhaseShifterP"),
+ Arguments.of("/dynamicModels/underVoltage.groovy", UnderVoltageAutomationSystem.class, EurostagTutorialExample1Factory.create(), "UV_GEN", "uv", "UnderVoltageAutomaton")
);
}
@@ -213,15 +213,15 @@ private static Stream provideWarningsModel() {
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
- + DSL model builder for CurrentLimitAutomaton
- 'iMeasurement' field value 'NGEN' not found for equipment type(s) Quadripole
+ + DSL model builder for OverloadManagementSystem
+ 'iMeasurement' field value 'NGEN' not found for equipment type(s) BRANCH
Model CLA_NGEN cannot be instantiated
"""),
Arguments.of("/warnings/claMissingMeasurementSide.groovy", EurostagTutorialExample1Factory.create(),
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
- + DSL model builder for CurrentLimitAutomaton
+ + DSL model builder for OverloadManagementSystem
'iMeasurementSide' field is not set
Model CLA_NGEN cannot be instantiated
"""),
@@ -229,23 +229,23 @@ private static Stream provideWarningsModel() {
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
- + DSL model builder for CurrentLimitAutomaton
- 'controlledQuadripole' field value 'GEN' not found for equipment type(s) Quadripole
+ + DSL model builder for OverloadManagementSystem
+ 'controlledBranch' field value 'GEN' not found for equipment type(s) BRANCH
Model CLA_NGEN cannot be instantiated
"""),
Arguments.of("/warnings/cla2MissingMeasurement2.groovy", EurostagTutorialExample1Factory.create(),
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
- + DSL model builder for CurrentLimitAutomatonTwoLevels
- 'iMeasurement2' field value 'NGEN' not found for equipment type(s) Quadripole
+ + DSL model builder for TwoLevelsOverloadManagementSystem
+ 'iMeasurement2' field value 'NGEN' not found for equipment type(s) BRANCH
Model CLA_NGEN cannot be instantiated
"""),
Arguments.of("/warnings/cla2MissingMeasurementSide2.groovy", EurostagTutorialExample1Factory.create(),
"""
+ DSL tests
+ Groovy Dynamic Models Supplier
- + DSL model builder for CurrentLimitAutomatonTwoLevels
+ + DSL model builder for TwoLevelsOverloadManagementSystem
'iMeasurement2Side' field is not set
Model CLA_NGEN cannot be instantiated
"""),
@@ -264,9 +264,8 @@ private static Stream provideWarningsModel() {
+ DSL tests
+ Groovy Dynamic Models Supplier
+ DSL model builder for TapChangerBlockingAutomaton
- 'uMeasurements' field value 'LOAD' not found for equipment type(s) BUS/BUSBAR_SECTION
- 'uMeasurements' field value 'Wrong_ID' not found for equipment type(s) BUS/BUSBAR_SECTION
- 'uMeasurements' field value 'NGEN_NHV1' not found for equipment type(s) BUS/BUSBAR_SECTION
+ 'uMeasurements' field value '[LOAD, Wrong_ID]' not found for equipment type(s) BUS/BUSBAR_SECTION
+ 'uMeasurements' field value '[NGEN_NHV1]' not found for equipment type(s) BUS/BUSBAR_SECTION
'uMeasurements' list is empty
Model ZAB cannot be instantiated
"""),
@@ -275,8 +274,9 @@ private static Stream provideWarningsModel() {
+ DSL tests
+ Groovy Dynamic Models Supplier
+ DSL model builder for TapChangerBlockingAutomaton
- 'uMeasurements' field value 'GEN' not found for equipment type(s) LOAD/TWO_WINDINGS_TRANSFORMER
- 'transformers' list is empty
+ 'transformers' field value 'GEN' not found for equipment type(s) TWO_WINDINGS_TRANSFORMER/LOAD, id will be used as pure dynamic model id
+ 'uMeasurements' field value 'GEN' not found for equipment type(s) BUS/BUSBAR_SECTION
+ 'uMeasurements' list is empty
Model ZAB cannot be instantiated
"""),
Arguments.of("/warnings/hvdcVscWrongStaticType.groovy", HvdcTestNetwork.createLcc(),
diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java
index 9da3e744f..daae12680 100644
--- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java
+++ b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java
@@ -68,7 +68,7 @@ void assertEventModel(AbstractEvent em, String dynamicId, String equipmentStatic
private static Stream provideEventModelData() {
return Stream.of(
- Arguments.of("/eventModels/quadripoleDisconnection.groovy", EventQuadripoleDisconnection.class, EurostagTutorialExample1Factory.create(), "NHV1_NHV2_1", "Disconnect_NHV1_NHV2_1", "EventQuadripoleDisconnection", 4),
+ Arguments.of("/eventModels/branchDisconnection.groovy", EventBranchDisconnection.class, EurostagTutorialExample1Factory.create(), "NHV1_NHV2_1", "Disconnect_NHV1_NHV2_1", "EventQuadripoleDisconnection", 4),
Arguments.of("/eventModels/equipmentDisconnection.groovy", EventInjectionDisconnection.class, EurostagTutorialExample1Factory.create(), "GEN", "Disconnect_GEN", null, 1),
Arguments.of("/eventModels/hvdcDisconnection.groovy", EventHvdcDisconnection.class, HvdcTestNetwork.createVsc(), "L", "Disconnect_L", null, 2),
Arguments.of("/eventModels/nodeFault.groovy", NodeFaultEvent.class, EurostagTutorialExample1Factory.create(), "NGEN", "NodeFault_NGEN", "NodeFault", 1),
@@ -124,7 +124,7 @@ faultTime should be strictly positive (0.0)
+ DSL tests
+ Groovy Event Models Supplier
+ DSL model builder for Disconnect
- 'disconnectSide' field is set but GENERATOR GEN does not possess this option
+ 'disconnectOnly' field is set but GENERATOR GEN does not possess this option
Model Disconnect_GEN cannot be instantiated
""")
);
diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14CurrentLimitAutomatonTest.java b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java
similarity index 65%
rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14CurrentLimitAutomatonTest.java
rename to dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java
index a1477a53b..46c16e084 100644
--- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14CurrentLimitAutomatonTest.java
+++ b/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java
@@ -19,18 +19,18 @@
/**
* @author Marcos de Miguel {@literal }
*/
-class Ieee14CurrentLimitAutomatonTest extends AbstractIeeeTest {
+class Ieee14DynamicOverloadManagementSystemTest extends AbstractIeeeTest {
@BeforeEach
void setup() throws IOException {
super.setup(
- "/ieee14-currentlimitautomaton/config/models.par",
- "/ieee14-currentlimitautomaton/config/network.par", "8",
- "/ieee14-currentlimitautomaton/config/solvers.par", "2",
- "/ieee14-currentlimitautomaton/powsybl-inputs/IEEE14.iidm",
- "/ieee14-currentlimitautomaton/powsybl-inputs/dynamicModels.groovy",
- "/ieee14-currentlimitautomaton/powsybl-inputs/eventModels.groovy",
- "/ieee14-currentlimitautomaton/powsybl-inputs/curves.groovy",
+ "/ieee14-overloadmanagementsystem/config/models.par",
+ "/ieee14-overloadmanagementsystem/config/network.par", "8",
+ "/ieee14-overloadmanagementsystem/config/solvers.par", "2",
+ "/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm",
+ "/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy",
+ "/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy",
+ "/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy",
0, 50
);
}
@@ -44,6 +44,6 @@ void testSimulation() throws Exception {
@Override
public String getWorkingDirName() {
- return "ieee14-currentlimitautomaton";
+ return "ieee14-overloadmanagementsystem";
}
}
diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels.groovy b/dynawaltz-dsl/src/test/resources/dynamicModels.groovy
index a9849a1ac..b6dfaf2cc 100644
--- a/dynawaltz-dsl/src/test/resources/dynamicModels.groovy
+++ b/dynawaltz-dsl/src/test/resources/dynamicModels.groovy
@@ -70,7 +70,7 @@ for (Generator gen : network.generators) {
}
for (Line line : network.lines) {
- CurrentLimitAutomaton {
+ OverloadManagementSystem {
dynamicModelId "BBM_" + line.id
parameterSetId "CLA"
iMeasurement line.id
diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/currentLimit.groovy b/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagement
similarity index 88%
rename from dynawaltz-dsl/src/test/resources/dynamicModels/currentLimit.groovy
rename to dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagement
index 3d4ed0531..e11998b3a 100644
--- a/dynawaltz-dsl/src/test/resources/dynamicModels/currentLimit.groovy
+++ b/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagement
@@ -10,10 +10,10 @@ package dynamicModels
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "AM_NHV1_NHV2_1"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement "NHV1_NHV2_1"
iMeasurementSide TwoSides.TWO
}
diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/currentLimitTwoLevels.groovy b/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy
similarity index 88%
rename from dynawaltz-dsl/src/test/resources/dynamicModels/currentLimitTwoLevels.groovy
rename to dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy
index 2d47e3581..8f16bd4b6 100644
--- a/dynawaltz-dsl/src/test/resources/dynamicModels/currentLimitTwoLevels.groovy
+++ b/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy
@@ -10,10 +10,10 @@ package dynamicModels
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomatonTwoLevels {
+TwoLevelsOverloadManagementSystem {
dynamicModelId "AM_NHV1_NHV2_1"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement1 "NHV1_NHV2_1"
iMeasurement1Side TwoSides.TWO
iMeasurement2 "NGEN_NHV1"
diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy b/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy
index d11424d4b..5d41fb5f0 100644
--- a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy
+++ b/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy
@@ -8,9 +8,11 @@
package dynamicModels
+List[] measurements = [["OldId", "NGEN", "NHV1"], ["NHV1", "OldId"], ["NHV2"]]
+
TapChangerBlockingAutomaton {
dynamicModelId "ZAB"
parameterSetId "ZAB"
- uMeasurements ["OldId", "NGEN", "NHV1"], ["NHV1", "OldId"], ["NHV2"]
+ uMeasurements measurements
transformers "NGEN_NHV1", "NHV2_NLOAD", "LOAD"
}
diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy b/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy
index 3372d8f88..1a3274b70 100644
--- a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy
+++ b/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy
@@ -8,10 +8,11 @@
package dynamicModels
+def measurements = ["S1VL2_BBS1", "OldId", "S3VL1_BBS"]
TapChangerBlockingAutomaton {
dynamicModelId "ZAB"
parameterSetId "ZAB"
- uMeasurements "S1VL2_BBS1", "OldId", "S3VL1_BBS"
+ uMeasurements measurements
transformers "TWT", "LD1"
}
diff --git a/dynawaltz-dsl/src/test/resources/eventModels/quadripoleDisconnection.groovy b/dynawaltz-dsl/src/test/resources/eventModels/branchDisconnection.groovy
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/eventModels/quadripoleDisconnection.groovy
rename to dynawaltz-dsl/src/test/resources/eventModels/branchDisconnection.groovy
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd
index 0fdd5547b..ff83b9a4d 100644
--- a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd
+++ b/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd
@@ -75,7 +75,7 @@
-
+
@@ -119,5 +119,5 @@
-
+
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/models.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/models.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/network.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/network.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/solvers.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/config/solvers.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/ieee14bus.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/ieee14bus.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/models.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/models.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/network.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/network.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.crv b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.crv
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.crv
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.crv
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd
similarity index 97%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.dyd
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd
index f778cd73f..c5a160aea 100644
--- a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.dyd
+++ b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd
@@ -84,7 +84,7 @@
-
+
@@ -132,5 +132,5 @@
-
+
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.jobs b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.jobs
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.xiidm b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.xiidm
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/powsybl_dynawaltz.xiidm
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.xiidm
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/solvers.par b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-inputs/solvers.par
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-outputs/curves.csv b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-outputs/curves.csv
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-outputs/timeline.log b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/dynawaltz-outputs/timeline.log
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/IEEE14.iidm b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/IEEE14.iidm
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/curves.groovy b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/curves.groovy
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/dynamicModels.groovy b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy
similarity index 89%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/dynamicModels.groovy
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy
index 6a5457d7f..5822840a5 100644
--- a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/dynamicModels.groovy
+++ b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy
@@ -32,18 +32,18 @@ for (Generator gen : network.generators) {
}
}
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "CLA_2_4"
parameterSetId "CLA_2_4"
- controlledQuadripole "_BUS____2-BUS____4-1_AC"
+ controlledBranch "_BUS____2-BUS____4-1_AC"
iMeasurement "_BUS____2-BUS____4-1_AC"
iMeasurementSide TwoSides.TWO
}
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "CLA_2_5"
parameterSetId "CLA_2_5"
- controlledQuadripole "_BUS____2-BUS____5-1_AC"
+ controlledBranch "_BUS____2-BUS____5-1_AC"
iMeasurement "_BUS____2-BUS____5-1_AC"
iMeasurementSide TwoSides.TWO
}
diff --git a/dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/eventModels.groovy b/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy
similarity index 100%
rename from dynawaltz-dsl/src/test/resources/ieee14-currentlimitautomaton/powsybl-inputs/eventModels.groovy
rename to dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy
diff --git a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy b/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy
index 3f9c32d81..199b834c3 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy
@@ -10,10 +10,10 @@ package warnings
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomatonTwoLevels {
+TwoLevelsOverloadManagementSystem {
dynamicModelId "CLA_NGEN"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement1 "NHV1_NHV2_1"
iMeasurement1Side TwoSides.TWO
iMeasurement2 "NGEN"
diff --git a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy b/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy
index bcf6345ea..32eb99e99 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy
@@ -10,10 +10,10 @@ package warnings
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomatonTwoLevels {
+TwoLevelsOverloadManagementSystem {
dynamicModelId "CLA_NGEN"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement1 "NHV1_NHV2_1"
iMeasurement1Side TwoSides.TWO
iMeasurement2 "NHV1_NHV2_2"
diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy b/dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy
index 0e7d57c6b..86393d320 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy
@@ -10,10 +10,10 @@ package warnings
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "CLA_NGEN"
parameterSetId "CLA"
- controlledQuadripole "GEN"
+ controlledBranch "GEN"
iMeasurement "NHV1_NHV2_1"
iMeasurementSide TwoSides.TWO
}
diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy b/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy
index f5e5b3e21..4d6b6c37e 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy
@@ -10,10 +10,10 @@ package warnings
import com.powsybl.iidm.network.TwoSides
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "CLA_NGEN"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement "NGEN"
iMeasurementSide TwoSides.TWO
}
diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy b/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy
index c536f5771..5a9120e09 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy
@@ -8,9 +8,9 @@
package warnings
-CurrentLimitAutomaton {
+OverloadManagementSystem {
dynamicModelId "CLA_NGEN"
parameterSetId "CLA"
- controlledQuadripole "NHV1_NHV2_2"
+ controlledBranch "NHV1_NHV2_2"
iMeasurement "NHV1_NHV2_1"
}
diff --git a/dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy b/dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy
index fadc96fe4..dedb879b9 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy
@@ -5,13 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
-
package warnings
TapChangerBlockingAutomaton {
dynamicModelId "ZAB"
parameterSetId "ZAB"
- uMeasurements "NGEN"
+ uMeasurements "GEN"
transformers "GEN"
}
diff --git a/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy b/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy
index 036e8aa03..739eb6d00 100644
--- a/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy
+++ b/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy
@@ -5,13 +5,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
-
package warnings
+List[] measurementPoints = [["LOAD", "Wrong_ID"], ["NGEN_NHV1"]]
TapChangerBlockingAutomaton {
dynamicModelId "ZAB"
parameterSetId "ZAB"
- uMeasurements ["LOAD", "Wrong_ID"], ["NGEN_NHV1"]
+ uMeasurements measurementPoints
transformers "NGEN_NHV1", "NHV2_NLOAD", "LOAD"
}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java
index bb2736d3a..927db67a4 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java
@@ -59,7 +59,7 @@ public static void reportDuplicateDynamicId(Reporter reporter, String duplicateI
public static void reportEmptyAutomaton(Reporter reporter, String automatonName, String dynamicId, String expectedModels) {
reporter.report(Report.builder()
.withKey("emptyAutomaton")
- .withDefaultMessage("${automatonName} ${dynamicId} equipment is not a ${expectedModels}, the automaton will be skipped")
+ .withDefaultMessage("${automatonName} ${dynamicId} equipment is not a ${expectedModels}, the automation system will be skipped")
.withValue("automatonName", automatonName)
.withValue("dynamicId", dynamicId)
.withValue("expectedModels", expectedModels)
@@ -70,7 +70,7 @@ public static void reportEmptyAutomaton(Reporter reporter, String automatonName,
public static void reportEmptyListAutomaton(Reporter reporter, String automatonName, String dynamicId, String expectedModels) {
reporter.report(Report.builder()
.withKey("emptyListAutomaton")
- .withDefaultMessage("None of ${automatonName} ${dynamicId} equipments are ${expectedModels}, the automaton will be skipped")
+ .withDefaultMessage("None of ${automatonName} ${dynamicId} equipments are ${expectedModels}, the automation system will be skipped")
.withValue("automatonName", automatonName)
.withValue("dynamicId", dynamicId)
.withValue("expectedModels", expectedModels)
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java
index eb9949068..35205f032 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java
@@ -10,6 +10,8 @@
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.iidm.network.Network;
+import java.util.Objects;
+
/**
* @author Laurent Issertial {@literal }
*/
@@ -20,8 +22,8 @@ public abstract class AbstractDynamicModelBuilder {
protected boolean isInstantiable = true;
protected AbstractDynamicModelBuilder(Network network, Reporter reporter) {
- this.network = network;
- this.reporter = reporter;
+ this.network = Objects.requireNonNull(network);
+ this.reporter = Objects.requireNonNull(reporter);
}
protected abstract void checkData();
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java
index d3fd85281..437440ef2 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java
@@ -12,6 +12,8 @@
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;
+import java.util.Objects;
+
/**
* @author Laurent Issertial {@literal }
*/
@@ -24,7 +26,7 @@ public abstract class AbstractEquipmentModelBuilder, R
protected AbstractEquipmentModelBuilder(Network network, ModelConfig modelConfig, IdentifiableType equipmentType, Reporter reporter) {
super(network, reporter);
- this.modelConfig = modelConfig;
+ this.modelConfig = Objects.requireNonNull(modelConfig);
this.builderEquipment = new BuilderEquipment<>(equipmentType);
}
@@ -39,6 +41,11 @@ public R staticId(String staticId) {
return self();
}
+ public R equipment(T equipment) {
+ builderEquipment.addEquipment(equipment, this::checkEquipment);
+ return self();
+ }
+
public R dynamicModelId(String dynamicModelId) {
this.dynamicModelId = dynamicModelId;
return self();
@@ -64,6 +71,10 @@ protected void checkData() {
protected abstract T findEquipment(String staticId);
+ protected boolean checkEquipment(T equipment) {
+ return Objects.equals(network, equipment.getNetwork());
+ }
+
public T getEquipment() {
return builderEquipment.getEquipment();
}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java
index 119b1271d..1030b2a2a 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java
@@ -12,6 +12,7 @@
import com.powsybl.iidm.network.IdentifiableType;
import java.util.function.Function;
+import java.util.function.Predicate;
/**
* Represents an equipment field identified by a static ID in a builder
@@ -21,6 +22,11 @@
*/
public class BuilderEquipment> {
+ private static final String DEFAULT_FIELD_NAME = "staticId";
+
+ private static final String EQUIPMENT_FIELD_NAME = "equipment";
+
+ protected boolean fromStaticId;
protected String staticId;
protected T equipment;
private final String equipmentType;
@@ -37,24 +43,37 @@ public BuilderEquipment(IdentifiableType identifiableType, String fieldName) {
}
public BuilderEquipment(IdentifiableType identifiableType) {
- this(identifiableType, "staticId");
+ this(identifiableType, DEFAULT_FIELD_NAME);
}
public BuilderEquipment(String equipmentType) {
- this(equipmentType, "staticId");
+ this(equipmentType, DEFAULT_FIELD_NAME);
}
public void addEquipment(String equipmentId, Function equipmentSupplier) {
+ fromStaticId = true;
staticId = equipmentId;
equipment = equipmentSupplier.apply(staticId);
}
+ public void addEquipment(T equipment, Predicate equipmentChecker) {
+ fromStaticId = false;
+ staticId = equipment.getId();
+ if (equipmentChecker.test(equipment)) {
+ this.equipment = equipment;
+ }
+ }
+
public boolean checkEquipmentData(Reporter reporter) {
if (!hasStaticId()) {
Reporters.reportFieldNotSet(reporter, fieldName);
return false;
} else if (equipment == null) {
- Reporters.reportStaticIdUnknown(reporter, fieldName, staticId, equipmentType);
+ if (fromStaticId) {
+ Reporters.reportStaticIdUnknown(reporter, fieldName, staticId, equipmentType);
+ } else {
+ Reporters.reportDifferentNetwork(reporter, EQUIPMENT_FIELD_NAME, staticId, equipmentType);
+ }
return false;
}
return true;
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java
new file mode 100644
index 000000000..f69cbbe6d
--- /dev/null
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2024, RTE (http://www.rte-france.com/)
+ * 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/.
+ * SPDX-License-Identifier: MPL-2.0
+ */
+package com.powsybl.dynawaltz.builders;
+
+import com.powsybl.commons.reporter.Reporter;
+import com.powsybl.iidm.network.Identifiable;
+import com.powsybl.iidm.network.IdentifiableType;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+
+/**
+ * @author Laurent Issertial {@literal }
+ */
+public class BuilderEquipmentsList> {
+
+ private final String equipmentType;
+ private final String fieldName;
+ // when set to true equipment ids not found in the network are seen as dynamic ids for automatons and reported as such
+ private final boolean missingIdsHasDynamicIds;
+ protected List missingEquipmentIds = new ArrayList<>();
+ protected final List equipments = new ArrayList<>();
+
+ public BuilderEquipmentsList(IdentifiableType identifiableType, String fieldName) {
+ this(identifiableType.toString(), fieldName, false);
+ }
+
+ public BuilderEquipmentsList(String equipmentType, String fieldName) {
+ this(equipmentType, fieldName, false);
+ }
+
+ public BuilderEquipmentsList(String equipmentType, String fieldName, boolean missingIdsHasDynamicIds) {
+ this.equipmentType = equipmentType;
+ this.fieldName = fieldName;
+ this.missingIdsHasDynamicIds = missingIdsHasDynamicIds;
+ }
+
+ public void addEquipments(String[] staticIds, Function equipmentsSupplier) {
+ addEquipments(() -> Arrays.stream(staticIds).iterator(), equipmentsSupplier);
+ }
+
+ public void addEquipments(Iterable staticIds, Function equipmentsSupplier) {
+ staticIds.forEach(id -> {
+ T equipment = equipmentsSupplier.apply(id);
+ if (equipment != null) {
+ equipments.add(equipment);
+ } else {
+ missingEquipmentIds.add(id);
+ }
+ });
+ }
+
+ public boolean checkEquipmentData(Reporter reporter) {
+ boolean emptyList = equipments.isEmpty();
+ if (missingEquipmentIds.isEmpty() && emptyList) {
+ Reporters.reportFieldNotSet(reporter, fieldName);
+ return false;
+ } else if (!missingIdsHasDynamicIds) {
+ missingEquipmentIds.forEach(missingId ->
+ Reporters.reportStaticIdUnknown(reporter, fieldName, missingId, equipmentType));
+ if (emptyList) {
+ Reporters.reportEmptyList(reporter, fieldName);
+ }
+ return !emptyList;
+ } else {
+ missingEquipmentIds.forEach(missingId ->
+ Reporters.reportUnknownStaticIdHandling(reporter, fieldName, missingId, equipmentType));
+ return true;
+ }
+ }
+
+ public List getEquipments() {
+ return equipments;
+ }
+
+ public List getMissingEquipmentIds() {
+ return missingEquipmentIds;
+ }
+}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java
new file mode 100644
index 000000000..01071cbb1
--- /dev/null
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2024, RTE (http://www.rte-france.com/)
+ * 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/.
+ * SPDX-License-Identifier: MPL-2.0
+ */
+package com.powsybl.dynawaltz.builders;
+
+import com.powsybl.iidm.network.Identifiable;
+
+import java.util.Collection;
+import java.util.Objects;
+import java.util.function.Function;
+
+/**
+ * @author Laurent Issertial {@literal }
+ */
+public class BuilderIdListEquipmentList> extends BuilderEquipmentsList {
+
+ public BuilderIdListEquipmentList(String equipmentType, String fieldName) {
+ super(equipmentType, fieldName);
+ }
+
+ public void addEquipments(Collection[] staticIdsArray, Function equipmentSupplier) {
+ for (Collection staticIds : staticIdsArray) {
+ addEquipment(staticIds, equipmentSupplier);
+ }
+ }
+
+ private void addEquipment(Collection staticIds, Function equipmentSupplier) {
+ staticIds.stream()
+ .map(equipmentSupplier)
+ .filter(Objects::nonNull)
+ .findFirst()
+ .ifPresentOrElse(equipments::add,
+ () -> missingEquipmentIds.add(staticIds.toString()));
+ }
+}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java
index f10c4bf1a..b6acfaf13 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java
@@ -8,6 +8,7 @@
package com.powsybl.dynawaltz.builders;
import com.powsybl.iidm.network.Identifiable;
+import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;
/**
@@ -15,6 +16,8 @@
*/
public final class BuildersUtil {
+ public static final String MEASUREMENT_POINT_TYPE = IdentifiableType.BUS + "/" + IdentifiableType.BUSBAR_SECTION;
+
private BuildersUtil() {
}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java
index 0fa77d683..2c11d91b6 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java
@@ -24,7 +24,7 @@ public interface ModelConfigLoader {
String getModelConfigFileName();
- default Map> loadModelConfigs() {
+ default Map loadModelConfigs() {
try {
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java
index 4b4cb32bc..a2c1bdb06 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java
@@ -8,13 +8,13 @@
package com.powsybl.dynawaltz.builders;
import com.google.auto.service.AutoService;
-import com.powsybl.dynawaltz.models.automatons.TapChangerAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.TapChangerBlockingAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.UnderVoltageAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.currentlimits.CurrentLimitAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.currentlimits.CurrentLimitTwoLevelsAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterIAutomatonBuilder;
-import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterPAutomatonBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.TapChangerAutomationSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.TapChangerBlockingAutomationSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.UnderVoltageAutomationSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder;
+import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystemBuilder;
import com.powsybl.dynawaltz.models.buses.InfiniteBusBuilder;
import com.powsybl.dynawaltz.models.buses.StandardBusBuilder;
import com.powsybl.dynawaltz.models.generators.*;
@@ -36,13 +36,13 @@ public final class ModelConfigLoaderImpl implements ModelConfigLoader {
private static final String MODEL_CONFIG_FILENAME = "models.json";
private static final Stream BUILDER_CONFIGS = Stream.of(
- new BuilderConfig(CurrentLimitAutomatonBuilder::of, CurrentLimitAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(CurrentLimitTwoLevelsAutomatonBuilder::of, CurrentLimitTwoLevelsAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(TapChangerAutomatonBuilder::of, TapChangerAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(TapChangerBlockingAutomatonBuilder::of, TapChangerBlockingAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(UnderVoltageAutomatonBuilder::of, UnderVoltageAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(PhaseShifterPAutomatonBuilder::of, PhaseShifterPAutomatonBuilder::getSupportedLibs),
- new BuilderConfig(PhaseShifterIAutomatonBuilder::of, PhaseShifterIAutomatonBuilder::getSupportedLibs),
+ new BuilderConfig(DynamicOverloadManagementSystemBuilder::of, DynamicOverloadManagementSystemBuilder::getSupportedLibs),
+ new BuilderConfig(DynamicTwoLevelsOverloadManagementSystemBuilder::of, DynamicTwoLevelsOverloadManagementSystemBuilder::getSupportedLibs),
+ new BuilderConfig(TapChangerAutomationSystemBuilder::of, TapChangerAutomationSystemBuilder::getSupportedLibs),
+ new BuilderConfig(TapChangerBlockingAutomationSystemBuilder::of, TapChangerBlockingAutomationSystemBuilder::getSupportedLibs),
+ new BuilderConfig(UnderVoltageAutomationSystemBuilder::of, UnderVoltageAutomationSystemBuilder::getSupportedLibs),
+ new BuilderConfig(PhaseShifterPAutomationSystemBuilder::of, PhaseShifterPAutomationSystemBuilder::getSupportedLibs),
+ new BuilderConfig(PhaseShifterIAutomationSystemBuilder::of, PhaseShifterIAutomationSystemBuilder::getSupportedLibs),
new BuilderConfig(StandardBusBuilder::of, StandardBusBuilder::getSupportedLibs),
new BuilderConfig(InfiniteBusBuilder::of, InfiniteBusBuilder::getSupportedLibs),
new BuilderConfig(TransformerFixedRatioBuilder::of, TransformerFixedRatioBuilder::getSupportedLibs),
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java
index f139af128..87c866562 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java
@@ -7,55 +7,55 @@
*/
package com.powsybl.dynawaltz.builders;
-import com.google.common.collect.Lists;
-import com.powsybl.dynawaltz.models.events.EventActivePowerVariationBuilder;
-import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder;
-import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import java.util.ServiceLoader;
+import java.util.Objects;
+import java.util.Set;
/**
* @author Laurent Issertial {@literal }
*/
-public final class ModelConfigs {
-
- private static final ModelConfigs INSTANCE = new ModelConfigs();
-
- private final List modelConfigLoaders;
- private final Map> modelConfigsMap = new HashMap<>();
- private final List builderConfigs;
- private final List eventBuilderConfigs = List.of(
- new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG),
- new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG),
- new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG));
-
- private ModelConfigs() {
- modelConfigLoaders = Lists.newArrayList(ServiceLoader.load(ModelConfigLoader.class));
- modelConfigLoaders.forEach(l -> l.loadModelConfigs().forEach(
- (cat, modelsMap) -> modelConfigsMap.merge(cat, modelsMap, (map1, map2) -> {
- map1.putAll(map2);
- return map1;
- })
- ));
- builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList();
+public class ModelConfigs {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ModelConfigs.class);
+
+ private ModelConfig defaultModelConfig;
+ private final Map modelConfigMap;
+
+ ModelConfigs(Map modelConfigMap, String defaultModelConfigName) {
+ this.modelConfigMap = Objects.requireNonNull(modelConfigMap);
+ if (defaultModelConfigName != null) {
+ this.defaultModelConfig = Objects.requireNonNull(modelConfigMap.get(defaultModelConfigName));
+ }
+ }
+
+ public boolean hasDefaultModelConfig() {
+ return defaultModelConfig != null;
}
- public static ModelConfigs getInstance() {
- return INSTANCE;
+ public ModelConfig getDefaultModelConfig() {
+ return defaultModelConfig;
}
- public Map getModelConfigs(String categoryName) {
- return modelConfigsMap.get(categoryName);
+ public ModelConfig getModelConfig(String libName) {
+ return modelConfigMap.get(libName);
}
- public List getBuilderConfigs() {
- return builderConfigs;
+ public Set getSupportedLibs() {
+ return modelConfigMap.keySet();
}
- public List getEventBuilderConfigs() {
- return eventBuilderConfigs;
+ void addModelConfigs(ModelConfigs modelConfigsToMerge) {
+ modelConfigMap.putAll(modelConfigsToMerge.modelConfigMap);
+ if (hasDefaultModelConfig() && modelConfigsToMerge.hasDefaultModelConfig()) {
+ LOGGER.warn("Default model configs {} & {} found, the first one will be kept",
+ defaultModelConfig.lib(),
+ modelConfigsToMerge.getDefaultModelConfig().lib());
+ } else if (!hasDefaultModelConfig()) {
+ defaultModelConfig = modelConfigsToMerge.defaultModelConfig;
+ }
+ modelConfigMap.putAll(modelConfigsToMerge.modelConfigMap);
}
}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java
new file mode 100644
index 000000000..284938126
--- /dev/null
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2024, RTE (http://www.rte-france.com/)
+ * 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/.
+ * SPDX-License-Identifier: MPL-2.0
+ */
+package com.powsybl.dynawaltz.builders;
+
+import com.google.common.collect.Lists;
+import com.powsybl.dynawaltz.models.events.EventActivePowerVariationBuilder;
+import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder;
+import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+
+/**
+ * @author Laurent Issertial {@literal }
+ */
+public final class ModelConfigsHandler {
+
+ private static final ModelConfigsHandler INSTANCE = new ModelConfigsHandler();
+
+ private final Map modelConfigsCat = new HashMap<>();
+
+ private final List builderConfigs;
+ private final List eventBuilderConfigs = List.of(
+ new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG),
+ new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG),
+ new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG));
+
+ private ModelConfigsHandler() {
+ List modelConfigLoaders = Lists.newArrayList(ServiceLoader.load(ModelConfigLoader.class));
+ modelConfigLoaders.forEach(l -> l.loadModelConfigs().forEach(
+ (cat, modelsMap) -> modelConfigsCat.merge(cat, modelsMap, (configs1, configs2) -> {
+ configs1.addModelConfigs(configs2);
+ return configs1;
+ })
+ ));
+ builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList();
+ }
+
+ public static ModelConfigsHandler getInstance() {
+ return INSTANCE;
+ }
+
+ public ModelConfigs getModelConfigs(String categoryName) {
+ return modelConfigsCat.get(categoryName);
+ }
+
+ public List getBuilderConfigs() {
+ return builderConfigs;
+ }
+
+ public List getEventBuilderConfigs() {
+ return eventBuilderConfigs;
+ }
+}
diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java
index 6b44844a4..31536a9f4 100644
--- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java
+++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java
@@ -20,15 +20,15 @@
/**
* @author Laurent Issertial {@literal }
*/
-public class ModelConfigsJsonDeserializer extends StdDeserializer