diff --git a/dynawaltz-dsl/pom.xml b/dynawaltz-dsl/pom.xml
index 72fcdcf4e..1f9b0f6be 100644
--- a/dynawaltz-dsl/pom.xml
+++ b/dynawaltz-dsl/pom.xml
@@ -51,6 +51,10 @@
com.powsybl
powsybl-dynawaltz
+
+ org.apache.groovy
+ groovy-json
+
diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/AbstractEquipmentGroovyExtension.groovy b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/AbstractEquipmentGroovyExtension.groovy
index 770ae5d2c..eff5dc3af 100644
--- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/AbstractEquipmentGroovyExtension.groovy
+++ b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/AbstractEquipmentGroovyExtension.groovy
@@ -11,15 +11,12 @@ import com.powsybl.dynawaltz.DynaWaltzProvider
import com.powsybl.iidm.network.Network
import java.util.function.Consumer
-
/**
* @author Laurent Issertial
*/
abstract class AbstractEquipmentGroovyExtension {
- protected static final String MODELS_CONFIG = "models.cfg"
- protected static final String MODEL_PREFIX = "prefix"
- protected static final String MODEL_PROPERTIES = "properties"
+ protected static final String MODELS_CONFIG = "models.json"
protected final List equipmentConfigs
@@ -28,14 +25,7 @@ abstract class AbstractEquipmentGroovyExtension {
}
protected AbstractEquipmentGroovyExtension(String modelTag, URL modelConfigUrl) {
- ConfigSlurper config = new ConfigSlurper()
- equipmentConfigs = config.parse(modelConfigUrl).get(modelTag).collect {
- new EquipmentConfig(
- it.key as String,
- it.value.get(MODEL_PREFIX) as String,
- it.value.get(MODEL_PROPERTIES).collect{it.toUpperCase()} as String[]
- )
- }
+ equipmentConfigs = ModelsSlurper.instance.getEquipmentConfigs(modelConfigUrl, modelTag)
}
abstract protected ModelBuilder createBuilder(Network network, EquipmentConfig equipmentConfig);
diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/EquipmentConfig.groovy b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/EquipmentConfig.groovy
index b6f22243f..2cf052484 100644
--- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/EquipmentConfig.groovy
+++ b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/EquipmentConfig.groovy
@@ -14,7 +14,7 @@ class EquipmentConfig {
EquipmentConfig(String lib, String prefix, String... properties) {
this.lib = lib
this.prefix = prefix
- this.properties = properties
+ this.properties = properties ? properties.collect{it.toUpperCase()} as List : [] as List
}
boolean isControllable() {
diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/ModelsSlurper.groovy b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/ModelsSlurper.groovy
new file mode 100644
index 000000000..e66ae2e2a
--- /dev/null
+++ b/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/ModelsSlurper.groovy
@@ -0,0 +1,34 @@
+/**
+ * Copyright (c) 2023, 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.dsl
+
+import groovy.json.JsonSlurper
+import org.apache.groovy.json.internal.LazyMap
+
+/**
+ * @author Laurent Issertial
+ */
+@Singleton
+class ModelsSlurper {
+
+ private static final String MODEL_LIB = "lib"
+ private static final String MODEL_PREFIX = "prefix"
+ private static final String MODEL_PROPERTIES = "properties"
+
+ private final slurper = new JsonSlurper()
+ private final Map libsList = new HashMap<>()
+
+ def getEquipmentConfigs(URL url, String modelTag) {
+ libsList.computeIfAbsent(url, u -> slurper.parse(u))[modelTag].collect() {
+ new EquipmentConfig(
+ it[MODEL_LIB] as String,
+ it[MODEL_PREFIX] as String,
+ it[MODEL_PROPERTIES] as String[])
+ }
+ }
+}
diff --git a/dynawaltz-dsl/src/main/resources/models.cfg b/dynawaltz-dsl/src/main/resources/models.cfg
deleted file mode 100644
index a04d38a7a..000000000
--- a/dynawaltz-dsl/src/main/resources/models.cfg
+++ /dev/null
@@ -1,107 +0,0 @@
-synchronousGenerators {
- GeneratorSynchronousFourWindings
- GeneratorSynchronousFourWindingsGoverPropVRPropInt.properties = ["Controllable"]
- GeneratorSynchronousFourWindingsGovSteam1ExcIEEEST4B
- GeneratorSynchronousFourWindingsGovSteam1ExcIEEEST4BPssIEEE2B
- GeneratorSynchronousFourWindingsPmConstVRNordic
- GeneratorSynchronousFourWindingsPmConstVRNordicTfo
- GeneratorSynchronousFourWindingsProportionalRegulations.properties = ["Controllable"]
- GeneratorSynchronousFourWindingsTGov1Sexs
- GeneratorSynchronousFourWindingsTGov1SexsPss2A
- GeneratorSynchronousFourWindingsVRKundur
- GeneratorSynchronousFourWindingsVRKundurPssKundur
- GeneratorSynchronousProportionalRegulationsInternalParameters
- GeneratorSynchronousThreeWindings
- GeneratorSynchronousThreeWindingsGoverNordicVRNordic
- GeneratorSynchronousThreeWindingsGoverNordicVRNordicTfo
- GeneratorSynchronousThreeWindingsGoverPropVRPropInt.properties = ["Controllable"]
- GeneratorSynchronousThreeWindingsPmConstVRNordic
- GeneratorSynchronousThreeWindingsPmConstVRNordicTfo
- GeneratorSynchronousThreeWindingsProportionalRegulations.properties = ["Controllable"]
-}
-
-synchronizedGenerators {
- GeneratorPQ
- GeneratorPV.properties = ["Controllable"]
- GeneratorPVFixed
- GeneratorPVDiagramPQ
-}
-
-hvdcPv {
- HvdcPV
- HvdcPVEmulation
- HvdcPVEmulationSet
- HvdcPVDiagramPQ
- HvdcPVDiagramPQEmulation
- HvdcPVDiagramPQEmulationSet
- HvdcPTanPhi
- HvdcPTanPhiDiagramPQ
- HvdcPVDangling.properties = ["Dangling"]
- HvdcPVDanglingDiagramPQ.properties = ["Dangling"]
- HvdcPTanPhiDangling.properties = ["Dangling"]
- HvdcPTanPhiDanglingDiagramPQ.properties = ["Dangling"]
-}
-
-hvdcVsc {
- HvdcVSC
- HvdcVSCEmulation
- HvdcVSCDanglingP.properties = ["Dangling"]
- HvdcVSCDanglingUdc.properties = ["Dangling"]
-}
-
-infiniteBuses {
- InfiniteBus
- InfiniteBusWithImpedance
- InfiniteBusWithVariations
-}
-
-baseLoads {
- LoadAlphaBeta.properties = ["Controllable"]
- LoadAlphaBetaRestorative
- LoadAlphaBetaRestorativeLimitsRecalc
- LoadAlphaBetaMotor
- LoadPQ
-}
-
-staticVarCompensators {
- StaticVarCompensator
- StaticVarCompensatorPV
- StaticVarCompensatorPVModeHandling
- StaticVarCompensatorPVRemote
- StaticVarCompensatorPVRemoteModeHandling
- StaticVarCompensatorPVProp
- StaticVarCompensatorPVPropModeHandling
- StaticVarCompensatorPVPropRemote
- StaticVarCompensatorPVPropRemoteModeHandling
-}
-
-transformers {
- TransformerFixedRatio
-}
-
-wecc {
- WTG4AWeccCurrentSource {
- prefix = "WTG4A"
- properties = ["Synchronized"]
- }
- WTG4BWeccCurrentSource {
- prefix = "WTG4B"
- properties = ["Synchronized"]
- }
- WT4AWeccCurrentSource.prefix = "WT4A"
- WT4BWeccCurrentSource.prefix = "WT4B"
- PhotovoltaicsWeccCurrentSource {
- prefix = "WTG4A"
- properties = ["Synchronized"]
- }
- PhotovoltaicsWeccVoltageSource {
- prefix = "photovoltaics"
- properties = ["Synchronized"]
- }
-}
-
-gridFormingConverter {
- GridFormingConverterDroopControl.properties = ["Synchronized"]
- GridFormingConverterMatchingControl.properties = ["Synchronized"]
- GridFormingConverterDispatchableVirtualOscillatorControl.properties = ["Synchronized"]
-}
diff --git a/dynawaltz-dsl/src/main/resources/models.json b/dynawaltz-dsl/src/main/resources/models.json
new file mode 100644
index 000000000..509b42c9a
--- /dev/null
+++ b/dynawaltz-dsl/src/main/resources/models.json
@@ -0,0 +1,283 @@
+{
+ "synchronousGenerators": [
+ {
+ "lib": "GeneratorSynchronousFourWindings"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsGoverPropVRPropInt",
+ "properties": [
+ "Controllable"
+ ]
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsGovSteam1ExcIEEEST4B"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsGovSteam1ExcIEEEST4BPssIEEE2B"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsPmConstVRNordic"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsPmConstVRNordicTfo"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsProportionalRegulations",
+ "properties": [
+ "Controllable"
+ ]
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsTGov1Sexs"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsTGov1SexsPss2A"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsVRKundur"
+ },
+ {
+ "lib": "GeneratorSynchronousFourWindingsVRKundurPssKundur"
+ },
+ {
+ "lib": "GeneratorSynchronousProportionalRegulationsInternalParameters"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindings"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsGoverNordicVRNordic"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsGoverNordicVRNordicTfo"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsGoverPropVRPropInt",
+ "properties": [
+ "Controllable"
+ ]
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsPmConstVRNordic"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsPmConstVRNordicTfo"
+ },
+ {
+ "lib": "GeneratorSynchronousThreeWindingsProportionalRegulations",
+ "properties": [
+ "Controllable"
+ ]
+ }
+ ],
+ "synchronizedGenerators": [
+ {
+ "lib": "GeneratorPQ"
+ },
+ {
+ "lib": "GeneratorPV",
+ "properties": [
+ "Controllable"
+ ]
+ },
+ {
+ "lib": "GeneratorPVFixed"
+ },
+ {
+ "lib": "GeneratorPVDiagramPQ"
+ }
+ ],
+ "hvdcPv": [
+ {
+ "lib": "HvdcPV"
+ },
+ {
+ "lib": "HvdcPVEmulation"
+ },
+ {
+ "lib": "HvdcPVEmulationSet"
+ },
+ {
+ "lib": "HvdcPVDiagramPQ"
+ },
+ {
+ "lib": "HvdcPVDiagramPQEmulation"
+ },
+ {
+ "lib": "HvdcPVDiagramPQEmulationSet"
+ },
+ {
+ "lib": "HvdcPTanPhi"
+ },
+ {
+ "lib": "HvdcPTanPhiDiagramPQ"
+ },
+ {
+ "lib": "HvdcPVDangling",
+ "properties": [
+ "Dangling"
+ ]
+ },
+ {
+ "lib": "HvdcPVDanglingDiagramPQ",
+ "properties": [
+ "Dangling"
+ ]
+ },
+ {
+ "lib": "HvdcPTanPhiDangling",
+ "properties": [
+ "Dangling"
+ ]
+ },
+ {
+ "lib": "HvdcPTanPhiDanglingDiagramPQ",
+ "properties": [
+ "Dangling"
+ ]
+ }
+ ],
+ "hvdcVsc": [
+ {
+ "lib": "HvdcVSC"
+ },
+ {
+ "lib": "HvdcVSCEmulation"
+ },
+ {
+ "lib": "HvdcVSCDanglingP",
+ "properties": [
+ "Dangling"
+ ]
+ },
+ {
+ "lib": "HvdcVSCDanglingUdc",
+ "properties": [
+ "Dangling"
+ ]
+ }
+ ],
+ "infiniteBuses": [
+ {
+ "lib": "InfiniteBus"
+ },
+ {
+ "lib": "InfiniteBusWithImpedance"
+ },
+ {
+ "lib": "InfiniteBusWithVariations"
+ }
+ ],
+ "baseLoads": [
+ {
+ "lib": "LoadAlphaBeta",
+ "properties": [
+ "Controllable"
+ ]
+ },
+ {
+ "lib": "LoadAlphaBetaRestorative"
+ },
+ {
+ "lib": "LoadAlphaBetaRestorativeLimitsRecalc"
+ },
+ {
+ "lib": "LoadAlphaBetaMotor"
+ },
+ {
+ "lib": "LoadPQ"
+ }
+ ],
+ "staticVarCompensators": [
+ {
+ "lib": "StaticVarCompensator"
+ },
+ {
+ "lib": "StaticVarCompensatorPV"
+ },
+ {
+ "lib": "StaticVarCompensatorPVModeHandling"
+ },
+ {
+ "lib": "StaticVarCompensatorPVRemote"
+ },
+ {
+ "lib": "StaticVarCompensatorPVRemoteModeHandling"
+ },
+ {
+ "lib": "StaticVarCompensatorPVProp"
+ },
+ {
+ "lib": "StaticVarCompensatorPVPropModeHandling"
+ },
+ {
+ "lib": "StaticVarCompensatorPVPropRemote"
+ },
+ {
+ "lib": "StaticVarCompensatorPVPropRemoteModeHandling"
+ }
+ ],
+ "transformers": [
+ {
+ "lib": "TransformerFixedRatio"
+ }
+ ],
+ "wecc": [
+ {
+ "lib": "WTG4AWeccCurrentSource",
+ "prefix": "WTG4A",
+ "properties": [
+ "Synchronized"
+ ]
+ },
+ {
+ "lib": "WTG4BWeccCurrentSource",
+ "prefix": "WTG4B",
+ "properties": [
+ "Synchronized"
+ ]
+ },
+ {
+ "lib": "WT4AWeccCurrentSource",
+ "prefix": "WT4A"
+ },
+ {
+ "lib": "WT4BWeccCurrentSource",
+ "prefix": "WT4B"
+ },
+ {
+ "lib": "PhotovoltaicsWeccCurrentSource",
+ "prefix": "WTG4A",
+ "properties": [
+ "Synchronized"
+ ]
+ },
+ {
+ "lib": "PhotovoltaicsWeccVoltageSource",
+ "prefix": "photovoltaics",
+ "properties": [
+ "Synchronized"
+ ]
+ }
+ ],
+ "gridFormingConverter": [
+ {
+ "lib": "GridFormingConverterDroopControl",
+ "properties": [
+ "Synchronized"
+ ]
+ },
+ {
+ "lib": "GridFormingConverterMatchingControl",
+ "properties": [
+ "Synchronized"
+ ]
+ },
+ {
+ "lib": "GridFormingConverterDispatchableVirtualOscillatorControl",
+ "properties": [
+ "Synchronized"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4bdf0ab51..745b91a89 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,11 +56,8 @@
17
-
- 3.0.9
-
6.0.0-RC1
-
+ 4.0.14
../distribution/target/site/jacoco-aggregate/jacoco.xml,
@@ -144,6 +141,12 @@
powsybl-dynawo-integration-tests
${project.version}
+
+
+ org.apache.groovy
+ groovy-json
+ ${groovy.version}
+