From c884e56f8bb025ba1d3a2102869ce979d9dadf4b Mon Sep 17 00:00:00 2001 From: lisrte Date: Wed, 19 Jun 2024 10:04:02 +0200 Subject: [PATCH 01/28] Add model documentation in models.json Return formatted doc in DynamicModelGroovyExtension::getModelNames Signed-off-by: lisrte --- ...ynaWaltzDynamicModelGroovyExtension.groovy | 4 +- .../dynawaltz/builders/BuilderConfig.java | 7 +- .../dynawaltz/builders/ModelConfig.java | 13 +++- .../dynawaltz/builders/ModelConfigs.java | 11 ++- .../builders/ModelConfigsHandler.java | 2 +- .../ModelConfigsJsonDeserializer.java | 7 +- .../builders/ModelConfigsLibsInfo.java | 20 +++++ .../TapChangerAutomationSystemBuilder.java | 6 +- ...hangerBlockingAutomationSystemBuilder.java | 4 +- .../UnderVoltageAutomationSystemBuilder.java | 12 +-- ...ynamicOverloadManagementSystemBuilder.java | 12 +-- ...LevelsOverloadManagementSystemBuilder.java | 12 +-- .../PhaseShifterIAutomationSystemBuilder.java | 11 +-- .../PhaseShifterPAutomationSystemBuilder.java | 11 +-- .../models/buses/InfiniteBusBuilder.java | 11 +-- .../models/buses/StandardBusBuilder.java | 11 +-- .../GeneratorFictitiousBuilder.java | 11 +-- .../GridFormingConverterBuilder.java | 11 +-- .../SynchronizedGeneratorBuilder.java | 11 +-- .../SynchronousGeneratorBuilder.java | 11 +-- .../models/generators/WeccBuilder.java | 11 +-- .../dynawaltz/models/hvdc/HvdcPBuilder.java | 11 +-- .../dynawaltz/models/hvdc/HvdcVscBuilder.java | 10 +-- .../dynawaltz/models/lines/LineBuilder.java | 12 +-- .../models/loads/BaseLoadBuilder.java | 11 +-- .../loads/LoadOneTransformerBuilder.java | 11 +-- .../LoadOneTransformerTapChangerBuilder.java | 11 +-- .../loads/LoadTwoTransformersBuilder.java | 11 +-- ...LoadTwoTransformersTapChangersBuilder.java | 11 +-- .../BaseStaticVarCompensatorBuilder.java | 12 +-- .../TransformerFixedRatioBuilder.java | 12 +-- dynawaltz/src/main/resources/models.json | 78 ++++++++++++------- .../dynawaltz/builders/BuilderConfigTest.java | 2 +- .../builders/ModelConfigLoaderTest.java | 15 ++-- 34 files changed, 184 insertions(+), 232 deletions(-) create mode 100644 dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java 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 7196518f5..5451a6ec0 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 @@ -38,14 +38,14 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio @Override List getModelNames() { - builderConfigs.stream().flatMap { it -> it.libs}.toList() as List + builderConfigs.stream().flatMap { it -> it.libs.libsInfo}.toList() as List } @Override void load(Binding binding, Consumer consumer, ReportNode reportNode) { builderConfigs.forEach {conf -> - conf.libs.forEach {lib -> + conf.libs.libsName.forEach {lib -> binding.setVariable(lib , { Closure closure -> def cloned = closure.clone() ModelBuilder builder = conf.builderConstructor diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java index c4c5e9b5c..211ebb19f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java @@ -11,7 +11,6 @@ import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.iidm.network.Network; -import java.util.Collection; import java.util.function.Supplier; /** @@ -26,9 +25,9 @@ public interface ModelBuilderConstructor { private final String category; private final ModelBuilderConstructor builderConstructor; - private final Supplier> libsSupplier; + private final Supplier libsSupplier; - public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier> libsSupplier) { + public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier libsSupplier) { this.category = category; this.builderConstructor = builderConstructor; this.libsSupplier = libsSupplier; @@ -42,7 +41,7 @@ public ModelBuilderConstructor getBuilderConstructor() { return builderConstructor; } - public Collection getLibs() { + public ModelConfigsLibsInfo getLibs() { return libsSupplier.get(); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java index dd3e53da5..cf535c9fe 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java @@ -13,7 +13,7 @@ /** * @author Laurent Issertial {@literal } */ -public record ModelConfig(String lib, String alias, String internalModelPrefix, List properties) { +public record ModelConfig(String lib, String alias, String internalModelPrefix, List properties, String doc) { private static final String CONTROLLABLE_PROPERTY = "CONTROLLABLE"; private static final String DANGLING_PROPERTY = "DANGLING"; @@ -21,11 +21,16 @@ public record ModelConfig(String lib, String alias, String internalModelPrefix, private static final String TRANSFORMER_PROPERTY = "TRANSFORMER"; private static final String AUXILIARY_PROPERTY = "AUXILIARY"; - public ModelConfig(String lib, String alias, String internalModelPrefix, List properties) { + public ModelConfig(String lib, String alias, String internalModelPrefix, List properties, String doc) { this.lib = Objects.requireNonNull(lib); this.alias = alias; this.internalModelPrefix = internalModelPrefix; this.properties = Objects.requireNonNull(properties); + this.doc = doc; + } + + public ModelConfig(String lib, String alias, String internalModelPrefix, List properties) { + this(lib, alias, internalModelPrefix, properties, null); } public boolean isControllable() { @@ -55,4 +60,8 @@ public boolean hasProperty(String property) { public String name() { return alias == null ? lib : alias; } + + public String getLibInfo() { + return name() + (alias != null ? " (" + lib + ")" : "") + (doc != null ? ": " + doc : ""); + } } 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 87c866562..8368cf940 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java @@ -13,11 +13,12 @@ import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.stream.Collectors; /** * @author Laurent Issertial {@literal } */ -public class ModelConfigs { +public class ModelConfigs implements ModelConfigsLibsInfo { private static final Logger LOGGER = LoggerFactory.getLogger(ModelConfigs.class); @@ -43,10 +44,16 @@ public ModelConfig getModelConfig(String libName) { return modelConfigMap.get(libName); } - public Set getSupportedLibs() { + @Override + public Set getLibsName() { return modelConfigMap.keySet(); } + @Override + public Set getLibsInfo() { + return modelConfigMap.values().stream().map(ModelConfig::getLibInfo).collect(Collectors.toSet()); + } + void addModelConfigs(ModelConfigs modelConfigsToMerge) { modelConfigMap.putAll(modelConfigsToMerge.modelConfigMap); if (hasDefaultModelConfig() && modelConfigsToMerge.hasDefaultModelConfig()) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java index a8353a259..ae66f5f41 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java @@ -50,7 +50,7 @@ private ModelConfigsHandler() { }) )); builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList(); - builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getSupportedLibs() + builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getLibsName() .forEach(lib -> builderConstructorByName.put(lib, bc.getBuilderConstructor()))); } 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 fb8489c49..c008aeb85 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java @@ -62,6 +62,7 @@ private static ModelConfig parseModelConfig(JsonParser parser) { String lib = null; String alias = null; String internalModelPrefix = null; + String doc = null; List properties = Collections.emptyList(); }; JsonUtil.parseObject(parser, name -> @@ -82,9 +83,13 @@ private static ModelConfig parseModelConfig(JsonParser parser) { parsingContext.alias = parser.nextTextValue(); yield true; } + case "doc" -> { + parsingContext.doc = parser.nextTextValue(); + yield true; + } default -> false; } ); - return new ModelConfig(parsingContext.lib, parsingContext.alias, parsingContext.internalModelPrefix, parsingContext.properties); + return new ModelConfig(parsingContext.lib, parsingContext.alias, parsingContext.internalModelPrefix, parsingContext.properties, parsingContext.doc); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java new file mode 100644 index 000000000..419088f58 --- /dev/null +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java @@ -0,0 +1,20 @@ +/** + * 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 java.util.Set; + +/** + * @author Laurent Issertial {@literal } + */ +public interface ModelConfigsLibsInfo { + + Set getLibsName(); + + Set getLibsInfo(); +} diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java index a38065cea..697fb6726 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java @@ -14,8 +14,6 @@ import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -48,8 +46,8 @@ public static TapChangerAutomationSystemBuilder of(Network network, String lib, return new TapChangerAutomationSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected TapChangerAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java index 38798cd03..4c19e8dd4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java @@ -50,8 +50,8 @@ public static TapChangerBlockingAutomationSystemBuilder of(Network network, Stri return new TapChangerBlockingAutomationSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected TapChangerBlockingAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java index 4310ecdb1..7ac05929c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java @@ -8,17 +8,11 @@ package com.powsybl.dynawaltz.models.automationsystems; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -50,8 +44,8 @@ public static UnderVoltageAutomationSystemBuilder of(Network network, String lib return new UnderVoltageAutomationSystemBuilder(network, MODEL_CONFIGS.getModelConfig(lib), reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected UnderVoltageAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java index 47e23a1f6..c4aaeaf58 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java @@ -8,16 +8,10 @@ package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -47,8 +41,8 @@ public static DynamicOverloadManagementSystemBuilder of(Network network, String return new DynamicOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected DynamicOverloadManagementSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java index 311c5b323..be5a77594 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java @@ -8,17 +8,11 @@ package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -51,8 +45,8 @@ public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected DynamicTwoLevelsOverloadManagementSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java index 889c22015..c4b094ee6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static PhaseShifterIAutomationSystemBuilder of(Network network, String li return new PhaseShifterIAutomationSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected PhaseShifterIAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java index 6189cbde3..ca2754932 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static PhaseShifterPAutomationSystemBuilder of(Network network, String li return new PhaseShifterPAutomationSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected PhaseShifterPAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java index b45545145..0b07c2b07 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.buses; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static InfiniteBusBuilder of(Network network, String lib, ReportNode repo return new InfiniteBusBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected InfiniteBusBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java index e8529ba80..994d2475a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.buses; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static StandardBusBuilder of(Network network, String lib, ReportNode repo return new StandardBusBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected StandardBusBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java index a61a8783b..decc5b48c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static GeneratorFictitiousBuilder of(Network network, String lib, ReportN return new GeneratorFictitiousBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected GeneratorFictitiousBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java index dddfc1fea..97ddbead1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static GridFormingConverterBuilder of(Network network, String lib, Report return new GridFormingConverterBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected GridFormingConverterBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java index 0ba9c7a2e..cc1a6ef1c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static SynchronizedGeneratorBuilder of(Network network, String lib, Repor return new SynchronizedGeneratorBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected SynchronizedGeneratorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java index ec14ec64a..b2b736c7b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java @@ -9,14 +9,9 @@ import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -46,8 +41,8 @@ public static SynchronousGeneratorBuilder of(Network network, String lib, Report return new SynchronousGeneratorBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected SynchronousGeneratorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java index a8aaa03b1..14e27fc2a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static WeccBuilder of(Network network, String lib, ReportNode reportNode) return new WeccBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected WeccBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java index 0f92bb440..c787b84e0 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java @@ -8,16 +8,11 @@ package com.powsybl.dynawaltz.models.hvdc; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -47,8 +42,8 @@ public static HvdcPBuilder of(Network network, String lib, ReportNode reportNode return new HvdcPBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected HvdcPBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java index f66d8319d..ab2711ec9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java @@ -8,13 +8,9 @@ package com.powsybl.dynawaltz.models.hvdc; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.*; -import java.util.Set; import java.util.function.Predicate; /** @@ -47,8 +43,8 @@ public static HvdcVscBuilder of(Network network, String lib, ReportNode reportNo return new HvdcVscBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected HvdcVscBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java index d536bd886..17058577b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java @@ -8,17 +8,11 @@ package com.powsybl.dynawaltz.models.lines; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -48,8 +42,8 @@ public static LineBuilder of(Network network, String lib, ReportNode reportNode) return new LineBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected LineBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java index 859c90ed7..b89cc3895 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static BaseLoadBuilder of(Network network, String lib, ReportNode reportN return new BaseLoadBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected BaseLoadBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java index 3c485ad8a..5c0946891 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static LoadOneTransformerBuilder of(Network network, String lib, ReportNo return new LoadOneTransformerBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected LoadOneTransformerBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java index ef938f90e..a1b3c34b4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static LoadOneTransformerTapChangerBuilder of(Network network, String lib return new LoadOneTransformerTapChangerBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected LoadOneTransformerTapChangerBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java index 26e91f153..0e6c6805b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static LoadTwoTransformersBuilder of(Network network, String lib, ReportN return new LoadTwoTransformersBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected LoadTwoTransformersBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java index 911d79cce..fd8c4ecb4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java @@ -8,14 +8,9 @@ package com.powsybl.dynawaltz.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -45,8 +40,8 @@ public static LoadTwoTransformersTapChangersBuilder of(Network network, String l return new LoadTwoTransformersTapChangersBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected LoadTwoTransformersTapChangersBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java index 5b68ebefc..3c4acba46 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java @@ -8,17 +8,11 @@ package com.powsybl.dynawaltz.models.svarcs; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -48,8 +42,8 @@ public static BaseStaticVarCompensatorBuilder of(Network network, String lib, Re return new BaseStaticVarCompensatorBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected BaseStaticVarCompensatorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java index a34be77c1..435abebd5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java @@ -8,17 +8,11 @@ package com.powsybl.dynawaltz.models.transformers; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; -import java.util.Set; - /** * @author Laurent Issertial {@literal } */ @@ -48,8 +42,8 @@ public static TransformerFixedRatioBuilder of(Network network, String lib, Repor return new TransformerFixedRatioBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static ModelConfigsLibsInfo getSupportedLibs() { + return MODEL_CONFIGS; } protected TransformerFixedRatioBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/resources/models.json b/dynawaltz/src/main/resources/models.json index ecc7115a3..0a5a7448b 100644 --- a/dynawaltz/src/main/resources/models.json +++ b/dynawaltz/src/main/resources/models.json @@ -3,7 +3,8 @@ "defaultLib": "GeneratorFictitious", "libs": [ { - "lib": "GeneratorFictitious" + "lib": "GeneratorFictitious", + "doc": "Fictitious generator (behaves in a similar way as an alpha-beta load)" } ] }, @@ -11,7 +12,8 @@ "defaultLib": "GeneratorSynchronousFourWindings", "libs": [ { - "lib": "GeneratorSynchronousFourWindings" + "lib": "GeneratorSynchronousFourWindings", + "doc": "Four windings synchronous generator" }, { "lib": "GeneratorSynchronousFourWindingsGoverPropVRPropInt", @@ -56,7 +58,8 @@ "lib": "GeneratorSynchronousProportionalRegulationsInternalParameters" }, { - "lib": "GeneratorSynchronousThreeWindings" + "lib": "GeneratorSynchronousThreeWindings", + "doc": "Three windings synchronous generator" }, { "lib": "GeneratorSynchronousThreeWindingsGoverNordicVRNordic" @@ -187,13 +190,15 @@ "defaultLib": "GeneratorPQ", "libs": [ { - "lib": "GeneratorPQ" + "lib": "GeneratorPQ", + "doc": "Generator with fixed active and reactive power targets. The actual outputs may however vary in order to mimic frequency and voltage regulation." }, { "lib": "GeneratorPV", "properties": [ "CONTROLLABLE" - ] + ], + "doc": "Generator with fixed active power and voltage targets. The reactive power output changes over time in order to follow the voltage target (when it is not possible to do so, the reactive power is set to the minimum or maximum value). The active power outputs may vary in order to mimic frequency regulation" }, { "lib": "GeneratorPVFixed" @@ -296,22 +301,26 @@ "defaultLib": "HvdcVSC", "libs": [ { - "lib": "HvdcVSC" + "lib": "HvdcVSC", + "doc": "Standard dynamic model for Hvdc-VSC link" }, { - "lib": "HvdcVSCEmulation" + "lib": "HvdcVSCEmulation", + "doc": "Standard dynamic model for Hvdc-VSC link with AC emulation" }, { "lib": "HvdcVSCDanglingP", "properties": [ "DANGLING" - ] + ], + "doc": "Standard dynamic model for Hvdc-VSC link between two different synchronous areas (P control on the main one)" }, { "lib": "HvdcVSCDanglingUdc", "properties": [ "DANGLING" - ] + ], + "doc": "Standard dynamic model for Hvdc-VSC link between two different synchronous areas (P control on the main one)" } ] }, @@ -319,7 +328,8 @@ "defaultLib": "Bus", "libs": [ { - "lib": "Bus" + "lib": "Bus", + "doc": "Standard bus" } ] }, @@ -344,10 +354,12 @@ "lib": "LoadAlphaBeta", "properties": [ "CONTROLLABLE" - ] + ], + "doc": "Voltage-dependent load" }, { - "lib": "LoadAlphaBetaRestorative" + "lib": "LoadAlphaBetaRestorative", + "doc": "Restorative load model with a voltage-dependent behavior when the voltage hits the limits" }, { "lib": "LoadAlphaBetaRestorativeLimitsRecalc" @@ -356,7 +368,8 @@ "lib": "LoadAlphaBetaMotor" }, { - "lib": "LoadPQ" + "lib": "LoadPQ", + "doc": "PQ load" }, { "lib": "LoadAlphaBetaRestorativeNetwork" @@ -388,7 +401,8 @@ "defaultLib": "LoadOneTransformer", "libs": [ { - "lib": "LoadOneTransformer" + "lib": "LoadOneTransformer", + "doc": "Load behind one transformer" } ] }, @@ -396,7 +410,8 @@ "defaultLib": "LoadOneTransformerTapChanger", "libs": [ { - "lib": "LoadOneTransformerTapChanger" + "lib": "LoadOneTransformerTapChanger", + "doc": "Load behind one transformer with a tap changer" } ] }, @@ -404,7 +419,8 @@ "defaultLib": "LoadTwoTransformers", "libs": [ { - "lib": "LoadTwoTransformers" + "lib": "LoadTwoTransformers", + "doc": "Load behind two transformers" } ] }, @@ -412,7 +428,8 @@ "defaultLib": "LoadTwoTransformersTapChangers", "libs": [ { - "lib": "LoadTwoTransformersTapChangers" + "lib": "LoadTwoTransformersTapChangers", + "doc": "Load behind two transformers with tap changers" } ] }, @@ -420,7 +437,8 @@ "defaultLib": "Line", "libs": [ { - "lib": "Line" + "lib": "Line", + "doc": "Standard line" } ] }, @@ -428,7 +446,8 @@ "defaultLib": "StaticVarCompensator", "libs": [ { - "lib": "StaticVarCompensator" + "lib": "StaticVarCompensator", + "doc": "Standard static var compensator" }, { "lib": "StaticVarCompensatorPV" @@ -536,7 +555,8 @@ "libs": [ { "lib": "CurrentLimitAutomaton", - "alias": "OverloadManagementSystem" + "alias": "OverloadManagementSystem", + "doc": "Automation system which emits a specific order when the current on the monitored line goes above a given threshold during some time" } ] }, @@ -545,7 +565,8 @@ "libs": [ { "lib": "CurrentLimitAutomatonTwoLevels", - "alias": "TwoLevelsOverloadManagementSystem" + "alias": "TwoLevelsOverloadManagementSystem", + "doc": "Automation system which emits a specific order when the current on two monitored lines goes above a given threshold during some time" } ] }, @@ -553,7 +574,8 @@ "defaultLib": "PhaseShifterI", "libs": [ { - "lib": "PhaseShifterI" + "lib": "PhaseShifterI", + "doc": "Phase-shifter which monitors a given current. When the current goes above a given threshold max, taps will be changed in order to decrease it. When the active power goes below another threshold stop, the phase-shifter is automatically deactivated" } ] }, @@ -561,7 +583,8 @@ "defaultLib": "PhaseShifterP", "libs": [ { - "lib": "PhaseShifterP" + "lib": "PhaseShifterP", + "doc": "Phase-shifter which monitors a given active power. When the active power goes above a given threshold max, taps will be changed in order to decrease it. When the active power goes below another threshold stop, the phase-shifter is automatically deactivated" } ] }, @@ -569,7 +592,8 @@ "defaultLib": "TapChangerAutomaton", "libs": [ { - "lib": "TapChangerAutomaton" + "lib": "TapChangerAutomaton", + "doc": "Tap changer" } ] }, @@ -577,7 +601,8 @@ "defaultLib": "TapChangerBlockingAutomaton", "libs": [ { - "lib": "TapChangerBlockingAutomaton" + "lib": "TapChangerBlockingAutomaton", + "doc": "Block tap-changers when one of the monitored voltages goes below a threshold" } ] }, @@ -586,7 +611,8 @@ "libs": [ { "lib": "UnderVoltageAutomaton", - "alias": "UnderVoltage" + "alias": "UnderVoltage", + "doc": "Send switch-off signal to the monitored generator when the voltage goes below a threshold" } ] } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java index 3e50da712..778c0c9a6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java @@ -34,7 +34,7 @@ static void setup() { @Test void testModelBuilders() { for (BuilderConfig builderConfig : MODEL_CONFIGS_HANDLER.getBuilderConfigs()) { - String lib = builderConfig.getLibs().iterator().next(); + String lib = builderConfig.getLibs().getLibsName().iterator().next(); ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, lib, ReportNode.NO_OP); ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, lib, ReportNode.NO_OP); assertNotNull(tagBuilder); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java index 336014f43..fdec1b0c6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java @@ -39,7 +39,8 @@ void loadConfigTest() throws IOException { "internalModelPrefix": "WTG4A", "properties": [ "SYNCHRONIZED" - ] + ], + "doc": "Photovoltaics Wecc generator" }, { "lib": "WT4BWeccCurrentSource", @@ -49,7 +50,8 @@ void loadConfigTest() throws IOException { ] }, { - "lib": "WT4AWeccCurrentSource" + "lib": "WT4AWeccCurrentSource", + "doc": "WT4A Wecc generator" } ] } @@ -63,16 +65,17 @@ void loadConfigTest() throws IOException { }); assertThat(configs.keySet()).containsExactlyInAnyOrder("synchronousGenerators"); ModelConfigs synchroGens = configs.get("synchronousGenerators"); - assertThat(synchroGens.getSupportedLibs()).containsExactlyInAnyOrder( + assertThat(synchroGens.getLibsName()).containsExactlyInAnyOrder( "Wecc", "WT4BWeccCurrentSource", "WT4AWeccCurrentSource"); ModelConfig defaultModel = new ModelConfig("WT4BWeccCurrentSource", null, null, List.of("SYNCHRONIZED", "CONTROLLABLE")); assertThat(listModelConfigs(synchroGens)).containsExactlyInAnyOrder( - new ModelConfig("PhotovoltaicsWeccCurrentSource", "Wecc", "WTG4A", List.of("SYNCHRONIZED")), + new ModelConfig("PhotovoltaicsWeccCurrentSource", "Wecc", "WTG4A", List.of("SYNCHRONIZED"), "Photovoltaics Wecc generator"), defaultModel, - new ModelConfig("WT4AWeccCurrentSource", null, null, Collections.emptyList())); + new ModelConfig("WT4AWeccCurrentSource", null, null, Collections.emptyList(), "WT4A Wecc generator")); assertEquals(defaultModel, synchroGens.getDefaultModelConfig()); + assertThat(synchroGens.getLibsInfo()).containsExactlyInAnyOrder("Wecc (PhotovoltaicsWeccCurrentSource): Photovoltaics Wecc generator", "WT4BWeccCurrentSource", "WT4AWeccCurrentSource: WT4A Wecc generator"); } @Test @@ -98,7 +101,7 @@ void mergeModelConfigs() { } private List listModelConfigs(ModelConfigs modelConfigs) { - return modelConfigs.getSupportedLibs().stream() + return modelConfigs.getLibsName().stream() .map(modelConfigs::getModelConfig) .toList(); } From 93e86f025218a703a4cad8da308501b82d681e92 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 20 Jun 2024 10:49:02 +0200 Subject: [PATCH 02/28] Add event models documentation Signed-off-by: lisrte --- .../dsl/DynaWaltzDynamicModelGroovyExtension.groovy | 2 +- .../dsl/DynaWaltzEventModelGroovyExtension.groovy | 2 +- .../powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java | 8 ++++++++ .../powsybl/dynawaltz/dsl/EventModelsSupplierTest.java | 8 ++++++++ .../powsybl/dynawaltz/builders/EventBuilderConfig.java | 8 +++++++- .../powsybl/dynawaltz/builders/ModelConfigsHandler.java | 6 +++--- .../models/events/EventActivePowerVariationBuilder.java | 5 +++++ .../models/events/EventDisconnectionBuilder.java | 5 +++++ .../dynawaltz/models/events/NodeFaultEventBuilder.java | 5 +++++ 9 files changed, 43 insertions(+), 6 deletions(-) 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 5451a6ec0..698d93020 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 @@ -38,7 +38,7 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio @Override List getModelNames() { - builderConfigs.stream().flatMap { it -> it.libs.libsInfo}.toList() as List + builderConfigs.stream().flatMap { it -> it.libs.libsInfo.stream()}.toList() as List } 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 816673fcd..6ea2e6ddc 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 @@ -37,7 +37,7 @@ class DynaWaltzEventModelGroovyExtension implements EventModelGroovyExtension { } List getModelNames() { - builderConfigs.collect {it.tag} + builderConfigs.collect {it.info} } @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 8e91c52da..35811d64e 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 @@ -39,6 +39,7 @@ import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory; import com.powsybl.iidm.network.test.HvdcTestNetwork; import com.powsybl.iidm.network.test.SvcTestCaseFactory; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -56,6 +57,13 @@ class DynamicModelsSupplierTest extends AbstractModelSupplierTest { private static final List EXTENSIONS = GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME); + @Test + void testLibsInfo() { + for (DynamicModelGroovyExtension extension : EXTENSIONS) { + assertNotNull(extension.getModelNames()); + } + } + @ParameterizedTest(name = "{0}") @MethodSource("provideEquipmentModelData") void testEquipmentDynamicModels(String groovyScriptName, Class modelClass, Network network, String staticId, String dynamicId, String parameterId, String lib) { 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 5b4b57ed3..76e181aa4 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 @@ -19,6 +19,7 @@ import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.HvdcTestNetwork; import com.powsybl.iidm.network.test.SvcTestCaseFactory; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -36,6 +37,13 @@ class EventModelsSupplierTest extends AbstractModelSupplierTest { protected static final List EXTENSIONS = GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME); + @Test + void testLibsInfo() { + for (EventModelGroovyExtension extension : EXTENSIONS) { + assertNotNull(extension.getModelNames()); + } + } + @ParameterizedTest(name = "{0}") @MethodSource("provideEventModelData") void testEventModels(String groovyScriptName, Class modelClass, Network network, String equipmentStaticId, String dynamicId, String lib, double startTime) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java index 9f095b4c9..3087dd117 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java @@ -23,10 +23,12 @@ public interface EventModelBuilderConstructor { private final EventModelBuilderConstructor builderConstructor; private final String tag; + private final String info; - public EventBuilderConfig(EventModelBuilderConstructor builderConstructor, String tag) { + public EventBuilderConfig(EventModelBuilderConstructor builderConstructor, String tag, String info) { this.builderConstructor = builderConstructor; this.tag = tag; + this.info = info; } public EventModelBuilderConstructor getBuilderConstructor() { @@ -36,4 +38,8 @@ public EventModelBuilderConstructor getBuilderConstructor() { public String getTag() { return tag; } + + public String getInfo() { + return info; + } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java index ae66f5f41..267a99041 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java @@ -34,9 +34,9 @@ public final class ModelConfigsHandler { private final Map builderConstructorByName = new HashMap<>(); private final List eventBuilderConfigs = List.of( - new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG), - new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG), - new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG)); + new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG, EventActivePowerVariationBuilder.getInfo()), + new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG, EventDisconnectionBuilder.getInfo()), + new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG, NodeFaultEventBuilder.getInfo())); private final Map eventBuilderConstructorByName = eventBuilderConfigs.stream().collect(Collectors.toMap(EventBuilderConfig::getTag, EventBuilderConfig::getBuilderConstructor)); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java index 026c175d7..9793e5722 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java @@ -19,6 +19,7 @@ public class EventActivePowerVariationBuilder extends AbstractEventModelBuilder, EventActivePowerVariationBuilder> { public static final String TAG = "Step"; + private static final String INFO = TAG + ": Power variation on generator or load"; protected Double deltaP; @@ -30,6 +31,10 @@ public static EventActivePowerVariationBuilder of(Network network, ReportNode re return new EventActivePowerVariationBuilder(network, reportNode); } + public static String getInfo() { + return INFO; + } + EventActivePowerVariationBuilder(Network network, ReportNode reportNode) { super(network, new BuilderEquipment<>("GENERATOR/LOAD"), reportNode); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java index b54f65c5e..9ed7b9b4a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java @@ -20,6 +20,7 @@ public class EventDisconnectionBuilder extends AbstractEventModelBuilder, EventDisconnectionBuilder> { public static final String TAG = "Disconnect"; + private static final String INFO = TAG + ": Disconnect network equipment (injection, branch or hvdc)"; private static final EnumSet CONNECTABLE_INJECTIONS = EnumSet.of(IdentifiableType.GENERATOR, IdentifiableType.LOAD, IdentifiableType.STATIC_VAR_COMPENSATOR, IdentifiableType.SHUNT_COMPENSATOR); private static final EnumSet CONNECTABLE_BRANCHES = EnumSet.of(IdentifiableType.LINE, IdentifiableType.TWO_WINDINGS_TRANSFORMER); @@ -41,6 +42,10 @@ public static EventDisconnectionBuilder of(Network network, ReportNode reportNod return new EventDisconnectionBuilder(network, reportNode); } + public static String getInfo() { + return INFO; + } + EventDisconnectionBuilder(Network network, ReportNode reportNode) { super(network, new BuilderEquipment<>("Disconnectable equipment"), reportNode); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java index 5bc39f4b9..239f20ecf 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java @@ -20,6 +20,7 @@ public class NodeFaultEventBuilder extends AbstractEventModelBuilder { public static final String TAG = "NodeFault"; + private static final String INFO = TAG + ": Node fault with configurable resistance, reactance and duration"; protected double faultTime; protected double rPu; @@ -33,6 +34,10 @@ public static NodeFaultEventBuilder of(Network network, ReportNode reportNode) { return new NodeFaultEventBuilder(network, reportNode); } + public static String getInfo() { + return INFO; + } + NodeFaultEventBuilder(Network network, ReportNode reportNode) { super(network, new BuilderEquipment<>(IdentifiableType.BUS), reportNode); } From 52843cf8c300c9c2763b1ca4a2efad54e0bd3e93 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 20 Jun 2024 11:06:35 +0200 Subject: [PATCH 03/28] Move ModelConfigsHandler::eventBuilderConfigs in ModelConfigLoader Signed-off-by: lisrte --- .../dynawaltz/builders/ModelConfigLoader.java | 4 ++++ .../dynawaltz/builders/ModelConfigLoaderImpl.java | 13 +++++++++++++ .../dynawaltz/builders/ModelConfigsHandler.java | 15 ++++----------- 3 files changed, 21 insertions(+), 11 deletions(-) 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 2c11d91b6..dd1a32e55 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java @@ -40,4 +40,8 @@ default Map loadModelConfigs() { } Stream loadBuilderConfigs(); + + default Stream loadEventBuilderConfigs() { + return Stream.empty(); + } } 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 2728e4426..846e8ed32 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java @@ -17,6 +17,9 @@ 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.events.EventActivePowerVariationBuilder; +import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder; import com.powsybl.dynawaltz.models.generators.*; import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; @@ -61,6 +64,11 @@ public final class ModelConfigLoaderImpl implements ModelConfigLoader { new BuilderConfig(WeccBuilder.CATEGORY, WeccBuilder::of, WeccBuilder::getSupportedLibs), new BuilderConfig(GridFormingConverterBuilder.CATEGORY, GridFormingConverterBuilder::of, GridFormingConverterBuilder::getSupportedLibs)); + private static final Stream EVENT_BUILDER_CONFIGS = Stream.of( + new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG, EventActivePowerVariationBuilder.getInfo()), + new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG, EventDisconnectionBuilder.getInfo()), + new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG, NodeFaultEventBuilder.getInfo())); + @Override public String getModelConfigFileName() { return MODEL_CONFIG_FILENAME; @@ -70,4 +78,9 @@ public String getModelConfigFileName() { public Stream loadBuilderConfigs() { return BUILDER_CONFIGS; } + + @Override + public Stream loadEventBuilderConfigs() { + return EVENT_BUILDER_CONFIGS; + } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java index 267a99041..9eb2b5289 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java @@ -11,9 +11,6 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynawaltz.models.events.EventActivePowerVariationBuilder; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder; import com.powsybl.iidm.network.Network; import java.util.HashMap; @@ -32,14 +29,8 @@ public final class ModelConfigsHandler { private final Map modelConfigsCat = new HashMap<>(); private final List builderConfigs; private final Map builderConstructorByName = new HashMap<>(); - - private final List eventBuilderConfigs = List.of( - new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG, EventActivePowerVariationBuilder.getInfo()), - new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG, EventDisconnectionBuilder.getInfo()), - new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG, NodeFaultEventBuilder.getInfo())); - - private final Map eventBuilderConstructorByName = - eventBuilderConfigs.stream().collect(Collectors.toMap(EventBuilderConfig::getTag, EventBuilderConfig::getBuilderConstructor)); + private final List eventBuilderConfigs; + private final Map eventBuilderConstructorByName; private ModelConfigsHandler() { List modelConfigLoaders = Lists.newArrayList(ServiceLoader.load(ModelConfigLoader.class)); @@ -52,6 +43,8 @@ private ModelConfigsHandler() { builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList(); builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getLibsName() .forEach(lib -> builderConstructorByName.put(lib, bc.getBuilderConstructor()))); + eventBuilderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadEventBuilderConfigs).toList(); + eventBuilderConstructorByName = eventBuilderConfigs.stream().collect(Collectors.toMap(EventBuilderConfig::getTag, EventBuilderConfig::getBuilderConstructor)); } public static ModelConfigsHandler getInstance() { From efde11bed40d58cb3d7f4390427a25cf9b5c9401 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 4 Jul 2024 15:21:44 +0200 Subject: [PATCH 04/28] Rename lib to modelName Add ModelInfo interface Signed-off-by: lisrte --- ...ynaWaltzDynamicModelGroovyExtension.groovy | 9 ++-- .../dynawaltz/builders/BuilderConfig.java | 12 ++--- .../dynawaltz/builders/ModelConfig.java | 6 ++- .../builders/ModelConfigLoaderImpl.java | 48 +++++++++---------- .../dynawaltz/builders/ModelConfigs.java | 12 ++--- .../builders/ModelConfigsHandler.java | 2 +- .../powsybl/dynawaltz/builders/ModelInfo.java | 39 +++++++++++++++ ...elConfigsLibsInfo.java => ModelInfos.java} | 7 ++- .../TapChangerAutomationSystemBuilder.java | 12 ++--- ...hangerBlockingAutomationSystemBuilder.java | 12 ++--- .../UnderVoltageAutomationSystemBuilder.java | 14 +++--- ...ynamicOverloadManagementSystemBuilder.java | 12 ++--- ...LevelsOverloadManagementSystemBuilder.java | 12 ++--- .../PhaseShifterIAutomationSystemBuilder.java | 12 ++--- .../PhaseShifterPAutomationSystemBuilder.java | 12 ++--- .../models/buses/InfiniteBusBuilder.java | 12 ++--- .../models/buses/StandardBusBuilder.java | 12 ++--- .../GeneratorFictitiousBuilder.java | 12 ++--- .../GridFormingConverterBuilder.java | 12 ++--- .../SynchronizedGeneratorBuilder.java | 12 ++--- .../SynchronousGeneratorBuilder.java | 12 ++--- .../models/generators/WeccBuilder.java | 12 ++--- .../dynawaltz/models/hvdc/HvdcPBuilder.java | 12 ++--- .../dynawaltz/models/hvdc/HvdcVscBuilder.java | 12 ++--- .../dynawaltz/models/lines/LineBuilder.java | 12 ++--- .../models/loads/BaseLoadBuilder.java | 12 ++--- .../loads/LoadOneTransformerBuilder.java | 12 ++--- .../LoadOneTransformerTapChangerBuilder.java | 12 ++--- .../loads/LoadTwoTransformersBuilder.java | 12 ++--- ...LoadTwoTransformersTapChangersBuilder.java | 12 ++--- .../BaseStaticVarCompensatorBuilder.java | 12 ++--- .../TransformerFixedRatioBuilder.java | 12 ++--- .../dynawaltz/builders/BuilderConfigTest.java | 6 +-- .../builders/ModelConfigLoaderTest.java | 6 +-- 34 files changed, 238 insertions(+), 199 deletions(-) create mode 100644 dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java rename dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/{ModelConfigsLibsInfo.java => ModelInfos.java} (81%) 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 698d93020..a040dd97a 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 @@ -38,18 +38,19 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio @Override List getModelNames() { - builderConfigs.stream().flatMap { it -> it.libs.libsInfo.stream()}.toList() as List + builderConfigs.stream().flatMap { it -> it.modelInfos.modelInfos.stream()}.map { i -> i.formattedInfo()}.toList() as List } @Override void load(Binding binding, Consumer consumer, ReportNode reportNode) { builderConfigs.forEach {conf -> - conf.libs.libsName.forEach {lib -> - binding.setVariable(lib , { Closure closure -> + conf.modelInfos.modelInfos.forEach { modelInfo -> + def modelName = modelInfo.name() + binding.setVariable(modelName , { Closure closure -> def cloned = closure.clone() ModelBuilder builder = conf.builderConstructor - .createBuilder(binding.getVariable("network") as Network, lib, DslReports.createModelBuilderReportNode(reportNode, lib)) + .createBuilder(binding.getVariable("network") as Network, modelName, DslReports.createModelBuilderReportNode(reportNode, modelName)) cloned.delegate = builder cloned() builder.build()?.tap { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java index 211ebb19f..bb61d6286 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java @@ -20,17 +20,17 @@ public class BuilderConfig { @FunctionalInterface public interface ModelBuilderConstructor { - ModelBuilder createBuilder(Network network, String lib, ReportNode reportNode); + ModelBuilder createBuilder(Network network, String modelName, ReportNode reportNode); } private final String category; private final ModelBuilderConstructor builderConstructor; - private final Supplier libsSupplier; + private final Supplier modelInfosSupplier; - public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier libsSupplier) { + public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier modelInfosSupplier) { this.category = category; this.builderConstructor = builderConstructor; - this.libsSupplier = libsSupplier; + this.modelInfosSupplier = modelInfosSupplier; } public String getCategory() { @@ -41,7 +41,7 @@ public ModelBuilderConstructor getBuilderConstructor() { return builderConstructor; } - public ModelConfigsLibsInfo getLibs() { - return libsSupplier.get(); + public ModelInfos getModelInfos() { + return modelInfosSupplier.get(); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java index cf535c9fe..4872893ba 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java @@ -13,7 +13,7 @@ /** * @author Laurent Issertial {@literal } */ -public record ModelConfig(String lib, String alias, String internalModelPrefix, List properties, String doc) { +public record ModelConfig(String lib, String alias, String internalModelPrefix, List properties, String doc) implements ModelInfo { private static final String CONTROLLABLE_PROPERTY = "CONTROLLABLE"; private static final String DANGLING_PROPERTY = "DANGLING"; @@ -57,11 +57,13 @@ public boolean hasProperty(String property) { return properties.contains(property); } + @Override public String name() { return alias == null ? lib : alias; } - public String getLibInfo() { + @Override + public String formattedInfo() { return name() + (alias != null ? " (" + lib + ")" : "") + (doc != null ? ": " + doc : ""); } } 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 846e8ed32..4cd4ea346 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java @@ -39,30 +39,30 @@ 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(DynamicOverloadManagementSystemBuilder.CATEGORY, DynamicOverloadManagementSystemBuilder::of, DynamicOverloadManagementSystemBuilder::getSupportedLibs), - new BuilderConfig(DynamicTwoLevelsOverloadManagementSystemBuilder.CATEGORY, DynamicTwoLevelsOverloadManagementSystemBuilder::of, DynamicTwoLevelsOverloadManagementSystemBuilder::getSupportedLibs), - new BuilderConfig(TapChangerAutomationSystemBuilder.CATEGORY, TapChangerAutomationSystemBuilder::of, TapChangerAutomationSystemBuilder::getSupportedLibs), - new BuilderConfig(TapChangerBlockingAutomationSystemBuilder.CATEGORY, TapChangerBlockingAutomationSystemBuilder::of, TapChangerBlockingAutomationSystemBuilder::getSupportedLibs), - new BuilderConfig(UnderVoltageAutomationSystemBuilder.CATEGORY, UnderVoltageAutomationSystemBuilder::of, UnderVoltageAutomationSystemBuilder::getSupportedLibs), - new BuilderConfig(PhaseShifterPAutomationSystemBuilder.CATEGORY, PhaseShifterPAutomationSystemBuilder::of, PhaseShifterPAutomationSystemBuilder::getSupportedLibs), - new BuilderConfig(PhaseShifterIAutomationSystemBuilder.CATEGORY, PhaseShifterIAutomationSystemBuilder::of, PhaseShifterIAutomationSystemBuilder::getSupportedLibs), - new BuilderConfig(StandardBusBuilder.CATEGORY, StandardBusBuilder::of, StandardBusBuilder::getSupportedLibs), - new BuilderConfig(InfiniteBusBuilder.CATEGORY, InfiniteBusBuilder::of, InfiniteBusBuilder::getSupportedLibs), - new BuilderConfig(TransformerFixedRatioBuilder.CATEGORY, TransformerFixedRatioBuilder::of, TransformerFixedRatioBuilder::getSupportedLibs), - new BuilderConfig(LineBuilder.CATEGORY, LineBuilder::of, LineBuilder::getSupportedLibs), - new BuilderConfig(HvdcVscBuilder.CATEGORY, HvdcVscBuilder::of, HvdcVscBuilder::getSupportedLibs), - new BuilderConfig(HvdcPBuilder.CATEGORY, HvdcPBuilder::of, HvdcPBuilder::getSupportedLibs), - new BuilderConfig(BaseLoadBuilder.CATEGORY, BaseLoadBuilder::of, BaseLoadBuilder::getSupportedLibs), - new BuilderConfig(LoadOneTransformerBuilder.CATEGORY, LoadOneTransformerBuilder::of, LoadOneTransformerBuilder::getSupportedLibs), - new BuilderConfig(LoadOneTransformerTapChangerBuilder.CATEGORY, LoadOneTransformerTapChangerBuilder::of, LoadOneTransformerTapChangerBuilder::getSupportedLibs), - new BuilderConfig(LoadTwoTransformersBuilder.CATEGORY, LoadTwoTransformersBuilder::of, LoadTwoTransformersBuilder::getSupportedLibs), - new BuilderConfig(LoadTwoTransformersTapChangersBuilder.CATEGORY, LoadTwoTransformersTapChangersBuilder::of, LoadTwoTransformersTapChangersBuilder::getSupportedLibs), - new BuilderConfig(BaseStaticVarCompensatorBuilder.CATEGORY, BaseStaticVarCompensatorBuilder::of, BaseStaticVarCompensatorBuilder::getSupportedLibs), - new BuilderConfig(GeneratorFictitiousBuilder.CATEGORY, GeneratorFictitiousBuilder::of, GeneratorFictitiousBuilder::getSupportedLibs), - new BuilderConfig(SynchronizedGeneratorBuilder.CATEGORY, SynchronizedGeneratorBuilder::of, SynchronizedGeneratorBuilder::getSupportedLibs), - new BuilderConfig(SynchronousGeneratorBuilder.CATEGORY, SynchronousGeneratorBuilder::of, SynchronousGeneratorBuilder::getSupportedLibs), - new BuilderConfig(WeccBuilder.CATEGORY, WeccBuilder::of, WeccBuilder::getSupportedLibs), - new BuilderConfig(GridFormingConverterBuilder.CATEGORY, GridFormingConverterBuilder::of, GridFormingConverterBuilder::getSupportedLibs)); + new BuilderConfig(DynamicOverloadManagementSystemBuilder.CATEGORY, DynamicOverloadManagementSystemBuilder::of, DynamicOverloadManagementSystemBuilder::getSupportedModelInfos), + new BuilderConfig(DynamicTwoLevelsOverloadManagementSystemBuilder.CATEGORY, DynamicTwoLevelsOverloadManagementSystemBuilder::of, DynamicTwoLevelsOverloadManagementSystemBuilder::getSupportedModelInfos), + new BuilderConfig(TapChangerAutomationSystemBuilder.CATEGORY, TapChangerAutomationSystemBuilder::of, TapChangerAutomationSystemBuilder::getSupportedModelInfos), + new BuilderConfig(TapChangerBlockingAutomationSystemBuilder.CATEGORY, TapChangerBlockingAutomationSystemBuilder::of, TapChangerBlockingAutomationSystemBuilder::getSupportedModelInfos), + new BuilderConfig(UnderVoltageAutomationSystemBuilder.CATEGORY, UnderVoltageAutomationSystemBuilder::of, UnderVoltageAutomationSystemBuilder::getSupportedModelInfos), + new BuilderConfig(PhaseShifterPAutomationSystemBuilder.CATEGORY, PhaseShifterPAutomationSystemBuilder::of, PhaseShifterPAutomationSystemBuilder::getSupportedModelInfos), + new BuilderConfig(PhaseShifterIAutomationSystemBuilder.CATEGORY, PhaseShifterIAutomationSystemBuilder::of, PhaseShifterIAutomationSystemBuilder::getSupportedModelInfos), + new BuilderConfig(StandardBusBuilder.CATEGORY, StandardBusBuilder::of, StandardBusBuilder::getSupportedModelInfos), + new BuilderConfig(InfiniteBusBuilder.CATEGORY, InfiniteBusBuilder::of, InfiniteBusBuilder::getSupportedModelInfos), + new BuilderConfig(TransformerFixedRatioBuilder.CATEGORY, TransformerFixedRatioBuilder::of, TransformerFixedRatioBuilder::getSupportedModelInfos), + new BuilderConfig(LineBuilder.CATEGORY, LineBuilder::of, LineBuilder::getSupportedModelInfos), + new BuilderConfig(HvdcVscBuilder.CATEGORY, HvdcVscBuilder::of, HvdcVscBuilder::getSupportedModelInfos), + new BuilderConfig(HvdcPBuilder.CATEGORY, HvdcPBuilder::of, HvdcPBuilder::getSupportedModelInfos), + new BuilderConfig(BaseLoadBuilder.CATEGORY, BaseLoadBuilder::of, BaseLoadBuilder::getSupportedModelInfos), + new BuilderConfig(LoadOneTransformerBuilder.CATEGORY, LoadOneTransformerBuilder::of, LoadOneTransformerBuilder::getSupportedModelInfos), + new BuilderConfig(LoadOneTransformerTapChangerBuilder.CATEGORY, LoadOneTransformerTapChangerBuilder::of, LoadOneTransformerTapChangerBuilder::getSupportedModelInfos), + new BuilderConfig(LoadTwoTransformersBuilder.CATEGORY, LoadTwoTransformersBuilder::of, LoadTwoTransformersBuilder::getSupportedModelInfos), + new BuilderConfig(LoadTwoTransformersTapChangersBuilder.CATEGORY, LoadTwoTransformersTapChangersBuilder::of, LoadTwoTransformersTapChangersBuilder::getSupportedModelInfos), + new BuilderConfig(BaseStaticVarCompensatorBuilder.CATEGORY, BaseStaticVarCompensatorBuilder::of, BaseStaticVarCompensatorBuilder::getSupportedModelInfos), + new BuilderConfig(GeneratorFictitiousBuilder.CATEGORY, GeneratorFictitiousBuilder::of, GeneratorFictitiousBuilder::getSupportedModelInfos), + new BuilderConfig(SynchronizedGeneratorBuilder.CATEGORY, SynchronizedGeneratorBuilder::of, SynchronizedGeneratorBuilder::getSupportedModelInfos), + new BuilderConfig(SynchronousGeneratorBuilder.CATEGORY, SynchronousGeneratorBuilder::of, SynchronousGeneratorBuilder::getSupportedModelInfos), + new BuilderConfig(WeccBuilder.CATEGORY, WeccBuilder::of, WeccBuilder::getSupportedModelInfos), + new BuilderConfig(GridFormingConverterBuilder.CATEGORY, GridFormingConverterBuilder::of, GridFormingConverterBuilder::getSupportedModelInfos)); private static final Stream EVENT_BUILDER_CONFIGS = Stream.of( new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG, EventActivePowerVariationBuilder.getInfo()), 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 8368cf940..4a5a53f0e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java @@ -13,12 +13,11 @@ import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.stream.Collectors; /** * @author Laurent Issertial {@literal } */ -public class ModelConfigs implements ModelConfigsLibsInfo { +public class ModelConfigs implements ModelInfos { private static final Logger LOGGER = LoggerFactory.getLogger(ModelConfigs.class); @@ -45,13 +44,12 @@ public ModelConfig getModelConfig(String libName) { } @Override - public Set getLibsName() { - return modelConfigMap.keySet(); + public Set getModelInfos() { + return Set.copyOf(modelConfigMap.values()); } - @Override - public Set getLibsInfo() { - return modelConfigMap.values().stream().map(ModelConfig::getLibInfo).collect(Collectors.toSet()); + Set getModelsName() { + return modelConfigMap.keySet(); } void addModelConfigs(ModelConfigs modelConfigsToMerge) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java index 9eb2b5289..f020a6e8a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java @@ -41,7 +41,7 @@ private ModelConfigsHandler() { }) )); builderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadBuilderConfigs).toList(); - builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getLibsName() + builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getModelsName() .forEach(lib -> builderConstructorByName.put(lib, bc.getBuilderConstructor()))); eventBuilderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadEventBuilderConfigs).toList(); eventBuilderConstructorByName = eventBuilderConfigs.stream().collect(Collectors.toMap(EventBuilderConfig::getTag, EventBuilderConfig::getBuilderConstructor)); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java new file mode 100644 index 000000000..3eb2f42b1 --- /dev/null +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java @@ -0,0 +1,39 @@ +/** + * 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.builders; + +/** + * @author Laurent Issertial {@literal } + */ +public interface ModelInfo { + + /** + * Returns the model name, lib if alias is null lib otherwise + */ + String name(); + + /** + * Returns the library name used in Dynawo + */ + String lib(); + + /** + * Returns the alias of the library name used in Powsybl-Dynawo instead of lib (or null if there is no alias) + */ + String alias(); + + /** + * Returns a definition of the model + */ + String doc(); + + /** + * Concatenation of lib, alias and info and doc field + */ + String formattedInfo(); +} diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java rename to dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java index 419088f58..be1c3d1ba 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsLibsInfo.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java @@ -12,9 +12,8 @@ /** * @author Laurent Issertial {@literal } */ -public interface ModelConfigsLibsInfo { +//TODO remove ? +public interface ModelInfos { - Set getLibsName(); - - Set getLibsInfo(); + Set getModelInfos(); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java index 697fb6726..5ab549a93 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java @@ -33,20 +33,20 @@ public static TapChangerAutomationSystemBuilder of(Network network, ReportNode r return new TapChangerAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static TapChangerAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static TapChangerAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static TapChangerAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static TapChangerAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TapChangerAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, TapChangerAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new TapChangerAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java index 4c19e8dd4..d5d6fbd1e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java @@ -37,20 +37,20 @@ public static TapChangerBlockingAutomationSystemBuilder of(Network network, Repo return new TapChangerBlockingAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static TapChangerBlockingAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static TapChangerBlockingAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static TapChangerBlockingAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static TapChangerBlockingAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TapChangerBlockingAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, TapChangerBlockingAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new TapChangerBlockingAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java index 7ac05929c..1afb53f10 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java @@ -31,20 +31,20 @@ public static UnderVoltageAutomationSystemBuilder of(Network network, ReportNode return new UnderVoltageAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static UnderVoltageAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static UnderVoltageAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static UnderVoltageAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static UnderVoltageAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, UnderVoltageAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, UnderVoltageAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } - return new UnderVoltageAutomationSystemBuilder(network, MODEL_CONFIGS.getModelConfig(lib), reportNode); + return new UnderVoltageAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java index c4aaeaf58..46db9be56 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java @@ -28,20 +28,20 @@ public static DynamicOverloadManagementSystemBuilder of(Network network, ReportN return new DynamicOverloadManagementSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static DynamicOverloadManagementSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static DynamicOverloadManagementSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static DynamicOverloadManagementSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static DynamicOverloadManagementSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, DynamicOverloadManagementSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, DynamicOverloadManagementSystemBuilder.class.getSimpleName(), modelName); return null; } return new DynamicOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java index be5a77594..2b016ff30 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java @@ -32,20 +32,20 @@ public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, DynamicTwoLevelsOverloadManagementSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, DynamicTwoLevelsOverloadManagementSystemBuilder.class.getSimpleName(), modelName); return null; } return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java index c4b094ee6..c878bd921 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java @@ -27,20 +27,20 @@ public static PhaseShifterIAutomationSystemBuilder of(Network network, ReportNod return new PhaseShifterIAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static PhaseShifterIAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static PhaseShifterIAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static PhaseShifterIAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static PhaseShifterIAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterIAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, PhaseShifterIAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterIAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java index ca2754932..329814224 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java @@ -27,20 +27,20 @@ public static PhaseShifterPAutomationSystemBuilder of(Network network, ReportNod return new PhaseShifterPAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static PhaseShifterPAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static PhaseShifterPAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static PhaseShifterPAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static PhaseShifterPAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterPAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, PhaseShifterPAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterPAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java index 0b07c2b07..5a46560b2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java @@ -27,20 +27,20 @@ public static InfiniteBusBuilder of(Network network, ReportNode reportNode) { return new InfiniteBusBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static InfiniteBusBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static InfiniteBusBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static InfiniteBusBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static InfiniteBusBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, InfiniteBusBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, InfiniteBusBuilder.class.getSimpleName(), modelName); return null; } return new InfiniteBusBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java index 994d2475a..32331f517 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java @@ -27,20 +27,20 @@ public static StandardBusBuilder of(Network network, ReportNode reportNode) { return new StandardBusBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static StandardBusBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static StandardBusBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static StandardBusBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static StandardBusBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, StandardBusBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, StandardBusBuilder.class.getSimpleName(), modelName); return null; } return new StandardBusBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java index decc5b48c..11fdf7eb1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java @@ -27,20 +27,20 @@ public static GeneratorFictitiousBuilder of(Network network, ReportNode reportNo return new GeneratorFictitiousBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static GeneratorFictitiousBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static GeneratorFictitiousBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static GeneratorFictitiousBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static GeneratorFictitiousBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, GeneratorFictitiousBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, GeneratorFictitiousBuilder.class.getSimpleName(), modelName); return null; } return new GeneratorFictitiousBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java index 97ddbead1..3b30fe1c5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java @@ -27,20 +27,20 @@ public static GridFormingConverterBuilder of(Network network, ReportNode reportN return new GridFormingConverterBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static GridFormingConverterBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static GridFormingConverterBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static GridFormingConverterBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static GridFormingConverterBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, GridFormingConverterBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, GridFormingConverterBuilder.class.getSimpleName(), modelName); return null; } return new GridFormingConverterBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java index cc1a6ef1c..5ac3e9dc5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java @@ -27,20 +27,20 @@ public static SynchronizedGeneratorBuilder of(Network network, ReportNode report return new SynchronizedGeneratorBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static SynchronizedGeneratorBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static SynchronizedGeneratorBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static SynchronizedGeneratorBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static SynchronizedGeneratorBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, SynchronizedGeneratorBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, SynchronizedGeneratorBuilder.class.getSimpleName(), modelName); return null; } return new SynchronizedGeneratorBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java index b2b736c7b..1ed9690e6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java @@ -28,20 +28,20 @@ public static SynchronousGeneratorBuilder of(Network network, ReportNode reportN return new SynchronousGeneratorBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static SynchronousGeneratorBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static SynchronousGeneratorBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static SynchronousGeneratorBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static SynchronousGeneratorBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, SynchronousGeneratorBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, SynchronousGeneratorBuilder.class.getSimpleName(), modelName); return null; } return new SynchronousGeneratorBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java index 14e27fc2a..05f4bc708 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java @@ -27,20 +27,20 @@ public static WeccBuilder of(Network network, ReportNode reportNode) { return new WeccBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static WeccBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static WeccBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static WeccBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static WeccBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, WeccBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, WeccBuilder.class.getSimpleName(), modelName); return null; } return new WeccBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java index c787b84e0..0c6bf1ef6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java @@ -29,20 +29,20 @@ public static HvdcPBuilder of(Network network, ReportNode reportNode) { return new HvdcPBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static HvdcPBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static HvdcPBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static HvdcPBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static HvdcPBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, HvdcPBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, HvdcPBuilder.class.getSimpleName(), modelName); return null; } return new HvdcPBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java index ab2711ec9..c3f4d483c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java @@ -30,20 +30,20 @@ public static HvdcVscBuilder of(Network network, ReportNode reportNode) { return new HvdcVscBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static HvdcVscBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static HvdcVscBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static HvdcVscBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static HvdcVscBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, HvdcVscBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, HvdcVscBuilder.class.getSimpleName(), modelName); return null; } return new HvdcVscBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java index 17058577b..cc429172f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java @@ -29,20 +29,20 @@ public static LineBuilder of(Network network, ReportNode reportNode) { return new LineBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static LineBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static LineBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static LineBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static LineBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LineBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, LineBuilder.class.getSimpleName(), modelName); return null; } return new LineBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java index b89cc3895..184085d1a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java @@ -27,20 +27,20 @@ public static BaseLoadBuilder of(Network network, ReportNode reportNode) { return new BaseLoadBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static BaseLoadBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static BaseLoadBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static BaseLoadBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static BaseLoadBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseLoadBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, BaseLoadBuilder.class.getSimpleName(), modelName); return null; } return new BaseLoadBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java index 5c0946891..fac60d052 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java @@ -27,20 +27,20 @@ public static LoadOneTransformerBuilder of(Network network, ReportNode reportNod return new LoadOneTransformerBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static LoadOneTransformerBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static LoadOneTransformerBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static LoadOneTransformerBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static LoadOneTransformerBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerBuilder.class.getSimpleName(), modelName); return null; } return new LoadOneTransformerBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java index a1b3c34b4..d13d3e60c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java @@ -27,20 +27,20 @@ public static LoadOneTransformerTapChangerBuilder of(Network network, ReportNode return new LoadOneTransformerTapChangerBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static LoadOneTransformerTapChangerBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static LoadOneTransformerTapChangerBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static LoadOneTransformerTapChangerBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static LoadOneTransformerTapChangerBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerTapChangerBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerTapChangerBuilder.class.getSimpleName(), modelName); return null; } return new LoadOneTransformerTapChangerBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java index 0e6c6805b..9dcfa57f2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java @@ -27,20 +27,20 @@ public static LoadTwoTransformersBuilder of(Network network, ReportNode reportNo return new LoadTwoTransformersBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static LoadTwoTransformersBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static LoadTwoTransformersBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static LoadTwoTransformersBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static LoadTwoTransformersBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersBuilder.class.getSimpleName(), modelName); return null; } return new LoadTwoTransformersBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java index fd8c4ecb4..5d72cfd2a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java @@ -27,20 +27,20 @@ public static LoadTwoTransformersTapChangersBuilder of(Network network, ReportNo return new LoadTwoTransformersTapChangersBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static LoadTwoTransformersTapChangersBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static LoadTwoTransformersTapChangersBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static LoadTwoTransformersTapChangersBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static LoadTwoTransformersTapChangersBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersTapChangersBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersTapChangersBuilder.class.getSimpleName(), modelName); return null; } return new LoadTwoTransformersTapChangersBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java index 3c4acba46..7b47cdc52 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java @@ -29,20 +29,20 @@ public static BaseStaticVarCompensatorBuilder of(Network network, ReportNode rep return new BaseStaticVarCompensatorBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static BaseStaticVarCompensatorBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static BaseStaticVarCompensatorBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static BaseStaticVarCompensatorBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static BaseStaticVarCompensatorBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseStaticVarCompensatorBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, BaseStaticVarCompensatorBuilder.class.getSimpleName(), modelName); return null; } return new BaseStaticVarCompensatorBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java index 435abebd5..0b7c8eb3f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java @@ -29,20 +29,20 @@ public static TransformerFixedRatioBuilder of(Network network, ReportNode report return new TransformerFixedRatioBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static TransformerFixedRatioBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static TransformerFixedRatioBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static TransformerFixedRatioBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static TransformerFixedRatioBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TransformerFixedRatioBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, TransformerFixedRatioBuilder.class.getSimpleName(), modelName); return null; } return new TransformerFixedRatioBuilder(network, modelConfig, reportNode); } - public static ModelConfigsLibsInfo getSupportedLibs() { + public static ModelInfos getSupportedModelInfos() { return MODEL_CONFIGS; } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java index 778c0c9a6..f7f9fb8a7 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java @@ -34,9 +34,9 @@ static void setup() { @Test void testModelBuilders() { for (BuilderConfig builderConfig : MODEL_CONFIGS_HANDLER.getBuilderConfigs()) { - String lib = builderConfig.getLibs().getLibsName().iterator().next(); - ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, lib, ReportNode.NO_OP); - ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, lib, ReportNode.NO_OP); + String modelName = builderConfig.getModelInfos().getModelInfos().iterator().next().name(); + ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, modelName, ReportNode.NO_OP); + ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, modelName, ReportNode.NO_OP); assertNotNull(tagBuilder); assertEquals(tagBuilder.getClass(), configBuilder.getClass()); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java index fdec1b0c6..c8f12d254 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java @@ -65,7 +65,7 @@ void loadConfigTest() throws IOException { }); assertThat(configs.keySet()).containsExactlyInAnyOrder("synchronousGenerators"); ModelConfigs synchroGens = configs.get("synchronousGenerators"); - assertThat(synchroGens.getLibsName()).containsExactlyInAnyOrder( + assertThat(synchroGens.getModelsName()).containsExactlyInAnyOrder( "Wecc", "WT4BWeccCurrentSource", "WT4AWeccCurrentSource"); @@ -75,7 +75,7 @@ void loadConfigTest() throws IOException { defaultModel, new ModelConfig("WT4AWeccCurrentSource", null, null, Collections.emptyList(), "WT4A Wecc generator")); assertEquals(defaultModel, synchroGens.getDefaultModelConfig()); - assertThat(synchroGens.getLibsInfo()).containsExactlyInAnyOrder("Wecc (PhotovoltaicsWeccCurrentSource): Photovoltaics Wecc generator", "WT4BWeccCurrentSource", "WT4AWeccCurrentSource: WT4A Wecc generator"); + assertThat(synchroGens.getModelInfos()).map(ModelInfo::formattedInfo).containsExactlyInAnyOrder("Wecc (PhotovoltaicsWeccCurrentSource): Photovoltaics Wecc generator", "WT4BWeccCurrentSource", "WT4AWeccCurrentSource: WT4A Wecc generator"); } @Test @@ -101,7 +101,7 @@ void mergeModelConfigs() { } private List listModelConfigs(ModelConfigs modelConfigs) { - return modelConfigs.getLibsName().stream() + return modelConfigs.getModelsName().stream() .map(modelConfigs::getModelConfig) .toList(); } From 2cbd3dd5b83d8aa369c44fdf4877a00326a74965 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 4 Jul 2024 15:45:59 +0200 Subject: [PATCH 05/28] Remove ModelInfos.java interface Signed-off-by: lisrte --- ...ynaWaltzDynamicModelGroovyExtension.groovy | 4 ++-- .../dynawaltz/builders/BuilderConfig.java | 7 ++++--- .../dynawaltz/builders/ModelConfigs.java | 3 +-- .../dynawaltz/builders/ModelInfos.java | 19 ------------------- .../TapChangerAutomationSystemBuilder.java | 6 ++++-- ...hangerBlockingAutomationSystemBuilder.java | 4 ++-- .../UnderVoltageAutomationSystemBuilder.java | 6 ++++-- ...ynamicOverloadManagementSystemBuilder.java | 6 ++++-- ...LevelsOverloadManagementSystemBuilder.java | 6 ++++-- .../PhaseShifterIAutomationSystemBuilder.java | 6 ++++-- .../PhaseShifterPAutomationSystemBuilder.java | 6 ++++-- .../models/buses/InfiniteBusBuilder.java | 6 ++++-- .../models/buses/StandardBusBuilder.java | 6 ++++-- .../GeneratorFictitiousBuilder.java | 6 ++++-- .../GridFormingConverterBuilder.java | 6 ++++-- .../SynchronizedGeneratorBuilder.java | 6 ++++-- .../SynchronousGeneratorBuilder.java | 6 ++++-- .../models/generators/WeccBuilder.java | 6 ++++-- .../dynawaltz/models/hvdc/HvdcPBuilder.java | 6 ++++-- .../dynawaltz/models/hvdc/HvdcVscBuilder.java | 5 +++-- .../dynawaltz/models/lines/LineBuilder.java | 6 ++++-- .../models/loads/BaseLoadBuilder.java | 6 ++++-- .../loads/LoadOneTransformerBuilder.java | 6 ++++-- .../LoadOneTransformerTapChangerBuilder.java | 6 ++++-- .../loads/LoadTwoTransformersBuilder.java | 6 ++++-- ...LoadTwoTransformersTapChangersBuilder.java | 6 ++++-- .../BaseStaticVarCompensatorBuilder.java | 6 ++++-- .../TransformerFixedRatioBuilder.java | 6 ++++-- .../dynawaltz/builders/BuilderConfigTest.java | 2 +- 29 files changed, 101 insertions(+), 75 deletions(-) delete mode 100644 dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java 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 a040dd97a..871b46451 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 @@ -38,14 +38,14 @@ class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtensio @Override List getModelNames() { - builderConfigs.stream().flatMap { it -> it.modelInfos.modelInfos.stream()}.map { i -> i.formattedInfo()}.toList() as List + builderConfigs.stream().flatMap { it -> it.modelInfos.stream()}.map { i -> i.formattedInfo()}.toList() as List } @Override void load(Binding binding, Consumer consumer, ReportNode reportNode) { builderConfigs.forEach {conf -> - conf.modelInfos.modelInfos.forEach { modelInfo -> + conf.modelInfos.forEach { modelInfo -> def modelName = modelInfo.name() binding.setVariable(modelName , { Closure closure -> def cloned = closure.clone() diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java index bb61d6286..0f46ca872 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java @@ -11,6 +11,7 @@ import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.iidm.network.Network; +import java.util.Set; import java.util.function.Supplier; /** @@ -25,9 +26,9 @@ public interface ModelBuilderConstructor { private final String category; private final ModelBuilderConstructor builderConstructor; - private final Supplier modelInfosSupplier; + private final Supplier> modelInfosSupplier; - public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier modelInfosSupplier) { + public BuilderConfig(String category, ModelBuilderConstructor builderConstructor, Supplier> modelInfosSupplier) { this.category = category; this.builderConstructor = builderConstructor; this.modelInfosSupplier = modelInfosSupplier; @@ -41,7 +42,7 @@ public ModelBuilderConstructor getBuilderConstructor() { return builderConstructor; } - public ModelInfos getModelInfos() { + public Set getModelInfos() { return modelInfosSupplier.get(); } } 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 4a5a53f0e..70d5f18bd 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java @@ -17,7 +17,7 @@ /** * @author Laurent Issertial {@literal } */ -public class ModelConfigs implements ModelInfos { +public class ModelConfigs { private static final Logger LOGGER = LoggerFactory.getLogger(ModelConfigs.class); @@ -43,7 +43,6 @@ public ModelConfig getModelConfig(String libName) { return modelConfigMap.get(libName); } - @Override public Set getModelInfos() { return Set.copyOf(modelConfigMap.values()); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java deleted file mode 100644 index be1c3d1ba..000000000 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfos.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 java.util.Set; - -/** - * @author Laurent Issertial {@literal } - */ -//TODO remove ? -public interface ModelInfos { - - Set getModelInfos(); -} diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java index 5ab549a93..1693463f2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java @@ -14,6 +14,8 @@ import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -46,8 +48,8 @@ public static TapChangerAutomationSystemBuilder of(Network network, String model return new TapChangerAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected TapChangerAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java index d5d6fbd1e..76aee5c14 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java @@ -50,8 +50,8 @@ public static TapChangerBlockingAutomationSystemBuilder of(Network network, Stri return new TapChangerBlockingAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected TapChangerBlockingAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java index 1afb53f10..280f97256 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -44,8 +46,8 @@ public static UnderVoltageAutomationSystemBuilder of(Network network, String mod return new UnderVoltageAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected UnderVoltageAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java index 46db9be56..db628a614 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java @@ -12,6 +12,8 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -41,8 +43,8 @@ public static DynamicOverloadManagementSystemBuilder of(Network network, String return new DynamicOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected DynamicOverloadManagementSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java index 2b016ff30..52c7a07f1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -45,8 +47,8 @@ public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected DynamicTwoLevelsOverloadManagementSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java index c878bd921..dae17ee8f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static PhaseShifterIAutomationSystemBuilder of(Network network, String mo return new PhaseShifterIAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected PhaseShifterIAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java index 329814224..179453bf7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static PhaseShifterPAutomationSystemBuilder of(Network network, String mo return new PhaseShifterPAutomationSystemBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected PhaseShifterPAutomationSystemBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java index 5a46560b2..2b8b83958 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static InfiniteBusBuilder of(Network network, String modelName, ReportNod return new InfiniteBusBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected InfiniteBusBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java index 32331f517..3ff9b13aa 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static StandardBusBuilder of(Network network, String modelName, ReportNod return new StandardBusBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected StandardBusBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java index 11fdf7eb1..572276a3a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static GeneratorFictitiousBuilder of(Network network, String modelName, R return new GeneratorFictitiousBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected GeneratorFictitiousBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java index 3b30fe1c5..88df10f30 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static GridFormingConverterBuilder of(Network network, String modelName, return new GridFormingConverterBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected GridFormingConverterBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java index 5ac3e9dc5..fca4f385c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static SynchronizedGeneratorBuilder of(Network network, String modelName, return new SynchronizedGeneratorBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected SynchronizedGeneratorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java index 1ed9690e6..1c8be373d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java @@ -12,6 +12,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -41,8 +43,8 @@ public static SynchronousGeneratorBuilder of(Network network, String modelName, return new SynchronousGeneratorBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected SynchronousGeneratorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java index 05f4bc708..8c375abb5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static WeccBuilder of(Network network, String modelName, ReportNode repor return new WeccBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected WeccBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java index 0c6bf1ef6..256a0dcee 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -42,8 +44,8 @@ public static HvdcPBuilder of(Network network, String modelName, ReportNode repo return new HvdcPBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected HvdcPBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java index c3f4d483c..b7ab27202 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java @@ -11,6 +11,7 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.*; +import java.util.Set; import java.util.function.Predicate; /** @@ -43,8 +44,8 @@ public static HvdcVscBuilder of(Network network, String modelName, ReportNode re return new HvdcVscBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected HvdcVscBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java index cc429172f..1017876f7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -42,8 +44,8 @@ public static LineBuilder of(Network network, String modelName, ReportNode repor return new LineBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected LineBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java index 184085d1a..5b722423b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static BaseLoadBuilder of(Network network, String modelName, ReportNode r return new BaseLoadBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected BaseLoadBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java index fac60d052..693cf4e18 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static LoadOneTransformerBuilder of(Network network, String modelName, Re return new LoadOneTransformerBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected LoadOneTransformerBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java index d13d3e60c..b7987612e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static LoadOneTransformerTapChangerBuilder of(Network network, String mod return new LoadOneTransformerTapChangerBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected LoadOneTransformerTapChangerBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java index 9dcfa57f2..1565f8af0 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static LoadTwoTransformersBuilder of(Network network, String modelName, R return new LoadTwoTransformersBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected LoadTwoTransformersBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java index 5d72cfd2a..a4137b79e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java @@ -11,6 +11,8 @@ import com.powsybl.dynawaltz.builders.*; import com.powsybl.iidm.network.Network; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -40,8 +42,8 @@ public static LoadTwoTransformersTapChangersBuilder of(Network network, String m return new LoadTwoTransformersTapChangersBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected LoadTwoTransformersTapChangersBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java index 7b47cdc52..225c483cd 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -42,8 +44,8 @@ public static BaseStaticVarCompensatorBuilder of(Network network, String modelNa return new BaseStaticVarCompensatorBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected BaseStaticVarCompensatorBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java index 0b7c8eb3f..49dfd9465 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java @@ -13,6 +13,8 @@ import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; +import java.util.Set; + /** * @author Laurent Issertial {@literal } */ @@ -42,8 +44,8 @@ public static TransformerFixedRatioBuilder of(Network network, String modelName, return new TransformerFixedRatioBuilder(network, modelConfig, reportNode); } - public static ModelInfos getSupportedModelInfos() { - return MODEL_CONFIGS; + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected TransformerFixedRatioBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java index f7f9fb8a7..2d6beb6c1 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java @@ -34,7 +34,7 @@ static void setup() { @Test void testModelBuilders() { for (BuilderConfig builderConfig : MODEL_CONFIGS_HANDLER.getBuilderConfigs()) { - String modelName = builderConfig.getModelInfos().getModelInfos().iterator().next().name(); + String modelName = builderConfig.getModelInfos().iterator().next().name(); ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, modelName, ReportNode.NO_OP); ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, modelName, ReportNode.NO_OP); assertNotNull(tagBuilder); From 2aa892265c5dbbd53baa9b032d2a15dfb66747df Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 4 Jul 2024 16:06:12 +0200 Subject: [PATCH 06/28] Fix merge Signed-off-by: lisrte --- ...ifterBlockingIAutomationSystemBuilder.java | 19 ++++++++----------- .../models/shunts/BaseShuntBuilder.java | 14 +++++++------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java index bd94c7d86..1c0e89957 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java @@ -8,10 +8,7 @@ package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderReports; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.ModelConfigs; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; +import com.powsybl.dynawaltz.builders.*; import com.powsybl.dynawaltz.models.automationsystems.AbstractAutomationSystemModelBuilder; import com.powsybl.iidm.network.Network; @@ -33,21 +30,21 @@ public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, R return new PhaseShifterBlockingIAutomationSystemBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterBlockingIAutomationSystemBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, PhaseShifterBlockingIAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterBlockingIAutomationSystemBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } private String phaseShifterIDynamicId; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java index 707062186..97fb989e3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java @@ -31,21 +31,21 @@ public static BaseShuntBuilder of(Network network, ReportNode reportNode) { return new BaseShuntBuilder(network, MODEL_CONFIGS.getDefaultModelConfig(), reportNode); } - public static BaseShuntBuilder of(Network network, String lib) { - return of(network, lib, ReportNode.NO_OP); + public static BaseShuntBuilder of(Network network, String modelName) { + return of(network, modelName, ReportNode.NO_OP); } - public static BaseShuntBuilder of(Network network, String lib, ReportNode reportNode) { - ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(lib); + public static BaseShuntBuilder of(Network network, String modelName, ReportNode reportNode) { + ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseShuntBuilder.class.getSimpleName(), lib); + BuilderReports.reportLibNotFound(reportNode, BaseShuntBuilder.class.getSimpleName(), modelName); return null; } return new BaseShuntBuilder(network, modelConfig, reportNode); } - public static Set getSupportedLibs() { - return MODEL_CONFIGS.getSupportedLibs(); + public static Set getSupportedModelInfos() { + return MODEL_CONFIGS.getModelInfos(); } protected BaseShuntBuilder(Network network, ModelConfig modelConfig, ReportNode reportNode) { From 861010949ae0cc233475b7d104fb6e8df2b228e1 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 4 Jul 2024 16:13:20 +0200 Subject: [PATCH 07/28] Rename remaining lib to model Signed-off-by: lisrte --- .../java/com/powsybl/dynawaltz/builders/BuilderReports.java | 6 +++--- .../java/com/powsybl/dynawaltz/builders/ModelConfigs.java | 4 ++-- .../TapChangerAutomationSystemBuilder.java | 2 +- .../TapChangerBlockingAutomationSystemBuilder.java | 2 +- .../UnderVoltageAutomationSystemBuilder.java | 2 +- .../DynamicOverloadManagementSystemBuilder.java | 2 +- .../DynamicTwoLevelsOverloadManagementSystemBuilder.java | 2 +- .../PhaseShifterBlockingIAutomationSystemBuilder.java | 2 +- .../phaseshifters/PhaseShifterIAutomationSystemBuilder.java | 2 +- .../phaseshifters/PhaseShifterPAutomationSystemBuilder.java | 2 +- .../powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java | 2 +- .../powsybl/dynawaltz/models/buses/StandardBusBuilder.java | 2 +- .../models/generators/GeneratorFictitiousBuilder.java | 2 +- .../models/generators/GridFormingConverterBuilder.java | 2 +- .../models/generators/SynchronizedGeneratorBuilder.java | 2 +- .../models/generators/SynchronousGeneratorBuilder.java | 2 +- .../powsybl/dynawaltz/models/generators/WeccBuilder.java | 2 +- .../com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java | 2 +- .../com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java | 2 +- .../com/powsybl/dynawaltz/models/lines/LineBuilder.java | 2 +- .../com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java | 2 +- .../dynawaltz/models/loads/LoadOneTransformerBuilder.java | 2 +- .../models/loads/LoadOneTransformerTapChangerBuilder.java | 2 +- .../dynawaltz/models/loads/LoadTwoTransformersBuilder.java | 2 +- .../models/loads/LoadTwoTransformersTapChangersBuilder.java | 2 +- .../powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java | 2 +- .../models/svarcs/BaseStaticVarCompensatorBuilder.java | 2 +- .../models/transformers/TransformerFixedRatioBuilder.java | 2 +- 28 files changed, 31 insertions(+), 31 deletions(-) diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java index a9f210f25..e2b482857 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java @@ -29,11 +29,11 @@ public static void reportBuilderNotFound(ReportNode reportNode, String lib) { .add(); } - public static void reportLibNotFound(ReportNode reportNode, String builderName, String lib) { + public static void reportModelNotFound(ReportNode reportNode, String builderName, String modelName) { reportNode.newReportNode() - .withMessageTemplate("libNotFound", "Library ${lib} not found for ${builderName}") + .withMessageTemplate("modelNotFound", "Model ${lib} not found for ${builderName}") .withUntypedValue("builderName", builderName) - .withUntypedValue("lib", lib) + .withUntypedValue("modelName", modelName) .withSeverity(TypedValue.INFO_SEVERITY) .add(); } 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 70d5f18bd..394f2dab4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java @@ -39,8 +39,8 @@ public ModelConfig getDefaultModelConfig() { return defaultModelConfig; } - public ModelConfig getModelConfig(String libName) { - return modelConfigMap.get(libName); + public ModelConfig getModelConfig(String modelName) { + return modelConfigMap.get(modelName); } public Set getModelInfos() { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java index 1693463f2..ed81808c1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java @@ -42,7 +42,7 @@ public static TapChangerAutomationSystemBuilder of(Network network, String model public static TapChangerAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TapChangerAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, TapChangerAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new TapChangerAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java index 76aee5c14..01949cec0 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java @@ -44,7 +44,7 @@ public static TapChangerBlockingAutomationSystemBuilder of(Network network, Stri public static TapChangerBlockingAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TapChangerBlockingAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, TapChangerBlockingAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new TapChangerBlockingAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java index 280f97256..0585187e7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java @@ -40,7 +40,7 @@ public static UnderVoltageAutomationSystemBuilder of(Network network, String mod public static UnderVoltageAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, UnderVoltageAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, UnderVoltageAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new UnderVoltageAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java index db628a614..204bd1d97 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java @@ -37,7 +37,7 @@ public static DynamicOverloadManagementSystemBuilder of(Network network, String public static DynamicOverloadManagementSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, DynamicOverloadManagementSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, DynamicOverloadManagementSystemBuilder.class.getSimpleName(), modelName); return null; } return new DynamicOverloadManagementSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java index 52c7a07f1..39104e7f5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java @@ -41,7 +41,7 @@ public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network public static DynamicTwoLevelsOverloadManagementSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, DynamicTwoLevelsOverloadManagementSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, DynamicTwoLevelsOverloadManagementSystemBuilder.class.getSimpleName(), modelName); return null; } return new DynamicTwoLevelsOverloadManagementSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java index 1c0e89957..80da2cf96 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java @@ -37,7 +37,7 @@ public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, S public static PhaseShifterBlockingIAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterBlockingIAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, PhaseShifterBlockingIAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterBlockingIAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java index dae17ee8f..938002507 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java @@ -36,7 +36,7 @@ public static PhaseShifterIAutomationSystemBuilder of(Network network, String mo public static PhaseShifterIAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterIAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, PhaseShifterIAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterIAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java index 179453bf7..9fd913d1e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java @@ -36,7 +36,7 @@ public static PhaseShifterPAutomationSystemBuilder of(Network network, String mo public static PhaseShifterPAutomationSystemBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, PhaseShifterPAutomationSystemBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, PhaseShifterPAutomationSystemBuilder.class.getSimpleName(), modelName); return null; } return new PhaseShifterPAutomationSystemBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java index 2b8b83958..136517343 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java @@ -36,7 +36,7 @@ public static InfiniteBusBuilder of(Network network, String modelName) { public static InfiniteBusBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, InfiniteBusBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, InfiniteBusBuilder.class.getSimpleName(), modelName); return null; } return new InfiniteBusBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java index 3ff9b13aa..b923c501f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java @@ -36,7 +36,7 @@ public static StandardBusBuilder of(Network network, String modelName) { public static StandardBusBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, StandardBusBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, StandardBusBuilder.class.getSimpleName(), modelName); return null; } return new StandardBusBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java index 572276a3a..e385df16f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java @@ -36,7 +36,7 @@ public static GeneratorFictitiousBuilder of(Network network, String modelName) { public static GeneratorFictitiousBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, GeneratorFictitiousBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, GeneratorFictitiousBuilder.class.getSimpleName(), modelName); return null; } return new GeneratorFictitiousBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java index 88df10f30..1918c81a3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java @@ -36,7 +36,7 @@ public static GridFormingConverterBuilder of(Network network, String modelName) public static GridFormingConverterBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, GridFormingConverterBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, GridFormingConverterBuilder.class.getSimpleName(), modelName); return null; } return new GridFormingConverterBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java index fca4f385c..7c857021b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java @@ -36,7 +36,7 @@ public static SynchronizedGeneratorBuilder of(Network network, String modelName) public static SynchronizedGeneratorBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, SynchronizedGeneratorBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, SynchronizedGeneratorBuilder.class.getSimpleName(), modelName); return null; } return new SynchronizedGeneratorBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java index 1c8be373d..86d29a2e1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java @@ -37,7 +37,7 @@ public static SynchronousGeneratorBuilder of(Network network, String modelName) public static SynchronousGeneratorBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, SynchronousGeneratorBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, SynchronousGeneratorBuilder.class.getSimpleName(), modelName); return null; } return new SynchronousGeneratorBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java index 8c375abb5..b5e4a5f3a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java @@ -36,7 +36,7 @@ public static WeccBuilder of(Network network, String modelName) { public static WeccBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, WeccBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, WeccBuilder.class.getSimpleName(), modelName); return null; } return new WeccBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java index 256a0dcee..dd1eb8b17 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java @@ -38,7 +38,7 @@ public static HvdcPBuilder of(Network network, String modelName) { public static HvdcPBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, HvdcPBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, HvdcPBuilder.class.getSimpleName(), modelName); return null; } return new HvdcPBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java index b7ab27202..a91312a0c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java @@ -38,7 +38,7 @@ public static HvdcVscBuilder of(Network network, String modelName) { public static HvdcVscBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, HvdcVscBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, HvdcVscBuilder.class.getSimpleName(), modelName); return null; } return new HvdcVscBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java index 1017876f7..fbe15180f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java @@ -38,7 +38,7 @@ public static LineBuilder of(Network network, String modelName) { public static LineBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LineBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, LineBuilder.class.getSimpleName(), modelName); return null; } return new LineBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java index 5b722423b..e262dd90b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java @@ -36,7 +36,7 @@ public static BaseLoadBuilder of(Network network, String modelName) { public static BaseLoadBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseLoadBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, BaseLoadBuilder.class.getSimpleName(), modelName); return null; } return new BaseLoadBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java index 693cf4e18..d268132b3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java @@ -36,7 +36,7 @@ public static LoadOneTransformerBuilder of(Network network, String modelName) { public static LoadOneTransformerBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, LoadOneTransformerBuilder.class.getSimpleName(), modelName); return null; } return new LoadOneTransformerBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java index b7987612e..c052f346f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java @@ -36,7 +36,7 @@ public static LoadOneTransformerTapChangerBuilder of(Network network, String mod public static LoadOneTransformerTapChangerBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadOneTransformerTapChangerBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, LoadOneTransformerTapChangerBuilder.class.getSimpleName(), modelName); return null; } return new LoadOneTransformerTapChangerBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java index 1565f8af0..20e80ae17 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java @@ -36,7 +36,7 @@ public static LoadTwoTransformersBuilder of(Network network, String modelName) { public static LoadTwoTransformersBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, LoadTwoTransformersBuilder.class.getSimpleName(), modelName); return null; } return new LoadTwoTransformersBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java index a4137b79e..f49c76e8b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java @@ -36,7 +36,7 @@ public static LoadTwoTransformersTapChangersBuilder of(Network network, String m public static LoadTwoTransformersTapChangersBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, LoadTwoTransformersTapChangersBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, LoadTwoTransformersTapChangersBuilder.class.getSimpleName(), modelName); return null; } return new LoadTwoTransformersTapChangersBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java index 97fb989e3..847c5089a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java @@ -38,7 +38,7 @@ public static BaseShuntBuilder of(Network network, String modelName) { public static BaseShuntBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseShuntBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, BaseShuntBuilder.class.getSimpleName(), modelName); return null; } return new BaseShuntBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java index 225c483cd..5d7ab0e05 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java @@ -38,7 +38,7 @@ public static BaseStaticVarCompensatorBuilder of(Network network, String modelNa public static BaseStaticVarCompensatorBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, BaseStaticVarCompensatorBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, BaseStaticVarCompensatorBuilder.class.getSimpleName(), modelName); return null; } return new BaseStaticVarCompensatorBuilder(network, modelConfig, reportNode); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java index 49dfd9465..5d9bf4014 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java @@ -38,7 +38,7 @@ public static TransformerFixedRatioBuilder of(Network network, String modelName) public static TransformerFixedRatioBuilder of(Network network, String modelName, ReportNode reportNode) { ModelConfig modelConfig = MODEL_CONFIGS.getModelConfig(modelName); if (modelConfig == null) { - BuilderReports.reportLibNotFound(reportNode, TransformerFixedRatioBuilder.class.getSimpleName(), modelName); + BuilderReports.reportModelNotFound(reportNode, TransformerFixedRatioBuilder.class.getSimpleName(), modelName); return null; } return new TransformerFixedRatioBuilder(network, modelConfig, reportNode); From 019319bd14879b60dde242b17431083e9a5a6bbc Mon Sep 17 00:00:00 2001 From: lisrte Date: Fri, 5 Jul 2024 12:43:11 +0200 Subject: [PATCH 08/28] Rename tag to modelName/name Add EventModelInfo Signed-off-by: lisrte --- .../DynaWaltzEventModelGroovyExtension.groovy | 6 ++--- .../builders/EventBuilderConfig.java | 16 ++++--------- .../dynawaltz/builders/EventModelInfo.java | 23 +++++++++++++++++++ .../builders/ModelConfigLoaderImpl.java | 6 ++--- .../builders/ModelConfigsHandler.java | 2 +- .../powsybl/dynawaltz/builders/ModelInfo.java | 4 ++-- .../events/AbstractEventModelBuilder.java | 4 ++-- .../EventActivePowerVariationBuilder.java | 12 +++++----- .../events/EventDisconnectionBuilder.java | 12 +++++----- .../models/events/NodeFaultEventBuilder.java | 12 +++++----- .../dynawaltz/builders/BuilderConfigTest.java | 12 +++++----- 11 files changed, 63 insertions(+), 46 deletions(-) create mode 100644 dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java 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 6ea2e6ddc..3a9a7a46b 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 @@ -37,17 +37,17 @@ class DynaWaltzEventModelGroovyExtension implements EventModelGroovyExtension { } List getModelNames() { - builderConfigs.collect {it.info} + builderConfigs.collect {it.eventModelInfo.formattedInfo()} } @Override void load(Binding binding, Consumer consumer, ReportNode reportNode) { builderConfigs.forEach { - binding.setVariable(it.tag, { Closure closure -> + binding.setVariable(it.eventModelInfo.name(), { Closure closure -> def cloned = closure.clone() ModelBuilder builder = it.builderConstructor.createBuilder( binding.getVariable("network") as Network, - DslReports.createModelBuilderReportNode(reportNode, it.tag)) + DslReports.createModelBuilderReportNode(reportNode, it.eventModelInfo.name())) cloned.delegate = builder cloned() builder.build()?.tap { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java index 3087dd117..c829cc7af 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java @@ -22,24 +22,18 @@ public interface EventModelBuilderConstructor { } private final EventModelBuilderConstructor builderConstructor; - private final String tag; - private final String info; + private final EventModelInfo eventModelInfo; - public EventBuilderConfig(EventModelBuilderConstructor builderConstructor, String tag, String info) { + public EventBuilderConfig(EventModelBuilderConstructor builderConstructor, EventModelInfo eventModelInfo) { this.builderConstructor = builderConstructor; - this.tag = tag; - this.info = info; + this.eventModelInfo = eventModelInfo; } public EventModelBuilderConstructor getBuilderConstructor() { return builderConstructor; } - public String getTag() { - return tag; - } - - public String getInfo() { - return info; + public EventModelInfo getEventModelInfo() { + return eventModelInfo; } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java new file mode 100644 index 000000000..4e049f844 --- /dev/null +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java @@ -0,0 +1,23 @@ +/** + * 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; + +/** + * @param name Model name + * @param info Definition of the event model + * @author Laurent Issertial {@literal } + */ +public record EventModelInfo(String name, String info) { + + /** + * Concatenation of name and doc + */ + public String formattedInfo() { + return String.format("%s: %s", name, info); + } +} 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 01345fe78..f5e3292ac 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java @@ -69,9 +69,9 @@ public final class ModelConfigLoaderImpl implements ModelConfigLoader { new BuilderConfig(GridFormingConverterBuilder.CATEGORY, GridFormingConverterBuilder::of, GridFormingConverterBuilder::getSupportedModelInfos)); private static final Stream EVENT_BUILDER_CONFIGS = Stream.of( - new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.TAG, EventActivePowerVariationBuilder.getInfo()), - new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.TAG, EventDisconnectionBuilder.getInfo()), - new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.TAG, NodeFaultEventBuilder.getInfo())); + new EventBuilderConfig(EventActivePowerVariationBuilder::of, EventActivePowerVariationBuilder.getEventModelInfo()), + new EventBuilderConfig(EventDisconnectionBuilder::of, EventDisconnectionBuilder.getEventModelInfo()), + new EventBuilderConfig(NodeFaultEventBuilder::of, NodeFaultEventBuilder.getEventModelInfo())); @Override public String getModelConfigFileName() { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java index f020a6e8a..267e29f87 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java @@ -44,7 +44,7 @@ private ModelConfigsHandler() { builderConfigs.forEach(bc -> modelConfigsCat.get(bc.getCategory()).getModelsName() .forEach(lib -> builderConstructorByName.put(lib, bc.getBuilderConstructor()))); eventBuilderConfigs = modelConfigLoaders.stream().flatMap(ModelConfigLoader::loadEventBuilderConfigs).toList(); - eventBuilderConstructorByName = eventBuilderConfigs.stream().collect(Collectors.toMap(EventBuilderConfig::getTag, EventBuilderConfig::getBuilderConstructor)); + eventBuilderConstructorByName = eventBuilderConfigs.stream().collect(Collectors.toMap(e -> e.getEventModelInfo().name(), EventBuilderConfig::getBuilderConstructor)); } public static ModelConfigsHandler getInstance() { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java index 3eb2f42b1..2e6347eb6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, RTE (http://www.rte-france.com/) + * 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/. @@ -33,7 +33,7 @@ public interface ModelInfo { String doc(); /** - * Concatenation of lib, alias and info and doc field + * Concatenation of lib, alias and doc field */ String formattedInfo(); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java index e9a528bc2..8bf4216ce 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java @@ -52,14 +52,14 @@ protected void checkData() { protected abstract T findEquipment(String staticId); private String generateEventId(String staticId) { - return getTag() + "_" + staticId; + return getModelName() + "_" + staticId; } protected String generateDefaultEventId() { return generateEventId("unknownStaticId"); } - protected abstract String getTag(); + protected abstract String getModelName(); @Override public String getModelId() { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java index 9793e5722..86cc130c8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java @@ -10,6 +10,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynawaltz.builders.BuilderEquipment; import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.EventModelInfo; import com.powsybl.iidm.network.Injection; import com.powsybl.iidm.network.Network; @@ -18,8 +19,7 @@ */ public class EventActivePowerVariationBuilder extends AbstractEventModelBuilder, EventActivePowerVariationBuilder> { - public static final String TAG = "Step"; - private static final String INFO = TAG + ": Power variation on generator or load"; + private static final EventModelInfo MODEL_INFO = new EventModelInfo("Step", "Power variation on generator or load"); protected Double deltaP; @@ -31,8 +31,8 @@ public static EventActivePowerVariationBuilder of(Network network, ReportNode re return new EventActivePowerVariationBuilder(network, reportNode); } - public static String getInfo() { - return INFO; + public static EventModelInfo getEventModelInfo() { + return MODEL_INFO; } EventActivePowerVariationBuilder(Network network, ReportNode reportNode) { @@ -60,8 +60,8 @@ protected Injection findEquipment(String staticId) { } @Override - protected String getTag() { - return TAG; + protected String getModelName() { + return MODEL_INFO.name(); } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java index 9ed7b9b4a..71d3cd2b7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java @@ -10,6 +10,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynawaltz.builders.BuilderEquipment; import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.EventModelInfo; import com.powsybl.iidm.network.*; import java.util.EnumSet; @@ -19,8 +20,7 @@ */ public class EventDisconnectionBuilder extends AbstractEventModelBuilder, EventDisconnectionBuilder> { - public static final String TAG = "Disconnect"; - private static final String INFO = TAG + ": Disconnect network equipment (injection, branch or hvdc)"; + private static final EventModelInfo MODEL_INFO = new EventModelInfo("Disconnect", "Disconnect network equipment (injection, branch or hvdc)"); private static final EnumSet CONNECTABLE_INJECTIONS = EnumSet.of(IdentifiableType.GENERATOR, IdentifiableType.LOAD, IdentifiableType.STATIC_VAR_COMPENSATOR, IdentifiableType.SHUNT_COMPENSATOR); private static final EnumSet CONNECTABLE_BRANCHES = EnumSet.of(IdentifiableType.LINE, IdentifiableType.TWO_WINDINGS_TRANSFORMER); @@ -42,8 +42,8 @@ public static EventDisconnectionBuilder of(Network network, ReportNode reportNod return new EventDisconnectionBuilder(network, reportNode); } - public static String getInfo() { - return INFO; + public static EventModelInfo getEventModelInfo() { + return MODEL_INFO; } EventDisconnectionBuilder(Network network, ReportNode reportNode) { @@ -71,8 +71,8 @@ protected Identifiable findEquipment(String staticId) { } @Override - protected String getTag() { - return TAG; + protected String getModelName() { + return MODEL_INFO.name(); } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java index 239f20ecf..ca59eed65 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java +++ b/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java @@ -10,6 +10,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynawaltz.builders.BuilderEquipment; import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawaltz.builders.EventModelInfo; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; @@ -19,8 +20,7 @@ */ public class NodeFaultEventBuilder extends AbstractEventModelBuilder { - public static final String TAG = "NodeFault"; - private static final String INFO = TAG + ": Node fault with configurable resistance, reactance and duration"; + private static final EventModelInfo MODEL_INFO = new EventModelInfo("NodeFault", "Node fault with configurable resistance, reactance and duration"); protected double faultTime; protected double rPu; @@ -34,8 +34,8 @@ public static NodeFaultEventBuilder of(Network network, ReportNode reportNode) { return new NodeFaultEventBuilder(network, reportNode); } - public static String getInfo() { - return INFO; + public static EventModelInfo getEventModelInfo() { + return MODEL_INFO; } NodeFaultEventBuilder(Network network, ReportNode reportNode) { @@ -62,8 +62,8 @@ protected Bus findEquipment(String staticId) { } @Override - protected String getTag() { - return TAG; + protected String getModelName() { + return MODEL_INFO.name(); } @Override diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java index 2d6beb6c1..f123f4d71 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java +++ b/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java @@ -35,20 +35,20 @@ static void setup() { void testModelBuilders() { for (BuilderConfig builderConfig : MODEL_CONFIGS_HANDLER.getBuilderConfigs()) { String modelName = builderConfig.getModelInfos().iterator().next().name(); - ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, modelName, ReportNode.NO_OP); + ModelBuilder handlerBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, modelName, ReportNode.NO_OP); ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, modelName, ReportNode.NO_OP); - assertNotNull(tagBuilder); - assertEquals(tagBuilder.getClass(), configBuilder.getClass()); + assertNotNull(handlerBuilder); + assertEquals(handlerBuilder.getClass(), configBuilder.getClass()); } } @Test void testEventBuilders() { for (EventBuilderConfig eventBuilderConfig : MODEL_CONFIGS_HANDLER.getEventBuilderConfigs()) { - ModelBuilder tagBuilder = MODEL_CONFIGS_HANDLER.getEventModelBuilder(NETWORK, eventBuilderConfig.getTag(), ReportNode.NO_OP); + ModelBuilder handlerBuilder = MODEL_CONFIGS_HANDLER.getEventModelBuilder(NETWORK, eventBuilderConfig.getEventModelInfo().name(), ReportNode.NO_OP); ModelBuilder configBuilder = eventBuilderConfig.getBuilderConstructor().createBuilder(NETWORK, ReportNode.NO_OP); - assertNotNull(tagBuilder); - assertEquals(tagBuilder.getClass(), configBuilder.getClass()); + assertNotNull(handlerBuilder); + assertEquals(handlerBuilder.getClass(), configBuilder.getClass()); } } } From df3274dbf459741177a3714178771405c8066ef8 Mon Sep 17 00:00:00 2001 From: lisrte Date: Fri, 5 Jul 2024 17:29:17 +0200 Subject: [PATCH 09/28] Rename dynawaltz to dynawo Signed-off-by: lisrte --- distribution/pom.xml | 4 +- docs/dynamic_simulation/configuration.md | 8 +- .../powsybl/dynawaltz/DynaWaltzConfig.java | 43 --------- {dynawaltz-dsl => dynawo-dsl}/pom.xml | 18 ++-- .../com/powsybl/dynawo}/dsl/DslReports.groovy | 2 +- .../dsl/DynawoCurveGroovyExtension.groovy | 10 +-- .../DynawoDynamicModelGroovyExtension.groovy | 16 ++-- .../DynawoEventModelGroovyExtension.groovy | 16 ++-- .../dsl/AbstractModelSupplierTest.java | 2 +- .../dynawo/dsl/CurvesSupplierTest.java | 12 +-- .../dsl/DynamicModelsSupplierTest.java | 47 +++++----- .../dynawo}/dsl/EventModelsSupplierTest.java | 8 +- .../dynawo}/dsl/ieee/AbstractIeeeTest.java | 36 ++++---- .../dsl/ieee/DynawoLocalCommandExecutor.java | 34 +++---- .../dsl/ieee14/Ieee14DisconnectLineTest.java | 8 +- ...14DynamicOverloadManagementSystemTest.java | 8 +- .../dsl/ieee14/Ieee14MacroConnectsTest.java | 8 +- .../ieee57/Ieee57DisconnectGeneratorTest.java | 8 +- .../src/test/resources/curves.groovy | 0 .../src/test/resources/dynamicModels.groovy | 0 .../test/resources/dynamicModels/bus.groovy | 0 .../danglingHvdcException.groovy | 0 .../test/resources/dynamicModels/gen.groovy | 0 .../dynamicModels/genControllable.groovy | 0 .../dynamicModels/genFictitious.groovy | 0 .../resources/dynamicModels/genTfo.groovy | 0 .../dynamicModels/gridFormingConverter.groovy | 0 .../test/resources/dynamicModels/hvdcP.groovy | 0 .../dynamicModels/hvdcPDangling.groovy | 0 .../resources/dynamicModels/hvdcVsc.groovy | 0 .../dynamicModels/hvdcVscDangling.groovy | 0 .../dynamicModels/infiniteBus.groovy | 0 .../test/resources/dynamicModels/line.groovy | 0 .../resources/dynamicModels/loadAB.groovy | 0 .../dynamicModels/loadABControllable.groovy | 0 .../dynamicModels/loadTransformer.groovy | 0 .../loadTransformerTapChanger.groovy | 0 .../dynamicModels/loadTwoTransformers.groovy | 0 .../loadTwoTransformersTapChangers.groovy | 0 .../resources/dynamicModels/omegaGen.groovy | 0 .../dynamicModels/omegaGenControllable.groovy | 0 .../dynamicModels/overloadManagement | 0 .../overloadManagementTwoLevels.groovy | 0 .../dynamicModels/phaseShifterI.groovy | 0 .../dynamicModels/phaseShifterP.groovy | 0 .../test/resources/dynamicModels/svarc.groovy | 0 .../resources/dynamicModels/tapChanger.groovy | 2 +- .../dynamicModels/tapChangerBlocking.groovy | 0 .../tapChangerBlockingBusBar.groovy | 0 .../dynamicModels/transformer.groovy | 0 .../dynamicModels/underVoltage.groovy | 0 .../test/resources/dynamicModels/wecc.groovy | 0 .../dynamicModels/weccSynchro.groovy | 0 .../src/test/resources/dynawo_bad_version.out | 0 .../src/test/resources/dynawo_version.out | 0 .../src/test/resources/eventModels.groovy | 0 .../eventModels/branchDisconnection.groovy | 0 .../eventModels/equipmentDisconnection.groovy | 0 .../eventModels/hvdcDisconnection.groovy | 0 .../resources/eventModels/nodeFault.groovy | 0 .../test/resources/eventModels/step.groovy | 0 .../eventWarnings/missingAPVParameters.groovy | 0 .../missingDisconnectionEquipment.groovy | 0 .../missingDisconnectionSide.groovy | 0 .../missingNodeFaultParameters.groovy | 0 .../eventWarnings/missingStartTime.groovy | 0 .../eventWarnings/missingStaticId.groovy | 0 .../ieee14-disconnectline/config/models.par | 0 .../ieee14-disconnectline/config/network.par | 0 .../ieee14-disconnectline/config/solvers.par | 0 .../dynawo-inputs}/ieee14bus.par | 0 .../dynawo-inputs}/models.par | 0 .../dynawo-inputs}/network.par | 0 .../dynawo-inputs/powsybl_dynawo.crv | 0 .../dynawo-inputs/powsybl_dynawo.dyd | 0 .../dynawo-inputs/powsybl_dynawo.jobs | 6 +- .../dynawo-inputs/powsybl_dynawo.xiidm | 0 .../dynawo-inputs}/solvers.par | 0 .../dynawo-outputs}/curves.csv | 0 .../dynawo-outputs}/timeline.log | 0 .../powsybl-inputs/IEEE14.iidm | 0 .../powsybl-inputs/curves.groovy | 0 .../powsybl-inputs/dynamicModels.groovy | 0 .../powsybl-inputs/eventModels.groovy | 0 .../ieee14-macroconnects/config/models.par | 0 .../ieee14-macroconnects/config/network.par | 0 .../ieee14-macroconnects/config/solvers.par | 0 .../dynawo-inputs}/ieee14bus.par | 0 .../dynawo-inputs}/models.par | 0 .../dynawo-inputs}/network.par | 0 .../dynawo-inputs/powsybl_dynawo.crv | 0 .../dynawo-inputs/powsybl_dynawo.dyd | 0 .../dynawo-inputs/powsybl_dynawo.jobs | 6 +- .../dynawo-inputs/powsybl_dynawo.xiidm | 0 .../dynawo-inputs}/solvers.par | 0 .../dynawo-outputs}/curves.csv | 0 .../dynawo-outputs}/timeline.log | 0 .../powsybl-inputs/IEEE14.iidm | 0 .../powsybl-inputs/curves.groovy | 0 .../powsybl-inputs/dynamicModels.groovy | 0 .../config/models.par | 0 .../config/network.par | 0 .../config/solvers.par | 0 .../dynawaltz-inputs/ieee14bus.par | 0 .../dynawaltz-inputs/models.par | 0 .../dynawaltz-inputs/network.par | 0 .../dynawaltz-inputs/powsybl_dynawo.crv | 0 .../dynawaltz-inputs/powsybl_dynawo.dyd | 0 .../dynawaltz-inputs/powsybl_dynawo.jobs | 6 +- .../dynawaltz-inputs/powsybl_dynawo.xiidm | 0 .../dynawaltz-inputs/solvers.par | 0 .../dynawaltz-outputs/curves.csv | 0 .../dynawaltz-outputs/timeline.log | 0 .../powsybl-inputs/IEEE14.iidm | 0 .../powsybl-inputs/curves.groovy | 0 .../powsybl-inputs/dynamicModels.groovy | 0 .../powsybl-inputs/eventModels.groovy | 0 .../config/models.par | 0 .../config/network.par | 0 .../config/solvers.par | 0 .../dynawo-inputs}/ieee57bus.par | 0 .../dynawo-inputs}/models.par | 0 .../dynawo-inputs}/network.par | 0 .../dynawo-inputs/powsybl_dynawo.crv | 0 .../dynawo-inputs/powsybl_dynawo.dyd | 0 .../dynawo-inputs/powsybl_dynawo.jobs | 6 +- .../dynawo-inputs/powsybl_dynawo.xiidm | 0 .../dynawo-inputs}/solvers.par | 0 .../dynawo-outputs}/curves.csv | 0 .../dynawo-outputs}/timeline.log | 0 .../powsybl-inputs/IEEE57.iidm | 0 .../powsybl-inputs/curves.groovy | 0 .../powsybl-inputs/dynamicModels.groovy | 0 .../powsybl-inputs/eventModels.groovy | 0 .../warnings/cla2MissingMeasurement2.groovy | 0 .../cla2MissingMeasurementSide2.groovy | 0 .../warnings/claMissingControlled.groovy | 0 .../warnings/claMissingMeasurement.groovy | 0 .../warnings/claMissingMeasurementSide.groovy | 0 .../warnings/hvdcVscWrongStaticType.groovy | 0 .../resources/warnings/missingDangling.groovy | 0 .../warnings/missingDanglingProperty.groovy | 0 .../warnings/missingEquipment.groovy | 0 .../warnings/missingParameterId.groovy | 0 .../resources/warnings/missingStaticId.groovy | 0 .../phaseShifterMissingTransformer.groovy | 0 .../warnings/tapChangerCompatible.groovy | 0 .../warnings/tapChangerMissingBus.groovy | 0 .../warnings/tapChangerMissingBusList.groovy | 0 .../underVoltageMissingGenerator.groovy | 0 dynawo-integration-tests/pom.xml | 4 +- .../dynawo/it/DynawoSecurityAnalysisTest.java | 20 ++--- ...ltzTest.java => DynawoSimulationTest.java} | 90 +++++++++---------- ...l_dynawaltz.xiidm => powsybl_dynawo.xiidm} | 0 dynawo-security-analysis/pom.xml | 4 +- .../security/ContingencyEventModels.java | 8 +- .../security/DynawoAlgorithmsConfig.java | 8 +- .../DynawoSecurityAnalysisHandler.java | 16 ++-- .../DynawoSecurityAnalysisProvider.java | 20 ++--- .../security/SecurityAnalysisContext.java | 22 ++--- .../security/xml/ContingenciesDydXml.java | 10 +-- .../security/xml/ContingenciesParXml.java | 4 +- .../dynawo/security/xml/MultipleJobsXml.java | 4 +- .../powsybl/dynawo/security/xml/XmlUtil.java | 26 +++--- .../security/DynawoAlgorithmsConfigTest.java | 2 +- .../security/xml/ContingenciesXmlTest.java | 10 +-- .../security/xml/MultiplesJobsXmlTest.java | 14 +-- .../src/test/resources/multipleJobs.xml | 2 +- {dynawaltz => dynawo-simulation}/pom.xml | 8 +- .../powsybl/dynawo}/DumpFileParameters.java | 2 +- .../dynawo/DynawoSimulationConfig.java | 43 +++++++++ .../dynawo/DynawoSimulationConstants.java | 6 +- .../dynawo/DynawoSimulationContext.java | 70 +++++++-------- .../dynawo/DynawoSimulationHandler.java | 42 ++++----- .../dynawo/DynawoSimulationParameters.java | 56 ++++++------ .../dynawo/DynawoSimulationProvider.java | 40 ++++----- .../dynawo/DynawoSimulationReports.java | 16 ++-- .../dynawo}/ModelsRemovalSimplifier.java | 4 +- .../dynawo}/ModelsSubstitutionSimplifier.java | 6 +- .../builders/AbstractDynamicModelBuilder.java | 2 +- .../AbstractEquipmentModelBuilder.java | 2 +- .../dynawo}/builders/BuilderConfig.java | 2 +- .../dynawo}/builders/BuilderEquipment.java | 2 +- .../builders/BuilderEquipmentsList.java | 2 +- .../builders/BuilderIdListEquipmentList.java | 2 +- .../dynawo}/builders/BuilderReports.java | 2 +- .../dynawo}/builders/BuildersUtil.java | 2 +- .../builders/EquipmentModelBuilder.java | 2 +- .../dynawo}/builders/EventBuilderConfig.java | 2 +- .../dynawo}/builders/EventModelInfo.java | 2 +- .../dynawo}/builders/ModelBuilder.java | 2 +- .../powsybl/dynawo}/builders/ModelConfig.java | 2 +- .../dynawo}/builders/ModelConfigLoader.java | 2 +- .../builders/ModelConfigLoaderImpl.java | 44 ++++----- .../dynawo}/builders/ModelConfigs.java | 2 +- .../dynawo}/builders/ModelConfigsHandler.java | 2 +- .../ModelConfigsJsonDeserializer.java | 2 +- .../powsybl/dynawo}/builders/ModelInfo.java | 2 +- .../powsybl/dynawo}/curves/DynawoCurve.java | 2 +- .../dynawo}/curves/DynawoCurvesBuilder.java | 4 +- .../DynawoSimulationParametersSerializer.java | 20 ++--- .../dynawo}/models/AbstractBlackBoxModel.java | 16 ++-- .../AbstractEquipmentBlackBoxModel.java | 10 +-- .../AbstractPureDynamicBlackBoxModel.java | 8 +- .../powsybl/dynawo}/models/BlackBoxModel.java | 16 ++-- .../models/EquipmentBlackBoxModel.java | 2 +- .../dynawo}/models/InjectionModel.java | 2 +- .../models/MeasurementPointSuffix.java | 4 +- .../com/powsybl/dynawo}/models/Model.java | 4 +- .../dynawo}/models/TransformerSide.java | 2 +- .../powsybl/dynawo}/models/VarConnection.java | 2 +- .../powsybl/dynawo}/models/VarMapping.java | 2 +- .../AbstractAutomationSystemModelBuilder.java | 10 +-- .../models/automationsystems/BranchModel.java | 4 +- .../ConnectionStatefulModel.java | 4 +- .../TapChangerAutomationSystem.java | 18 ++-- .../TapChangerAutomationSystemBuilder.java | 6 +- .../TapChangerBlockingAutomationSystem.java | 18 ++-- ...hangerBlockingAutomationSystemBuilder.java | 6 +- .../UnderVoltageAutomationSystem.java | 10 +-- .../UnderVoltageAutomationSystemBuilder.java | 4 +- ...stractOverloadManagementSystemBuilder.java | 10 +-- .../DynamicOverloadManagementSystem.java | 12 +-- ...ynamicOverloadManagementSystemBuilder.java | 4 +- ...amicTwoLevelsOverloadManagementSystem.java | 10 +-- ...LevelsOverloadManagementSystemBuilder.java | 4 +- .../AbstractPhaseShifterAutomationSystem.java | 10 +-- .../AbstractPhaseShifterModelBuilder.java | 8 +- ...PhaseShifterBlockingIAutomationSystem.java | 22 ++--- ...ifterBlockingIAutomationSystemBuilder.java | 6 +- .../PhaseShifterIAutomationSystem.java | 10 +-- .../PhaseShifterIAutomationSystemBuilder.java | 4 +- .../phaseshifters/PhaseShifterIModel.java | 4 +- .../PhaseShifterPAutomationSystem.java | 6 +- .../PhaseShifterPAutomationSystemBuilder.java | 4 +- .../dynawo}/models/buses/AbstractBus.java | 10 +-- .../models/buses/AbstractBusBuilder.java | 6 +- .../models/buses/ActionConnectionPoint.java | 4 +- .../BusOfFrequencySynchronizedModel.java | 4 +- .../buses/DefaultActionConnectionPoint.java | 4 +- .../DefaultBusOfFrequencySynchronized.java | 10 +-- .../DefaultEquipmentConnectionPoint.java | 8 +- .../buses/EquipmentConnectionPoint.java | 4 +- .../dynawo}/models/buses/InfiniteBus.java | 2 +- .../models/buses/InfiniteBusBuilder.java | 4 +- .../dynawo}/models/buses/StandardBus.java | 2 +- .../models/buses/StandardBusBuilder.java | 4 +- .../defaultmodels/AbstractDefaultModel.java | 10 +-- .../AbstractInjectionDefaultModel.java | 4 +- .../DefaultModelConfiguration.java | 35 ++++---- .../defaultmodels/DefaultModelFactory.java | 2 +- .../DefaultModelFactoryInterface.java | 2 +- .../defaultmodels/DefaultModelsHandler.java | 4 +- .../AbstractDynamicLibEventDisconnection.java | 14 +-- .../dynawo}/models/events/AbstractEvent.java | 12 +-- .../events/AbstractEventModelBuilder.java | 7 +- .../models/events/ContextDependentEvent.java | 8 +- .../models/events/ControllableEquipment.java | 4 +- .../events/EventActivePowerVariation.java | 18 ++-- .../EventActivePowerVariationBuilder.java | 8 +- .../events/EventBranchDisconnection.java | 14 +-- .../events/EventDisconnectionBuilder.java | 8 +- .../models/events/EventHvdcDisconnection.java | 8 +- .../events/EventInjectionDisconnection.java | 8 +- .../dynawo}/models/events/NodeFaultEvent.java | 14 +-- .../models/events/NodeFaultEventBuilder.java | 8 +- .../AbstractFrequencySynchronizer.java | 8 +- .../FrequencySynchronizedModel.java | 10 +-- .../FrequencySynchronizerModel.java | 4 +- .../frequencysynchronizers/OmegaRef.java | 28 +++--- .../frequencysynchronizers/SetPoint.java | 14 +-- .../models/generators/AbstractGenerator.java | 12 +-- .../generators/AbstractGeneratorBuilder.java | 6 +- .../models/generators/DefaultGenerator.java | 6 +- .../generators/EnumGeneratorComponent.java | 2 +- .../generators/GeneratorFictitious.java | 2 +- .../GeneratorFictitiousBuilder.java | 4 +- .../models/generators/GeneratorModel.java | 4 +- .../generators/GridFormingConverter.java | 22 ++--- .../GridFormingConverterBuilder.java | 4 +- .../generators/SynchronizedGenerator.java | 8 +- .../SynchronizedGeneratorBuilder.java | 4 +- .../SynchronizedGeneratorControllable.java | 4 +- .../generators/SynchronizedWeccGen.java | 6 +- .../generators/SynchronousGenerator.java | 12 +-- .../SynchronousGeneratorBuilder.java | 4 +- .../SynchronousGeneratorControllable.java | 4 +- .../models/generators/WeccBuilder.java | 4 +- .../dynawo}/models/generators/WeccGen.java | 12 +-- .../dynawo}/models/hvdc/AbstractHvdc.java | 14 +-- .../models/hvdc/AbstractHvdcBuilder.java | 8 +- .../dynawo}/models/hvdc/DanglingSide.java | 8 +- .../dynawo}/models/hvdc/DefaultHvdc.java | 4 +- .../dynawo}/models/hvdc/HvdcModel.java | 4 +- .../powsybl/dynawo}/models/hvdc/HvdcP.java | 4 +- .../dynawo}/models/hvdc/HvdcPBuilder.java | 4 +- .../dynawo}/models/hvdc/HvdcPDangling.java | 4 +- .../powsybl/dynawo}/models/hvdc/HvdcVsc.java | 2 +- .../dynawo}/models/hvdc/HvdcVscBuilder.java | 4 +- .../dynawo}/models/hvdc/HvdcVscDangling.java | 4 +- .../dynawo}/models/lines/DefaultLine.java | 6 +- .../dynawo}/models/lines/LineBuilder.java | 4 +- .../dynawo}/models/lines/LineModel.java | 4 +- .../dynawo}/models/lines/StandardLine.java | 10 +-- .../dynawo}/models/loads/AbstractLoad.java | 12 +-- .../loads/AbstractLoadModelBuilder.java | 6 +- .../dynawo}/models/loads/BaseLoad.java | 8 +- .../dynawo}/models/loads/BaseLoadBuilder.java | 4 +- .../models/loads/BaseLoadControllable.java | 4 +- .../dynawo}/models/loads/DefaultLoad.java | 6 +- .../models/loads/LoadOneTransformer.java | 12 +-- .../loads/LoadOneTransformerBuilder.java | 4 +- .../loads/LoadOneTransformerTapChanger.java | 12 +-- .../LoadOneTransformerTapChangerBuilder.java | 4 +- .../models/loads/LoadTwoTransformers.java | 12 +-- .../loads/LoadTwoTransformersBuilder.java | 4 +- .../loads/LoadTwoTransformersTapChangers.java | 14 +-- ...LoadTwoTransformersTapChangersBuilder.java | 4 +- .../models/loads/LoadWithTransformers.java | 8 +- .../models/macroconnections/MacroConnect.java | 4 +- .../MacroConnectAttribute.java | 2 +- .../MacroConnectionSuffix.java | 2 +- .../MacroConnectionsAdder.java | 14 +-- .../macroconnections/MacroConnector.java | 10 +-- .../dynawo}/models/shunts/BaseShunt.java | 10 +-- .../models/shunts/BaseShuntBuilder.java | 4 +- .../dynawo}/models/shunts/DefaultShunt.java | 4 +- .../dynawo}/models/shunts/ShuntModel.java | 4 +- .../svarcs/BaseStaticVarCompensator.java | 16 ++-- .../BaseStaticVarCompensatorBuilder.java | 4 +- .../svarcs/DefaultStaticVarCompensator.java | 4 +- .../transformers/DefaultTransformer.java | 10 +-- .../models/transformers/TapChangerModel.java | 12 +-- .../transformers/TransformerFixedRatio.java | 14 +-- .../TransformerFixedRatioBuilder.java | 4 +- .../models/transformers/TransformerModel.java | 4 +- .../models/utils/BlackBoxSupplierUtils.java | 4 +- .../dynawo}/models/utils/BusUtils.java | 2 +- .../models/utils/ImmutableLateInit.java | 2 +- .../dynawo}/models/utils/SideUtils.java | 2 +- .../powsybl/dynawo}/parameters/Parameter.java | 2 +- .../dynawo}/parameters/ParameterType.java | 2 +- .../dynawo}/parameters/ParametersSet.java | 2 +- .../powsybl/dynawo}/parameters/Reference.java | 2 +- .../powsybl/dynawo}/suppliers/Property.java | 9 +- .../dynawo}/suppliers/PropertyBuilder.java | 6 +- .../suppliers/PropertyParserUtils.java | 2 +- .../dynawo}/suppliers/PropertyType.java | 2 +- .../dynawo}/suppliers/SetGroupType.java | 7 +- .../suppliers/SupplierJsonDeserializer.java | 2 +- .../curves/CurvesJsonDeserializer.java | 4 +- .../dynamicmodels/DynamicModelConfig.java | 6 +- .../DynamicModelConfigsJsonDeserializer.java | 8 +- .../dynamicmodels/DynawoModelsSupplier.java | 14 +-- .../events/DynawoEventModelsSupplier.java | 14 +-- .../suppliers/events/EventModelConfig.java | 4 +- .../EventModelConfigsJsonDeserializer.java | 6 +- .../AbstractXmlDynawoSimulationWriter.java | 16 ++-- .../com/powsybl/dynawo}/xml/CurvesXml.java | 16 ++-- .../java/com/powsybl/dynawo}/xml/DydXml.java | 18 ++-- .../dynawo/xml/DynawoSimulationConstants.java | 14 +-- .../xml/DynawoSimulationXmlConstants.java | 6 +- .../java/com/powsybl/dynawo}/xml/JobsXml.java | 52 +++++------ .../dynawo}/xml/MacroStaticReference.java | 8 +- .../powsybl/dynawo}/xml/ParametersXml.java | 28 +++--- .../dynawo/xml/XmlDynawoSimulationWriter.java | 8 +- .../dynawo}/xml/XmlStreamWriterFactory.java | 4 +- .../src/main/resources/models.json | 0 .../dynawo}/AbstractLocalCommandExecutor.java | 2 +- .../com/powsybl/dynawo/DynawoConfigTest.java | 8 +- .../dynawo/DynawoParametersDatabaseTest.java | 14 +-- .../powsybl/dynawo/DynawoParametersTest.java | 88 +++++++++--------- .../powsybl/dynawo/DynawoProviderTest.java | 44 ++++----- .../powsybl/dynawo}/ModelsSimplifierTest.java | 18 ++-- .../dynawo}/builders/BuilderConfigTest.java | 2 +- .../dynawo}/builders/CurvesBuilderTest.java | 6 +- .../builders/DefaultLibBuilderTest.java | 38 ++++---- .../builders/ModelConfigLoaderTest.java | 2 +- .../models/ActionConnectionPointTest.java | 4 +- .../models/BuilderEquipmentSetterTest.java | 4 +- .../com/powsybl/dynawo}/models/HvdcTest.java | 10 +-- .../com/powsybl/dynawo}/models/LoadTest.java | 4 +- .../dynawo}/models/buses/StandardBusTest.java | 12 +-- .../DefaultModelHandlerTest.java | 10 +-- .../models/lines/StandardLineTest.java | 14 +-- .../DynawoCurvesJsonDeserializerTest.java | 6 +- .../DynawoEventModelsSupplierTest.java | 10 ++- .../suppliers/DynawoModelsSupplierTest.java | 11 +-- .../SupplierJsonDeserializerTest.java | 6 +- .../xml/AbstractDynamicModelXmlTest.java | 18 ++-- ...stractParametrizedDynamicModelXmlTest.java | 16 ++-- .../xml/ActivePowerVariationEventXmlTest.java | 12 +-- .../powsybl/dynawo}/xml/CurvesXmlTest.java | 14 +-- .../dynawo}/xml/CustomParameterResolver.java | 2 +- .../xml/DisconnectBranchEventXmlTest.java | 6 +- .../dynawo}/xml/DisconnectEventXmlTest.java | 10 +-- .../xml/DisconnectHvdcEventXmlTest.java | 14 +-- .../xml/DisconnectionExceptionXmlTest.java | 12 +-- .../dynawo}/xml/DynamicModelsXmlTest.java | 34 +++---- ...cOverloadManagementSystemModelXmlTest.java | 8 +- ...sOverloadManagementSystemModelXmlTest.java | 6 +- .../powsybl/dynawo/xml/DynawoTestUtil.java | 26 +++--- .../EmptyPhaseShifterBlockingIXmlTest.java | 10 +-- ...mptyTapChangerAutomationSystemXmlTest.java | 10 +-- ...hangerBlockingAutomationSystemXmlTest.java | 12 +-- .../com/powsybl/dynawo}/xml/EventXmlTest.java | 22 ++--- .../com/powsybl/dynawo}/xml/HvdcXmlTest.java | 12 +-- .../com/powsybl/dynawo}/xml/JobsXmlTest.java | 30 +++---- .../dynawo}/xml/LoadsModelXmlTest.java | 10 +-- .../dynawo}/xml/MappedParameterContext.java | 2 +- .../dynawo}/xml/NodeFaultEventXmlTest.java | 6 +- .../dynawo}/xml/OmegaRefModelXmlTest.java | 8 +- .../dynawo}/xml/ParametersXmlTest.java | 12 +-- .../xml/PhaseShifterBlockingIXmlTest.java | 8 +- .../dynawo}/xml/PhaseShiftersXmlTest.java | 14 +-- .../xml/SetPointInfiniteBusModelXmlTest.java | 10 +-- .../dynawo}/xml/ShuntModelXmlTest.java | 6 +- .../dynawo}/xml/SvarcModelWithSbaXmlTest.java | 6 +- .../dynawo}/xml/SvarcModelXmlTest.java | 6 +- ...ngerAutomationSystemExceptionsXmlTest.java | 15 ++-- .../TapChangerAutomationSystemXmlTest.java | 11 +-- ...hangerBlockingAutomationSystemXmlTest.java | 12 +-- ...ngToTapChangerAutomationSystemXmlTest.java | 6 +- .../dynawo}/xml/TransformerModelXmlTest.java | 6 +- .../UnderVoltageAutomationSystemXmlTest.java | 6 +- .../powsybl/dynawo}/xml/WeccGenXmlTest.java | 12 +-- .../resources/DynawoSimulationParameters.json | 2 +- .../src/test/resources/apv_dyd.xml | 0 .../src/test/resources/apv_network_par.xml | 0 .../src/test/resources/apv_par.xml | 0 .../src/test/resources/cla_dyd.xml | 0 .../src/test/resources/cla_tl_dyd.xml | 0 .../com/powsybl/config/test/config.yml | 6 +- .../com/powsybl/config/test/configModels.par | 0 .../com/powsybl/config/test/configNetwork.par | 0 .../com/powsybl/config/test/configSolver.par | 0 .../com/powsybl/config/test/filelist.txt | 0 .../src/test/resources/curves.csv | 0 .../src/test/resources/curvesInput.xml | 0 .../src/test/resources/curvesInput.xsd | 0 .../test/resources/disconnect_branch_dyd.xml | 0 .../test/resources/disconnect_branch_par.xml | 0 .../resources/disconnect_default_hvdc_dyd.xml | 0 .../src/test/resources/disconnect_dyd.xml | 0 .../test/resources/disconnect_hvdc_par.xml | 0 .../disconnect_hvdc_pv_dangling_dyd.xml | 0 .../test/resources/disconnect_hvdc_pv_dyd.xml | 0 .../disconnect_hvdc_vsc_dangling_dyd.xml | 0 .../resources/disconnect_hvdc_vsc_dyd.xml | 0 .../src/test/resources/disconnect_par.xml | 0 .../src/test/resources/dyd.xml | 0 .../src/test/resources/dyd.xsd | 0 .../src/test/resources/dyd_fictitious.xml | 0 .../src/test/resources/dynawo_bad_version.out | 0 .../src/test/resources/dynawo_version.out | 0 .../empty_phase_shifter_blocking_i_dyd.xml | 0 .../src/test/resources/events.xml | 0 .../resources/grid_forming_converter_dyd.xml | 0 .../resources/grid_forming_converter_par.xml | 0 .../test/resources/hvdc_p_dangling_dyd.xml | 0 .../src/test/resources/hvdc_p_dyd.xml | 0 .../test/resources/hvdc_vsc_dangling_dyd.xml | 0 .../src/test/resources/hvdc_vsc_dyd.xml | 0 .../src/test/resources/jobs.xml | 6 +- .../src/test/resources/jobs.xsd | 0 .../src/test/resources/jobsWithDump.xml | 6 +- .../test/resources/jobsWithSpecificLogs.xml | 6 +- .../test/resources/load_alpha_beta_dyd.xml | 0 .../resources/load_one_transformer_dyd.xml | 0 .../load_one_transformer_tap_changer_dyd.xml | 0 .../resources/load_two_transformers_dyd.xml | 0 ...load_two_transformers_tap_changers_dyd.xml | 0 .../src/test/resources/mergedLoads.xiidm | 0 .../src/test/resources/models.par | 0 .../src/test/resources/models_misspelled.par | 0 .../src/test/resources/noMergedLoads.xiidm | 0 .../src/test/resources/node_fault_dyd.xml | 0 .../src/test/resources/node_fault_par.xml | 0 .../src/test/resources/node_network_par.xml | 0 .../src/test/resources/omega_ref.xml | 0 .../src/test/resources/omega_ref_dyd.xml | 0 .../src/test/resources/omega_ref_par.xml | 0 .../src/test/resources/parameters.xsd | 0 .../test/resources/parametersSet/models.par | 0 .../test/resources/parametersSet/network.par | 0 .../test/resources/parametersSet/solvers.par | 0 .../parametersSet/solversMissingDefault.par | 0 .../phase_shifter_blocking_i_dyd.xml | 0 .../test/resources/phase_shifter_i_dyd.xml | 0 .../test/resources/phase_shifter_p_dyd.xml | 0 .../test/resources/set_point_inf_bus_dyd.xml | 0 .../test/resources/set_point_inf_bus_par.xml | 0 .../src/test/resources/shunt_dyd.xml | 0 .../src/test/resources/suppliers/curves.json | 0 .../suppliers/mappingDynamicModel.json | 0 .../resources/suppliers/mappingEvent.json | 0 .../src/test/resources/svarc_dyd.xml | 0 .../src/test/resources/svarc_sba_dyd.xml | 0 .../resources/tap_changer_blocking_dyd.xml | 0 .../tap_changer_blocking_empty_dyd.xml | 0 .../tap_changer_blocking_tap_changer_dyd.xml | 0 .../src/test/resources/tap_changer_dyd.xml | 0 .../test/resources/tap_changer_empty_dyd.xml | 0 .../src/test/resources/tfr_dyd.xml | 0 .../src/test/resources/under_voltage_dyd.xml | 0 .../src/test/resources/wecc_pv_dyd.xml | 0 .../src/test/resources/wecc_wt_dyd.xml | 0 .../src/test/resources/wecc_wt_par.xml | 0 .../test/resources/wecc_wt_synchro_dyd.xml | 0 pom.xml | 12 +-- 510 files changed, 1531 insertions(+), 1515 deletions(-) delete mode 100644 dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConfig.java rename {dynawaltz-dsl => dynawo-dsl}/pom.xml (93%) rename {dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz => dynawo-dsl/src/main/groovy/com/powsybl/dynawo}/dsl/DslReports.groovy (95%) rename dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzCurveGroovyExtension.groovy => dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoCurveGroovyExtension.groovy (83%) rename dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy => dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoDynamicModelGroovyExtension.groovy (82%) rename dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy => dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoEventModelGroovyExtension.groovy (81%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/AbstractModelSupplierTest.java (97%) rename dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynaWaltzGroovyCurvesSupplierTest.java => dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/CurvesSupplierTest.java (89%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/DynamicModelsSupplierTest.java (93%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/EventModelsSupplierTest.java (97%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/ieee/AbstractIeeeTest.java (79%) rename dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/DynaWaltzLocalCommandExecutor.java => dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/DynawoLocalCommandExecutor.java (68%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/ieee14/Ieee14DisconnectLineTest.java (79%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java (80%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/ieee14/Ieee14MacroConnectsTest.java (79%) rename {dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz => dynawo-dsl/src/test/java/com/powsybl/dynawo}/dsl/ieee57/Ieee57DisconnectGeneratorTest.java (79%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/curves.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/bus.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/danglingHvdcException.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/gen.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/genControllable.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/genFictitious.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/genTfo.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/gridFormingConverter.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/hvdcP.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/hvdcPDangling.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/hvdcVsc.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/hvdcVscDangling.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/infiniteBus.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/line.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadAB.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadABControllable.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadTransformer.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadTransformerTapChanger.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadTwoTransformers.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/loadTwoTransformersTapChangers.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/omegaGen.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/omegaGenControllable.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/overloadManagement (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/phaseShifterI.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/phaseShifterP.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/svarc.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/tapChanger.groovy (89%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/tapChangerBlocking.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/transformer.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/underVoltage.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/wecc.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynamicModels/weccSynchro.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynawo_bad_version.out (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/dynawo_version.out (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels/branchDisconnection.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels/equipmentDisconnection.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels/hvdcDisconnection.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels/nodeFault.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventModels/step.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingAPVParameters.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingDisconnectionEquipment.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingDisconnectionSide.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingNodeFaultParameters.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingStartTime.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/eventWarnings/missingStaticId.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/config/models.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/config/network.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/config/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs}/ieee14bus.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs}/models.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs}/network.par (100%) rename dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.crv => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.crv (100%) rename dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.dyd (100%) rename dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.jobs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.jobs (78%) rename dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.xiidm => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.xiidm (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs}/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs}/curves.csv (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs}/timeline.log (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/powsybl-inputs/IEEE14.iidm (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/powsybl-inputs/curves.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/powsybl-inputs/dynamicModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-disconnectline/powsybl-inputs/eventModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/config/models.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/config/network.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/config/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs}/ieee14bus.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs}/models.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs}/network.par (100%) rename dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.crv => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.crv (100%) rename dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.dyd => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.dyd (100%) rename dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.jobs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.jobs (78%) rename dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.xiidm => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.xiidm (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs}/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs}/curves.csv (100%) rename {dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs}/timeline.log (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/powsybl-inputs/IEEE14.iidm (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/powsybl-inputs/curves.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-macroconnects/powsybl-inputs/dynamicModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/config/models.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/config/network.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par (100%) rename dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.crv => dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.crv (100%) rename dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd => dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.dyd (100%) rename dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs => dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.jobs (78%) rename dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.xiidm => dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.xiidm (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/config/models.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/config/network.par (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/config/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs}/ieee57bus.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs}/models.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs}/network.par (100%) rename dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.crv => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.crv (100%) rename dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.dyd => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.dyd (100%) rename dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.jobs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.jobs (78%) rename dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.xiidm => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.xiidm (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs}/solvers.par (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs}/curves.csv (100%) rename {dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs => dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs}/timeline.log (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/IEEE57.iidm (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/curves.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/dynamicModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/eventModels.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/cla2MissingMeasurement2.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/claMissingControlled.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/claMissingMeasurement.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/claMissingMeasurementSide.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/hvdcVscWrongStaticType.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/missingDangling.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/missingDanglingProperty.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/missingEquipment.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/missingParameterId.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/missingStaticId.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/phaseShifterMissingTransformer.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/tapChangerCompatible.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/tapChangerMissingBus.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/tapChangerMissingBusList.groovy (100%) rename {dynawaltz-dsl => dynawo-dsl}/src/test/resources/warnings/underVoltageMissingGenerator.groovy (100%) rename dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/{DynaWaltzTest.java => DynawoSimulationTest.java} (83%) rename dynawo-integration-tests/src/test/resources/error/{powsybl_dynawaltz.xiidm => powsybl_dynawo.xiidm} (100%) rename {dynawaltz => dynawo-simulation}/pom.xml (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/DumpFileParameters.java (99%) create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConfig.java rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConstants.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java (81%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzContext.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java (78%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzHandler.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java (84%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzParameters.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationParameters.java (82%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzProvider.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java (67%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/ModelsRemovalSimplifier.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/ModelsSubstitutionSimplifier.java (77%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/AbstractDynamicModelBuilder.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/AbstractEquipmentModelBuilder.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuilderConfig.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuilderEquipment.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuilderEquipmentsList.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuilderIdListEquipmentList.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuilderReports.java (99%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/BuildersUtil.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/EquipmentModelBuilder.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/EventBuilderConfig.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/EventModelInfo.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelBuilder.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfig.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfigLoader.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfigLoaderImpl.java (76%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfigs.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfigsHandler.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelConfigsJsonDeserializer.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/builders/ModelInfo.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/curves/DynawoCurve.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/curves/DynawoCurvesBuilder.java (97%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/json/DynaWaltzSimulationParametersSerializer.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/json/DynawoSimulationParametersSerializer.java (70%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/AbstractBlackBoxModel.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/AbstractEquipmentBlackBoxModel.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/AbstractPureDynamicBlackBoxModel.java (84%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/BlackBoxModel.java (65%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/EquipmentBlackBoxModel.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/InjectionModel.java (92%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/MeasurementPointSuffix.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/Model.java (82%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/TransformerSide.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/VarConnection.java (92%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/VarMapping.java (92%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/AbstractAutomationSystemModelBuilder.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/BranchModel.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/ConnectionStatefulModel.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/TapChangerAutomationSystem.java (80%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/TapChangerAutomationSystemBuilder.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/TapChangerBlockingAutomationSystem.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/UnderVoltageAutomationSystem.java (81%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/UnderVoltageAutomationSystemBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java (78%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java (73%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterIModel.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/AbstractBus.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/AbstractBusBuilder.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/ActionConnectionPoint.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/BusOfFrequencySynchronizedModel.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/DefaultActionConnectionPoint.java (90%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/DefaultBusOfFrequencySynchronized.java (71%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/DefaultEquipmentConnectionPoint.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/EquipmentConnectionPoint.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/InfiniteBus.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/InfiniteBusBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/StandardBus.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/buses/StandardBusBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/AbstractDefaultModel.java (62%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/AbstractInjectionDefaultModel.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/DefaultModelConfiguration.java (71%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/DefaultModelFactory.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/DefaultModelFactoryInterface.java (90%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/defaultmodels/DefaultModelsHandler.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/AbstractDynamicLibEventDisconnection.java (81%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/AbstractEvent.java (79%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/AbstractEventModelBuilder.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/ContextDependentEvent.java (71%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/ControllableEquipment.java (50%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventActivePowerVariation.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventActivePowerVariationBuilder.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventBranchDisconnection.java (80%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventDisconnectionBuilder.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventHvdcDisconnection.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/EventInjectionDisconnection.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/NodeFaultEvent.java (81%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/events/NodeFaultEventBuilder.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/frequencysynchronizers/AbstractFrequencySynchronizer.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/frequencysynchronizers/FrequencySynchronizedModel.java (79%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/frequencysynchronizers/FrequencySynchronizerModel.java (81%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/frequencysynchronizers/OmegaRef.java (75%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/frequencysynchronizers/SetPoint.java (75%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/AbstractGenerator.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/AbstractGeneratorBuilder.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/DefaultGenerator.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/EnumGeneratorComponent.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/GeneratorFictitious.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/GeneratorFictitiousBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/GeneratorModel.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/GridFormingConverter.java (76%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/GridFormingConverterBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronizedGenerator.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronizedGeneratorBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronizedGeneratorControllable.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronizedWeccGen.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronousGenerator.java (76%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronousGeneratorBuilder.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/SynchronousGeneratorControllable.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/WeccBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/generators/WeccGen.java (82%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/AbstractHvdc.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/AbstractHvdcBuilder.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/DanglingSide.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/DefaultHvdc.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcModel.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcP.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcPBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcPDangling.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcVsc.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcVscBuilder.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/hvdc/HvdcVscDangling.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/lines/DefaultLine.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/lines/LineBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/lines/LineModel.java (79%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/lines/StandardLine.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/AbstractLoad.java (79%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/AbstractLoadModelBuilder.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/BaseLoad.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/BaseLoadBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/BaseLoadControllable.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/DefaultLoad.java (79%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadOneTransformer.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadOneTransformerBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadOneTransformerTapChanger.java (82%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadOneTransformerTapChangerBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadTwoTransformers.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadTwoTransformersBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadTwoTransformersTapChangers.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadTwoTransformersTapChangersBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/loads/LoadWithTransformers.java (74%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/macroconnections/MacroConnect.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/macroconnections/MacroConnectAttribute.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/macroconnections/MacroConnectionSuffix.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/macroconnections/MacroConnectionsAdder.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/macroconnections/MacroConnector.java (86%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/shunts/BaseShunt.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/shunts/BaseShuntBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/shunts/DefaultShunt.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/shunts/ShuntModel.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/svarcs/BaseStaticVarCompensator.java (84%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/svarcs/BaseStaticVarCompensatorBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/svarcs/DefaultStaticVarCompensator.java (83%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/transformers/DefaultTransformer.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/transformers/TapChangerModel.java (68%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/transformers/TransformerFixedRatio.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/transformers/TransformerFixedRatioBuilder.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/transformers/TransformerModel.java (84%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/utils/BlackBoxSupplierUtils.java (93%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/utils/BusUtils.java (94%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/utils/ImmutableLateInit.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/models/utils/SideUtils.java (95%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/parameters/Parameter.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/parameters/ParameterType.java (92%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/parameters/ParametersSet.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/parameters/Reference.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/Property.java (59%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/PropertyBuilder.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/PropertyParserUtils.java (98%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/PropertyType.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/SetGroupType.java (74%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/SupplierJsonDeserializer.java (97%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/curves/CurvesJsonDeserializer.java (96%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/dynamicmodels/DynamicModelConfig.java (87%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java (91%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/dynamicmodels/DynawoModelsSupplier.java (92%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/events/DynawoEventModelsSupplier.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/events/EventModelConfig.java (88%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/suppliers/events/EventModelConfigsJsonDeserializer.java (93%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/AbstractXmlDynawaltzWriter.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java (73%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/CurvesXml.java (62%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/DydXml.java (70%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzConstants.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java (67%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzXmlConstants.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationXmlConstants.java (85%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/JobsXml.java (69%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/MacroStaticReference.java (89%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/ParametersXml.java (90%) rename dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlDynawaltzWriter.java => dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java (66%) rename {dynawaltz/src/main/java/com/powsybl/dynawaltz => dynawo-simulation/src/main/java/com/powsybl/dynawo}/xml/XmlStreamWriterFactory.java (92%) rename {dynawaltz => dynawo-simulation}/src/main/resources/models.json (100%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/AbstractLocalCommandExecutor.java (97%) rename dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzConfigTest.java => dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoConfigTest.java (90%) rename dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersDatabaseTest.java => dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersDatabaseTest.java (89%) rename dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersTest.java => dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java (73%) rename dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzProviderTest.java => dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoProviderTest.java (85%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/ModelsSimplifierTest.java (82%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/builders/BuilderConfigTest.java (98%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/builders/CurvesBuilderTest.java (96%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/builders/DefaultLibBuilderTest.java (76%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/builders/ModelConfigLoaderTest.java (99%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/ActionConnectionPointTest.java (92%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/BuilderEquipmentSetterTest.java (95%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/HvdcTest.java (90%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/LoadTest.java (92%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/buses/StandardBusTest.java (82%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/defaultmodels/DefaultModelHandlerTest.java (90%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/models/lines/StandardLineTest.java (83%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/suppliers/DynawoCurvesJsonDeserializerTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/suppliers/DynawoEventModelsSupplierTest.java (93%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/suppliers/DynawoModelsSupplierTest.java (94%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/suppliers/SupplierJsonDeserializerTest.java (89%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/AbstractDynamicModelXmlTest.java (85%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/AbstractParametrizedDynamicModelXmlTest.java (81%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/ActivePowerVariationEventXmlTest.java (87%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/CurvesXmlTest.java (59%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/CustomParameterResolver.java (99%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DisconnectBranchEventXmlTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DisconnectEventXmlTest.java (90%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DisconnectHvdcEventXmlTest.java (93%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DisconnectionExceptionXmlTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DynamicModelsXmlTest.java (66%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DynamicOverloadManagementSystemModelXmlTest.java (88%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java (89%) rename dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynaWaltzTestUtil.java => dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynawoTestUtil.java (92%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/EmptyPhaseShifterBlockingIXmlTest.java (85%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/EmptyTapChangerAutomationSystemXmlTest.java (86%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java (86%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/EventXmlTest.java (72%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/HvdcXmlTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/JobsXmlTest.java (51%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/LoadsModelXmlTest.java (95%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/MappedParameterContext.java (97%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/NodeFaultEventXmlTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/OmegaRefModelXmlTest.java (89%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/ParametersXmlTest.java (63%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/PhaseShifterBlockingIXmlTest.java (83%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/PhaseShiftersXmlTest.java (87%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/SetPointInfiniteBusModelXmlTest.java (86%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/ShuntModelXmlTest.java (90%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/SvarcModelWithSbaXmlTest.java (91%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/SvarcModelXmlTest.java (89%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/TapChangerAutomationSystemExceptionsXmlTest.java (88%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/TapChangerAutomationSystemXmlTest.java (89%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/TapChangerBlockingAutomationSystemXmlTest.java (88%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java (87%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/TransformerModelXmlTest.java (85%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/UnderVoltageAutomationSystemXmlTest.java (88%) rename {dynawaltz/src/test/java/com/powsybl/dynawaltz => dynawo-simulation/src/test/java/com/powsybl/dynawo}/xml/WeccGenXmlTest.java (91%) rename dynawaltz/src/test/resources/DynaWaltzParameters.json => dynawo-simulation/src/test/resources/DynawoSimulationParameters.json (97%) rename {dynawaltz => dynawo-simulation}/src/test/resources/apv_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/apv_network_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/apv_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/cla_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/cla_tl_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/com/powsybl/config/test/config.yml (87%) rename {dynawaltz => dynawo-simulation}/src/test/resources/com/powsybl/config/test/configModels.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/com/powsybl/config/test/configNetwork.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/com/powsybl/config/test/configSolver.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/com/powsybl/config/test/filelist.txt (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/curves.csv (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/curvesInput.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/curvesInput.xsd (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_branch_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_branch_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_default_hvdc_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_hvdc_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_hvdc_pv_dangling_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_hvdc_pv_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_hvdc_vsc_dangling_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_hvdc_vsc_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/disconnect_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/dyd.xsd (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/dyd_fictitious.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/dynawo_bad_version.out (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/dynawo_version.out (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/empty_phase_shifter_blocking_i_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/events.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/grid_forming_converter_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/grid_forming_converter_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/hvdc_p_dangling_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/hvdc_p_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/hvdc_vsc_dangling_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/hvdc_vsc_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/jobs.xml (79%) rename {dynawaltz => dynawo-simulation}/src/test/resources/jobs.xsd (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/jobsWithDump.xml (79%) rename {dynawaltz => dynawo-simulation}/src/test/resources/jobsWithSpecificLogs.xml (84%) rename {dynawaltz => dynawo-simulation}/src/test/resources/load_alpha_beta_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/load_one_transformer_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/load_one_transformer_tap_changer_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/load_two_transformers_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/load_two_transformers_tap_changers_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/mergedLoads.xiidm (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/models.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/models_misspelled.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/noMergedLoads.xiidm (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/node_fault_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/node_fault_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/node_network_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/omega_ref.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/omega_ref_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/omega_ref_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/parameters.xsd (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/parametersSet/models.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/parametersSet/network.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/parametersSet/solvers.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/parametersSet/solversMissingDefault.par (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/phase_shifter_blocking_i_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/phase_shifter_i_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/phase_shifter_p_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/set_point_inf_bus_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/set_point_inf_bus_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/shunt_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/suppliers/curves.json (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/suppliers/mappingDynamicModel.json (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/suppliers/mappingEvent.json (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/svarc_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/svarc_sba_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tap_changer_blocking_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tap_changer_blocking_empty_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tap_changer_blocking_tap_changer_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tap_changer_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tap_changer_empty_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/tfr_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/under_voltage_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/wecc_pv_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/wecc_wt_dyd.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/wecc_wt_par.xml (100%) rename {dynawaltz => dynawo-simulation}/src/test/resources/wecc_wt_synchro_dyd.xml (100%) diff --git a/distribution/pom.xml b/distribution/pom.xml index 39bf21dcd..c5a8a4af8 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -35,11 +35,11 @@ ${project.groupId} - powsybl-dynawaltz + powsybl-dynawo-simulation ${project.groupId} - powsybl-dynawaltz-dsl + powsybl-dynawo-dsl ${project.groupId} diff --git a/docs/dynamic_simulation/configuration.md b/docs/dynamic_simulation/configuration.md index 2d9ad5fe9..cb5587519 100644 --- a/docs/dynamic_simulation/configuration.md +++ b/docs/dynamic_simulation/configuration.md @@ -55,7 +55,7 @@ The default value is `1`. **solver.type** `solver.type` defines the solver used in the simulation. -The available `com.powsybl.dynawaltz.DynaWaltzParameters.SolverType` values are: +The available `com.powsybl.dynawo.DynawoSimulationParameters.SolverType` values are: - `SIM`: the simplified solver (fixed time step solver) - `IDA`: the IDA solver (variable time step solver) @@ -87,7 +87,7 @@ The default value is `FALSE`. **timeline.exportMode** `timeline.exportMode` defines the file extension of the timeline export. -The available `com.powsybl.dynawaltz.DynaWaltzParameters.ExportMode` values are: +The available `com.powsybl.dynawo.DynawoSimulationParameters.ExportMode` values are: - `CSV` - `TXT`: same format as `CSV` but with `|` separator - `XML` @@ -101,7 +101,7 @@ The default value is `1e-6`. **log.levelFilter** `log.levelFilter` defines the log level for Dynawo log. The default value is `INFO`. -The available `com.powsybl.dynawaltz.DynaWaltzParameters.LogLevel` values are: +The available `com.powsybl.dynawo.DynawoSimulationParameters.LogLevel` values are: - `DEBUG` - `INFO` - `WARN` @@ -110,7 +110,7 @@ The available `com.powsybl.dynawaltz.DynaWaltzParameters.LogLevel` values are: **log.specificLogs** `log.specificLogs` defines as a list the specifics logs to return besides the regular Dynawo log. The default value is an empty list. -The available `com.powsybl.dynawaltz.DynaWaltzParameters.SpecificLog` values are: +The available `com.powsybl.dynawo.DynawoSimulationParameters.SpecificLog` values are: - `NETWORK` - `MODELER` - `PARAMETERS` diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConfig.java b/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConfig.java deleted file mode 100644 index 829e9d3e0..000000000 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConfig.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2020, 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/. - */ -package com.powsybl.dynawaltz; - -import com.powsybl.commons.config.ModuleConfig; -import com.powsybl.commons.config.PlatformConfig; -import com.powsybl.dynawo.commons.AbstractDynawoConfig; - -import java.nio.file.Path; - -/** - * @author Marcos de Miguel {@literal } - */ -public class DynaWaltzConfig extends AbstractDynawoConfig { - - public static final String DYNAWALTZ_LAUNCHER_PROGRAM_NAME = "dynawo"; - protected static final String DYNAWALTZ_MODULE_NAME = "dynawaltz"; - - public static DynaWaltzConfig load() { - return load(DynaWaltzConfig::new, DYNAWALTZ_MODULE_NAME); - } - - public static DynaWaltzConfig load(PlatformConfig platformConfig) { - return load(DynaWaltzConfig::new, DYNAWALTZ_MODULE_NAME, platformConfig); - } - - public DynaWaltzConfig(Path homeDir, boolean debug) { - super(homeDir, debug); - } - - protected DynaWaltzConfig(ModuleConfig config) { - super(config); - } - - @Override - public String getProgram() { - return getProgram(DYNAWALTZ_LAUNCHER_PROGRAM_NAME); - } -} diff --git a/dynawaltz-dsl/pom.xml b/dynawo-dsl/pom.xml similarity index 93% rename from dynawaltz-dsl/pom.xml rename to dynawo-dsl/pom.xml index f09ff81b3..9a4591f7c 100644 --- a/dynawaltz-dsl/pom.xml +++ b/dynawo-dsl/pom.xml @@ -16,9 +16,9 @@ 2.6.0-SNAPSHOT - powsybl-dynawaltz-dsl - DynaWaltz DSL - DSL for DynaWaltz + powsybl-dynawo-dsl + Dynawo DSL + DSL for Dynawo true @@ -46,7 +46,7 @@ com.powsybl - powsybl-dynawaltz + powsybl-dynawo-simulation org.apache.groovy @@ -100,14 +100,14 @@ test - ${project.groupId} - powsybl-dynawaltz - test-jar + com.powsybl + powsybl-iidm-test test - com.powsybl - powsybl-iidm-test + ${project.groupId} + powsybl-dynawo-simulation + test-jar test diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DslReports.groovy b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DslReports.groovy similarity index 95% rename from dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DslReports.groovy rename to dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DslReports.groovy index 3b071e602..6bf06d355 100644 --- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DslReports.groovy +++ b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DslReports.groovy @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl +package com.powsybl.dynawo.dsl import com.powsybl.commons.report.ReportNode diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzCurveGroovyExtension.groovy b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoCurveGroovyExtension.groovy similarity index 83% rename from dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzCurveGroovyExtension.groovy rename to dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoCurveGroovyExtension.groovy index 855c9902a..9c8283df2 100644 --- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzCurveGroovyExtension.groovy +++ b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoCurveGroovyExtension.groovy @@ -4,14 +4,14 @@ * 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.dynawaltz.dsl +package com.powsybl.dynawo.dsl import com.google.auto.service.AutoService import com.powsybl.commons.report.ReportNode import com.powsybl.dynamicsimulation.Curve import com.powsybl.dynamicsimulation.groovy.CurveGroovyExtension -import com.powsybl.dynawaltz.DynaWaltzProvider -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder +import com.powsybl.dynawo.DynawoSimulationProvider +import com.powsybl.dynawo.curves.DynawoCurvesBuilder import java.util.function.Consumer /** @@ -20,11 +20,11 @@ import java.util.function.Consumer * @author Mathieu Bague {@literal } */ @AutoService(CurveGroovyExtension.class) -class DynaWaltzCurveGroovyExtension implements CurveGroovyExtension { +class DynawoCurveGroovyExtension implements CurveGroovyExtension { @Override String getName() { - DynaWaltzProvider.NAME + DynawoSimulationProvider.NAME } @Override diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoDynamicModelGroovyExtension.groovy similarity index 82% rename from dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy rename to dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoDynamicModelGroovyExtension.groovy index 871b46451..75ff28359 100644 --- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzDynamicModelGroovyExtension.groovy +++ b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoDynamicModelGroovyExtension.groovy @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl +package com.powsybl.dynawo.dsl import com.google.auto.service.AutoService import com.powsybl.commons.report.ReportNode import com.powsybl.dynamicsimulation.DynamicModel 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.ModelConfigsHandler +import com.powsybl.dynawo.DynawoSimulationProvider +import com.powsybl.dynawo.builders.BuilderConfig +import com.powsybl.dynawo.builders.ModelBuilder +import com.powsybl.dynawo.builders.ModelConfigsHandler import com.powsybl.iidm.network.Network import java.util.function.Consumer @@ -23,17 +23,17 @@ import java.util.function.Consumer * @author Laurent Issertial {@literal } */ @AutoService(DynamicModelGroovyExtension.class) -class DynaWaltzDynamicModelGroovyExtension implements DynamicModelGroovyExtension { +class DynawoDynamicModelGroovyExtension implements DynamicModelGroovyExtension { private final List builderConfigs - DynaWaltzDynamicModelGroovyExtension() { + DynawoDynamicModelGroovyExtension() { builderConfigs = ModelConfigsHandler.getInstance().getBuilderConfigs() } @Override String getName() { - DynaWaltzProvider.NAME + DynawoSimulationProvider.NAME } @Override diff --git a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoEventModelGroovyExtension.groovy similarity index 81% rename from dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy rename to dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoEventModelGroovyExtension.groovy index 3a9a7a46b..287c570a2 100644 --- a/dynawaltz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/DynaWaltzEventModelGroovyExtension.groovy +++ b/dynawo-dsl/src/main/groovy/com/powsybl/dynawo/dsl/DynawoEventModelGroovyExtension.groovy @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl +package com.powsybl.dynawo.dsl import com.google.auto.service.AutoService import com.powsybl.commons.report.ReportNode import com.powsybl.dynamicsimulation.EventModel 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.ModelConfigsHandler +import com.powsybl.dynawo.DynawoSimulationProvider +import com.powsybl.dynawo.builders.EventBuilderConfig +import com.powsybl.dynawo.builders.ModelBuilder +import com.powsybl.dynawo.builders.ModelConfigsHandler import com.powsybl.iidm.network.Network import java.util.function.Consumer @@ -23,17 +23,17 @@ import java.util.function.Consumer * @author Laurent Issertial {@literal } */ @AutoService(EventModelGroovyExtension.class) -class DynaWaltzEventModelGroovyExtension implements EventModelGroovyExtension { +class DynawoEventModelGroovyExtension implements EventModelGroovyExtension { private final List builderConfigs - DynaWaltzEventModelGroovyExtension() { + DynawoEventModelGroovyExtension() { builderConfigs = ModelConfigsHandler.getInstance().getEventBuilderConfigs() } @Override String getName() { - DynaWaltzProvider.NAME + DynawoSimulationProvider.NAME } List getModelNames() { diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/AbstractModelSupplierTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/AbstractModelSupplierTest.java similarity index 97% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/AbstractModelSupplierTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/AbstractModelSupplierTest.java index c9507e507..85ad11bee 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/AbstractModelSupplierTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/AbstractModelSupplierTest.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl; +package com.powsybl.dynawo.dsl; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.test.TestUtil; diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynaWaltzGroovyCurvesSupplierTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/CurvesSupplierTest.java similarity index 89% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynaWaltzGroovyCurvesSupplierTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/CurvesSupplierTest.java index 2b540613b..86731722d 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynaWaltzGroovyCurvesSupplierTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/CurvesSupplierTest.java @@ -4,7 +4,7 @@ * 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.dynawaltz.dsl; +package com.powsybl.dynawo.dsl; import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; @@ -13,8 +13,8 @@ import com.powsybl.dynamicsimulation.groovy.CurveGroovyExtension; import com.powsybl.dynamicsimulation.groovy.GroovyCurvesSupplier; import com.powsybl.dynamicsimulation.groovy.GroovyExtension; -import com.powsybl.dynawaltz.curves.DynawoCurve; -import com.powsybl.dynawaltz.DynaWaltzProvider; +import com.powsybl.dynawo.curves.DynawoCurve; +import com.powsybl.dynawo.DynawoSimulationProvider; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; @@ -35,7 +35,7 @@ /** * @author Marcos de Miguel {@literal } */ -class DynaWaltzGroovyCurvesSupplierTest extends AbstractModelSupplierTest { +class CurvesSupplierTest extends AbstractModelSupplierTest { private FileSystem fileSystem; private Network network; @@ -63,9 +63,9 @@ void test() { } private List validateGroovyExtension() { - List extensions = GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME); + List extensions = GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME); assertEquals(1, extensions.size()); - assertInstanceOf(DynaWaltzCurveGroovyExtension.class, extensions.get(0)); + assertInstanceOf(DynawoCurveGroovyExtension.class, extensions.get(0)); return extensions; } diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/DynamicModelsSupplierTest.java similarity index 93% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/DynamicModelsSupplierTest.java index 35811d64e..c83e3430d 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/DynamicModelsSupplierTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/DynamicModelsSupplierTest.java @@ -5,35 +5,34 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl; +package com.powsybl.dynawo.dsl; import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension; import com.powsybl.dynamicsimulation.groovy.GroovyDynamicModelsSupplier; import com.powsybl.dynamicsimulation.groovy.GroovyExtension; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.EquipmentBlackBoxModel; -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.*; -import com.powsybl.dynawaltz.models.hvdc.HvdcP; -import com.powsybl.dynawaltz.models.hvdc.HvdcPDangling; -import com.powsybl.dynawaltz.models.hvdc.HvdcVsc; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscDangling; -import com.powsybl.dynawaltz.models.lines.StandardLine; -import com.powsybl.dynawaltz.models.loads.*; -import com.powsybl.dynawaltz.models.svarcs.BaseStaticVarCompensator; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatio; -import com.powsybl.dynawaltz.models.generators.GridFormingConverter; -import com.powsybl.dynawaltz.models.generators.SynchronizedWeccGen; -import com.powsybl.dynawaltz.models.generators.WeccGen; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.EquipmentBlackBoxModel; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystem; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystem; +import com.powsybl.dynawo.models.automationsystems.UnderVoltageAutomationSystem; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystem; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystem; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystem; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystem; +import com.powsybl.dynawo.models.buses.InfiniteBus; +import com.powsybl.dynawo.models.buses.StandardBus; +import com.powsybl.dynawo.models.generators.*; +import com.powsybl.dynawo.models.loads.*; +import com.powsybl.dynawo.models.hvdc.HvdcP; +import com.powsybl.dynawo.models.hvdc.HvdcPDangling; +import com.powsybl.dynawo.models.hvdc.HvdcVsc; +import com.powsybl.dynawo.models.hvdc.HvdcVscDangling; +import com.powsybl.dynawo.models.lines.StandardLine; +import com.powsybl.dynawo.models.svarcs.BaseStaticVarCompensator; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatio; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.FourSubstationsNodeBreakerFactory; @@ -55,7 +54,7 @@ */ class DynamicModelsSupplierTest extends AbstractModelSupplierTest { - private static final List EXTENSIONS = GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME); + private static final List EXTENSIONS = GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME); @Test void testLibsInfo() { diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/EventModelsSupplierTest.java similarity index 97% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/EventModelsSupplierTest.java index 76e181aa4..0f8a742ec 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/EventModelsSupplierTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/EventModelsSupplierTest.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.dsl; +package com.powsybl.dynawo.dsl; import com.powsybl.commons.PowsyblException; import com.powsybl.dynamicsimulation.EventModel; @@ -13,8 +13,8 @@ import com.powsybl.dynamicsimulation.groovy.EventModelGroovyExtension; import com.powsybl.dynamicsimulation.groovy.GroovyEventModelsSupplier; import com.powsybl.dynamicsimulation.groovy.GroovyExtension; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.models.events.*; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.models.events.*; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.HvdcTestNetwork; @@ -35,7 +35,7 @@ */ class EventModelsSupplierTest extends AbstractModelSupplierTest { - protected static final List EXTENSIONS = GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME); + protected static final List EXTENSIONS = GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME); @Test void testLibsInfo() { diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/AbstractIeeeTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java similarity index 79% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/AbstractIeeeTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java index 617f08ecd..72bb564a2 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/AbstractIeeeTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java @@ -4,7 +4,7 @@ * 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.dynawaltz.dsl.ieee; +package com.powsybl.dynawo.dsl.ieee; import com.powsybl.commons.config.PlatformConfig; import com.powsybl.commons.io.FileUtil; @@ -14,9 +14,9 @@ import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.dynamicsimulation.*; import com.powsybl.dynamicsimulation.groovy.*; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.iidm.network.Network; import org.junit.jupiter.api.AfterEach; @@ -57,7 +57,7 @@ protected void setup(String parametersFile, String networkParametersFile, String String dynamicModelsFile, String eventModelsFile, String curvesFile, int startTime, int stopTime) throws IOException { // The parameter files are copied into the PlatformConfig filesystem, - // that filesystem is the one that DynaWaltzContext and ParametersXml will use to read the parameters + // that filesystem is the one that DynawoSimulationContext and ParametersXml will use to read the parameters fileSystem = PlatformConfig.defaultConfig().getConfigDir().map(Path::getFileSystem).orElseThrow(AssertionError::new); workingDir = Files.createDirectory(fileSystem.getPath(getWorkingDirName())); @@ -68,7 +68,7 @@ protected void setup(String parametersFile, String networkParametersFile, String // Dynamic models if (dynamicModelsFile != null) { Files.copy(Objects.requireNonNull(getClass().getResourceAsStream(dynamicModelsFile)), workingDir.resolve("dynamicModels.groovy")); - List dynamicModelGroovyExtensions = GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME); + List dynamicModelGroovyExtensions = GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME); dynamicModelsSupplier = new GroovyDynamicModelsSupplier(workingDir.resolve("dynamicModels.groovy"), dynamicModelGroovyExtensions); } else { dynamicModelsSupplier = (n, NO_OP) -> Collections.emptyList(); @@ -77,7 +77,7 @@ protected void setup(String parametersFile, String networkParametersFile, String // Event models if (eventModelsFile != null) { Files.copy(Objects.requireNonNull(getClass().getResourceAsStream(eventModelsFile)), workingDir.resolve("eventModels.groovy")); - List eventModelGroovyExtensions = GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME); + List eventModelGroovyExtensions = GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME); eventModelsSupplier = new GroovyEventModelsSupplier(workingDir.resolve("eventModels.groovy"), eventModelGroovyExtensions); } else { eventModelsSupplier = EventModelsSupplier.empty(); @@ -86,7 +86,7 @@ protected void setup(String parametersFile, String networkParametersFile, String // Curves if (curvesFile != null) { Files.copy(Objects.requireNonNull(getClass().getResourceAsStream(curvesFile)), workingDir.resolve("curves.groovy")); - List curveGroovyExtensions = GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME); + List curveGroovyExtensions = GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME); curvesSupplier = new GroovyCurvesSupplier(workingDir.resolve("curves.groovy"), curveGroovyExtensions); } else { curvesSupplier = CurvesSupplier.empty(); @@ -95,26 +95,26 @@ protected void setup(String parametersFile, String networkParametersFile, String parameters = new DynamicSimulationParameters() .setStartTime(startTime) .setStopTime(stopTime); - DynaWaltzParameters dynaWaltzParameters = new DynaWaltzParameters(); - parameters.addExtension(DynaWaltzParameters.class, dynaWaltzParameters); - dynaWaltzParameters.setModelsParameters(ParametersXml.load(getClass().getResourceAsStream(parametersFile))) + DynawoSimulationParameters dynawoSimulationParameters = new DynawoSimulationParameters(); + parameters.addExtension(DynawoSimulationParameters.class, dynawoSimulationParameters); + dynawoSimulationParameters.setModelsParameters(ParametersXml.load(getClass().getResourceAsStream(parametersFile))) .setNetworkParameters(ParametersXml.load(getClass().getResourceAsStream(networkParametersFile), networkParametersId)) .setSolverParameters(ParametersXml.load(getClass().getResourceAsStream(solverParametersFile), solverParametersId)) - .setSolverType(DynaWaltzParameters.SolverType.IDA); + .setSolverType(DynawoSimulationParameters.SolverType.IDA); } - protected DynaWaltzParameters getDynaWaltzSimulationParameters(DynamicSimulationParameters parameters) { - DynaWaltzParameters dynaWaltzParameters = parameters.getExtension(DynaWaltzParameters.class); - if (dynaWaltzParameters == null) { - dynaWaltzParameters = DynaWaltzParameters.load(); + protected DynawoSimulationParameters getDynamicSimulationParameters(DynamicSimulationParameters parameters) { + DynawoSimulationParameters dynawoSimulationParameters = parameters.getExtension(DynawoSimulationParameters.class); + if (dynawoSimulationParameters == null) { + dynawoSimulationParameters = DynawoSimulationParameters.load(); } - return dynaWaltzParameters; + return dynawoSimulationParameters; } public DynamicSimulationResult runSimulation(LocalCommandExecutor commandExecutor) throws Exception { ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(workingDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); return dynawoSimulation.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier, network.getVariantManager().getWorkingVariantId(), computationManager, parameters, NO_OP); diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/DynaWaltzLocalCommandExecutor.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/DynawoLocalCommandExecutor.java similarity index 68% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/DynaWaltzLocalCommandExecutor.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/DynawoLocalCommandExecutor.java index c0cb1d2dc..940fc4bd7 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee/DynaWaltzLocalCommandExecutor.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/DynawoLocalCommandExecutor.java @@ -4,10 +4,10 @@ * 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.dynawaltz.dsl.ieee; +package com.powsybl.dynawo.dsl.ieee; import com.powsybl.computation.local.LocalCommandExecutor; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DynawoSimulationParameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xmlunit.builder.DiffBuilder; @@ -25,44 +25,44 @@ import java.util.Map; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.*; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; import static org.junit.jupiter.api.Assertions.assertFalse; /** * @author Marcos de Miguel {@literal } * @author Laurent Issertial {@literal } */ -public class DynaWaltzLocalCommandExecutor implements LocalCommandExecutor { +public class DynawoLocalCommandExecutor implements LocalCommandExecutor { - private static final Logger LOGGER = LoggerFactory.getLogger(DynaWaltzLocalCommandExecutor.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DynawoLocalCommandExecutor.class); private final FileSystem fileSystem; private final String networkId; - private final DynaWaltzParameters dynaWaltzParameters; + private final DynawoSimulationParameters dynawoSimulationParameters; private final String baseDirName; private final String stdOutFileRef; - public DynaWaltzLocalCommandExecutor(FileSystem fileSystem, String networkId, DynaWaltzParameters dynaWaltzParameters, String baseDir, String stdOutFileRef) { + public DynawoLocalCommandExecutor(FileSystem fileSystem, String networkId, DynawoSimulationParameters dynawoSimulationParameters, String baseDir, String stdOutFileRef) { this.fileSystem = Objects.requireNonNull(fileSystem); this.networkId = Objects.requireNonNull(networkId); - this.dynaWaltzParameters = Objects.requireNonNull(dynaWaltzParameters); + this.dynawoSimulationParameters = Objects.requireNonNull(dynawoSimulationParameters); this.baseDirName = baseDir; this.stdOutFileRef = stdOutFileRef; } protected void validateInputs(Path workingDir) throws IOException { - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/powsybl_dynawaltz.xiidm"), Files.newInputStream(workingDir.resolve(NETWORK_FILENAME))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/powsybl_dynawaltz.jobs"), Files.newInputStream(workingDir.resolve(JOBS_FILENAME))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/powsybl_dynawaltz.dyd"), Files.newInputStream(workingDir.resolve(DYD_FILENAME))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/models.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynaWaltzParameters.MODELS_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/network.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynaWaltzParameters.NETWORK_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/solvers.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynaWaltzParameters.SOLVER_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/" + networkId + ".par"), Files.newInputStream(workingDir.resolve(networkId + ".par"))); - compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-inputs/powsybl_dynawaltz.crv"), Files.newInputStream(workingDir.resolve(CRV_FILENAME))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/powsybl_dynawo.xiidm"), Files.newInputStream(workingDir.resolve(NETWORK_FILENAME))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/powsybl_dynawo.jobs"), Files.newInputStream(workingDir.resolve(JOBS_FILENAME))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/powsybl_dynawo.dyd"), Files.newInputStream(workingDir.resolve(DYD_FILENAME))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/models.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynawoSimulationParameters.MODELS_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/network.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynawoSimulationParameters.NETWORK_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/solvers.par"), Files.newInputStream(workingDir.resolve(fileSystem.getPath(DynawoSimulationParameters.SOLVER_OUTPUT_PARAMETERS_FILE).getFileName().toString()))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/" + networkId + ".par"), Files.newInputStream(workingDir.resolve(networkId + ".par"))); + compareXml(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-inputs/powsybl_dynawo.crv"), Files.newInputStream(workingDir.resolve(CRV_FILENAME))); } protected void copyOutputs(Path workingDir) throws IOException { Path output = Files.createDirectories(workingDir.resolve("outputs/curves").toAbsolutePath()); - Files.copy(Objects.requireNonNull(getClass().getResourceAsStream("/" + baseDirName + "/dynawaltz-outputs/curves.csv")), output.resolve("curves.csv")); + Files.copy(Objects.requireNonNull(getClass().getResourceAsStream("/" + baseDirName + "/dynawo-outputs/curves.csv")), output.resolve("curves.csv")); } @Override diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DisconnectLineTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DisconnectLineTest.java similarity index 79% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DisconnectLineTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DisconnectLineTest.java index 901bb34d4..7128bcbce 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DisconnectLineTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DisconnectLineTest.java @@ -4,11 +4,11 @@ * 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.dynawaltz.dsl.ieee14; +package com.powsybl.dynawo.dsl.ieee14; import com.powsybl.dynamicsimulation.DynamicSimulationResult; -import com.powsybl.dynawaltz.dsl.ieee.AbstractIeeeTest; -import com.powsybl.dynawaltz.dsl.ieee.DynaWaltzLocalCommandExecutor; +import com.powsybl.dynawo.dsl.ieee.AbstractIeeeTest; +import com.powsybl.dynawo.dsl.ieee.DynawoLocalCommandExecutor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -36,7 +36,7 @@ public void setup() throws IOException { @Test void testSimulation() throws Exception { - DynaWaltzLocalCommandExecutor commandExecutor = new DynaWaltzLocalCommandExecutor(fileSystem, network.getId(), getDynaWaltzSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); + DynawoLocalCommandExecutor commandExecutor = new DynawoLocalCommandExecutor(fileSystem, network.getId(), getDynamicSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); DynamicSimulationResult result; result = runSimulation(commandExecutor); assertNotNull(result); diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java similarity index 80% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java index 46c16e084..cee3f36d0 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14DynamicOverloadManagementSystemTest.java @@ -4,11 +4,11 @@ * 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.dynawaltz.dsl.ieee14; +package com.powsybl.dynawo.dsl.ieee14; import com.powsybl.dynamicsimulation.DynamicSimulationResult; -import com.powsybl.dynawaltz.dsl.ieee.AbstractIeeeTest; -import com.powsybl.dynawaltz.dsl.ieee.DynaWaltzLocalCommandExecutor; +import com.powsybl.dynawo.dsl.ieee.AbstractIeeeTest; +import com.powsybl.dynawo.dsl.ieee.DynawoLocalCommandExecutor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -37,7 +37,7 @@ void setup() throws IOException { @Test void testSimulation() throws Exception { - DynaWaltzLocalCommandExecutor commandExecutor = new DynaWaltzLocalCommandExecutor(fileSystem, network.getId(), getDynaWaltzSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); + DynawoLocalCommandExecutor commandExecutor = new DynawoLocalCommandExecutor(fileSystem, network.getId(), getDynamicSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); DynamicSimulationResult result = runSimulation(commandExecutor); assertNotNull(result); } diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14MacroConnectsTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14MacroConnectsTest.java similarity index 79% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14MacroConnectsTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14MacroConnectsTest.java index 78f52e92d..ef2577a41 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee14/Ieee14MacroConnectsTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee14/Ieee14MacroConnectsTest.java @@ -4,11 +4,11 @@ * 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.dynawaltz.dsl.ieee14; +package com.powsybl.dynawo.dsl.ieee14; import com.powsybl.dynamicsimulation.DynamicSimulationResult; -import com.powsybl.dynawaltz.dsl.ieee.AbstractIeeeTest; -import com.powsybl.dynawaltz.dsl.ieee.DynaWaltzLocalCommandExecutor; +import com.powsybl.dynawo.dsl.ieee.AbstractIeeeTest; +import com.powsybl.dynawo.dsl.ieee.DynawoLocalCommandExecutor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -37,7 +37,7 @@ void setup() throws IOException { @Test void testSimulation() throws Exception { - DynaWaltzLocalCommandExecutor commandExecutor = new DynaWaltzLocalCommandExecutor(fileSystem, network.getId(), getDynaWaltzSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); + DynawoLocalCommandExecutor commandExecutor = new DynawoLocalCommandExecutor(fileSystem, network.getId(), getDynamicSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); DynamicSimulationResult result = runSimulation(commandExecutor); assertNotNull(result); } diff --git a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee57/Ieee57DisconnectGeneratorTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee57/Ieee57DisconnectGeneratorTest.java similarity index 79% rename from dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee57/Ieee57DisconnectGeneratorTest.java rename to dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee57/Ieee57DisconnectGeneratorTest.java index b3fac05cd..ab2df83e3 100644 --- a/dynawaltz-dsl/src/test/java/com/powsybl/dynawaltz/dsl/ieee57/Ieee57DisconnectGeneratorTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee57/Ieee57DisconnectGeneratorTest.java @@ -4,11 +4,11 @@ * 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.dynawaltz.dsl.ieee57; +package com.powsybl.dynawo.dsl.ieee57; import com.powsybl.dynamicsimulation.DynamicSimulationResult; -import com.powsybl.dynawaltz.dsl.ieee.AbstractIeeeTest; -import com.powsybl.dynawaltz.dsl.ieee.DynaWaltzLocalCommandExecutor; +import com.powsybl.dynawo.dsl.ieee.AbstractIeeeTest; +import com.powsybl.dynawo.dsl.ieee.DynawoLocalCommandExecutor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -36,7 +36,7 @@ void setup() throws IOException { @Test void testSimulation() throws Exception { - DynaWaltzLocalCommandExecutor commandExecutor = new DynaWaltzLocalCommandExecutor(fileSystem, network.getId(), getDynaWaltzSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); + DynawoLocalCommandExecutor commandExecutor = new DynawoLocalCommandExecutor(fileSystem, network.getId(), getDynamicSimulationParameters(parameters), getWorkingDirName(), "/dynawo_version.out"); DynamicSimulationResult result = runSimulation(commandExecutor); assertNotNull(result); } diff --git a/dynawaltz-dsl/src/test/resources/curves.groovy b/dynawo-dsl/src/test/resources/curves.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/curves.groovy rename to dynawo-dsl/src/test/resources/curves.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels.groovy b/dynawo-dsl/src/test/resources/dynamicModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels.groovy rename to dynawo-dsl/src/test/resources/dynamicModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/bus.groovy b/dynawo-dsl/src/test/resources/dynamicModels/bus.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/bus.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/bus.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/danglingHvdcException.groovy b/dynawo-dsl/src/test/resources/dynamicModels/danglingHvdcException.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/danglingHvdcException.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/danglingHvdcException.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/gen.groovy b/dynawo-dsl/src/test/resources/dynamicModels/gen.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/gen.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/gen.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/genControllable.groovy b/dynawo-dsl/src/test/resources/dynamicModels/genControllable.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/genControllable.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/genControllable.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/genFictitious.groovy b/dynawo-dsl/src/test/resources/dynamicModels/genFictitious.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/genFictitious.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/genFictitious.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/genTfo.groovy b/dynawo-dsl/src/test/resources/dynamicModels/genTfo.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/genTfo.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/genTfo.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/gridFormingConverter.groovy b/dynawo-dsl/src/test/resources/dynamicModels/gridFormingConverter.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/gridFormingConverter.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/gridFormingConverter.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/hvdcP.groovy b/dynawo-dsl/src/test/resources/dynamicModels/hvdcP.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/hvdcP.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/hvdcP.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/hvdcPDangling.groovy b/dynawo-dsl/src/test/resources/dynamicModels/hvdcPDangling.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/hvdcPDangling.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/hvdcPDangling.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/hvdcVsc.groovy b/dynawo-dsl/src/test/resources/dynamicModels/hvdcVsc.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/hvdcVsc.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/hvdcVsc.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/hvdcVscDangling.groovy b/dynawo-dsl/src/test/resources/dynamicModels/hvdcVscDangling.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/hvdcVscDangling.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/hvdcVscDangling.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/infiniteBus.groovy b/dynawo-dsl/src/test/resources/dynamicModels/infiniteBus.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/infiniteBus.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/infiniteBus.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/line.groovy b/dynawo-dsl/src/test/resources/dynamicModels/line.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/line.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/line.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadAB.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadAB.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadAB.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadAB.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadABControllable.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadABControllable.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadABControllable.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadABControllable.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadTransformer.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadTransformer.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadTransformer.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadTransformer.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadTransformerTapChanger.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadTransformerTapChanger.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadTransformerTapChanger.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadTransformerTapChanger.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadTwoTransformers.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadTwoTransformers.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadTwoTransformers.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadTwoTransformers.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/loadTwoTransformersTapChangers.groovy b/dynawo-dsl/src/test/resources/dynamicModels/loadTwoTransformersTapChangers.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/loadTwoTransformersTapChangers.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/loadTwoTransformersTapChangers.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/omegaGen.groovy b/dynawo-dsl/src/test/resources/dynamicModels/omegaGen.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/omegaGen.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/omegaGen.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/omegaGenControllable.groovy b/dynawo-dsl/src/test/resources/dynamicModels/omegaGenControllable.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/omegaGenControllable.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/omegaGenControllable.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagement b/dynawo-dsl/src/test/resources/dynamicModels/overloadManagement similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagement rename to dynawo-dsl/src/test/resources/dynamicModels/overloadManagement diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy b/dynawo-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/overloadManagementTwoLevels.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/phaseShifterI.groovy b/dynawo-dsl/src/test/resources/dynamicModels/phaseShifterI.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/phaseShifterI.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/phaseShifterI.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/phaseShifterP.groovy b/dynawo-dsl/src/test/resources/dynamicModels/phaseShifterP.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/phaseShifterP.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/phaseShifterP.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/svarc.groovy b/dynawo-dsl/src/test/resources/dynamicModels/svarc.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/svarc.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/svarc.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChanger.groovy b/dynawo-dsl/src/test/resources/dynamicModels/tapChanger.groovy similarity index 89% rename from dynawaltz-dsl/src/test/resources/dynamicModels/tapChanger.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/tapChanger.groovy index 1905ee8d0..3dba1dc35 100644 --- a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChanger.groovy +++ b/dynawo-dsl/src/test/resources/dynamicModels/tapChanger.groovy @@ -8,7 +8,7 @@ package dynamicModels -import com.powsybl.dynawaltz.models.TransformerSide +import com.powsybl.dynawo.models.TransformerSide TapChangerAutomaton { diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy b/dynawo-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/tapChangerBlocking.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy b/dynawo-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/tapChangerBlockingBusBar.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/transformer.groovy b/dynawo-dsl/src/test/resources/dynamicModels/transformer.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/transformer.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/transformer.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/underVoltage.groovy b/dynawo-dsl/src/test/resources/dynamicModels/underVoltage.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/underVoltage.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/underVoltage.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/wecc.groovy b/dynawo-dsl/src/test/resources/dynamicModels/wecc.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/wecc.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/wecc.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynamicModels/weccSynchro.groovy b/dynawo-dsl/src/test/resources/dynamicModels/weccSynchro.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynamicModels/weccSynchro.groovy rename to dynawo-dsl/src/test/resources/dynamicModels/weccSynchro.groovy diff --git a/dynawaltz-dsl/src/test/resources/dynawo_bad_version.out b/dynawo-dsl/src/test/resources/dynawo_bad_version.out similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynawo_bad_version.out rename to dynawo-dsl/src/test/resources/dynawo_bad_version.out diff --git a/dynawaltz-dsl/src/test/resources/dynawo_version.out b/dynawo-dsl/src/test/resources/dynawo_version.out similarity index 100% rename from dynawaltz-dsl/src/test/resources/dynawo_version.out rename to dynawo-dsl/src/test/resources/dynawo_version.out diff --git a/dynawaltz-dsl/src/test/resources/eventModels.groovy b/dynawo-dsl/src/test/resources/eventModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels.groovy rename to dynawo-dsl/src/test/resources/eventModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventModels/branchDisconnection.groovy b/dynawo-dsl/src/test/resources/eventModels/branchDisconnection.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels/branchDisconnection.groovy rename to dynawo-dsl/src/test/resources/eventModels/branchDisconnection.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventModels/equipmentDisconnection.groovy b/dynawo-dsl/src/test/resources/eventModels/equipmentDisconnection.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels/equipmentDisconnection.groovy rename to dynawo-dsl/src/test/resources/eventModels/equipmentDisconnection.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventModels/hvdcDisconnection.groovy b/dynawo-dsl/src/test/resources/eventModels/hvdcDisconnection.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels/hvdcDisconnection.groovy rename to dynawo-dsl/src/test/resources/eventModels/hvdcDisconnection.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventModels/nodeFault.groovy b/dynawo-dsl/src/test/resources/eventModels/nodeFault.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels/nodeFault.groovy rename to dynawo-dsl/src/test/resources/eventModels/nodeFault.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventModels/step.groovy b/dynawo-dsl/src/test/resources/eventModels/step.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventModels/step.groovy rename to dynawo-dsl/src/test/resources/eventModels/step.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingAPVParameters.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingAPVParameters.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingAPVParameters.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingAPVParameters.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingDisconnectionEquipment.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingDisconnectionEquipment.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingDisconnectionEquipment.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingDisconnectionEquipment.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingDisconnectionSide.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingDisconnectionSide.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingDisconnectionSide.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingDisconnectionSide.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingNodeFaultParameters.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingNodeFaultParameters.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingNodeFaultParameters.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingNodeFaultParameters.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingStartTime.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingStartTime.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingStartTime.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingStartTime.groovy diff --git a/dynawaltz-dsl/src/test/resources/eventWarnings/missingStaticId.groovy b/dynawo-dsl/src/test/resources/eventWarnings/missingStaticId.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/eventWarnings/missingStaticId.groovy rename to dynawo-dsl/src/test/resources/eventWarnings/missingStaticId.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/models.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/config/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/models.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/config/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/network.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/config/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/network.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/config/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/solvers.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/config/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/config/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/config/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/ieee14bus.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/ieee14bus.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/ieee14bus.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/ieee14bus.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/models.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/models.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/network.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/network.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.crv b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.crv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.crv rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.crv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.dyd similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.dyd rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.dyd diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.jobs b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.jobs similarity index 78% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.jobs rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.jobs index 5591a9cb7..1bea0b033 100644 --- a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.jobs +++ b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.jobs @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.xiidm b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.xiidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/powsybl_dynawaltz.xiidm rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/powsybl_dynawo.xiidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/solvers.par b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-inputs/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-inputs/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs/curves.csv b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs/curves.csv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs/curves.csv rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs/curves.csv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs/timeline.log b/dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs/timeline.log similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/dynawaltz-outputs/timeline.log rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/dynawo-outputs/timeline.log diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/IEEE14.iidm b/dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/IEEE14.iidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/IEEE14.iidm rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/IEEE14.iidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/curves.groovy b/dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/curves.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/curves.groovy rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/curves.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/dynamicModels.groovy b/dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/dynamicModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/dynamicModels.groovy rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/dynamicModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/eventModels.groovy b/dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/eventModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/eventModels.groovy rename to dynawo-dsl/src/test/resources/ieee14-disconnectline/powsybl-inputs/eventModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/models.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/config/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/models.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/config/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/network.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/config/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/network.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/config/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/solvers.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/config/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/config/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/config/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/ieee14bus.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/ieee14bus.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/ieee14bus.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/ieee14bus.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/models.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/models.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/network.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/network.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.crv b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.crv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.crv rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.crv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.dyd similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.dyd rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.dyd diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.jobs b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.jobs similarity index 78% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.jobs rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.jobs index 2ffceda39..022b08908 100644 --- a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.jobs +++ b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.jobs @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.xiidm b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.xiidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/powsybl_dynawaltz.xiidm rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/powsybl_dynawo.xiidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/solvers.par b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-inputs/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-inputs/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs/curves.csv b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs/curves.csv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs/curves.csv rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs/curves.csv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs/timeline.log b/dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs/timeline.log similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/dynawaltz-outputs/timeline.log rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/dynawo-outputs/timeline.log diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/IEEE14.iidm b/dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/IEEE14.iidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/IEEE14.iidm rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/IEEE14.iidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/curves.groovy b/dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/curves.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/curves.groovy rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/curves.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/dynamicModels.groovy b/dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/dynamicModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/dynamicModels.groovy rename to dynawo-dsl/src/test/resources/ieee14-macroconnects/powsybl-inputs/dynamicModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/config/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/ieee14bus.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.crv b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.crv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.crv rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.crv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.dyd similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.dyd rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.dyd diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.jobs similarity index 78% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.jobs index efff61aa6..bffb9fbc2 100644 --- a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.jobs +++ b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.jobs @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.xiidm b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.xiidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawaltz.xiidm rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/powsybl_dynawo.xiidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-inputs/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/curves.csv diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/dynawaltz-outputs/timeline.log diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/IEEE14.iidm diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/curves.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/dynamicModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy b/dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy rename to dynawo-dsl/src/test/resources/ieee14-overloadmanagementsystem/powsybl-inputs/eventModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/models.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/models.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/network.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/network.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/solvers.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/config/solvers.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/config/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/ieee57bus.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/ieee57bus.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/ieee57bus.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/ieee57bus.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/models.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/models.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/models.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/models.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/network.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/network.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/network.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/network.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.crv b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.crv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.crv rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.crv diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.dyd b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.dyd similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.dyd rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.dyd diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.jobs b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.jobs similarity index 78% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.jobs rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.jobs index 2f6f9dcbc..f9895dd09 100644 --- a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.jobs +++ b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.jobs @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.xiidm b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.xiidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/powsybl_dynawaltz.xiidm rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/powsybl_dynawo.xiidm diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/solvers.par b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/solvers.par similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-inputs/solvers.par rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-inputs/solvers.par diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs/curves.csv b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs/curves.csv similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs/curves.csv rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs/curves.csv diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs/timeline.log b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs/timeline.log similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/dynawaltz-outputs/timeline.log rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/dynawo-outputs/timeline.log diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/IEEE57.iidm b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/IEEE57.iidm similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/IEEE57.iidm rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/IEEE57.iidm diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/curves.groovy b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/curves.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/curves.groovy rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/curves.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/dynamicModels.groovy b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/dynamicModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/dynamicModels.groovy rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/dynamicModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/eventModels.groovy b/dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/eventModels.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/eventModels.groovy rename to dynawo-dsl/src/test/resources/ieee57-disconnectgenerator/powsybl-inputs/eventModels.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy b/dynawo-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy rename to dynawo-dsl/src/test/resources/warnings/cla2MissingMeasurement2.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy b/dynawo-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy rename to dynawo-dsl/src/test/resources/warnings/cla2MissingMeasurementSide2.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy b/dynawo-dsl/src/test/resources/warnings/claMissingControlled.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/claMissingControlled.groovy rename to dynawo-dsl/src/test/resources/warnings/claMissingControlled.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy b/dynawo-dsl/src/test/resources/warnings/claMissingMeasurement.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurement.groovy rename to dynawo-dsl/src/test/resources/warnings/claMissingMeasurement.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy b/dynawo-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy rename to dynawo-dsl/src/test/resources/warnings/claMissingMeasurementSide.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/hvdcVscWrongStaticType.groovy b/dynawo-dsl/src/test/resources/warnings/hvdcVscWrongStaticType.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/hvdcVscWrongStaticType.groovy rename to dynawo-dsl/src/test/resources/warnings/hvdcVscWrongStaticType.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/missingDangling.groovy b/dynawo-dsl/src/test/resources/warnings/missingDangling.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/missingDangling.groovy rename to dynawo-dsl/src/test/resources/warnings/missingDangling.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/missingDanglingProperty.groovy b/dynawo-dsl/src/test/resources/warnings/missingDanglingProperty.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/missingDanglingProperty.groovy rename to dynawo-dsl/src/test/resources/warnings/missingDanglingProperty.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/missingEquipment.groovy b/dynawo-dsl/src/test/resources/warnings/missingEquipment.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/missingEquipment.groovy rename to dynawo-dsl/src/test/resources/warnings/missingEquipment.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/missingParameterId.groovy b/dynawo-dsl/src/test/resources/warnings/missingParameterId.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/missingParameterId.groovy rename to dynawo-dsl/src/test/resources/warnings/missingParameterId.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/missingStaticId.groovy b/dynawo-dsl/src/test/resources/warnings/missingStaticId.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/missingStaticId.groovy rename to dynawo-dsl/src/test/resources/warnings/missingStaticId.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/phaseShifterMissingTransformer.groovy b/dynawo-dsl/src/test/resources/warnings/phaseShifterMissingTransformer.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/phaseShifterMissingTransformer.groovy rename to dynawo-dsl/src/test/resources/warnings/phaseShifterMissingTransformer.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy b/dynawo-dsl/src/test/resources/warnings/tapChangerCompatible.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/tapChangerCompatible.groovy rename to dynawo-dsl/src/test/resources/warnings/tapChangerCompatible.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBus.groovy b/dynawo-dsl/src/test/resources/warnings/tapChangerMissingBus.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBus.groovy rename to dynawo-dsl/src/test/resources/warnings/tapChangerMissingBus.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy b/dynawo-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy rename to dynawo-dsl/src/test/resources/warnings/tapChangerMissingBusList.groovy diff --git a/dynawaltz-dsl/src/test/resources/warnings/underVoltageMissingGenerator.groovy b/dynawo-dsl/src/test/resources/warnings/underVoltageMissingGenerator.groovy similarity index 100% rename from dynawaltz-dsl/src/test/resources/warnings/underVoltageMissingGenerator.groovy rename to dynawo-dsl/src/test/resources/warnings/underVoltageMissingGenerator.groovy diff --git a/dynawo-integration-tests/pom.xml b/dynawo-integration-tests/pom.xml index 57b4e43a6..6436749bf 100644 --- a/dynawo-integration-tests/pom.xml +++ b/dynawo-integration-tests/pom.xml @@ -36,11 +36,11 @@ com.powsybl - powsybl-dynawaltz + powsybl-dynawo-simulation com.powsybl - powsybl-dynawaltz-dsl + powsybl-dynawo-dsl com.powsybl diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index 56e5d6e45..1d136dbb2 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -17,10 +17,10 @@ import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension; import com.powsybl.dynamicsimulation.groovy.GroovyDynamicModelsSupplier; import com.powsybl.dynamicsimulation.groovy.GroovyExtension; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.parameters.ParametersSet; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.dynawo.security.DynawoAlgorithmsConfig; import com.powsybl.dynawo.security.DynawoSecurityAnalysisProvider; @@ -53,7 +53,7 @@ class DynawoSecurityAnalysisTest extends AbstractDynawoTest { private DynamicSecurityAnalysisParameters parameters; - private DynaWaltzParameters dynaWaltzParameters; + private DynawoSimulationParameters dynawoSimulationParameters; @Override @BeforeEach @@ -63,8 +63,8 @@ void setUp() throws Exception { parameters = new DynamicSecurityAnalysisParameters() .setDynamicSimulationParameters(new DynamicSimulationParameters(0, 100)) .setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(50)); - dynaWaltzParameters = new DynaWaltzParameters(); - parameters.getDynamicSimulationParameters().addExtension(DynaWaltzParameters.class, dynaWaltzParameters); + dynawoSimulationParameters = new DynawoSimulationParameters(); + parameters.getDynamicSimulationParameters().addExtension(DynawoSimulationParameters.class, dynawoSimulationParameters); } @Test @@ -73,15 +73,15 @@ void testIeee14() throws IOException { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/ieee14/disconnectline/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/models.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/solvers.par"), "2"); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA); + .setSolverType(DynawoSimulationParameters.SolverType.IDA); ReportNode reportNode = ReportNode.newRootReportNode() .withMessageTemplate("root", "Root message") diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynaWaltzTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java similarity index 83% rename from dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynaWaltzTest.java rename to dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java index 6c474426c..166f82922 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynaWaltzTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java @@ -11,14 +11,14 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.*; import com.powsybl.dynamicsimulation.groovy.*; -import com.powsybl.dynawaltz.DumpFileParameters; -import com.powsybl.dynawaltz.DynaWaltzConfig; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.parameters.ParametersSet; -import com.powsybl.dynawaltz.suppliers.dynamicmodels.DynawoModelsSupplier; -import com.powsybl.dynawaltz.suppliers.events.DynawoEventModelsSupplier; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.DumpFileParameters; +import com.powsybl.dynawo.DynawoSimulationConfig; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynawoModelsSupplier; +import com.powsybl.dynawo.suppliers.events.DynawoEventModelsSupplier; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VariantManagerConstants; import com.powsybl.iidm.network.test.SvcTestCaseFactory; @@ -40,24 +40,24 @@ /** * @author Geoffroy Jamgotchian {@literal } */ -class DynaWaltzTest extends AbstractDynawoTest { +class DynawoSimulationTest extends AbstractDynawoTest { private DynamicSimulationProvider provider; private DynamicSimulationParameters parameters; - private DynaWaltzParameters dynaWaltzParameters; + private DynawoSimulationParameters dynawoSimulationParameters; @Override @BeforeEach void setUp() throws Exception { super.setUp(); - provider = new DynaWaltzProvider(new DynaWaltzConfig(Path.of("/dynawo"), false)); + provider = new DynawoSimulationProvider(new DynawoSimulationConfig(Path.of("/dynawo"), false)); parameters = new DynamicSimulationParameters() .setStartTime(0) .setStopTime(100); - dynaWaltzParameters = new DynaWaltzParameters(); - parameters.addExtension(DynaWaltzParameters.class, dynaWaltzParameters); + dynawoSimulationParameters = new DynawoSimulationParameters(); + parameters.addExtension(DynawoSimulationParameters.class, dynawoSimulationParameters); } @Test @@ -66,24 +66,24 @@ void testIeee14() { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/ieee14/disconnectline/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyEventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier( getResourceAsStream("/ieee14/disconnectline/eventModels.groovy"), - GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyCurvesSupplier curvesSupplier = new GroovyCurvesSupplier( getResourceAsStream("/ieee14/disconnectline/curves.groovy"), - GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/models.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/solvers.par"), "2"); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) - .setTimelineExportMode(DynaWaltzParameters.ExportMode.XML); + .setSolverType(DynawoSimulationParameters.SolverType.IDA) + .setTimelineExportMode(DynawoSimulationParameters.ExportMode.XML); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier, VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP) @@ -106,15 +106,15 @@ void testIeee14WithDump() throws IOException { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/ieee14/disconnectline/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyEventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier( getResourceAsStream("/ieee14/disconnectline/eventModels.groovy"), - GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyCurvesSupplier curvesSupplier = new GroovyCurvesSupplier( getResourceAsStream("/ieee14/disconnectline/curves.groovy"), - GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME)); Path dumpDir = Files.createDirectory(localDir.resolve("dumpFiles")); @@ -124,10 +124,10 @@ void testIeee14WithDump() throws IOException { ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/solvers.par"), "2"); DumpFileParameters dumpFileParameters = DumpFileParameters.createExportDumpFileParameters(dumpDir); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) + .setSolverType(DynawoSimulationParameters.SolverType.IDA) .setDumpFileParameters(dumpFileParameters); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier, @@ -143,7 +143,7 @@ void testIeee14WithDump() throws IOException { try (Stream stream = Files.list(dumpDir)) { dumpFile = stream.findFirst().map(Path::getFileName).map(Path::toString).orElseThrow(); } - dynaWaltzParameters.setDumpFileParameters(DumpFileParameters.createImportDumpFileParameters(dumpDir, dumpFile)); + dynawoSimulationParameters.setDumpFileParameters(DumpFileParameters.createImportDumpFileParameters(dumpDir, dumpFile)); result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier, VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP) @@ -158,15 +158,15 @@ void testSvarc() { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/svarc/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/svarc/models.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/svarc/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/svarc/solvers.par"), "2"); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) + .setSolverType(DynawoSimulationParameters.SolverType.IDA) .setPrecision(10e-8); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, EventModelsSupplier.empty(), CurvesSupplier.empty(), @@ -187,17 +187,17 @@ void testHvdc() { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/hvdc/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/hvdc/models.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/hvdc/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/hvdc/solvers.par"), "2"); ReportNode reportNode = newRootReportNode().withMessageTemplate("testHvdc", "Test HVDC").build(); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) - .setSpecificLogs(EnumSet.allOf(DynaWaltzParameters.SpecificLog.class)); + .setSolverType(DynawoSimulationParameters.SolverType.IDA) + .setSpecificLogs(EnumSet.allOf(DynawoSimulationParameters.SpecificLog.class)); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, EventModelsSupplier.empty(), CurvesSupplier.empty(), VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, reportNode) @@ -217,23 +217,23 @@ void testSmib() { GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/smib/dynamicModels.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyEventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier( getResourceAsStream("/smib/eventModels.groovy"), - GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyCurvesSupplier curvesSupplier = new GroovyCurvesSupplier( getResourceAsStream("/smib/curves.groovy"), - GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/smib/SMIB.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/smib/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/smib/solvers.par"), "1"); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) + .setSolverType(DynawoSimulationParameters.SolverType.IDA) .setWriteFinalState(false); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, curvesSupplier, @@ -249,21 +249,21 @@ void testSmib() { @Test void testSimulationError() { - Network network = Network.read(new ResourceDataSource("powsybl_dynawaltz", new ResourceSet("/error", "powsybl_dynawaltz.xiidm"))); + Network network = Network.read(new ResourceDataSource("powsybl_dynawo", new ResourceSet("/error", "powsybl_dynawo.xiidm"))); GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( getResourceAsStream("/error/models.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); GroovyEventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier( getResourceAsStream("/error/eventModels.groovy"), - GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME)); parameters.setStopTime(200); - dynaWaltzParameters.setModelsParameters(ParametersXml.load(getResourceAsStream("/error/models.par"))) + dynawoSimulationParameters.setModelsParameters(ParametersXml.load(getResourceAsStream("/error/models.par"))) .setNetworkParameters(ParametersXml.load(getResourceAsStream("/error/network.par"), "NETWORK")) .setSolverParameters(ParametersXml.load(getResourceAsStream("/error/solvers.par"), "3")) - .setSolverType(DynaWaltzParameters.SolverType.SIM); + .setSolverType(DynawoSimulationParameters.SolverType.SIM); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, CurvesSupplier.empty(), VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP) @@ -285,11 +285,11 @@ void testIeee14DynawoSuppliers() { List modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/models.par")); ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/network.par"), "8"); ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/disconnectline/solvers.par"), "2"); - dynaWaltzParameters.setModelsParameters(modelsParameters) + dynawoSimulationParameters.setModelsParameters(modelsParameters) .setNetworkParameters(networkParameters) .setSolverParameters(solverParameters) - .setSolverType(DynaWaltzParameters.SolverType.IDA) - .setTimelineExportMode(DynaWaltzParameters.ExportMode.XML); + .setSolverType(DynawoSimulationParameters.SolverType.IDA) + .setTimelineExportMode(DynawoSimulationParameters.ExportMode.XML); DynamicSimulationResult result = provider.run(network, dynamicModelsSupplier, eventModelsSupplier, CurvesSupplier.empty(), VariantManagerConstants.INITIAL_VARIANT_ID, computationManager, parameters, NO_OP) diff --git a/dynawo-integration-tests/src/test/resources/error/powsybl_dynawaltz.xiidm b/dynawo-integration-tests/src/test/resources/error/powsybl_dynawo.xiidm similarity index 100% rename from dynawo-integration-tests/src/test/resources/error/powsybl_dynawaltz.xiidm rename to dynawo-integration-tests/src/test/resources/error/powsybl_dynawo.xiidm diff --git a/dynawo-security-analysis/pom.xml b/dynawo-security-analysis/pom.xml index 95b1fe630..6a0152f9b 100644 --- a/dynawo-security-analysis/pom.xml +++ b/dynawo-security-analysis/pom.xml @@ -29,7 +29,7 @@ ${project.groupId} - powsybl-dynawaltz + powsybl-dynawo-simulation ${project.groupId} @@ -74,7 +74,7 @@ ${project.groupId} - powsybl-dynawaltz + powsybl-dynawo-simulation test-jar test diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java index bf783ec2a..4c06a7b5f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java @@ -8,10 +8,10 @@ package com.powsybl.dynawo.security; import com.powsybl.contingency.Contingency; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnect; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnector; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.parameters.ParametersSet; import java.util.List; import java.util.Map; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java index bb073a577..88960f1d0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java @@ -9,23 +9,23 @@ import com.powsybl.commons.config.ModuleConfig; import com.powsybl.commons.config.PlatformConfig; -import com.powsybl.dynawaltz.DynaWaltzConfig; +import com.powsybl.dynawo.DynawoSimulationConfig; import java.nio.file.Path; /** * @author Laurent Issertial */ -public class DynawoAlgorithmsConfig extends DynaWaltzConfig { +public class DynawoAlgorithmsConfig extends DynawoSimulationConfig { public static final String DYNAWO_ALGORITHMS_LAUNCHER_PROGRAM_NAME = "dynawo-algorithms"; public static DynawoAlgorithmsConfig load() { - return load(DynawoAlgorithmsConfig::new, DYNAWALTZ_MODULE_NAME); + return load(DynawoAlgorithmsConfig::new, DYNAWO_MODULE_NAME); } public static DynawoAlgorithmsConfig load(PlatformConfig platformConfig) { - return load(DynawoAlgorithmsConfig::new, DYNAWALTZ_MODULE_NAME, platformConfig); + return load(DynawoAlgorithmsConfig::new, DYNAWO_MODULE_NAME, platformConfig); } public DynawoAlgorithmsConfig(Path homeDir, boolean debug) { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java index 91f2bc0cf..aedb25440 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java @@ -14,10 +14,10 @@ import com.powsybl.computation.CommandExecution; import com.powsybl.computation.ExecutionReport; import com.powsybl.dynaflow.ContingencyResultsUtils; -import com.powsybl.dynawaltz.xml.DydXml; -import com.powsybl.dynawaltz.xml.DynaWaltzConstants; -import com.powsybl.dynawaltz.xml.JobsXml; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; +import com.powsybl.dynawo.xml.JobsXml; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.NetworkResultsUpdater; @@ -40,8 +40,8 @@ import java.util.List; import static com.powsybl.dynaflow.SecurityAnalysisConstants.DYNAWO_CONSTRAINTS_FOLDER; -import static com.powsybl.dynawaltz.DynaWaltzConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawaltz.DynaWaltzConstants.OUTPUTS_FOLDER; +import static com.powsybl.dynawo.DynawoSimulationConstants.FINAL_STATE_FOLDER; +import static com.powsybl.dynawo.DynawoSimulationConstants.OUTPUTS_FOLDER; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; @@ -85,7 +85,7 @@ public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) thr context.getNetwork().getVariantManager().setWorkingVariant(context.getWorkingVariantId()); Path outputNetworkFile = workingDir.resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); if (Files.exists(outputNetworkFile)) { - NetworkResultsUpdater.update(context.getNetwork(), NetworkSerDe.read(outputNetworkFile), context.getDynaWaltzParameters().isMergeLoads()); + NetworkResultsUpdater.update(context.getNetwork(), NetworkSerDe.read(outputNetworkFile), context.getDynawoSimulationParameters().isMergeLoads()); } ContingencyResultsUtils.reportContingenciesTimelines(context.getContingencies(), workingDir.resolve(DYNAWO_TIMELINE_FOLDER), reportNode); @@ -99,7 +99,7 @@ public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) thr private void writeInputFiles(Path workingDir) { try { - DynawoUtil.writeIidm(network, workingDir.resolve(DynaWaltzConstants.NETWORK_FILENAME)); + DynawoUtil.writeIidm(network, workingDir.resolve(DynawoSimulationConstants.NETWORK_FILENAME)); JobsXml.write(workingDir, context); DydXml.write(workingDir, context); ParametersXml.write(workingDir, context); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index a6fe958ed..7a3fecb0b 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -16,10 +16,10 @@ import com.powsybl.contingency.ContingenciesProvider; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.models.utils.BlackBoxSupplierUtils; -import com.powsybl.dynawaltz.xml.DynaWaltzConstants; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.iidm.network.Network; @@ -36,7 +36,7 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; -import static com.powsybl.dynawaltz.DynaWaltzConfig.DYNAWALTZ_LAUNCHER_PROGRAM_NAME; +import static com.powsybl.dynawo.DynawoSimulationConfig.DYNAWO_LAUNCHER_PROGRAM_NAME; /** * @author Laurent Issertial @@ -79,13 +79,13 @@ public CompletableFuture run(Network network, String wor ReportNode dsaReportNode = DynamicSecurityAnalysisReports.createDynamicSecurityAnalysisReportNode(runParameters.getReportNode(), network.getId()); network.getVariantManager().setWorkingVariant(workingVariantId); ExecutionEnvironment execEnv = new ExecutionEnvironment(Collections.emptyMap(), WORKING_DIR_PREFIX, config.isDebug()); - DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWALTZ_LAUNCHER_PROGRAM_NAME, false); + DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWO_LAUNCHER_PROGRAM_NAME, false); List contingencies = contingenciesProvider.getContingencies(network); DynamicSecurityAnalysisParameters parameters = runParameters.getDynamicSecurityAnalysisParameters(); SecurityAnalysisContext context = new SecurityAnalysisContext(network, workingVariantId, BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, dsaReportNode), parameters, - DynaWaltzParameters.load(parameters.getDynamicSimulationParameters()), + DynawoSimulationParameters.load(parameters.getDynamicSimulationParameters()), contingencies); return runParameters.getComputationManager().execute(execEnv, new DynawoSecurityAnalysisHandler(context, getCommand(config), runParameters.getFilter(), runParameters.getInterceptors(), dsaReportNode)); @@ -93,7 +93,7 @@ public CompletableFuture run(Network network, String wor @Override public String getName() { - return DynaWaltzProvider.NAME; + return DynawoSimulationProvider.NAME; } @Override @@ -104,8 +104,8 @@ public String getVersion() { public static Command getCommand(DynawoAlgorithmsConfig config) { List args = Arrays.asList( "SA", - "--input", DynaWaltzConstants.MULTIPLE_JOBS_FILENAME, - "--output", DynaWaltzConstants.AGGREGATED_RESULTS); + "--input", DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME, + "--output", DynawoSimulationConstants.AGGREGATED_RESULTS); return new SimpleCommandBuilder() .id("dynawo_dynamic_sa") .program(config.getProgram()) diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index 70f00f0ef..263faf9cb 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -10,14 +10,14 @@ import com.powsybl.commons.PowsyblException; import com.powsybl.contingency.Contingency; import com.powsybl.contingency.ContingencyElement; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.events.ContextDependentEvent; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnect; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnector; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.events.ContextDependentEvent; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Network; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; @@ -27,7 +27,7 @@ /** * @author Laurent Issertial */ -public class SecurityAnalysisContext extends DynaWaltzContext { +public class SecurityAnalysisContext extends DynawoSimulationContext { private final List contingencies; private final List contingencyEventModels; @@ -35,10 +35,10 @@ public class SecurityAnalysisContext extends DynaWaltzContext { public SecurityAnalysisContext(Network network, String workingVariantId, List dynamicModels, DynamicSecurityAnalysisParameters parameters, - DynaWaltzParameters dynaWaltzParameters, + DynawoSimulationParameters dynawoSimulationParameters, List contingencies) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), - parameters.getDynamicSimulationParameters(), dynaWaltzParameters); + parameters.getDynamicSimulationParameters(), dynawoSimulationParameters); double contingenciesStartTime = parameters.getDynamicContingenciesParameters().getContingenciesStartTime(); this.contingencies = contingencies; this.contingencyEventModels = contingencies.stream() diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java index 9209bc6b6..1d1239bb6 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java @@ -7,10 +7,10 @@ */ package com.powsybl.dynawo.security.xml; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnect; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.security.ContingencyEventModels; import com.powsybl.dynawo.security.SecurityAnalysisContext; @@ -36,7 +36,7 @@ public static void write(Path workingDir, SecurityAnalysisContext context) throw } } - private static void writeEvent(XMLStreamWriter writer, DynaWaltzContext context, ContingencyEventModels model) throws XMLStreamException { + private static void writeEvent(XMLStreamWriter writer, DynawoSimulationContext context, ContingencyEventModels model) throws XMLStreamException { for (BlackBoxModel ev : model.eventModels()) { ev.write(writer, ContingenciesParXml.createParFileName(model)); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java index 6516d0c01..985dd81b1 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java @@ -7,14 +7,14 @@ */ package com.powsybl.dynawo.security.xml; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.dynawo.security.ContingencyEventModels; import com.powsybl.dynawo.security.SecurityAnalysisContext; import java.nio.file.Path; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; /** * @author Laurent Issertial diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java index da429a7cd..892c8ebbf 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java @@ -16,8 +16,8 @@ import java.nio.file.Path; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.JOBS_FILENAME; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.JOBS_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME; /** * @author Laurent Issertial diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java index 04c74f928..ba94242b3 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java @@ -7,7 +7,7 @@ */ package com.powsybl.dynawo.security.xml; -import com.powsybl.dynawaltz.xml.XmlStreamWriterFactory; +import com.powsybl.dynawo.xml.XmlStreamWriterFactory; import com.powsybl.dynawo.security.ContingencyEventModels; import com.powsybl.dynawo.security.SecurityAnalysisContext; @@ -20,8 +20,8 @@ import java.nio.file.Path; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_PREFIX; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Laurent Issertial @@ -29,23 +29,23 @@ public final class XmlUtil { @FunctionalInterface - public interface XmlDynawaltzContingenciesWriter { - void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext dynaWaltzContext) throws XMLStreamException; + public interface XmlDynawoContingenciesWriter { + void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) throws XMLStreamException; } @FunctionalInterface - public interface XmlDynawaltzEventWriter { - void writeEvent(XMLStreamWriter writer, SecurityAnalysisContext dynaWaltzContext, ContingencyEventModels model) throws XMLStreamException; + public interface XmlDynawoEventWriter { + void writeEvent(XMLStreamWriter writer, SecurityAnalysisContext context, ContingencyEventModels model) throws XMLStreamException; } private XmlUtil() { } - public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawaltzEventWriter xmlDynawaltzEventWriter, ContingencyEventModels model) throws IOException, XMLStreamException { + public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawoEventWriter xmlDynawoEventWriter, ContingencyEventModels model) throws IOException, XMLStreamException { Objects.requireNonNull(file); Objects.requireNonNull(context); Objects.requireNonNull(elementName); - Objects.requireNonNull(xmlDynawaltzEventWriter); + Objects.requireNonNull(xmlDynawoEventWriter); try (Writer writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) { XMLStreamWriter xmlWriter = XmlStreamWriterFactory.newInstance(writer); @@ -55,7 +55,7 @@ public static void write(Path file, SecurityAnalysisContext context, String elem xmlWriter.writeStartElement(DYN_URI, elementName); xmlWriter.writeNamespace(DYN_PREFIX, DYN_URI); - xmlDynawaltzEventWriter.writeEvent(xmlWriter, context, model); + xmlDynawoEventWriter.writeEvent(xmlWriter, context, model); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); @@ -65,11 +65,11 @@ public static void write(Path file, SecurityAnalysisContext context, String elem } } - public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawaltzContingenciesWriter xmlDynawaltzWriter) throws IOException, XMLStreamException { + public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawoContingenciesWriter xmlDynawoWriter) throws IOException, XMLStreamException { Objects.requireNonNull(file); Objects.requireNonNull(context); Objects.requireNonNull(elementName); - Objects.requireNonNull(xmlDynawaltzWriter); + Objects.requireNonNull(xmlDynawoWriter); try (Writer writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) { XMLStreamWriter xmlWriter = XmlStreamWriterFactory.newInstance(writer); @@ -78,7 +78,7 @@ public static void write(Path file, SecurityAnalysisContext context, String elem xmlWriter.writeStartElement(elementName); xmlWriter.writeNamespace("", DYN_URI); - xmlDynawaltzWriter.writeContingencies(xmlWriter, context); + xmlDynawoWriter.writeContingencies(xmlWriter, context); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java index d7e1e633d..939abbc89 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java @@ -43,7 +43,7 @@ void checkConfig() { String homeDir = "homeDir"; boolean debug = true; - MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawaltz"); + MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawo"); moduleConfig.setStringProperty("homeDir", homeDir); moduleConfig.setStringProperty("debug", Boolean.toString(debug)); DynawoAlgorithmsConfig config = DynawoAlgorithmsConfig.load(platformConfig); diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java index 55cde9df9..39a44c951 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java @@ -9,9 +9,9 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.xml.DynawoTestUtil; +import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; -import com.powsybl.dynawaltz.xml.DynaWaltzTestUtil; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -23,21 +23,21 @@ /** * @author Laurent Issertial */ -class ContingenciesXmlTest extends DynaWaltzTestUtil { +class ContingenciesXmlTest extends DynawoTestUtil { @Test void writeDyds() throws SAXException, IOException, XMLStreamException { DynamicSecurityAnalysisParameters parameters = DynamicSecurityAnalysisParameters.load(); parameters.setDynamicSimulationParameters(new DynamicSimulationParameters(0, 20)); parameters.setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(10)); - DynaWaltzParameters dynawaltzParameters = DynaWaltzParameters.load(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); List contingencies = List.of( Contingency.load("LOAD"), Contingency.builder("DisconnectLineGenerator") .addLine("NHV1_NHV2_1") .addGenerator("GEN2") .build()); - SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawaltzParameters, contingencies); + SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); ContingenciesDydXml.write(tmpDir, context); ContingenciesParXml.write(tmpDir, context); diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java index 8b8872ff4..91c35df11 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java @@ -8,10 +8,10 @@ package com.powsybl.dynawo.security.xml; import com.powsybl.contingency.Contingency; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; -import com.powsybl.dynawaltz.xml.DynaWaltzConstants; -import com.powsybl.dynawaltz.xml.DynaWaltzTestUtil; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; +import com.powsybl.dynawo.xml.DynawoTestUtil; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -23,22 +23,22 @@ /** * @author Laurent Issertial */ -class MultiplesJobsXmlTest extends DynaWaltzTestUtil { +class MultiplesJobsXmlTest extends DynawoTestUtil { @Test void writeMultiplesJobs() throws SAXException, IOException, XMLStreamException { DynamicSecurityAnalysisParameters parameters = DynamicSecurityAnalysisParameters.load(); - DynaWaltzParameters dynawaltzParameters = DynaWaltzParameters.load(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); List contingencies = List.of( Contingency.load("LOAD"), Contingency.builder("DisconnectLineGenerator") .addLine("NHV1_NHV2_1") .addGenerator("GEN2") .build()); - SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawaltzParameters, contingencies); + SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); MultipleJobsXml.write(tmpDir, context); - validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(DynaWaltzConstants.MULTIPLE_JOBS_FILENAME)); + validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME)); } } diff --git a/dynawo-security-analysis/src/test/resources/multipleJobs.xml b/dynawo-security-analysis/src/test/resources/multipleJobs.xml index da5e3c488..1ad813292 100644 --- a/dynawo-security-analysis/src/test/resources/multipleJobs.xml +++ b/dynawo-security-analysis/src/test/resources/multipleJobs.xml @@ -1,6 +1,6 @@ - + diff --git a/dynawaltz/pom.xml b/dynawo-simulation/pom.xml similarity index 95% rename from dynawaltz/pom.xml rename to dynawo-simulation/pom.xml index 27f487f20..6f10837e2 100644 --- a/dynawaltz/pom.xml +++ b/dynawo-simulation/pom.xml @@ -16,9 +16,9 @@ 2.6.0-SNAPSHOT - powsybl-dynawaltz - DynaWaltz - DynaWaltz integration module for powsybl + powsybl-dynawo-simulation + Dynawo simulation + Dynawo simulation integration module for powsybl @@ -28,7 +28,7 @@ - com.powsybl.dynawaltz + com.powsybl.dynawo diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DumpFileParameters.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DumpFileParameters.java similarity index 99% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DumpFileParameters.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DumpFileParameters.java index 8854ddae8..dc856667d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DumpFileParameters.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DumpFileParameters.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.powsybl.commons.PowsyblException; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConfig.java new file mode 100644 index 000000000..63006cbb3 --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConfig.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2020, 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/. + */ +package com.powsybl.dynawo; + +import com.powsybl.commons.config.ModuleConfig; +import com.powsybl.commons.config.PlatformConfig; +import com.powsybl.dynawo.commons.AbstractDynawoConfig; + +import java.nio.file.Path; + +/** + * @author Marcos de Miguel {@literal } + */ +public class DynawoSimulationConfig extends AbstractDynawoConfig { + + public static final String DYNAWO_LAUNCHER_PROGRAM_NAME = "dynawo"; + protected static final String DYNAWO_MODULE_NAME = "dynawo"; + + public static DynawoSimulationConfig load() { + return load(DynawoSimulationConfig::new, DYNAWO_MODULE_NAME); + } + + public static DynawoSimulationConfig load(PlatformConfig platformConfig) { + return load(DynawoSimulationConfig::new, DYNAWO_MODULE_NAME, platformConfig); + } + + public DynawoSimulationConfig(Path homeDir, boolean debug) { + super(homeDir, debug); + } + + protected DynawoSimulationConfig(ModuleConfig config) { + super(config); + } + + @Override + public String getProgram() { + return getProgram(DYNAWO_LAUNCHER_PROGRAM_NAME); + } +} diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConstants.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java index afcb6d99d..b821f29c8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; /** * @author Laurent Issertial */ -public final class DynaWaltzConstants { +public final class DynawoSimulationConstants { - private DynaWaltzConstants() { + private DynawoSimulationConstants() { } public static final String OUTPUTS_FOLDER = "outputs"; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java similarity index 78% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzContext.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 96290715f..3eda357c6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -4,29 +4,29 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.curves.DynawoCurve; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.EquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.buses.AbstractBus; -import com.powsybl.dynawaltz.models.defaultmodels.DefaultModelsHandler; -import com.powsybl.dynawaltz.models.events.ContextDependentEvent; -import com.powsybl.dynawaltz.models.frequencysynchronizers.FrequencySynchronizedModel; -import com.powsybl.dynawaltz.models.frequencysynchronizers.FrequencySynchronizerModel; -import com.powsybl.dynawaltz.models.frequencysynchronizers.OmegaRef; -import com.powsybl.dynawaltz.models.frequencysynchronizers.SetPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnect; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnector; -import com.powsybl.dynawaltz.parameters.ParametersSet; -import com.powsybl.dynawaltz.xml.MacroStaticReference; +import com.powsybl.dynawo.curves.DynawoCurve; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.EquipmentBlackBoxModel; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.buses.AbstractBus; +import com.powsybl.dynawo.models.defaultmodels.DefaultModelsHandler; +import com.powsybl.dynawo.models.events.ContextDependentEvent; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizedModel; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizerModel; +import com.powsybl.dynawo.models.frequencysynchronizers.OmegaRef; +import com.powsybl.dynawo.models.frequencysynchronizers.SetPoint; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.MacroStaticReference; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.Network; import org.slf4j.Logger; @@ -42,16 +42,16 @@ * @author Marcos de Miguel {@literal } * @author Laurent Issertial {@literal } */ -public class DynaWaltzContext { +public class DynawoSimulationContext { - protected static final Logger LOGGER = LoggerFactory.getLogger(DynaWaltzContext.class); + protected static final Logger LOGGER = LoggerFactory.getLogger(DynawoSimulationContext.class); private static final String MODEL_ID_EXCEPTION = "The model identified by the static id %s does not match the expected model (%s)"; private static final String MODEL_ID_LOG = "The model identified by the static id {} does not match the expected model ({})"; protected final Network network; private final String workingVariantId; private final DynamicSimulationParameters parameters; - private final DynaWaltzParameters dynaWaltzParameters; + private final DynawoSimulationParameters dynawoSimulationParameters; private final List dynamicModels; private final List eventModels; private final Map staticIdBlackBoxModelMap; @@ -64,23 +64,23 @@ public class DynaWaltzContext { private final List dynamicModelsParameters = new ArrayList<>(); protected final MacroConnectionsAdder macroConnectionsAdder; - public DynaWaltzContext(Network network, String workingVariantId, List dynamicModels, List eventModels, - List curves, DynamicSimulationParameters parameters, DynaWaltzParameters dynaWaltzParameters) { - this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynaWaltzParameters, ReportNode.NO_OP); + public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, + List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { + this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, ReportNode.NO_OP); } - public DynaWaltzContext(Network network, String workingVariantId, List dynamicModels, List eventModels, - List curves, DynamicSimulationParameters parameters, DynaWaltzParameters dynaWaltzParameters, ReportNode reportNode) { + public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, + List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, ReportNode reportNode) { - ReportNode contextReportNode = DynawaltzReports.createDynaWaltzContextReportNode(reportNode); + ReportNode contextReportNode = DynawoSimulationReports.createDynawoSimulationContextReportNode(reportNode); this.network = Objects.requireNonNull(network); this.workingVariantId = Objects.requireNonNull(workingVariantId); this.parameters = Objects.requireNonNull(parameters); - this.dynaWaltzParameters = Objects.requireNonNull(dynaWaltzParameters); + this.dynawoSimulationParameters = Objects.requireNonNull(dynawoSimulationParameters); Stream uniqueIdsDynamicModels = Objects.requireNonNull(dynamicModels).stream() .filter(distinctByDynamicId(contextReportNode).and(distinctByStaticId(contextReportNode))); - this.dynamicModels = dynaWaltzParameters.isUseModelSimplifiers() + this.dynamicModels = dynawoSimulationParameters.isUseModelSimplifiers() ? simplifyModels(uniqueIdsDynamicModels, contextReportNode).toList() : uniqueIdsDynamicModels.toList(); @@ -115,7 +115,7 @@ public DynaWaltzContext(Network network, String workingVariantId, List simplifyModels(Stream inputBbm, Rep outputBbm = outputBbm.filter(modelsSimplifier.getModelRemovalPredicate(reportNode)); } for (ModelsSubstitutionSimplifier modelsSimplifier : ServiceLoader.load(ModelsSubstitutionSimplifier.class)) { - outputBbm = outputBbm.map(modelsSimplifier.getModelSubstitutionFunction(network, dynaWaltzParameters, reportNode)) + outputBbm = outputBbm.map(modelsSimplifier.getModelSubstitutionFunction(network, dynawoSimulationParameters, reportNode)) .filter(Objects::nonNull); } return outputBbm; @@ -154,8 +154,8 @@ public DynamicSimulationParameters getParameters() { return parameters; } - public DynaWaltzParameters getDynaWaltzParameters() { - return dynaWaltzParameters; + public DynawoSimulationParameters getDynawoSimulationParameters() { + return dynawoSimulationParameters; } public Collection getMacroStaticReferences() { @@ -206,7 +206,7 @@ protected static Predicate distinctByStaticId(ReportNode reportNo Set seen = new HashSet<>(); return bbm -> { if (bbm instanceof EquipmentBlackBoxModel eBbm && !seen.add(eBbm.getStaticId())) { - DynawaltzReports.reportDuplicateStaticId(reportNode, eBbm.getStaticId(), eBbm.getLib(), eBbm.getDynamicModelId()); + DynawoSimulationReports.reportDuplicateStaticId(reportNode, eBbm.getStaticId(), eBbm.getLib(), eBbm.getDynamicModelId()); return false; } return true; @@ -217,7 +217,7 @@ protected static Predicate distinctByDynamicId(ReportNode reportN Set seen = new HashSet<>(); return bbm -> { if (!seen.add(bbm.getDynamicModelId())) { - DynawaltzReports.reportDuplicateDynamicId(reportNode, bbm.getDynamicModelId(), bbm.getName()); + DynawoSimulationReports.reportDuplicateDynamicId(reportNode, bbm.getDynamicModelId(), bbm.getName()); return false; } return true; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzHandler.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java similarity index 84% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzHandler.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java index b9460d065..4f1612965 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzHandler.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.report.ReportNode; import com.powsybl.computation.AbstractExecutionHandler; @@ -15,10 +15,10 @@ import com.powsybl.dynamicsimulation.DynamicSimulationResult; import com.powsybl.dynamicsimulation.DynamicSimulationResultImpl; import com.powsybl.dynamicsimulation.TimelineEvent; -import com.powsybl.dynawaltz.xml.CurvesXml; -import com.powsybl.dynawaltz.xml.DydXml; -import com.powsybl.dynawaltz.xml.JobsXml; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.xml.CurvesXml; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.JobsXml; +import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.dynawo.commons.CommonReports; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.NetworkResultsUpdater; @@ -44,18 +44,18 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.powsybl.dynawaltz.DynaWaltzConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawaltz.DynaWaltzConstants.OUTPUTS_FOLDER; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.*; +import static com.powsybl.dynawo.DynawoSimulationConstants.FINAL_STATE_FOLDER; +import static com.powsybl.dynawo.DynawoSimulationConstants.OUTPUTS_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; /** * @author Laurent Issertial */ -public final class DynaWaltzHandler extends AbstractExecutionHandler { +public final class DynawoSimulationHandler extends AbstractExecutionHandler { - private static final Logger LOGGER = LoggerFactory.getLogger(DynaWaltzHandler.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DynawoSimulationHandler.class); private static final String LOGS_FOLDER = "logs"; private static final String OUTPUT_IIDM_FILENAME = "outputIIDM.xml"; private static final String OUTPUT_DUMP_FILENAME = "outputState.dmp"; @@ -64,7 +64,7 @@ public final class DynaWaltzHandler extends AbstractExecutionHandler specificLogs) throws IOException { + private void setDynawoLog(Path outputsFolder, Set specificLogs) throws IOException { Path logFolder = outputsFolder.resolve(LOGS_FOLDER); if (Files.exists(logFolder)) { Path logFile = logFolder.resolve(LOGS_FILENAME); @@ -142,11 +142,11 @@ private void setDynawoLog(Path outputsFolder, Set CommonReports.reportLogEntry(logReportNode, e)); } - for (DynaWaltzParameters.SpecificLog specificLog : specificLogs) { + for (DynawoSimulationParameters.SpecificLog specificLog : specificLogs) { Path specificLogFile = logFolder.resolve(specificLog.getFileName()); if (Files.exists(specificLogFile)) { - ReportNode logReport = DynawaltzReports.createDynawoSpecificLogReportNode(reportNode, specificLog); - DynawaltzReports.reportSpecificLogEntry(logReport, Files.readString(specificLogFile)); + ReportNode logReport = DynawoSimulationReports.createDynawoSpecificLogReportNode(reportNode, specificLog); + DynawoSimulationReports.reportSpecificLogEntry(logReport, Files.readString(specificLogFile)); } } } else { @@ -157,7 +157,7 @@ private void setDynawoLog(Path outputsFolder, Set} * @author Florian Dupuy {@literal } */ -public class DynaWaltzParameters extends AbstractExtension { +public class DynawoSimulationParameters extends AbstractExtension { public static final SolverType DEFAULT_SOLVER_TYPE = SolverType.SIM; public static final String DEFAULT_NETWORK_PAR_ID = "1"; @@ -117,20 +117,20 @@ public String getFileName() { /** * Loads parameters from the default platform configuration. */ - public static DynaWaltzParameters load() { + public static DynawoSimulationParameters load() { return load(PlatformConfig.defaultConfig()); } /** * Load parameters from a provided platform configuration. */ - public static DynaWaltzParameters load(PlatformConfig platformConfig) { + public static DynawoSimulationParameters load(PlatformConfig platformConfig) { return load(platformConfig, FileSystems.getDefault()); } - public static DynaWaltzParameters load(PlatformConfig platformConfig, FileSystem fileSystem) { - DynaWaltzParameters parameters = new DynaWaltzParameters(); - Optional config = platformConfig.getOptionalModuleConfig("dynawaltz-default-parameters"); + public static DynawoSimulationParameters load(PlatformConfig platformConfig, FileSystem fileSystem) { + DynawoSimulationParameters parameters = new DynawoSimulationParameters(); + Optional config = platformConfig.getOptionalModuleConfig("dynawo-simulation-default-parameters"); String parametersFile = config.flatMap(c -> c.getOptionalStringProperty("parametersFile")).orElse(DEFAULT_INPUT_PARAMETERS_FILE); String networkParametersFile = config.flatMap(c -> c.getOptionalStringProperty("network.parametersFile")).orElse(DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); @@ -163,17 +163,17 @@ private static Path resolveParameterPath(String fileName, PlatformConfig platfor return platformConfig.getConfigDir().map(configDir -> configDir.resolve(fileName)).orElse(fileSystem.getPath(fileName)); } - public static DynaWaltzParameters load(DynamicSimulationParameters parameters) { - DynaWaltzParameters dynaWaltzParameters = parameters.getExtension(DynaWaltzParameters.class); - if (dynaWaltzParameters == null) { - dynaWaltzParameters = DynaWaltzParameters.load(); + public static DynawoSimulationParameters load(DynamicSimulationParameters parameters) { + DynawoSimulationParameters dynawoSimulationParameters = parameters.getExtension(DynawoSimulationParameters.class); + if (dynawoSimulationParameters == null) { + dynawoSimulationParameters = DynawoSimulationParameters.load(); } - return dynaWaltzParameters; + return dynawoSimulationParameters; } @Override public String getName() { - return "DynaWaltzParameters"; + return "DynawoSimulationParameters"; } public void addModelParameters(ParametersSet parameterSet) { @@ -194,13 +194,13 @@ public Collection getModelParameters() { } @JsonSetter("modelsParameters") - public DynaWaltzParameters setModelsParameters(Collection parametersSets) { + public DynawoSimulationParameters setModelsParameters(Collection parametersSets) { modelsParameters = new LinkedHashMap<>(); parametersSets.forEach(parametersSet -> modelsParameters.put(parametersSet.getId(), parametersSet)); return this; } - public DynaWaltzParameters setNetworkParameters(ParametersSet networkParameters) { + public DynawoSimulationParameters setNetworkParameters(ParametersSet networkParameters) { this.networkParameters = Objects.requireNonNull(networkParameters); return this; } @@ -209,7 +209,7 @@ public ParametersSet getNetworkParameters() { return networkParameters; } - public DynaWaltzParameters setSolverParameters(ParametersSet solverParameters) { + public DynawoSimulationParameters setSolverParameters(ParametersSet solverParameters) { this.solverParameters = Objects.requireNonNull(solverParameters); return this; } @@ -218,7 +218,7 @@ public ParametersSet getSolverParameters() { return solverParameters; } - public DynaWaltzParameters setSolverType(SolverType solverType) { + public DynawoSimulationParameters setSolverType(SolverType solverType) { this.solverType = solverType; return this; } @@ -231,12 +231,12 @@ public boolean isMergeLoads() { return mergeLoads; } - public DynaWaltzParameters setMergeLoads(boolean mergeLoads) { + public DynawoSimulationParameters setMergeLoads(boolean mergeLoads) { this.mergeLoads = mergeLoads; return this; } - public DynaWaltzParameters setWriteFinalState(boolean writeFinalState) { + public DynawoSimulationParameters setWriteFinalState(boolean writeFinalState) { this.writeFinalState = writeFinalState; return this; } @@ -249,7 +249,7 @@ public boolean isUseModelSimplifiers() { return useModelSimplifiers; } - public DynaWaltzParameters setUseModelSimplifiers(boolean useModelSimplifiers) { + public DynawoSimulationParameters setUseModelSimplifiers(boolean useModelSimplifiers) { this.useModelSimplifiers = useModelSimplifiers; return this; } @@ -258,7 +258,7 @@ public DumpFileParameters getDumpFileParameters() { return dumpFileParameters; } - public DynaWaltzParameters setDumpFileParameters(DumpFileParameters dumpFileParameters) { + public DynawoSimulationParameters setDumpFileParameters(DumpFileParameters dumpFileParameters) { this.dumpFileParameters = dumpFileParameters; return this; } @@ -267,7 +267,7 @@ public double getPrecision() { return precision; } - public DynaWaltzParameters setPrecision(double precision) { + public DynawoSimulationParameters setPrecision(double precision) { this.precision = precision; return this; } @@ -276,7 +276,7 @@ public ExportMode getTimelineExportMode() { return timelineExportMode; } - public DynaWaltzParameters setTimelineExportMode(ExportMode timelineExportMode) { + public DynawoSimulationParameters setTimelineExportMode(ExportMode timelineExportMode) { this.timelineExportMode = timelineExportMode; return this; } @@ -285,7 +285,7 @@ public LogLevel getLogLevelFilter() { return logLevelFilter; } - public DynaWaltzParameters setLogLevelFilter(LogLevel logLevelFilter) { + public DynawoSimulationParameters setLogLevelFilter(LogLevel logLevelFilter) { this.logLevelFilter = logLevelFilter; return this; } @@ -294,12 +294,12 @@ public Set getSpecificLogs() { return specificLogs; } - public DynaWaltzParameters setSpecificLogs(Set specificLogs) { + public DynawoSimulationParameters setSpecificLogs(Set specificLogs) { this.specificLogs = EnumSet.copyOf(specificLogs); return this; } - public DynaWaltzParameters addSpecificLog(SpecificLog specificLog) { + public DynawoSimulationParameters addSpecificLog(SpecificLog specificLog) { specificLogs.add(specificLog); return this; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzProvider.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java similarity index 67% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzProvider.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java index c56441966..c706f03dc 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynaWaltzProvider.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java @@ -4,14 +4,14 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.google.auto.service.AutoService; import com.powsybl.commons.config.PlatformConfig; import com.powsybl.commons.report.ReportNode; import com.powsybl.computation.*; import com.powsybl.dynamicsimulation.*; -import com.powsybl.dynawaltz.models.utils.BlackBoxSupplierUtils; +import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.iidm.network.Network; @@ -21,28 +21,28 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.JOBS_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.JOBS_FILENAME; /** * @author Marcos de Miguel {@literal } */ @AutoService(DynamicSimulationProvider.class) -public class DynaWaltzProvider implements DynamicSimulationProvider { +public class DynawoSimulationProvider implements DynamicSimulationProvider { - public static final String NAME = "DynaWaltz"; - private static final String WORKING_DIR_PREFIX = "powsybl_dynawaltz_"; + public static final String NAME = "Dynawo"; + private static final String WORKING_DIR_PREFIX = "powsybl_dynawo_"; - private final DynaWaltzConfig config; + private final DynawoSimulationConfig config; - public DynaWaltzProvider() { + public DynawoSimulationProvider() { this(PlatformConfig.defaultConfig()); } - public DynaWaltzProvider(PlatformConfig platformConfig) { - this(DynaWaltzConfig.load(platformConfig)); + public DynawoSimulationProvider(PlatformConfig platformConfig) { + this(DynawoSimulationConfig.load(platformConfig)); } - public DynaWaltzProvider(DynaWaltzConfig config) { + public DynawoSimulationProvider(DynawoSimulationConfig config) { this.config = Objects.requireNonNull(config); } @@ -56,21 +56,21 @@ public String getVersion() { return new PowsyblDynawoVersion().getMavenProjectVersion(); } - public static Command getCommand(DynaWaltzConfig dynaWaltzConfig) { + public static Command getCommand(DynawoSimulationConfig dynawoSimulationConfig) { return new GroupCommandBuilder() .id("dyn_fs") .subCommand() - .program(dynaWaltzConfig.getProgram()) + .program(dynawoSimulationConfig.getProgram()) .args("jobs", JOBS_FILENAME) .add() .build(); } - public static Command getVersionCommand(DynaWaltzConfig dynaWaltzConfig) { + public static Command getVersionCommand(DynawoSimulationConfig dynawoSimulationConfig) { List args = Collections.singletonList("version"); return new SimpleCommandBuilder() .id("dynawo_version") - .program(dynaWaltzConfig.getProgram()) + .program(dynawoSimulationConfig.getProgram()) .args(args) .build(); } @@ -85,18 +85,18 @@ public CompletableFuture run(Network network, DynamicMo Objects.requireNonNull(parameters); Objects.requireNonNull(reportNode); - ReportNode dsReportNode = DynawaltzReports.createDynaWaltzReportNode(reportNode, network.getId()); + ReportNode dsReportNode = DynawoSimulationReports.createDynawoSimulationReportNode(reportNode, network.getId()); network.getVariantManager().setWorkingVariant(workingVariantId); ExecutionEnvironment execEnv = new ExecutionEnvironment(Collections.emptyMap(), WORKING_DIR_PREFIX, config.isDebug()); - DynawoUtil.requireDynaMinVersion(execEnv, computationManager, getVersionCommand(config), DynaWaltzConfig.DYNAWALTZ_LAUNCHER_PROGRAM_NAME, false); - DynaWaltzContext context = new DynaWaltzContext(network, workingVariantId, + DynawoUtil.requireDynaMinVersion(execEnv, computationManager, getVersionCommand(config), DynawoSimulationConfig.DYNAWO_LAUNCHER_PROGRAM_NAME, false); + DynawoSimulationContext context = new DynawoSimulationContext(network, workingVariantId, BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, dsReportNode), BlackBoxSupplierUtils.getBlackBoxModelList(eventModelsSupplier, network, dsReportNode), curvesSupplier.get(network), parameters, - DynaWaltzParameters.load(parameters), + DynawoSimulationParameters.load(parameters), reportNode); - return computationManager.execute(execEnv, new DynaWaltzHandler(context, getCommand(config), reportNode)); + return computationManager.execute(execEnv, new DynawoSimulationHandler(context, getCommand(config), reportNode)); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java index b5d1c3128..e01563a33 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/DynawaltzReports.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.report.TypedValue; @@ -14,21 +14,21 @@ /** * @author Laurent Issertial {@literal } */ -public final class DynawaltzReports { +public final class DynawoSimulationReports { - private DynawaltzReports() { + private DynawoSimulationReports() { } - public static ReportNode createDynaWaltzReportNode(ReportNode reportNode, String networkId) { + public static ReportNode createDynawoSimulationReportNode(ReportNode reportNode, String networkId) { return reportNode.newReportNode() - .withMessageTemplate("dynawaltz", "Dynawaltz dynamic simulation on network '${networkId}'") + .withMessageTemplate("dynawoSimulation", "Dynawo dynamic simulation on network '${networkId}'") .withUntypedValue("networkId", networkId) .add(); } - public static ReportNode createDynaWaltzContextReportNode(ReportNode reportNode) { + public static ReportNode createDynawoSimulationContextReportNode(ReportNode reportNode) { return reportNode.newReportNode() - .withMessageTemplate("dynawaltzContext", "Dynawaltz models processing") + .withMessageTemplate("dynawoSimulationContext", "Dynawo models processing") .add(); } @@ -75,7 +75,7 @@ public static void reportEmptyListAutomaton(ReportNode reportNode, String automa .add(); } - public static ReportNode createDynawoSpecificLogReportNode(ReportNode reportNode, DynaWaltzParameters.SpecificLog logType) { + public static ReportNode createDynawoSpecificLogReportNode(ReportNode reportNode, DynawoSimulationParameters.SpecificLog logType) { String logTypeName = StringUtils.capitalize(logType.toString().toLowerCase()); return reportNode.newReportNode() .withMessageTemplate("dynawo" + logTypeName + "Log", logTypeName + " log") diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsRemovalSimplifier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsRemovalSimplifier.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsRemovalSimplifier.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsRemovalSimplifier.java index 13ba309b6..4de88a573 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsRemovalSimplifier.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsRemovalSimplifier.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.BlackBoxModel; import java.util.function.Predicate; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsSubstitutionSimplifier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsSubstitutionSimplifier.java similarity index 77% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsSubstitutionSimplifier.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsSubstitutionSimplifier.java index 78ea58fe7..de4c691fa 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/ModelsSubstitutionSimplifier.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/ModelsSubstitutionSimplifier.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import java.util.function.Function; @@ -18,5 +18,5 @@ */ public interface ModelsSubstitutionSimplifier { - Function getModelSubstitutionFunction(Network network, DynaWaltzParameters dynaWaltzParameters, ReportNode reportNode); + Function getModelSubstitutionFunction(Network network, DynawoSimulationParameters dynawoSimulationParameters, ReportNode reportNode); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractDynamicModelBuilder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractDynamicModelBuilder.java index ff1a62574..33e553ca5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractDynamicModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractDynamicModelBuilder.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractEquipmentModelBuilder.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractEquipmentModelBuilder.java index 57319bce7..c52cbfbae 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/AbstractEquipmentModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/AbstractEquipmentModelBuilder.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderConfig.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderConfig.java index 0f46ca872..d018854da 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderConfig.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderConfig.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipment.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipment.java index fa6e6452a..210b26f2f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipment.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipment.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipmentsList.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipmentsList.java index 5adcc74ee..665b02e5b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderEquipmentsList.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderEquipmentsList.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderIdListEquipmentList.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderIdListEquipmentList.java index 01071cbb1..ad746b184 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderIdListEquipmentList.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderIdListEquipmentList.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java similarity index 99% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java index e2b482857..63b0cc553 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuilderReports.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.report.TypedValue; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuildersUtil.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuildersUtil.java index f1b6178a6..abf527433 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/BuildersUtil.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuildersUtil.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.iidm.network.*; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EquipmentModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EquipmentModelBuilder.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EquipmentModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EquipmentModelBuilder.java index 97db380ed..99a3f0bee 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EquipmentModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EquipmentModelBuilder.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventBuilderConfig.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventBuilderConfig.java index c829cc7af..b969a23f4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventBuilderConfig.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventBuilderConfig.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.EventModel; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventModelInfo.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventModelInfo.java index 4e049f844..0a28bbd38 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/EventModelInfo.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/EventModelInfo.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; /** * @param name Model name diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelBuilder.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelBuilder.java index eac7f0f75..e72746d34 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelBuilder.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfig.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfig.java index 4872893ba..05a7deda8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfig.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfig.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import java.util.List; import java.util.Objects; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoader.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoader.java index dd1a32e55..ad4af88a8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoader.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoader.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoaderImpl.java similarity index 76% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoaderImpl.java index f5e3292ac..789910cae 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderImpl.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigLoaderImpl.java @@ -5,30 +5,30 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.google.auto.service.AutoService; -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.PhaseShifterBlockingIAutomationSystemBuilder; -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.events.EventActivePowerVariationBuilder; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder; -import com.powsybl.dynawaltz.models.generators.*; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; -import com.powsybl.dynawaltz.models.lines.LineBuilder; -import com.powsybl.dynawaltz.models.loads.*; -import com.powsybl.dynawaltz.models.shunts.BaseShuntBuilder; -import com.powsybl.dynawaltz.models.svarcs.BaseStaticVarCompensatorBuilder; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.UnderVoltageAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystemBuilder; +import com.powsybl.dynawo.models.buses.InfiniteBusBuilder; +import com.powsybl.dynawo.models.buses.StandardBusBuilder; +import com.powsybl.dynawo.models.events.EventActivePowerVariationBuilder; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.events.NodeFaultEventBuilder; +import com.powsybl.dynawo.models.generators.*; +import com.powsybl.dynawo.models.loads.*; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.lines.LineBuilder; +import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; +import com.powsybl.dynawo.models.svarcs.BaseStaticVarCompensatorBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; import java.util.stream.Stream; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigs.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigs.java index 394f2dab4..c60197cf4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigs.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigs.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsHandler.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsHandler.java index 267e29f87..699af3b26 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsHandler.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsHandler.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.google.common.collect.Lists; import com.powsybl.commons.report.ReportNode; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsJsonDeserializer.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsJsonDeserializer.java index c34cdcd46..7f3986b7b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelConfigsJsonDeserializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelConfigsJsonDeserializer.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelInfo.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelInfo.java index 2e6347eb6..9cfbf5a18 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/builders/ModelInfo.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/ModelInfo.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurve.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurve.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurve.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurve.java index 82e955b0b..de9670b7b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurve.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurve.java @@ -4,7 +4,7 @@ * 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.dynawaltz.curves; +package com.powsybl.dynawo.curves; import com.powsybl.dynamicsimulation.Curve; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurvesBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurvesBuilder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurvesBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurvesBuilder.java index 26d9437a4..a519420f4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/curves/DynawoCurvesBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/curves/DynawoCurvesBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.curves; +package com.powsybl.dynawo.curves; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.Curve; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawo.builders.BuilderReports; import java.util.*; import java.util.function.Consumer; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/json/DynaWaltzSimulationParametersSerializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/json/DynawoSimulationParametersSerializer.java similarity index 70% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/json/DynaWaltzSimulationParametersSerializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/json/DynawoSimulationParametersSerializer.java index e66a9ef0c..dd66df728 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/json/DynaWaltzSimulationParametersSerializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/json/DynawoSimulationParametersSerializer.java @@ -4,7 +4,7 @@ * 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.dynawaltz.json; +package com.powsybl.dynawo.json; import java.io.IOException; @@ -19,13 +19,13 @@ import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynamicsimulation.json.JsonDynamicSimulationParameters; import com.powsybl.dynamicsimulation.json.JsonDynamicSimulationParameters.ExtensionSerializer; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DynawoSimulationParameters; /** * @author Marcos de Miguel {@literal } */ @AutoService(ExtensionSerializer.class) -public class DynaWaltzSimulationParametersSerializer implements JsonDynamicSimulationParameters.ExtensionSerializer { +public class DynawoSimulationParametersSerializer implements JsonDynamicSimulationParameters.ExtensionSerializer { @Override public String getCategoryName() { @@ -33,13 +33,13 @@ public String getCategoryName() { } @Override - public Class getExtensionClass() { - return DynaWaltzParameters.class; + public Class getExtensionClass() { + return DynawoSimulationParameters.class; } @Override public String getExtensionName() { - return "DynaWaltzParameters"; + return "DynawoSimulationParameters"; } /** @@ -56,18 +56,18 @@ private interface SerializationSpec { private static ObjectMapper createMapper() { return JsonUtil.createObjectMapper() - .addMixIn(DynaWaltzParameters.class, SerializationSpec.class); + .addMixIn(DynawoSimulationParameters.class, SerializationSpec.class); } @Override - public void serialize(DynaWaltzParameters dynawoParameters, JsonGenerator generator, + public void serialize(DynawoSimulationParameters dynawoParameters, JsonGenerator generator, SerializerProvider provider) throws IOException { createMapper().writeValue(generator, dynawoParameters); } @Override - public DynaWaltzParameters deserialize(JsonParser parser, DeserializationContext arg1) + public DynawoSimulationParameters deserialize(JsonParser parser, DeserializationContext arg1) throws IOException { - return createMapper().readValue(parser, DynaWaltzParameters.class); + return createMapper().readValue(parser, DynawoSimulationParameters.class); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractBlackBoxModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java index dd91a7c01..b6d55d3cc 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java @@ -4,12 +4,12 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.parameters.ParametersSet; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -57,7 +57,7 @@ public void setParameterSetId(String parameterSetId) { } @Override - public void createDynamicModelParameters(DynaWaltzContext context, Consumer parametersAdder) { + public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { // method empty by default to be redefined by specific models } @@ -77,8 +77,8 @@ public List getMacroConnectToAttributes() { } @Override - public String getParFile(DynaWaltzContext context) { - return DynaWaltzParameters.MODELS_OUTPUT_PARAMETERS_FILE; + public String getParFile(DynawoSimulationContext context) { + return DynawoSimulationParameters.MODELS_OUTPUT_PARAMETERS_FILE; } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractEquipmentBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractEquipmentBlackBoxModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java index 341d6e88b..b01c67fa6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractEquipmentBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.xml.MacroStaticReference; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.xml.MacroStaticReference; import com.powsybl.iidm.network.Identifiable; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Luma Zamarreño {@literal } @@ -41,7 +41,7 @@ public T getEquipment() { } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { write(writer, getParFile(context)); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractPureDynamicBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java similarity index 84% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractPureDynamicBlackBoxModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java index c22f40400..684388c1e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/AbstractPureDynamicBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java @@ -4,16 +4,16 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.DynaWaltzContext; +import com.powsybl.dynawo.DynawoSimulationContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Collections; import java.util.List; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * Superclass for automation system and event black box models (model without IIDM static id) @@ -37,7 +37,7 @@ public final List getVarsMapping() { } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { write(writer, getParFile(context)); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/BlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java similarity index 65% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/BlackBoxModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java index b651db0e7..97d5ee674 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/BlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java @@ -4,12 +4,12 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.parameters.ParametersSet; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -33,13 +33,13 @@ public interface BlackBoxModel extends Model { List getMacroConnectFromAttributes(); - String getParFile(DynaWaltzContext context); + String getParFile(DynawoSimulationContext context); - void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException; + void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException; void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException; - void createDynamicModelParameters(DynaWaltzContext context, Consumer parametersAdder); + void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder); void createNetworkParameter(ParametersSet networkParameters); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/EquipmentBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/EquipmentBlackBoxModel.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/EquipmentBlackBoxModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/EquipmentBlackBoxModel.java index 0e38d9f62..0c85f560b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/EquipmentBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/EquipmentBlackBoxModel.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/InjectionModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/InjectionModel.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/InjectionModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/InjectionModel.java index 33ad9051a..cd76d6a06 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/InjectionModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/InjectionModel.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/MeasurementPointSuffix.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/MeasurementPointSuffix.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/MeasurementPointSuffix.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/MeasurementPointSuffix.java index c715f8337..2c81a82d3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/MeasurementPointSuffix.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/MeasurementPointSuffix.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionSuffix; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionSuffix; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/Model.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/Model.java similarity index 82% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/Model.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/Model.java index c11fc06b2..bbe885e59 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/Model.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/Model.java @@ -4,10 +4,10 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; import com.powsybl.dynamicsimulation.DynamicModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/TransformerSide.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/TransformerSide.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/TransformerSide.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/TransformerSide.java index ca3794f8b..e5e7a58cc 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/TransformerSide.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/TransformerSide.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarConnection.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarConnection.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarConnection.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarConnection.java index 855353476..9432dc917 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarConnection.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarConnection.java @@ -4,7 +4,7 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; /** * @author Florian Dupuy {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarMapping.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarMapping.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarMapping.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarMapping.java index d976cd392..9b5f05f44 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/VarMapping.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/VarMapping.java @@ -4,7 +4,7 @@ * 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.dynawaltz.models; +package com.powsybl.dynawo.models; /** * @author Florian Dupuy {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/AbstractAutomationSystemModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/AbstractAutomationSystemModelBuilder.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/AbstractAutomationSystemModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/AbstractAutomationSystemModelBuilder.java index 53a691109..d2fe4f994 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/AbstractAutomationSystemModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/AbstractAutomationSystemModelBuilder.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; -import com.powsybl.dynawaltz.builders.AbstractDynamicModelBuilder; -import com.powsybl.dynawaltz.builders.ModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawo.builders.AbstractDynamicModelBuilder; +import com.powsybl.dynawo.builders.ModelBuilder; +import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.builders.BuilderReports; import com.powsybl.iidm.network.Network; import java.util.Objects; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/BranchModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/BranchModel.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/BranchModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/BranchModel.java index 23f414582..9218786e1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/BranchModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/BranchModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import com.powsybl.iidm.network.TwoSides; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/ConnectionStatefulModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/ConnectionStatefulModel.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/ConnectionStatefulModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/ConnectionStatefulModel.java index 3e62b21d9..6d419f2cc 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/ConnectionStatefulModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/ConnectionStatefulModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; /** * Indicates the connection state of a dynamic model diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystem.java similarity index 80% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystem.java index 06a8cdbc0..91baa563f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystem.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; -import com.powsybl.dynawaltz.DynawaltzReports; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.loads.LoadWithTransformers; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.transformers.TapChangerModel; +import com.powsybl.dynawo.DynawoSimulationReports; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.loads.LoadWithTransformers; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.transformers.TapChangerModel; import com.powsybl.iidm.network.Load; import javax.xml.stream.XMLStreamException; @@ -52,7 +52,7 @@ public void createMacroConnections(MacroConnectionsAdder adder) { boolean isSkipped = adder.createMacroConnectionsOrSkip(this, load, LoadWithTransformers.class, this::getVarConnectionsWith); if (isSkipped) { connection = ConnectionState.CANNOT_CONNECT; - DynawaltzReports.reportEmptyAutomaton(adder.getReportNode(), getName(), getDynamicModelId(), load.getId(), LoadWithTransformers.class.getSimpleName()); + DynawoSimulationReports.reportEmptyAutomaton(adder.getReportNode(), getName(), getDynamicModelId(), load.getId(), LoadWithTransformers.class.getSimpleName()); } else { connection = ConnectionState.CONNECTED; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystemBuilder.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystemBuilder.java index ed81808c1..6296cb409 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerAutomationSystemBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; -import com.powsybl.dynawaltz.models.TransformerSide; +import com.powsybl.dynawo.builders.*; +import com.powsybl.dynawo.models.TransformerSide; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystem.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystem.java index a78f8a06c..9193ba972 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystem.java @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.DynawaltzReports; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.MeasurementPointSuffix; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.ActionConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.transformers.TapChangerModel; +import com.powsybl.dynawo.DynawoSimulationReports; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.MeasurementPointSuffix; +import com.powsybl.dynawo.models.buses.ActionConnectionPoint; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.transformers.TapChangerModel; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.IdentifiableType; @@ -86,7 +86,7 @@ public void createMacroConnections(MacroConnectionsAdder adder) { } } else { isConnected = false; - DynawaltzReports.reportEmptyListAutomaton(adder.getReportNode(), this.getName(), getDynamicModelId(), TapChangerModel.class.getSimpleName()); + DynawoSimulationReports.reportEmptyListAutomaton(adder.getReportNode(), this.getName(), getDynamicModelId(), TapChangerModel.class.getSimpleName()); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java index 01949cec0..fd53831a9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/TapChangerBlockingAutomationSystemBuilder.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.*; import java.util.*; -import static com.powsybl.dynawaltz.builders.BuildersUtil.MEASUREMENT_POINT_TYPE; +import static com.powsybl.dynawo.builders.BuildersUtil.MEASUREMENT_POINT_TYPE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystem.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystem.java index f4bd33b07..665a8bddb 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystem.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.generators.GeneratorModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.generators.GeneratorModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; import com.powsybl.iidm.network.Generator; import java.util.Arrays; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystemBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystemBuilder.java index 0585187e7..709029b1c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/UnderVoltageAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/UnderVoltageAutomationSystemBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems; +package com.powsybl.dynawo.models.automationsystems; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java index 3e58043fc..436c37eba 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/AbstractOverloadManagementSystemBuilder.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; +package com.powsybl.dynawo.models.automationsystems.overloadmanagments; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.BuilderReports; -import com.powsybl.dynawaltz.models.automationsystems.AbstractAutomationSystemModelBuilder; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.models.automationsystems.AbstractAutomationSystemModelBuilder; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java index 3b94ed32a..c779bf99f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystem.java @@ -4,13 +4,13 @@ * 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.dynawaltz.models.automationsystems.overloadmanagments; +package com.powsybl.dynawo.models.automationsystems.overloadmanagments; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.automationsystems.BranchModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.automationsystems.BranchModel; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java index 204bd1d97..aacb9d90b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicOverloadManagementSystemBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; +package com.powsybl.dynawo.models.automationsystems.overloadmanagments; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java index c3c358a03..2ce2756bb 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystem.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; +package com.powsybl.dynawo.models.automationsystems.overloadmanagments; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.automationsystems.BranchModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.automationsystems.BranchModel; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java index 39104e7f5..ff4c702e6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/overloadmanagments/DynamicTwoLevelsOverloadManagementSystemBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.overloadmanagments; +package com.powsybl.dynawo.models.automationsystems.overloadmanagments; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java similarity index 78% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java index 3dbbb4d3c..d7409fa47 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterAutomationSystem.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.transformers.TransformerModel; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.transformers.TransformerModel; import com.powsybl.iidm.network.TwoWindingsTransformer; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java index f2a8ade9d..57a752399 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/AbstractPhaseShifterModelBuilder.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.models.automationsystems.AbstractAutomationSystemModelBuilder; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.models.automationsystems.AbstractAutomationSystemModelBuilder; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java similarity index 73% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java index c55d4a412..7230382d7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; - -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynawaltzReports; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.transformers.TransformerModel; -import com.powsybl.dynawaltz.models.utils.ImmutableLateInit; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; + +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationReports; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.transformers.TransformerModel; +import com.powsybl.dynawo.models.utils.ImmutableLateInit; import com.powsybl.iidm.network.TwoWindingsTransformer; import javax.xml.stream.XMLStreamException; @@ -40,7 +40,7 @@ public void createMacroConnections(MacroConnectionsAdder adder) { if (isConnected) { adder.createMacroConnections(this, transformer.getValue(), TransformerModel.class, this::getVarConnectionsWith); } else { - DynawaltzReports.reportEmptyAutomaton(adder.getReportNode(), getName(), getDynamicModelId(), phaseShifterIDynamicId, PhaseShifterIModel.class.getSimpleName()); + DynawoSimulationReports.reportEmptyAutomaton(adder.getReportNode(), getName(), getDynamicModelId(), phaseShifterIDynamicId, PhaseShifterIModel.class.getSimpleName()); } } @@ -54,7 +54,7 @@ protected List getVarConnectionsWith(TransformerModel connected) } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { if (isConnected) { super.write(writer, context); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java index 80da2cf96..bb2f27cae 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystemBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; -import com.powsybl.dynawaltz.models.automationsystems.AbstractAutomationSystemModelBuilder; +import com.powsybl.dynawo.builders.*; +import com.powsybl.dynawo.models.automationsystems.AbstractAutomationSystemModelBuilder; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java index a91a590ab..34e266071 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystem.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.automationsystems.ConnectionStatefulModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.transformers.TransformerModel; +import com.powsybl.dynawo.models.automationsystems.ConnectionStatefulModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.transformers.TransformerModel; import com.powsybl.iidm.network.TwoWindingsTransformer; import java.util.Arrays; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java index 938002507..829326534 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIAutomationSystemBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIModel.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIModel.java index ae03d14da..ace78fe94 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterIModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterIModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import com.powsybl.iidm.network.TwoWindingsTransformer; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java index 0ab779fe1..e33fb4b12 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystem.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.transformers.TransformerModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.transformers.TransformerModel; import com.powsybl.iidm.network.TwoWindingsTransformer; import java.util.Arrays; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java index 9fd913d1e..ca69311ff 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterPAutomationSystemBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.automationsystems.phaseshifters; +package com.powsybl.dynawo.models.automationsystems.phaseshifters; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBus.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBus.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBus.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBus.java index 2a7ded14c..9c2078b0e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBus.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBus.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.EquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.EquipmentBlackBoxModel; import com.powsybl.iidm.network.Bus; import java.util.ArrayList; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBusBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBusBuilder.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBusBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBusBuilder.java index 6f6880fba..b8a5d2fde 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBusBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/AbstractBusBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; +import com.powsybl.dynawo.builders.AbstractEquipmentModelBuilder; +import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/ActionConnectionPoint.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/ActionConnectionPoint.java index 2a1d7ef2e..e4da98012 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/ActionConnectionPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/ActionConnectionPoint.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import java.util.Optional; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/BusOfFrequencySynchronizedModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/BusOfFrequencySynchronizedModel.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/BusOfFrequencySynchronizedModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/BusOfFrequencySynchronizedModel.java index 2ea7fd412..432aa2275 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/BusOfFrequencySynchronizedModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/BusOfFrequencySynchronizedModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; /** * View of frequency synchronized equipment from the bus to which it is connected diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultActionConnectionPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultActionConnectionPoint.java similarity index 90% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultActionConnectionPoint.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultActionConnectionPoint.java index 5fb5ce8ab..e3af4ef04 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultActionConnectionPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultActionConnectionPoint.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractDefaultModel; +import com.powsybl.dynawo.models.defaultmodels.AbstractDefaultModel; import java.util.Optional; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultBusOfFrequencySynchronized.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultBusOfFrequencySynchronized.java similarity index 71% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultBusOfFrequencySynchronized.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultBusOfFrequencySynchronized.java index 0961168b5..1d943f099 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultBusOfFrequencySynchronized.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultBusOfFrequencySynchronized.java @@ -1,8 +1,8 @@ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractDefaultModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants; +import com.powsybl.dynawo.models.defaultmodels.AbstractDefaultModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.xml.DynawoSimulationXmlConstants; import java.util.List; @@ -27,7 +27,7 @@ public String getNumCCVarName() { @Override public List getMacroConnectToAttributes() { return List.of( - MacroConnectAttribute.of("id2", DynaWaltzXmlConstants.NETWORK), + MacroConnectAttribute.of("id2", DynawoSimulationXmlConstants.NETWORK), MacroConnectAttribute.of("name2", frequencySynchronizedStaticId) ); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultEquipmentConnectionPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultEquipmentConnectionPoint.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultEquipmentConnectionPoint.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultEquipmentConnectionPoint.java index b484e431b..fa35a2235 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/DefaultEquipmentConnectionPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/DefaultEquipmentConnectionPoint.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.xml.DynawoSimulationXmlConstants; import com.powsybl.iidm.network.TwoSides; import java.util.List; @@ -58,6 +58,6 @@ public Optional getSwitchOffSignalVarName(TwoSides side) { @Override public List getMacroConnectToAttributes() { - return List.of(MacroConnectAttribute.of("id2", DynaWaltzXmlConstants.NETWORK)); + return List.of(MacroConnectAttribute.of("id2", DynawoSimulationXmlConstants.NETWORK)); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/EquipmentConnectionPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/EquipmentConnectionPoint.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/EquipmentConnectionPoint.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/EquipmentConnectionPoint.java index 03f2d30ec..e1c18460e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/EquipmentConnectionPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/EquipmentConnectionPoint.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import com.powsybl.iidm.network.TwoSides; import java.util.Optional; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBus.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBus.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBus.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBus.java index 8753d1c4b..bed3f0087 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBus.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBus.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.iidm.network.Bus; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBusBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBusBuilder.java index 136517343..e89f76cff 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBusBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/InfiniteBusBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBus.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBus.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBus.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBus.java index 3b965c7e2..7db37c03c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBus.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBus.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.iidm.network.Bus; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBusBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBusBuilder.java index b923c501f..c16767d53 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/StandardBusBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/buses/StandardBusBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractDefaultModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractDefaultModel.java similarity index 62% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractDefaultModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractDefaultModel.java index b7c5c158b..b91c4cb7a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractDefaultModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractDefaultModel.java @@ -1,8 +1,8 @@ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.xml.DynawoSimulationXmlConstants; import java.util.List; import java.util.Objects; @@ -22,7 +22,7 @@ public String getStaticId() { @Override public List getMacroConnectToAttributes() { return List.of( - MacroConnectAttribute.of("id2", DynaWaltzXmlConstants.NETWORK), + MacroConnectAttribute.of("id2", DynawoSimulationXmlConstants.NETWORK), MacroConnectAttribute.of("name2", staticId) ); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractInjectionDefaultModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractInjectionDefaultModel.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractInjectionDefaultModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractInjectionDefaultModel.java index d7362aac0..f1c6b09a2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/AbstractInjectionDefaultModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/AbstractInjectionDefaultModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; -import com.powsybl.dynawaltz.models.InjectionModel; +import com.powsybl.dynawo.models.InjectionModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelConfiguration.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelConfiguration.java similarity index 71% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelConfiguration.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelConfiguration.java index 1bd1437f2..5c872b63c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelConfiguration.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelConfiguration.java @@ -5,23 +5,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; -import com.powsybl.dynawaltz.models.InjectionModel; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.buses.*; -import com.powsybl.dynawaltz.models.generators.DefaultGenerator; -import com.powsybl.dynawaltz.models.generators.GeneratorModel; -import com.powsybl.dynawaltz.models.hvdc.DefaultHvdc; -import com.powsybl.dynawaltz.models.hvdc.HvdcModel; -import com.powsybl.dynawaltz.models.lines.DefaultLine; -import com.powsybl.dynawaltz.models.lines.LineModel; -import com.powsybl.dynawaltz.models.loads.DefaultLoad; -import com.powsybl.dynawaltz.models.shunts.DefaultShunt; -import com.powsybl.dynawaltz.models.shunts.ShuntModel; -import com.powsybl.dynawaltz.models.svarcs.DefaultStaticVarCompensator; -import com.powsybl.dynawaltz.models.transformers.DefaultTransformer; -import com.powsybl.dynawaltz.models.transformers.TransformerModel; +import com.powsybl.dynawo.models.InjectionModel; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.buses.ActionConnectionPoint; +import com.powsybl.dynawo.models.buses.DefaultActionConnectionPoint; +import com.powsybl.dynawo.models.buses.DefaultEquipmentConnectionPoint; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.generators.DefaultGenerator; +import com.powsybl.dynawo.models.generators.GeneratorModel; +import com.powsybl.dynawo.models.hvdc.DefaultHvdc; +import com.powsybl.dynawo.models.hvdc.HvdcModel; +import com.powsybl.dynawo.models.lines.DefaultLine; +import com.powsybl.dynawo.models.lines.LineModel; +import com.powsybl.dynawo.models.loads.DefaultLoad; +import com.powsybl.dynawo.models.shunts.DefaultShunt; +import com.powsybl.dynawo.models.shunts.ShuntModel; +import com.powsybl.dynawo.models.svarcs.DefaultStaticVarCompensator; +import com.powsybl.dynawo.models.transformers.DefaultTransformer; +import com.powsybl.dynawo.models.transformers.TransformerModel; import com.powsybl.iidm.network.IdentifiableType; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactory.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactory.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactory.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactory.java index c3f975be1..d87b4d9cb 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactory.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactory.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; import java.util.HashMap; import java.util.Map; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactoryInterface.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactoryInterface.java similarity index 90% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactoryInterface.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactoryInterface.java index 3e2b88ea8..a2cf58867 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelFactoryInterface.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelFactoryInterface.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelsHandler.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelsHandler.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelsHandler.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelsHandler.java index 97ff99424..6ee7770fd 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelsHandler.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelsHandler.java @@ -4,10 +4,10 @@ * 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.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.IdentifiableType; import org.slf4j.Logger; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractDynamicLibEventDisconnection.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractDynamicLibEventDisconnection.java index e7c10aa40..886179940 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractDynamicLibEventDisconnection.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractDynamicLibEventDisconnection.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.utils.ImmutableLateInit; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.utils.ImmutableLateInit; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Identifiable; -import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.BOOL; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; import static java.lang.Boolean.TRUE; /** @@ -50,7 +50,7 @@ protected void createEventSpecificParameters(ParametersSet paramSet) { } @Override - public final void setEquipmentHasDynamicModel(DynaWaltzContext context) { + public final void setEquipmentHasDynamicModel(DynawoSimulationContext context) { this.equipmentHasDynamicModel.setValue(hasDynamicModel(context)); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java similarity index 79% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEvent.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java index e84a95020..2a6845421 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Identifiable; import java.util.function.Consumer; @@ -40,12 +40,12 @@ public double getStartTime() { } @Override - public String getParFile(DynaWaltzContext context) { + public String getParFile(DynawoSimulationContext context) { return context.getSimulationParFile(); } @Override - public void createDynamicModelParameters(DynaWaltzContext context, Consumer parametersAdder) { + public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { ParametersSet paramSet = new ParametersSet(getParameterSetId()); createEventSpecificParameters(paramSet); parametersAdder.accept(paramSet); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEventModelBuilder.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEventModelBuilder.java index 8bf4216ce..5031b9a84 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/AbstractEventModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEventModelBuilder.java @@ -5,11 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.AbstractDynamicModelBuilder; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.builders.ModelBuilder; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ContextDependentEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ContextDependentEvent.java similarity index 71% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ContextDependentEvent.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ContextDependentEvent.java index 61c14dd86..93f925ecb 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ContextDependentEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ContextDependentEvent.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.DynaWaltzContext; +import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.iidm.network.Identifiable; /** @@ -17,9 +17,9 @@ public interface ContextDependentEvent { Identifiable getEquipment(); - default boolean hasDynamicModel(DynaWaltzContext context) { + default boolean hasDynamicModel(DynawoSimulationContext context) { return context.hasDynamicModel(getEquipment()); } - void setEquipmentHasDynamicModel(DynaWaltzContext context); + void setEquipmentHasDynamicModel(DynawoSimulationContext context); } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ControllableEquipment.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java similarity index 50% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ControllableEquipment.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java index 6248a71fc..dc76a2853 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/ControllableEquipment.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java @@ -1,6 +1,6 @@ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; public interface ControllableEquipment extends Model { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java index cd9ba9c87..d58b4187f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariation.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java @@ -5,21 +5,21 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.ImmutableLateInit; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.utils.ImmutableLateInit; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Injection; import java.util.EnumSet; import java.util.List; -import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.BOOL; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; import static java.lang.Boolean.TRUE; /** @@ -86,7 +86,7 @@ public void createNetworkParameter(ParametersSet networkParameters) { } @Override - public final void setEquipmentHasDynamicModel(DynaWaltzContext context) { + public final void setEquipmentHasDynamicModel(DynawoSimulationContext context) { this.equipmentHasDynamicModel.setValue(hasDynamicModel(context)); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariationBuilder.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariationBuilder.java index 86cc130c8..28d0fffa6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventActivePowerVariationBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariationBuilder.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.BuilderReports; -import com.powsybl.dynawaltz.builders.EventModelInfo; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.builders.EventModelInfo; import com.powsybl.iidm.network.Injection; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventBranchDisconnection.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventBranchDisconnection.java similarity index 80% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventBranchDisconnection.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventBranchDisconnection.java index 7dcda04f2..e51620bc6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventBranchDisconnection.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventBranchDisconnection.java @@ -4,19 +4,19 @@ * 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.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.automationsystems.BranchModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.automationsystems.BranchModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Branch; import com.powsybl.iidm.network.TwoSides; import java.util.List; -import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.BOOL; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; /** * @author Marcos de Miguel {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventDisconnectionBuilder.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventDisconnectionBuilder.java index 71d3cd2b7..5b0a00d74 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventDisconnectionBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventDisconnectionBuilder.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.BuilderReports; -import com.powsybl.dynawaltz.builders.EventModelInfo; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.builders.EventModelInfo; import com.powsybl.iidm.network.*; import java.util.EnumSet; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventHvdcDisconnection.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventHvdcDisconnection.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventHvdcDisconnection.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventHvdcDisconnection.java index 8dbc02f12..ac3a593d3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventHvdcDisconnection.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventHvdcDisconnection.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.hvdc.HvdcModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.hvdc.HvdcModel; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventInjectionDisconnection.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventInjectionDisconnection.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventInjectionDisconnection.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventInjectionDisconnection.java index 5c295d272..13b8e6c61 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/EventInjectionDisconnection.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventInjectionDisconnection.java @@ -4,11 +4,11 @@ * 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.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.models.InjectionModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.InjectionModel; +import com.powsybl.dynawo.models.VarConnection; import com.powsybl.iidm.network.*; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEvent.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEvent.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEvent.java index 8be27e06c..11d839a8c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEvent.java @@ -5,18 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.ActionConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.ActionConnectionPoint; +import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Bus; import java.util.List; -import static com.powsybl.dynawaltz.parameters.ParameterType.BOOL; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.BOOL; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEventBuilder.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEventBuilder.java index ca59eed65..9002b2db7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/events/NodeFaultEventBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/NodeFaultEventBuilder.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.events; +package com.powsybl.dynawo.models.events; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.BuilderEquipment; -import com.powsybl.dynawaltz.builders.BuilderReports; -import com.powsybl.dynawaltz.builders.EventModelInfo; +import com.powsybl.dynawo.builders.BuilderEquipment; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.builders.EventModelInfo; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/AbstractFrequencySynchronizer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/AbstractFrequencySynchronizer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java index c3a69a07e..6e0d5e1ec 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/AbstractFrequencySynchronizer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.frequencysynchronizers; +package com.powsybl.dynawo.models.frequencysynchronizers; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import java.util.List; @@ -32,7 +32,7 @@ public boolean isEmpty() { } @Override - public String getParFile(DynaWaltzContext context) { + public String getParFile(DynawoSimulationContext context) { return context.getSimulationParFile(); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizedModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizedModel.java similarity index 79% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizedModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizedModel.java index 666da6bdf..e90e6b3ce 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizedModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizedModel.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.frequencysynchronizers; +package com.powsybl.dynawo.models.frequencysynchronizers; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.VarConnection; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.VarConnection; import com.powsybl.iidm.network.Bus; import java.util.List; @@ -32,7 +32,7 @@ default List getSetPointVarConnections() { ); } - default double getWeightGen(DynaWaltzParameters dynaWaltzParameters) { + default double getWeightGen(DynawoSimulationParameters dynawoSimulationParameters) { return 0; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizerModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizerModel.java similarity index 81% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizerModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizerModel.java index ca5979e13..19fb886cf 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/FrequencySynchronizerModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/FrequencySynchronizerModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.frequencysynchronizers; +package com.powsybl.dynawo.models.frequencysynchronizers; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.BlackBoxModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/OmegaRef.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java similarity index 75% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/OmegaRef.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java index 37b791fba..a631dfecd 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/OmegaRef.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java @@ -4,23 +4,23 @@ * 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.dynawaltz.models.frequencysynchronizers; +package com.powsybl.dynawo.models.frequencysynchronizers; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.BusOfFrequencySynchronizedModel; -import com.powsybl.dynawaltz.models.buses.DefaultBusOfFrequencySynchronized; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectAttribute; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.BusOfFrequencySynchronizedModel; +import com.powsybl.dynawo.models.buses.DefaultBusOfFrequencySynchronized; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.parameters.ParametersSet; import java.util.List; import java.util.function.Consumer; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; -import static com.powsybl.dynawaltz.parameters.ParameterType.INT; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.INT; /** * OmegaRef is a special model: its role is to synchronize the generators' frequency. The corresponding black @@ -39,14 +39,14 @@ public OmegaRef(List synchronizedEquipments) { } @Override - public void createDynamicModelParameters(DynaWaltzContext context, Consumer parametersAdder) { + public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { ParametersSet paramSet = new ParametersSet(getParameterSetId()); - DynaWaltzParameters dynaWaltzParameters = context.getDynaWaltzParameters(); + DynawoSimulationParameters dynawoSimulationParameters = context.getDynawoSimulationParameters(); // The dynamic models are declared in the DYD following the order of dynamic models' supplier. // The OmegaRef parameters index the weight of each generator according to that declaration order. int index = 0; for (FrequencySynchronizedModel eq : synchronizedEquipments) { - paramSet.addParameter("weight_gen_" + index, DOUBLE, Double.toString(eq.getWeightGen(dynaWaltzParameters))); + paramSet.addParameter("weight_gen_" + index, DOUBLE, Double.toString(eq.getWeightGen(dynawoSimulationParameters))); index++; } paramSet.addParameter("nbGen", INT, Long.toString(synchronizedEquipments.size())); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/SetPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java similarity index 75% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/SetPoint.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java index 9e347aa34..2f156c1de 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/frequencysynchronizers/SetPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java @@ -5,18 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.frequencysynchronizers; +package com.powsybl.dynawo.models.frequencysynchronizers; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.parameters.ParametersSet; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.parameters.ParametersSet; import java.util.List; import java.util.function.Consumer; -import static com.powsybl.dynawaltz.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; /** * Special generators' frequency synchronizer used when an Infinite Bus is present in the model. @@ -30,7 +30,7 @@ public SetPoint(List synchronizedEquipments) { } @Override - public void createDynamicModelParameters(DynaWaltzContext context, Consumer parametersAdder) { + public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { ParametersSet paramSet = new ParametersSet(getParameterSetId()); paramSet.addParameter("setPoint_Value0", DOUBLE, Double.toString(1)); parametersAdder.accept(paramSet); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGenerator.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGenerator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGenerator.java index ed7c5dce3..f7327ceb9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGenerator.java @@ -4,13 +4,13 @@ * 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.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Generator; import java.util.ArrayList; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGeneratorBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGeneratorBuilder.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGeneratorBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGeneratorBuilder.java index 404386ff5..7604bad3d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/AbstractGeneratorBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/AbstractGeneratorBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; +import com.powsybl.dynawo.builders.AbstractEquipmentModelBuilder; +import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/DefaultGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/DefaultGenerator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java index 8a70d8f12..54d001179 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/DefaultGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawaltz.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; +import com.powsybl.dynawo.models.events.ControllableEquipment; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/EnumGeneratorComponent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/EnumGeneratorComponent.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/EnumGeneratorComponent.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/EnumGeneratorComponent.java index 5887b60e9..faeeaedab 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/EnumGeneratorComponent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/EnumGeneratorComponent.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitious.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitious.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitious.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitious.java index 855040ae1..b9986e0b7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitious.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitious.java @@ -4,7 +4,7 @@ * 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.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.iidm.network.Generator; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitiousBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitiousBuilder.java index e385df16f..d6ca73fb9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorFictitiousBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorFictitiousBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorModel.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorModel.java index cd6d7a809..a0a6c5150 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GeneratorModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GeneratorModel.java @@ -4,9 +4,9 @@ * 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.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.InjectionModel; +import com.powsybl.dynawo.models.InjectionModel; /** * @author Florian Dupuy {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverter.java similarity index 76% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverter.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverter.java index 0371ca6e7..d5c77eab0 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverter.java @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.frequencysynchronizers.FrequencySynchronizedModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.BusUtils; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizedModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.utils.BusUtils; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Generator; @@ -68,8 +68,8 @@ public List getOmegaRefVarConnections() { } @Override - public double getWeightGen(DynaWaltzParameters dynaWaltzParameters) { - return dynaWaltzParameters.getModelParameters(getParameterSetId()).getDouble("converter_SNom"); + public double getWeightGen(DynawoSimulationParameters dynawoSimulationParameters) { + return dynawoSimulationParameters.getModelParameters(getParameterSetId()).getDouble("converter_SNom"); } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverterBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverterBuilder.java index 1918c81a3..513cbd163 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/GridFormingConverterBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/GridFormingConverterBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGenerator.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGenerator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGenerator.java index 4e1acc243..1d425c3e9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGenerator.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.frequencysynchronizers.FrequencySynchronizedModel; -import com.powsybl.dynawaltz.models.utils.BusUtils; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizedModel; +import com.powsybl.dynawo.models.utils.BusUtils; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Generator; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorBuilder.java index 7c857021b..c4548ce09 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorControllable.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java index 5b56342e9..a1ac5e984 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipment; import com.powsybl.iidm.network.Generator; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedWeccGen.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedWeccGen.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedWeccGen.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedWeccGen.java index a01f27cd5..98bddc15f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronizedWeccGen.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedWeccGen.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.frequencysynchronizers.FrequencySynchronizedModel; -import com.powsybl.dynawaltz.models.utils.BusUtils; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizedModel; +import com.powsybl.dynawo.models.utils.BusUtils; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Generator; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java similarity index 76% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGenerator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java index 129d83eed..e61d3f524 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java @@ -4,10 +4,10 @@ * 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.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.VarConnection; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.VarConnection; import com.powsybl.iidm.network.Generator; import java.util.Arrays; @@ -45,9 +45,9 @@ public List getOmegaRefVarConnections() { } @Override - public double getWeightGen(DynaWaltzParameters dynaWaltzParameters) { - double h = dynaWaltzParameters.getModelParameters(getParameterSetId()).getDouble("generator_H"); - double sNom = dynaWaltzParameters.getModelParameters(getParameterSetId()).getDouble("generator_SNom"); + public double getWeightGen(DynawoSimulationParameters dynawoSimulationParameters) { + double h = dynawoSimulationParameters.getModelParameters(getParameterSetId()).getDouble("generator_H"); + double sNom = dynawoSimulationParameters.getModelParameters(getParameterSetId()).getDouble("generator_SNom"); return h * sNom; } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorBuilder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorBuilder.java index 86d29a2e1..ef90798fb 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorControllable.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java index b1645394f..53dea8a81 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/SynchronousGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipment; import com.powsybl.iidm.network.Generator; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccBuilder.java index b5e4a5f3a..99a1f1ac2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccGen.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccGen.java similarity index 82% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccGen.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccGen.java index 0ca4b64a3..b56068fb9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/generators/WeccGen.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/WeccGen.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.generators; +package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Generator; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdc.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdc.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdc.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdc.java index c2eaedd05..e3c96cf6d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdc.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdc.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.HvdcConverterStation; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdcBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdcBuilder.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdcBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdcBuilder.java index cc5516997..59a7f8bc6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/AbstractHvdcBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/AbstractHvdcBuilder.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; -import com.powsybl.dynawaltz.builders.BuilderReports; +import com.powsybl.dynawo.builders.AbstractEquipmentModelBuilder; +import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.builders.BuilderReports; import com.powsybl.iidm.network.*; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DanglingSide.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DanglingSide.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DanglingSide.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DanglingSide.java index c4a7e1e48..04868cb8f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DanglingSide.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DanglingSide.java @@ -1,8 +1,8 @@ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.TwoSides; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DefaultHvdc.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DefaultHvdc.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DefaultHvdc.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DefaultHvdc.java index 6e2b4a339..76b9740ec 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/DefaultHvdc.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/DefaultHvdc.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractDefaultModel; +import com.powsybl.dynawo.models.defaultmodels.AbstractDefaultModel; import com.powsybl.iidm.network.TwoSides; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcModel.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcModel.java index 82104b67e..351ca20d5 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; -import com.powsybl.dynawaltz.models.Model; +import com.powsybl.dynawo.models.Model; import com.powsybl.iidm.network.TwoSides; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcP.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcP.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcP.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcP.java index d3b230211..559768623 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcP.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcP.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPBuilder.java index dd1eb8b17..531ddb787 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPDangling.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPDangling.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPDangling.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPDangling.java index 48fad3653..9d732a737 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcPDangling.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcPDangling.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.iidm.network.HvdcConverterStation; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVsc.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVsc.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVsc.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVsc.java index d7757a35d..f7467ef10 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVsc.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVsc.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscBuilder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscBuilder.java index a91312a0c..dc344865c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.*; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscDangling.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscDangling.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscDangling.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscDangling.java index 3291d4370..e2431331d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/hvdc/HvdcVscDangling.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/hvdc/HvdcVscDangling.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.hvdc; +package com.powsybl.dynawo.models.hvdc; import com.powsybl.commons.PowsyblException; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.iidm.network.HvdcConverterStation; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/DefaultLine.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/DefaultLine.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/DefaultLine.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/DefaultLine.java index bd42d9628..c6b9b55a3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/DefaultLine.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/DefaultLine.java @@ -4,10 +4,10 @@ * 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.dynawaltz.models.lines; +package com.powsybl.dynawo.models.lines; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractDefaultModel; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.defaultmodels.AbstractDefaultModel; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.TwoSides; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineBuilder.java index fbe15180f..eef91450b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.lines; +package com.powsybl.dynawo.models.lines; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineModel.java similarity index 79% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineModel.java index 38c2eb769..d8c4ec0f6 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/LineModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/LineModel.java @@ -4,9 +4,9 @@ * 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.dynawaltz.models.lines; +package com.powsybl.dynawo.models.lines; -import com.powsybl.dynawaltz.models.automationsystems.BranchModel; +import com.powsybl.dynawo.models.automationsystems.BranchModel; /** * @author Florian Dupuy {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/StandardLine.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/StandardLine.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/StandardLine.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/StandardLine.java index b68563fc2..f13c46fba 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/lines/StandardLine.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/lines/StandardLine.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.lines; +package com.powsybl.dynawo.models.lines; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoad.java similarity index 79% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoad.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoad.java index d51bee59c..c7366b59b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoad.java @@ -4,13 +4,13 @@ * 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.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.InjectionModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.InjectionModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Load; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoadModelBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoadModelBuilder.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoadModelBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoadModelBuilder.java index bf7ff2695..abe8211df 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/AbstractLoadModelBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/AbstractLoadModelBuilder.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.AbstractEquipmentModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfig; +import com.powsybl.dynawo.builders.AbstractEquipmentModelBuilder; +import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoad.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoad.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoad.java index 464b4c5db..4975a531e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoad.java @@ -4,11 +4,11 @@ * 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.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Load; import java.util.ArrayList; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadBuilder.java index e262dd90b..299f08fb3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadControllable.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java index b78da598d..2b4fb4772 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/BaseLoadControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawaltz.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipment; import com.powsybl.iidm.network.Load; /** diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/DefaultLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java similarity index 79% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/DefaultLoad.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java index e7d14b433..1384a52da 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/DefaultLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawaltz.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; +import com.powsybl.dynawo.models.events.ControllableEquipment; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformer.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformer.java index 973ba7812..3eb8fd265 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformer.java @@ -4,20 +4,20 @@ * 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.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Load; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.NONE; +import static com.powsybl.dynawo.models.TransformerSide.NONE; /** * @author Marcos de Miguel {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerBuilder.java index d268132b3..73b738955 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChanger.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChanger.java similarity index 82% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChanger.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChanger.java index ae3602fd8..94b405d78 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChanger.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChanger.java @@ -5,18 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.transformers.TapChangerModel; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.transformers.TapChangerModel; import com.powsybl.iidm.network.Load; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.NONE; +import static com.powsybl.dynawo.models.TransformerSide.NONE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChangerBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChangerBuilder.java index c052f346f..7067e2b3e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadOneTransformerTapChangerBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadOneTransformerTapChangerBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformers.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformers.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformers.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformers.java index 46f790774..9b8d3f3d4 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformers.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformers.java @@ -5,20 +5,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.Load; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.*; +import static com.powsybl.dynawo.models.TransformerSide.*; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersBuilder.java index 20e80ae17..8023f0094 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangers.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangers.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangers.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangers.java index a1fab28d9..d533b6609 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangers.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangers.java @@ -5,19 +5,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.transformers.TapChangerModel; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.transformers.TapChangerModel; import com.powsybl.iidm.network.Load; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.HIGH_VOLTAGE; -import static com.powsybl.dynawaltz.models.TransformerSide.LOW_VOLTAGE; +import static com.powsybl.dynawo.models.TransformerSide.HIGH_VOLTAGE; +import static com.powsybl.dynawo.models.TransformerSide.LOW_VOLTAGE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangersBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangersBuilder.java index f49c76e8b..f5749ec2e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadTwoTransformersTapChangersBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadTwoTransformersTapChangersBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.Network; import java.util.Set; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadWithTransformers.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadWithTransformers.java similarity index 74% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadWithTransformers.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadWithTransformers.java index b0268af80..36e43fd03 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/loads/LoadWithTransformers.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/LoadWithTransformers.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.loads; +package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnect.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnect.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnect.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnect.java index 66e5f53b4..f96896df2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnect.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnect.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.macroconnections; +package com.powsybl.dynawo.models.macroconnections; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.List; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectAttribute.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectAttribute.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectAttribute.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectAttribute.java index 4a8b0341c..fb9af65d9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectAttribute.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectAttribute.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.macroconnections; +package com.powsybl.dynawo.models.macroconnections; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionSuffix.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionSuffix.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionSuffix.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionSuffix.java index d77c2ab21..a148e811e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionSuffix.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionSuffix.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.macroconnections; +package com.powsybl.dynawo.models.macroconnections; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionsAdder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionsAdder.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionsAdder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionsAdder.java index dc20c5a81..5c53fcac2 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnectionsAdder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnectionsAdder.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.macroconnections; +package com.powsybl.dynawo.models.macroconnections; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.automationsystems.ConnectionStatefulModel; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.utils.BusUtils; +import com.powsybl.dynawo.models.automationsystems.ConnectionStatefulModel; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.utils.BusUtils; import com.powsybl.iidm.network.*; import java.util.Arrays; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnector.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnector.java similarity index 86% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnector.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnector.java index 44b7b3255..d0538bda8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/macroconnections/MacroConnector.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/macroconnections/MacroConnector.java @@ -4,18 +4,18 @@ * 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.dynawaltz.models.macroconnections; +package com.powsybl.dynawo.models.macroconnections; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.TwoSides; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.List; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.MACRO_CONNECTOR_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.MACRO_CONNECTOR_PREFIX; /** * @author Marcos de Miguel {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShunt.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShunt.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShunt.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShunt.java index bef1810db..8f5d18ae9 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShunt.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShunt.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.shunts; +package com.powsybl.dynawo.models.shunts; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.iidm.network.ShuntCompensator; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShuntBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShuntBuilder.java index 847c5089a..968dad1a1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/BaseShuntBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/BaseShuntBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.shunts; +package com.powsybl.dynawo.models.shunts; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.ShuntCompensator; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/DefaultShunt.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/DefaultShunt.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/DefaultShunt.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/DefaultShunt.java index 3664d786c..f08600c92 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/DefaultShunt.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/DefaultShunt.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.shunts; +package com.powsybl.dynawo.models.shunts; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractInjectionDefaultModel; +import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/ShuntModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/ShuntModel.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/ShuntModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/ShuntModel.java index 87f33d71f..57baf5cf0 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/shunts/ShuntModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/shunts/ShuntModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.shunts; +package com.powsybl.dynawo.models.shunts; -import com.powsybl.dynawaltz.models.InjectionModel; +import com.powsybl.dynawo.models.InjectionModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensator.java similarity index 84% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensator.java index 7877f35c1..e9db958bf 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensator.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.svarcs; - -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.InjectionModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.VarMapping; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; +package com.powsybl.dynawo.models.svarcs; + +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.InjectionModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.VarMapping; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; import com.powsybl.iidm.network.StaticVarCompensator; import com.powsybl.iidm.network.extensions.StandbyAutomaton; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensatorBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensatorBuilder.java index 5d7ab0e05..330c35874 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/BaseStaticVarCompensatorBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/BaseStaticVarCompensatorBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.svarcs; +package com.powsybl.dynawo.models.svarcs; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.StaticVarCompensator; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/DefaultStaticVarCompensator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/DefaultStaticVarCompensator.java similarity index 83% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/DefaultStaticVarCompensator.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/DefaultStaticVarCompensator.java index ea0b5be15..26bf55367 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/svarcs/DefaultStaticVarCompensator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/svarcs/DefaultStaticVarCompensator.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.svarcs; +package com.powsybl.dynawo.models.svarcs; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractInjectionDefaultModel; +import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/DefaultTransformer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/DefaultTransformer.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/DefaultTransformer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/DefaultTransformer.java index d55b89f49..6bd63a11d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/DefaultTransformer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/DefaultTransformer.java @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.transformers; +package com.powsybl.dynawo.models.transformers; -import com.powsybl.dynawaltz.models.defaultmodels.AbstractDefaultModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.defaultmodels.AbstractDefaultModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.TwoSides; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.NONE; +import static com.powsybl.dynawo.models.TransformerSide.NONE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TapChangerModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TapChangerModel.java similarity index 68% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TapChangerModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TapChangerModel.java index 6128c848d..437ebbeda 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TapChangerModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TapChangerModel.java @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.transformers; +package com.powsybl.dynawo.models.transformers; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.VarConnection; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.VarConnection; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.HIGH_VOLTAGE; -import static com.powsybl.dynawaltz.models.TransformerSide.NONE; +import static com.powsybl.dynawo.models.TransformerSide.HIGH_VOLTAGE; +import static com.powsybl.dynawo.models.TransformerSide.NONE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatio.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatio.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatio.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatio.java index e12e0a4f0..a765bba42 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatio.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatio.java @@ -5,19 +5,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.transformers; +package com.powsybl.dynawo.models.transformers; -import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; -import com.powsybl.dynawaltz.models.VarConnection; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawaltz.models.utils.SideUtils; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.AbstractEquipmentBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.utils.SideUtils; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.TwoWindingsTransformer; import java.util.List; -import static com.powsybl.dynawaltz.models.TransformerSide.NONE; +import static com.powsybl.dynawo.models.TransformerSide.NONE; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatioBuilder.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatioBuilder.java index 5d9bf4014..1352fcfb8 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerFixedRatioBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerFixedRatioBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.transformers; +package com.powsybl.dynawo.models.transformers; import com.powsybl.commons.report.ReportNode; -import com.powsybl.dynawaltz.builders.*; +import com.powsybl.dynawo.builders.*; import com.powsybl.iidm.network.IdentifiableType; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoWindingsTransformer; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerModel.java similarity index 84% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerModel.java index 9c0c16480..e3bc61b96 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/transformers/TransformerModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/transformers/TransformerModel.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.transformers; +package com.powsybl.dynawo.models.transformers; -import com.powsybl.dynawaltz.models.automationsystems.BranchModel; +import com.powsybl.dynawo.models.automationsystems.BranchModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BlackBoxSupplierUtils.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BlackBoxSupplierUtils.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BlackBoxSupplierUtils.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BlackBoxSupplierUtils.java index 277ef399c..80d47995a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BlackBoxSupplierUtils.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BlackBoxSupplierUtils.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.utils; +package com.powsybl.dynawo.models.utils; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; import com.powsybl.dynamicsimulation.EventModelsSupplier; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BusUtils.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BusUtils.java similarity index 94% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BusUtils.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BusUtils.java index c05c622cf..1572934fe 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/BusUtils.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/BusUtils.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.utils; +package com.powsybl.dynawo.models.utils; import com.powsybl.iidm.network.*; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/ImmutableLateInit.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/ImmutableLateInit.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/ImmutableLateInit.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/ImmutableLateInit.java index 3b29b2f05..1ce0ea975 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/ImmutableLateInit.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/ImmutableLateInit.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.utils; +package com.powsybl.dynawo.models.utils; import com.powsybl.commons.PowsyblException; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/SideUtils.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/SideUtils.java similarity index 95% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/SideUtils.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/SideUtils.java index 671d700b7..ce7ff9aed 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/models/utils/SideUtils.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/utils/SideUtils.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.utils; +package com.powsybl.dynawo.models.utils; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Parameter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Parameter.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Parameter.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Parameter.java index cd4f1c0a2..fe1792462 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Parameter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Parameter.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.parameters; +package com.powsybl.dynawo.parameters; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParameterType.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParameterType.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParameterType.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParameterType.java index d057f90ff..ef0c0059a 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParameterType.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParameterType.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.parameters; +package com.powsybl.dynawo.parameters; /** * @author Marcos de Miguel {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParametersSet.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParametersSet.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParametersSet.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParametersSet.java index 39c968bf4..c47995ca3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/ParametersSet.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/ParametersSet.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.parameters; +package com.powsybl.dynawo.parameters; import com.fasterxml.jackson.annotation.JsonProperty; import com.powsybl.commons.PowsyblException; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Reference.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Reference.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Reference.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Reference.java index ba34c5c05..74291c149 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/parameters/Reference.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/parameters/Reference.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.parameters; +package com.powsybl.dynawo.parameters; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/Property.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/Property.java similarity index 59% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/Property.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/Property.java index 73e383e67..d69314abe 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/Property.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/Property.java @@ -5,12 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; +import com.powsybl.dynawo.builders.ModelBuilder; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfig; +import com.powsybl.dynawo.suppliers.events.EventModelConfig; /** - * {@link com.powsybl.dynawaltz.suppliers.dynamicmodels.DynamicModelConfig} and {@link com.powsybl.dynawaltz.suppliers.events.EventModelConfig} property - * @param name property name corresponding to {@link com.powsybl.dynawaltz.builders.ModelBuilder} method name + * {@link DynamicModelConfig} and {@link EventModelConfig} property + * @param name property name corresponding to {@link ModelBuilder} method name * @param value property value * @param propertyClass {@link #value} class * @author Laurent Issertial {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyBuilder.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyBuilder.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyBuilder.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyBuilder.java index b15b689d3..16c5e6f5e 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyBuilder.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyBuilder.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; -import com.powsybl.dynawaltz.suppliers.dynamicmodels.DynamicModelConfigsJsonDeserializer; -import com.powsybl.dynawaltz.suppliers.events.EventModelConfigsJsonDeserializer; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfigsJsonDeserializer; +import com.powsybl.dynawo.suppliers.events.EventModelConfigsJsonDeserializer; import java.util.Collection; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyParserUtils.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyParserUtils.java similarity index 98% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyParserUtils.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyParserUtils.java index b610ef1b3..497f2fe8b 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyParserUtils.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyParserUtils.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonToken; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyType.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyType.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyType.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyType.java index 9b03f5995..5a084bdf7 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/PropertyType.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/PropertyType.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SetGroupType.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SetGroupType.java similarity index 74% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SetGroupType.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SetGroupType.java index 5e10323fd..184ef5697 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SetGroupType.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SetGroupType.java @@ -5,12 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; -import com.powsybl.dynawaltz.suppliers.dynamicmodels.DynawoModelsSupplier; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynawoModelsSupplier; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfig; /** - * Configures {@link com.powsybl.dynawaltz.suppliers.dynamicmodels.DynamicModelConfig#group()} processing in {@link DynawoModelsSupplier} + * Configures {@link DynamicModelConfig#group()} processing in {@link DynawoModelsSupplier} * @author Laurent Issertial {@literal } */ public enum SetGroupType { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializer.java similarity index 97% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializer.java index efc2f481e..213531fef 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializer.java @@ -1,4 +1,4 @@ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/curves/CurvesJsonDeserializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/curves/CurvesJsonDeserializer.java similarity index 96% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/curves/CurvesJsonDeserializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/curves/CurvesJsonDeserializer.java index a1b3d63e8..5f131b9d1 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/curves/CurvesJsonDeserializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/curves/CurvesJsonDeserializer.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.curves; +package com.powsybl.dynawo.suppliers.curves; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.powsybl.commons.json.JsonUtil; import com.powsybl.dynamicsimulation.Curve; -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder; +import com.powsybl.dynawo.curves.DynawoCurvesBuilder; import java.util.ArrayList; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfig.java similarity index 87% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfig.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfig.java index b053b6756..65d3cf331 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfig.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfig.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.dynamicmodels; +package com.powsybl.dynawo.suppliers.dynamicmodels; -import com.powsybl.dynawaltz.suppliers.Property; -import com.powsybl.dynawaltz.suppliers.SetGroupType; +import com.powsybl.dynawo.suppliers.Property; +import com.powsybl.dynawo.suppliers.SetGroupType; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java similarity index 91% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java index b9b4ba5c4..38db0bd71 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynamicModelConfigsJsonDeserializer.java @@ -5,15 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.dynamicmodels; +package com.powsybl.dynawo.suppliers.dynamicmodels; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.powsybl.commons.json.JsonUtil; -import com.powsybl.dynawaltz.suppliers.Property; -import com.powsybl.dynawaltz.suppliers.PropertyParserUtils; -import com.powsybl.dynawaltz.suppliers.SetGroupType; +import com.powsybl.dynawo.suppliers.Property; +import com.powsybl.dynawo.suppliers.PropertyParserUtils; +import com.powsybl.dynawo.suppliers.SetGroupType; import java.util.ArrayList; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynawoModelsSupplier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynawoModelsSupplier.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynawoModelsSupplier.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynawoModelsSupplier.java index ceee9be81..0807d300f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/dynamicmodels/DynawoModelsSupplier.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/dynamicmodels/DynawoModelsSupplier.java @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.dynamicmodels; +package com.powsybl.dynawo.suppliers.dynamicmodels; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.builders.ModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.suppliers.Property; -import com.powsybl.dynawaltz.suppliers.SupplierJsonDeserializer; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.builders.ModelBuilder; +import com.powsybl.dynawo.builders.ModelConfigsHandler; +import com.powsybl.dynawo.suppliers.Property; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; import com.powsybl.iidm.network.Network; import java.io.InputStream; @@ -48,7 +48,7 @@ public DynawoModelsSupplier(List dynamicModelConfigs) { @Override public String getName() { - return DynaWaltzProvider.NAME; + return DynawoSimulationProvider.NAME; } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/DynawoEventModelsSupplier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/DynawoEventModelsSupplier.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/DynawoEventModelsSupplier.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/DynawoEventModelsSupplier.java index 62d66555c..3be15590f 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/DynawoEventModelsSupplier.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/DynawoEventModelsSupplier.java @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.events; +package com.powsybl.dynawo.suppliers.events; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.EventModel; import com.powsybl.dynamicsimulation.EventModelsSupplier; -import com.powsybl.dynawaltz.DynaWaltzProvider; -import com.powsybl.dynawaltz.builders.ModelBuilder; -import com.powsybl.dynawaltz.builders.ModelConfigsHandler; -import com.powsybl.dynawaltz.suppliers.Property; -import com.powsybl.dynawaltz.suppliers.SupplierJsonDeserializer; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.builders.ModelBuilder; +import com.powsybl.dynawo.builders.ModelConfigsHandler; +import com.powsybl.dynawo.suppliers.Property; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; import com.powsybl.iidm.network.Network; import java.io.InputStream; @@ -46,7 +46,7 @@ public DynawoEventModelsSupplier(List eventModelConfigs) { @Override public String getName() { - return DynaWaltzProvider.NAME; + return DynawoSimulationProvider.NAME; } @Override diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfig.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfig.java similarity index 88% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfig.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfig.java index 79dbf701b..536c88b39 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfig.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfig.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.events; +package com.powsybl.dynawo.suppliers.events; -import com.powsybl.dynawaltz.suppliers.Property; +import com.powsybl.dynawo.suppliers.Property; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfigsJsonDeserializer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfigsJsonDeserializer.java similarity index 93% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfigsJsonDeserializer.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfigsJsonDeserializer.java index 781c17f1e..e564dbe96 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/suppliers/events/EventModelConfigsJsonDeserializer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/suppliers/events/EventModelConfigsJsonDeserializer.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers.events; +package com.powsybl.dynawo.suppliers.events; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.powsybl.commons.json.JsonUtil; -import com.powsybl.dynawaltz.suppliers.Property; -import com.powsybl.dynawaltz.suppliers.PropertyParserUtils; +import com.powsybl.dynawo.suppliers.Property; +import com.powsybl.dynawo.suppliers.PropertyParserUtils; import java.util.ArrayList; import java.util.List; diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/AbstractXmlDynawaltzWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java similarity index 73% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/AbstractXmlDynawaltzWriter.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java index 281ce2ff4..e3c2478cd 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/AbstractXmlDynawaltzWriter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.exceptions.UncheckedXmlStreamException; -import com.powsybl.dynawaltz.DynaWaltzContext; +import com.powsybl.dynawo.DynawoSimulationContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -19,24 +19,24 @@ import java.nio.file.Path; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_PREFIX; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Florian Dupuy {@literal } */ -public abstract class AbstractXmlDynawaltzWriter implements XmlDynawaltzWriter { +public abstract class AbstractXmlDynawoSimulationWriter implements XmlDynawoSimulationWriter { private final String xmlFileName; private final String xmlRootName; - protected AbstractXmlDynawaltzWriter(String xmlFileName, String xmlRootName) { + protected AbstractXmlDynawoSimulationWriter(String xmlFileName, String xmlRootName) { this.xmlFileName = Objects.requireNonNull(xmlFileName); this.xmlRootName = Objects.requireNonNull(xmlRootName); } @Override - public void createXmlFileFromContext(Path workingDir, DynaWaltzContext context) throws IOException { + public void createXmlFileFromContext(Path workingDir, DynawoSimulationContext context) throws IOException { Objects.requireNonNull(workingDir); Objects.requireNonNull(context); Path file = workingDir.resolve(xmlFileName); @@ -61,5 +61,5 @@ public void createXmlFileFromContext(Path workingDir, DynaWaltzContext context) } } - abstract void write(XMLStreamWriter writer, DynaWaltzContext dynaWaltzContext) throws XMLStreamException; + abstract void write(XMLStreamWriter writer, DynawoSimulationContext dynawoSimulationContext) throws XMLStreamException; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/CurvesXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java similarity index 62% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/CurvesXml.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java index 29d22f363..bb45bee41 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/CurvesXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java @@ -4,34 +4,34 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.curves.DynawoCurve; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.curves.DynawoCurve; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.nio.file.Path; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.CRV_FILENAME; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.CRV_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Marcos de Miguel {@literal } */ -public final class CurvesXml extends AbstractXmlDynawaltzWriter { +public final class CurvesXml extends AbstractXmlDynawoSimulationWriter { private CurvesXml() { super(CRV_FILENAME, "curvesInput"); } - public static void write(Path workingDir, DynaWaltzContext context) throws IOException { + public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { new CurvesXml().createXmlFileFromContext(workingDir, context); } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { for (DynawoCurve dynCurve : context.getCurves()) { writer.writeEmptyElement(DYN_URI, "curve"); writer.writeAttribute("model", dynCurve.getModelId()); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DydXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java similarity index 70% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DydXml.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java index 6774e22e6..79ede7cd3 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DydXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java @@ -5,35 +5,35 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnect; -import com.powsybl.dynawaltz.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.nio.file.Path; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.DYD_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.DYD_FILENAME; /** * @author Mathieu Bague {@literal } */ -public final class DydXml extends AbstractXmlDynawaltzWriter { +public final class DydXml extends AbstractXmlDynawoSimulationWriter { private DydXml() { super(DYD_FILENAME, "dynamicModelsArchitecture"); } - public static void write(Path workingDir, DynaWaltzContext context) throws IOException { + public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { new DydXml().createXmlFileFromContext(workingDir, context); } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { // loop over the values of the map indexed by dynamicIds to write only once objects with the same dynamicId for (BlackBoxModel model : context.getBlackBoxDynamicModels()) { model.write(writer, context); diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java similarity index 67% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzConstants.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java index 497a5fa79..e9f5c1e38 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java @@ -4,20 +4,20 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; /** * @author Marcos de Miguel {@literal } */ -public final class DynaWaltzConstants { +public final class DynawoSimulationConstants { - public static final String JOBS_FILENAME = "powsybl_dynawaltz.jobs"; + public static final String JOBS_FILENAME = "powsybl_dynawo.jobs"; - public static final String NETWORK_FILENAME = "powsybl_dynawaltz.xiidm"; + public static final String NETWORK_FILENAME = "powsybl_dynawo.xiidm"; - public static final String DYD_FILENAME = "powsybl_dynawaltz.dyd"; + public static final String DYD_FILENAME = "powsybl_dynawo.dyd"; - public static final String CRV_FILENAME = "powsybl_dynawaltz.crv"; + public static final String CRV_FILENAME = "powsybl_dynawo.crv"; public static final String CURVES_OUTPUT_PATH = "outputs/curves"; @@ -27,6 +27,6 @@ public final class DynaWaltzConstants { public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; - private DynaWaltzConstants() { + private DynawoSimulationConstants() { } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzXmlConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationXmlConstants.java similarity index 85% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzXmlConstants.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationXmlConstants.java index 70988dded..c29e95f8d 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/DynaWaltzXmlConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationXmlConstants.java @@ -4,12 +4,12 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; /** * @author Marcos de Miguel {@literal } */ -public final class DynaWaltzXmlConstants { +public final class DynawoSimulationXmlConstants { public static final String DYN_BASE_URI = "http://www.rte-france.com/dynawo"; @@ -24,6 +24,6 @@ public final class DynaWaltzXmlConstants { public static final String MACRO_STATIC_REFERENCE_PREFIX = "MSR_"; public static final String MACRO_CONNECTOR_PREFIX = "MC_"; - private DynaWaltzXmlConstants() { + private DynawoSimulationXmlConstants() { } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/JobsXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java similarity index 69% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/JobsXml.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java index a0a09c6cf..148a62908 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/JobsXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java @@ -4,36 +4,36 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.DumpFileParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.DynaWaltzParameters.SolverType; +import com.powsybl.dynawo.DumpFileParameters; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationParameters.SolverType; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.nio.file.Path; -import static com.powsybl.dynawaltz.xml.DynaWaltzConstants.*; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Marcos de Miguel {@literal } */ -public final class JobsXml extends AbstractXmlDynawaltzWriter { +public final class JobsXml extends AbstractXmlDynawoSimulationWriter { private JobsXml() { super(JOBS_FILENAME, "jobs"); } - public static void write(Path workingDir, DynaWaltzContext context) throws IOException { + public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { new JobsXml().createXmlFileFromContext(workingDir, context); } @Override - public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { writer.writeStartElement(DYN_URI, "job"); writer.writeAttribute("name", "Job"); writeSolver(writer, context); @@ -43,22 +43,22 @@ public void write(XMLStreamWriter writer, DynaWaltzContext context) throws XMLSt writer.writeEndElement(); } - private static void writeSolver(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { - DynaWaltzParameters parameters = context.getDynaWaltzParameters(); + private static void writeSolver(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeEmptyElement(DYN_URI, "solver"); writer.writeAttribute("lib", parameters.getSolverType().equals(SolverType.IDA) ? "dynawo_SolverIDA" : "dynawo_SolverSIM"); - writer.writeAttribute("parFile", DynaWaltzParameters.SOLVER_OUTPUT_PARAMETERS_FILE); + writer.writeAttribute("parFile", DynawoSimulationParameters.SOLVER_OUTPUT_PARAMETERS_FILE); writer.writeAttribute("parId", parameters.getSolverParameters().getId()); } - private static void writeModeler(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { - DynaWaltzParameters parameters = context.getDynaWaltzParameters(); + private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeStartElement(DYN_URI, "modeler"); writer.writeAttribute("compileDir", "outputs/compilation"); writer.writeEmptyElement(DYN_URI, "network"); writer.writeAttribute("iidmFile", NETWORK_FILENAME); - writer.writeAttribute("parFile", DynaWaltzParameters.NETWORK_OUTPUT_PARAMETERS_FILE); + writer.writeAttribute("parFile", DynawoSimulationParameters.NETWORK_OUTPUT_PARAMETERS_FILE); writer.writeAttribute("parId", parameters.getNetworkParameters().getId()); writer.writeEmptyElement(DYN_URI, "dynModels"); @@ -79,15 +79,15 @@ private static void writeModeler(XMLStreamWriter writer, DynaWaltzContext contex writer.writeEndElement(); } - private static void writeSimulation(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { + private static void writeSimulation(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "simulation"); writer.writeAttribute("startTime", Double.toString(context.getParameters().getStartTime())); writer.writeAttribute("stopTime", Double.toString(context.getParameters().getStopTime())); - writer.writeAttribute("precision", Double.toString(context.getDynaWaltzParameters().getPrecision())); + writer.writeAttribute("precision", Double.toString(context.getDynawoSimulationParameters().getPrecision())); } - private static void writeOutput(XMLStreamWriter writer, DynaWaltzContext context) throws XMLStreamException { - DynaWaltzParameters parameters = context.getDynaWaltzParameters(); + private static void writeOutput(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeStartElement(DYN_URI, "outputs"); writer.writeAttribute("directory", "outputs"); @@ -104,8 +104,8 @@ private static void writeOutput(XMLStreamWriter writer, DynaWaltzContext context if (context.withCurves()) { writer.writeEmptyElement(DYN_URI, "curves"); - writer.writeAttribute("inputFile", DynaWaltzConstants.CRV_FILENAME); - writer.writeAttribute("exportMode", DynaWaltzParameters.ExportMode.CSV.toString()); + writer.writeAttribute("inputFile", DynawoSimulationConstants.CRV_FILENAME); + writer.writeAttribute("exportMode", DynawoSimulationParameters.ExportMode.CSV.toString()); } writer.writeStartElement(DYN_URI, "logs"); @@ -115,20 +115,20 @@ private static void writeOutput(XMLStreamWriter writer, DynaWaltzContext context writer.writeEndElement(); } - private static void writeAppender(XMLStreamWriter writer, DynaWaltzParameters parameters) throws XMLStreamException { + private static void writeAppender(XMLStreamWriter writer, DynawoSimulationParameters parameters) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "appender"); writer.writeAttribute("tag", ""); writer.writeAttribute("file", "dynawaltz.log"); writer.writeAttribute("lvlFilter", parameters.getLogLevelFilter().toString()); - for (DynaWaltzParameters.SpecificLog log : parameters.getSpecificLogs()) { + for (DynawoSimulationParameters.SpecificLog log : parameters.getSpecificLogs()) { writeSpecificAppender(writer, log); } } - private static void writeSpecificAppender(XMLStreamWriter writer, DynaWaltzParameters.SpecificLog log) throws XMLStreamException { + private static void writeSpecificAppender(XMLStreamWriter writer, DynawoSimulationParameters.SpecificLog log) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "appender"); writer.writeAttribute("tag", log.toString()); writer.writeAttribute("file", log.getFileName()); - writer.writeAttribute("lvlFilter", DynaWaltzParameters.LogLevel.DEBUG.toString()); + writer.writeAttribute("lvlFilter", DynawoSimulationParameters.LogLevel.DEBUG.toString()); } } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/MacroStaticReference.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/MacroStaticReference.java similarity index 89% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/MacroStaticReference.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/MacroStaticReference.java index 96639ef01..c6ad14e6c 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/MacroStaticReference.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/MacroStaticReference.java @@ -4,17 +4,17 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.VarMapping; +import com.powsybl.dynawo.models.VarMapping; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.List; import java.util.Objects; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.MACRO_STATIC_REFERENCE_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.MACRO_STATIC_REFERENCE_PREFIX; /** * @author Marcos de Miguel {@literal } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/ParametersXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/ParametersXml.java similarity index 90% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/ParametersXml.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/ParametersXml.java index 77b1265e4..e6ca3d449 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/ParametersXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/ParametersXml.java @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.xml.XmlUtil; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.parameters.Parameter; -import com.powsybl.dynawaltz.parameters.ParameterType; -import com.powsybl.dynawaltz.parameters.ParametersSet; -import com.powsybl.dynawaltz.parameters.Reference; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.parameters.Parameter; +import com.powsybl.dynawo.parameters.ParameterType; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.parameters.Reference; import javax.xml.XMLConstants; import javax.xml.stream.*; @@ -29,8 +29,8 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_PREFIX; -import static com.powsybl.dynawaltz.xml.DynaWaltzXmlConstants.DYN_URI; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** * @author Marcos de Miguel {@literal } @@ -178,14 +178,14 @@ private static void closeAndThrowException(XMLStreamReader xmlReader, String une throw new PowsyblException("Unexpected element: " + unexpectedElement); } - public static void write(Path workingDir, DynaWaltzContext context) { + public static void write(Path workingDir, DynawoSimulationContext context) { Objects.requireNonNull(workingDir); write(context.getDynamicModelsParameters(), context.getSimulationParFile(), workingDir, DYN_PREFIX); - DynaWaltzParameters parameters = context.getDynaWaltzParameters(); - write(parameters.getModelParameters(), DynaWaltzParameters.MODELS_OUTPUT_PARAMETERS_FILE, workingDir, ""); - write(List.of(parameters.getNetworkParameters()), DynaWaltzParameters.NETWORK_OUTPUT_PARAMETERS_FILE, workingDir, ""); - write(List.of(parameters.getSolverParameters()), DynaWaltzParameters.SOLVER_OUTPUT_PARAMETERS_FILE, workingDir, ""); + DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); + write(parameters.getModelParameters(), DynawoSimulationParameters.MODELS_OUTPUT_PARAMETERS_FILE, workingDir, ""); + write(List.of(parameters.getNetworkParameters()), DynawoSimulationParameters.NETWORK_OUTPUT_PARAMETERS_FILE, workingDir, ""); + write(List.of(parameters.getSolverParameters()), DynawoSimulationParameters.SOLVER_OUTPUT_PARAMETERS_FILE, workingDir, ""); } public static void write(Collection parametersSets, String filename, Path workingDir, String dynPrefix) { diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlDynawaltzWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java similarity index 66% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlDynawaltzWriter.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java index 4668e8f06..34d10b845 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlDynawaltzWriter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.DynaWaltzContext; +import com.powsybl.dynawo.DynawoSimulationContext; import java.io.IOException; import java.nio.file.Path; @@ -16,6 +16,6 @@ * @author Florian Dupuy {@literal } */ @FunctionalInterface -public interface XmlDynawaltzWriter { - void createXmlFileFromContext(Path workingDir, DynaWaltzContext context) throws IOException; +public interface XmlDynawoSimulationWriter { + void createXmlFileFromContext(Path workingDir, DynawoSimulationContext context) throws IOException; } diff --git a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlStreamWriterFactory.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlStreamWriterFactory.java similarity index 92% rename from dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlStreamWriterFactory.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlStreamWriterFactory.java index c8acdeb96..b6e400616 100644 --- a/dynawaltz/src/main/java/com/powsybl/dynawaltz/xml/XmlStreamWriterFactory.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlStreamWriterFactory.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import javanet.staxutils.IndentingXMLStreamWriter; @@ -31,7 +31,7 @@ public static XMLStreamWriter newInstance(Writer writer, boolean indent) throws XMLStreamWriter xmlStreamWriter = factory.createXMLStreamWriter(writer); if (indent) { IndentingXMLStreamWriter indentingWriter = new IndentingXMLStreamWriter(xmlStreamWriter); - indentingWriter.setIndent(DynaWaltzXmlConstants.INDENT); + indentingWriter.setIndent(DynawoSimulationXmlConstants.INDENT); xmlStreamWriter = indentingWriter; } return xmlStreamWriter; diff --git a/dynawaltz/src/main/resources/models.json b/dynawo-simulation/src/main/resources/models.json similarity index 100% rename from dynawaltz/src/main/resources/models.json rename to dynawo-simulation/src/main/resources/models.json diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/AbstractLocalCommandExecutor.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/AbstractLocalCommandExecutor.java similarity index 97% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/AbstractLocalCommandExecutor.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/AbstractLocalCommandExecutor.java index 3112d62aa..3b31b8e09 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/AbstractLocalCommandExecutor.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/AbstractLocalCommandExecutor.java @@ -4,7 +4,7 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.computation.local.LocalCommandExecutor; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzConfigTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoConfigTest.java similarity index 90% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzConfigTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoConfigTest.java index 235c2d43f..b0352fddc 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzConfigTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoConfigTest.java @@ -4,7 +4,7 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; @@ -22,7 +22,7 @@ /** * @author Marcos de Miguel {@literal } */ -class DynaWaltzConfigTest { +class DynawoConfigTest { private InMemoryPlatformConfig platformConfig; private FileSystem fileSystem; @@ -43,10 +43,10 @@ void checkConfig() { String homeDir = "homeDir"; boolean debug = true; - MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawaltz"); + MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawo"); moduleConfig.setStringProperty("homeDir", homeDir); moduleConfig.setStringProperty("debug", Boolean.toString(debug)); - DynaWaltzConfig config = DynaWaltzConfig.load(platformConfig); + DynawoSimulationConfig config = DynawoSimulationConfig.load(platformConfig); assertEquals(homeDir, config.getHomeDir().toString()); assertEquals(debug, config.isDebug()); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersDatabaseTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersDatabaseTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersDatabaseTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersDatabaseTest.java index 58ac7497f..7ec668eb2 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersDatabaseTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersDatabaseTest.java @@ -4,14 +4,14 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.parameters.ParameterType; -import com.powsybl.dynawaltz.parameters.ParametersSet; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.parameters.ParameterType; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.ParametersXml; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -28,7 +28,7 @@ /** * @author Marcos de Miguel {@literal } */ -class DynaWaltzParametersDatabaseTest { +class DynawoParametersDatabaseTest { private FileSystem fileSystem; @@ -47,7 +47,7 @@ void tearDown() throws IOException { @Test void checkParameters() { List setsMap = ParametersXml.load(fileSystem.getPath("/models.par")); - DynaWaltzParameters dParameters = new DynaWaltzParameters().setModelsParameters(setsMap); + DynawoSimulationParameters dParameters = new DynawoSimulationParameters().setModelsParameters(setsMap); ParametersSet set1 = dParameters.getModelParameters("LoadAlphaBeta"); assertEquals(1.5, set1.getDouble("load_alpha"), 1e-6); @@ -80,7 +80,7 @@ void checkParametersNotFound() { @Test void addParametersSet() { - DynaWaltzParameters dParameters = new DynaWaltzParameters(); + DynawoSimulationParameters dParameters = new DynawoSimulationParameters(); ParametersSet set = new ParametersSet("test"); dParameters.addModelParameters(set); assertEquals(1, dParameters.getModelParameters().size()); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java similarity index 73% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java index df03b710f..df5a77430 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzParametersTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java @@ -4,7 +4,7 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.config.InMemoryPlatformConfig; @@ -12,13 +12,13 @@ import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynamicsimulation.json.JsonDynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzParameters.ExportMode; -import com.powsybl.dynawaltz.DynaWaltzParameters.LogLevel; -import com.powsybl.dynawaltz.DynaWaltzParameters.SolverType; -import com.powsybl.dynawaltz.DynaWaltzParameters.SpecificLog; -import com.powsybl.dynawaltz.parameters.Parameter; -import com.powsybl.dynawaltz.parameters.ParameterType; -import com.powsybl.dynawaltz.xml.ParametersXml; +import com.powsybl.dynawo.DynawoSimulationParameters.ExportMode; +import com.powsybl.dynawo.DynawoSimulationParameters.LogLevel; +import com.powsybl.dynawo.DynawoSimulationParameters.SolverType; +import com.powsybl.dynawo.DynawoSimulationParameters.SpecificLog; +import com.powsybl.dynawo.parameters.Parameter; +import com.powsybl.dynawo.parameters.ParameterType; +import com.powsybl.dynawo.xml.ParametersXml; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,7 +33,7 @@ /** * @author Marcos de Miguel {@literal } */ -class DynaWaltzParametersTest extends AbstractSerDeTest { +class DynawoParametersTest extends AbstractSerDeTest { public static final String USER_HOME = "/home/user/"; @@ -66,7 +66,7 @@ void checkParameters() throws IOException { Set specificLogs = EnumSet.of(SpecificLog.MODELER, SpecificLog.EQUATIONS); initPlatformConfig(networkParametersId, solverType, solverParametersId, mergeLoads, useModelSimplifiers, precision, timelinExportMode, logLevel, specificLogs); - DynaWaltzParameters parameters = DynaWaltzParameters.load(platformConfig, fileSystem); + DynawoSimulationParameters parameters = DynawoSimulationParameters.load(platformConfig, fileSystem); checkModelParameters(parameters); @@ -106,7 +106,7 @@ void checkDumpFileParameters() throws IOException { String folderProperty = USER_HOME + "dumpFiles"; String fileProperty = "dumpFile.dmp"; initDumpFilePlatformConfig(folderProperty, fileProperty); - DynaWaltzParameters parameters = DynaWaltzParameters.load(platformConfig, fileSystem); + DynawoSimulationParameters parameters = DynawoSimulationParameters.load(platformConfig, fileSystem); DumpFileParameters dumpFileParameters = parameters.getDumpFileParameters(); assertTrue(dumpFileParameters.exportDumpFile()); @@ -126,10 +126,10 @@ void roundTripParametersSerializing() throws IOException { DynamicSimulationParameters dynamicSimulationParameters = new DynamicSimulationParameters() .setStartTime(0) .setStopTime(3600); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(platformConfig); - dynamicSimulationParameters.addExtension(DynaWaltzParameters.class, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(platformConfig); + dynamicSimulationParameters.addExtension(DynawoSimulationParameters.class, dynawoParameters); roundTripTest(dynamicSimulationParameters, JsonDynamicSimulationParameters::write, - JsonDynamicSimulationParameters::read, "/DynaWaltzParameters.json"); + JsonDynamicSimulationParameters::read, "/DynawoSimulationParameters.json"); } private void initPlatformConfig(String networkParametersId, SolverType solverType, String solverParametersId, @@ -139,7 +139,7 @@ private void initPlatformConfig(String networkParametersId, SolverType solverTyp String networkParametersFile = USER_HOME + "networkParametersFile"; String solverParametersFile = USER_HOME + "solverParametersFile"; - MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawaltz-default-parameters"); + MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawo-simulation-default-parameters"); moduleConfig.setStringProperty("parametersFile", parametersFile); moduleConfig.setStringProperty("network.parametersFile", networkParametersFile); moduleConfig.setStringProperty("solver.parametersFile", solverParametersFile); @@ -161,17 +161,17 @@ private void initPlatformConfig(String networkParametersId, SolverType solverTyp private void initDumpFilePlatformConfig(String folderProperty, String fileProperty) throws IOException { Files.createDirectories(fileSystem.getPath(USER_HOME)); - copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE); - copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); - copyFile("/parametersSet/solvers.par", DynaWaltzParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); + copyFile("/parametersSet/models.par", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + copyFile("/parametersSet/network.par", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + copyFile("/parametersSet/solvers.par", DynawoSimulationParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); String folderName = USER_HOME + "dumpFiles"; Files.createDirectories(fileSystem.getPath(folderName)); String fileName = "dumpFile.dmp"; Files.createFile(fileSystem.getPath(folderName, fileName)); - MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawaltz-default-parameters"); - moduleConfig.setStringProperty("parametersFile", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE); - moduleConfig.setStringProperty("network.parametersFile", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + MapModuleConfig moduleConfig = platformConfig.createModuleConfig("dynawo-simulation-default-parameters"); + moduleConfig.setStringProperty("parametersFile", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + moduleConfig.setStringProperty("network.parametersFile", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); moduleConfig.setStringProperty("dump.export", Boolean.toString(true)); moduleConfig.setStringProperty("dump.useAsInput", Boolean.toString(true)); moduleConfig.setStringProperty("dump.exportFolder", folderProperty); @@ -182,34 +182,34 @@ private void initDumpFilePlatformConfig(String folderProperty, String fileProper @Test void checkDefaultParameters() throws IOException { Files.createDirectories(fileSystem.getPath(USER_HOME)); - copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE); - copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); - copyFile("/parametersSet/solvers.par", DynaWaltzParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); + copyFile("/parametersSet/models.par", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + copyFile("/parametersSet/network.par", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + copyFile("/parametersSet/solvers.par", DynawoSimulationParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); - DynaWaltzParameters parameters = DynaWaltzParameters.load(platformConfig, fileSystem); + DynawoSimulationParameters parameters = DynawoSimulationParameters.load(platformConfig, fileSystem); checkModelParameters(parameters); - assertEquals(DynaWaltzParameters.DEFAULT_NETWORK_PAR_ID, parameters.getNetworkParameters().getId()); + assertEquals(DynawoSimulationParameters.DEFAULT_NETWORK_PAR_ID, parameters.getNetworkParameters().getId()); assertTrue(parameters.getNetworkParameters().getParameters().isEmpty()); assertTrue(parameters.getNetworkParameters().getReferences().isEmpty()); - assertEquals(DynaWaltzParameters.DEFAULT_SOLVER_TYPE, parameters.getSolverType()); - assertEquals(DynaWaltzParameters.DEFAULT_SOLVER_PAR_ID, parameters.getSolverParameters().getId()); + assertEquals(DynawoSimulationParameters.DEFAULT_SOLVER_TYPE, parameters.getSolverType()); + assertEquals(DynawoSimulationParameters.DEFAULT_SOLVER_PAR_ID, parameters.getSolverParameters().getId()); assertEquals("1", parameters.getSolverParameters().getId()); - assertEquals(DynaWaltzParameters.DEFAULT_MERGE_LOADS, parameters.isMergeLoads()); - assertEquals(DynaWaltzParameters.DEFAULT_USE_MODEL_SIMPLIFIERS, parameters.isUseModelSimplifiers()); - assertEquals(DynaWaltzParameters.DEFAULT_TIMELINE_EXPORT_MODE, parameters.getTimelineExportMode()); + assertEquals(DynawoSimulationParameters.DEFAULT_MERGE_LOADS, parameters.isMergeLoads()); + assertEquals(DynawoSimulationParameters.DEFAULT_USE_MODEL_SIMPLIFIERS, parameters.isUseModelSimplifiers()); + assertEquals(DynawoSimulationParameters.DEFAULT_TIMELINE_EXPORT_MODE, parameters.getTimelineExportMode()); } @Test void checkDefaultDumpParameters() throws IOException { Files.createDirectories(fileSystem.getPath(USER_HOME)); - copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE); - copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); - copyFile("/parametersSet/solvers.par", DynaWaltzParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); + copyFile("/parametersSet/models.par", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + copyFile("/parametersSet/network.par", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + copyFile("/parametersSet/solvers.par", DynawoSimulationParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); - DynaWaltzParameters parameters = DynaWaltzParameters.load(platformConfig, fileSystem); + DynawoSimulationParameters parameters = DynawoSimulationParameters.load(platformConfig, fileSystem); DumpFileParameters dumpFileParameters = parameters.getDumpFileParameters(); assertEquals(DumpFileParameters.DEFAULT_EXPORT_DUMP, dumpFileParameters.exportDumpFile()); assertEquals(DumpFileParameters.DEFAULT_USE_DUMP, dumpFileParameters.useDumpFile()); @@ -220,11 +220,11 @@ void checkDefaultDumpParameters() throws IOException { @Test void checkException() throws IOException { Files.createDirectories(fileSystem.getPath(USER_HOME)); - copyFile("/parametersSet/models.par", DynaWaltzParameters.DEFAULT_INPUT_PARAMETERS_FILE); - copyFile("/parametersSet/network.par", DynaWaltzParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); - copyFile("/parametersSet/solversMissingDefault.par", DynaWaltzParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); + copyFile("/parametersSet/models.par", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + copyFile("/parametersSet/network.par", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + copyFile("/parametersSet/solversMissingDefault.par", DynawoSimulationParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); - PowsyblException e1 = assertThrows(PowsyblException.class, () -> DynaWaltzParameters.load(platformConfig, fileSystem)); + PowsyblException e1 = assertThrows(PowsyblException.class, () -> DynawoSimulationParameters.load(platformConfig, fileSystem)); assertEquals("Could not find parameters set with id='1' in file '/work/inmemory/solvers.par'", e1.getMessage()); try (InputStream is = getClass().getResourceAsStream("/parametersSet/solvers.par")) { @@ -238,7 +238,7 @@ void dumpFilesFolderNotFound() throws IOException { String folderProperty = USER_HOME + "wrongFolder"; String fileProperty = "dumpFile.dmp"; initDumpFilePlatformConfig(folderProperty, fileProperty); - PowsyblException e = assertThrows(PowsyblException.class, () -> DynaWaltzParameters.load(platformConfig, fileSystem)); + PowsyblException e = assertThrows(PowsyblException.class, () -> DynawoSimulationParameters.load(platformConfig, fileSystem)); assertEquals("Folder /home/user/wrongFolder set in 'dumpFileFolder' property cannot be found", e.getMessage()); } @@ -247,16 +247,16 @@ void dumpFileNotFound() throws IOException { String folderProperty = USER_HOME + "dumpFiles"; String fileProperty = "wrongFile.dmp"; initDumpFilePlatformConfig(folderProperty, fileProperty); - PowsyblException e = assertThrows(PowsyblException.class, () -> DynaWaltzParameters.load(platformConfig, fileSystem)); + PowsyblException e = assertThrows(PowsyblException.class, () -> DynawoSimulationParameters.load(platformConfig, fileSystem)); assertEquals("File wrongFile.dmp set in 'dumpFile' property cannot be found", e.getMessage()); } - private static void checkModelParameters(DynaWaltzParameters dynaWaltzParameters) { - Parameter booleanParameter = dynaWaltzParameters.getModelParameters("test").getParameters().get("boolean"); + private static void checkModelParameters(DynawoSimulationParameters dynawoSimulationParameters) { + Parameter booleanParameter = dynawoSimulationParameters.getModelParameters("test").getParameters().get("boolean"); assertEquals("true", booleanParameter.value()); assertEquals("boolean", booleanParameter.name()); assertEquals(ParameterType.BOOL, booleanParameter.type()); - Parameter stringParameter = dynaWaltzParameters.getModelParameters("test").getParameters().get("string"); + Parameter stringParameter = dynawoSimulationParameters.getModelParameters("test").getParameters().get("string"); assertEquals("aString", stringParameter.value()); assertEquals("string", stringParameter.name()); assertEquals(ParameterType.STRING, stringParameter.type()); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzProviderTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoProviderTest.java similarity index 85% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzProviderTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoProviderTest.java index 31ecd3ccc..e9e57124d 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/DynaWaltzProviderTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoProviderTest.java @@ -4,7 +4,7 @@ * 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.dynawaltz; +package com.powsybl.dynawo; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; @@ -14,7 +14,7 @@ import com.powsybl.computation.local.LocalComputationConfig; import com.powsybl.computation.local.LocalComputationManager; import com.powsybl.dynamicsimulation.*; -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder; +import com.powsybl.dynawo.curves.DynawoCurvesBuilder; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.Substation; @@ -41,16 +41,16 @@ * @author Florian Dupuy {@literal } * @author Marcos de Miguel {@literal } */ -class DynaWaltzProviderTest extends AbstractSerDeTest { +class DynawoProviderTest extends AbstractSerDeTest { private static final String OUTPUT_IIDM_FILENAME = "outputIIDM.xml"; - private DynaWaltzConfig config; + private DynawoSimulationConfig config; @BeforeEach @Override public void setUp() throws IOException { super.setUp(); - config = DynaWaltzConfig.load(); + config = DynawoSimulationConfig.load(); } public static class CurvesSupplierMock implements CurvesSupplier { @@ -89,7 +89,7 @@ void testWithMergeLoads() throws Exception { LocalCommandExecutor commandExecutor = new LocalCommandExecutorMock("/dynawo_version.out", "/mergedLoads.xiidm"); ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicSimulationResult result = dynawoSimulation.run(network, (n, r) -> Collections.emptyList(), EventModelsSupplier.empty(), CurvesSupplier.empty(), network.getVariantManager().getWorkingVariantId(), computationManager, DynamicSimulationParameters.load(), NO_OP); @@ -103,11 +103,11 @@ void testWithoutMergeLoads() throws Exception { ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); DynamicSimulationParameters dynamicSimulationParameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynaWaltzParameters = DynaWaltzParameters.load(); - dynaWaltzParameters.setMergeLoads(false); - dynamicSimulationParameters.addExtension(DynaWaltzParameters.class, dynaWaltzParameters); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + dynawoSimulationParameters.setMergeLoads(false); + dynamicSimulationParameters.addExtension(DynawoSimulationParameters.class, dynawoSimulationParameters); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicSimulationResult result = dynawoSimulation.run(network, (n, r) -> Collections.emptyList(), EventModelsSupplier.empty(), CurvesSupplier.empty(), network.getVariantManager().getWorkingVariantId(), computationManager, dynamicSimulationParameters, NO_OP); @@ -126,12 +126,12 @@ void testWithDump() throws Exception { ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); DynamicSimulationParameters dynamicSimulationParameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynaWaltzParameters = DynaWaltzParameters.load() + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load() .setMergeLoads(false) .setDumpFileParameters(DumpFileParameters.createImportExportDumpFileParameters(folderPath, fileProperty)); - dynamicSimulationParameters.addExtension(DynaWaltzParameters.class, dynaWaltzParameters); + dynamicSimulationParameters.addExtension(DynawoSimulationParameters.class, dynawoSimulationParameters); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicSimulationResult result = dynawoSimulation.run(network, (n, r) -> Collections.emptyList(), EventModelsSupplier.empty(), CurvesSupplier.empty(), network.getVariantManager().getWorkingVariantId(), computationManager, dynamicSimulationParameters, NO_OP); @@ -144,7 +144,7 @@ void testFail() throws Exception { LocalCommandExecutor commandExecutor = new LocalCommandExecutorMock("/dynawo_version.out", null); ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicSimulationResult result = dynawoSimulation.run(network, (n, r) -> Collections.emptyList(), EventModelsSupplier.empty(), CurvesSupplier.empty(), network.getVariantManager().getWorkingVariantId(), computationManager, DynamicSimulationParameters.load(), NO_OP); @@ -158,7 +158,7 @@ void testWithoutCurves() throws Exception { LocalCommandExecutor commandExecutor = new LocalCommandExecutorMock("/dynawo_version.out", "/test.xiidm"); ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicSimulationResult result = dynawoSimulation.run(network, (n, r) -> Collections.emptyList(), EventModelsSupplier.empty(), new CurvesSupplierMock(), network.getVariantManager().getWorkingVariantId(), computationManager, DynamicSimulationParameters.load(), NO_OP); @@ -168,21 +168,21 @@ void testWithoutCurves() throws Exception { @Test void checkVersionCommand() { - String versionCommand = DynaWaltzProvider.getVersionCommand(config).toString(0); + String versionCommand = DynawoSimulationProvider.getVersionCommand(config).toString(0); if (SystemUtils.IS_OS_WINDOWS) { - assertEquals("[/home/dynawaltz/dynawo.cmd, version]", versionCommand); + assertEquals("[/home/dynawo/dynawo.cmd, version]", versionCommand); } else { - assertEquals("[/home/dynawaltz/dynawo.sh, version]", versionCommand); + assertEquals("[/home/dynawo/dynawo.sh, version]", versionCommand); } } @Test void checkExecutionCommand() { - String versionCommand = DynaWaltzProvider.getCommand(config).toString(0); + String versionCommand = DynawoSimulationProvider.getCommand(config).toString(0); if (SystemUtils.IS_OS_WINDOWS) { - assertEquals("[[/home/dynawaltz/dynawo.cmd, jobs, powsybl_dynawaltz.jobs]]", versionCommand); + assertEquals("[[/home/dynawo/dynawo.cmd, jobs, powsybl_dynawo.jobs]]", versionCommand); } else { - assertEquals("[[/home/dynawaltz/dynawo.sh, jobs, powsybl_dynawaltz.jobs]]", versionCommand); + assertEquals("[[/home/dynawo/dynawo.sh, jobs, powsybl_dynawo.jobs]]", versionCommand); } } @@ -192,7 +192,7 @@ void testCallingBadVersionDynawo() throws Exception { LocalCommandExecutor commandExecutor = new LocalCommandExecutorMock("/dynawo_bad_version.out", null); ComputationManager computationManager = new LocalComputationManager(new LocalComputationConfig(tmpDir, 1), commandExecutor, ForkJoinPool.commonPool()); DynamicSimulation.Runner dynawoSimulation = DynamicSimulation.find(); - assertEquals(DynaWaltzProvider.NAME, dynawoSimulation.getName()); + assertEquals(DynawoSimulationProvider.NAME, dynawoSimulation.getName()); DynamicModelsSupplier dms = (n, r) -> Collections.emptyList(); EventModelsSupplier ems = EventModelsSupplier.empty(); CurvesSupplier cs = CurvesSupplier.empty(); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/ModelsSimplifierTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/ModelsSimplifierTest.java similarity index 82% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/ModelsSimplifierTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/ModelsSimplifierTest.java index ec4cab7aa..85dd1509e 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/ModelsSimplifierTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/ModelsSimplifierTest.java @@ -5,17 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz; +package com.powsybl.dynawo; import com.google.auto.service.AutoService; import com.google.common.collect.Lists; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.models.generators.AbstractGenerator; -import com.powsybl.dynawaltz.models.generators.GeneratorFictitiousBuilder; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.generators.AbstractGenerator; +import com.powsybl.dynawo.models.generators.GeneratorFictitiousBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; @@ -49,7 +49,7 @@ void loadSubstitutionSimplifiers() { void simplifyModels() { Network network = EurostagTutorialExample1Factory.create(); DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load().setUseModelSimplifiers(true); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load().setUseModelSimplifiers(true); List dynamicModels = List.of( GeneratorFictitiousBuilder.of(network) .dynamicModelId("BBM_GEN") @@ -66,7 +66,7 @@ void simplifyModels() { .staticId("NGEN_NHV1") .parameterSetId("TR") .build()); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, Collections.emptyList(), Collections.emptyList(), parameters, dynawoParameters); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, Collections.emptyList(), Collections.emptyList(), parameters, dynawoParameters); assertEquals(2, context.getBlackBoxDynamicModels().size()); assertFalse(context.getBlackBoxDynamicModelStream().anyMatch(bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD"))); assertTrue(context.getBlackBoxDynamicModelStream().anyMatch(bbm -> bbm.getDynamicModelId().equalsIgnoreCase("newModel"))); @@ -83,7 +83,7 @@ public Predicate getModelRemovalPredicate(ReportNode reportNode) @AutoService(ModelsSubstitutionSimplifier.class) public static class ModelsSimplifierSubstitution implements ModelsSubstitutionSimplifier { @Override - public Function getModelSubstitutionFunction(Network network, DynaWaltzParameters dynaWaltzParameters, ReportNode reportNode) { + public Function getModelSubstitutionFunction(Network network, DynawoSimulationParameters dynawoSimulationParameters, ReportNode reportNode) { return m -> { if ("BBM_GEN".equalsIgnoreCase(m.getDynamicModelId()) && m instanceof AbstractGenerator gen) { return GeneratorFictitiousBuilder.of(network) diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java similarity index 98% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java index f123f4d71..047bc9442 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/BuilderConfigTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/CurvesBuilderTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/CurvesBuilderTest.java similarity index 96% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/CurvesBuilderTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/CurvesBuilderTest.java index 189862a8e..0d4eddf57 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/CurvesBuilderTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/CurvesBuilderTest.java @@ -1,10 +1,10 @@ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.test.TestUtil; import com.powsybl.dynamicsimulation.Curve; -import com.powsybl.dynawaltz.curves.DynawoCurve; -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder; +import com.powsybl.dynawo.curves.DynawoCurve; +import com.powsybl.dynawo.curves.DynawoCurvesBuilder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/DefaultLibBuilderTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/DefaultLibBuilderTest.java similarity index 76% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/DefaultLibBuilderTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/DefaultLibBuilderTest.java index 1bab6e406..3f5bdc6c4 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/DefaultLibBuilderTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/DefaultLibBuilderTest.java @@ -5,26 +5,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; -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.PhaseShifterBlockingIAutomationSystemBuilder; -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.*; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; -import com.powsybl.dynawaltz.models.lines.LineBuilder; -import com.powsybl.dynawaltz.models.loads.*; -import com.powsybl.dynawaltz.models.shunts.BaseShuntBuilder; -import com.powsybl.dynawaltz.models.svarcs.BaseStaticVarCompensatorBuilder; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.UnderVoltageAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystemBuilder; +import com.powsybl.dynawo.models.buses.InfiniteBusBuilder; +import com.powsybl.dynawo.models.buses.StandardBusBuilder; +import com.powsybl.dynawo.models.generators.*; +import com.powsybl.dynawo.models.loads.*; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.lines.LineBuilder; +import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; +import com.powsybl.dynawo.models.svarcs.BaseStaticVarCompensatorBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.SvcTestCaseFactory; import org.junit.jupiter.api.Test; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/ModelConfigLoaderTest.java similarity index 99% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/ModelConfigLoaderTest.java index c8f12d254..3280f74c6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/builders/ModelConfigLoaderTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/ModelConfigLoaderTest.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.builders; +package com.powsybl.dynawo.builders; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/ActionConnectionPointTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/ActionConnectionPointTest.java similarity index 92% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/ActionConnectionPointTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/ActionConnectionPointTest.java index 724616312..27d83f72c 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/ActionConnectionPointTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/ActionConnectionPointTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.builders.BuildersUtil; +import com.powsybl.dynawo.builders.BuildersUtil; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import com.powsybl.iidm.network.test.HvdcTestNetwork; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/BuilderEquipmentSetterTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/BuilderEquipmentSetterTest.java similarity index 95% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/BuilderEquipmentSetterTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/BuilderEquipmentSetterTest.java index 95e61ee9f..3307f753e 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/BuilderEquipmentSetterTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/BuilderEquipmentSetterTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.test.TestUtil; -import com.powsybl.dynawaltz.models.lines.LineBuilder; +import com.powsybl.dynawo.models.lines.LineBuilder; import com.powsybl.iidm.network.Line; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.PhaseShifterTestCaseFactory; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/HvdcTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/HvdcTest.java similarity index 90% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/HvdcTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/HvdcTest.java index ce94b9aa9..8c402c93a 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/HvdcTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/HvdcTest.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcP; -import com.powsybl.dynawaltz.models.hvdc.HvdcVsc; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcP; +import com.powsybl.dynawo.models.hvdc.HvdcVsc; import com.powsybl.iidm.network.HvdcLine; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/LoadTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/LoadTest.java similarity index 92% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/LoadTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/LoadTest.java index 0db1eab23..e159df914 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/LoadTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/LoadTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models; +package com.powsybl.dynawo.models; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.NoEquipmentNetworkFactory; import org.junit.jupiter.api.Test; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/buses/StandardBusTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/buses/StandardBusTest.java similarity index 82% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/buses/StandardBusTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/buses/StandardBusTest.java index 80fe00051..7f3f1ac11 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/buses/StandardBusTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/buses/StandardBusTest.java @@ -6,14 +6,14 @@ * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.buses; +package com.powsybl.dynawo.models.buses; import com.powsybl.commons.PowsyblException; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.NetworkFactory; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; @@ -42,11 +42,11 @@ void connectionToModelWithoutDynamicModelException() { .parameterSetId("SB") .build()); DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); String workingVariantId = network.getVariantManager().getWorkingVariantId(); List events = Collections.emptyList(); List curves = Collections.emptyList(); - PowsyblException e = assertThrows(PowsyblException.class, () -> new DynaWaltzContext(network, workingVariantId, dynamicModels, events, curves, parameters, dynawoParameters)); + PowsyblException e = assertThrows(PowsyblException.class, () -> new DynawoSimulationContext(network, workingVariantId, dynamicModels, events, curves, parameters, dynawoParameters)); assertEquals("The equipment NHV1_NHV2_1 linked to the StandardBus NHV1 does not possess a dynamic model", e.getMessage()); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelHandlerTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelHandlerTest.java similarity index 90% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelHandlerTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelHandlerTest.java index be049b2ab..8829ff332 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/defaultmodels/DefaultModelHandlerTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/defaultmodels/DefaultModelHandlerTest.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.defaultmodels; +package com.powsybl.dynawo.models.defaultmodels; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.Model; -import com.powsybl.dynawaltz.models.buses.EquipmentConnectionPoint; -import com.powsybl.dynawaltz.models.generators.GeneratorModel; -import com.powsybl.dynawaltz.models.shunts.ShuntModel; +import com.powsybl.dynawo.models.Model; +import com.powsybl.dynawo.models.buses.EquipmentConnectionPoint; +import com.powsybl.dynawo.models.generators.GeneratorModel; +import com.powsybl.dynawo.models.shunts.ShuntModel; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.Generator; import com.powsybl.iidm.network.Network; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/lines/StandardLineTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/lines/StandardLineTest.java similarity index 83% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/models/lines/StandardLineTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/models/lines/StandardLineTest.java index 22c7f19da..81e9b2c64 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/models/lines/StandardLineTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/models/lines/StandardLineTest.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.models.lines; +package com.powsybl.dynawo.models.lines; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; import com.powsybl.iidm.network.*; import org.junit.jupiter.api.Test; @@ -49,12 +49,12 @@ void connectionToDynamicOverloadManagementSystemException() { .iMeasurementSide(TwoSides.ONE) .build()); DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); String workingVariantId = network.getVariantManager().getWorkingVariantId(); List events = Collections.emptyList(); List curves = Collections.emptyList(); UnsupportedOperationException e = assertThrows(UnsupportedOperationException.class, - () -> new DynaWaltzContext(network, workingVariantId, dynamicModels, events, curves, parameters, dynawoParameters)); + () -> new DynawoSimulationContext(network, workingVariantId, dynamicModels, events, curves, parameters, dynawoParameters)); assertEquals("i variable not implemented in StandardLine dynawo's model", e.getMessage()); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoCurvesJsonDeserializerTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoCurvesJsonDeserializerTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoCurvesJsonDeserializerTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoCurvesJsonDeserializerTest.java index 83f3cdd58..e9523a8db 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoCurvesJsonDeserializerTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoCurvesJsonDeserializerTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.powsybl.dynamicsimulation.Curve; -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder; -import com.powsybl.dynawaltz.suppliers.curves.CurvesJsonDeserializer; +import com.powsybl.dynawo.curves.DynawoCurvesBuilder; +import com.powsybl.dynawo.suppliers.curves.CurvesJsonDeserializer; import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoEventModelsSupplierTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoEventModelsSupplierTest.java similarity index 93% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoEventModelsSupplierTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoEventModelsSupplierTest.java index e5b914866..9c64ce9d6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoEventModelsSupplierTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoEventModelsSupplierTest.java @@ -5,14 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynawaltz.models.events.EventActivePowerVariationBuilder; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.suppliers.events.*; +import com.powsybl.dynawo.models.events.EventActivePowerVariationBuilder; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.suppliers.events.DynawoEventModelsSupplier; +import com.powsybl.dynawo.suppliers.events.EventModelConfig; +import com.powsybl.dynawo.suppliers.events.EventModelConfigsJsonDeserializer; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoModelsSupplierTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoModelsSupplierTest.java similarity index 94% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoModelsSupplierTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoModelsSupplierTest.java index adfe1d171..587dea080 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/DynawoModelsSupplierTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/DynawoModelsSupplierTest.java @@ -5,15 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicModel; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder; -import com.powsybl.dynawaltz.suppliers.dynamicmodels.DynamicModelConfig; -import com.powsybl.dynawaltz.suppliers.dynamicmodels.*; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfig; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynamicModelConfigsJsonDeserializer; +import com.powsybl.dynawo.suppliers.dynamicmodels.DynawoModelsSupplier; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializerTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializerTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializerTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializerTest.java index e64dbd19c..3d3c15098 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/suppliers/SupplierJsonDeserializerTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/suppliers/SupplierJsonDeserializerTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.suppliers; +package com.powsybl.dynawo.suppliers; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.suppliers.events.EventModelConfig; -import com.powsybl.dynawaltz.suppliers.events.EventModelConfigsJsonDeserializer; +import com.powsybl.dynawo.suppliers.events.EventModelConfig; +import com.powsybl.dynawo.suppliers.events.EventModelConfigsJsonDeserializer; import org.junit.jupiter.api.Test; import java.io.IOException; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java similarity index 85% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractDynamicModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java index edeefd6eb..4f86ea48d 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java @@ -5,16 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.commons.test.TestUtil; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -47,14 +47,14 @@ public abstract class AbstractDynamicModelXmlTest extends AbstractSerDeTest { protected List dynamicModels = new ArrayList<>(); protected List eventModels = new ArrayList<>(); protected List curves = new ArrayList<>(); - protected DynaWaltzContext context; + protected DynawoSimulationContext context; protected ReportNode reportNode = ReportNode.newRootReportNode().withMessageTemplate("testDyd", "Test DYD").build(); @BeforeEach void setup() { setupNetwork(); addDynamicModels(); - setupDynawaltzContext(); + setupDynawoContext(); } @AfterEach @@ -76,10 +76,10 @@ public void validate(String schemaDefinition, String expectedResourceName, Path assertTxtEquals(expected, actual); } - void setupDynawaltzContext() { + void setupDynawoContext() { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters, reportNode); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters, reportNode); } protected abstract void setupNetwork(); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractParametrizedDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java similarity index 81% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractParametrizedDynamicModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java index 4c4016698..132f04472 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/AbstractParametrizedDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java @@ -5,14 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import org.xml.sax.SAXException; @@ -41,7 +41,7 @@ abstract class AbstractParametrizedDynamicModelXmlTest extends AbstractSerDeTest protected List dynamicModels = new ArrayList<>(); protected List eventModels = new ArrayList<>(); protected List curves = new ArrayList<>(); - protected DynaWaltzContext context; + protected DynawoSimulationContext context; public void validate(String schemaDefinition, String expectedResourceName, Path xmlFile) throws SAXException, IOException { InputStream expected = Objects.requireNonNull(getClass().getResourceAsStream("/" + expectedResourceName)); @@ -55,9 +55,9 @@ public void validate(String schemaDefinition, String expectedResourceName, Path assertTxtEquals(expected, actual); } - void setupDynawaltzContext() { + void setupDynawoContext() { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ActivePowerVariationEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ActivePowerVariationEventXmlTest.java similarity index 87% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ActivePowerVariationEventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ActivePowerVariationEventXmlTest.java index a428134dc..7c962babf 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ActivePowerVariationEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ActivePowerVariationEventXmlTest.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.events.EventActivePowerVariationBuilder; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronousGeneratorBuilder; +import com.powsybl.dynawo.models.events.EventActivePowerVariationBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder; +import com.powsybl.dynawo.models.generators.SynchronousGeneratorBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -75,7 +75,7 @@ protected void addDynamicModels() { void writeDisconnectModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "apv_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "apv_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "apv_par.xml", tmpDir.resolve(context.getSimulationParFile())); validate("parameters.xsd", "apv_network_par.xml", tmpDir.resolve("network.par")); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CurvesXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CurvesXmlTest.java similarity index 59% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CurvesXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CurvesXmlTest.java index eecc62f9e..71a55854a 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CurvesXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CurvesXmlTest.java @@ -4,11 +4,11 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -17,16 +17,16 @@ /** * @author Marcos de Miguel {@literal } */ -class CurvesXmlTest extends DynaWaltzTestUtil { +class CurvesXmlTest extends DynawoTestUtil { @Test void writeCurve() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); CurvesXml.write(tmpDir, context); - validate("curvesInput.xsd", "curvesInput.xml", tmpDir.resolve(DynaWaltzConstants.CRV_FILENAME)); + validate("curvesInput.xsd", "curvesInput.xml", tmpDir.resolve(DynawoSimulationConstants.CRV_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CustomParameterResolver.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CustomParameterResolver.java similarity index 99% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CustomParameterResolver.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CustomParameterResolver.java index 9e5e9202b..684ec1cea 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/CustomParameterResolver.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/CustomParameterResolver.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectBranchEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectBranchEventXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectBranchEventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectBranchEventXmlTest.java index f2a60880a..d20a59408 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectBranchEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectBranchEventXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; @@ -42,7 +42,7 @@ protected void addDynamicModels() { void writeDisconnectModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "disconnect_branch_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "disconnect_branch_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "disconnect_branch_par.xml", tmpDir.resolve(context.getSimulationParFile())); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectEventXmlTest.java similarity index 90% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectEventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectEventXmlTest.java index a5a5dd348..b50bd6614 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectEventXmlTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.generators.GeneratorFictitiousBuilder; -import com.powsybl.dynawaltz.models.shunts.BaseShuntBuilder; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.generators.GeneratorFictitiousBuilder; +import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.iidm.network.test.SvcTestCaseFactory; @@ -74,7 +74,7 @@ protected void addDynamicModels() { void writeDisconnectModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "disconnect_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "disconnect_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "disconnect_par.xml", tmpDir.resolve(context.getSimulationParFile())); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectHvdcEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java similarity index 93% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectHvdcEventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java index 0f105ca9b..4e626c279 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectHvdcEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.HvdcTestNetwork; @@ -39,7 +39,7 @@ class DisconnectHvdcEventXmlTest extends AbstractParametrizedDynamicModelXmlTest void setup(String dydName, Function< Network, BlackBoxModel> hvdcConstructor, Function< Network, BlackBoxModel> disconnectConstructor) { setupNetwork(); addDynamicModels(hvdcConstructor, disconnectConstructor); - setupDynawaltzContext(); + setupDynawoContext(); } protected void setupNetwork() { @@ -58,7 +58,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> hvdcConstructo void writeModel(String dydName, Function< Network, BlackBoxModel> hvdcConstructor, Function< Network, BlackBoxModel> disconnectConstructor) throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", dydName, tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "disconnect_hvdc_par.xml", tmpDir.resolve(context.getSimulationParFile())); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectionExceptionXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectionExceptionXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectionExceptionXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectionExceptionXmlTest.java index 86f32da23..a61baa03a 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DisconnectionExceptionXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectionExceptionXmlTest.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.HvdcTestNetwork; @@ -55,7 +55,7 @@ protected void addDynamicModels(TwoSides side, BiFunction constructor) { - Exception e = assertThrows(PowsyblException.class, this::setupDynawaltzContext); + Exception e = assertThrows(PowsyblException.class, this::setupDynawoContext); assertEquals(exception, e.getMessage()); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicModelsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicModelsXmlTest.java similarity index 66% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicModelsXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicModelsXmlTest.java index ddce3dfb5..d6e38cb33 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicModelsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicModelsXmlTest.java @@ -4,16 +4,16 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.PowsyblException; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.generators.GeneratorFictitiousBuilder; -import com.powsybl.dynawaltz.models.lines.LineModel; -import com.powsybl.dynawaltz.models.loads.BaseLoad; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.generators.GeneratorFictitiousBuilder; +import com.powsybl.dynawo.models.lines.LineModel; +import com.powsybl.dynawo.models.loads.BaseLoad; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; import com.powsybl.iidm.network.Identifiable; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -29,22 +29,22 @@ * @author Marcos de Miguel {@literal } * @author Laurent Issertial {@literal } */ -class DynamicModelsXmlTest extends DynaWaltzTestUtil { +class DynamicModelsXmlTest extends DynawoTestUtil { @Test void writeDynamicModel() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, new ArrayList<>(), curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, new ArrayList<>(), curves, parameters, dynawoParameters); DydXml.write(tmpDir, context); - validate("dyd.xsd", "dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } @Test void writeDynamicModelWithLoadsAndOnlyOneFictitiousGenerator() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); dynamicModels.clear(); dynamicModels.add(GeneratorFictitiousBuilder.of(network) .dynamicModelId("BBM_GEN6") @@ -52,10 +52,10 @@ void writeDynamicModelWithLoadsAndOnlyOneFictitiousGenerator() throws SAXExcepti .parameterSetId("GF") .build()); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, new ArrayList<>(), curves, parameters, dynawoParameters); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, new ArrayList<>(), curves, parameters, dynawoParameters); DydXml.write(tmpDir, context); - validate("dyd.xsd", "dyd_fictitious.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "dyd_fictitious.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } @Test @@ -74,7 +74,7 @@ void duplicateStaticId() { dynamicModels.add(load1); dynamicModels.add(load2); String workingVariantId = network.getVariantManager().getWorkingVariantId(); - DynaWaltzContext context = new DynaWaltzContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynaWaltzParameters.load()); + DynawoSimulationContext context = new DynawoSimulationContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynawoSimulationParameters.load()); Assertions.assertThat(context.getBlackBoxDynamicModels()).containsExactly(load1); } @@ -94,13 +94,13 @@ void duplicateDynamicId() { dynamicModels.add(load1); dynamicModels.add(load2); String workingVariantId = network.getVariantManager().getWorkingVariantId(); - DynaWaltzContext context = new DynaWaltzContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynaWaltzParameters.load()); + DynawoSimulationContext context = new DynawoSimulationContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynawoSimulationParameters.load()); Assertions.assertThat(context.getBlackBoxDynamicModels()).containsExactly(load1); } @Test void testIncorrectModelException() { - DynaWaltzContext dc = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynaWaltzParameters.load()); + DynawoSimulationContext dc = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynawoSimulationParameters.load()); Identifiable gen = network.getIdentifiable("GEN5"); Exception e = assertThrows(PowsyblException.class, () -> dc.getDynamicModel(gen, LineModel.class, true)); assertEquals("The model identified by the static id GEN5 does not match the expected model (LineModel)", e.getMessage()); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicOverloadManagementSystemModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java similarity index 88% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicOverloadManagementSystemModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java index b4628ab59..0f834b5a9 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicOverloadManagementSystemModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; -import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; @@ -60,6 +60,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "cla_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "cla_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java index dc1e4a792..93fb61ad1 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicTwoLevelsOverloadManagementSystemBuilder; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; @@ -42,6 +42,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "cla_tl_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "cla_tl_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynaWaltzTestUtil.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynawoTestUtil.java similarity index 92% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynaWaltzTestUtil.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynawoTestUtil.java index 47fe34d6c..399d56244 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/DynaWaltzTestUtil.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynawoTestUtil.java @@ -4,21 +4,21 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.dynamicsimulation.Curve; -import com.powsybl.dynawaltz.curves.DynawoCurvesBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.generators.GeneratorFictitiousBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronousGeneratorBuilder; -import com.powsybl.dynawaltz.models.lines.LineBuilder; -import com.powsybl.dynawaltz.models.lines.StandardLine; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; -import com.powsybl.dynawaltz.models.loads.LoadOneTransformerBuilder; +import com.powsybl.dynawo.curves.DynawoCurvesBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.automationsystems.overloadmanagments.DynamicOverloadManagementSystemBuilder; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.generators.GeneratorFictitiousBuilder; +import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder; +import com.powsybl.dynawo.models.generators.SynchronousGeneratorBuilder; +import com.powsybl.dynawo.models.lines.LineBuilder; +import com.powsybl.dynawo.models.lines.StandardLine; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerBuilder; import com.powsybl.iidm.network.*; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.BeforeEach; @@ -42,7 +42,7 @@ /** * @author Marcos de Miguel {@literal } */ -public class DynaWaltzTestUtil extends AbstractSerDeTest { +public class DynawoTestUtil extends AbstractSerDeTest { protected Network network; protected List dynamicModels; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyPhaseShifterBlockingIXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyPhaseShifterBlockingIXmlTest.java similarity index 85% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyPhaseShifterBlockingIXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyPhaseShifterBlockingIXmlTest.java index 8b66568b6..3d8bb13a5 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyPhaseShifterBlockingIXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyPhaseShifterBlockingIXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -48,14 +48,14 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "empty_phase_shifter_blocking_i_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "empty_phase_shifter_blocking_i_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); checkReport(""" + Test DYD Model BBM_PS instantiation successful Model BBM_PSB instantiation successful 'phaseShifterId' field is not set Model BBM_PSB2 cannot be instantiated - + Dynawaltz models processing + + Dynawo models processing PhaseShifterBlockingI BBM_PSB equipment WRONG_ID is not a PhaseShifterIModel, the automation system will be skipped """); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java similarity index 86% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java index b95c16968..72c4e2ab8 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -44,10 +44,10 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "tap_changer_empty_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tap_changer_empty_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); checkReport(""" + Test DYD - + Dynawaltz models processing + + Dynawo models processing TapChangerAutomaton BBM_TC equipment LOAD is not a LoadWithTransformers, the automation system will be skipped """); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java similarity index 86% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java index 9848ed88e..28b342f6e 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.loads.LoadOneTransformerBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -58,10 +58,10 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "tap_changer_blocking_empty_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tap_changer_blocking_empty_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); checkReport(""" + Test DYD - + Dynawaltz models processing + + Dynawo models processing TapChangerAutomaton BBM_TC equipment LOAD2 is not a LoadWithTransformers, the automation system will be skipped None of TapChangerBlockingAutomaton BBM_TapChangerBlocking equipments are TapChangerModel, the automation system will be skipped """); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EventXmlTest.java similarity index 72% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EventXmlTest.java index 1ae1e24c6..d70fbd112 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/EventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EventXmlTest.java @@ -4,14 +4,14 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronousGeneratorBuilder; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.generators.SynchronousGeneratorBuilder; import com.powsybl.iidm.network.TwoSides; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; @@ -22,7 +22,7 @@ /** * @author Marcos de Miguel {@literal } */ -class EventXmlTest extends DynaWaltzTestUtil { +class EventXmlTest extends DynawoTestUtil { @Test void writeDynamicModel() throws SAXException, IOException { @@ -33,12 +33,12 @@ void writeDynamicModel() throws SAXException, IOException { .parameterSetId("GSFWPR") .build()); DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); DydXml.write(tmpDir, context); - validate("dyd.xsd", "events.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "events.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } @Test @@ -66,7 +66,7 @@ void duplicateEventId() { eventModels.add(event1Duplicate); eventModels.add(event2Duplicate); String workingVariantId = network.getVariantManager().getWorkingVariantId(); - DynaWaltzContext context = new DynaWaltzContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynaWaltzParameters.load()); + DynawoSimulationContext context = new DynawoSimulationContext(network, workingVariantId, dynamicModels, eventModels, curves, DynamicSimulationParameters.load(), DynawoSimulationParameters.load()); Assertions.assertThat(context.getBlackBoxEventModels()).containsExactly(event1, event2); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/HvdcXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/HvdcXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java index 68466b3c6..307cf1e72 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/HvdcXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.hvdc.HvdcPBuilder; -import com.powsybl.dynawaltz.models.hvdc.HvdcVscBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; +import com.powsybl.dynawo.models.hvdc.HvdcPBuilder; +import com.powsybl.dynawo.models.hvdc.HvdcVscBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import com.powsybl.iidm.network.test.HvdcTestNetwork; @@ -38,7 +38,7 @@ class HvdcXmlTest extends AbstractParametrizedDynamicModelXmlTest { void setup(String dydName, Function< Network, BlackBoxModel> constructor) { setupNetwork(); addDynamicModels(constructor); - setupDynawaltzContext(); + setupDynawoContext(); } protected void setupNetwork() { @@ -53,7 +53,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> constructor) { @MethodSource("provideHvdc") void writeHvdcModel(String dydName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", dydName, tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } private static Stream provideHvdc() { diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java similarity index 51% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/JobsXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index 034326916..607c0d5f6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -4,12 +4,12 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DumpFileParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DumpFileParameters; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -20,38 +20,38 @@ /** * @author Marcos de Miguel {@literal } */ -class JobsXmlTest extends DynaWaltzTestUtil { +class JobsXmlTest extends DynawoTestUtil { @Test void writeJob() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); JobsXml.write(tmpDir, context); - validate("jobs.xsd", "jobs.xml", tmpDir.resolve(DynaWaltzConstants.JOBS_FILENAME)); + validate("jobs.xsd", "jobs.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); } @Test void writeJobWithDumpFile() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load() + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load() .setDumpFileParameters(DumpFileParameters.createImportExportDumpFileParameters(Path.of("/dumpFiles"), "dump.dmp")); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); JobsXml.write(tmpDir, context); - validate("jobs.xsd", "jobsWithDump.xml", tmpDir.resolve(DynaWaltzConstants.JOBS_FILENAME)); + validate("jobs.xsd", "jobsWithDump.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); } @Test void writeJobWithSpecificLogs() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load() - .setSpecificLogs(EnumSet.allOf(DynaWaltzParameters.SpecificLog.class)); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load() + .setSpecificLogs(EnumSet.allOf(DynawoSimulationParameters.SpecificLog.class)); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); JobsXml.write(tmpDir, context); - validate("jobs.xsd", "jobsWithSpecificLogs.xml", tmpDir.resolve(DynaWaltzConstants.JOBS_FILENAME)); + validate("jobs.xsd", "jobsWithSpecificLogs.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/LoadsModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java similarity index 95% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/LoadsModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java index 42c451e8a..e937159c7 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/LoadsModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.loads.*; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.loads.*; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.BeforeEach; @@ -36,7 +36,7 @@ class LoadsModelXmlTest extends AbstractParametrizedDynamicModelXmlTest { void setup(String dydName, Function< Network, BlackBoxModel> loadConstructor) { setupNetwork(); addDynamicModels(loadConstructor); - setupDynawaltzContext(); + setupDynawoContext(); } protected void setupNetwork() { @@ -51,7 +51,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> loadConstructo @MethodSource("provideLoads") void writeLoadModel(String dydName, Function< Network, BlackBoxModel> loadConstructor) throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } private static Stream provideLoads() { diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/MappedParameterContext.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MappedParameterContext.java similarity index 97% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/MappedParameterContext.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MappedParameterContext.java index d3327c44a..a0b76f5fd 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/MappedParameterContext.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MappedParameterContext.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.platform.commons.util.AnnotationUtils; diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/NodeFaultEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/NodeFaultEventXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java index 764b27773..97ee0af99 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/NodeFaultEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.events.NodeFaultEventBuilder; +import com.powsybl.dynawo.models.events.NodeFaultEventBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -40,7 +40,7 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "node_fault_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "node_fault_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "node_fault_par.xml", tmpDir.resolve(context.getSimulationParFile())); validate("parameters.xsd", "node_network_par.xml", tmpDir.resolve("network.par")); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/OmegaRefModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/OmegaRefModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java index 4fd4f0d34..0ae237a8d 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/OmegaRefModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronousGeneratorBuilder; +import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder; +import com.powsybl.dynawo.models.generators.SynchronousGeneratorBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -49,7 +49,7 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "omega_ref_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "omega_ref_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "omega_ref_par.xml", tmpDir.resolve(context.getSimulationParFile())); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ParametersXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ParametersXmlTest.java similarity index 63% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ParametersXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ParametersXmlTest.java index e71d57ba9..2eccf1ea8 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ParametersXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ParametersXmlTest.java @@ -4,12 +4,12 @@ * 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.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.config.PlatformConfig; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawaltz.DynaWaltzContext; -import com.powsybl.dynawaltz.DynaWaltzParameters; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -18,13 +18,13 @@ /** * @author Marcos de Miguel {@literal } */ -class ParametersXmlTest extends DynaWaltzTestUtil { +class ParametersXmlTest extends DynawoTestUtil { @Test void writeOmegaRef() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); - DynaWaltzParameters dynawoParameters = DynaWaltzParameters.load(PlatformConfig.defaultConfig(), fileSystem); - DynaWaltzContext context = new DynaWaltzContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(PlatformConfig.defaultConfig(), fileSystem); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShifterBlockingIXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShifterBlockingIXmlTest.java similarity index 83% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShifterBlockingIXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShifterBlockingIXmlTest.java index e7ce94a6a..91aef6f4b 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShifterBlockingIXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShifterBlockingIXmlTest.java @@ -5,10 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterBlockingIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -43,6 +43,6 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "phase_shifter_blocking_i_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "phase_shifter_blocking_i_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShiftersXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java similarity index 87% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShiftersXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java index 30e8b79d8..198559384 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/PhaseShiftersXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java @@ -5,12 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystemBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterIAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.phaseshifters.PhaseShifterPAutomationSystemBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.BeforeEach; @@ -38,7 +38,7 @@ class PhaseShiftersXmlTest extends AbstractParametrizedDynamicModelXmlTest { void setup(String dydName, Function phaseShifterConstructor, boolean dynamicTransformer) { setupNetwork(); addDynamicModels(phaseShifterConstructor, dynamicTransformer); - setupDynawaltzContext(); + setupDynawoContext(); } protected void setupNetwork() { @@ -60,7 +60,7 @@ protected void addDynamicModels(Function phaseShifterCon @MethodSource("providePhaseShifter") void writeLoadModel(String dydName, Function phaseShifterConstructor, boolean dynamicTransformer) throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } private static Stream providePhaseShifter() { diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SetPointInfiniteBusModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java similarity index 86% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SetPointInfiniteBusModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java index 60262feaa..f3df762a1 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SetPointInfiniteBusModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.buses.InfiniteBusBuilder; -import com.powsybl.dynawaltz.models.generators.SynchronizedGeneratorBuilder; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.buses.InfiniteBusBuilder; +import com.powsybl.dynawo.models.generators.SynchronizedGeneratorBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -50,7 +50,7 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "set_point_inf_bus_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "set_point_inf_bus_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); validate("parameters.xsd", "set_point_inf_bus_par.xml", tmpDir.resolve(context.getSimulationParFile())); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ShuntModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java similarity index 90% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ShuntModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java index 72d52e489..2da682d18 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/ShuntModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.shunts.BaseShuntBuilder; +import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; import com.powsybl.iidm.network.test.ShuntTestCaseFactory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -37,6 +37,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "shunt_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "shunt_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelWithSbaXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelWithSbaXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java index 67290b8c7..234865a8b 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelWithSbaXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.svarcs.BaseStaticVarCompensatorBuilder; +import com.powsybl.dynawo.models.svarcs.BaseStaticVarCompensatorBuilder; import com.powsybl.iidm.network.extensions.StandbyAutomatonAdder; import com.powsybl.iidm.network.test.SvcTestCaseFactory; import org.junit.jupiter.api.Test; @@ -46,6 +46,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "svarc_sba_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "svarc_sba_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java index 081c93113..fff96c436 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/SvarcModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.svarcs.BaseStaticVarCompensatorBuilder; +import com.powsybl.dynawo.models.svarcs.BaseStaticVarCompensatorBuilder; import com.powsybl.iidm.network.test.SvcTestCaseFactory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -37,6 +37,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "svarc_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "svarc_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemExceptionsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemExceptionsXmlTest.java similarity index 88% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemExceptionsXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemExceptionsXmlTest.java index e8d03f691..c35b3a4d6 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemExceptionsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemExceptionsXmlTest.java @@ -5,13 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.loads.*; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerTapChangerBuilder; +import com.powsybl.dynawo.models.loads.LoadTwoTransformersBuilder; +import com.powsybl.dynawo.models.loads.LoadTwoTransformersTapChangersBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.BeforeEach; @@ -58,7 +61,7 @@ protected void addDynamicModels(TransformerSide side, Function< Network, BlackBo @ParameterizedTest @MethodSource("provideTapChangers") void testExceptions(TransformerSide side, Function< Network, BlackBoxModel> loadConstructor, String exceptionMessage) { - Exception e = assertThrows(PowsyblException.class, this::setupDynawaltzContext); + Exception e = assertThrows(PowsyblException.class, this::setupDynawoContext); assertEquals(exceptionMessage, e.getMessage()); } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java similarity index 89% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java index 16456732a..4e3599733 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java @@ -5,11 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.TransformerSide; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerAutomationSystemBuilder; -import com.powsybl.dynawaltz.models.loads.*; +import com.powsybl.dynawo.models.TransformerSide; +import com.powsybl.dynawo.models.automationsystems.TapChangerAutomationSystemBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerBuilder; +import com.powsybl.dynawo.models.loads.LoadTwoTransformersBuilder; import com.powsybl.iidm.network.Bus; import com.powsybl.iidm.network.VoltageLevel; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; @@ -73,6 +74,6 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "tap_changer_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tap_changer_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java similarity index 88% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java index 9b313b9c9..4017d9a7f 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; import com.powsybl.commons.PowsyblException; -import com.powsybl.dynawaltz.models.loads.LoadOneTransformerTapChangerBuilder; -import com.powsybl.dynawaltz.models.loads.LoadTwoTransformersTapChangersBuilder; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.loads.LoadOneTransformerTapChangerBuilder; +import com.powsybl.dynawo.models.loads.LoadTwoTransformersTapChangersBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -68,7 +68,7 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "tap_changer_blocking_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tap_changer_blocking_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } @Test diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java similarity index 87% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java index 0c3efbe3e..c43ddcb03 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.TapChangerBlockingAutomationSystemBuilder; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -34,6 +34,6 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "tap_changer_blocking_tap_changer_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tap_changer_blocking_tap_changer_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TransformerModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java similarity index 85% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TransformerModelXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java index 7585b5591..2a6d19524 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/TransformerModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.transformers.TransformerFixedRatioBuilder; +import com.powsybl.dynawo.models.transformers.TransformerFixedRatioBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -37,6 +37,6 @@ protected void addDynamicModels() { @Test void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); - validate("dyd.xsd", "tfr_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "tfr_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/UnderVoltageAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java similarity index 88% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/UnderVoltageAutomationSystemXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java index 66a23717c..0bd32fcc8 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/UnderVoltageAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java @@ -5,9 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.automationsystems.UnderVoltageAutomationSystemBuilder; +import com.powsybl.dynawo.models.automationsystems.UnderVoltageAutomationSystemBuilder; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -38,6 +38,6 @@ protected void addDynamicModels() { void writeModel() throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "under_voltage_dyd.xml", tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", "under_voltage_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } } diff --git a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/WeccGenXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java similarity index 91% rename from dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/WeccGenXmlTest.java rename to dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java index 8a0f65632..39ec9468a 100644 --- a/dynawaltz/src/test/java/com/powsybl/dynawaltz/xml/WeccGenXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java @@ -5,11 +5,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawaltz.xml; +package com.powsybl.dynawo.xml; -import com.powsybl.dynawaltz.models.generators.GridFormingConverterBuilder; -import com.powsybl.dynawaltz.models.BlackBoxModel; -import com.powsybl.dynawaltz.models.generators.WeccBuilder; +import com.powsybl.dynawo.models.generators.GridFormingConverterBuilder; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.generators.WeccBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.BeforeEach; @@ -37,7 +37,7 @@ class WeccGenXmlTest extends AbstractParametrizedDynamicModelXmlTest { void setup(String dydName, String parName, Function< Network, BlackBoxModel> loadConstructor) { setupNetwork(); addDynamicModels(loadConstructor); - setupDynawaltzContext(); + setupDynawoContext(); } protected void setupNetwork() { @@ -53,7 +53,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> constructor) { void writeModel(String dydName, String parName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException, XMLStreamException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", dydName, tmpDir.resolve(DynaWaltzConstants.DYD_FILENAME)); + validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); if (!parName.isEmpty()) { validate("parameters.xsd", parName, tmpDir.resolve(context.getSimulationParFile())); } diff --git a/dynawaltz/src/test/resources/DynaWaltzParameters.json b/dynawo-simulation/src/test/resources/DynawoSimulationParameters.json similarity index 97% rename from dynawaltz/src/test/resources/DynaWaltzParameters.json rename to dynawo-simulation/src/test/resources/DynawoSimulationParameters.json index d3083c91f..c1749bafd 100644 --- a/dynawaltz/src/test/resources/DynaWaltzParameters.json +++ b/dynawo-simulation/src/test/resources/DynawoSimulationParameters.json @@ -3,7 +3,7 @@ "startTime" : 0.0, "stopTime" : 3600.0, "extensions" : { - "DynaWaltzParameters" : { + "DynawoSimulationParameters" : { "networkParameters" : { "id" : "networkParametersId", "parameters" : { diff --git a/dynawaltz/src/test/resources/apv_dyd.xml b/dynawo-simulation/src/test/resources/apv_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/apv_dyd.xml rename to dynawo-simulation/src/test/resources/apv_dyd.xml diff --git a/dynawaltz/src/test/resources/apv_network_par.xml b/dynawo-simulation/src/test/resources/apv_network_par.xml similarity index 100% rename from dynawaltz/src/test/resources/apv_network_par.xml rename to dynawo-simulation/src/test/resources/apv_network_par.xml diff --git a/dynawaltz/src/test/resources/apv_par.xml b/dynawo-simulation/src/test/resources/apv_par.xml similarity index 100% rename from dynawaltz/src/test/resources/apv_par.xml rename to dynawo-simulation/src/test/resources/apv_par.xml diff --git a/dynawaltz/src/test/resources/cla_dyd.xml b/dynawo-simulation/src/test/resources/cla_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/cla_dyd.xml rename to dynawo-simulation/src/test/resources/cla_dyd.xml diff --git a/dynawaltz/src/test/resources/cla_tl_dyd.xml b/dynawo-simulation/src/test/resources/cla_tl_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/cla_tl_dyd.xml rename to dynawo-simulation/src/test/resources/cla_tl_dyd.xml diff --git a/dynawaltz/src/test/resources/com/powsybl/config/test/config.yml b/dynawo-simulation/src/test/resources/com/powsybl/config/test/config.yml similarity index 87% rename from dynawaltz/src/test/resources/com/powsybl/config/test/config.yml rename to dynawo-simulation/src/test/resources/com/powsybl/config/test/config.yml index bc1d37ba4..df742ffa7 100644 --- a/dynawaltz/src/test/resources/com/powsybl/config/test/config.yml +++ b/dynawo-simulation/src/test/resources/com/powsybl/config/test/config.yml @@ -2,8 +2,8 @@ dynamic-simulation-default-parameters: startTime: 1 stopTime: 100 -dynawaltz: - homeDir: /home/dynawaltz +dynawo: + homeDir: /home/dynawo debug: false dynawo-algorithms: @@ -13,7 +13,7 @@ dynawo-algorithms: dynamic-security-analysis-default-parameters: contingencies-start-time: 10 -dynawaltz-default-parameters: +dynawo-simulation-default-parameters: parametersFile: /work/unittests/configModels.par network.parametersFile: /work/unittests/configNetwork.par network.parametersId: "1" diff --git a/dynawaltz/src/test/resources/com/powsybl/config/test/configModels.par b/dynawo-simulation/src/test/resources/com/powsybl/config/test/configModels.par similarity index 100% rename from dynawaltz/src/test/resources/com/powsybl/config/test/configModels.par rename to dynawo-simulation/src/test/resources/com/powsybl/config/test/configModels.par diff --git a/dynawaltz/src/test/resources/com/powsybl/config/test/configNetwork.par b/dynawo-simulation/src/test/resources/com/powsybl/config/test/configNetwork.par similarity index 100% rename from dynawaltz/src/test/resources/com/powsybl/config/test/configNetwork.par rename to dynawo-simulation/src/test/resources/com/powsybl/config/test/configNetwork.par diff --git a/dynawaltz/src/test/resources/com/powsybl/config/test/configSolver.par b/dynawo-simulation/src/test/resources/com/powsybl/config/test/configSolver.par similarity index 100% rename from dynawaltz/src/test/resources/com/powsybl/config/test/configSolver.par rename to dynawo-simulation/src/test/resources/com/powsybl/config/test/configSolver.par diff --git a/dynawaltz/src/test/resources/com/powsybl/config/test/filelist.txt b/dynawo-simulation/src/test/resources/com/powsybl/config/test/filelist.txt similarity index 100% rename from dynawaltz/src/test/resources/com/powsybl/config/test/filelist.txt rename to dynawo-simulation/src/test/resources/com/powsybl/config/test/filelist.txt diff --git a/dynawaltz/src/test/resources/curves.csv b/dynawo-simulation/src/test/resources/curves.csv similarity index 100% rename from dynawaltz/src/test/resources/curves.csv rename to dynawo-simulation/src/test/resources/curves.csv diff --git a/dynawaltz/src/test/resources/curvesInput.xml b/dynawo-simulation/src/test/resources/curvesInput.xml similarity index 100% rename from dynawaltz/src/test/resources/curvesInput.xml rename to dynawo-simulation/src/test/resources/curvesInput.xml diff --git a/dynawaltz/src/test/resources/curvesInput.xsd b/dynawo-simulation/src/test/resources/curvesInput.xsd similarity index 100% rename from dynawaltz/src/test/resources/curvesInput.xsd rename to dynawo-simulation/src/test/resources/curvesInput.xsd diff --git a/dynawaltz/src/test/resources/disconnect_branch_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_branch_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_branch_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_branch_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_branch_par.xml b/dynawo-simulation/src/test/resources/disconnect_branch_par.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_branch_par.xml rename to dynawo-simulation/src/test/resources/disconnect_branch_par.xml diff --git a/dynawaltz/src/test/resources/disconnect_default_hvdc_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_default_hvdc_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_default_hvdc_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_default_hvdc_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_hvdc_par.xml b/dynawo-simulation/src/test/resources/disconnect_hvdc_par.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_hvdc_par.xml rename to dynawo-simulation/src/test/resources/disconnect_hvdc_par.xml diff --git a/dynawaltz/src/test/resources/disconnect_hvdc_pv_dangling_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_hvdc_pv_dangling_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_hvdc_pv_dangling_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_hvdc_pv_dangling_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_hvdc_pv_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_hvdc_pv_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_hvdc_pv_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_hvdc_pv_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_hvdc_vsc_dangling_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_hvdc_vsc_dangling_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_hvdc_vsc_dangling_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_hvdc_vsc_dangling_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_hvdc_vsc_dyd.xml b/dynawo-simulation/src/test/resources/disconnect_hvdc_vsc_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_hvdc_vsc_dyd.xml rename to dynawo-simulation/src/test/resources/disconnect_hvdc_vsc_dyd.xml diff --git a/dynawaltz/src/test/resources/disconnect_par.xml b/dynawo-simulation/src/test/resources/disconnect_par.xml similarity index 100% rename from dynawaltz/src/test/resources/disconnect_par.xml rename to dynawo-simulation/src/test/resources/disconnect_par.xml diff --git a/dynawaltz/src/test/resources/dyd.xml b/dynawo-simulation/src/test/resources/dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/dyd.xml rename to dynawo-simulation/src/test/resources/dyd.xml diff --git a/dynawaltz/src/test/resources/dyd.xsd b/dynawo-simulation/src/test/resources/dyd.xsd similarity index 100% rename from dynawaltz/src/test/resources/dyd.xsd rename to dynawo-simulation/src/test/resources/dyd.xsd diff --git a/dynawaltz/src/test/resources/dyd_fictitious.xml b/dynawo-simulation/src/test/resources/dyd_fictitious.xml similarity index 100% rename from dynawaltz/src/test/resources/dyd_fictitious.xml rename to dynawo-simulation/src/test/resources/dyd_fictitious.xml diff --git a/dynawaltz/src/test/resources/dynawo_bad_version.out b/dynawo-simulation/src/test/resources/dynawo_bad_version.out similarity index 100% rename from dynawaltz/src/test/resources/dynawo_bad_version.out rename to dynawo-simulation/src/test/resources/dynawo_bad_version.out diff --git a/dynawaltz/src/test/resources/dynawo_version.out b/dynawo-simulation/src/test/resources/dynawo_version.out similarity index 100% rename from dynawaltz/src/test/resources/dynawo_version.out rename to dynawo-simulation/src/test/resources/dynawo_version.out diff --git a/dynawaltz/src/test/resources/empty_phase_shifter_blocking_i_dyd.xml b/dynawo-simulation/src/test/resources/empty_phase_shifter_blocking_i_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/empty_phase_shifter_blocking_i_dyd.xml rename to dynawo-simulation/src/test/resources/empty_phase_shifter_blocking_i_dyd.xml diff --git a/dynawaltz/src/test/resources/events.xml b/dynawo-simulation/src/test/resources/events.xml similarity index 100% rename from dynawaltz/src/test/resources/events.xml rename to dynawo-simulation/src/test/resources/events.xml diff --git a/dynawaltz/src/test/resources/grid_forming_converter_dyd.xml b/dynawo-simulation/src/test/resources/grid_forming_converter_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/grid_forming_converter_dyd.xml rename to dynawo-simulation/src/test/resources/grid_forming_converter_dyd.xml diff --git a/dynawaltz/src/test/resources/grid_forming_converter_par.xml b/dynawo-simulation/src/test/resources/grid_forming_converter_par.xml similarity index 100% rename from dynawaltz/src/test/resources/grid_forming_converter_par.xml rename to dynawo-simulation/src/test/resources/grid_forming_converter_par.xml diff --git a/dynawaltz/src/test/resources/hvdc_p_dangling_dyd.xml b/dynawo-simulation/src/test/resources/hvdc_p_dangling_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/hvdc_p_dangling_dyd.xml rename to dynawo-simulation/src/test/resources/hvdc_p_dangling_dyd.xml diff --git a/dynawaltz/src/test/resources/hvdc_p_dyd.xml b/dynawo-simulation/src/test/resources/hvdc_p_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/hvdc_p_dyd.xml rename to dynawo-simulation/src/test/resources/hvdc_p_dyd.xml diff --git a/dynawaltz/src/test/resources/hvdc_vsc_dangling_dyd.xml b/dynawo-simulation/src/test/resources/hvdc_vsc_dangling_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/hvdc_vsc_dangling_dyd.xml rename to dynawo-simulation/src/test/resources/hvdc_vsc_dangling_dyd.xml diff --git a/dynawaltz/src/test/resources/hvdc_vsc_dyd.xml b/dynawo-simulation/src/test/resources/hvdc_vsc_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/hvdc_vsc_dyd.xml rename to dynawo-simulation/src/test/resources/hvdc_vsc_dyd.xml diff --git a/dynawaltz/src/test/resources/jobs.xml b/dynawo-simulation/src/test/resources/jobs.xml similarity index 79% rename from dynawaltz/src/test/resources/jobs.xml rename to dynawo-simulation/src/test/resources/jobs.xml index 608bd9985..640320dc2 100644 --- a/dynawaltz/src/test/resources/jobs.xml +++ b/dynawo-simulation/src/test/resources/jobs.xml @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz/src/test/resources/jobs.xsd b/dynawo-simulation/src/test/resources/jobs.xsd similarity index 100% rename from dynawaltz/src/test/resources/jobs.xsd rename to dynawo-simulation/src/test/resources/jobs.xsd diff --git a/dynawaltz/src/test/resources/jobsWithDump.xml b/dynawo-simulation/src/test/resources/jobsWithDump.xml similarity index 79% rename from dynawaltz/src/test/resources/jobsWithDump.xml rename to dynawo-simulation/src/test/resources/jobsWithDump.xml index 49f23b0f5..5d073b43a 100644 --- a/dynawaltz/src/test/resources/jobsWithDump.xml +++ b/dynawo-simulation/src/test/resources/jobsWithDump.xml @@ -3,8 +3,8 @@ - - + + @@ -14,7 +14,7 @@ - + diff --git a/dynawaltz/src/test/resources/jobsWithSpecificLogs.xml b/dynawo-simulation/src/test/resources/jobsWithSpecificLogs.xml similarity index 84% rename from dynawaltz/src/test/resources/jobsWithSpecificLogs.xml rename to dynawo-simulation/src/test/resources/jobsWithSpecificLogs.xml index 0f4d928ce..a71243b33 100644 --- a/dynawaltz/src/test/resources/jobsWithSpecificLogs.xml +++ b/dynawo-simulation/src/test/resources/jobsWithSpecificLogs.xml @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - + diff --git a/dynawaltz/src/test/resources/load_alpha_beta_dyd.xml b/dynawo-simulation/src/test/resources/load_alpha_beta_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/load_alpha_beta_dyd.xml rename to dynawo-simulation/src/test/resources/load_alpha_beta_dyd.xml diff --git a/dynawaltz/src/test/resources/load_one_transformer_dyd.xml b/dynawo-simulation/src/test/resources/load_one_transformer_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/load_one_transformer_dyd.xml rename to dynawo-simulation/src/test/resources/load_one_transformer_dyd.xml diff --git a/dynawaltz/src/test/resources/load_one_transformer_tap_changer_dyd.xml b/dynawo-simulation/src/test/resources/load_one_transformer_tap_changer_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/load_one_transformer_tap_changer_dyd.xml rename to dynawo-simulation/src/test/resources/load_one_transformer_tap_changer_dyd.xml diff --git a/dynawaltz/src/test/resources/load_two_transformers_dyd.xml b/dynawo-simulation/src/test/resources/load_two_transformers_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/load_two_transformers_dyd.xml rename to dynawo-simulation/src/test/resources/load_two_transformers_dyd.xml diff --git a/dynawaltz/src/test/resources/load_two_transformers_tap_changers_dyd.xml b/dynawo-simulation/src/test/resources/load_two_transformers_tap_changers_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/load_two_transformers_tap_changers_dyd.xml rename to dynawo-simulation/src/test/resources/load_two_transformers_tap_changers_dyd.xml diff --git a/dynawaltz/src/test/resources/mergedLoads.xiidm b/dynawo-simulation/src/test/resources/mergedLoads.xiidm similarity index 100% rename from dynawaltz/src/test/resources/mergedLoads.xiidm rename to dynawo-simulation/src/test/resources/mergedLoads.xiidm diff --git a/dynawaltz/src/test/resources/models.par b/dynawo-simulation/src/test/resources/models.par similarity index 100% rename from dynawaltz/src/test/resources/models.par rename to dynawo-simulation/src/test/resources/models.par diff --git a/dynawaltz/src/test/resources/models_misspelled.par b/dynawo-simulation/src/test/resources/models_misspelled.par similarity index 100% rename from dynawaltz/src/test/resources/models_misspelled.par rename to dynawo-simulation/src/test/resources/models_misspelled.par diff --git a/dynawaltz/src/test/resources/noMergedLoads.xiidm b/dynawo-simulation/src/test/resources/noMergedLoads.xiidm similarity index 100% rename from dynawaltz/src/test/resources/noMergedLoads.xiidm rename to dynawo-simulation/src/test/resources/noMergedLoads.xiidm diff --git a/dynawaltz/src/test/resources/node_fault_dyd.xml b/dynawo-simulation/src/test/resources/node_fault_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/node_fault_dyd.xml rename to dynawo-simulation/src/test/resources/node_fault_dyd.xml diff --git a/dynawaltz/src/test/resources/node_fault_par.xml b/dynawo-simulation/src/test/resources/node_fault_par.xml similarity index 100% rename from dynawaltz/src/test/resources/node_fault_par.xml rename to dynawo-simulation/src/test/resources/node_fault_par.xml diff --git a/dynawaltz/src/test/resources/node_network_par.xml b/dynawo-simulation/src/test/resources/node_network_par.xml similarity index 100% rename from dynawaltz/src/test/resources/node_network_par.xml rename to dynawo-simulation/src/test/resources/node_network_par.xml diff --git a/dynawaltz/src/test/resources/omega_ref.xml b/dynawo-simulation/src/test/resources/omega_ref.xml similarity index 100% rename from dynawaltz/src/test/resources/omega_ref.xml rename to dynawo-simulation/src/test/resources/omega_ref.xml diff --git a/dynawaltz/src/test/resources/omega_ref_dyd.xml b/dynawo-simulation/src/test/resources/omega_ref_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/omega_ref_dyd.xml rename to dynawo-simulation/src/test/resources/omega_ref_dyd.xml diff --git a/dynawaltz/src/test/resources/omega_ref_par.xml b/dynawo-simulation/src/test/resources/omega_ref_par.xml similarity index 100% rename from dynawaltz/src/test/resources/omega_ref_par.xml rename to dynawo-simulation/src/test/resources/omega_ref_par.xml diff --git a/dynawaltz/src/test/resources/parameters.xsd b/dynawo-simulation/src/test/resources/parameters.xsd similarity index 100% rename from dynawaltz/src/test/resources/parameters.xsd rename to dynawo-simulation/src/test/resources/parameters.xsd diff --git a/dynawaltz/src/test/resources/parametersSet/models.par b/dynawo-simulation/src/test/resources/parametersSet/models.par similarity index 100% rename from dynawaltz/src/test/resources/parametersSet/models.par rename to dynawo-simulation/src/test/resources/parametersSet/models.par diff --git a/dynawaltz/src/test/resources/parametersSet/network.par b/dynawo-simulation/src/test/resources/parametersSet/network.par similarity index 100% rename from dynawaltz/src/test/resources/parametersSet/network.par rename to dynawo-simulation/src/test/resources/parametersSet/network.par diff --git a/dynawaltz/src/test/resources/parametersSet/solvers.par b/dynawo-simulation/src/test/resources/parametersSet/solvers.par similarity index 100% rename from dynawaltz/src/test/resources/parametersSet/solvers.par rename to dynawo-simulation/src/test/resources/parametersSet/solvers.par diff --git a/dynawaltz/src/test/resources/parametersSet/solversMissingDefault.par b/dynawo-simulation/src/test/resources/parametersSet/solversMissingDefault.par similarity index 100% rename from dynawaltz/src/test/resources/parametersSet/solversMissingDefault.par rename to dynawo-simulation/src/test/resources/parametersSet/solversMissingDefault.par diff --git a/dynawaltz/src/test/resources/phase_shifter_blocking_i_dyd.xml b/dynawo-simulation/src/test/resources/phase_shifter_blocking_i_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/phase_shifter_blocking_i_dyd.xml rename to dynawo-simulation/src/test/resources/phase_shifter_blocking_i_dyd.xml diff --git a/dynawaltz/src/test/resources/phase_shifter_i_dyd.xml b/dynawo-simulation/src/test/resources/phase_shifter_i_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/phase_shifter_i_dyd.xml rename to dynawo-simulation/src/test/resources/phase_shifter_i_dyd.xml diff --git a/dynawaltz/src/test/resources/phase_shifter_p_dyd.xml b/dynawo-simulation/src/test/resources/phase_shifter_p_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/phase_shifter_p_dyd.xml rename to dynawo-simulation/src/test/resources/phase_shifter_p_dyd.xml diff --git a/dynawaltz/src/test/resources/set_point_inf_bus_dyd.xml b/dynawo-simulation/src/test/resources/set_point_inf_bus_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/set_point_inf_bus_dyd.xml rename to dynawo-simulation/src/test/resources/set_point_inf_bus_dyd.xml diff --git a/dynawaltz/src/test/resources/set_point_inf_bus_par.xml b/dynawo-simulation/src/test/resources/set_point_inf_bus_par.xml similarity index 100% rename from dynawaltz/src/test/resources/set_point_inf_bus_par.xml rename to dynawo-simulation/src/test/resources/set_point_inf_bus_par.xml diff --git a/dynawaltz/src/test/resources/shunt_dyd.xml b/dynawo-simulation/src/test/resources/shunt_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/shunt_dyd.xml rename to dynawo-simulation/src/test/resources/shunt_dyd.xml diff --git a/dynawaltz/src/test/resources/suppliers/curves.json b/dynawo-simulation/src/test/resources/suppliers/curves.json similarity index 100% rename from dynawaltz/src/test/resources/suppliers/curves.json rename to dynawo-simulation/src/test/resources/suppliers/curves.json diff --git a/dynawaltz/src/test/resources/suppliers/mappingDynamicModel.json b/dynawo-simulation/src/test/resources/suppliers/mappingDynamicModel.json similarity index 100% rename from dynawaltz/src/test/resources/suppliers/mappingDynamicModel.json rename to dynawo-simulation/src/test/resources/suppliers/mappingDynamicModel.json diff --git a/dynawaltz/src/test/resources/suppliers/mappingEvent.json b/dynawo-simulation/src/test/resources/suppliers/mappingEvent.json similarity index 100% rename from dynawaltz/src/test/resources/suppliers/mappingEvent.json rename to dynawo-simulation/src/test/resources/suppliers/mappingEvent.json diff --git a/dynawaltz/src/test/resources/svarc_dyd.xml b/dynawo-simulation/src/test/resources/svarc_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/svarc_dyd.xml rename to dynawo-simulation/src/test/resources/svarc_dyd.xml diff --git a/dynawaltz/src/test/resources/svarc_sba_dyd.xml b/dynawo-simulation/src/test/resources/svarc_sba_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/svarc_sba_dyd.xml rename to dynawo-simulation/src/test/resources/svarc_sba_dyd.xml diff --git a/dynawaltz/src/test/resources/tap_changer_blocking_dyd.xml b/dynawo-simulation/src/test/resources/tap_changer_blocking_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tap_changer_blocking_dyd.xml rename to dynawo-simulation/src/test/resources/tap_changer_blocking_dyd.xml diff --git a/dynawaltz/src/test/resources/tap_changer_blocking_empty_dyd.xml b/dynawo-simulation/src/test/resources/tap_changer_blocking_empty_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tap_changer_blocking_empty_dyd.xml rename to dynawo-simulation/src/test/resources/tap_changer_blocking_empty_dyd.xml diff --git a/dynawaltz/src/test/resources/tap_changer_blocking_tap_changer_dyd.xml b/dynawo-simulation/src/test/resources/tap_changer_blocking_tap_changer_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tap_changer_blocking_tap_changer_dyd.xml rename to dynawo-simulation/src/test/resources/tap_changer_blocking_tap_changer_dyd.xml diff --git a/dynawaltz/src/test/resources/tap_changer_dyd.xml b/dynawo-simulation/src/test/resources/tap_changer_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tap_changer_dyd.xml rename to dynawo-simulation/src/test/resources/tap_changer_dyd.xml diff --git a/dynawaltz/src/test/resources/tap_changer_empty_dyd.xml b/dynawo-simulation/src/test/resources/tap_changer_empty_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tap_changer_empty_dyd.xml rename to dynawo-simulation/src/test/resources/tap_changer_empty_dyd.xml diff --git a/dynawaltz/src/test/resources/tfr_dyd.xml b/dynawo-simulation/src/test/resources/tfr_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/tfr_dyd.xml rename to dynawo-simulation/src/test/resources/tfr_dyd.xml diff --git a/dynawaltz/src/test/resources/under_voltage_dyd.xml b/dynawo-simulation/src/test/resources/under_voltage_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/under_voltage_dyd.xml rename to dynawo-simulation/src/test/resources/under_voltage_dyd.xml diff --git a/dynawaltz/src/test/resources/wecc_pv_dyd.xml b/dynawo-simulation/src/test/resources/wecc_pv_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/wecc_pv_dyd.xml rename to dynawo-simulation/src/test/resources/wecc_pv_dyd.xml diff --git a/dynawaltz/src/test/resources/wecc_wt_dyd.xml b/dynawo-simulation/src/test/resources/wecc_wt_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/wecc_wt_dyd.xml rename to dynawo-simulation/src/test/resources/wecc_wt_dyd.xml diff --git a/dynawaltz/src/test/resources/wecc_wt_par.xml b/dynawo-simulation/src/test/resources/wecc_wt_par.xml similarity index 100% rename from dynawaltz/src/test/resources/wecc_wt_par.xml rename to dynawo-simulation/src/test/resources/wecc_wt_par.xml diff --git a/dynawaltz/src/test/resources/wecc_wt_synchro_dyd.xml b/dynawo-simulation/src/test/resources/wecc_wt_synchro_dyd.xml similarity index 100% rename from dynawaltz/src/test/resources/wecc_wt_synchro_dyd.xml rename to dynawo-simulation/src/test/resources/wecc_wt_synchro_dyd.xml diff --git a/pom.xml b/pom.xml index 3ad541102..2763b82c5 100644 --- a/pom.xml +++ b/pom.xml @@ -49,8 +49,8 @@ commons dynaflow - dynawaltz - dynawaltz-dsl + dynawo-simulation + dynawo-dsl dynawo-security-analysis distribution @@ -58,7 +58,7 @@ 17 6.4.0 - 4.0.14 + 4.0.14 0.3.2 ../distribution/target/site/jacoco-aggregate/jacoco.xml, @@ -126,19 +126,19 @@ com.powsybl - powsybl-dynawaltz + powsybl-dynawo-simulation ${project.version} ${project.groupId} - powsybl-dynawaltz + powsybl-dynawo-simulation ${project.version} test-jar test com.powsybl - powsybl-dynawaltz-dsl + powsybl-dynawo-dsl ${project.version} From eb5d3b6b81addb514ace7c08a16293d52c66169f Mon Sep 17 00:00:00 2001 From: lisrte Date: Mon, 8 Jul 2024 11:04:43 +0200 Subject: [PATCH 10/28] Update documentation Signed-off-by: lisrte --- README.md | 16 ++++++++-------- docs/dynamic_simulation/dynamic-models-dsl.md | 4 ++-- docs/dynamic_simulation/index.md | 2 +- .../security/DynawoSecurityAnalysisProvider.java | 2 +- .../powsybl/dynawo/DynawoSimulationProvider.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3f0ba697c..35e602b14 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ LoadFlow.find("DynaFlow").run(network, parameters); To learn more about the usage of DynaFlow, read the [dedicated page](https://www.powsybl.org/pages/documentation/simulation/powerflow/dynaflow.html) on our website. -## DynaWaltz +## Dynawo -To use DynaWaltz as your time domain engine, add the `com.powsybl:powsybl-dynawaltz` and `com.powsybl:powsybl-dynawaltz-dsl` modules to your dependencies. +To use Dynawo as your time domain engine, add the `com.powsybl:powsybl-dynawo` and `com.powsybl:powsybl-dynawo-dsl` modules to your dependencies. To run a dynamic simulation, you need: - a case file - a `DynamicModelsSupplier` to associate dynamic models to the equipment of the network @@ -31,7 +31,7 @@ To run a dynamic simulation, you need: - a `CurvesSupplier` to follow the evolution of dynamic variables during the simulation (optional) - a set of parameters to configure the simulation (optional) -Thanks to `powsybl-dynawaltz-dsl`, the inputs can be easily configured using Groovy scripts. +Thanks to `powsybl-dynawo-dsl`, the inputs can be easily configured using Groovy scripts. The simulation parameters can be configured either in the `config.yml` file or using a Json file. ```java @@ -40,17 +40,17 @@ Network network = Network.read("/path/to/the/casefile.xiidm"); // Load the dynamic models mapping GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( Paths.get("/path/to/dynamicModelsMapping.groovy"), - GroovyExtension.find(DynamicModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); // Load the events GroovyEventModelsSupplier eventModelsSupplier = new GroovyEventModelsSupplier( Paths.get("/path/to/event.groovy"), - GroovyExtension.find(EventModelGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(EventModelGroovyExtension.class, DynawoSimulationProvider.NAME)); // Configure the curves GroovyCurvesSupplier curvesSupplier = new GroovyCurvesSupplier( Paths.get("/path/to/curves.groovy"), - GroovyExtension.find(CurveGroovyExtension.class, DynaWaltzProvider.NAME)); + GroovyExtension.find(CurveGroovyExtension.class, DynawoSimulationProvider.NAME)); // Load the parameters DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); @@ -62,7 +62,7 @@ System.out.println("Timeline:"); result.getTimeLine().forEach(tl -> System.out.printf("[%.8f] %s (on %s)%n", tl.time(), tl.message(), tl.modelName())); ``` -To learn more about the usage of DynaWaltz, read the [dedicated page](https://www.powsybl.org/pages/documentation/simulation/timedomain/dynawo) on our website. +To learn more about the usage of Dynawo, read the [dedicated page](https://www.powsybl.org/pages/documentation/simulation/timedomain/dynawo) on our website. ### Examples @@ -171,7 +171,7 @@ For the above example, the corresponding parameter file could be: ``` -Other examples can be found in the [resources](https://github.com/powsybl/powsybl-dynawo/tree/main/dynawaltz-dsl/src/test/resources) of this project. +Other examples can be found in the [resources](https://github.com/powsybl/powsybl-dynawo/tree/main/dynawo-dsl/src/test/resources) of this project. ## Contribute to documentation diff --git a/docs/dynamic_simulation/dynamic-models-dsl.md b/docs/dynamic_simulation/dynamic-models-dsl.md index 672e81065..7ff17ca1d 100644 --- a/docs/dynamic_simulation/dynamic-models-dsl.md +++ b/docs/dynamic_simulation/dynamic-models-dsl.md @@ -50,13 +50,13 @@ OverloadManagementSystem { #### TODO add all automation systems ## Supported models -Models are listed in [models.json](../../dynawaltz/src/main/resources/models.json). +Models are listed in [models.json](../../dynawo/src/main/resources/models.json). The list is divided in categories each linked to a dedicated builder. ### Categories properties * `defaultLib` : name of the default library * `libs` : list of dynawo libraries supported for this category -The list is statically loaded via [ModelConfigLoader](https://javadoc.io/doc/com.powsybl/powsybl-dynawo/latest/com/powsybl/dynawaltz/builders/ModelConfigLoader.html) services and thus can be extended. +The list is statically loaded via [ModelConfigLoader](https://javadoc.io/doc/com.powsybl/powsybl-dynawo/latest/com/powsybl/dynawo/builders/ModelConfigLoader.html) services and thus can be extended. ### Library properties * `lib`: library name used in dynawo diff --git a/docs/dynamic_simulation/index.md b/docs/dynamic_simulation/index.md index b96ba4a78..e6d743836 100644 --- a/docs/dynamic_simulation/index.md +++ b/docs/dynamic_simulation/index.md @@ -8,7 +8,7 @@ event-models-dsl.md curves-dsl.md ``` -PowSyBl provides an implementation of the [DynamicSimulation API from powsybl-core](inv:powsyblcore:*:*#simulation/dynamic/index) with [DynaWaltz](https://dynawo.github.io/about/dynawaltz), a tool for long-term stability simulation from the [Dynaωo](https://dynawo.github.io) suite. +PowSyBl provides an implementation of the [DynamicSimulation API from powsybl-core](inv:powsyblcore:*:*#simulation/dynamic/index) with [Dynaωo](https://dynawo.github.io), a tool for long-term stability simulation. ## Installation diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index 7a3fecb0b..14e336a9f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -45,7 +45,7 @@ public class DynawoSecurityAnalysisProvider implements DynamicSecurityAnalysisProvider { private static final Logger LOGGER = LoggerFactory.getLogger(DynawoSecurityAnalysisProvider.class); - private static final String WORKING_DIR_PREFIX = "dynawaltz_sa_"; + private static final String WORKING_DIR_PREFIX = "dynawo_sa_"; private final DynawoAlgorithmsConfig config; public DynawoSecurityAnalysisProvider() { diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java index c706f03dc..4068d6a4d 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationProvider.java @@ -30,7 +30,7 @@ public class DynawoSimulationProvider implements DynamicSimulationProvider { public static final String NAME = "Dynawo"; - private static final String WORKING_DIR_PREFIX = "powsybl_dynawo_"; + private static final String WORKING_DIR_PREFIX = "dynawo_"; private final DynawoSimulationConfig config; From 248b80a2c58687e3303ed9a7f3d8461ba264e30c Mon Sep 17 00:00:00 2001 From: lisrte Date: Mon, 8 Jul 2024 11:18:20 +0200 Subject: [PATCH 11/28] Update documentation 2 Signed-off-by: lisrte --- docs/dynamic_security_analysis/configuration.md | 2 +- docs/dynamic_simulation/configuration.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/dynamic_security_analysis/configuration.md b/docs/dynamic_security_analysis/configuration.md index 36a1b937e..e14dac4db 100644 --- a/docs/dynamic_security_analysis/configuration.md +++ b/docs/dynamic_security_analysis/configuration.md @@ -27,4 +27,4 @@ dynawo-algorithms: ``` ## Default parameters -The dynamic security analysis reuse the `dynawo-default-parameters` [module](../dynamic_simulation/configuration.md#default-parameters). +The dynamic security analysis reuse the `dynawo-simulation-default-parameters` [module](../dynamic_simulation/configuration.md#default-parameters). diff --git a/docs/dynamic_simulation/configuration.md b/docs/dynamic_simulation/configuration.md index cb5587519..3e45de2a7 100644 --- a/docs/dynamic_simulation/configuration.md +++ b/docs/dynamic_simulation/configuration.md @@ -27,7 +27,7 @@ dynawo: ``` ## Default parameters -The `dynawo-default-parameters` module defines the default values for all specific parameters of a dynamic simulation run with Dynawo. +The `dynawo-simulation-default-parameters` module defines the default values for all specific parameters of a dynamic simulation run with Dynawo. ### Required parameters @@ -121,7 +121,7 @@ The available `com.powsybl.dynawo.DynawoSimulationParameters.SpecificLog` values **YAML configuration:** ```yaml -dynawo-default-parameters: +dynawo-simulation-default-parameters: parametersFile: /home/user/parametersFile network.parametersFile: /home/user/networkParametersFile network.parametersId: 1 @@ -144,7 +144,7 @@ dynawo-default-parameters: **XML configuration:** ```xml - + /home/user/parametersFile /home/user/networkParametersFile NETWORK @@ -161,5 +161,5 @@ dynawo-default-parameters: 10e-6 INFO NETWORK, PARAMETERS - + ``` From 91b6b421d24e7a8e5da44d2f6b1ba902ebc3580a Mon Sep 17 00:00:00 2001 From: lisrte Date: Mon, 8 Jul 2024 14:41:24 +0200 Subject: [PATCH 12/28] Fix code smells Signed-off-by: lisrte --- .../dynawo/dsl/ieee/AbstractIeeeTest.java | 2 +- .../dynawo/DynawoSimulationReports.java | 8 +++++--- .../dynawo/builders/BuilderReports.java | 7 ++++--- .../powsybl/dynawo/DynawoParametersTest.java | 1 + .../dynawo/builders/BuilderConfigTest.java | 20 +++++++++---------- .../xml/DisconnectHvdcEventXmlTest.java | 3 +-- ...cOverloadManagementSystemModelXmlTest.java | 3 +-- ...sOverloadManagementSystemModelXmlTest.java | 3 +-- ...mptyTapChangerAutomationSystemXmlTest.java | 3 +-- ...hangerBlockingAutomationSystemXmlTest.java | 3 +-- .../com/powsybl/dynawo/xml/HvdcXmlTest.java | 3 +-- .../powsybl/dynawo/xml/LoadsModelXmlTest.java | 3 +-- .../dynawo/xml/NodeFaultEventXmlTest.java | 3 +-- .../dynawo/xml/OmegaRefModelXmlTest.java | 3 +-- .../dynawo/xml/PhaseShiftersXmlTest.java | 3 +-- .../xml/SetPointInfiniteBusModelXmlTest.java | 3 +-- .../powsybl/dynawo/xml/ShuntModelXmlTest.java | 3 +-- .../dynawo/xml/SvarcModelWithSbaXmlTest.java | 3 +-- .../powsybl/dynawo/xml/SvarcModelXmlTest.java | 3 +-- .../TapChangerAutomationSystemXmlTest.java | 3 +-- ...hangerBlockingAutomationSystemXmlTest.java | 3 +-- ...ngToTapChangerAutomationSystemXmlTest.java | 3 +-- .../dynawo/xml/TransformerModelXmlTest.java | 3 +-- .../UnderVoltageAutomationSystemXmlTest.java | 3 +-- .../powsybl/dynawo/xml/WeccGenXmlTest.java | 3 +-- 25 files changed, 41 insertions(+), 57 deletions(-) diff --git a/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java index 72bb564a2..75826799a 100644 --- a/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java +++ b/dynawo-dsl/src/test/java/com/powsybl/dynawo/dsl/ieee/AbstractIeeeTest.java @@ -71,7 +71,7 @@ protected void setup(String parametersFile, String networkParametersFile, String List dynamicModelGroovyExtensions = GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME); dynamicModelsSupplier = new GroovyDynamicModelsSupplier(workingDir.resolve("dynamicModels.groovy"), dynamicModelGroovyExtensions); } else { - dynamicModelsSupplier = (n, NO_OP) -> Collections.emptyList(); + dynamicModelsSupplier = (n, r) -> Collections.emptyList(); } // Event models diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java index e01563a33..2ca46361f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationReports.java @@ -16,6 +16,8 @@ */ public final class DynawoSimulationReports { + private static final String DYNAMIC_ID_FIELD = "dynamicId"; + private DynawoSimulationReports() { } @@ -37,7 +39,7 @@ public static void reportDuplicateStaticId(ReportNode reportNode, String duplica .withMessageTemplate("duplicateStaticId", "Duplicate static id found: ${duplicateId} -> model ${modelName} ${dynamicId} will be skipped") .withUntypedValue("duplicateId", duplicateId) .withUntypedValue("modelName", modelName) - .withUntypedValue("dynamicId", dynamicId) + .withUntypedValue(DYNAMIC_ID_FIELD, dynamicId) .withSeverity(TypedValue.WARN_SEVERITY) .add(); } @@ -57,7 +59,7 @@ public static void reportEmptyAutomaton(ReportNode reportNode, String automatonN .withMessageTemplate("emptyAutomaton", "${automatonName} ${dynamicId} equipment ${equipmentId} is not a ${expectedModels}, the automation system will be skipped") .withUntypedValue("automatonName", automatonName) - .withUntypedValue("dynamicId", dynamicId) + .withUntypedValue(DYNAMIC_ID_FIELD, dynamicId) .withUntypedValue("equipmentId", equipmentId) .withUntypedValue("expectedModels", expectedModels) .withSeverity(TypedValue.WARN_SEVERITY) @@ -69,7 +71,7 @@ public static void reportEmptyListAutomaton(ReportNode reportNode, String automa .withMessageTemplate("emptyListAutomaton", "None of ${automatonName} ${dynamicId} equipments are ${expectedModels}, the automation system will be skipped") .withUntypedValue("automatonName", automatonName) - .withUntypedValue("dynamicId", dynamicId) + .withUntypedValue(DYNAMIC_ID_FIELD, dynamicId) .withUntypedValue("expectedModels", expectedModels) .withSeverity(TypedValue.WARN_SEVERITY) .add(); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java index 63b0cc553..e3a408961 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/builders/BuilderReports.java @@ -17,6 +17,7 @@ public final class BuilderReports { private static final String FIELD_NAME = "fieldName"; + private static final String EQUIPMENT_TYPE_FIELD = "equipmentType"; private BuilderReports() { } @@ -83,7 +84,7 @@ public static void reportFieldNotSet(ReportNode reportNode, String fieldName) { public static void reportStaticIdUnknown(ReportNode reportNode, String fieldName, String staticId, String equipmentType) { reportNode.newReportNode() .withMessageTemplate("unknownStaticIdToDynamic", "'${fieldName}' field value '${staticId}' not found for equipment type(s) ${equipmentType}") - .withUntypedValue("equipmentType", equipmentType) + .withUntypedValue(EQUIPMENT_TYPE_FIELD, equipmentType) .withUntypedValue(FIELD_NAME, fieldName) .withUntypedValue("staticId", staticId) .withSeverity(TypedValue.WARN_SEVERITY) @@ -93,7 +94,7 @@ public static void reportStaticIdUnknown(ReportNode reportNode, String fieldName public static void reportDifferentNetwork(ReportNode reportNode, String fieldName, String staticId, String equipmentType) { reportNode.newReportNode() .withMessageTemplate("wrongNetwork", "'${fieldName}' field value ${equipmentType} ${staticId} does not belong to the builder network") - .withUntypedValue("equipmentType", equipmentType) + .withUntypedValue(EQUIPMENT_TYPE_FIELD, equipmentType) .withUntypedValue(FIELD_NAME, fieldName) .withUntypedValue("staticId", staticId) .withSeverity(TypedValue.WARN_SEVERITY) @@ -103,7 +104,7 @@ public static void reportDifferentNetwork(ReportNode reportNode, String fieldNam public static void reportUnknownStaticIdHandling(ReportNode reportNode, String fieldName, String staticId, String equipmentType) { reportNode.newReportNode() .withMessageTemplate("staticIdUnknown", "'${fieldName}' field value '${staticId}' not found for equipment type(s) ${equipmentType}, id will be used as pure dynamic model id") - .withUntypedValue("equipmentType", equipmentType) + .withUntypedValue(EQUIPMENT_TYPE_FIELD, equipmentType) .withUntypedValue(FIELD_NAME, fieldName).withUntypedValue("staticId", staticId) .withSeverity(TypedValue.INFO_SEVERITY) .add(); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java index df5a77430..fcf8e9b5e 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/DynawoParametersTest.java @@ -40,6 +40,7 @@ class DynawoParametersTest extends AbstractSerDeTest { private InMemoryPlatformConfig platformConfig; @BeforeEach + @Override public void setUp() throws IOException { super.setUp(); platformConfig = new InMemoryPlatformConfig(fileSystem); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java index 047bc9442..a5f5c2ad8 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/builders/BuilderConfigTest.java @@ -22,21 +22,21 @@ */ class BuilderConfigTest { - private static Network NETWORK; - private static ModelConfigsHandler MODEL_CONFIGS_HANDLER; + private static Network network; + private static ModelConfigsHandler modelConfigsHandler; @BeforeAll static void setup() { - NETWORK = EurostagTutorialExample1Factory.create(); - MODEL_CONFIGS_HANDLER = ModelConfigsHandler.getInstance(); + network = EurostagTutorialExample1Factory.create(); + modelConfigsHandler = ModelConfigsHandler.getInstance(); } @Test void testModelBuilders() { - for (BuilderConfig builderConfig : MODEL_CONFIGS_HANDLER.getBuilderConfigs()) { + for (BuilderConfig builderConfig : modelConfigsHandler.getBuilderConfigs()) { String modelName = builderConfig.getModelInfos().iterator().next().name(); - ModelBuilder handlerBuilder = MODEL_CONFIGS_HANDLER.getModelBuilder(NETWORK, modelName, ReportNode.NO_OP); - ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(NETWORK, modelName, ReportNode.NO_OP); + ModelBuilder handlerBuilder = modelConfigsHandler.getModelBuilder(network, modelName, ReportNode.NO_OP); + ModelBuilder configBuilder = builderConfig.getBuilderConstructor().createBuilder(network, modelName, ReportNode.NO_OP); assertNotNull(handlerBuilder); assertEquals(handlerBuilder.getClass(), configBuilder.getClass()); } @@ -44,9 +44,9 @@ void testModelBuilders() { @Test void testEventBuilders() { - for (EventBuilderConfig eventBuilderConfig : MODEL_CONFIGS_HANDLER.getEventBuilderConfigs()) { - ModelBuilder handlerBuilder = MODEL_CONFIGS_HANDLER.getEventModelBuilder(NETWORK, eventBuilderConfig.getEventModelInfo().name(), ReportNode.NO_OP); - ModelBuilder configBuilder = eventBuilderConfig.getBuilderConstructor().createBuilder(NETWORK, ReportNode.NO_OP); + for (EventBuilderConfig eventBuilderConfig : modelConfigsHandler.getEventBuilderConfigs()) { + ModelBuilder handlerBuilder = modelConfigsHandler.getEventModelBuilder(network, eventBuilderConfig.getEventModelInfo().name(), ReportNode.NO_OP); + ModelBuilder configBuilder = eventBuilderConfig.getBuilderConstructor().createBuilder(network, ReportNode.NO_OP); assertNotNull(handlerBuilder); assertEquals(handlerBuilder.getClass(), configBuilder.getClass()); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java index 4e626c279..5b5a0f22d 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DisconnectHvdcEventXmlTest.java @@ -21,7 +21,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.util.function.Function; import java.util.stream.Stream; @@ -55,7 +54,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> hvdcConstructo @ParameterizedTest(name = "{0}") @MethodSource("provideModels") - void writeModel(String dydName, Function< Network, BlackBoxModel> hvdcConstructor, Function< Network, BlackBoxModel> disconnectConstructor) throws SAXException, IOException, XMLStreamException { + void writeModel(String dydName, Function< Network, BlackBoxModel> hvdcConstructor, Function< Network, BlackBoxModel> disconnectConstructor) throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java index 0f834b5a9..86695a7b9 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicOverloadManagementSystemModelXmlTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -58,7 +57,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "cla_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java index 93fb61ad1..ad05587f0 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/DynamicTwoLevelsOverloadManagementSystemModelXmlTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -40,7 +39,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "cla_tl_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java index 72c4e2ab8..c1f4d73d7 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerAutomationSystemXmlTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -41,7 +40,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "tap_changer_empty_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java index 28b342f6e..926248298 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/EmptyTapChangerBlockingAutomationSystemXmlTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -55,7 +54,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "tap_changer_blocking_empty_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java index 307cf1e72..96624d6cf 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/HvdcXmlTest.java @@ -20,7 +20,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.util.function.Function; import java.util.stream.Stream; @@ -51,7 +50,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> constructor) { @ParameterizedTest(name = "{0}") @MethodSource("provideHvdc") - void writeHvdcModel(String dydName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException, XMLStreamException { + void writeHvdcModel(String dydName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java index e937159c7..d2ca79429 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/LoadsModelXmlTest.java @@ -18,7 +18,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.util.function.Function; import java.util.stream.Stream; @@ -49,7 +48,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> loadConstructo @ParameterizedTest(name = "{0}") @MethodSource("provideLoads") - void writeLoadModel(String dydName, Function< Network, BlackBoxModel> loadConstructor) throws SAXException, IOException, XMLStreamException { + void writeLoadModel(String dydName, Function< Network, BlackBoxModel> loadConstructor) throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java index 97ee0af99..ac34e76be 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/NodeFaultEventXmlTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -37,7 +36,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "node_fault_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java index 0ae237a8d..61e8faa6c 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/OmegaRefModelXmlTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -46,7 +45,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "omega_ref_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java index 198559384..737cbf054 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/PhaseShiftersXmlTest.java @@ -20,7 +20,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.util.function.Function; import java.util.stream.Stream; @@ -58,7 +57,7 @@ protected void addDynamicModels(Function phaseShifterCon @ParameterizedTest(name = "{0}") @MethodSource("providePhaseShifter") - void writeLoadModel(String dydName, Function phaseShifterConstructor, boolean dynamicTransformer) throws SAXException, IOException, XMLStreamException { + void writeLoadModel(String dydName, Function phaseShifterConstructor, boolean dynamicTransformer) throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", dydName + ".xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java index f3df762a1..cc82f66b9 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SetPointInfiniteBusModelXmlTest.java @@ -14,7 +14,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -47,7 +46,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "set_point_inf_bus_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java index 2da682d18..68e976969 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ShuntModelXmlTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -35,7 +34,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "shunt_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java index 234865a8b..293daa8aa 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelWithSbaXmlTest.java @@ -13,7 +13,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -44,7 +43,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "svarc_sba_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java index fff96c436..83a747299 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/SvarcModelXmlTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -35,7 +34,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "svarc_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java index 4e3599733..e04f9dddc 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerAutomationSystemXmlTest.java @@ -17,7 +17,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -71,7 +70,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "tap_changer_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java index 4017d9a7f..aaa1f105e 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingAutomationSystemXmlTest.java @@ -16,7 +16,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -65,7 +64,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "tap_changer_blocking_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java index c43ddcb03..ec8e3bf3f 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TapChangerBlockingToTapChangerAutomationSystemXmlTest.java @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -31,7 +30,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "tap_changer_blocking_tap_changer_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java index 2a6d19524..6808221b1 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/TransformerModelXmlTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -35,7 +34,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); validate("dyd.xsd", "tfr_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java index 0bd32fcc8..fd79320f7 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/UnderVoltageAutomationSystemXmlTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; /** @@ -35,7 +34,7 @@ protected void addDynamicModels() { } @Test - void writeModel() throws SAXException, IOException, XMLStreamException { + void writeModel() throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "under_voltage_dyd.xml", tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java index 39ec9468a..ccd88aa58 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/WeccGenXmlTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; -import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.util.function.Function; import java.util.stream.Stream; @@ -50,7 +49,7 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> constructor) { @ParameterizedTest(name = "{0}") @MethodSource("provideWecc") - void writeModel(String dydName, String parName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException, XMLStreamException { + void writeModel(String dydName, String parName, Function< Network, BlackBoxModel> constructor) throws SAXException, IOException { DydXml.write(tmpDir, context); ParametersXml.write(tmpDir, context); validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME)); From 302bc630c8566c4c14f693454d70919e411851ed Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 11 Jul 2024 17:05:06 +0200 Subject: [PATCH 13/28] Handle load variation area in margin calculation Signed-off-by: lisrte --- .../LoadVariationAreaAutomationSystem.java | 77 ++++++++++++++++ .../MarginCalculationContext.java | 91 +++++++++++++++++++ .../security/ContingencyEventModels.java | 6 ++ .../ContingencyEventModelsHandler.java | 69 ++++++++++++++ .../security/SecurityAnalysisContext.java | 36 +++----- .../xml/LoadVariationAreaXmlTest.java | 42 +++++++++ .../dynawo/DynawoSimulationConstants.java | 6 ++ .../dynawo/DynawoSimulationContext.java | 31 ++++++- .../java/com/powsybl/dynawo/TFinModels.java | 53 +++++++++++ .../dynawo/models/AbstractBlackBoxModel.java | 7 +- .../AbstractEquipmentBlackBoxModel.java | 5 - .../AbstractPureDynamicBlackBoxModel.java | 5 - .../powsybl/dynawo/models/BlackBoxModel.java | 4 +- ...PhaseShifterBlockingIAutomationSystem.java | 5 +- .../dynawo/models/events/AbstractEvent.java | 5 +- .../models/events/ControllableEquipment.java | 8 -- .../events/ControllableEquipmentModel.java | 18 ++++ .../events/EventActivePowerVariation.java | 4 +- .../AbstractFrequencySynchronizer.java | 7 +- .../models/generators/DefaultGenerator.java | 4 +- .../SynchronizedGeneratorControllable.java | 4 +- .../SynchronousGeneratorControllable.java | 4 +- .../models/loads/BaseLoadControllable.java | 9 +- .../models/loads/ControllableLoadModel.java | 18 ++++ .../dynawo/models/loads/DefaultLoad.java | 9 +- .../AbstractXmlDynawoSimulationWriter.java | 12 +-- .../com/powsybl/dynawo/xml/CurvesXml.java | 4 +- .../powsybl/dynawo/xml/DydDataSupplier.java | 42 +++++++++ .../java/com/powsybl/dynawo/xml/DydXml.java | 46 +++++++--- .../java/com/powsybl/dynawo/xml/JobsXml.java | 4 +- .../dynawo/xml/XmlDynawoSimulationWriter.java | 21 ----- 31 files changed, 543 insertions(+), 113 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java delete mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipmentModel.java create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java delete mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java new file mode 100644 index 000000000..a80cb4357 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java @@ -0,0 +1,77 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.dynawo.DynawoSimulationConstants; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.loads.ControllableLoadModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.iidm.network.Load; + +import java.util.List; +import java.util.Objects; +import java.util.function.Consumer; + +import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; +import static com.powsybl.dynawo.parameters.ParameterType.INT; + +/** + * @author Laurent Issertial {@literal } + */ +public class LoadVariationAreaAutomationSystem extends AbstractPureDynamicBlackBoxModel { + + private static final String ID = "LOAD_VARIATION_AREA"; + private static final String PAR_ID = "loadVarArea"; + private static final String LIB = "DYNModelVariationArea"; + + private final List loads; + private final double loadIncreaseStartTime; + private final double loadIncreaseStopTime; + + + public LoadVariationAreaAutomationSystem(List loads, double loadIncreaseStartTime, double loadIncreaseStopTime) { + super(ID, PAR_ID, LIB); + this.loads = Objects.requireNonNull(loads); + this.loadIncreaseStartTime = loadIncreaseStartTime; + this.loadIncreaseStopTime = loadIncreaseStopTime; + } + + @Override + public void createMacroConnections(MacroConnectionsAdder adder) { + int index = 0; + for (Load load : loads) { + adder.createMacroConnections(this, load, ControllableLoadModel.class, this::getVarConnectionsWith, MacroConnectAttribute.ofIndex1(index)); + index++; + } + } + + private List getVarConnectionsWith(ControllableLoadModel connected) { + return List.of(new VarConnection("DeltaPc_load_@INDEX@", connected.getDeltaPVarName()), + new VarConnection("DeltaQc_load_@INDEX@", connected.getDeltaQVarName())); + } + + @Override + public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { + ParametersSet paramSet = new ParametersSet(getParameterSetId()); + paramSet.addParameter("nbLoads", INT, String.valueOf(loads.size())); + paramSet.addParameter("startTime", DOUBLE, String.valueOf(loadIncreaseStartTime)); + paramSet.addParameter("stopTime", DOUBLE, String.valueOf(loadIncreaseStopTime)); + //TODO calc delta + int index = 0; + for (Load load : loads) { + paramSet.addParameter("deltaP_load_" + index, DOUBLE, String.valueOf(1)); + paramSet.addParameter("deltaQ_load_" + index, DOUBLE, String.valueOf(1)); + index++; + } + parametersAdder.accept(paramSet); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java new file mode 100644 index 000000000..99c42147e --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -0,0 +1,91 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.contingency.Contingency; +import com.powsybl.dynawo.DynawoSimulationConstants; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.security.ContingencyEventModelsHandler; +import com.powsybl.dynawo.xml.DydDataSupplier; +import com.powsybl.iidm.network.Network; +import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; + +import java.util.*; + +/** + * @author Laurent Issertial + */ +public class MarginCalculationContext extends DynawoSimulationContext { + + private final List contingencies; + private final List contingencyEventModels; + private final LoadVariationAreaAutomationSystem loadVariationArea; + private final List loadVariationMacroConnectList = new ArrayList<>(); + private final Map loadVariationMacroConnectorsMap = new LinkedHashMap<>(); + + public MarginCalculationContext(Network network, String workingVariantId, + List dynamicModels, + DynamicSecurityAnalysisParameters parameters, + DynawoSimulationParameters dynawoSimulationParameters, + List contingencies) { + super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), + parameters.getDynamicSimulationParameters(), dynawoSimulationParameters); + double contingenciesStartTime = parameters.getDynamicContingenciesParameters().getContingenciesStartTime(); + + this.contingencies = contingencies; + this.contingencyEventModels = ContingencyEventModelsHandler.createFrom(contingencies, this, contingenciesStartTime).getContingencyEventModels(); + this.loadVariationArea = new LoadVariationAreaAutomationSystem(List.of(), 10, 20); + + macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); + macroConnectionsAdder.setMacroConnectAdder(loadVariationMacroConnectList::add); + loadVariationArea.createMacroConnections(macroConnectionsAdder); + loadVariationArea.createDynamicModelParameters(this, getDynamicModelsParameters()::add); + } + + private static void splitDynamicModels(List dynamicModels) { + + } + + public List getContingencies() { + return contingencies; + } + + public List getContingencyEventModels() { + return contingencyEventModels; + } + + public DydDataSupplier getLoadVariationAreaDydData() { + return new DydDataSupplier() { + + @Override + public List getBlackBoxDynamicModels() { + return List.of(loadVariationArea); + } + + @Override + public Collection getMacroConnectors() { + return loadVariationMacroConnectorsMap.values(); + } + + @Override + public List getMacroConnectList() { + return loadVariationMacroConnectList; + } + + @Override + public String getParFileName() { + return DynawoSimulationConstants.getSimulationParFile(getNetwork()); + } + }; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java index 4c06a7b5f..be7f81a18 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java @@ -13,6 +13,8 @@ import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.parameters.ParametersSet; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,6 +25,10 @@ public record ContingencyEventModels(Contingency contingency, List macroConnectorsMap, List macroConnectList, List eventParameters) { + public ContingencyEventModels(Contingency contingency, List eventModels) { + this(contingency, eventModels, new HashMap<>(), new ArrayList<>(), new ArrayList<>(eventModels.size())); + } + public String getId() { return contingency.getId(); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java new file mode 100644 index 000000000..747dd9af3 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java @@ -0,0 +1,69 @@ +/** + * 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.dynawo.security; + +import com.powsybl.commons.PowsyblException; +import com.powsybl.contingency.Contingency; +import com.powsybl.contingency.ContingencyElement; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.events.ContextDependentEvent; +import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author Laurent Issertial + */ +public class ContingencyEventModelsHandler { + + private final List contingencyEventModels; + + public static ContingencyEventModelsHandler createFrom(List contingencies, DynawoSimulationContext context, double contingenciesStartTime) { + List contingencyEventModels = contingencies.stream() + .map(c -> { + ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() + .map(ce -> createContingencyEventModel(ce, context, contingenciesStartTime)) + .toList()); + // Set Contingencies connections and parameters + //TODO add getter + context.macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); + context.macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); + cem.eventModels().forEach(em -> { + em.createMacroConnections(context.macroConnectionsAdder); + em.createDynamicModelParameters(context, cem.eventParameters()::add); + }); + return cem; + }) + .collect(Collectors.toList()); + return new ContingencyEventModelsHandler(contingencyEventModels); + } + + private ContingencyEventModelsHandler(List contingencyEventModels) { + this.contingencyEventModels = contingencyEventModels; + } + + private static BlackBoxModel createContingencyEventModel(ContingencyElement element, DynawoSimulationContext context, double contingenciesStartTime) { + BlackBoxModel bbm = EventDisconnectionBuilder.of(context.getNetwork()) + .staticId(element.getId()) + .startTime(contingenciesStartTime) + .build(); + if (bbm == null) { + throw new PowsyblException("Contingency element " + element.getType() + " not supported"); + } + if (bbm instanceof ContextDependentEvent cde) { + cde.setEquipmentHasDynamicModel(context); + } + return bbm; + } + + public List getContingencyEventModels() { + return contingencyEventModels; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index 263faf9cb..3b507acba 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -15,9 +15,6 @@ import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.events.ContextDependentEvent; import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawo.models.macroconnections.MacroConnect; -import com.powsybl.dynawo.models.macroconnections.MacroConnector; -import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.iidm.network.Network; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; @@ -43,25 +40,17 @@ public SecurityAnalysisContext(Network network, String workingVariantId, this.contingencies = contingencies; this.contingencyEventModels = contingencies.stream() .map(c -> { - List contEventModels = c.getElements().stream() - .map(ce -> { - BlackBoxModel bbm = this.createContingencyEventModel(ce, contingenciesStartTime); - if (bbm instanceof ContextDependentEvent cde) { - cde.setEquipmentHasDynamicModel(this); - } - return bbm; - }) - .collect(Collectors.toList()); - Map macroConnectorsMap = new HashMap<>(); - List macroConnects = new ArrayList<>(); - List parametersSets = new ArrayList<>(contEventModels.size()); - macroConnectionsAdder.setMacroConnectorAdder(macroConnectorsMap::computeIfAbsent); - macroConnectionsAdder.setMacroConnectAdder(macroConnects::add); - for (BlackBoxModel bbm : contEventModels) { - bbm.createMacroConnections(macroConnectionsAdder); - bbm.createDynamicModelParameters(this, parametersSets::add); - } - return new ContingencyEventModels(c, contEventModels, macroConnectorsMap, macroConnects, parametersSets); + ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() + .map(ce -> createContingencyEventModel(ce, contingenciesStartTime)) + .toList()); + // Set Contingencies connections and parameters + macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); + macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); + cem.eventModels().forEach(em -> { + em.createMacroConnections(macroConnectionsAdder); + em.createDynamicModelParameters(this, cem.eventParameters()::add); + }); + return cem; }) .collect(Collectors.toList()); } @@ -74,6 +63,9 @@ private BlackBoxModel createContingencyEventModel(ContingencyElement element, do if (bbm == null) { throw new PowsyblException("Contingency element " + element.getType() + " not supported"); } + if (bbm instanceof ContextDependentEvent cde) { + cde.setEquipmentHasDynamicModel(this); + } return bbm; } diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java new file mode 100644 index 000000000..091a7a7a4 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -0,0 +1,42 @@ +/** + * 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.dynawo.security.margincalculation.xml; + +import com.powsybl.dynamicsimulation.DynamicSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.DynawoTestUtil; +import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.util.Collections; + +/** + * @author Laurent Issertial + */ +class LoadVariationAreaXmlTest extends DynawoTestUtil { + + @Test + void writeDyd() throws SAXException, IOException { + DynamicSecurityAnalysisParameters parameters = DynamicSecurityAnalysisParameters.load(); + parameters.setDynamicSimulationParameters(new DynamicSimulationParameters(0, 20)); + parameters.setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(10)); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + MarginCalculationContext context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, Collections.emptyList()); + + DydXml.write(tmpDir, context.getLoadVariationAreaDydData()); + ParametersXml.write(tmpDir, context); + validate("dyd.xsd", "LOAD_VARIATION_AREA.xml", tmpDir.resolve("LOAD_VARIATION_AREA.dyd")); + validate("parameters.xsd", "omega_ref.xml", tmpDir.resolve(context.getSimulationParFile())); + } + +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java index b821f29c8..dff52cd35 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java @@ -7,6 +7,8 @@ */ package com.powsybl.dynawo; +import com.powsybl.iidm.network.Network; + /** * @author Laurent Issertial */ @@ -17,4 +19,8 @@ private DynawoSimulationConstants() { public static final String OUTPUTS_FOLDER = "outputs"; public static final String FINAL_STATE_FOLDER = "finalState"; + + public static String getSimulationParFile(Network network) { + return network.getId() + ".par"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 3eda357c6..cec3fe3cc 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -26,6 +26,7 @@ import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.DydDataSupplier; import com.powsybl.dynawo.xml.MacroStaticReference; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.Network; @@ -42,7 +43,7 @@ * @author Marcos de Miguel {@literal } * @author Laurent Issertial {@literal } */ -public class DynawoSimulationContext { +public class DynawoSimulationContext implements DydDataSupplier { protected static final Logger LOGGER = LoggerFactory.getLogger(DynawoSimulationContext.class); private static final String MODEL_ID_EXCEPTION = "The model identified by the static id %s does not match the expected model (%s)"; @@ -62,7 +63,8 @@ public class DynawoSimulationContext { private final DefaultModelsHandler defaultModelsHandler = new DefaultModelsHandler(); private final FrequencySynchronizerModel frequencySynchronizer; private final List dynamicModelsParameters = new ArrayList<>(); - protected final MacroConnectionsAdder macroConnectionsAdder; + public final MacroConnectionsAdder macroConnectionsAdder; + private TFinModels tFinModels; public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { @@ -71,6 +73,13 @@ public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, ReportNode reportNode) { + this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, null, reportNode); + + } + + public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, + List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, + Predicate tFinModelsPredicate, ReportNode reportNode) { ReportNode contextReportNode = DynawoSimulationReports.createDynawoSimulationContextReportNode(reportNode); this.network = Objects.requireNonNull(network); @@ -80,9 +89,16 @@ public DynawoSimulationContext(Network network, String workingVariantId, List uniqueIdsDynamicModels = Objects.requireNonNull(dynamicModels).stream() .filter(distinctByDynamicId(contextReportNode).and(distinctByStaticId(contextReportNode))); - this.dynamicModels = dynawoSimulationParameters.isUseModelSimplifiers() - ? simplifyModels(uniqueIdsDynamicModels, contextReportNode).toList() - : uniqueIdsDynamicModels.toList(); + if (dynawoSimulationParameters.isUseModelSimplifiers()) { + uniqueIdsDynamicModels = simplifyModels(uniqueIdsDynamicModels, contextReportNode); + } + if (tFinModelsPredicate != null) { + Map> splitModels = uniqueIdsDynamicModels.collect(Collectors.partitioningBy(tFinModelsPredicate)); + this.dynamicModels = splitModels.get(false); + this.tFinModels = new TFinModels(splitModels.get(true)); + } else { + this.dynamicModels = uniqueIdsDynamicModels.toList(); + } this.eventModels = Objects.requireNonNull(eventModels).stream() .filter(distinctByDynamicId(contextReportNode)) @@ -158,6 +174,7 @@ public DynawoSimulationParameters getDynawoSimulationParameters() { return dynawoSimulationParameters; } + @Override public Collection getMacroStaticReferences() { return macroStaticReferences.values(); } @@ -228,10 +245,12 @@ public boolean hasDynamicModel(Identifiable equipment) { return staticIdBlackBoxModelMap.containsKey(equipment.getId()); } + @Override public List getMacroConnectList() { return macroConnectList; } + @Override public Collection getMacroConnectors() { return macroConnectorsMap.values(); } @@ -248,6 +267,7 @@ public Stream getBlackBoxDynamicModelStream() { return Stream.concat(getInputBlackBoxDynamicModelStream(), Stream.of(frequencySynchronizer)); } + @Override public List getBlackBoxDynamicModels() { return getBlackBoxDynamicModelStream().toList(); } @@ -256,6 +276,7 @@ public Stream getBlackBoxEventModelStream() { return eventModels.stream(); } + @Override public List getBlackBoxEventModels() { return eventModels; } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java new file mode 100644 index 000000000..c409d4703 --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java @@ -0,0 +1,53 @@ +/** + * 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.dynawo; + +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.xml.DydDataSupplier; +import com.powsybl.dynawo.xml.MacroStaticReference; + +import java.util.*; + +/** + * @author Laurent Issertial {@literal } + */ +public class TFinModels implements DydDataSupplier { + + private final List dynamicModels; + //TODO check duplicate + private final Map macroStaticReferences = new LinkedHashMap<>(); + private final List macroConnectList = new ArrayList<>(); + private final Map macroConnectorsMap = new LinkedHashMap<>(); + + + public TFinModels(List dynamicModels) { + this.dynamicModels = dynamicModels; + } + + @Override + public List getBlackBoxDynamicModels() { + return dynamicModels; + } + + @Override + public Collection getMacroConnectors() { + return macroConnectorsMap.values(); + } + + @Override + public Collection getMacroStaticReferences() { + return macroStaticReferences.values(); + } + + @Override + public List getMacroConnectList() { + return macroConnectList; + } +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java index b6d55d3cc..a26e6a5a7 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java @@ -77,7 +77,12 @@ public List getMacroConnectToAttributes() { } @Override - public String getParFile(DynawoSimulationContext context) { + public void write(XMLStreamWriter writer) throws XMLStreamException { + write(writer, getDefaultParFile()); + } + + @Override + public String getDefaultParFile() { return DynawoSimulationParameters.MODELS_OUTPUT_PARAMETERS_FILE; } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java index b01c67fa6..320d04912 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java @@ -40,11 +40,6 @@ public T getEquipment() { return equipment; } - @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { - write(writer, getParFile(context)); - } - @Override public void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException { boolean hasVarMapping = !getVarsMapping().isEmpty(); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java index 684388c1e..0c6a0f1f5 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java @@ -36,11 +36,6 @@ public final List getVarsMapping() { return Collections.emptyList(); } - @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { - write(writer, getParFile(context)); - } - @Override public void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "blackBoxModel"); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java index 97d5ee674..4a425f790 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/BlackBoxModel.java @@ -33,9 +33,9 @@ public interface BlackBoxModel extends Model { List getMacroConnectFromAttributes(); - String getParFile(DynawoSimulationContext context); + String getDefaultParFile(); - void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException; + void write(XMLStreamWriter writer) throws XMLStreamException; void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java index 7230382d7..d5d5cf634 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationReports; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.models.VarConnection; @@ -54,9 +53,9 @@ protected List getVarConnectionsWith(TransformerModel connected) } @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer) throws XMLStreamException { if (isConnected) { - super.write(writer, context); + super.write(writer); } } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java index 2a6845421..194776e74 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java @@ -8,6 +8,7 @@ package com.powsybl.dynawo.models.events; import com.powsybl.dynamicsimulation.EventModel; +import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.parameters.ParametersSet; @@ -40,8 +41,8 @@ public double getStartTime() { } @Override - public String getParFile(DynawoSimulationContext context) { - return context.getSimulationParFile(); + public String getDefaultParFile() { + return DynawoSimulationConstants.getSimulationParFile(getEquipment().getNetwork()); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java deleted file mode 100644 index dc76a2853..000000000 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipment.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.powsybl.dynawo.models.events; - -import com.powsybl.dynawo.models.Model; - -public interface ControllableEquipment extends Model { - - String getDeltaPVarName(); -} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipmentModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipmentModel.java new file mode 100644 index 000000000..106e34f6d --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/ControllableEquipmentModel.java @@ -0,0 +1,18 @@ +/** + * 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.dynawo.models.events; + +import com.powsybl.dynawo.models.Model; + +/** + * @author Laurent Issertial {@literal } + */ +public interface ControllableEquipmentModel extends Model { + + String getDeltaPVarName(); +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java index d58b4187f..55c3dae14 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventActivePowerVariation.java @@ -53,7 +53,7 @@ public String getName() { return EventActivePowerVariation.class.getSimpleName(); } - private List getVarConnectionsWith(ControllableEquipment connected) { + private List getVarConnectionsWith(ControllableEquipmentModel connected) { return List.of(TRUE == equipmentHasDynamicModel.getValue() ? new VarConnection("step_step_value", connected.getDeltaPVarName()) : new VarConnection("event_state1", connected.getDeltaPVarName())); } @@ -62,7 +62,7 @@ private List getVarConnectionsWith(ControllableEquipment connecte public void createMacroConnections(MacroConnectionsAdder adder) { adder.createMacroConnections(this, getEquipment(), - ControllableEquipment.class, + ControllableEquipmentModel.class, this::getVarConnectionsWith); } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java index 6e0d5e1ec..0abea235f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java @@ -7,6 +7,7 @@ */ package com.powsybl.dynawo.models.frequencysynchronizers; +import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; @@ -20,6 +21,8 @@ public abstract class AbstractFrequencySynchronizer extends AbstractPureDynamicB private static final String FREQUENCY_SYNCHRONIZER_ID = "FREQ_SYNC"; private static final String FREQUENCY_SYNCHRONIZER_PARAMETER_SET_ID = "FREQ_SYNC_PAR"; protected final List synchronizedEquipments; + //TODO fix with proper value + private final String defaultParFile = "AA"; protected AbstractFrequencySynchronizer(List synchronizedEquipments, String lib) { super(FREQUENCY_SYNCHRONIZER_ID, FREQUENCY_SYNCHRONIZER_PARAMETER_SET_ID, lib); @@ -32,7 +35,7 @@ public boolean isEmpty() { } @Override - public String getParFile(DynawoSimulationContext context) { - return context.getSimulationParFile(); + public String getDefaultParFile() { + return defaultParFile; } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java index 54d001179..20777b8fa 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java @@ -8,12 +8,12 @@ package com.powsybl.dynawo.models.generators; import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; /** * @author Laurent Issertial {@literal } */ -public class DefaultGenerator extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipment { +public class DefaultGenerator extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipmentModel { public DefaultGenerator(String staticId) { super(staticId); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java index a1ac5e984..66629bf23 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java @@ -7,13 +7,13 @@ */ package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Generator; /** * @author Laurent Issertial {@literal } */ -public class SynchronizedGeneratorControllable extends SynchronizedGenerator implements ControllableEquipment { +public class SynchronizedGeneratorControllable extends SynchronizedGenerator implements ControllableEquipmentModel { protected SynchronizedGeneratorControllable(String dynamicModelId, Generator generator, String parameterSetId, String generatorLib) { super(dynamicModelId, generator, parameterSetId, generatorLib); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java index 53dea8a81..288c7a6fc 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java @@ -7,13 +7,13 @@ */ package com.powsybl.dynawo.models.generators; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Generator; /** * @author Laurent Issertial {@literal } */ -public class SynchronousGeneratorControllable extends SynchronousGenerator implements ControllableEquipment { +public class SynchronousGeneratorControllable extends SynchronousGenerator implements ControllableEquipmentModel { protected SynchronousGeneratorControllable(String dynamicModelId, Generator generator, String parameterSetId, String generatorLib, EnumGeneratorComponent generatorComponent) { super(dynamicModelId, generator, parameterSetId, generatorLib, generatorComponent); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java index 2b4fb4772..84076cc67 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java @@ -7,13 +7,13 @@ */ package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Load; /** * @author Laurent Issertial {@literal } */ -public class BaseLoadControllable extends BaseLoad implements ControllableEquipment { +public class BaseLoadControllable extends BaseLoad implements ControllableLoadModel { protected BaseLoadControllable(String dynamicModelId, Load load, String parameterSetId, String lib) { super(dynamicModelId, load, parameterSetId, lib); @@ -23,4 +23,9 @@ protected BaseLoadControllable(String dynamicModelId, Load load, String paramete public String getDeltaPVarName() { return "load_deltaP"; } + + @Override + public String getDeltaQVarName() { + return "load_deltaQ"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java new file mode 100644 index 000000000..be14f832c --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java @@ -0,0 +1,18 @@ +/** + * 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.dynawo.models.loads; + +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; + +/** + * @author Laurent Issertial {@literal } + */ +public interface ControllableLoadModel extends ControllableEquipmentModel { + + String getDeltaQVarName(); +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java index 1384a52da..49c14cb6d 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java @@ -8,12 +8,12 @@ package com.powsybl.dynawo.models.loads; import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; /** * @author Laurent Issertial {@literal } */ -public class DefaultLoad extends AbstractInjectionDefaultModel implements ControllableEquipment { +public class DefaultLoad extends AbstractInjectionDefaultModel implements ControllableLoadModel { public DefaultLoad(String staticId) { super(staticId); @@ -28,4 +28,9 @@ public String getName() { public String getDeltaPVarName() { return "@NAME@_DeltaPc"; } + + @Override + public String getDeltaQVarName() { + return "@NAME@_DeltaQc"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java index e3c2478cd..a181a9c65 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java @@ -8,7 +8,6 @@ package com.powsybl.dynawo.xml; import com.powsybl.commons.exceptions.UncheckedXmlStreamException; -import com.powsybl.dynawo.DynawoSimulationContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -25,7 +24,7 @@ /** * @author Florian Dupuy {@literal } */ -public abstract class AbstractXmlDynawoSimulationWriter implements XmlDynawoSimulationWriter { +abstract class AbstractXmlDynawoSimulationWriter { private final String xmlFileName; private final String xmlRootName; @@ -35,10 +34,9 @@ protected AbstractXmlDynawoSimulationWriter(String xmlFileName, String xmlRootNa this.xmlRootName = Objects.requireNonNull(xmlRootName); } - @Override - public void createXmlFileFromContext(Path workingDir, DynawoSimulationContext context) throws IOException { + public void createXmlFileFromDataSupplier(Path workingDir, T dataSupplier) throws IOException { Objects.requireNonNull(workingDir); - Objects.requireNonNull(context); + Objects.requireNonNull(dataSupplier); Path file = workingDir.resolve(xmlFileName); try (Writer writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) { @@ -49,7 +47,7 @@ public void createXmlFileFromContext(Path workingDir, DynawoSimulationContext co xmlWriter.writeStartElement(DYN_URI, xmlRootName); xmlWriter.writeNamespace(DYN_PREFIX, DYN_URI); - write(xmlWriter, context); + write(xmlWriter, dataSupplier); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); @@ -61,5 +59,5 @@ public void createXmlFileFromContext(Path workingDir, DynawoSimulationContext co } } - abstract void write(XMLStreamWriter writer, DynawoSimulationContext dynawoSimulationContext) throws XMLStreamException; + abstract void write(XMLStreamWriter writer, T dataSupplier) throws XMLStreamException; } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java index bb45bee41..820ff91fb 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/CurvesXml.java @@ -20,14 +20,14 @@ /** * @author Marcos de Miguel {@literal } */ -public final class CurvesXml extends AbstractXmlDynawoSimulationWriter { +public final class CurvesXml extends AbstractXmlDynawoSimulationWriter { private CurvesXml() { super(CRV_FILENAME, "curvesInput"); } public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { - new CurvesXml().createXmlFileFromContext(workingDir, context); + new CurvesXml().createXmlFileFromDataSupplier(workingDir, context); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java new file mode 100644 index 000000000..434e6daf6 --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java @@ -0,0 +1,42 @@ +/** + * 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.dynawo.xml; + +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +/** + * @author Laurent Issertial + */ +public interface DydDataSupplier { + + default List getBlackBoxDynamicModels() { + return Collections.emptyList(); + } + + default List getBlackBoxEventModels() { + return Collections.emptyList(); + } + + Collection getMacroConnectors(); + + default Collection getMacroStaticReferences() { + return Collections.emptySet(); + } + + List getMacroConnectList(); + + default String getParFileName() { + return null; + } +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java index 79ede7cd3..42321f16c 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java @@ -7,7 +7,6 @@ package com.powsybl.dynawo.xml; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; @@ -22,32 +21,51 @@ /** * @author Mathieu Bague {@literal } */ -public final class DydXml extends AbstractXmlDynawoSimulationWriter { +public final class DydXml extends AbstractXmlDynawoSimulationWriter { + + private DydXml(String fileName) { + super(fileName, "dynamicModelsArchitecture"); + } private DydXml() { - super(DYD_FILENAME, "dynamicModelsArchitecture"); + this(DYD_FILENAME); } - public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { - new DydXml().createXmlFileFromContext(workingDir, context); + public static void write(Path workingDir, DydDataSupplier dataSupplier) throws IOException { + new DydXml().createXmlFileFromDataSupplier(workingDir, dataSupplier); + } + + public static void write(Path workingDir, String fileName, DydDataSupplier dataSupplier) throws IOException { + new DydXml(fileName).createXmlFileFromDataSupplier(workingDir, dataSupplier); } @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DydDataSupplier dataSupplier) throws XMLStreamException { // loop over the values of the map indexed by dynamicIds to write only once objects with the same dynamicId - for (BlackBoxModel model : context.getBlackBoxDynamicModels()) { - model.write(writer, context); - } - for (BlackBoxModel model : context.getBlackBoxEventModels()) { - model.write(writer, context); + String parFileName = dataSupplier.getParFileName(); + //TODO merge all models in one parameter file ? + if (parFileName == null || parFileName.isEmpty()) { + for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { + model.write(writer); + } + for (BlackBoxModel model : dataSupplier.getBlackBoxEventModels()) { + model.write(writer); + } + } else { + for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { + model.write(writer, dataSupplier.getParFileName()); + } + for (BlackBoxModel model : dataSupplier.getBlackBoxEventModels()) { + model.write(writer, dataSupplier.getParFileName()); + } } - for (MacroConnector macroConnector : context.getMacroConnectors()) { + for (MacroConnector macroConnector : dataSupplier.getMacroConnectors()) { macroConnector.write(writer); } - for (MacroStaticReference macroStaticReference : context.getMacroStaticReferences()) { + for (MacroStaticReference macroStaticReference : dataSupplier.getMacroStaticReferences()) { macroStaticReference.write(writer); } - for (MacroConnect macroConnect : context.getMacroConnectList()) { + for (MacroConnect macroConnect : dataSupplier.getMacroConnectList()) { macroConnect.write(writer); } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java index 148a62908..38dbab484 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java @@ -22,14 +22,14 @@ /** * @author Marcos de Miguel {@literal } */ -public final class JobsXml extends AbstractXmlDynawoSimulationWriter { +public final class JobsXml extends AbstractXmlDynawoSimulationWriter { private JobsXml() { super(JOBS_FILENAME, "jobs"); } public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { - new JobsXml().createXmlFileFromContext(workingDir, context); + new JobsXml().createXmlFileFromDataSupplier(workingDir, context); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java deleted file mode 100644 index 34d10b845..000000000 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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.dynawo.xml; - -import com.powsybl.dynawo.DynawoSimulationContext; - -import java.io.IOException; -import java.nio.file.Path; - -/** - * @author Florian Dupuy {@literal } - */ -@FunctionalInterface -public interface XmlDynawoSimulationWriter { - void createXmlFileFromContext(Path workingDir, DynawoSimulationContext context) throws IOException; -} From 172037356e3c24bae4d356c0a16deb3d8e45c8d5 Mon Sep 17 00:00:00 2001 From: lisrte Date: Fri, 12 Jul 2024 16:27:55 +0200 Subject: [PATCH 14/28] Phase 2 in DynawoSimulationContext Signed-off-by: lisrte --- .../LoadVariationAreaAutomationSystem.java | 2 - .../MarginCalculationContext.java | 2 +- .../xml/MarginCalculationConstant.java | 19 +++++ .../ContingencyEventModelsHandler.java | 2 +- .../DynawoSecurityAnalysisHandler.java | 4 +- .../xml/LoadVariationAreaXmlTest.java | 8 +- .../resources/load_variation_area_dyd.xml | 4 + .../dynawo/DynawoSimulationConstants.java | 26 ------- .../dynawo/DynawoSimulationContext.java | 43 ++++++++-- .../dynawo/DynawoSimulationHandler.java | 4 +- .../{TFinModels.java => Phase2Models.java} | 21 ++++- .../AbstractEquipmentBlackBoxModel.java | 1 - .../AbstractPureDynamicBlackBoxModel.java | 2 - .../dynawo/models/events/AbstractEvent.java | 2 +- .../AbstractFrequencySynchronizer.java | 8 +- .../frequencysynchronizers/OmegaRef.java | 4 +- .../frequencysynchronizers/SetPoint.java | 4 +- .../models/loads/BaseLoadControllable.java | 1 - .../dynawo/models/loads/DefaultLoad.java | 1 - .../powsybl/dynawo/xml/DydDataSupplier.java | 2 +- .../java/com/powsybl/dynawo/xml/DydXml.java | 2 +- .../dynawo/xml/DynawoSimulationConstants.java | 12 +++ .../java/com/powsybl/dynawo/xml/JobsXml.java | 19 ++++- ...stractParametrizedDynamicModelXmlTest.java | 9 ++- .../dynawo/xml/ContextPhase2XmlTest.java | 78 +++++++++++++++++++ .../com/powsybl/dynawo/xml/JobsXmlTest.java | 10 +++ .../src/test/resources/jobsWithPhase2.xml | 23 ++++++ .../test/resources/no_loads_phase_1_dyd.xml | 8 ++ .../test/resources/no_loads_phase_2_dyd.xml | 20 +++++ .../resources/specific_load_phase_1_dyd.xml | 21 +++++ .../resources/specific_load_phase_2_dyd.xml | 7 ++ 31 files changed, 300 insertions(+), 69 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MarginCalculationConstant.java create mode 100644 dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml delete mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java rename dynawo-simulation/src/main/java/com/powsybl/dynawo/{TFinModels.java => Phase2Models.java} (60%) create mode 100644 dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java create mode 100644 dynawo-simulation/src/test/resources/jobsWithPhase2.xml create mode 100644 dynawo-simulation/src/test/resources/no_loads_phase_1_dyd.xml create mode 100644 dynawo-simulation/src/test/resources/no_loads_phase_2_dyd.xml create mode 100644 dynawo-simulation/src/test/resources/specific_load_phase_1_dyd.xml create mode 100644 dynawo-simulation/src/test/resources/specific_load_phase_2_dyd.xml diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java index a80cb4357..d4f649c32 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.margincalculation; -import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.models.VarConnection; @@ -37,7 +36,6 @@ public class LoadVariationAreaAutomationSystem extends AbstractPureDynamicBlackB private final double loadIncreaseStartTime; private final double loadIncreaseStopTime; - public LoadVariationAreaAutomationSystem(List loads, double loadIncreaseStartTime, double loadIncreaseStopTime) { super(ID, PAR_ID, LIB); this.loads = Objects.requireNonNull(loads); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 99c42147e..dfe200d38 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -8,7 +8,7 @@ package com.powsybl.dynawo.margincalculation; import com.powsybl.contingency.Contingency; -import com.powsybl.dynawo.DynawoSimulationConstants; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.models.BlackBoxModel; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MarginCalculationConstant.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MarginCalculationConstant.java new file mode 100644 index 000000000..945ec7e50 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MarginCalculationConstant.java @@ -0,0 +1,19 @@ +/** + * 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.dynawo.margincalculation.xml; + +/** + * @author Laurent Issertial + */ +public final class MarginCalculationConstant { + + public static final String LOAD_VARIATION_AREA_FILENAME = "load_variation_area.dyd"; + + private MarginCalculationConstant() { + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java index 747dd9af3..247cf0c29 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java @@ -21,7 +21,7 @@ /** * @author Laurent Issertial */ -public class ContingencyEventModelsHandler { +public final class ContingencyEventModelsHandler { private final List contingencyEventModels; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java index aedb25440..2720330b0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java @@ -40,8 +40,8 @@ import java.util.List; import static com.powsybl.dynaflow.SecurityAnalysisConstants.DYNAWO_CONSTRAINTS_FOLDER; -import static com.powsybl.dynawo.DynawoSimulationConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawo.DynawoSimulationConstants.OUTPUTS_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.FINAL_STATE_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.OUTPUTS_FOLDER; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java index 091a7a7a4..f08f8e467 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.Collections; +import static com.powsybl.dynawo.margincalculation.xml.MarginCalculationConstant.LOAD_VARIATION_AREA_FILENAME; + /** * @author Laurent Issertial */ @@ -33,10 +35,10 @@ void writeDyd() throws SAXException, IOException { DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); MarginCalculationContext context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, Collections.emptyList()); - DydXml.write(tmpDir, context.getLoadVariationAreaDydData()); + DydXml.write(tmpDir, LOAD_VARIATION_AREA_FILENAME, context.getLoadVariationAreaDydData()); ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "LOAD_VARIATION_AREA.xml", tmpDir.resolve("LOAD_VARIATION_AREA.dyd")); - validate("parameters.xsd", "omega_ref.xml", tmpDir.resolve(context.getSimulationParFile())); + validate("dyd.xsd", "load_variation_area_dyd.xml", tmpDir.resolve(LOAD_VARIATION_AREA_FILENAME)); +// validate("parameters.xsd", "omega_ref.xml", tmpDir.resolve(context.getSimulationParFile())); } } diff --git a/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml b/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml new file mode 100644 index 000000000..89313437d --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml @@ -0,0 +1,4 @@ + + + + diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java deleted file mode 100644 index dff52cd35..000000000 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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.dynawo; - -import com.powsybl.iidm.network.Network; - -/** - * @author Laurent Issertial - */ -public final class DynawoSimulationConstants { - - private DynawoSimulationConstants() { - } - - public static final String OUTPUTS_FOLDER = "outputs"; - public static final String FINAL_STATE_FOLDER = "finalState"; - - public static String getSimulationParFile(Network network) { - return network.getId() + ".par"; - } -} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index cec3fe3cc..8726d4b7f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -27,6 +27,7 @@ import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.dynawo.xml.DydDataSupplier; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.xml.MacroStaticReference; import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.Network; @@ -64,13 +65,20 @@ public class DynawoSimulationContext implements DydDataSupplier { private final FrequencySynchronizerModel frequencySynchronizer; private final List dynamicModelsParameters = new ArrayList<>(); public final MacroConnectionsAdder macroConnectionsAdder; - private TFinModels tFinModels; + private Phase2Models phase2Models; public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, ReportNode.NO_OP); } + public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, + List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, + Predicate phase2ModelsPredicate) { + this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, phase2ModelsPredicate, ReportNode.NO_OP); + + } + public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, ReportNode reportNode) { this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, null, reportNode); @@ -79,7 +87,8 @@ public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, - Predicate tFinModelsPredicate, ReportNode reportNode) { + //TODO change predicate to Identifiable ? + Predicate phase2ModelsPredicate, ReportNode reportNode) { ReportNode contextReportNode = DynawoSimulationReports.createDynawoSimulationContextReportNode(reportNode); this.network = Objects.requireNonNull(network); @@ -92,10 +101,12 @@ public DynawoSimulationContext(Network network, String workingVariantId, List> splitModels = uniqueIdsDynamicModels.collect(Collectors.partitioningBy(tFinModelsPredicate)); + + List phase2DynamicModels = List.of(); + if (phase2ModelsPredicate != null) { + Map> splitModels = uniqueIdsDynamicModels.collect(Collectors.partitioningBy(phase2ModelsPredicate)); this.dynamicModels = splitModels.get(false); - this.tFinModels = new TFinModels(splitModels.get(true)); + phase2DynamicModels = splitModels.get(true); } else { this.dynamicModels = uniqueIdsDynamicModels.toList(); } @@ -118,18 +129,21 @@ public DynawoSimulationContext(Network network, String workingVariantId, List new SetPoint(m, DynawoSimulationConstants.getSimulationParFile(getNetwork())) + : m -> new OmegaRef(m, DynawoSimulationConstants.getSimulationParFile(getNetwork()))); this.macroConnectionsAdder = new MacroConnectionsAdder(this::getDynamicModel, this::getPureDynamicModel, macroConnectList::add, macroConnectorsMap::computeIfAbsent, contextReportNode); - for (BlackBoxModel bbm : getBlackBoxDynamicModelStream().toList()) { + // Write macro connection + getBlackBoxDynamicModelStream().forEach(bbm -> { macroStaticReferences.computeIfAbsent(bbm.getName(), k -> new MacroStaticReference(k, bbm.getVarsMapping())); bbm.createMacroConnections(macroConnectionsAdder); bbm.createDynamicModelParameters(this, dynamicModelsParameters::add); - } + }); ParametersSet networkParameters = getDynawoSimulationParameters().getNetworkParameters(); for (BlackBoxModel bbem : eventModels) { @@ -137,6 +151,14 @@ public DynawoSimulationContext(Network network, String workingVariantId, List !macroStaticReferences.containsKey(bbm.getName()), + n -> !macroConnectorsMap.containsKey(n)); + phase2Models.getBlackBoxDynamicModels().forEach(bbm -> bbm.createDynamicModelParameters(this, dynamicModelsParameters::add)); + } } private Stream simplifyModels(Stream inputBbm, ReportNode reportNode) { @@ -293,7 +315,12 @@ public List getDynamicModelsParameters() { return dynamicModelsParameters; } + //TODO remove ? public String getSimulationParFile() { return getNetwork().getId() + ".par"; } + + public Optional getPhase2DydData() { + return Optional.ofNullable(phase2Models); + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java index 4f1612965..e517c483e 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationHandler.java @@ -44,8 +44,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static com.powsybl.dynawo.DynawoSimulationConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawo.DynawoSimulationConstants.OUTPUTS_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.FINAL_STATE_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.OUTPUTS_FOLDER; import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Models.java similarity index 60% rename from dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Models.java index c409d4703..7410b953d 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/TFinModels.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Models.java @@ -9,26 +9,39 @@ import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.xml.DydDataSupplier; import com.powsybl.dynawo.xml.MacroStaticReference; import java.util.*; +import java.util.function.Predicate; /** * @author Laurent Issertial {@literal } */ -public class TFinModels implements DydDataSupplier { +public class Phase2Models implements DydDataSupplier { private final List dynamicModels; - //TODO check duplicate private final Map macroStaticReferences = new LinkedHashMap<>(); private final List macroConnectList = new ArrayList<>(); private final Map macroConnectorsMap = new LinkedHashMap<>(); - - public TFinModels(List dynamicModels) { + public Phase2Models(List dynamicModels, MacroConnectionsAdder macroConnectionsAdder, + Predicate macroStaticDuplicatePredicate, Predicate macroConnectorDuplicatePredicate) { this.dynamicModels = dynamicModels; + macroConnectionsAdder.setMacroConnectorAdder((n, f) -> { + if (macroConnectorDuplicatePredicate.test(n)) { + macroConnectorsMap.computeIfAbsent(n, f); + } + }); + macroConnectionsAdder.setMacroConnectAdder(macroConnectList::add); + for (BlackBoxModel bbm : dynamicModels) { + if (macroStaticDuplicatePredicate.test(bbm)) { + macroStaticReferences.computeIfAbsent(bbm.getName(), k -> new MacroStaticReference(k, bbm.getVarsMapping())); + } + bbm.createMacroConnections(macroConnectionsAdder); + } } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java index 320d04912..218d1c28c 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractEquipmentBlackBoxModel.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.models; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.xml.MacroStaticReference; import com.powsybl.iidm.network.Identifiable; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java index 0c6a0f1f5..d1f470105 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractPureDynamicBlackBoxModel.java @@ -6,8 +6,6 @@ */ package com.powsybl.dynawo.models; -import com.powsybl.dynawo.DynawoSimulationContext; - import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Collections; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java index 194776e74..8759704d8 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java @@ -8,10 +8,10 @@ package com.powsybl.dynawo.models.events; import com.powsybl.dynamicsimulation.EventModel; -import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.iidm.network.Identifiable; import java.util.function.Consumer; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java index 0abea235f..a7f9b91ed 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java @@ -7,8 +7,6 @@ */ package com.powsybl.dynawo.models.frequencysynchronizers; -import com.powsybl.dynawo.DynawoSimulationConstants; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import java.util.List; @@ -21,12 +19,12 @@ public abstract class AbstractFrequencySynchronizer extends AbstractPureDynamicB private static final String FREQUENCY_SYNCHRONIZER_ID = "FREQ_SYNC"; private static final String FREQUENCY_SYNCHRONIZER_PARAMETER_SET_ID = "FREQ_SYNC_PAR"; protected final List synchronizedEquipments; - //TODO fix with proper value - private final String defaultParFile = "AA"; + private final String defaultParFile; - protected AbstractFrequencySynchronizer(List synchronizedEquipments, String lib) { + protected AbstractFrequencySynchronizer(List synchronizedEquipments, String lib, String defaultParFile) { super(FREQUENCY_SYNCHRONIZER_ID, FREQUENCY_SYNCHRONIZER_PARAMETER_SET_ID, lib); this.synchronizedEquipments = synchronizedEquipments; + this.defaultParFile = defaultParFile; } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java index a631dfecd..b0975c6e0 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java @@ -34,8 +34,8 @@ */ public class OmegaRef extends AbstractFrequencySynchronizer { - public OmegaRef(List synchronizedEquipments) { - super(synchronizedEquipments, "DYNModelOmegaRef"); + public OmegaRef(List synchronizedEquipments, String defaultParFile) { + super(synchronizedEquipments, "DYNModelOmegaRef", defaultParFile); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java index 2f156c1de..55b585d28 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java @@ -25,8 +25,8 @@ */ public class SetPoint extends AbstractFrequencySynchronizer { - public SetPoint(List synchronizedEquipments) { - super(synchronizedEquipments, "SetPoint"); + public SetPoint(List synchronizedEquipments, String defaultParFile) { + super(synchronizedEquipments, "SetPoint", defaultParFile); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java index 84076cc67..2a3731ee4 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.models.loads; -import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Load; /** diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java index 49c14cb6d..70a76de40 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java @@ -8,7 +8,6 @@ package com.powsybl.dynawo.models.loads; import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawo.models.events.ControllableEquipmentModel; /** * @author Laurent Issertial {@literal } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java index 434e6daf6..df5878dfe 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydDataSupplier.java @@ -31,7 +31,7 @@ default List getBlackBoxEventModels() { Collection getMacroConnectors(); default Collection getMacroStaticReferences() { - return Collections.emptySet(); + return Collections.emptySet(); } List getMacroConnectList(); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java index 42321f16c..c09d84b59 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java @@ -42,7 +42,7 @@ public static void write(Path workingDir, String fileName, DydDataSupplier dataS @Override public void write(XMLStreamWriter writer, DydDataSupplier dataSupplier) throws XMLStreamException { // loop over the values of the map indexed by dynamicIds to write only once objects with the same dynamicId - String parFileName = dataSupplier.getParFileName(); + String parFileName = dataSupplier.getParFileName(); //TODO merge all models in one parameter file ? if (parFileName == null || parFileName.isEmpty()) { for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java index e9f5c1e38..3eb4f0929 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java @@ -6,6 +6,8 @@ */ package com.powsybl.dynawo.xml; +import com.powsybl.iidm.network.Network; + /** * @author Marcos de Miguel {@literal } */ @@ -17,6 +19,8 @@ public final class DynawoSimulationConstants { public static final String DYD_FILENAME = "powsybl_dynawo.dyd"; + public static final String PHASE_2_DYD_FILENAME = "phase_2_powsybl_dynawo.dyd"; + public static final String CRV_FILENAME = "powsybl_dynawo.crv"; public static final String CURVES_OUTPUT_PATH = "outputs/curves"; @@ -27,6 +31,14 @@ public final class DynawoSimulationConstants { public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; + public static final String OUTPUTS_FOLDER = "outputs"; + + public static final String FINAL_STATE_FOLDER = "finalState"; + private DynawoSimulationConstants() { } + + public static String getSimulationParFile(Network network) { + return network.getId() + ".par"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java index 38dbab484..e5019b678 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java @@ -24,20 +24,31 @@ */ public final class JobsXml extends AbstractXmlDynawoSimulationWriter { + private final boolean isPhase2; + private JobsXml() { + this(false); + } + + private JobsXml(boolean isPhase2) { super(JOBS_FILENAME, "jobs"); + this.isPhase2 = isPhase2; } public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { new JobsXml().createXmlFileFromDataSupplier(workingDir, context); } + public static void writePhase2(Path workingDir, DynawoSimulationContext context) throws IOException { + new JobsXml(true).createXmlFileFromDataSupplier(workingDir, context); + } + @Override public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { writer.writeStartElement(DYN_URI, "job"); writer.writeAttribute("name", "Job"); writeSolver(writer, context); - writeModeler(writer, context); + writeModeler(writer, context, isPhase2); writeSimulation(writer, context); writeOutput(writer, context); writer.writeEndElement(); @@ -51,7 +62,7 @@ private static void writeSolver(XMLStreamWriter writer, DynawoSimulationContext writer.writeAttribute("parId", parameters.getSolverParameters().getId()); } - private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext context, boolean isPhase2) throws XMLStreamException { DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeStartElement(DYN_URI, "modeler"); writer.writeAttribute("compileDir", "outputs/compilation"); @@ -63,6 +74,10 @@ private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext writer.writeEmptyElement(DYN_URI, "dynModels"); writer.writeAttribute("dydFile", DYD_FILENAME); + if (isPhase2 && context.getPhase2DydData().isPresent()) { + writer.writeEmptyElement(DYN_URI, "dynModels"); + writer.writeAttribute("dydFile", PHASE_2_DYD_FILENAME); + } DumpFileParameters dumpFileParameters = parameters.getDumpFileParameters(); if (dumpFileParameters.useDumpFile()) { diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java index 132f04472..54ab73735 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java @@ -7,6 +7,7 @@ */ package com.powsybl.dynawo.xml; +import com.powsybl.commons.report.ReportNode; import com.powsybl.commons.test.AbstractSerDeTest; import com.powsybl.dynamicsimulation.Curve; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; @@ -29,6 +30,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.function.Predicate; import static com.powsybl.commons.test.ComparisonUtils.assertTxtEquals; @@ -56,8 +58,13 @@ public void validate(String schemaDefinition, String expectedResourceName, Path } void setupDynawoContext() { + setupDynawoContext(null); + } + + void setupDynawoContext(Predicate phase2ModelsPredicate) { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); - context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters); + context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + eventModels, curves, parameters, dynawoParameters, phase2ModelsPredicate, ReportNode.NO_OP); } } diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java new file mode 100644 index 000000000..39e638ef5 --- /dev/null +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java @@ -0,0 +1,78 @@ +/** + * 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.dynawo.xml; + +import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.DYD_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Laurent Issertial {@literal } + */ +@ExtendWith(CustomParameterResolver.class) +class ContextPhase2XmlTest extends AbstractParametrizedDynamicModelXmlTest { + + @BeforeEach + void setup(String dydName, String phase2DydName, Predicate phase2ModelsPredicate) { + setupNetwork(); + addDynamicModels(); + setupDynawoContext(phase2ModelsPredicate); + } + + protected void setupNetwork() { + network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + } + + protected void addDynamicModels() { + dynamicModels.add(BaseShuntBuilder.of(network) + .staticId("SHUNT") + .parameterSetId("sh") + .build()); + dynamicModels.add(BaseLoadBuilder.of(network) + .staticId("LOAD") + .parameterSetId("lab") + .build()); + dynamicModels.add(BaseLoadBuilder.of(network) + .staticId("LOAD2") + .parameterSetId("lab") + .build()); + } + + @ParameterizedTest(name = "{0}") + @MethodSource("provideBbm") + void writePhase2Models(String dydName, String phase2DydName, Predicate phase2ModelsPredicate) throws SAXException, IOException { + DydXml.write(tmpDir, context); + validate("dyd.xsd", dydName, tmpDir.resolve(DYD_FILENAME)); + assertThat(context.getPhase2DydData()).isPresent(); + DydXml.write(tmpDir, PHASE_2_DYD_FILENAME, context.getPhase2DydData().get()); + validate("dyd.xsd", phase2DydName, tmpDir.resolve(PHASE_2_DYD_FILENAME)); + } + + private static Stream provideBbm() { + return Stream.of( + Arguments.of("no_loads_phase_1_dyd.xml", "no_loads_phase_2_dyd.xml", + (Predicate) bbm -> bbm.getLib().equalsIgnoreCase("LoadAlphaBeta")), + Arguments.of("specific_load_phase_1_dyd.xml", "specific_load_phase_2_dyd.xml", + (Predicate) bbm -> bbm.getDynamicModelId().equalsIgnoreCase("LOAD"))); + } +} diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index 607c0d5f6..8621d6be4 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -54,4 +54,14 @@ void writeJobWithSpecificLogs() throws SAXException, IOException { validate("jobs.xsd", "jobsWithSpecificLogs.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); } + @Test + void writeJobWithPhase2() throws SAXException, IOException { + DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, eventModels, curves, parameters, dynawoParameters, bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD2")); + + JobsXml.writePhase2(tmpDir, context); + validate("jobs.xsd", "jobsWithPhase2.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); + } } diff --git a/dynawo-simulation/src/test/resources/jobsWithPhase2.xml b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml new file mode 100644 index 000000000..679fe06aa --- /dev/null +++ b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dynawo-simulation/src/test/resources/no_loads_phase_1_dyd.xml b/dynawo-simulation/src/test/resources/no_loads_phase_1_dyd.xml new file mode 100644 index 000000000..fae160f24 --- /dev/null +++ b/dynawo-simulation/src/test/resources/no_loads_phase_1_dyd.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/dynawo-simulation/src/test/resources/no_loads_phase_2_dyd.xml b/dynawo-simulation/src/test/resources/no_loads_phase_2_dyd.xml new file mode 100644 index 000000000..cf449d13a --- /dev/null +++ b/dynawo-simulation/src/test/resources/no_loads_phase_2_dyd.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dynawo-simulation/src/test/resources/specific_load_phase_1_dyd.xml b/dynawo-simulation/src/test/resources/specific_load_phase_1_dyd.xml new file mode 100644 index 000000000..f830b9577 --- /dev/null +++ b/dynawo-simulation/src/test/resources/specific_load_phase_1_dyd.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/dynawo-simulation/src/test/resources/specific_load_phase_2_dyd.xml b/dynawo-simulation/src/test/resources/specific_load_phase_2_dyd.xml new file mode 100644 index 000000000..77740e1aa --- /dev/null +++ b/dynawo-simulation/src/test/resources/specific_load_phase_2_dyd.xml @@ -0,0 +1,7 @@ + + + + + + + From fa97b48d091b8643821e972c5bea99de26645639 Mon Sep 17 00:00:00 2001 From: lisrte Date: Tue, 16 Jul 2024 16:36:33 +0200 Subject: [PATCH 15/28] Add MarginCalculationParameters and LoadVariationAreaXmlTest Signed-off-by: lisrte --- .../LoadVariationAreaAutomationSystem.java | 30 ++- .../margincalculation/LoadsVariation.java | 23 ++ .../MarginCalculationContext.java | 14 +- .../MarginCalculationParameters.java | 246 ++++++++++++++++++ .../MarginCalculationParametersTest.java | 52 ++++ .../xml/LoadVariationAreaXmlTest.java | 60 +++++ .../xml/LoadVariationAreaXmlTest.java | 44 ---- .../resources/load_variation_area_dyd.xml | 7 + .../resources/load_variation_area_par.xml | 14 + .../xml/AbstractDynamicModelXmlTest.java | 2 +- 10 files changed, 428 insertions(+), 64 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/MarginCalculationParametersTest.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java delete mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java create mode 100644 dynawo-security-analysis/src/test/resources/load_variation_area_par.xml diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java index d4f649c32..cc91c54cc 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java @@ -32,13 +32,13 @@ public class LoadVariationAreaAutomationSystem extends AbstractPureDynamicBlackB private static final String PAR_ID = "loadVarArea"; private static final String LIB = "DYNModelVariationArea"; - private final List loads; + private final List loadsVariations; private final double loadIncreaseStartTime; private final double loadIncreaseStopTime; - public LoadVariationAreaAutomationSystem(List loads, double loadIncreaseStartTime, double loadIncreaseStopTime) { + public LoadVariationAreaAutomationSystem(List loadsVariations, double loadIncreaseStartTime, double loadIncreaseStopTime) { super(ID, PAR_ID, LIB); - this.loads = Objects.requireNonNull(loads); + this.loadsVariations = Objects.requireNonNull(loadsVariations); this.loadIncreaseStartTime = loadIncreaseStartTime; this.loadIncreaseStopTime = loadIncreaseStopTime; } @@ -46,9 +46,11 @@ public LoadVariationAreaAutomationSystem(List loads, double loadIncreaseSt @Override public void createMacroConnections(MacroConnectionsAdder adder) { int index = 0; - for (Load load : loads) { - adder.createMacroConnections(this, load, ControllableLoadModel.class, this::getVarConnectionsWith, MacroConnectAttribute.ofIndex1(index)); - index++; + for (LoadsVariation lv : loadsVariations) { + for (Load load : lv.loads()) { + adder.createMacroConnections(this, load, ControllableLoadModel.class, this::getVarConnectionsWith, MacroConnectAttribute.ofIndex1(index)); + index++; + } } } @@ -60,16 +62,18 @@ private List getVarConnectionsWith(ControllableLoadModel connecte @Override public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { ParametersSet paramSet = new ParametersSet(getParameterSetId()); - paramSet.addParameter("nbLoads", INT, String.valueOf(loads.size())); - paramSet.addParameter("startTime", DOUBLE, String.valueOf(loadIncreaseStartTime)); - paramSet.addParameter("stopTime", DOUBLE, String.valueOf(loadIncreaseStopTime)); //TODO calc delta int index = 0; - for (Load load : loads) { - paramSet.addParameter("deltaP_load_" + index, DOUBLE, String.valueOf(1)); - paramSet.addParameter("deltaQ_load_" + index, DOUBLE, String.valueOf(1)); - index++; + for (LoadsVariation lv : loadsVariations) { + for (Load load : lv.loads()) { + paramSet.addParameter("deltaP_load_" + index, DOUBLE, String.valueOf(1)); + paramSet.addParameter("deltaQ_load_" + index, DOUBLE, String.valueOf(1)); + index++; + } } + paramSet.addParameter("nbLoads", INT, String.valueOf(index)); + paramSet.addParameter("startTime", DOUBLE, String.valueOf(loadIncreaseStartTime)); + paramSet.addParameter("stopTime", DOUBLE, String.valueOf(loadIncreaseStopTime)); parametersAdder.accept(paramSet); } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java new file mode 100644 index 000000000..1fcf4472b --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java @@ -0,0 +1,23 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.iidm.network.Load; + +import java.util.List; + +/** + * @author Laurent Issertial + */ +public record LoadsVariation(List loads, double variationValue, VariationMode variationMode) { + + //TODO complete + public enum VariationMode { + PROPORTIONAL + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index dfe200d38..066a45810 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -8,6 +8,7 @@ package com.powsybl.dynawo.margincalculation; import com.powsybl.contingency.Contingency; +import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; @@ -18,7 +19,6 @@ import com.powsybl.dynawo.security.ContingencyEventModelsHandler; import com.powsybl.dynawo.xml.DydDataSupplier; import com.powsybl.iidm.network.Network; -import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import java.util.*; @@ -35,16 +35,18 @@ public class MarginCalculationContext extends DynawoSimulationContext { public MarginCalculationContext(Network network, String workingVariantId, List dynamicModels, - DynamicSecurityAnalysisParameters parameters, + MarginCalculationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, - List contingencies) { + List contingencies, + List loadsVariations) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), - parameters.getDynamicSimulationParameters(), dynawoSimulationParameters); - double contingenciesStartTime = parameters.getDynamicContingenciesParameters().getContingenciesStartTime(); + //TODO fix + new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters); + double contingenciesStartTime = parameters.getContingenciesStartTime(); this.contingencies = contingencies; this.contingencyEventModels = ContingencyEventModelsHandler.createFrom(contingencies, this, contingenciesStartTime).getContingencyEventModels(); - this.loadVariationArea = new LoadVariationAreaAutomationSystem(List.of(), 10, 20); + this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, parameters.getLoadIncreaseStartTime(), parameters.getLoadIncreaseStopTime()); macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); macroConnectionsAdder.setMacroConnectAdder(loadVariationMacroConnectList::add); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java new file mode 100644 index 000000000..20d25f285 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java @@ -0,0 +1,246 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.commons.config.ModuleConfig; +import com.powsybl.commons.config.PlatformConfig; + +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.util.Optional; + +/** + * @author Laurent Issertial + */ +//TODO reuse core parameters ? +public class MarginCalculationParameters { + + public static final double DEFAULT_START_TIME = 0; + public static final double DEFAULT_STOP_TIME = 200; + public static final double DEFAULT_MARGIN_CALCULATION_START_TIME = 100; + public static final double DEFAULT_LOAD_INCREASE_START_TIME = 10; + public static final double DEFAULT_LOAD_INCREASE_STOP_TIME = 50; + public static final double DEFAULT_CONTINGENCIES_START_TIME = 120; + public static final CalculationType DEFAULT_CALCULATION_TYPE = CalculationType.GLOBAL_MARGIN; + public static final double DEFAULT_ACCURACY = 2; + public static final LoadModelsRule DEFAULT_LOAD_MODELS_RULE = LoadModelsRule.EVERY_MODELS; + + public enum CalculationType { + GLOBAL_MARGIN, + LOCAL_MARGIN + } + + /** + * Indicates how to handle loads in the first phase + */ + public enum LoadModelsRule { + /** + * Remove every specific loads dynamic models + */ + EVERY_MODELS, + /** + * Remove dynamic models on loads affected by the margin calculation + */ + HYBRID + } + + public static class Builder { + + private double startTime = DEFAULT_START_TIME; + private double stopTime = DEFAULT_STOP_TIME; + private double marginCalculationStartTime = DEFAULT_MARGIN_CALCULATION_START_TIME; + private double loadIncreaseStartTime= DEFAULT_LOAD_INCREASE_START_TIME; + private double loadIncreaseStopTime = DEFAULT_LOAD_INCREASE_STOP_TIME; + private double contingenciesStartTime = DEFAULT_CONTINGENCIES_START_TIME; + private CalculationType calculationType = DEFAULT_CALCULATION_TYPE; + private double accuracy = DEFAULT_ACCURACY; + private LoadModelsRule loadModelsRule = DEFAULT_LOAD_MODELS_RULE; + + /** + * Set dynamic simulation start time, must be greater than 0 + */ + public Builder setStartTime(double startTime) { + this.startTime = startTime; + return this; + } + + /** + * Set dynamic simulation stop time, must be after {@link #startTime} + */ + public Builder setStopTime(double stopTime) { + this.stopTime = stopTime; + return this; + } + + /** + * Set margin calculation phase start time, must be between {@link #startTime} and {@link #stopTime} + */ + public Builder setMarginCalculationStartTime(double marginCalculationStartTime) { + this.marginCalculationStartTime = marginCalculationStartTime; + return this; + } + + /** + * Set load increase start time, must be between {@link #startTime} and {@link #marginCalculationStartTime} + */ + public Builder setLoadIncreaseStartTime(double loadIncreaseStartTime) { + this.loadIncreaseStartTime = loadIncreaseStartTime; + return this; + } + + /** + * Set load increase stop time, must be after {@link #loadIncreaseStartTime} + */ + public Builder setLoadIncreaseStopTime(double loadIncreaseStopTime) { + this.loadIncreaseStopTime = loadIncreaseStopTime; + return this; + } + + /** + * Set contingencies start time, must be between {@link #marginCalculationStartTime} and {@link #stopTime} + */ + public Builder setContingenciesStartTime(double contingenciesStartTime) { + this.contingenciesStartTime = contingenciesStartTime; + return this; + } + + public Builder setCalculationType(CalculationType calculationType) { + this.calculationType = calculationType; + return this; + } + + public Builder setAccuracy(double accuracy) { + this.accuracy = accuracy; + return this; + } + + public Builder setLoadModelsRule(LoadModelsRule loadModelsRule) { + this.loadModelsRule = loadModelsRule; + return this; + } + + public MarginCalculationParameters build() { + if (startTime < 0) { + throw new IllegalStateException("Start time should be zero or positive"); + } + if (stopTime <= startTime) { + throw new IllegalStateException("Stop time should be greater than start time"); + } + if (marginCalculationStartTime <= startTime || marginCalculationStartTime >= stopTime) { + throw new IllegalStateException("Margin calculation start time should be between start and stop time"); + } + if (contingenciesStartTime <= marginCalculationStartTime || contingenciesStartTime >= stopTime) { + throw new IllegalStateException("Contingencies start time should be between margin calculation start time and stop time"); + } + if (loadIncreaseStartTime <= startTime) { + throw new IllegalStateException("Load increase start time should be greater start time"); + } + if (loadIncreaseStopTime <= loadIncreaseStartTime || loadIncreaseStopTime >= marginCalculationStartTime) { + throw new IllegalStateException("Load increase stop time should be between load increase start time and margin calculation start time"); + } + return new MarginCalculationParameters(startTime, stopTime, marginCalculationStartTime,loadIncreaseStartTime, + loadIncreaseStopTime, contingenciesStartTime, calculationType, accuracy, loadModelsRule); + } + } + + /** + * Creates a builder for MarginCalculationParameters with default values + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Loads parameters from the default platform configuration. + */ + public static MarginCalculationParameters load() { + return load(PlatformConfig.defaultConfig()); + } + + /** + * Loads parameters from a provided platform configuration. + */ + public static MarginCalculationParameters load(PlatformConfig platformConfig) { + return load(platformConfig, FileSystems.getDefault()); + } + + public static MarginCalculationParameters load(PlatformConfig platformConfig, FileSystem fileSystem) { + Builder builder = builder(); + Optional config = platformConfig.getOptionalModuleConfig("margin-calculation-default-parameters"); + config.ifPresent(c -> { + c.getOptionalDoubleProperty("startTime").ifPresent(builder::setStartTime); + c.getOptionalDoubleProperty("stopTime").ifPresent(builder::setStopTime); + c.getOptionalDoubleProperty("margin-calculation-start-time").ifPresent(builder::setMarginCalculationStartTime); + c.getOptionalDoubleProperty("loadIncrease.startTime").ifPresent(builder::setLoadIncreaseStartTime); + c.getOptionalDoubleProperty("loadIncrease.stopTime").ifPresent(builder::setLoadIncreaseStopTime); + c.getOptionalDoubleProperty("contingencies-start-time").ifPresent(builder::setContingenciesStartTime); + c.getOptionalEnumProperty("calculation-type", CalculationType.class).ifPresent(builder::setCalculationType); + c.getOptionalDoubleProperty("accuracy").ifPresent(builder::setAccuracy); + c.getOptionalEnumProperty("loads-models-rule", LoadModelsRule.class).ifPresent(builder::setLoadModelsRule); + }); + return builder.build(); + } + + private final double startTime; + private final double stopTime ; + private final double marginCalculationStartTime; + private final double loadIncreaseStartTime; + private final double loadIncreaseStopTime; + private final double contingenciesStartTime; + private final CalculationType calculationType; + private final double accuracy; + private final LoadModelsRule loadModelsRule; + + private MarginCalculationParameters(double startTime, double stopTime, double marginCalculationStartTime, double loadIncreaseStartTime, double loadIncreaseStopTime, double contingenciesStartTime, CalculationType calculationType, double accuracy, LoadModelsRule loadModelsRule) { + this.startTime = startTime; + this.stopTime = stopTime; + this.marginCalculationStartTime = marginCalculationStartTime; + this.loadIncreaseStartTime = loadIncreaseStartTime; + this.loadIncreaseStopTime = loadIncreaseStopTime; + this.contingenciesStartTime = contingenciesStartTime; + this.calculationType = calculationType; + this.accuracy = accuracy; + this.loadModelsRule = loadModelsRule; + } + + public double getStartTime() { + return startTime; + } + + public double getStopTime() { + return stopTime; + } + + public double getMarginCalculationStartTime() { + return marginCalculationStartTime; + } + + public double getLoadIncreaseStartTime() { + return loadIncreaseStartTime; + } + + public double getLoadIncreaseStopTime() { + return loadIncreaseStopTime; + } + + public double getContingenciesStartTime() { + return contingenciesStartTime; + } + + public CalculationType getCalculationType() { + return calculationType; + } + + public double getAccuracy() { + return accuracy; + } + + public LoadModelsRule getLoadModelsRule() { + return loadModelsRule; + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/MarginCalculationParametersTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/MarginCalculationParametersTest.java new file mode 100644 index 000000000..507a4aa37 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/MarginCalculationParametersTest.java @@ -0,0 +1,52 @@ +/** + * 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.dynawo.margincalculation; + +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * @author Laurent Issertial + */ +public class MarginCalculationParametersTest { + + @ParameterizedTest(name = "{6}") + @MethodSource("provideMarginCalculationTimes") + void testExceptions(double startTime, double stopTime, double marginCalculationStartTime, double loadIncreaseStartTime, + double loadIncreaseStopTime, double contingenciesStartTime, String message) { + MarginCalculationParameters.Builder builder = MarginCalculationParameters.builder() + .setStartTime(startTime) + .setStopTime(stopTime) + .setMarginCalculationStartTime(marginCalculationStartTime) + .setLoadIncreaseStartTime(loadIncreaseStartTime) + .setLoadIncreaseStopTime(loadIncreaseStopTime) + .setContingenciesStartTime(contingenciesStartTime); + Exception e = assertThrows(IllegalStateException.class, builder::build); + assertEquals(message, e.getMessage()); + } + + private static Stream provideMarginCalculationTimes() { + return Stream.of( + Arguments.of(-1, 200, 100, 20, 70, 150, "Start time should be zero or positive"), + Arguments.of(10, 5, 100, 20, 70, 150, "Stop time should be greater than start time"), + Arguments.of(10, 200, 5, 20, 70, 150, "Margin calculation start time should be between start and stop time"), + Arguments.of(10, 200, 205, 20, 70, 150, "Margin calculation start time should be between start and stop time"), + Arguments.of(10, 200, 100, 20, 70, 90, "Contingencies start time should be between margin calculation start time and stop time"), + Arguments.of(10, 200, 100, 20, 70, 210, "Contingencies start time should be between margin calculation start time and stop time"), + Arguments.of(10, 200, 100, 5, 70, 150, "Load increase start time should be greater start time"), + Arguments.of(10, 200, 100, 20, 15, 150, "Load increase stop time should be between load increase start time and margin calculation start time"), + Arguments.of(10, 200, 100, 20, 110, 150, "Load increase stop time should be between load increase start time and margin calculation start time") + ); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java new file mode 100644 index 000000000..048f6ded0 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -0,0 +1,60 @@ +/** + * 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.dynawo.margincalculation.xml; + +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.LoadsVariation; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.AbstractDynamicModelXmlTest; +import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import static com.powsybl.dynawo.margincalculation.xml.MarginCalculationConstant.LOAD_VARIATION_AREA_FILENAME; + +/** + * @author Laurent Issertial + */ +class LoadVariationAreaXmlTest extends AbstractDynamicModelXmlTest { + + @Override + protected void setupNetwork() { + network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + } + + @Override + protected void addDynamicModels() { + // no models + } + + @Override + protected void setupDynawoContext() { + MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + List loadsVariationList = List.of( + new LoadsVariation(List.of(network.getLoad("LOAD")),2, LoadsVariation.VariationMode.PROPORTIONAL), + new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")),5, LoadsVariation.VariationMode.PROPORTIONAL)); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + } + + @Test + void writeDyd() throws SAXException, IOException { + DydXml.write(tmpDir, LOAD_VARIATION_AREA_FILENAME, ((MarginCalculationContext)context).getLoadVariationAreaDydData()); + ParametersXml.write(tmpDir, context); + validate("dyd.xsd", "load_variation_area_dyd.xml", tmpDir.resolve(LOAD_VARIATION_AREA_FILENAME)); + validate("parameters.xsd", "load_variation_area_par.xml", tmpDir.resolve(context.getSimulationParFile())); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java deleted file mode 100644 index f08f8e467..000000000 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/margincalculation/xml/LoadVariationAreaXmlTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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.dynawo.security.margincalculation.xml; - -import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawo.DynawoSimulationParameters; -import com.powsybl.dynawo.margincalculation.MarginCalculationContext; -import com.powsybl.dynawo.xml.DydXml; -import com.powsybl.dynawo.xml.DynawoTestUtil; -import com.powsybl.dynawo.xml.ParametersXml; -import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; -import org.junit.jupiter.api.Test; -import org.xml.sax.SAXException; - -import java.io.IOException; -import java.util.Collections; - -import static com.powsybl.dynawo.margincalculation.xml.MarginCalculationConstant.LOAD_VARIATION_AREA_FILENAME; - -/** - * @author Laurent Issertial - */ -class LoadVariationAreaXmlTest extends DynawoTestUtil { - - @Test - void writeDyd() throws SAXException, IOException { - DynamicSecurityAnalysisParameters parameters = DynamicSecurityAnalysisParameters.load(); - parameters.setDynamicSimulationParameters(new DynamicSimulationParameters(0, 20)); - parameters.setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(10)); - DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); - MarginCalculationContext context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, Collections.emptyList()); - - DydXml.write(tmpDir, LOAD_VARIATION_AREA_FILENAME, context.getLoadVariationAreaDydData()); - ParametersXml.write(tmpDir, context); - validate("dyd.xsd", "load_variation_area_dyd.xml", tmpDir.resolve(LOAD_VARIATION_AREA_FILENAME)); -// validate("parameters.xsd", "omega_ref.xml", tmpDir.resolve(context.getSimulationParFile())); - } - -} diff --git a/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml b/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml index 89313437d..04389c11f 100644 --- a/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml +++ b/dynawo-security-analysis/src/test/resources/load_variation_area_dyd.xml @@ -1,4 +1,11 @@ + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml b/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml new file mode 100644 index 000000000..c2aca9c34 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java index 4f86ea48d..94f82621a 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java @@ -76,7 +76,7 @@ public void validate(String schemaDefinition, String expectedResourceName, Path assertTxtEquals(expected, actual); } - void setupDynawoContext() { + protected void setupDynawoContext() { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, curves, parameters, dynawoParameters, reportNode); From 8dd30583d45885cd5e353b55d1e74c770514c3e8 Mon Sep 17 00:00:00 2001 From: lisrte Date: Wed, 4 Sep 2024 10:46:18 +0200 Subject: [PATCH 16/28] Add LoadIncreaseResult with XML parsing Signed-off-by: lisrte --- .../dynawo/commons/AbstractXmlParser.java | 65 ++++++++++ .../commons/timeline/XmlTimeLineParser.java | 49 +------- .../timeline/XmlTimeLineParserTest.java | 4 +- .../dynawo/it/DynawoSecurityAnalysisTest.java | 2 +- .../MarginCalculationParameters.java | 8 +- .../results/FailedCriterion.java | 17 +++ .../results/LoadIncreaseResult.java | 22 ++++ .../results/ResultsUtil.java | 118 ++++++++++++++++++ .../results/ScenarioResult.java | 25 ++++ .../margincalculation/results/Status.java | 18 +++ .../XmlMarginCalculationResultParser.java | 77 ++++++++++++ .../results/XmlResultParserTest.java | 60 +++++++++ .../xml/LoadVariationAreaXmlTest.java | 6 +- .../src/test/resources/result.xml | 17 +++ .../src/test/resources/wrongResult.xml | 29 +++++ 15 files changed, 462 insertions(+), 55 deletions(-) create mode 100644 commons/src/main/java/com/powsybl/dynawo/commons/AbstractXmlParser.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java create mode 100644 dynawo-security-analysis/src/test/resources/result.xml create mode 100644 dynawo-security-analysis/src/test/resources/wrongResult.xml diff --git a/commons/src/main/java/com/powsybl/dynawo/commons/AbstractXmlParser.java b/commons/src/main/java/com/powsybl/dynawo/commons/AbstractXmlParser.java new file mode 100644 index 000000000..4b1bd79e8 --- /dev/null +++ b/commons/src/main/java/com/powsybl/dynawo/commons/AbstractXmlParser.java @@ -0,0 +1,65 @@ +/** + * 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.dynawo.commons; + +import com.powsybl.commons.exceptions.UncheckedXmlStreamException; + +import javax.xml.XMLConstants; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.io.IOException; +import java.io.Reader; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +/** + * @author Laurent Issertial {@literal } + */ +public abstract class AbstractXmlParser { + + public List parse(Path path) { + Objects.requireNonNull(path); + if (!Files.exists(path)) { + return Collections.emptyList(); + } + + try (Reader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8)) { + return parse(reader); + } catch (IOException e) { + throw new UncheckedIOException(e); + } catch (XMLStreamException e) { + throw new UncheckedXmlStreamException(e); + } + } + + public List parse(Reader reader) throws XMLStreamException { + + List series; + XMLInputFactory factory = XMLInputFactory.newInstance(); + factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); + factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); + XMLStreamReader xmlReader = null; + try { + xmlReader = factory.createXMLStreamReader(reader); + series = read(xmlReader); + } finally { + if (xmlReader != null) { + xmlReader.close(); + } + } + return series; + } + + protected abstract List read(XMLStreamReader reader) throws XMLStreamException; +} diff --git a/commons/src/main/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParser.java b/commons/src/main/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParser.java index 33d344983..f3942c5ec 100644 --- a/commons/src/main/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParser.java +++ b/commons/src/main/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParser.java @@ -9,67 +9,26 @@ import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.xml.XmlUtil; +import com.powsybl.dynawo.commons.AbstractXmlParser; -import javax.xml.XMLConstants; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import java.io.IOException; -import java.io.Reader; -import java.io.UncheckedIOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -import java.util.Objects; /** * @author Laurent Issertial {@literal } * @author Marcos de Miguel {@literal } */ -public final class XmlTimeLineParser implements TimeLineParser { +public final class XmlTimeLineParser extends AbstractXmlParser implements TimeLineParser { private static final String TIME = "time"; private static final String MODEL_NAME = "modelName"; private static final String MESSAGE = "message"; - public List parse(Path timeLineFile) { - Objects.requireNonNull(timeLineFile); - if (!Files.exists(timeLineFile)) { - return Collections.emptyList(); - } - - try (Reader reader = Files.newBufferedReader(timeLineFile, StandardCharsets.UTF_8)) { - return parse(reader); - } catch (IOException e) { - throw new UncheckedIOException(e); - } catch (XMLStreamException e) { - throw new UncheckedXmlStreamException(e); - } - } - - public static List parse(Reader reader) throws XMLStreamException { - - List timeLineSeries; - XMLInputFactory factory = XMLInputFactory.newInstance(); - factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); - factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); - XMLStreamReader xmlReader = null; - try { - xmlReader = factory.createXMLStreamReader(reader); - timeLineSeries = read(xmlReader); - } finally { - if (xmlReader != null) { - xmlReader.close(); - } - } - return timeLineSeries; - } - - private static List read(XMLStreamReader xmlReader) throws XMLStreamException { + @Override + protected List read(XMLStreamReader xmlReader) throws XMLStreamException { List timeline = new ArrayList<>(); int state = xmlReader.next(); while (state == XMLStreamConstants.COMMENT) { diff --git a/commons/src/test/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParserTest.java b/commons/src/test/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParserTest.java index 1f2fd7385..5d8d61a3f 100644 --- a/commons/src/test/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParserTest.java +++ b/commons/src/test/java/com/powsybl/dynawo/commons/timeline/XmlTimeLineParserTest.java @@ -27,7 +27,7 @@ class XmlTimeLineParserTest { void test() throws XMLStreamException { InputStreamReader xml = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/timeline.xml"))); - List timeline = XmlTimeLineParser.parse(xml); + List timeline = new XmlTimeLineParser().parse(xml); assertEquals(5, timeline.size()); assertEquals("PMIN : activation", timeline.get(0).message()); @@ -54,7 +54,7 @@ void parseFromPath() throws URISyntaxException { @Test void testInconsistentFile() throws XMLStreamException { InputStreamReader xml = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/wrongTimeline.xml"))); - List timeline = XmlTimeLineParser.parse(xml); + List timeline = new XmlTimeLineParser().parse(xml); assertEquals(4, timeline.size()); } } diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index 1d136dbb2..02b7adfa6 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -59,7 +59,7 @@ class DynawoSecurityAnalysisTest extends AbstractDynawoTest { @BeforeEach void setUp() throws Exception { super.setUp(); - provider = new DynawoSecurityAnalysisProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), false)); + provider = new DynawoSecurityAnalysisProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), true)); parameters = new DynamicSecurityAnalysisParameters() .setDynamicSimulationParameters(new DynamicSimulationParameters(0, 100)) .setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(50)); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java index 20d25f285..5909392aa 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java @@ -18,7 +18,7 @@ * @author Laurent Issertial */ //TODO reuse core parameters ? -public class MarginCalculationParameters { +public final class MarginCalculationParameters { public static final double DEFAULT_START_TIME = 0; public static final double DEFAULT_STOP_TIME = 200; @@ -54,7 +54,7 @@ public static class Builder { private double startTime = DEFAULT_START_TIME; private double stopTime = DEFAULT_STOP_TIME; private double marginCalculationStartTime = DEFAULT_MARGIN_CALCULATION_START_TIME; - private double loadIncreaseStartTime= DEFAULT_LOAD_INCREASE_START_TIME; + private double loadIncreaseStartTime = DEFAULT_LOAD_INCREASE_START_TIME; private double loadIncreaseStopTime = DEFAULT_LOAD_INCREASE_STOP_TIME; private double contingenciesStartTime = DEFAULT_CONTINGENCIES_START_TIME; private CalculationType calculationType = DEFAULT_CALCULATION_TYPE; @@ -143,7 +143,7 @@ public MarginCalculationParameters build() { if (loadIncreaseStopTime <= loadIncreaseStartTime || loadIncreaseStopTime >= marginCalculationStartTime) { throw new IllegalStateException("Load increase stop time should be between load increase start time and margin calculation start time"); } - return new MarginCalculationParameters(startTime, stopTime, marginCalculationStartTime,loadIncreaseStartTime, + return new MarginCalculationParameters(startTime, stopTime, marginCalculationStartTime, loadIncreaseStartTime, loadIncreaseStopTime, contingenciesStartTime, calculationType, accuracy, loadModelsRule); } } @@ -187,7 +187,7 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi } private final double startTime; - private final double stopTime ; + private final double stopTime; private final double marginCalculationStartTime; private final double loadIncreaseStartTime; private final double loadIncreaseStopTime; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java new file mode 100644 index 000000000..e225c6f10 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java @@ -0,0 +1,17 @@ +/** + * 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.dynawo.margincalculation.results; + +/** + * scenarioResults or loadIncreaseResults failed criterion + * @param message Failed criterion message + * @param time Failure time (in seconds) + * @author Laurent Issertial {@literal } + */ +public record FailedCriterion(String message, double time) { +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java new file mode 100644 index 000000000..63fdaaba6 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java @@ -0,0 +1,22 @@ +/** + * 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.dynawo.margincalculation.results; + +import java.util.Collections; +import java.util.List; + +/** + * @author Laurent Issertial {@literal } + */ +public record LoadIncreaseResult(double loadLevel, Status status, + List scenarioResults, List failedCriteria) { + + public LoadIncreaseResult(double loadLevel, Status status) { + this(loadLevel, status, Collections.emptyList(), Collections.emptyList()); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java new file mode 100644 index 000000000..b36572677 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java @@ -0,0 +1,118 @@ +/** + * 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.dynawo.margincalculation.results; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Optional; + +import static com.powsybl.dynawo.margincalculation.results.Status.*; + +/** + * @author Laurent Issertial {@literal } + */ +public final class ResultsUtil { + + private ResultsUtil() { + } + + private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtil.class); + + static Optional createLoadIncreaseResult(String loadLevel, String status, List scenarioResults, + List failedCriteria) { + if (loadLevel == null || status == null || failedCriteria == null || scenarioResults == null) { + LOGGER.warn("Inconsistent load increase result entry (loadLevel: '{}', status: '{}', scenarioResults: '{}', failedCriteria: '{}')", + loadLevel, status, scenarioResults, failedCriteria); + } else { + try { + double loadLevelD = Double.parseDouble(loadLevel); + Status statusE = Status.valueOf(status); + switch (statusE) { + case CONVERGENCE -> { + if (scenarioResults.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should have scenario results", status); + return Optional.empty(); + } + if (!failedCriteria.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should not have failed criteria", status); + return Optional.empty(); + } + } + case CRITERIA_NON_RESPECTED -> { + if (!scenarioResults.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should not have scenario results", status); + return Optional.empty(); + } + if (failedCriteria.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should have failed criteria", status); + return Optional.empty(); + } + } + case DIVERGENCE, EXECUTION_PROBLEM -> { + if (!scenarioResults.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should not have scenario results", status); + return Optional.empty(); + } + if (!failedCriteria.isEmpty()) { + LOGGER.warn("LoadIncreaseResult with {} status should not have failed criteria", status); + return Optional.empty(); + } + } + } + return Optional.of(new LoadIncreaseResult(loadLevelD, statusE, scenarioResults, failedCriteria)); + } catch (NumberFormatException e) { + logInconsistentEntry("loadLevel", loadLevel); + } catch (IllegalArgumentException e) { + logInconsistentEntry("status", status); + } + } + return Optional.empty(); + } + + static Optional createScenarioResult(String id, String status, List failedCriteria) { + if (id == null || status == null || failedCriteria == null) { + LOGGER.warn("Inconsistent scenario result entry (id: '{}', status: '{}', failedCriteria: '{}')", id, status, failedCriteria); + } else { + try { + Status statusE = Status.valueOf(status); + boolean isCriterionError = CRITERIA_NON_RESPECTED == statusE; + if (isCriterionError && failedCriteria.isEmpty()) { + LOGGER.warn("ScenarioResult with {} status should have failed criteria", status); + return Optional.empty(); + } else if (!isCriterionError && !failedCriteria.isEmpty()) { + LOGGER.warn("ScenarioResult with {} status should not have failed criteria", status); + return Optional.empty(); + } + return Optional.of(new ScenarioResult(id, statusE, failedCriteria)); + } catch (IllegalArgumentException e) { + logInconsistentEntry("status", status); + } + } + return Optional.empty(); + } + + static Optional createFailedCriterion(String message, String time) { + if (message == null || time == null) { + LOGGER.warn("Inconsistent failed criterion entry (message: '{}', time: '{}')", message, time); + } else { + try { + double timeD = Double.parseDouble(time); + return Optional.of(new FailedCriterion(message, timeD)); + } catch (NumberFormatException e) { + logInconsistentEntry("time", time); + } + } + return Optional.empty(); + } + + private static void logInconsistentEntry(String fieldName, String message) { + LOGGER.warn("Inconsistent {} entry '{}'", fieldName, message); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java new file mode 100644 index 000000000..5a00f872c --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java @@ -0,0 +1,25 @@ +/** + * 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.dynawo.margincalculation.results; + +import java.util.Collections; +import java.util.List; + +/** + * Contingency scenario result + * @param id Contingency id + * @param status Result status + * @param failedCriteria List of failed criterion + * @author Laurent Issertial {@literal } + */ +public record ScenarioResult(String id, Status status, List failedCriteria) { + + public ScenarioResult(String id, Status status) { + this(id, status, Collections.emptyList()); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java new file mode 100644 index 000000000..357235a97 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java @@ -0,0 +1,18 @@ +/** + * 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.dynawo.margincalculation.results; + +/** + * @author Laurent Issertial {@literal } + */ +public enum Status { + CONVERGENCE, + DIVERGENCE, + EXECUTION_PROBLEM, + CRITERIA_NON_RESPECTED +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java new file mode 100644 index 000000000..e4278f5db --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java @@ -0,0 +1,77 @@ +/** + * 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.dynawo.margincalculation.results; + +import com.powsybl.commons.exceptions.UncheckedXmlStreamException; +import com.powsybl.commons.xml.XmlUtil; +import com.powsybl.dynawo.commons.AbstractXmlParser; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +/** + * @author Laurent Issertial {@literal } + */ +public final class XmlMarginCalculationResultParser extends AbstractXmlParser { + + private static final String LOAD_LEVEL = "loadLevel"; + private static final String STATUS = "status"; + private static final String ID = "id"; + private static final String TIME = "time"; + + @Override + protected List read(XMLStreamReader xmlReader) throws XMLStreamException { + List loadIncreaseResults = new ArrayList<>(); + int state = xmlReader.next(); + while (state == XMLStreamConstants.COMMENT) { + state = xmlReader.next(); + } + XmlUtil.readSubElements(xmlReader, elementName -> readLoadIncreaseResult(elementName, xmlReader, loadIncreaseResults::add)); + return loadIncreaseResults; + } + + private static void readLoadIncreaseResult(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { + if (elementName.equals("loadIncreaseResults")) { + String loadLevel = xmlReader.getAttributeValue(null, LOAD_LEVEL); + String status = xmlReader.getAttributeValue(null, STATUS); + List scenarioResults = new ArrayList<>(); + List failedCriteria = new ArrayList<>(); + XmlUtil.readSubElements(xmlReader, subElementName -> readLoadIncreaseResultSubElements(subElementName, xmlReader, scenarioResults::add, failedCriteria::add)); + ResultsUtil.createLoadIncreaseResult(loadLevel, status, scenarioResults, failedCriteria).ifPresent(resultConsumer); + } + } + + private static void readLoadIncreaseResultSubElements(String elementName, XMLStreamReader xmlReader, Consumer scenarioConsumer, Consumer criterionConsumer) { + if (elementName.equals("scenarioResults")) { + String id = xmlReader.getAttributeValue(null, ID); + String status = xmlReader.getAttributeValue(null, STATUS); + List failedCriteria = new ArrayList<>(); + XmlUtil.readSubElements(xmlReader, subElementName -> readFailedCriterion(subElementName, xmlReader, failedCriteria::add)); + ResultsUtil.createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); + } else { + readFailedCriterion(elementName, xmlReader, criterionConsumer); + } + } + + private static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { + try { + if (elementName.equals("criterionNonRespected")) { + String message = xmlReader.getAttributeValue(null, ID); + String time = xmlReader.getAttributeValue(null, TIME); + XmlUtil.readEndElementOrThrow(xmlReader); + ResultsUtil.createFailedCriterion(message, time).ifPresent(resultConsumer); + } + } catch (XMLStreamException e) { + throw new UncheckedXmlStreamException(e); + } + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java new file mode 100644 index 000000000..03c81539c --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java @@ -0,0 +1,60 @@ +/** + * 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.dynawo.margincalculation.results; + +import org.junit.jupiter.api.Test; + +import javax.xml.stream.XMLStreamException; +import java.io.InputStreamReader; +import java.net.URISyntaxException; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import static com.powsybl.dynawo.margincalculation.results.Status.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * @author Laurent Issertial {@literal } + */ +class XmlResultParserTest { + + @Test + void test() throws XMLStreamException { + + InputStreamReader xml = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/result.xml"))); + List result = new XmlMarginCalculationResultParser().parse(xml); + + assertThat(result).containsExactly(new LoadIncreaseResult(100, CRITERIA_NON_RESPECTED, Collections.emptyList(), + List.of(new FailedCriterion("total load power = 295.381MW", 70.0))), + new LoadIncreaseResult(50, CONVERGENCE, + List.of(new ScenarioResult("DisconnectLine", CONVERGENCE), + new ScenarioResult("DisconnectGroup", CRITERIA_NON_RESPECTED, + List.of(new FailedCriterion("total load power = 276.374MW", 185.0))), + new ScenarioResult("DisconnectGenerator", DIVERGENCE)), + Collections.emptyList()), + new LoadIncreaseResult(60, DIVERGENCE), + new LoadIncreaseResult(70, EXECUTION_PROBLEM)); + } + + @Test + void parseFromPath() throws URISyntaxException { + Path path = Path.of(Objects.requireNonNull(getClass().getResource("/result.xml")).toURI()); + List result = new XmlMarginCalculationResultParser().parse(path); + assertEquals(4, result.size()); + } + + @Test + void testInconsistentFile() throws XMLStreamException { + InputStreamReader xml = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/wrongResult.xml"))); + List result = new XmlMarginCalculationResultParser().parse(xml); + assertEquals(0, result.size()); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java index 048f6ded0..7e1b1462e 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -44,15 +44,15 @@ protected void setupDynawoContext() { MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); List loadsVariationList = List.of( - new LoadsVariation(List.of(network.getLoad("LOAD")),2, LoadsVariation.VariationMode.PROPORTIONAL), - new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")),5, LoadsVariation.VariationMode.PROPORTIONAL)); + new LoadsVariation(List.of(network.getLoad("LOAD")), 2, LoadsVariation.VariationMode.PROPORTIONAL), + new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 5, LoadsVariation.VariationMode.PROPORTIONAL)); context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); } @Test void writeDyd() throws SAXException, IOException { - DydXml.write(tmpDir, LOAD_VARIATION_AREA_FILENAME, ((MarginCalculationContext)context).getLoadVariationAreaDydData()); + DydXml.write(tmpDir, LOAD_VARIATION_AREA_FILENAME, ((MarginCalculationContext) context).getLoadVariationAreaDydData()); ParametersXml.write(tmpDir, context); validate("dyd.xsd", "load_variation_area_dyd.xml", tmpDir.resolve(LOAD_VARIATION_AREA_FILENAME)); validate("parameters.xsd", "load_variation_area_par.xml", tmpDir.resolve(context.getSimulationParFile())); diff --git a/dynawo-security-analysis/src/test/resources/result.xml b/dynawo-security-analysis/src/test/resources/result.xml new file mode 100644 index 000000000..c9ffafe1c --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/result.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/wrongResult.xml b/dynawo-security-analysis/src/test/resources/wrongResult.xml new file mode 100644 index 000000000..bd106412a --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/wrongResult.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From aee669c9ad792eb22f6cdfaafe226a264d61914f Mon Sep 17 00:00:00 2001 From: lisrte Date: Wed, 4 Sep 2024 18:02:53 +0200 Subject: [PATCH 17/28] Add provider, handler, multiple jobs Signed-off-by: lisrte --- .../dynawo/it/DynawoSecurityAnalysisTest.java | 2 +- .../AbstractDynawoAlgorithmsHandler.java | 82 +++++++++++++++++ .../DynawoAlgorithmsCommandUtil.java | 46 ++++++++++ .../DynawoAlgorithmsConfig.java | 2 +- .../algorithms/DynawoAlgorithmsContext.java | 21 +++++ .../xml/ContingenciesDydXml.java | 13 ++- .../xml/ContingenciesParXml.java | 8 +- .../{security => algorithms}/xml/XmlUtil.java | 23 ++--- .../LoadsVariationSupplier.java | 20 ++++ .../MarginCalculationContext.java | 10 +- .../MarginCalculationHandler.java | 45 +++++++++ .../MarginCalculationProvider.java | 85 +++++++++++++++++ .../MarginCalculationReport.java | 49 ++++++++++ .../MarginCalculationReports.java | 26 ++++++ .../MarginCalculationRunParameters.java | 91 +++++++++++++++++++ .../xml/MultipleJobsXml.java | 68 ++++++++++++++ .../DynawoSecurityAnalysisHandler.java | 58 ++---------- .../DynawoSecurityAnalysisProvider.java | 31 +------ .../security/SecurityAnalysisContext.java | 5 +- .../dynawo/security/xml/MultipleJobsXml.java | 25 ++--- .../security/DynawoAlgorithmsConfigTest.java | 1 + .../security/xml/ContingenciesXmlTest.java | 7 +- .../dynawo/xml/DynawoSimulationConstants.java | 5 + 23 files changed, 604 insertions(+), 119 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security => algorithms}/DynawoAlgorithmsConfig.java (97%) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security => algorithms}/xml/ContingenciesDydXml.java (70%) rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security => algorithms}/xml/ContingenciesParXml.java (79%) rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security => algorithms}/xml/XmlUtil.java (69%) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationRunParameters.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index 02b7adfa6..b547b9979 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -22,7 +22,7 @@ import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.dynawo.xml.ParametersXml; -import com.powsybl.dynawo.security.DynawoAlgorithmsConfig; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.dynawo.security.DynawoSecurityAnalysisProvider; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VariantManagerConstants; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java new file mode 100644 index 000000000..9e75143a4 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java @@ -0,0 +1,82 @@ +/** + * 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.dynawo.algorithms; + +import com.powsybl.commons.exceptions.UncheckedXmlStreamException; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.computation.AbstractExecutionHandler; +import com.powsybl.computation.Command; +import com.powsybl.computation.CommandExecution; +import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; +import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; +import com.powsybl.dynawo.commons.DynawoConstants; +import com.powsybl.dynawo.commons.DynawoUtil; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; +import com.powsybl.dynawo.xml.JobsXml; +import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.iidm.network.Network; + +import javax.xml.stream.XMLStreamException; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.FINAL_STATE_FOLDER; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.OUTPUTS_FOLDER; + +/** + * @author Laurent Issertial {@literal } + */ +public abstract class AbstractDynawoAlgorithmsHandler extends AbstractExecutionHandler { + + protected final S context; + protected final Command command; + protected final Network network; + protected final ReportNode reportNode; + + protected AbstractDynawoAlgorithmsHandler(S context, Command command, ReportNode reportNode) { + this.context = context; + this.command = command; + this.network = context.getNetwork(); + this.reportNode = reportNode; + } + + @Override + public List before(Path workingDir) throws IOException { + network.getVariantManager().setWorkingVariant(context.getWorkingVariantId()); + Path outputNetworkFile = workingDir.resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); + if (Files.exists(outputNetworkFile)) { + Files.delete(outputNetworkFile); + } + writeInputFiles(workingDir); + return getCommandExecutions(command); + } + + private void writeInputFiles(Path workingDir) { + try { + DynawoUtil.writeIidm(network, workingDir.resolve(DynawoSimulationConstants.NETWORK_FILENAME)); + JobsXml.write(workingDir, context); + DydXml.write(workingDir, context); + ParametersXml.write(workingDir, context); + writeMultipleJobs(workingDir); + ContingenciesDydXml.write(workingDir, context.getContingencyEventModels()); + ContingenciesParXml.write(workingDir, context.getContingencyEventModels()); + } catch (IOException e) { + throw new UncheckedIOException(e); + } catch (XMLStreamException e) { + throw new UncheckedXmlStreamException(e); + } + } + + protected abstract void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOException; +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java new file mode 100644 index 000000000..4aa8a31b4 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java @@ -0,0 +1,46 @@ +/** + * 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.dynawo.algorithms; + +import com.powsybl.computation.Command; +import com.powsybl.computation.SimpleCommandBuilder; +import com.powsybl.dynawo.xml.DynawoSimulationConstants; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * @author Laurent Issertial {@literal } + */ +public final class DynawoAlgorithmsCommandUtil { + + private DynawoAlgorithmsCommandUtil() { + } + + public static Command getCommand(DynawoAlgorithmsConfig config, String mode, String id) { + List args = Arrays.asList( + mode, + "--input", DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME, + "--output", DynawoSimulationConstants.AGGREGATED_RESULTS); + return new SimpleCommandBuilder() + .id(id) + .program(config.getProgram()) + .args(args) + .build(); + } + + public static Command getVersionCommand(DynawoAlgorithmsConfig config) { + List args = Collections.singletonList("--version"); + return new SimpleCommandBuilder() + .id("dynawo_version") + .program(config.getProgram()) + .args(args) + .build(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfig.java similarity index 97% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfig.java index 88960f1d0..c13d8c6e9 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfig.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfig.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security; +package com.powsybl.dynawo.algorithms; import com.powsybl.commons.config.ModuleConfig; import com.powsybl.commons.config.PlatformConfig; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java new file mode 100644 index 000000000..719aa88c8 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java @@ -0,0 +1,21 @@ +/** + * 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.dynawo.algorithms; + +import com.powsybl.dynawo.security.ContingencyEventModels; + +import java.util.List; + +/** + * @author Laurent Issertial {@literal } + */ +//TODO replace with functional interface? +public interface DynawoAlgorithmsContext { + + List getContingencyEventModels(); +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java similarity index 70% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java index 1d1239bb6..0807e7c82 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesDydXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java @@ -5,19 +5,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security.xml; +package com.powsybl.dynawo.algorithms.xml; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.security.ContingencyEventModels; -import com.powsybl.dynawo.security.SecurityAnalysisContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.nio.file.Path; +import java.util.List; import java.util.Objects; /** @@ -28,15 +27,15 @@ public final class ContingenciesDydXml { private ContingenciesDydXml() { } - public static void write(Path workingDir, SecurityAnalysisContext context) throws IOException, XMLStreamException { + public static void write(Path workingDir, List eventModels) throws IOException, XMLStreamException { Objects.requireNonNull(workingDir); - for (ContingencyEventModels model : context.getContingencyEventModels()) { + for (ContingencyEventModels model : eventModels) { Path file = workingDir.resolve(createDydFileName(model)); - XmlUtil.write(file, context, "dynamicModelsArchitecture", ContingenciesDydXml::writeEvent, model); + XmlUtil.write(file, "dynamicModelsArchitecture", ContingenciesDydXml::writeEvent, model); } } - private static void writeEvent(XMLStreamWriter writer, DynawoSimulationContext context, ContingencyEventModels model) throws XMLStreamException { + private static void writeEvent(XMLStreamWriter writer, ContingencyEventModels model) throws XMLStreamException { for (BlackBoxModel ev : model.eventModels()) { ev.write(writer, ContingenciesParXml.createParFileName(model)); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java similarity index 79% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java index 985dd81b1..dba13438e 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/ContingenciesParXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java @@ -5,13 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security.xml; +package com.powsybl.dynawo.algorithms.xml; import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.dynawo.security.ContingencyEventModels; -import com.powsybl.dynawo.security.SecurityAnalysisContext; import java.nio.file.Path; +import java.util.List; import java.util.Objects; import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; @@ -24,9 +24,9 @@ public final class ContingenciesParXml { private ContingenciesParXml() { } - public static void write(Path workingDir, SecurityAnalysisContext context) { + public static void write(Path workingDir, List eventModels) { Objects.requireNonNull(workingDir); - for (ContingencyEventModels model : context.getContingencyEventModels()) { + for (ContingencyEventModels model : eventModels) { ParametersXml.write(model.eventParameters(), createParFileName(model), workingDir, DYN_PREFIX); } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java similarity index 69% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java index ba94242b3..37734c431 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/XmlUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java @@ -5,11 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security.xml; +package com.powsybl.dynawo.algorithms.xml; import com.powsybl.dynawo.xml.XmlStreamWriterFactory; import com.powsybl.dynawo.security.ContingencyEventModels; -import com.powsybl.dynawo.security.SecurityAnalysisContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -19,6 +18,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Objects; +import java.util.function.Consumer; import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_PREFIX; import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; @@ -28,22 +28,16 @@ */ public final class XmlUtil { - @FunctionalInterface - public interface XmlDynawoContingenciesWriter { - void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) throws XMLStreamException; - } - @FunctionalInterface public interface XmlDynawoEventWriter { - void writeEvent(XMLStreamWriter writer, SecurityAnalysisContext context, ContingencyEventModels model) throws XMLStreamException; + void writeEvent(XMLStreamWriter writer, ContingencyEventModels model) throws XMLStreamException; } private XmlUtil() { } - public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawoEventWriter xmlDynawoEventWriter, ContingencyEventModels model) throws IOException, XMLStreamException { + public static void write(Path file, String elementName, XmlDynawoEventWriter xmlDynawoEventWriter, ContingencyEventModels model) throws IOException, XMLStreamException { Objects.requireNonNull(file); - Objects.requireNonNull(context); Objects.requireNonNull(elementName); Objects.requireNonNull(xmlDynawoEventWriter); @@ -55,7 +49,7 @@ public static void write(Path file, SecurityAnalysisContext context, String elem xmlWriter.writeStartElement(DYN_URI, elementName); xmlWriter.writeNamespace(DYN_PREFIX, DYN_URI); - xmlDynawoEventWriter.writeEvent(xmlWriter, context, model); + xmlDynawoEventWriter.writeEvent(xmlWriter, model); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); @@ -65,11 +59,10 @@ public static void write(Path file, SecurityAnalysisContext context, String elem } } - public static void write(Path file, SecurityAnalysisContext context, String elementName, XmlDynawoContingenciesWriter xmlDynawoWriter) throws IOException, XMLStreamException { + public static void write(Path file, String elementName, Consumer xmlStreamWriterConsumer) throws IOException, XMLStreamException { Objects.requireNonNull(file); - Objects.requireNonNull(context); Objects.requireNonNull(elementName); - Objects.requireNonNull(xmlDynawoWriter); + Objects.requireNonNull(xmlStreamWriterConsumer); try (Writer writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) { XMLStreamWriter xmlWriter = XmlStreamWriterFactory.newInstance(writer); @@ -78,7 +71,7 @@ public static void write(Path file, SecurityAnalysisContext context, String elem xmlWriter.writeStartElement(elementName); xmlWriter.writeNamespace("", DYN_URI); - xmlDynawoWriter.writeContingencies(xmlWriter, context); + xmlStreamWriterConsumer.accept(xmlWriter); xmlWriter.writeEndElement(); xmlWriter.writeEndDocument(); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java new file mode 100644 index 000000000..6a23580c2 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java @@ -0,0 +1,20 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.iidm.network.Network; + +import java.util.List; + +/** + * @author Laurent Issertial {@literal } + */ +public interface LoadsVariationSupplier { + + List getLoadsVariations(Network network); +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 066a45810..712df1be5 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -9,6 +9,7 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsContext; import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; @@ -25,8 +26,9 @@ /** * @author Laurent Issertial */ -public class MarginCalculationContext extends DynawoSimulationContext { +public class MarginCalculationContext extends DynawoSimulationContext implements DynawoAlgorithmsContext { + private final MarginCalculationParameters marginCalculationParameters; private final List contingencies; private final List contingencyEventModels; private final LoadVariationAreaAutomationSystem loadVariationArea; @@ -42,6 +44,7 @@ public MarginCalculationContext(Network network, String workingVariantId, super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), //TODO fix new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters); + this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); this.contingencies = contingencies; @@ -58,10 +61,15 @@ private static void splitDynamicModels(List dynamicModels) { } + public MarginCalculationParameters getMarginCalculationParameters() { + return marginCalculationParameters; + } + public List getContingencies() { return contingencies; } + @Override public List getContingencyEventModels() { return contingencyEventModels; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java new file mode 100644 index 000000000..29ff928ac --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java @@ -0,0 +1,45 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.computation.Command; +import com.powsybl.computation.ExecutionReport; +import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; +import com.powsybl.dynawo.margincalculation.results.XmlMarginCalculationResultParser; +import com.powsybl.dynawo.margincalculation.xml.MultipleJobsXml; + +import javax.xml.stream.XMLStreamException; +import java.io.IOException; +import java.nio.file.Path; + +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationHandler extends AbstractDynawoAlgorithmsHandler { + + public MarginCalculationHandler(MarginCalculationContext context, Command command, ReportNode reportNode) { + super(context, command, reportNode); + } + + @Override + public MarginCalculationReport after(Path workingDir, ExecutionReport report) throws IOException { + super.after(workingDir, report); + context.getNetwork().getVariantManager().setWorkingVariant(context.getWorkingVariantId()); + Path resultsFile = workingDir.resolve(AGGREGATED_RESULTS); + new XmlMarginCalculationResultParser().parse(resultsFile); + return new MarginCalculationReport(new XmlMarginCalculationResultParser().parse(resultsFile)); + } + + @Override + protected void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOException { + MultipleJobsXml.write(workingDir, context); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java new file mode 100644 index 000000000..c5861b936 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -0,0 +1,85 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.commons.Versionable; +import com.powsybl.commons.config.PlatformConfig; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.computation.ExecutionEnvironment; +import com.powsybl.contingency.ContingenciesProvider; +import com.powsybl.dynamicsimulation.DynamicModelsSupplier; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.commons.DynawoUtil; +import com.powsybl.dynawo.commons.PowsyblDynawoVersion; +import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; +import com.powsybl.iidm.network.Network; + +import java.util.Collections; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + +import static com.powsybl.dynawo.DynawoSimulationConfig.DYNAWO_LAUNCHER_PROGRAM_NAME; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsCommandUtil.getCommand; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsCommandUtil.getVersionCommand; + +/** + * @author Laurent Issertial {@literal } + */ +//TODO add an interface and API +public class MarginCalculationProvider implements Versionable { + + private static final String WORKING_DIR_PREFIX = "dynawo_mc_"; + private final DynawoAlgorithmsConfig config; + + public MarginCalculationProvider() { + this(PlatformConfig.defaultConfig()); + } + + public MarginCalculationProvider(PlatformConfig platformConfig) { + this(DynawoAlgorithmsConfig.load(platformConfig)); + } + + public MarginCalculationProvider(DynawoAlgorithmsConfig config) { + this.config = Objects.requireNonNull(config); + } + + public CompletableFuture run(Network network, String workingVariantId, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + + ReportNode mcReportNode = MarginCalculationReports.createMarginCalculationReportNode(runParameters.getReportNode(), network.getId()); + network.getVariantManager().setWorkingVariant(workingVariantId); + ExecutionEnvironment execEnv = new ExecutionEnvironment(Collections.emptyMap(), WORKING_DIR_PREFIX, config.isDebug()); + DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWO_LAUNCHER_PROGRAM_NAME, false); + MarginCalculationParameters parameters = runParameters.getMarginCalculationParameters(); + MarginCalculationContext context = new MarginCalculationContext(network, workingVariantId, + BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, mcReportNode), + parameters, + //TODO fix + DynawoSimulationParameters.load(), + contingenciesProvider.getContingencies(network), + loadsVariationSupplier.getLoadsVariations(network)); + + return runParameters.getComputationManager().execute(execEnv, + new MarginCalculationHandler(context, getCommand(config, "MC", "dynawo_dynamic_mc"), mcReportNode)); + } + + @Override + public String getName() { + return DynawoSimulationProvider.NAME; + } + + @Override + public String getVersion() { + return new PowsyblDynawoVersion().getMavenProjectVersion(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java new file mode 100644 index 000000000..89fdf63d5 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java @@ -0,0 +1,49 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; + +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationReport { + + private final List loadIncreaseResults; + private byte[] logBytes; + + public static MarginCalculationReport empty() { + return new MarginCalculationReport(Collections.emptyList()); + } + + public MarginCalculationReport(List loadIncreaseResults) { + this.loadIncreaseResults = Objects.requireNonNull(loadIncreaseResults); + } + + public List getResults() { + return loadIncreaseResults; + } + + /** + * Gets log file in bytes. + * @return an Optional describing the zip bytes + */ + public Optional getLogBytes() { + return Optional.ofNullable(logBytes); + } + + public MarginCalculationReport setLogBytes(byte[] logBytes) { + this.logBytes = logBytes; + return this; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java new file mode 100644 index 000000000..a18bca0d7 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java @@ -0,0 +1,26 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.commons.report.ReportNode; + +/** + * @author Laurent Issertial {@literal } + */ +public final class MarginCalculationReports { + + private MarginCalculationReports() { + } + + public static ReportNode createMarginCalculationReportNode(ReportNode reportNode, String networkId) { + return reportNode.newReportNode() + .withMessageTemplate("mc", "Dynawo margin calculation on network '${networkId}'") + .withUntypedValue("networkId", networkId) + .add(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationRunParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationRunParameters.java new file mode 100644 index 000000000..87fbbf486 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationRunParameters.java @@ -0,0 +1,91 @@ +/** + * 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.dynawo.margincalculation; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.computation.ComputationManager; +import com.powsybl.computation.local.LocalComputationManager; + +import java.util.Objects; +import java.util.function.Supplier; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationRunParameters { + + private static final Supplier DEFAULT_MC_PARAMETERS_SUPPLIER = MarginCalculationParameters::load; + private static final Supplier DEFAULT_COMPUTATION_MANAGER_SUPPLIER = LocalComputationManager::getDefault; + + private MarginCalculationParameters marginCalculationParameters; + private ComputationManager computationManager; + private ReportNode reportNode = ReportNode.NO_OP; + + /** + * Returns a {@link MarginCalculationRunParameters} instance with default value on each field. + * @return the MarginCalculationRunParameters instance. + */ + public static MarginCalculationRunParameters getDefault() { + return new MarginCalculationRunParameters() + .setMarginCalculationParameters(DEFAULT_MC_PARAMETERS_SUPPLIER.get()) + .setComputationManager(DEFAULT_COMPUTATION_MANAGER_SUPPLIER.get()); + } + + /** + * {@link MarginCalculationParameters} getter
+ * If null, sets the field to its default value with {@link #DEFAULT_MC_PARAMETERS_SUPPLIER} before returning it. + */ + public MarginCalculationParameters getMarginCalculationParameters() { + if (marginCalculationParameters == null) { + setMarginCalculationParameters(DEFAULT_MC_PARAMETERS_SUPPLIER.get()); + } + return marginCalculationParameters; + } + + /** + * {@link ComputationManager} getter
+ * If null, sets the field to its default value with {@link #DEFAULT_COMPUTATION_MANAGER_SUPPLIER} before returning it. + */ + public ComputationManager getComputationManager() { + if (computationManager == null) { + setComputationManager(DEFAULT_COMPUTATION_MANAGER_SUPPLIER.get()); + } + return computationManager; + } + + public ReportNode getReportNode() { + return reportNode; + } + + /** + * Sets the security analysis parameters, see {@link MarginCalculationRunParameters}. + */ + public MarginCalculationRunParameters setMarginCalculationParameters(MarginCalculationParameters marginCalculationParameters) { + Objects.requireNonNull(marginCalculationParameters, "Margin calculation parameters should not be null"); + this.marginCalculationParameters = marginCalculationParameters; + return this; + } + + /** + * Sets the computationManager handling command execution. + */ + public MarginCalculationRunParameters setComputationManager(ComputationManager computationManager) { + Objects.requireNonNull(computationManager, "ComputationManager should not be null"); + this.computationManager = computationManager; + return this; + } + + /** + * Sets the reportNode used for functional logs, see {@link ReportNode} + */ + public MarginCalculationRunParameters setReportNode(ReportNode reportNode) { + Objects.requireNonNull(reportNode, "ReportNode should not be null"); + this.reportNode = reportNode; + return this; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java new file mode 100644 index 000000000..9a87370a5 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java @@ -0,0 +1,68 @@ +/** + * 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.dynawo.margincalculation.xml; + +import com.powsybl.dynawo.algorithms.xml.XmlUtil; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.security.ContingencyEventModels; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; + +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; + +/** + * @author Laurent Issertial + */ +//TODO add tests +public final class MultipleJobsXml { + + private MultipleJobsXml() { + } + + public static void write(Path workingDir, MarginCalculationContext context) throws IOException, XMLStreamException { + Objects.requireNonNull(workingDir); + Path file = workingDir.resolve(MULTIPLE_JOBS_FILENAME); + XmlUtil.write(file, "multipleJobs", w -> writeMarginCalculation(w, context)); + } + + private static void writeMarginCalculation(XMLStreamWriter writer, MarginCalculationContext context) { + try { + MarginCalculationParameters parameters = context.getMarginCalculationParameters(); + writer.writeStartElement("marginCalculation"); + writer.writeAttribute("calculationType", parameters.getCalculationType().toString()); + writer.writeAttribute("accuracy", Double.toString(parameters.getAccuracy())); + writeScenarios(writer, context.getContingencyEventModels()); + writer.writeEmptyElement("loadIncrease"); + writer.writeAttribute("jobsFile", JOBS_FILENAME); + writer.writeEndElement(); + } catch (XMLStreamException e) { + throw new RuntimeException(e); + } + } + + private static void writeScenarios(XMLStreamWriter writer, List models) throws XMLStreamException { + writer.writeStartElement("scenarios"); + writer.writeAttribute("jobsFile", PHASE_2_JOBS_FILENAME); + for (ContingencyEventModels model : models) { + writeScenario(writer, model.getId()); + } + writer.writeEndElement(); + } + + private static void writeScenario(XMLStreamWriter writer, String id) throws XMLStreamException { + writer.writeEmptyElement("scenario"); + writer.writeAttribute("id", id); + writer.writeAttribute("dydFile", id + ".dyd"); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java index 2720330b0..5e1b7cd60 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java @@ -7,24 +7,14 @@ */ package com.powsybl.dynawo.security; -import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.report.ReportNode; -import com.powsybl.computation.AbstractExecutionHandler; import com.powsybl.computation.Command; -import com.powsybl.computation.CommandExecution; import com.powsybl.computation.ExecutionReport; import com.powsybl.dynaflow.ContingencyResultsUtils; -import com.powsybl.dynawo.xml.DydXml; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; -import com.powsybl.dynawo.xml.JobsXml; -import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; import com.powsybl.dynawo.commons.DynawoConstants; -import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.NetworkResultsUpdater; -import com.powsybl.dynawo.security.xml.ContingenciesDydXml; -import com.powsybl.dynawo.security.xml.ContingenciesParXml; import com.powsybl.dynawo.security.xml.MultipleJobsXml; -import com.powsybl.iidm.network.Network; import com.powsybl.iidm.serde.NetworkSerDe; import com.powsybl.security.LimitViolationFilter; import com.powsybl.security.SecurityAnalysisReport; @@ -33,57 +23,36 @@ import javax.xml.stream.XMLStreamException; import java.io.IOException; -import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; import java.util.List; import static com.powsybl.dynaflow.SecurityAnalysisConstants.DYNAWO_CONSTRAINTS_FOLDER; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.OUTPUTS_FOLDER; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; -import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; /** * @author Laurent Issertial */ -public final class DynawoSecurityAnalysisHandler extends AbstractExecutionHandler { +public final class DynawoSecurityAnalysisHandler extends AbstractDynawoAlgorithmsHandler { - private final SecurityAnalysisContext context; - private final Command command; - private final Network network; private final LimitViolationFilter violationFilter; private final List interceptors; - private final ReportNode reportNode; public DynawoSecurityAnalysisHandler(SecurityAnalysisContext context, Command command, LimitViolationFilter violationFilter, List interceptors, ReportNode reportNode) { - this.context = context; - this.network = context.getNetwork(); - this.command = command; + super(context, command, reportNode); this.violationFilter = violationFilter; this.interceptors = interceptors; - this.reportNode = reportNode; - } - - @Override - public List before(Path workingDir) throws IOException { - network.getVariantManager().setWorkingVariant(context.getWorkingVariantId()); - Path outputNetworkFile = workingDir.resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); - if (Files.exists(outputNetworkFile)) { - Files.delete(outputNetworkFile); - } - writeInputFiles(workingDir); - return getCommandExecutions(command); } @Override public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) throws IOException { super.after(workingDir, report); context.getNetwork().getVariantManager().setWorkingVariant(context.getWorkingVariantId()); - Path outputNetworkFile = workingDir.resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); + Path outputNetworkFile = workingDir.resolve(BASE_SCENARIO_FOLDER).resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); if (Files.exists(outputNetworkFile)) { NetworkResultsUpdater.update(context.getNetwork(), NetworkSerDe.read(outputNetworkFile), context.getDynawoSimulationParameters().isMergeLoads()); } @@ -97,19 +66,8 @@ public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) thr ); } - private void writeInputFiles(Path workingDir) { - try { - DynawoUtil.writeIidm(network, workingDir.resolve(DynawoSimulationConstants.NETWORK_FILENAME)); - JobsXml.write(workingDir, context); - DydXml.write(workingDir, context); - ParametersXml.write(workingDir, context); - MultipleJobsXml.write(workingDir, context); - ContingenciesDydXml.write(workingDir, context); - ContingenciesParXml.write(workingDir, context); - } catch (IOException e) { - throw new UncheckedIOException(e); - } catch (XMLStreamException e) { - throw new UncheckedXmlStreamException(e); - } + @Override + protected void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOException { + MultipleJobsXml.write(workingDir, context); } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index 14e336a9f..863c4dde4 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -10,16 +10,14 @@ import com.google.auto.service.AutoService; import com.powsybl.commons.config.PlatformConfig; import com.powsybl.commons.report.ReportNode; -import com.powsybl.computation.Command; import com.powsybl.computation.ExecutionEnvironment; -import com.powsybl.computation.SimpleCommandBuilder; import com.powsybl.contingency.ContingenciesProvider; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.iidm.network.Network; @@ -30,13 +28,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.concurrent.CompletableFuture; import static com.powsybl.dynawo.DynawoSimulationConfig.DYNAWO_LAUNCHER_PROGRAM_NAME; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsCommandUtil.getCommand; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsCommandUtil.getVersionCommand; /** * @author Laurent Issertial @@ -88,7 +87,8 @@ public CompletableFuture run(Network network, String wor DynawoSimulationParameters.load(parameters.getDynamicSimulationParameters()), contingencies); - return runParameters.getComputationManager().execute(execEnv, new DynawoSecurityAnalysisHandler(context, getCommand(config), runParameters.getFilter(), runParameters.getInterceptors(), dsaReportNode)); + return runParameters.getComputationManager().execute(execEnv, new DynawoSecurityAnalysisHandler(context, getCommand(config, "SA", "dynawo_dynamic_sa"), + runParameters.getFilter(), runParameters.getInterceptors(), dsaReportNode)); } @Override @@ -100,25 +100,4 @@ public String getName() { public String getVersion() { return new PowsyblDynawoVersion().getMavenProjectVersion(); } - - public static Command getCommand(DynawoAlgorithmsConfig config) { - List args = Arrays.asList( - "SA", - "--input", DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME, - "--output", DynawoSimulationConstants.AGGREGATED_RESULTS); - return new SimpleCommandBuilder() - .id("dynawo_dynamic_sa") - .program(config.getProgram()) - .args(args) - .build(); - } - - public static Command getVersionCommand(DynawoAlgorithmsConfig config) { - List args = Collections.singletonList("--version"); - return new SimpleCommandBuilder() - .id("dynawo_version") - .program(config.getProgram()) - .args(args) - .build(); - } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index 3b507acba..0a7b0148f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -12,6 +12,7 @@ import com.powsybl.contingency.ContingencyElement; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsContext; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.events.ContextDependentEvent; import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; @@ -24,7 +25,7 @@ /** * @author Laurent Issertial */ -public class SecurityAnalysisContext extends DynawoSimulationContext { +public class SecurityAnalysisContext extends DynawoSimulationContext implements DynawoAlgorithmsContext { private final List contingencies; private final List contingencyEventModels; @@ -38,6 +39,7 @@ public SecurityAnalysisContext(Network network, String workingVariantId, parameters.getDynamicSimulationParameters(), dynawoSimulationParameters); double contingenciesStartTime = parameters.getDynamicContingenciesParameters().getContingenciesStartTime(); this.contingencies = contingencies; + //TODO use ContingencyEventModelsHandler instead this.contingencyEventModels = contingencies.stream() .map(c -> { ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() @@ -73,6 +75,7 @@ public List getContingencies() { return contingencies; } + @Override public List getContingencyEventModels() { return contingencyEventModels; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java index 892c8ebbf..c6ff16f5c 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java @@ -7,6 +7,7 @@ */ package com.powsybl.dynawo.security.xml; +import com.powsybl.dynawo.algorithms.xml.XmlUtil; import com.powsybl.dynawo.security.ContingencyEventModels; import com.powsybl.dynawo.security.SecurityAnalysisContext; @@ -16,8 +17,7 @@ import java.nio.file.Path; import java.util.Objects; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.JOBS_FILENAME; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; /** * @author Laurent Issertial @@ -30,18 +30,21 @@ private MultipleJobsXml() { public static void write(Path workingDir, SecurityAnalysisContext context) throws IOException, XMLStreamException { Objects.requireNonNull(workingDir); Path file = workingDir.resolve(MULTIPLE_JOBS_FILENAME); - - XmlUtil.write(file, context, "multipleJobs", MultipleJobsXml::writeContingencies); + XmlUtil.write(file, "multipleJobs", w -> writeContingencies(w, context)); } - private static void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) throws XMLStreamException { - writer.writeStartElement("scenarios"); - writer.writeAttribute("jobsFile", JOBS_FILENAME); - for (ContingencyEventModels model : context.getContingencyEventModels()) { - writeScenario(writer, model.getId()); + private static void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) { + try { + writer.writeStartElement("scenarios"); + writer.writeAttribute("jobsFile", JOBS_FILENAME); + for (ContingencyEventModels model : context.getContingencyEventModels()) { + writeScenario(writer, model.getId()); + } + writeBaseScenario(writer); + writer.writeEndElement(); + } catch (XMLStreamException e) { + throw new RuntimeException(e); } - writeBaseScenario(writer); - writer.writeEndElement(); } private static void writeScenario(XMLStreamWriter writer, String id) throws XMLStreamException { diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java index 939abbc89..377df83c8 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java @@ -10,6 +10,7 @@ import com.google.common.jimfs.Jimfs; import com.powsybl.commons.config.InMemoryPlatformConfig; import com.powsybl.commons.config.MapModuleConfig; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java index 39a44c951..25f20e70d 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java @@ -9,6 +9,8 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; +import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; +import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; import com.powsybl.dynawo.xml.DynawoTestUtil; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; @@ -27,6 +29,7 @@ class ContingenciesXmlTest extends DynawoTestUtil { @Test void writeDyds() throws SAXException, IOException, XMLStreamException { + //TODO use ContingenciesEvent supplier and move test DynamicSecurityAnalysisParameters parameters = DynamicSecurityAnalysisParameters.load(); parameters.setDynamicSimulationParameters(new DynamicSimulationParameters(0, 20)); parameters.setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(10)); @@ -39,8 +42,8 @@ void writeDyds() throws SAXException, IOException, XMLStreamException { .build()); SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); - ContingenciesDydXml.write(tmpDir, context); - ContingenciesParXml.write(tmpDir, context); + ContingenciesDydXml.write(tmpDir, context.getContingencyEventModels()); + ContingenciesParXml.write(tmpDir, context.getContingencyEventModels()); validate("dyd.xsd", "LOAD.xml", tmpDir.resolve("LOAD.dyd")); validate("dyd.xsd", "DisconnectLineGenerator.xml", tmpDir.resolve("DisconnectLineGenerator.dyd")); validate("parameters.xsd", "LOAD_par.xml", tmpDir.resolve("LOAD.par")); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java index 3eb4f0929..b79f14b21 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java @@ -15,6 +15,9 @@ public final class DynawoSimulationConstants { public static final String JOBS_FILENAME = "powsybl_dynawo.jobs"; + // TODO create and add to a DynawoAlgorithmsConstants ? + public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; + public static final String NETWORK_FILENAME = "powsybl_dynawo.xiidm"; public static final String DYD_FILENAME = "powsybl_dynawo.dyd"; @@ -35,6 +38,8 @@ public final class DynawoSimulationConstants { public static final String FINAL_STATE_FOLDER = "finalState"; + public static final String BASE_SCENARIO_FOLDER = "base"; + private DynawoSimulationConstants() { } From e0caacbfd99fbfa434ca1261e8b90e165cd332c7 Mon Sep 17 00:00:00 2001 From: lisrte Date: Fri, 6 Sep 2024 17:02:41 +0200 Subject: [PATCH 18/28] Add LoadsVariationSupplier, fix todo Signed-off-by: lisrte --- .../dynawo/it/DynawoSecurityAnalysisTest.java | 2 +- .../AbstractDynawoAlgorithmsHandler.java | 6 +- .../ContingencyEventModels.java | 2 +- .../ContingencyEventModelsFactory.java} | 27 +++--- .../DynawoAlgorithmsCommandUtil.java | 8 +- .../algorithms/DynawoAlgorithmsContext.java | 21 ----- .../algorithms/xml/AlgorithmsConstants.java | 25 ++++++ .../algorithms/xml/ContingenciesDydXml.java | 2 +- .../algorithms/xml/ContingenciesParXml.java | 2 +- .../dynawo/algorithms/xml/XmlUtil.java | 2 +- .../MarginCalculationContext.java | 35 ++++---- .../MarginCalculationHandler.java | 7 +- .../MarginCalculationProvider.java | 2 + .../MarginCalculationReports.java | 8 ++ .../LoadVariationAreaAutomationSystem.java | 2 +- .../{ => loadsvariation}/LoadsVariation.java | 2 +- .../loadsvariation/LoadsVariationBuilder.java | 83 +++++++++++++++++++ .../LoadsVariationJsonDeserializer.java | 83 +++++++++++++++++++ .../supplier}/LoadsVariationSupplier.java | 11 ++- .../supplier/LoadsVariationUtils.java | 31 +++++++ .../MarginCalculationReport.java | 4 +- .../xml/MultipleJobsXml.java | 4 +- .../DynawoSecurityAnalysisHandler.java | 5 ++ .../DynawoSecurityAnalysisProvider.java | 3 +- .../security/SecurityAnalysisContext.java | 54 ++++-------- .../dynawo/security/xml/MultipleJobsXml.java | 3 +- .../xml/LoadVariationAreaXmlTest.java | 2 +- .../security/xml/MultiplesJobsXmlTest.java | 5 +- .../src/test/resources/load_variations.json | 25 ++++++ .../dynawo/DynawoSimulationContext.java | 2 +- .../dynawo/xml/DynawoSimulationConstants.java | 10 +-- 31 files changed, 349 insertions(+), 129 deletions(-) rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security => algorithms}/ContingencyEventModels.java (97%) rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/{security/ContingencyEventModelsHandler.java => algorithms/ContingencyEventModelsFactory.java} (65%) delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/{ => loadsvariation}/LoadVariationAreaAutomationSystem.java (98%) rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/{ => loadsvariation}/LoadsVariation.java (91%) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/{ => loadsvariation/supplier}/LoadsVariationSupplier.java (54%) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/{ => results}/MarginCalculationReport.java (91%) create mode 100644 dynawo-security-analysis/src/test/resources/load_variations.json diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index b547b9979..beefac9db 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -59,7 +59,7 @@ class DynawoSecurityAnalysisTest extends AbstractDynawoTest { @BeforeEach void setUp() throws Exception { super.setUp(); - provider = new DynawoSecurityAnalysisProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), true)); + provider = new DynawoSecurityAnalysisProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), false)); parameters = new DynamicSecurityAnalysisParameters() .setDynamicSimulationParameters(new DynamicSimulationParameters(0, 100)) .setDynamicContingenciesParameters(new DynamicSecurityAnalysisParameters.ContingenciesParameters(50)); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java index 9e75143a4..a7bb9a6d2 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java @@ -13,8 +13,6 @@ import com.powsybl.computation.Command; import com.powsybl.computation.CommandExecution; import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; -import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.xml.DydXml; @@ -37,7 +35,7 @@ /** * @author Laurent Issertial {@literal } */ -public abstract class AbstractDynawoAlgorithmsHandler extends AbstractExecutionHandler { +public abstract class AbstractDynawoAlgorithmsHandler extends AbstractExecutionHandler { protected final S context; protected final Command command; @@ -69,8 +67,6 @@ private void writeInputFiles(Path workingDir) { DydXml.write(workingDir, context); ParametersXml.write(workingDir, context); writeMultipleJobs(workingDir); - ContingenciesDydXml.write(workingDir, context.getContingencyEventModels()); - ContingenciesParXml.write(workingDir, context.getContingencyEventModels()); } catch (IOException e) { throw new UncheckedIOException(e); } catch (XMLStreamException e) { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java similarity index 97% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java index be7f81a18..be2b6fe72 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModels.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security; +package com.powsybl.dynawo.algorithms; import com.powsybl.contingency.Contingency; import com.powsybl.dynawo.models.BlackBoxModel; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java similarity index 65% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java index 247cf0c29..17d00a558 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security; +package com.powsybl.dynawo.algorithms; import com.powsybl.commons.PowsyblException; import com.powsybl.contingency.Contingency; @@ -14,6 +14,7 @@ import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.events.ContextDependentEvent; import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import java.util.List; import java.util.stream.Collectors; @@ -21,32 +22,25 @@ /** * @author Laurent Issertial */ -public final class ContingencyEventModelsHandler { +public final class ContingencyEventModelsFactory { - private final List contingencyEventModels; - - public static ContingencyEventModelsHandler createFrom(List contingencies, DynawoSimulationContext context, double contingenciesStartTime) { - List contingencyEventModels = contingencies.stream() + public static List createFrom(List contingencies, DynawoSimulationContext context, + MacroConnectionsAdder macroConnectionsAdder, double contingenciesStartTime) { + return contingencies.stream() .map(c -> { ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() .map(ce -> createContingencyEventModel(ce, context, contingenciesStartTime)) .toList()); // Set Contingencies connections and parameters - //TODO add getter - context.macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); - context.macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); + macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); + macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); cem.eventModels().forEach(em -> { - em.createMacroConnections(context.macroConnectionsAdder); + em.createMacroConnections(macroConnectionsAdder); em.createDynamicModelParameters(context, cem.eventParameters()::add); }); return cem; }) .collect(Collectors.toList()); - return new ContingencyEventModelsHandler(contingencyEventModels); - } - - private ContingencyEventModelsHandler(List contingencyEventModels) { - this.contingencyEventModels = contingencyEventModels; } private static BlackBoxModel createContingencyEventModel(ContingencyElement element, DynawoSimulationContext context, double contingenciesStartTime) { @@ -63,7 +57,6 @@ private static BlackBoxModel createContingencyEventModel(ContingencyElement elem return bbm; } - public List getContingencyEventModels() { - return contingencyEventModels; + private ContingencyEventModelsFactory() { } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java index 4aa8a31b4..fa0031914 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java @@ -9,12 +9,14 @@ import com.powsybl.computation.Command; import com.powsybl.computation.SimpleCommandBuilder; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; import java.util.Arrays; import java.util.Collections; import java.util.List; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.AGGREGATED_RESULTS; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; + /** * @author Laurent Issertial {@literal } */ @@ -26,8 +28,8 @@ private DynawoAlgorithmsCommandUtil() { public static Command getCommand(DynawoAlgorithmsConfig config, String mode, String id) { List args = Arrays.asList( mode, - "--input", DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME, - "--output", DynawoSimulationConstants.AGGREGATED_RESULTS); + "--input", MULTIPLE_JOBS_FILENAME, + "--output", AGGREGATED_RESULTS); return new SimpleCommandBuilder() .id(id) .program(config.getProgram()) diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java deleted file mode 100644 index 719aa88c8..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsContext.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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.dynawo.algorithms; - -import com.powsybl.dynawo.security.ContingencyEventModels; - -import java.util.List; - -/** - * @author Laurent Issertial {@literal } - */ -//TODO replace with functional interface? -public interface DynawoAlgorithmsContext { - - List getContingencyEventModels(); -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java new file mode 100644 index 000000000..bd74bae8d --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java @@ -0,0 +1,25 @@ +/** + * 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.dynawo.algorithms.xml; + +/** + * @author Laurent Issertial {@literal } + */ +public final class AlgorithmsConstants { + + public static final String MULTIPLE_JOBS_FILENAME = "multiple_jobs.xml"; + + public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; + + public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; + + public static final String BASE_SCENARIO_FOLDER = "base"; + + private AlgorithmsConstants() { + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java index 0807e7c82..ae14f4fad 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesDydXml.java @@ -10,7 +10,7 @@ import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; -import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java index dba13438e..1fc8795ac 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/ContingenciesParXml.java @@ -8,7 +8,7 @@ package com.powsybl.dynawo.algorithms.xml; import com.powsybl.dynawo.xml.ParametersXml; -import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import java.nio.file.Path; import java.util.List; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java index 37734c431..72e5a2b46 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/XmlUtil.java @@ -8,7 +8,7 @@ package com.powsybl.dynawo.algorithms.xml; import com.powsybl.dynawo.xml.XmlStreamWriterFactory; -import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 712df1be5..5d9f8706e 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -7,17 +7,19 @@ */ package com.powsybl.dynawo.margincalculation; +import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawo.algorithms.DynawoAlgorithmsContext; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadVariationAreaAutomationSystem; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; -import com.powsybl.dynawo.security.ContingencyEventModels; -import com.powsybl.dynawo.security.ContingencyEventModelsHandler; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModelsFactory; import com.powsybl.dynawo.xml.DydDataSupplier; import com.powsybl.iidm.network.Network; @@ -26,10 +28,9 @@ /** * @author Laurent Issertial */ -public class MarginCalculationContext extends DynawoSimulationContext implements DynawoAlgorithmsContext { +public class MarginCalculationContext extends DynawoSimulationContext { private final MarginCalculationParameters marginCalculationParameters; - private final List contingencies; private final List contingencyEventModels; private final LoadVariationAreaAutomationSystem loadVariationArea; private final List loadVariationMacroConnectList = new ArrayList<>(); @@ -41,14 +42,23 @@ public MarginCalculationContext(Network network, String workingVariantId, DynawoSimulationParameters dynawoSimulationParameters, List contingencies, List loadsVariations) { + this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, loadsVariations, ReportNode.NO_OP); + } + + public MarginCalculationContext(Network network, String workingVariantId, + List dynamicModels, + MarginCalculationParameters parameters, + DynawoSimulationParameters dynawoSimulationParameters, + List contingencies, + List loadsVariations, + ReportNode reportNode) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), //TODO fix - new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters); + //TODO calculate phase 2 predicate + new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters, reportNode); this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); - - this.contingencies = contingencies; - this.contingencyEventModels = ContingencyEventModelsHandler.createFrom(contingencies, this, contingenciesStartTime).getContingencyEventModels(); + this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime); this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, parameters.getLoadIncreaseStartTime(), parameters.getLoadIncreaseStopTime()); macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); @@ -58,18 +68,13 @@ public MarginCalculationContext(Network network, String workingVariantId, } private static void splitDynamicModels(List dynamicModels) { - + //TODO } public MarginCalculationParameters getMarginCalculationParameters() { return marginCalculationParameters; } - public List getContingencies() { - return contingencies; - } - - @Override public List getContingencyEventModels() { return contingencyEventModels; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java index 29ff928ac..f0b528b9d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java @@ -11,6 +11,9 @@ import com.powsybl.computation.Command; import com.powsybl.computation.ExecutionReport; import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; +import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; +import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationReport; import com.powsybl.dynawo.margincalculation.results.XmlMarginCalculationResultParser; import com.powsybl.dynawo.margincalculation.xml.MultipleJobsXml; @@ -18,7 +21,7 @@ import java.io.IOException; import java.nio.file.Path; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.AGGREGATED_RESULTS; /** * @author Laurent Issertial {@literal } @@ -41,5 +44,7 @@ public MarginCalculationReport after(Path workingDir, ExecutionReport report) th @Override protected void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOException { MultipleJobsXml.write(workingDir, context); + ContingenciesDydXml.write(workingDir, context.getContingencyEventModels()); + ContingenciesParXml.write(workingDir, context.getContingencyEventModels()); } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java index c5861b936..3e338c3b0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -17,6 +17,8 @@ import com.powsybl.dynawo.DynawoSimulationProvider; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; +import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationReport; import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.iidm.network.Network; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java index a18bca0d7..de812b811 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReports.java @@ -8,6 +8,7 @@ package com.powsybl.dynawo.margincalculation; import com.powsybl.commons.report.ReportNode; +import com.powsybl.commons.report.TypedValue; /** * @author Laurent Issertial {@literal } @@ -23,4 +24,11 @@ public static ReportNode createMarginCalculationReportNode(ReportNode reportNode .withUntypedValue("networkId", networkId) .add(); } + + public static void reportLoadVariationInstantiationFailure(ReportNode reportNode) { + reportNode.newReportNode() + .withMessageTemplate("loadsVariationInstantiationError", "LoadVariation cannot be instantiated") + .withSeverity(TypedValue.WARN_SEVERITY) + .add(); + } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java similarity index 98% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java index cc91c54cc..6d6111614 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.margincalculation; +package com.powsybl.dynawo.margincalculation.loadsvariation; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java similarity index 91% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java index 1fcf4472b..ae4af5e56 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariation.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.margincalculation; +package com.powsybl.dynawo.margincalculation.loadsvariation; import com.powsybl.iidm.network.Load; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java new file mode 100644 index 000000000..4ea1d7803 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java @@ -0,0 +1,83 @@ +/** + * 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.dynawo.margincalculation.loadsvariation; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.dynawo.builders.BuilderEquipmentsList; +import com.powsybl.dynawo.builders.BuilderReports; +import com.powsybl.dynawo.margincalculation.MarginCalculationReports; +import com.powsybl.iidm.network.IdentifiableType; +import com.powsybl.iidm.network.Load; +import com.powsybl.iidm.network.Network; + +import java.util.Collection; +import java.util.Objects; + +/** + * @author Laurent Issertial {@literal } + */ +public class LoadsVariationBuilder { + + private final Network network; + private final ReportNode reportNode; + private boolean isInstantiable = true; + + private final BuilderEquipmentsList loads; + private double variationValue = Double.NaN; + private LoadsVariation.VariationMode mode; + + public LoadsVariationBuilder(Network network, ReportNode reportNode) { + this.network = Objects.requireNonNull(network); + this.reportNode = Objects.requireNonNull(reportNode); + this.loads = new BuilderEquipmentsList<>(IdentifiableType.LOAD, "loads"); + } + + public LoadsVariationBuilder loads(String... loadIds) { + loads.addEquipments(loadIds, network::getLoad); + return this; + } + + public LoadsVariationBuilder loads(Collection loadIds) { + loads.addEquipments(loadIds, network::getLoad); + return this; + } + + public LoadsVariationBuilder variationValue(double variationValue) { + this.variationValue = variationValue; + return this; + } + + public LoadsVariationBuilder variationMode(LoadsVariation.VariationMode mode) { + this.mode = mode; + return this; + } + + protected void checkData() { + isInstantiable = loads.checkEquipmentData(reportNode); + if (Double.isNaN(variationValue)) { + BuilderReports.reportFieldNotSet(reportNode, "variationValue"); + isInstantiable = false; + } + if (mode == null) { + BuilderReports.reportFieldNotSet(reportNode, "variationMode"); + isInstantiable = false; + } + } + + private boolean isInstantiable() { + checkData(); + if (!isInstantiable) { + MarginCalculationReports.reportLoadVariationInstantiationFailure(reportNode); + } + return isInstantiable; + } + + public LoadsVariation build() { + return isInstantiable() ? new LoadsVariation(loads.getEquipments(), variationValue, mode) : null; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java new file mode 100644 index 000000000..ea0fd3230 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java @@ -0,0 +1,83 @@ +/** + * 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.dynawo.margincalculation.loadsvariation.supplier; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.powsybl.commons.json.JsonUtil; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.function.Supplier; + +/** + * @author Laurent Issertial {@literal } + */ +public class LoadsVariationJsonDeserializer extends StdDeserializer> { + + private final transient Supplier builderConstructor; + + public LoadsVariationJsonDeserializer(Supplier builderConstructor) { + super(List.class); + this.builderConstructor = builderConstructor; + } + + @Override + public List deserialize(JsonParser parser, DeserializationContext context) { + List modelConfigList = new ArrayList<>(); + JsonUtil.parseObject(parser, name -> { + if (name.equals("variations")) { + JsonUtil.parseObjectArray(parser, modelConfigList::add, this::parseLoadsVariationBuilder); + return true; + } + return false; + }); + return modelConfigList.stream() + .map(LoadsVariationBuilder::build) + .filter(Objects::nonNull) + .toList(); + } + + private LoadsVariationBuilder parseLoadsVariationBuilder(JsonParser parser) { + LoadsVariationBuilder loadsVariationBuilder = builderConstructor.get(); + JsonUtil.parseObject(parser, name -> { + boolean handled = true; + switch (name) { + case "loadsIds" -> { + List loadsIds = new ArrayList<>(); + JsonUtil.parseObjectArray(parser, loadsIds::add, this::parseLoadsIds); + loadsVariationBuilder.loads(loadsIds); + } + case "variationValue" -> loadsVariationBuilder.variationValue(Double.parseDouble(parser.nextTextValue())); + case "variationMode" -> loadsVariationBuilder.variationMode(LoadsVariation.VariationMode.valueOf(parser.nextTextValue())); + default -> handled = false; + } + return handled; + }); + return loadsVariationBuilder; + } + + //TODO check json model + private String parseLoadsIds(JsonParser parser) { + var temp = new Object() { + String loadId; + }; + JsonUtil.parseObject(parser, name -> { + if (name.equals("id")) { + temp.loadId = parser.nextTextValue(); + return true; + } + return false; + }); + return temp.loadId; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplier.java similarity index 54% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplier.java index 6a23580c2..494f45232 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/LoadsVariationSupplier.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplier.java @@ -5,8 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.margincalculation; +package com.powsybl.dynawo.margincalculation.loadsvariation.supplier; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.iidm.network.Network; import java.util.List; @@ -16,5 +18,10 @@ */ public interface LoadsVariationSupplier { - List getLoadsVariations(Network network); + List getLoadsVariations(Network network, ReportNode reportNode); + + default List getLoadsVariations(Network network) { + return getLoadsVariations(network, ReportNode.NO_OP); + } + } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java new file mode 100644 index 000000000..03f7f95d7 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java @@ -0,0 +1,31 @@ +/** + * 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.dynawo.margincalculation.loadsvariation.supplier; + +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; + +import java.io.InputStream; +import java.nio.file.Path; + +/** + * @author Laurent Issertial {@literal } + */ +public final class LoadsVariationUtils { + + private LoadsVariationUtils() { + } + + public static LoadsVariationSupplier createLoadsVariationSupplier(InputStream is) { + return (n, r) -> new SupplierJsonDeserializer<>(new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(n, r))).deserialize(is); + } + + public static LoadsVariationSupplier createLoadsVariationSupplier(Path path) { + return (n, r) -> new SupplierJsonDeserializer<>(new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(n, r))).deserialize(path); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java similarity index 91% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java index 89fdf63d5..af14038a1 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationReport.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java @@ -5,9 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.margincalculation; - -import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +package com.powsybl.dynawo.margincalculation.results; import java.util.Collections; import java.util.List; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java index 9a87370a5..dc1ca506d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java @@ -10,7 +10,7 @@ import com.powsybl.dynawo.algorithms.xml.XmlUtil; import com.powsybl.dynawo.margincalculation.MarginCalculationContext; import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; -import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; @@ -19,6 +19,8 @@ import java.util.List; import java.util.Objects; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.PHASE_2_JOBS_FILENAME; import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; /** diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java index 5e1b7cd60..0acbd364d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java @@ -12,6 +12,8 @@ import com.powsybl.computation.ExecutionReport; import com.powsybl.dynaflow.ContingencyResultsUtils; import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; +import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; +import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.NetworkResultsUpdater; import com.powsybl.dynawo.security.xml.MultipleJobsXml; @@ -29,6 +31,7 @@ import java.util.List; import static com.powsybl.dynaflow.SecurityAnalysisConstants.DYNAWO_CONSTRAINTS_FOLDER; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.BASE_SCENARIO_FOLDER; import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; @@ -69,5 +72,7 @@ public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) thr @Override protected void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOException { MultipleJobsXml.write(workingDir, context); + ContingenciesDydXml.write(workingDir, context.getContingencyEventModels()); + ContingenciesParXml.write(workingDir, context.getContingencyEventModels()); } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index 863c4dde4..a97455db6 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -85,7 +85,8 @@ public CompletableFuture run(Network network, String wor BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, dsaReportNode), parameters, DynawoSimulationParameters.load(parameters.getDynamicSimulationParameters()), - contingencies); + contingencies, + dsaReportNode); return runParameters.getComputationManager().execute(execEnv, new DynawoSecurityAnalysisHandler(context, getCommand(config, "SA", "dynawo_dynamic_sa"), runParameters.getFilter(), runParameters.getInterceptors(), dsaReportNode)); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index 0a7b0148f..5c3d1afd8 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -7,25 +7,22 @@ */ package com.powsybl.dynawo.security; -import com.powsybl.commons.PowsyblException; +import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; -import com.powsybl.contingency.ContingencyElement; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; -import com.powsybl.dynawo.algorithms.DynawoAlgorithmsContext; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModelsFactory; import com.powsybl.dynawo.models.BlackBoxModel; -import com.powsybl.dynawo.models.events.ContextDependentEvent; -import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; import com.powsybl.iidm.network.Network; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import java.util.*; -import java.util.stream.Collectors; /** * @author Laurent Issertial */ -public class SecurityAnalysisContext extends DynawoSimulationContext implements DynawoAlgorithmsContext { +public class SecurityAnalysisContext extends DynawoSimulationContext { private final List contingencies; private final List contingencyEventModels; @@ -35,47 +32,26 @@ public SecurityAnalysisContext(Network network, String workingVariantId, DynamicSecurityAnalysisParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, List contingencies) { + this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, ReportNode.NO_OP); + } + + public SecurityAnalysisContext(Network network, String workingVariantId, + List dynamicModels, + DynamicSecurityAnalysisParameters parameters, + DynawoSimulationParameters dynawoSimulationParameters, + List contingencies, + ReportNode reportNode) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), - parameters.getDynamicSimulationParameters(), dynawoSimulationParameters); + parameters.getDynamicSimulationParameters(), dynawoSimulationParameters, reportNode); double contingenciesStartTime = parameters.getDynamicContingenciesParameters().getContingenciesStartTime(); this.contingencies = contingencies; - //TODO use ContingencyEventModelsHandler instead - this.contingencyEventModels = contingencies.stream() - .map(c -> { - ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() - .map(ce -> createContingencyEventModel(ce, contingenciesStartTime)) - .toList()); - // Set Contingencies connections and parameters - macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); - macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); - cem.eventModels().forEach(em -> { - em.createMacroConnections(macroConnectionsAdder); - em.createDynamicModelParameters(this, cem.eventParameters()::add); - }); - return cem; - }) - .collect(Collectors.toList()); - } - - private BlackBoxModel createContingencyEventModel(ContingencyElement element, double contingenciesStartTime) { - BlackBoxModel bbm = EventDisconnectionBuilder.of(network) - .staticId(element.getId()) - .startTime(contingenciesStartTime) - .build(); - if (bbm == null) { - throw new PowsyblException("Contingency element " + element.getType() + " not supported"); - } - if (bbm instanceof ContextDependentEvent cde) { - cde.setEquipmentHasDynamicModel(this); - } - return bbm; + this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime); } public List getContingencies() { return contingencies; } - @Override public List getContingencyEventModels() { return contingencyEventModels; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java index c6ff16f5c..6f1423203 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java @@ -8,7 +8,7 @@ package com.powsybl.dynawo.security.xml; import com.powsybl.dynawo.algorithms.xml.XmlUtil; -import com.powsybl.dynawo.security.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.security.SecurityAnalysisContext; import javax.xml.stream.XMLStreamException; @@ -17,6 +17,7 @@ import java.nio.file.Path; import java.util.Objects; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; /** diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java index 7e1b1462e..89a9205b9 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -8,7 +8,7 @@ package com.powsybl.dynawo.margincalculation.xml; import com.powsybl.dynawo.DynawoSimulationParameters; -import com.powsybl.dynawo.margincalculation.LoadsVariation; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.margincalculation.MarginCalculationContext; import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; import com.powsybl.dynawo.xml.DydXml; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java index 91c35df11..bb3c17984 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java @@ -10,7 +10,6 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.xml.DynawoTestUtil; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import org.junit.jupiter.api.Test; @@ -20,6 +19,8 @@ import java.io.IOException; import java.util.List; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; + /** * @author Laurent Issertial */ @@ -38,7 +39,7 @@ void writeMultiplesJobs() throws SAXException, IOException, XMLStreamException { SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); MultipleJobsXml.write(tmpDir, context); - validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME)); + validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(MULTIPLE_JOBS_FILENAME)); } } diff --git a/dynawo-security-analysis/src/test/resources/load_variations.json b/dynawo-security-analysis/src/test/resources/load_variations.json new file mode 100644 index 000000000..f85aaec38 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/load_variations.json @@ -0,0 +1,25 @@ +{ + "variations": [ + { + "loadsIds": [ + { + "id": "LOAD" + } + ], + "variationValue": 12, + "variationMode": "PROPORTIONAL" + }, + { + "loadsIds": [ + { + "id": "LOAD2" + }, + { + "id": "LOAD3" + } + ], + "variationValue": 5, + "variationMode": "PROPORTIONAL" + } + ] +} \ No newline at end of file diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 8726d4b7f..bb9a36df9 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -64,7 +64,7 @@ public class DynawoSimulationContext implements DydDataSupplier { private final DefaultModelsHandler defaultModelsHandler = new DefaultModelsHandler(); private final FrequencySynchronizerModel frequencySynchronizer; private final List dynamicModelsParameters = new ArrayList<>(); - public final MacroConnectionsAdder macroConnectionsAdder; + protected final MacroConnectionsAdder macroConnectionsAdder; private Phase2Models phase2Models; public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java index b79f14b21..c9735cf1d 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java @@ -15,13 +15,11 @@ public final class DynawoSimulationConstants { public static final String JOBS_FILENAME = "powsybl_dynawo.jobs"; - // TODO create and add to a DynawoAlgorithmsConstants ? - public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; - public static final String NETWORK_FILENAME = "powsybl_dynawo.xiidm"; public static final String DYD_FILENAME = "powsybl_dynawo.dyd"; + // TODO use it in dyna algo ? public static final String PHASE_2_DYD_FILENAME = "phase_2_powsybl_dynawo.dyd"; public static final String CRV_FILENAME = "powsybl_dynawo.crv"; @@ -30,16 +28,10 @@ public final class DynawoSimulationConstants { public static final String CURVES_FILENAME = "curves.csv"; - public static final String MULTIPLE_JOBS_FILENAME = "multiple_jobs.xml"; - - public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; - public static final String OUTPUTS_FOLDER = "outputs"; public static final String FINAL_STATE_FOLDER = "finalState"; - public static final String BASE_SCENARIO_FOLDER = "base"; - private DynawoSimulationConstants() { } From c1960c1b16dd1e0ac24b896a5550fbe2f81dbd09 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 19 Dec 2024 14:40:27 +0100 Subject: [PATCH 19/28] Fix merge Signed-off-by: lisrte --- .../dynawo/it/DynawoSecurityAnalysisTest.java | 2 +- .../AbstractDynawoAlgorithmsHandler.java | 22 ++---- .../MarginCalculationContext.java | 7 +- .../LoadVariationAreaAutomationSystem.java | 5 +- .../XmlMarginCalculationResultParser.java | 7 +- .../xml/MultipleJobsXml.java | 2 +- .../ContingencyEventModelsFactory.java | 1 + .../DynawoSecurityAnalysisHandler.java | 23 ++----- .../DynawoSecurityAnalysisProvider.java | 1 + .../security/SecurityAnalysisContext.java | 3 +- .../dynawo/security/xml/MultipleJobsXml.java | 16 +++-- .../results/XmlResultParserTest.java | 5 +- .../security/ContingencyEventModelsTest.java | 1 + .../security/xml/ContingenciesXmlTest.java | 6 +- .../dynawo/DynawoSimulationConstants.java | 9 +++ .../dynawo/DynawoSimulationContext.java | 25 ++++--- .../dynawo/models/AbstractBlackBoxModel.java | 5 -- ...PhaseShifterBlockingIAutomationSystem.java | 5 +- .../dynawo/models/events/AbstractEvent.java | 51 +++++++++++--- .../AbstractFrequencySynchronizer.java | 1 - .../frequencysynchronizers/SignalN.java | 9 ++- .../models/generators/DefaultGenerator.java | 4 +- .../SynchronizedGeneratorControllable.java | 4 +- .../generators/SynchronousGenerator.java | 60 ++++++++++++++++ .../SynchronousGeneratorControllable.java | 4 +- .../models/loads/BaseLoadControllable.java | 8 ++- .../dynawo/models/loads/DefaultLoad.java | 8 ++- .../AbstractXmlDynawoSimulationWriter.java | 1 - .../java/com/powsybl/dynawo/xml/DydXml.java | 46 +++++++++---- .../dynawo/xml/DynawoSimulationConstants.java | 41 ----------- .../java/com/powsybl/dynawo/xml/JobsXml.java | 69 +++++++++++++------ .../dynawo/xml/OutputVariablesXml.java | 6 +- .../xml/AbstractDynamicModelXmlTest.java | 2 +- .../dynawo/xml/ContextPhase2XmlTest.java | 4 +- .../xml/MixedFreqSynchSignalNXmlTest.java | 2 +- 35 files changed, 288 insertions(+), 177 deletions(-) create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java delete mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index 60f936f72..005d1c335 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -17,10 +17,10 @@ import com.powsybl.dynamicsimulation.groovy.GroovyExtension; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.dynawo.parameters.ParametersSet; import com.powsybl.dynawo.xml.ParametersXml; -import com.powsybl.dynawo.security.DynawoAlgorithmsConfig; import com.powsybl.dynawo.security.DynawoSecurityAnalysisProvider; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.VariantManagerConstants; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java index a7bb9a6d2..5f390f4db 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/AbstractDynawoAlgorithmsHandler.java @@ -12,25 +12,20 @@ import com.powsybl.computation.AbstractExecutionHandler; import com.powsybl.computation.Command; import com.powsybl.computation.CommandExecution; +import com.powsybl.dynawo.DynawoFilesUtils; import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoUtil; -import com.powsybl.dynawo.xml.DydXml; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; -import com.powsybl.dynawo.xml.JobsXml; -import com.powsybl.dynawo.xml.ParametersXml; import com.powsybl.iidm.network.Network; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.io.UncheckedIOException; -import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import static com.powsybl.dynawo.DynawoFilesUtils.deleteExistingFile; +import static com.powsybl.dynawo.commons.DynawoConstants.*; import static com.powsybl.dynawo.commons.DynawoUtil.getCommandExecutions; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.FINAL_STATE_FOLDER; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.OUTPUTS_FOLDER; /** * @author Laurent Issertial {@literal } @@ -52,20 +47,15 @@ protected AbstractDynawoAlgorithmsHandler(S context, Command command, ReportNode @Override public List before(Path workingDir) throws IOException { network.getVariantManager().setWorkingVariant(context.getWorkingVariantId()); - Path outputNetworkFile = workingDir.resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); - if (Files.exists(outputNetworkFile)) { - Files.delete(outputNetworkFile); - } + deleteExistingFile(workingDir.resolve(OUTPUTS_FOLDER), FINAL_STATE_FOLDER, OUTPUT_IIDM_FILENAME); writeInputFiles(workingDir); return getCommandExecutions(command); } private void writeInputFiles(Path workingDir) { try { - DynawoUtil.writeIidm(network, workingDir.resolve(DynawoSimulationConstants.NETWORK_FILENAME)); - JobsXml.write(workingDir, context); - DydXml.write(workingDir, context); - ParametersXml.write(workingDir, context); + DynawoUtil.writeIidm(network, workingDir.resolve(NETWORK_FILENAME)); + DynawoFilesUtils.writeInputFiles(workingDir, context); writeMultipleJobs(workingDir); } catch (IOException e) { throw new UncheckedIOException(e); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 5d9f8706e..6bc2a29ab 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -10,9 +10,10 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationConstants; +import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadVariationAreaAutomationSystem; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.models.BlackBoxModel; @@ -54,8 +55,8 @@ public MarginCalculationContext(Network network, String workingVariantId, ReportNode reportNode) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), //TODO fix - //TODO calculate phase 2 predicate - new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters, reportNode); + //TODO calculate phase 2 predicate - hande dyna version + new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters, null, DynawoConstants.VERSION_MIN, reportNode); this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java index 6d6111614..656693990 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java @@ -8,6 +8,7 @@ package com.powsybl.dynawo.margincalculation.loadsvariation; import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.models.VarConnection; import com.powsybl.dynawo.models.loads.ControllableLoadModel; @@ -30,14 +31,14 @@ public class LoadVariationAreaAutomationSystem extends AbstractPureDynamicBlackB private static final String ID = "LOAD_VARIATION_AREA"; private static final String PAR_ID = "loadVarArea"; - private static final String LIB = "DYNModelVariationArea"; + private static final ModelConfig MODEL_CONFIG = new ModelConfig("DYNModelVariationArea"); private final List loadsVariations; private final double loadIncreaseStartTime; private final double loadIncreaseStopTime; public LoadVariationAreaAutomationSystem(List loadsVariations, double loadIncreaseStartTime, double loadIncreaseStopTime) { - super(ID, PAR_ID, LIB); + super(ID, PAR_ID, MODEL_CONFIG); this.loadsVariations = Objects.requireNonNull(loadsVariations); this.loadIncreaseStartTime = loadIncreaseStartTime; this.loadIncreaseStopTime = loadIncreaseStopTime; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java index e4278f5db..81915f448 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java @@ -29,14 +29,12 @@ public final class XmlMarginCalculationResultParser extends AbstractXmlParser read(XMLStreamReader xmlReader) throws XMLStreamException { - List loadIncreaseResults = new ArrayList<>(); + protected void read(XMLStreamReader xmlReader, Consumer consumer) throws XMLStreamException { int state = xmlReader.next(); while (state == XMLStreamConstants.COMMENT) { state = xmlReader.next(); } - XmlUtil.readSubElements(xmlReader, elementName -> readLoadIncreaseResult(elementName, xmlReader, loadIncreaseResults::add)); - return loadIncreaseResults; + XmlUtil.readSubElements(xmlReader, elementName -> readLoadIncreaseResult(elementName, xmlReader, consumer)); } private static void readLoadIncreaseResult(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { @@ -62,6 +60,7 @@ private static void readLoadIncreaseResultSubElements(String elementName, XMLStr } } + //TODO factorize private static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { try { if (elementName.equals("criterionNonRespected")) { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java index dc1ca506d..c744b2988 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java @@ -19,9 +19,9 @@ import java.util.List; import java.util.Objects; +import static com.powsybl.dynawo.DynawoSimulationConstants.JOBS_FILENAME; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.PHASE_2_JOBS_FILENAME; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; /** * @author Laurent Issertial diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java index 33a1ef451..e82d19cc8 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java @@ -13,6 +13,7 @@ import com.powsybl.contingency.ContingencyElement; import com.powsybl.contingency.SidedContingencyElement; import com.powsybl.dynawo.DynawoSimulationContext; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.events.ContextDependentEvent; import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java index 0acbd364d..a5d915e0c 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisHandler.java @@ -10,30 +10,25 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.computation.Command; import com.powsybl.computation.ExecutionReport; -import com.powsybl.dynaflow.ContingencyResultsUtils; +import com.powsybl.dynaflow.results.ContingencyResultsUtils; import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; -import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.NetworkResultsUpdater; import com.powsybl.dynawo.security.xml.MultipleJobsXml; import com.powsybl.iidm.serde.NetworkSerDe; import com.powsybl.security.LimitViolationFilter; import com.powsybl.security.SecurityAnalysisReport; -import com.powsybl.security.SecurityAnalysisResult; import com.powsybl.security.interceptors.SecurityAnalysisInterceptor; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collections; import java.util.List; -import static com.powsybl.dynaflow.SecurityAnalysisConstants.DYNAWO_CONSTRAINTS_FOLDER; -import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.BASE_SCENARIO_FOLDER; -import static com.powsybl.dynawo.commons.DynawoConstants.DYNAWO_TIMELINE_FOLDER; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; +import static com.powsybl.dynaflow.results.ContingencyResultsUtils.createSecurityAnalysisResult; +import static com.powsybl.dynawo.commons.DynawoConstants.*; /** * @author Laurent Issertial @@ -55,18 +50,12 @@ public DynawoSecurityAnalysisHandler(SecurityAnalysisContext context, Command co public SecurityAnalysisReport after(Path workingDir, ExecutionReport report) throws IOException { super.after(workingDir, report); context.getNetwork().getVariantManager().setWorkingVariant(context.getWorkingVariantId()); - Path outputNetworkFile = workingDir.resolve(BASE_SCENARIO_FOLDER).resolve(OUTPUTS_FOLDER).resolve(FINAL_STATE_FOLDER).resolve(DynawoConstants.OUTPUT_IIDM_FILENAME); + Path outputNetworkFile = workingDir.resolve(OUTPUT_IIDM_FILENAME_PATH); if (Files.exists(outputNetworkFile)) { NetworkResultsUpdater.update(context.getNetwork(), NetworkSerDe.read(outputNetworkFile), context.getDynawoSimulationParameters().isMergeLoads()); } - ContingencyResultsUtils.reportContingenciesTimelines(context.getContingencies(), workingDir.resolve(DYNAWO_TIMELINE_FOLDER), reportNode); - - return new SecurityAnalysisReport( - new SecurityAnalysisResult( - ContingencyResultsUtils.getPreContingencyResult(network, violationFilter), - ContingencyResultsUtils.getPostContingencyResults(network, violationFilter, workingDir.resolve(DYNAWO_CONSTRAINTS_FOLDER), context.getContingencies()), - Collections.emptyList()) - ); + ContingencyResultsUtils.reportContingenciesTimelines(context.getContingencies(), workingDir.resolve(TIMELINE_FOLDER), reportNode); + return new SecurityAnalysisReport(createSecurityAnalysisResult(network, violationFilter, workingDir, context.getContingencies())); } @Override diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index 491486c6c..9da2d2cbf 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -18,6 +18,7 @@ import com.powsybl.dynamicsimulation.DynamicModelsSupplier; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; import com.powsybl.dynawo.DynawoSimulationConstants; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index 8135ed8e2..babc290e7 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -11,6 +11,7 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.models.BlackBoxModel; @@ -32,7 +33,7 @@ public SecurityAnalysisContext(Network network, String workingVariantId, DynamicSecurityAnalysisParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, List contingencies) { - this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, DynawoConstants.VERSION_MIN); + this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, DynawoConstants.VERSION_MIN, ReportNode.NO_OP); } public SecurityAnalysisContext(Network network, String workingVariantId, diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java index fcce8a9b1..9b69f54ec 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java @@ -34,13 +34,17 @@ public static void write(Path workingDir, SecurityAnalysisContext context) throw XmlUtil.write(file, "multipleJobs", w -> writeContingencies(w, context)); } - private static void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) throws XMLStreamException { - writer.writeStartElement("scenarios"); - writer.writeAttribute("jobsFile", JOBS_FILENAME); - for (ContingencyEventModels model : context.getContingencyEventModels()) { - writeScenario(writer, model.getId()); + private static void writeContingencies(XMLStreamWriter writer, SecurityAnalysisContext context) { + try { + writer.writeStartElement("scenarios"); + writer.writeAttribute("jobsFile", JOBS_FILENAME); + for (ContingencyEventModels model : context.getContingencyEventModels()) { + writeScenario(writer, model.getId()); + } + writer.writeEndElement(); + } catch (XMLStreamException e) { + throw new RuntimeException(e); } - writer.writeEndElement(); } private static void writeScenario(XMLStreamWriter writer, String id) throws XMLStreamException { diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java index 03c81539c..b8733b53c 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java @@ -13,6 +13,7 @@ import java.io.InputStreamReader; import java.net.URISyntaxException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -28,7 +29,6 @@ class XmlResultParserTest { @Test void test() throws XMLStreamException { - InputStreamReader xml = new InputStreamReader(Objects.requireNonNull(getClass().getResourceAsStream("/result.xml"))); List result = new XmlMarginCalculationResultParser().parse(xml); @@ -46,8 +46,9 @@ void test() throws XMLStreamException { @Test void parseFromPath() throws URISyntaxException { + List result = new ArrayList<>(); Path path = Path.of(Objects.requireNonNull(getClass().getResource("/result.xml")).toURI()); - List result = new XmlMarginCalculationResultParser().parse(path); + new XmlMarginCalculationResultParser().parse(path, result::add); assertEquals(4, result.size()); } diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java index d046092b8..1ef90d53a 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java @@ -12,6 +12,7 @@ import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.generators.BaseGeneratorBuilder; import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java index 39a44c951..e0346cfd0 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java @@ -9,6 +9,8 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; +import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; +import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; import com.powsybl.dynawo.xml.DynawoTestUtil; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; @@ -39,8 +41,8 @@ void writeDyds() throws SAXException, IOException, XMLStreamException { .build()); SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); - ContingenciesDydXml.write(tmpDir, context); - ContingenciesParXml.write(tmpDir, context); + ContingenciesDydXml.write(tmpDir, context.getContingencyEventModels()); + ContingenciesParXml.write(tmpDir, context.getContingencyEventModels()); validate("dyd.xsd", "LOAD.xml", tmpDir.resolve("LOAD.dyd")); validate("dyd.xsd", "DisconnectLineGenerator.xml", tmpDir.resolve("DisconnectLineGenerator.dyd")); validate("parameters.xsd", "LOAD_par.xml", tmpDir.resolve("LOAD.par")); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java index e75fe6a99..ac42a03e5 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java @@ -6,6 +6,8 @@ */ package com.powsybl.dynawo; +import com.powsybl.iidm.network.Network; + /** * @author Marcos de Miguel {@literal } */ @@ -35,6 +37,13 @@ public final class DynawoSimulationConstants { public static final String LOGS_FILENAME = "dynawo.log"; + // TODO use it in dyna algo ? + public static final String PHASE_2_DYD_FILENAME = "phase_2_powsybl_dynawo.dyd"; + private DynawoSimulationConstants() { } + + public static String getSimulationParFile(Network network) { + return network.getId() + ".par"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 7c7f2eaeb..79c703709 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -65,15 +65,21 @@ public class DynawoSimulationContext implements DydDataSupplier { protected final MacroConnectionsAdder macroConnectionsAdder; private Phase2Models phase2Models; - public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, - List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { - this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, ReportNode.NO_OP); - } +// public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, +// List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { +// this(network, workingVariantId, dynamicModels, eventModels, outputVariables, parameters, dynawoSimulationParameters, ReportNode.NO_OP); +// } +// +// public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, +// List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, +// Predicate phase2ModelsPredicate) { +// this(network, workingVariantId, dynamicModels, eventModels, outputVariables, parameters, dynawoSimulationParameters, phase2ModelsPredicate, ReportNode.NO_OP); +// } public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, - List curves, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, - Predicate phase2ModelsPredicate) { - this(network, workingVariantId, dynamicModels, eventModels, curves, parameters, dynawoSimulationParameters, phase2ModelsPredicate, ReportNode.NO_OP); + List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, + DynawoVersion currentVersion, ReportNode reportNode) { + this(network, workingVariantId, dynamicModels, eventModels, outputVariables, parameters, dynawoSimulationParameters, null, currentVersion, reportNode); } public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, @@ -173,13 +179,14 @@ private FrequencySynchronizerModel setupFrequencySynchronizer() { List frequencySynchronizedModels = filterDynamicModels(FrequencySynchronizedModel.class); boolean hasSpecificBuses = dynamicModels.stream().anyMatch(AbstractBus.class::isInstance); boolean hasSignalNModel = !signalNModels.isEmpty(); + String defaultParFile = DynawoSimulationConstants.getSimulationParFile(getNetwork()); if (!frequencySynchronizedModels.isEmpty() && hasSignalNModel) { throw new PowsyblException("Signal N and frequency synchronized generators cannot be used with one another"); } if (hasSignalNModel) { - return new SignalN(signalNModels); + return new SignalN(signalNModels, defaultParFile); } - return hasSpecificBuses ? new SetPoint(frequencySynchronizedModels) : new OmegaRef(frequencySynchronizedModels); + return hasSpecificBuses ? new SetPoint(frequencySynchronizedModels, defaultParFile) : new OmegaRef(frequencySynchronizedModels, defaultParFile); } private List filterDynamicModels(Class modelClass) { diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java index 456c28c15..03c10bdab 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/AbstractBlackBoxModel.java @@ -89,11 +89,6 @@ public List getVarsMapping() { return Collections.emptyList(); } - @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { - write(writer, getParFile(context)); - } - protected void writeDynamicAttributes(XMLStreamWriter writer, String parFileName) throws XMLStreamException { writer.writeAttribute("id", getDynamicModelId()); writer.writeAttribute("lib", getLib()); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java index a3afc73dd..686523f33 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/automationsystems/phaseshifters/PhaseShifterBlockingIAutomationSystem.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.models.automationsystems.phaseshifters; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationReports; import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; @@ -55,9 +54,9 @@ protected List getVarConnectionsWith(TransformerModel connected) } @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException { if (isConnected) { - super.write(writer, context); + super.write(writer, parFileName); } } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java index 8759704d8..22505202a 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/AbstractEvent.java @@ -8,27 +8,38 @@ package com.powsybl.dynawo.models.events; import com.powsybl.dynamicsimulation.EventModel; +import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; +import com.powsybl.dynawo.builders.EventModelInfo; +import com.powsybl.dynawo.builders.VersionInterval; +import com.powsybl.dynawo.models.AbstractBlackBoxModel; +import com.powsybl.dynawo.models.VarMapping; import com.powsybl.dynawo.parameters.ParametersSet; -import com.powsybl.dynawo.xml.DynawoSimulationConstants; import com.powsybl.iidm.network.Identifiable; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import java.util.Collections; +import java.util.List; import java.util.function.Consumer; +import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; + /** * @author Florian Dupuy {@literal } * @author Laurent Issertial {@literal } */ -public abstract class AbstractEvent extends AbstractPureDynamicBlackBoxModel implements EventModel { +public abstract class AbstractEvent extends AbstractBlackBoxModel implements EventModel { + private final EventModelInfo eventModelInfo; private final Identifiable> equipment; private final double startTime; - protected AbstractEvent(String eventId, Identifiable equipment, double startTime, String lib) { - super(eventId, lib); + protected AbstractEvent(String eventId, Identifiable equipment, EventModelInfo eventModelInfo, double startTime) { + super(eventId); this.equipment = equipment; this.startTime = startTime; + this.eventModelInfo = eventModelInfo; } public Identifiable getEquipment() { @@ -36,13 +47,30 @@ public Identifiable getEquipment() { } @Override - public double getStartTime() { - return startTime; + public String getLib() { + return eventModelInfo.name(); } @Override - public String getDefaultParFile() { - return DynawoSimulationConstants.getSimulationParFile(getEquipment().getNetwork()); + public VersionInterval getVersionInterval() { + return eventModelInfo.version(); + } + + @Override + public final List getVarsMapping() { + // No static-dynamic mapping as purely dynamic + return Collections.emptyList(); + } + + @Override + public void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException { + writer.writeEmptyElement(DYN_URI, "blackBoxModel"); + writeDynamicAttributes(writer, parFileName); + } + + @Override + public double getStartTime() { + return startTime; } @Override @@ -52,5 +80,10 @@ public void createDynamicModelParameters(DynawoSimulationContext context, Consum parametersAdder.accept(paramSet); } + @Override + public String getDefaultParFile() { + return DynawoSimulationConstants.getSimulationParFile(getEquipment().getNetwork()); + } + protected abstract void createEventSpecificParameters(ParametersSet paramSet); } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java index dd9e603b6..d0dfb4bf1 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/AbstractFrequencySynchronizer.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.models.frequencysynchronizers; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SignalN.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SignalN.java index 0745a8557..2890f1546 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SignalN.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SignalN.java @@ -26,10 +26,12 @@ public class SignalN extends AbstractPureDynamicBlackBoxModel implements Frequen private static final String SIGNAL_N_ID = "Signal_N"; private static final ModelConfig MODEL_CONFIG = new ModelConfig("SignalN"); private final List signalNEquipments; + private final String defaultParFile; - public SignalN(List signalNEquipments) { + public SignalN(List signalNEquipments, String defaultParFile) { super(SIGNAL_N_ID, "", MODEL_CONFIG); this.signalNEquipments = signalNEquipments; + this.defaultParFile = defaultParFile; } @Override @@ -60,4 +62,9 @@ protected void writeDynamicAttributes(XMLStreamWriter writer, String parFileName writer.writeAttribute("id", getDynamicModelId()); writer.writeAttribute("lib", getLib()); } + + @Override + public String getDefaultParFile() { + return defaultParFile; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java index 54d001179..20777b8fa 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/DefaultGenerator.java @@ -8,12 +8,12 @@ package com.powsybl.dynawo.models.generators; import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; /** * @author Laurent Issertial {@literal } */ -public class DefaultGenerator extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipment { +public class DefaultGenerator extends AbstractInjectionDefaultModel implements GeneratorModel, ControllableEquipmentModel { public DefaultGenerator(String staticId) { super(staticId); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java index 6959569b1..be7d84345 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronizedGeneratorControllable.java @@ -8,13 +8,13 @@ package com.powsybl.dynawo.models.generators; import com.powsybl.dynawo.builders.ModelConfig; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Generator; /** * @author Laurent Issertial {@literal } */ -public class SynchronizedGeneratorControllable extends SynchronizedGenerator implements ControllableEquipment { +public class SynchronizedGeneratorControllable extends SynchronizedGenerator implements ControllableEquipmentModel { protected SynchronizedGeneratorControllable(String dynamicModelId, Generator generator, String parameterSetId, ModelConfig modelConfig) { super(dynamicModelId, generator, parameterSetId, modelConfig); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java new file mode 100644 index 000000000..448f2229f --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGenerator.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) 2022, 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/. + */ +package com.powsybl.dynawo.models.generators; + +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.models.VarConnection; +import com.powsybl.dynawo.models.frequencysynchronizers.FrequencySynchronizedModel; +import com.powsybl.dynawo.models.utils.BusUtils; +import com.powsybl.iidm.network.Bus; +import com.powsybl.iidm.network.Generator; + +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +/** + * @author Florian Dupuy {@literal } + */ +public class SynchronousGenerator extends BaseGenerator implements FrequencySynchronizedModel { + + private static final String OMEGA_PU_VAR_NAME = "generator_omegaPu"; + + private final EnumGeneratorComponent generatorComponent; + + protected SynchronousGenerator(String dynamicModelId, Generator generator, String parameterSetId, ModelConfig modelConfig, EnumGeneratorComponent generatorComponent) { + super(dynamicModelId, generator, parameterSetId, modelConfig); + this.generatorComponent = Objects.requireNonNull(generatorComponent); + } + + @Override + public String getTerminalVarName() { + return generatorComponent.getTerminalVarName(); + } + + @Override + public List getOmegaRefVarConnections() { + return Arrays.asList( + new VarConnection("omega_grp_@INDEX@", OMEGA_PU_VAR_NAME), + new VarConnection("omegaRef_grp_@INDEX@", getOmegaRefPuVarName()), + new VarConnection("running_grp_@INDEX@", getRunningVarName()) + ); + } + + @Override + public double getWeightGen(DynawoSimulationParameters dynawoSimulationParameters) { + double h = dynawoSimulationParameters.getModelParameters(getParameterSetId()).getDouble("generator_H"); + double sNom = dynawoSimulationParameters.getModelParameters(getParameterSetId()).getDouble("generator_SNom"); + return h * sNom; + } + + @Override + public Bus getConnectableBus() { + return BusUtils.getConnectableBus(equipment); + } +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java index 29ef4e29b..aefdabc0f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/generators/SynchronousGeneratorControllable.java @@ -8,13 +8,13 @@ package com.powsybl.dynawo.models.generators; import com.powsybl.dynawo.builders.ModelConfig; -import com.powsybl.dynawo.models.events.ControllableEquipment; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Generator; /** * @author Laurent Issertial {@literal } */ -public class SynchronousGeneratorControllable extends SynchronousGenerator implements ControllableEquipment { +public class SynchronousGeneratorControllable extends SynchronousGenerator implements ControllableEquipmentModel { protected SynchronousGeneratorControllable(String dynamicModelId, Generator generator, String parameterSetId, ModelConfig modelConfig, EnumGeneratorComponent generatorComponent) { super(dynamicModelId, generator, parameterSetId, modelConfig, generatorComponent); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java index f9de46f40..6646293fd 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java @@ -8,13 +8,12 @@ package com.powsybl.dynawo.models.loads; import com.powsybl.dynawo.builders.ModelConfig; -import com.powsybl.dynawo.models.events.ControllableEquipment; import com.powsybl.iidm.network.Load; /** * @author Laurent Issertial {@literal } */ -public class BaseLoadControllable extends BaseLoad implements ControllableEquipment { +public class BaseLoadControllable extends BaseLoad implements ControllableLoadModel { protected BaseLoadControllable(String dynamicModelId, Load load, String parameterSetId, ModelConfig modelConfig) { super(dynamicModelId, load, parameterSetId, modelConfig); @@ -24,4 +23,9 @@ protected BaseLoadControllable(String dynamicModelId, Load load, String paramete public String getDeltaPVarName() { return "load_deltaP"; } + + @Override + public String getDeltaQVarName() { + return "load_deltaQ"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java index 1384a52da..70a76de40 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java @@ -8,12 +8,11 @@ package com.powsybl.dynawo.models.loads; import com.powsybl.dynawo.models.defaultmodels.AbstractInjectionDefaultModel; -import com.powsybl.dynawo.models.events.ControllableEquipment; /** * @author Laurent Issertial {@literal } */ -public class DefaultLoad extends AbstractInjectionDefaultModel implements ControllableEquipment { +public class DefaultLoad extends AbstractInjectionDefaultModel implements ControllableLoadModel { public DefaultLoad(String staticId) { super(staticId); @@ -28,4 +27,9 @@ public String getName() { public String getDeltaPVarName() { return "@NAME@_DeltaPc"; } + + @Override + public String getDeltaQVarName() { + return "@NAME@_DeltaQc"; + } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java index 374d71778..a181a9c65 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/AbstractXmlDynawoSimulationWriter.java @@ -8,7 +8,6 @@ package com.powsybl.dynawo.xml; import com.powsybl.commons.exceptions.UncheckedXmlStreamException; -import com.powsybl.dynawaltz.DynaWaltzContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java index 330ac5ed2..70c12f8a7 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java @@ -7,7 +7,6 @@ package com.powsybl.dynawo.xml; -import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; @@ -22,32 +21,51 @@ /** * @author Mathieu Bague {@literal } */ -public final class DydXml extends AbstractXmlDynawoSimulationWriter { +public final class DydXml extends AbstractXmlDynawoSimulationWriter { + + private DydXml(String fileName) { + super(fileName, "dynamicModelsArchitecture"); + } private DydXml() { - super(DYD_FILENAME, "dynamicModelsArchitecture"); + this(DYD_FILENAME); } - public static void write(Path workingDir, DynawoSimulationContext context) throws IOException { - new DydXml().createXmlFileFromContext(workingDir, context); + public static void write(Path workingDir, DydDataSupplier dataSupplier) throws IOException { + new DydXml().createXmlFileFromDataSupplier(workingDir, dataSupplier); + } + + public static void write(Path workingDir, String fileName, DydDataSupplier dataSupplier) throws IOException { + new DydXml(fileName).createXmlFileFromDataSupplier(workingDir, dataSupplier); } @Override - public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + public void write(XMLStreamWriter writer, DydDataSupplier dataSupplier) throws XMLStreamException { // loop over the values of the map indexed by dynamicIds to write only once objects with the same dynamicId - for (BlackBoxModel model : context.getBlackBoxDynamicModels()) { - model.write(writer, context); - } - for (BlackBoxModel model : context.getBlackBoxEventModels()) { - model.write(writer, context); + String parFileName = dataSupplier.getParFileName(); + //TODO merge all models in one parameter file ? + if (parFileName == null || parFileName.isEmpty()) { + for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { + model.write(writer); + } + for (BlackBoxModel model : dataSupplier.getBlackBoxEventModels()) { + model.write(writer); + } + } else { + for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { + model.write(writer, dataSupplier.getParFileName()); + } + for (BlackBoxModel model : dataSupplier.getBlackBoxEventModels()) { + model.write(writer, dataSupplier.getParFileName()); + } } - for (MacroConnector macroConnector : context.getMacroConnectors()) { + for (MacroConnector macroConnector : dataSupplier.getMacroConnectors()) { macroConnector.write(writer); } - for (MacroStaticReference macroStaticReference : context.getMacroStaticReferences()) { + for (MacroStaticReference macroStaticReference : dataSupplier.getMacroStaticReferences()) { macroStaticReference.write(writer); } - for (MacroConnect macroConnect : context.getMacroConnectList()) { + for (MacroConnect macroConnect : dataSupplier.getMacroConnectList()) { macroConnect.write(writer); } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java deleted file mode 100644 index c9735cf1d..000000000 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DynawoSimulationConstants.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2020, 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/. - */ -package com.powsybl.dynawo.xml; - -import com.powsybl.iidm.network.Network; - -/** - * @author Marcos de Miguel {@literal } - */ -public final class DynawoSimulationConstants { - - public static final String JOBS_FILENAME = "powsybl_dynawo.jobs"; - - public static final String NETWORK_FILENAME = "powsybl_dynawo.xiidm"; - - public static final String DYD_FILENAME = "powsybl_dynawo.dyd"; - - // TODO use it in dyna algo ? - public static final String PHASE_2_DYD_FILENAME = "phase_2_powsybl_dynawo.dyd"; - - public static final String CRV_FILENAME = "powsybl_dynawo.crv"; - - public static final String CURVES_OUTPUT_PATH = "outputs/curves"; - - public static final String CURVES_FILENAME = "curves.csv"; - - public static final String OUTPUTS_FOLDER = "outputs"; - - public static final String FINAL_STATE_FOLDER = "finalState"; - - private DynawoSimulationConstants() { - } - - public static String getSimulationParFile(Network network) { - return network.getId() + ".par"; - } -} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java index e5019b678..4bf4964c2 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java @@ -6,17 +6,23 @@ */ package com.powsybl.dynawo.xml; +import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DumpFileParameters; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationParameters.SolverType; +import com.powsybl.dynawo.commons.ExportMode; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.io.IOException; import java.nio.file.Path; +import java.util.Optional; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.*; +import static com.powsybl.dynawo.DynawoSimulationConstants.*; +import static com.powsybl.dynawo.DynawoSimulationConstants.DYD_FILENAME; +import static com.powsybl.dynawo.commons.DynawoConstants.NETWORK_FILENAME; +import static com.powsybl.dynawo.commons.DynawoConstants.OUTPUTS_FOLDER; import static com.powsybl.dynawo.xml.DynawoSimulationXmlConstants.DYN_URI; /** @@ -24,6 +30,7 @@ */ public final class JobsXml extends AbstractXmlDynawoSimulationWriter { + private static final String EXPORT_MODE = "exportMode"; private final boolean isPhase2; private JobsXml() { @@ -45,25 +52,24 @@ public static void writePhase2(Path workingDir, DynawoSimulationContext context) @Override public void write(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { + DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeStartElement(DYN_URI, "job"); writer.writeAttribute("name", "Job"); - writeSolver(writer, context); - writeModeler(writer, context, isPhase2); - writeSimulation(writer, context); + writeSolver(writer, parameters); + writeModeler(writer, parameters, isPhase2 && context.getPhase2DydData().isPresent()); + writeSimulation(writer, parameters, context.getParameters()); writeOutput(writer, context); writer.writeEndElement(); } - private static void writeSolver(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { - DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); + private static void writeSolver(XMLStreamWriter writer, DynawoSimulationParameters parameters) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "solver"); writer.writeAttribute("lib", parameters.getSolverType().equals(SolverType.IDA) ? "dynawo_SolverIDA" : "dynawo_SolverSIM"); writer.writeAttribute("parFile", DynawoSimulationParameters.SOLVER_OUTPUT_PARAMETERS_FILE); writer.writeAttribute("parId", parameters.getSolverParameters().getId()); } - private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext context, boolean isPhase2) throws XMLStreamException { - DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); + private static void writeModeler(XMLStreamWriter writer, DynawoSimulationParameters parameters, boolean phase2) throws XMLStreamException { writer.writeStartElement(DYN_URI, "modeler"); writer.writeAttribute("compileDir", "outputs/compilation"); @@ -74,7 +80,7 @@ private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext writer.writeEmptyElement(DYN_URI, "dynModels"); writer.writeAttribute("dydFile", DYD_FILENAME); - if (isPhase2 && context.getPhase2DydData().isPresent()) { + if (phase2) { writer.writeEmptyElement(DYN_URI, "dynModels"); writer.writeAttribute("dydFile", PHASE_2_DYD_FILENAME); } @@ -94,33 +100,54 @@ private static void writeModeler(XMLStreamWriter writer, DynawoSimulationContext writer.writeEndElement(); } - private static void writeSimulation(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { - writer.writeEmptyElement(DYN_URI, "simulation"); - writer.writeAttribute("startTime", Double.toString(context.getParameters().getStartTime())); - writer.writeAttribute("stopTime", Double.toString(context.getParameters().getStopTime())); - writer.writeAttribute("precision", Double.toString(context.getDynawoSimulationParameters().getPrecision())); + private static void writeSimulation(XMLStreamWriter writer, DynawoSimulationParameters parameters, DynamicSimulationParameters dynamicSimulationParameters) throws XMLStreamException { + Optional criteriaFileName = parameters.getCriteriaFileName(); + if (criteriaFileName.isPresent()) { + writer.writeStartElement(DYN_URI, "simulation"); + } else { + writer.writeEmptyElement(DYN_URI, "simulation"); + } + writer.writeAttribute("startTime", Double.toString(dynamicSimulationParameters.getStartTime())); + writer.writeAttribute("stopTime", Double.toString(dynamicSimulationParameters.getStopTime())); + writer.writeAttribute("precision", Double.toString(parameters.getPrecision())); + if (criteriaFileName.isPresent()) { + writer.writeEmptyElement(DYN_URI, "criteria"); + writer.writeAttribute("criteriaFile", criteriaFileName.get()); + writer.writeEndElement(); + } } private static void writeOutput(XMLStreamWriter writer, DynawoSimulationContext context) throws XMLStreamException { DynawoSimulationParameters parameters = context.getDynawoSimulationParameters(); writer.writeStartElement(DYN_URI, "outputs"); - writer.writeAttribute("directory", "outputs"); + writer.writeAttribute("directory", OUTPUTS_FOLDER); writer.writeEmptyElement(DYN_URI, "dumpInitValues"); writer.writeAttribute("local", Boolean.toString(false)); writer.writeAttribute("global", Boolean.toString(false)); + if (context.withConstraints()) { + writer.writeEmptyElement(DYN_URI, "constraints"); + writer.writeAttribute(EXPORT_MODE, ExportMode.XML.toString()); + } + writer.writeEmptyElement(DYN_URI, "timeline"); - writer.writeAttribute("exportMode", parameters.getTimelineExportMode().toString()); + writer.writeAttribute(EXPORT_MODE, parameters.getTimelineExportMode().toString()); writer.writeEmptyElement(DYN_URI, "finalState"); - writer.writeAttribute("exportIIDMFile", Boolean.toString(parameters.isWriteFinalState())); + writer.writeAttribute("exportIIDMFile", Boolean.toString(true)); writer.writeAttribute("exportDumpFile", Boolean.toString(parameters.getDumpFileParameters().exportDumpFile())); - if (context.withCurves()) { + if (context.withCurveVariables()) { writer.writeEmptyElement(DYN_URI, "curves"); - writer.writeAttribute("inputFile", DynawoSimulationConstants.CRV_FILENAME); - writer.writeAttribute("exportMode", DynawoSimulationParameters.ExportMode.CSV.toString()); + writer.writeAttribute("inputFile", CRV_FILENAME); + writer.writeAttribute(EXPORT_MODE, ExportMode.CSV.toString()); + } + + if (context.withFsvVariables()) { + writer.writeEmptyElement(DYN_URI, "finalStateValues"); + writer.writeAttribute("inputFile", FSV_FILENAME); + writer.writeAttribute(EXPORT_MODE, ExportMode.CSV.toString()); } writer.writeStartElement(DYN_URI, "logs"); @@ -133,7 +160,7 @@ private static void writeOutput(XMLStreamWriter writer, DynawoSimulationContext private static void writeAppender(XMLStreamWriter writer, DynawoSimulationParameters parameters) throws XMLStreamException { writer.writeEmptyElement(DYN_URI, "appender"); writer.writeAttribute("tag", ""); - writer.writeAttribute("file", "dynawaltz.log"); + writer.writeAttribute("file", LOGS_FILENAME); writer.writeAttribute("lvlFilter", parameters.getLogLevelFilter().toString()); for (DynawoSimulationParameters.SpecificLog log : parameters.getSpecificLogs()) { writeSpecificAppender(writer, log); diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/OutputVariablesXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/OutputVariablesXml.java index 2df3504fb..b5147f66c 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/OutputVariablesXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/OutputVariablesXml.java @@ -21,7 +21,7 @@ /** * @author Marcos de Miguel {@literal } */ -public final class OutputVariablesXml extends AbstractXmlDynawoSimulationWriter { +public final class OutputVariablesXml extends AbstractXmlDynawoSimulationWriter { private final OutputVariable.OutputType outputType; private final String xmlElementName; @@ -34,12 +34,12 @@ private OutputVariablesXml(String xmlFileName, String xmlRootName, String xmlEle public static void writeCurve(Path workingDir, DynawoSimulationContext context) throws IOException { new OutputVariablesXml(CRV_FILENAME, "curvesInput", "curve", OutputVariable.OutputType.CURVE) - .createXmlFileFromContext(workingDir, context); + .createXmlFileFromDataSupplier(workingDir, context); } public static void writeFsv(Path workingDir, DynawoSimulationContext context) throws IOException { new OutputVariablesXml(FSV_FILENAME, "finalStateValuesInput", "finalStateValue", OutputVariable.OutputType.FINAL_STATE) - .createXmlFileFromContext(workingDir, context); + .createXmlFileFromDataSupplier(workingDir, context); } @Override diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java index a207ef663..1778b71e2 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractDynamicModelXmlTest.java @@ -77,7 +77,7 @@ public void validate(String schemaDefinition, String expectedResourceName, Path assertTxtEquals(expected, actual); } - void setupDynawoContext() { + protected void setupDynawoContext() { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, outputVariables, parameters, dynawoParameters, DynawoConstants.VERSION_MIN, reportNode); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java index 39e638ef5..6d0cb7fe5 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java @@ -22,8 +22,8 @@ import java.util.function.Predicate; import java.util.stream.Stream; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.DYD_FILENAME; -import static com.powsybl.dynawo.xml.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; +import static com.powsybl.dynawo.DynawoSimulationConstants.DYD_FILENAME; +import static com.powsybl.dynawo.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MixedFreqSynchSignalNXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MixedFreqSynchSignalNXmlTest.java index d7f02b1fc..45a6bbfd9 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MixedFreqSynchSignalNXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/MixedFreqSynchSignalNXmlTest.java @@ -41,7 +41,7 @@ protected void addDynamicModels() { } @Override - void setupDynawoContext() { + protected void setupDynawoContext() { // empty to call super in test } From dcdebd5c3491cccaeac53ba6c1d186f00b8cbbe7 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 19 Dec 2024 14:42:20 +0100 Subject: [PATCH 20/28] Remove unused class Signed-off-by: lisrte --- .../dynawo/xml/XmlDynawoSimulationWriter.java | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java deleted file mode 100644 index 34d10b845..000000000 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/XmlDynawoSimulationWriter.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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.dynawo.xml; - -import com.powsybl.dynawo.DynawoSimulationContext; - -import java.io.IOException; -import java.nio.file.Path; - -/** - * @author Florian Dupuy {@literal } - */ -@FunctionalInterface -public interface XmlDynawoSimulationWriter { - void createXmlFileFromContext(Path workingDir, DynawoSimulationContext context) throws IOException; -} From 1e8faf2861b8e9b7ba16a6d7d3bf23aadfbae5ce Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 19 Dec 2024 16:31:50 +0100 Subject: [PATCH 21/28] Remove duplicate code Signed-off-by: lisrte --- .../powsybl/dynaflow/results/ResultsUtil.java | 5 +- .../algorithms/ContingencyEventModels.java | 6 - .../ContingencyEventModelsFactory.java | 85 ++++++++++---- .../DynawoAlgorithmsCommandUtil.java | 2 +- .../algorithms/xml/AlgorithmsConstants.java | 4 - .../MarginCalculationContext.java | 2 +- .../MarginCalculationHandler.java | 2 +- .../results/FailedCriterion.java | 17 --- .../results/LoadIncreaseResult.java | 4 + ...Util.java => LoadIncreaseResultsUtil.java} | 47 +------- .../results/ScenarioResult.java | 25 ----- .../margincalculation/results/Status.java | 18 --- .../XmlMarginCalculationResultParser.java | 11 +- .../ContingencyEventModelsFactory.java | 105 ------------------ .../DynawoSecurityAnalysisProvider.java | 7 +- .../security/SecurityAnalysisContext.java | 1 + .../dynawo/security/xml/MultipleJobsXml.java | 2 +- .../ContingenciesXmlTest.java | 3 +- .../ContingencyEventModelsTest.java | 3 +- .../DynawoAlgorithmsConfigTest.java | 3 +- .../results/XmlResultParserTest.java | 4 +- .../security/xml/MultiplesJobsXmlTest.java | 5 +- .../dynawo/DynawoSimulationConstants.java | 4 - .../dynawo/DynawoSimulationContext.java | 11 -- .../frequencysynchronizers/OmegaRef.java | 4 +- .../frequencysynchronizers/SetPoint.java | 4 +- .../com/powsybl/dynawo/xml/JobsXmlTest.java | 16 +++ .../src/test/resources/jobsWithPhase2.xml | 3 +- 28 files changed, 128 insertions(+), 275 deletions(-) delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/{ResultsUtil.java => LoadIncreaseResultsUtil.java} (65%) delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java rename dynawo-security-analysis/src/test/java/com/powsybl/dynawo/{security/xml => algorithms}/ContingenciesXmlTest.java (97%) rename dynawo-security-analysis/src/test/java/com/powsybl/dynawo/{security => algorithms}/ContingencyEventModelsTest.java (97%) rename dynawo-security-analysis/src/test/java/com/powsybl/dynawo/{security => algorithms}/DynawoAlgorithmsConfigTest.java (94%) diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java index a642c6f2a..ebdb03599 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java @@ -20,6 +20,7 @@ /** * @author Laurent Issertial {@literal } */ +//TODO move results and factorize with load margin results public final class ResultsUtil { private ResultsUtil() { @@ -35,7 +36,7 @@ public static PostContingencyComputationStatus convertToPostStatus(Status status }; } - static Optional createScenarioResult(String id, String status, List failedCriteria) { + public static Optional createScenarioResult(String id, String status, List failedCriteria) { if (id == null || status == null || failedCriteria == null) { LOGGER.warn("Inconsistent scenario result entry (id: '{}', status: '{}', failedCriteria: '{}')", id, status, failedCriteria); } else { @@ -56,7 +57,7 @@ static Optional createScenarioResult(String id, String status, L return Optional.empty(); } - static Optional createFailedCriterion(String description, String time) { + public static Optional createFailedCriterion(String description, String time) { if (description == null || time == null) { LOGGER.warn("Inconsistent failed criterion entry (description: '{}', time: '{}')", description, time); } else { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java index be2b6fe72..210257f0b 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModels.java @@ -13,8 +13,6 @@ import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.parameters.ParametersSet; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,10 +23,6 @@ public record ContingencyEventModels(Contingency contingency, List macroConnectorsMap, List macroConnectList, List eventParameters) { - public ContingencyEventModels(Contingency contingency, List eventModels) { - this(contingency, eventModels, new HashMap<>(), new ArrayList<>(), new ArrayList<>(eventModels.size())); - } - public String getId() { return contingency.getId(); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java index 17d00a558..571d94b8d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java @@ -8,16 +8,23 @@ package com.powsybl.dynawo.algorithms; import com.powsybl.commons.PowsyblException; +import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; import com.powsybl.contingency.ContingencyElement; +import com.powsybl.contingency.SidedContingencyElement; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.events.ContextDependentEvent; import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; +import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; +import com.powsybl.dynawo.models.macroconnections.MacroConnector; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.security.DynamicSecurityAnalysisReports; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.TwoSides; -import java.util.List; -import java.util.stream.Collectors; +import java.util.*; /** * @author Laurent Issertial @@ -25,29 +32,65 @@ public final class ContingencyEventModelsFactory { public static List createFrom(List contingencies, DynawoSimulationContext context, - MacroConnectionsAdder macroConnectionsAdder, double contingenciesStartTime) { + MacroConnectionsAdder macroConnectionsAdder, + double contingenciesStartTime, + ReportNode reportNode) { return contingencies.stream() - .map(c -> { - ContingencyEventModels cem = new ContingencyEventModels(c, c.getElements().stream() - .map(ce -> createContingencyEventModel(ce, context, contingenciesStartTime)) - .toList()); - // Set Contingencies connections and parameters - macroConnectionsAdder.setMacroConnectorAdder(cem.macroConnectorsMap()::computeIfAbsent); - macroConnectionsAdder.setMacroConnectAdder(cem.macroConnectList()::add); - cem.eventModels().forEach(em -> { - em.createMacroConnections(macroConnectionsAdder); - em.createDynamicModelParameters(context, cem.eventParameters()::add); - }); - return cem; - }) - .collect(Collectors.toList()); + .map(c -> createFrom(c, context, macroConnectionsAdder, contingenciesStartTime, reportNode)) + .filter(Objects::nonNull) + .toList(); } - private static BlackBoxModel createContingencyEventModel(ContingencyElement element, DynawoSimulationContext context, double contingenciesStartTime) { - BlackBoxModel bbm = EventDisconnectionBuilder.of(context.getNetwork()) + public static ContingencyEventModels createFrom(Contingency contingency, DynawoSimulationContext context, + MacroConnectionsAdder macroConnectionsAdder, + double contingenciesStartTime, + ReportNode reportNode) { + List eventModels = createContingencyEventModelList(contingency, context, contingenciesStartTime, reportNode); + if (eventModels.isEmpty()) { + return null; + } + Map macroConnectorsMap = new HashMap<>(); + List macroConnectList = new ArrayList<>(); + List eventParameters = new ArrayList<>(eventModels.size()); + // Set Contingencies connections and parameters + macroConnectionsAdder.setMacroConnectorAdder(macroConnectorsMap::computeIfAbsent); + macroConnectionsAdder.setMacroConnectAdder(macroConnectList::add); + eventModels.forEach(em -> { + em.createMacroConnections(macroConnectionsAdder); + em.createDynamicModelParameters(context, eventParameters::add); + }); + return new ContingencyEventModels(contingency, eventModels, macroConnectorsMap, macroConnectList, eventParameters); + } + + private static List createContingencyEventModelList(Contingency contingency, + DynawoSimulationContext context, + double contingenciesStartTime, + ReportNode reportNode) { + return contingency.getElements().stream() + .map(ce -> createContingencyEventModel(ce, context, contingenciesStartTime, reportNode)) + .filter(Objects::nonNull) + .toList(); + } + + private static BlackBoxModel createContingencyEventModel(ContingencyElement element, + DynawoSimulationContext context, + double contingenciesStartTime, + ReportNode reportNode) { + Network network = context.getNetwork(); + EventDisconnectionBuilder builder = EventDisconnectionBuilder.of(network) .staticId(element.getId()) - .startTime(contingenciesStartTime) - .build(); + .startTime(contingenciesStartTime); + if (element instanceof SidedContingencyElement sidedElement && sidedElement.getVoltageLevelId() != null) { + TwoSides side = SidedContingencyElement.getContingencySide(network, sidedElement); + if (side != null) { + builder.disconnectOnly(side); + } else { + DynamicSecurityAnalysisReports.createContingencyVoltageIdNotFoundReportNode(reportNode, + sidedElement.getId(), sidedElement.getVoltageLevelId()); + return null; + } + } + BlackBoxModel bbm = builder.build(); if (bbm == null) { throw new PowsyblException("Contingency element " + element.getType() + " not supported"); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java index fa0031914..acd623cb1 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsCommandUtil.java @@ -14,8 +14,8 @@ import java.util.Collections; import java.util.List; -import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.AGGREGATED_RESULTS; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.commons.DynawoConstants.AGGREGATED_RESULTS; /** * @author Laurent Issertial {@literal } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java index bd74bae8d..e706365a0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java @@ -14,12 +14,8 @@ public final class AlgorithmsConstants { public static final String MULTIPLE_JOBS_FILENAME = "multiple_jobs.xml"; - public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; - public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; - public static final String BASE_SCENARIO_FOLDER = "base"; - private AlgorithmsConstants() { } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 6bc2a29ab..eaa22ef41 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -59,7 +59,7 @@ public MarginCalculationContext(Network network, String workingVariantId, new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters, null, DynawoConstants.VERSION_MIN, reportNode); this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); - this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime); + this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime, reportNode); this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, parameters.getLoadIncreaseStartTime(), parameters.getLoadIncreaseStopTime()); macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java index f0b528b9d..94f931d78 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.nio.file.Path; -import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.AGGREGATED_RESULTS; +import static com.powsybl.dynawo.commons.DynawoConstants.AGGREGATED_RESULTS; /** * @author Laurent Issertial {@literal } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java deleted file mode 100644 index e225c6f10..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/FailedCriterion.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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.dynawo.margincalculation.results; - -/** - * scenarioResults or loadIncreaseResults failed criterion - * @param message Failed criterion message - * @param time Failure time (in seconds) - * @author Laurent Issertial {@literal } - */ -public record FailedCriterion(String message, double time) { -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java index 63fdaaba6..066fffa8d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java @@ -7,6 +7,10 @@ */ package com.powsybl.dynawo.margincalculation.results; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynaflow.results.Status; + import java.util.Collections; import java.util.List; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResultsUtil.java similarity index 65% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResultsUtil.java index b36572677..88536b66f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ResultsUtil.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResultsUtil.java @@ -7,23 +7,24 @@ */ package com.powsybl.dynawo.margincalculation.results; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynaflow.results.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import java.util.Optional; -import static com.powsybl.dynawo.margincalculation.results.Status.*; - /** * @author Laurent Issertial {@literal } */ -public final class ResultsUtil { +public final class LoadIncreaseResultsUtil { - private ResultsUtil() { + private LoadIncreaseResultsUtil() { } - private static final Logger LOGGER = LoggerFactory.getLogger(ResultsUtil.class); + private static final Logger LOGGER = LoggerFactory.getLogger(LoadIncreaseResultsUtil.class); static Optional createLoadIncreaseResult(String loadLevel, String status, List scenarioResults, List failedCriteria) { @@ -76,42 +77,6 @@ static Optional createLoadIncreaseResult(String loadLevel, S return Optional.empty(); } - static Optional createScenarioResult(String id, String status, List failedCriteria) { - if (id == null || status == null || failedCriteria == null) { - LOGGER.warn("Inconsistent scenario result entry (id: '{}', status: '{}', failedCriteria: '{}')", id, status, failedCriteria); - } else { - try { - Status statusE = Status.valueOf(status); - boolean isCriterionError = CRITERIA_NON_RESPECTED == statusE; - if (isCriterionError && failedCriteria.isEmpty()) { - LOGGER.warn("ScenarioResult with {} status should have failed criteria", status); - return Optional.empty(); - } else if (!isCriterionError && !failedCriteria.isEmpty()) { - LOGGER.warn("ScenarioResult with {} status should not have failed criteria", status); - return Optional.empty(); - } - return Optional.of(new ScenarioResult(id, statusE, failedCriteria)); - } catch (IllegalArgumentException e) { - logInconsistentEntry("status", status); - } - } - return Optional.empty(); - } - - static Optional createFailedCriterion(String message, String time) { - if (message == null || time == null) { - LOGGER.warn("Inconsistent failed criterion entry (message: '{}', time: '{}')", message, time); - } else { - try { - double timeD = Double.parseDouble(time); - return Optional.of(new FailedCriterion(message, timeD)); - } catch (NumberFormatException e) { - logInconsistentEntry("time", time); - } - } - return Optional.empty(); - } - private static void logInconsistentEntry(String fieldName, String message) { LOGGER.warn("Inconsistent {} entry '{}'", fieldName, message); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java deleted file mode 100644 index 5a00f872c..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/ScenarioResult.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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.dynawo.margincalculation.results; - -import java.util.Collections; -import java.util.List; - -/** - * Contingency scenario result - * @param id Contingency id - * @param status Result status - * @param failedCriteria List of failed criterion - * @author Laurent Issertial {@literal } - */ -public record ScenarioResult(String id, Status status, List failedCriteria) { - - public ScenarioResult(String id, Status status) { - this(id, status, Collections.emptyList()); - } -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java deleted file mode 100644 index 357235a97..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/Status.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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.dynawo.margincalculation.results; - -/** - * @author Laurent Issertial {@literal } - */ -public enum Status { - CONVERGENCE, - DIVERGENCE, - EXECUTION_PROBLEM, - CRITERIA_NON_RESPECTED -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java index 81915f448..d2e83b8bb 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java @@ -9,6 +9,8 @@ import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.xml.XmlUtil; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; import com.powsybl.dynawo.commons.AbstractXmlParser; import javax.xml.stream.XMLStreamConstants; @@ -18,6 +20,9 @@ import java.util.List; import java.util.function.Consumer; +import static com.powsybl.dynaflow.results.ResultsUtil.createFailedCriterion; +import static com.powsybl.dynaflow.results.ResultsUtil.createScenarioResult; + /** * @author Laurent Issertial {@literal } */ @@ -44,7 +49,7 @@ private static void readLoadIncreaseResult(String elementName, XMLStreamReader x List scenarioResults = new ArrayList<>(); List failedCriteria = new ArrayList<>(); XmlUtil.readSubElements(xmlReader, subElementName -> readLoadIncreaseResultSubElements(subElementName, xmlReader, scenarioResults::add, failedCriteria::add)); - ResultsUtil.createLoadIncreaseResult(loadLevel, status, scenarioResults, failedCriteria).ifPresent(resultConsumer); + LoadIncreaseResultsUtil.createLoadIncreaseResult(loadLevel, status, scenarioResults, failedCriteria).ifPresent(resultConsumer); } } @@ -54,7 +59,7 @@ private static void readLoadIncreaseResultSubElements(String elementName, XMLStr String status = xmlReader.getAttributeValue(null, STATUS); List failedCriteria = new ArrayList<>(); XmlUtil.readSubElements(xmlReader, subElementName -> readFailedCriterion(subElementName, xmlReader, failedCriteria::add)); - ResultsUtil.createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); + createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); } else { readFailedCriterion(elementName, xmlReader, criterionConsumer); } @@ -67,7 +72,7 @@ private static void readFailedCriterion(String elementName, XMLStreamReader xmlR String message = xmlReader.getAttributeValue(null, ID); String time = xmlReader.getAttributeValue(null, TIME); XmlUtil.readEndElementOrThrow(xmlReader); - ResultsUtil.createFailedCriterion(message, time).ifPresent(resultConsumer); + createFailedCriterion(message, time).ifPresent(resultConsumer); } } catch (XMLStreamException e) { throw new UncheckedXmlStreamException(e); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java deleted file mode 100644 index e82d19cc8..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/ContingencyEventModelsFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * 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.dynawo.security; - -import com.powsybl.commons.PowsyblException; -import com.powsybl.commons.report.ReportNode; -import com.powsybl.contingency.Contingency; -import com.powsybl.contingency.ContingencyElement; -import com.powsybl.contingency.SidedContingencyElement; -import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.algorithms.ContingencyEventModels; -import com.powsybl.dynawo.models.BlackBoxModel; -import com.powsybl.dynawo.models.events.ContextDependentEvent; -import com.powsybl.dynawo.models.events.EventDisconnectionBuilder; -import com.powsybl.dynawo.models.macroconnections.MacroConnect; -import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; -import com.powsybl.dynawo.models.macroconnections.MacroConnector; -import com.powsybl.dynawo.parameters.ParametersSet; -import com.powsybl.iidm.network.Network; -import com.powsybl.iidm.network.TwoSides; - -import java.util.*; - -/** - * @author Laurent Issertial - */ -public final class ContingencyEventModelsFactory { - - public static List createFrom(List contingencies, DynawoSimulationContext context, - MacroConnectionsAdder macroConnectionsAdder, - double contingenciesStartTime, - ReportNode reportNode) { - return contingencies.stream() - .map(c -> createFrom(c, context, macroConnectionsAdder, contingenciesStartTime, reportNode)) - .filter(Objects::nonNull) - .toList(); - } - - public static ContingencyEventModels createFrom(Contingency contingency, DynawoSimulationContext context, - MacroConnectionsAdder macroConnectionsAdder, - double contingenciesStartTime, - ReportNode reportNode) { - List eventModels = createContingencyEventModelList(contingency, context, contingenciesStartTime, reportNode); - if (eventModels.isEmpty()) { - return null; - } - Map macroConnectorsMap = new HashMap<>(); - List macroConnectList = new ArrayList<>(); - List eventParameters = new ArrayList<>(eventModels.size()); - // Set Contingencies connections and parameters - macroConnectionsAdder.setMacroConnectorAdder(macroConnectorsMap::computeIfAbsent); - macroConnectionsAdder.setMacroConnectAdder(macroConnectList::add); - eventModels.forEach(em -> { - em.createMacroConnections(macroConnectionsAdder); - em.createDynamicModelParameters(context, eventParameters::add); - }); - return new ContingencyEventModels(contingency, eventModels, macroConnectorsMap, macroConnectList, eventParameters); - } - - private static List createContingencyEventModelList(Contingency contingency, - DynawoSimulationContext context, - double contingenciesStartTime, - ReportNode reportNode) { - return contingency.getElements().stream() - .map(ce -> createContingencyEventModel(ce, context, contingenciesStartTime, reportNode)) - .filter(Objects::nonNull) - .toList(); - } - - private static BlackBoxModel createContingencyEventModel(ContingencyElement element, - DynawoSimulationContext context, - double contingenciesStartTime, - ReportNode reportNode) { - Network network = context.getNetwork(); - EventDisconnectionBuilder builder = EventDisconnectionBuilder.of(network) - .staticId(element.getId()) - .startTime(contingenciesStartTime); - if (element instanceof SidedContingencyElement sidedElement && sidedElement.getVoltageLevelId() != null) { - TwoSides side = SidedContingencyElement.getContingencySide(network, sidedElement); - if (side != null) { - builder.disconnectOnly(side); - } else { - DynamicSecurityAnalysisReports.createContingencyVoltageIdNotFoundReportNode(reportNode, - sidedElement.getId(), sidedElement.getVoltageLevelId()); - return null; - } - } - BlackBoxModel bbm = builder.build(); - if (bbm == null) { - throw new PowsyblException("Contingency element " + element.getType() + " not supported"); - } - if (bbm instanceof ContextDependentEvent cde) { - cde.setEquipmentHasDynamicModel(context); - } - return bbm; - } - - private ContingencyEventModelsFactory() { - } -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java index 9da2d2cbf..4b049e528 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynawoSecurityAnalysisProvider.java @@ -21,7 +21,6 @@ import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; -import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.iidm.network.Network; @@ -39,6 +38,8 @@ import java.util.concurrent.CompletableFuture; import static com.powsybl.dynawo.DynawoSimulationConfig.DYNAWO_LAUNCHER_PROGRAM_NAME; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.commons.DynawoConstants.AGGREGATED_RESULTS; /** * @author Laurent Issertial @@ -108,8 +109,8 @@ public String getVersion() { public static Command getCommand(DynawoAlgorithmsConfig config) { List args = Arrays.asList( "SA", - "--input", DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME, - "--output", DynawoSimulationConstants.AGGREGATED_RESULTS); + "--input", MULTIPLE_JOBS_FILENAME, + "--output", AGGREGATED_RESULTS); return new SimpleCommandBuilder() .id("dynawo_dynamic_sa") .program(config.getProgram()) diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java index babc290e7..d3b60f74a 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/SecurityAnalysisContext.java @@ -12,6 +12,7 @@ import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.algorithms.ContingencyEventModels; +import com.powsybl.dynawo.algorithms.ContingencyEventModelsFactory; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.models.BlackBoxModel; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java index 9b69f54ec..3e66064d0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/xml/MultipleJobsXml.java @@ -18,7 +18,7 @@ import java.util.Objects; import static com.powsybl.dynawo.DynawoSimulationConstants.JOBS_FILENAME; -import static com.powsybl.dynawo.DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; /** * @author Laurent Issertial diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java similarity index 97% rename from dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java rename to dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java index e0346cfd0..220cd4c33 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/ContingenciesXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security.xml; +package com.powsybl.dynawo.algorithms; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; @@ -25,6 +25,7 @@ /** * @author Laurent Issertial */ +//TODO replace SecurityAnalysisContext class ContingenciesXmlTest extends DynawoTestUtil { @Test diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java similarity index 97% rename from dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java rename to dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java index 1ef90d53a..ea081f3ea 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/ContingencyEventModelsTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java @@ -5,14 +5,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * SPDX-License-Identifier: MPL-2.0 */ -package com.powsybl.dynawo.security; +package com.powsybl.dynawo.algorithms; import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; -import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.generators.BaseGeneratorBuilder; import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfigTest.java similarity index 94% rename from dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java rename to dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfigTest.java index 377df83c8..0341b1dab 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/DynawoAlgorithmsConfigTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsConfigTest.java @@ -4,13 +4,12 @@ * 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.dynawo.security; +package com.powsybl.dynawo.algorithms; import com.google.common.jimfs.Configuration; import com.google.common.jimfs.Jimfs; import com.powsybl.commons.config.InMemoryPlatformConfig; import com.powsybl.commons.config.MapModuleConfig; -import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java index b8733b53c..26c4f8e69 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/results/XmlResultParserTest.java @@ -7,6 +7,8 @@ */ package com.powsybl.dynawo.margincalculation.results; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; import org.junit.jupiter.api.Test; import javax.xml.stream.XMLStreamException; @@ -18,7 +20,7 @@ import java.util.List; import java.util.Objects; -import static com.powsybl.dynawo.margincalculation.results.Status.*; +import static com.powsybl.dynaflow.results.Status.*; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java index 7aac2307a..bb3c17984 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java @@ -10,7 +10,6 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.security.SecurityAnalysisContext; -import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.xml.DynawoTestUtil; import com.powsybl.security.dynamic.DynamicSecurityAnalysisParameters; import org.junit.jupiter.api.Test; @@ -20,6 +19,8 @@ import java.io.IOException; import java.util.List; +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; + /** * @author Laurent Issertial */ @@ -38,7 +39,7 @@ void writeMultiplesJobs() throws SAXException, IOException, XMLStreamException { SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); MultipleJobsXml.write(tmpDir, context); - validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(DynawoSimulationConstants.MULTIPLE_JOBS_FILENAME)); + validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(MULTIPLE_JOBS_FILENAME)); } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java index ac42a03e5..bc03faa3e 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java @@ -29,10 +29,6 @@ public final class DynawoSimulationConstants { public static final String FSV_OUTPUT_FILENAME = "finalStateValues.csv"; - public static final String MULTIPLE_JOBS_FILENAME = "multiple_jobs.xml"; - - public static final String AGGREGATED_RESULTS = "aggregatedResults.xml"; - public static final String LOGS_FOLDER = "logs"; public static final String LOGS_FILENAME = "dynawo.log"; diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 79c703709..9b46e9254 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -65,17 +65,6 @@ public class DynawoSimulationContext implements DydDataSupplier { protected final MacroConnectionsAdder macroConnectionsAdder; private Phase2Models phase2Models; -// public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, -// List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters) { -// this(network, workingVariantId, dynamicModels, eventModels, outputVariables, parameters, dynawoSimulationParameters, ReportNode.NO_OP); -// } -// -// public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, -// List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, -// Predicate phase2ModelsPredicate) { -// this(network, workingVariantId, dynamicModels, eventModels, outputVariables, parameters, dynawoSimulationParameters, phase2ModelsPredicate, ReportNode.NO_OP); -// } - public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, DynawoVersion currentVersion, ReportNode reportNode) { diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java index 0fde7f6dd..2761ac7ad 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/OmegaRef.java @@ -35,8 +35,10 @@ */ public class OmegaRef extends AbstractFrequencySynchronizer { + private static final ModelConfig MODEL_CONFIG = new ModelConfig("DYNModelOmegaRef"); + public OmegaRef(List synchronizedEquipments, String defaultParFile) { - super(synchronizedEquipments, new ModelConfig("DYNModelOmegaRef"), defaultParFile); + super(synchronizedEquipments, MODEL_CONFIG, defaultParFile); } @Override diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java index 907ef31d3..981433d1e 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/frequencysynchronizers/SetPoint.java @@ -26,8 +26,10 @@ */ public class SetPoint extends AbstractFrequencySynchronizer { + private static final ModelConfig MODEL_CONFIG = new ModelConfig("SetPoint"); + public SetPoint(List synchronizedEquipments, String defaultParFile) { - super(synchronizedEquipments, new ModelConfig("SetPoint"), defaultParFile); + super(synchronizedEquipments, MODEL_CONFIG, defaultParFile); } @Override diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index 24121c1fe..7eea4ab00 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -6,11 +6,14 @@ */ package com.powsybl.dynawo.xml; +import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DumpFileParameters; import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.commons.DynawoConstants; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -46,4 +49,17 @@ private static Stream provideParameters() { .setCriteriaFilePath(Path.of("criteria.crt"))) ); } + + @Test + void writeJobWithPhase2() throws SAXException, IOException { + DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); + DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, eventModels, outputVariables, parameters, dynawoParameters, + bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD2"), + DynawoConstants.VERSION_MIN, ReportNode.NO_OP); + + JobsXml.writePhase2(tmpDir, context); + validate("jobs.xsd", "jobsWithPhase2.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); + } } diff --git a/dynawo-simulation/src/test/resources/jobsWithPhase2.xml b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml index 679fe06aa..2e064c2af 100644 --- a/dynawo-simulation/src/test/resources/jobsWithPhase2.xml +++ b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml @@ -15,8 +15,9 @@ + - +
From d0731574f7b50aee473acc31cbae0c2c1522d872 Mon Sep 17 00:00:00 2001 From: lisrte Date: Mon, 6 Jan 2025 16:43:35 +0100 Subject: [PATCH 22/28] Remove LoadsVariation::VariationMode Add Proportional Scalable loads Config maven.yml Signed-off-by: lisrte --- .github/workflows/maven.yml | 11 +++- .../dynawo/it/DynawoSimulationTest.java | 2 +- .../MarginCalculationContext.java | 16 +++++- .../MarginCalculationHandler.java | 8 +-- .../MarginCalculationProvider.java | 4 +- .../CalculatedLoadScalable.java | 55 +++++++++++++++++++ .../loadsvariation/CalculatedPower.java | 18 ++++++ .../LoadVariationAreaAutomationSystem.java | 16 ++++-- .../LoadsProportionalScalable.java | 30 ++++++++++ .../loadsvariation/LoadsVariation.java | 7 +-- .../loadsvariation/LoadsVariationBuilder.java | 21 +++---- .../LoadsVariationJsonDeserializer.java | 25 ++------- ...port.java => MarginCalculationResult.java} | 10 ++-- .../LoadsVariationJsonDeserializerTest.java | 48 ++++++++++++++++ .../xml/LoadVariationAreaXmlTest.java | 10 +++- .../resources/load_variation_area_par.xml | 12 ++-- .../src/test/resources/load_variations.json | 21 ++----- pom.xml | 2 +- 18 files changed, 231 insertions(+), 85 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedLoadScalable.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedPower.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsProportionalScalable.java rename dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/{MarginCalculationReport.java => MarginCalculationResult.java} (79%) create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializerTest.java diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 909d4fa1b..eff5b36e3 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -18,7 +18,16 @@ jobs: steps: - name: Checkout sources - uses: actions/checkout@v1 + uses: actions/checkout@v4 + with: + path: main + + - name: Checkout powsybl-core branch + uses: actions/checkout@v4 + with: + repository: powsybl/powsybl-core + ref: refs/heads/scalable_access + path: powsybl-core - name: Set up JDK 17 uses: actions/setup-java@v1 diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java index 9d18241ed..279a09e60 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSimulationTest.java @@ -72,7 +72,7 @@ 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(192, ts1.toArray().length); + assertEquals(258, ts1.toArray().length); assertEquals(14, result.getFinalStateValues().size()); assertEquals(1.046227, result.getFinalStateValues().get("NETWORK__BUS___10_TN_Upu_value")); List timeLine = result.getTimeLine(); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index eaa22ef41..f3ed1779d 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -13,6 +13,7 @@ import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadVariationAreaAutomationSystem; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsProportionalScalable; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; @@ -22,9 +23,12 @@ import com.powsybl.dynawo.algorithms.ContingencyEventModels; import com.powsybl.dynawo.algorithms.ContingencyEventModelsFactory; import com.powsybl.dynawo.xml.DydDataSupplier; +import com.powsybl.iidm.modification.scalable.Scalable; +import com.powsybl.iidm.modification.scalable.ScalingParameters; import com.powsybl.iidm.network.Network; import java.util.*; +import java.util.function.BiConsumer; /** * @author Laurent Issertial @@ -60,7 +64,10 @@ public MarginCalculationContext(Network network, String workingVariantId, this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime, reportNode); - this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, parameters.getLoadIncreaseStartTime(), parameters.getLoadIncreaseStopTime()); + this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, + parameters.getLoadIncreaseStartTime(), + parameters.getLoadIncreaseStopTime(), + getScalableConfig(network)); macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); macroConnectionsAdder.setMacroConnectAdder(loadVariationMacroConnectList::add); @@ -104,4 +111,11 @@ public String getParFileName() { } }; } + + private static BiConsumer getScalableConfig(Network network) { + ScalingParameters scalingParameters = new ScalingParameters() + .setScalingConvention(Scalable.ScalingConvention.LOAD) + .setConstantPowerFactor(true); + return (s, v) -> s.scale(network, v, scalingParameters); + } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java index 94f931d78..c48a88f45 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java @@ -13,7 +13,7 @@ import com.powsybl.dynawo.algorithms.AbstractDynawoAlgorithmsHandler; import com.powsybl.dynawo.algorithms.xml.ContingenciesDydXml; import com.powsybl.dynawo.algorithms.xml.ContingenciesParXml; -import com.powsybl.dynawo.margincalculation.results.MarginCalculationReport; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; import com.powsybl.dynawo.margincalculation.results.XmlMarginCalculationResultParser; import com.powsybl.dynawo.margincalculation.xml.MultipleJobsXml; @@ -26,19 +26,19 @@ /** * @author Laurent Issertial {@literal } */ -public class MarginCalculationHandler extends AbstractDynawoAlgorithmsHandler { +public class MarginCalculationHandler extends AbstractDynawoAlgorithmsHandler { public MarginCalculationHandler(MarginCalculationContext context, Command command, ReportNode reportNode) { super(context, command, reportNode); } @Override - public MarginCalculationReport after(Path workingDir, ExecutionReport report) throws IOException { + public MarginCalculationResult after(Path workingDir, ExecutionReport report) throws IOException { super.after(workingDir, report); context.getNetwork().getVariantManager().setWorkingVariant(context.getWorkingVariantId()); Path resultsFile = workingDir.resolve(AGGREGATED_RESULTS); new XmlMarginCalculationResultParser().parse(resultsFile); - return new MarginCalculationReport(new XmlMarginCalculationResultParser().parse(resultsFile)); + return new MarginCalculationResult(new XmlMarginCalculationResultParser().parse(resultsFile)); } @Override diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java index 3e338c3b0..8f8eef824 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -18,7 +18,7 @@ import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; -import com.powsybl.dynawo.margincalculation.results.MarginCalculationReport; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; import com.powsybl.dynawo.models.utils.BlackBoxSupplierUtils; import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; import com.powsybl.iidm.network.Network; @@ -52,7 +52,7 @@ public MarginCalculationProvider(DynawoAlgorithmsConfig config) { this.config = Objects.requireNonNull(config); } - public CompletableFuture run(Network network, String workingVariantId, + public CompletableFuture run(Network network, String workingVariantId, DynamicModelsSupplier dynamicModelsSupplier, ContingenciesProvider contingenciesProvider, LoadsVariationSupplier loadsVariationSupplier, diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedLoadScalable.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedLoadScalable.java new file mode 100644 index 000000000..04709879e --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedLoadScalable.java @@ -0,0 +1,55 @@ +/** + * 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.dynawo.margincalculation.loadsvariation; + +import com.powsybl.iidm.modification.scalable.LoadScalable; +import com.powsybl.iidm.network.Load; + +/** + * The scaled P and Q are not set in the given load but kept in properties, contrary to {@link LoadScalable} + * @author Laurent Issertial {@literal } + */ +public class CalculatedLoadScalable extends LoadScalable implements CalculatedPower { + + private Double calculatedP0 = Double.NaN; + private Double calculatedQ0 = Double.NaN; + + CalculatedLoadScalable(String id) { + super(id); + } + + @Override + protected void setP0(Load l, double value) { + calculatedP0 = value; + } + + @Override + protected double getP0(Load l) { + return calculatedP0.isNaN() ? l.getP0() : calculatedP0; + } + + @Override + protected void setQ0(Load l, double value) { + calculatedQ0 = value; + } + + @Override + protected double getQ0(Load l) { + return calculatedQ0.isNaN() ? l.getQ0() : calculatedQ0; + } + + @Override + public Double getCalculatedP0() { + return calculatedP0; + } + + @Override + public Double getCalculatedQ0() { + return calculatedQ0; + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedPower.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedPower.java new file mode 100644 index 000000000..06379688e --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/CalculatedPower.java @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.loadsvariation; + +/** + * @author Laurent Issertial {@literal } + */ +public interface CalculatedPower { + + Double getCalculatedP0(); + + Double getCalculatedQ0(); +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java index 656693990..e2d779f09 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Objects; +import java.util.function.BiConsumer; import java.util.function.Consumer; import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; @@ -36,12 +37,16 @@ public class LoadVariationAreaAutomationSystem extends AbstractPureDynamicBlackB private final List loadsVariations; private final double loadIncreaseStartTime; private final double loadIncreaseStopTime; + private final BiConsumer scalingConfig; - public LoadVariationAreaAutomationSystem(List loadsVariations, double loadIncreaseStartTime, double loadIncreaseStopTime) { + public LoadVariationAreaAutomationSystem(List loadsVariations, double loadIncreaseStartTime, + double loadIncreaseStopTime, + BiConsumer scalingConfig) { super(ID, PAR_ID, MODEL_CONFIG); this.loadsVariations = Objects.requireNonNull(loadsVariations); this.loadIncreaseStartTime = loadIncreaseStartTime; this.loadIncreaseStopTime = loadIncreaseStopTime; + this.scalingConfig = scalingConfig; } @Override @@ -63,12 +68,13 @@ private List getVarConnectionsWith(ControllableLoadModel connecte @Override public void createDynamicModelParameters(DynawoSimulationContext context, Consumer parametersAdder) { ParametersSet paramSet = new ParametersSet(getParameterSetId()); - //TODO calc delta int index = 0; for (LoadsVariation lv : loadsVariations) { - for (Load load : lv.loads()) { - paramSet.addParameter("deltaP_load_" + index, DOUBLE, String.valueOf(1)); - paramSet.addParameter("deltaQ_load_" + index, DOUBLE, String.valueOf(1)); + LoadsProportionalScalable proportionalScalable = new LoadsProportionalScalable(lv.loads()); + scalingConfig.accept(proportionalScalable, lv.variationValue()); + for (CalculatedPower load : proportionalScalable.getLoadScalable()) { + paramSet.addParameter("deltaP_load_" + index, DOUBLE, String.valueOf(load.getCalculatedP0())); + paramSet.addParameter("deltaQ_load_" + index, DOUBLE, String.valueOf(load.getCalculatedQ0())); index++; } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsProportionalScalable.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsProportionalScalable.java new file mode 100644 index 000000000..6ddac163d --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsProportionalScalable.java @@ -0,0 +1,30 @@ +/** + * 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.dynawo.margincalculation.loadsvariation; + +import com.powsybl.iidm.modification.scalable.ProportionalScalable; +import com.powsybl.iidm.network.Load; + +import java.util.List; + +import static com.powsybl.iidm.modification.scalable.ProportionalScalable.DistributionMode.PROPORTIONAL_TO_P0; + +/** + * @author Laurent Issertial {@literal } + */ +public class LoadsProportionalScalable extends ProportionalScalable { + + public LoadsProportionalScalable(List loads) { + super(loads, i -> + new CalculatedLoadScalable(i.getId()), PROPORTIONAL_TO_P0, -Double.MAX_VALUE, Double.MAX_VALUE); + } + + public List getLoadScalable() { + return getScalables().stream().map(CalculatedPower.class::cast).toList(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java index ae4af5e56..f381d726a 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariation.java @@ -14,10 +14,5 @@ /** * @author Laurent Issertial */ -public record LoadsVariation(List loads, double variationValue, VariationMode variationMode) { - - //TODO complete - public enum VariationMode { - PROPORTIONAL - } +public record LoadsVariation(List loads, double variationValue) { } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java index 4ea1d7803..6bc2d3097 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadsVariationBuilder.java @@ -29,7 +29,6 @@ public class LoadsVariationBuilder { private final BuilderEquipmentsList loads; private double variationValue = Double.NaN; - private LoadsVariation.VariationMode mode; public LoadsVariationBuilder(Network network, ReportNode reportNode) { this.network = Objects.requireNonNull(network); @@ -38,22 +37,22 @@ public LoadsVariationBuilder(Network network, ReportNode reportNode) { } public LoadsVariationBuilder loads(String... loadIds) { - loads.addEquipments(loadIds, network::getLoad); + loads.addEquipments(loadIds, this::getConnectedLoad); return this; } public LoadsVariationBuilder loads(Collection loadIds) { - loads.addEquipments(loadIds, network::getLoad); + loads.addEquipments(loadIds, this::getConnectedLoad); return this; } - public LoadsVariationBuilder variationValue(double variationValue) { - this.variationValue = variationValue; - return this; + private Load getConnectedLoad(String loadId) { + Load load = network.getLoad(loadId); + return load != null && load.getTerminal().isConnected() ? load : null; } - public LoadsVariationBuilder variationMode(LoadsVariation.VariationMode mode) { - this.mode = mode; + public LoadsVariationBuilder variationValue(double variationValue) { + this.variationValue = variationValue; return this; } @@ -63,10 +62,6 @@ protected void checkData() { BuilderReports.reportFieldNotSet(reportNode, "variationValue"); isInstantiable = false; } - if (mode == null) { - BuilderReports.reportFieldNotSet(reportNode, "variationMode"); - isInstantiable = false; - } } private boolean isInstantiable() { @@ -78,6 +73,6 @@ private boolean isInstantiable() { } public LoadsVariation build() { - return isInstantiable() ? new LoadsVariation(loads.getEquipments(), variationValue, mode) : null; + return isInstantiable() ? new LoadsVariation(loads.getEquipments(), variationValue) : null; } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java index ea0fd3230..7d82530d7 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java @@ -52,32 +52,15 @@ private LoadsVariationBuilder parseLoadsVariationBuilder(JsonParser parser) { JsonUtil.parseObject(parser, name -> { boolean handled = true; switch (name) { - case "loadsIds" -> { - List loadsIds = new ArrayList<>(); - JsonUtil.parseObjectArray(parser, loadsIds::add, this::parseLoadsIds); - loadsVariationBuilder.loads(loadsIds); + case "loadsIds" -> loadsVariationBuilder.loads(JsonUtil.parseStringArray(parser)); + case "variationValue" -> { + parser.nextToken(); + loadsVariationBuilder.variationValue(parser.getDoubleValue()); } - case "variationValue" -> loadsVariationBuilder.variationValue(Double.parseDouble(parser.nextTextValue())); - case "variationMode" -> loadsVariationBuilder.variationMode(LoadsVariation.VariationMode.valueOf(parser.nextTextValue())); default -> handled = false; } return handled; }); return loadsVariationBuilder; } - - //TODO check json model - private String parseLoadsIds(JsonParser parser) { - var temp = new Object() { - String loadId; - }; - JsonUtil.parseObject(parser, name -> { - if (name.equals("id")) { - temp.loadId = parser.nextTextValue(); - return true; - } - return false; - }); - return temp.loadId; - } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java similarity index 79% rename from dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java rename to dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java index af14038a1..0f506c2c7 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationReport.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java @@ -15,16 +15,16 @@ /** * @author Laurent Issertial {@literal } */ -public class MarginCalculationReport { +public class MarginCalculationResult { private final List loadIncreaseResults; private byte[] logBytes; - public static MarginCalculationReport empty() { - return new MarginCalculationReport(Collections.emptyList()); + public static MarginCalculationResult empty() { + return new MarginCalculationResult(Collections.emptyList()); } - public MarginCalculationReport(List loadIncreaseResults) { + public MarginCalculationResult(List loadIncreaseResults) { this.loadIncreaseResults = Objects.requireNonNull(loadIncreaseResults); } @@ -40,7 +40,7 @@ public Optional getLogBytes() { return Optional.ofNullable(logBytes); } - public MarginCalculationReport setLogBytes(byte[] logBytes) { + public MarginCalculationResult setLogBytes(byte[] logBytes) { this.logBytes = logBytes; return this; } diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializerTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializerTest.java new file mode 100644 index 000000000..4e35ba011 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializerTest.java @@ -0,0 +1,48 @@ +/** + * 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.dynawo.margincalculation.loadsvariation.supplier; + +import com.powsybl.commons.report.ReportNode; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Laurent Issertial {@literal } + */ +class LoadsVariationJsonDeserializerTest { + + @Test + void testLoadVariationSupplier() throws IOException { + Network network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + try (InputStream is = getClass().getResourceAsStream("/load_variations.json")) { + List loadsVariations = new SupplierJsonDeserializer<>( + new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(network, ReportNode.NO_OP))) + .deserialize(is); + assertThat(loadsVariations).usingRecursiveFieldByFieldElementComparatorOnFields() + .containsExactlyInAnyOrderElementsOf(getExpectedLoadsVariations(network)); + } + } + + private static List getExpectedLoadsVariations(Network network) { + return List.of( + new LoadsVariationBuilder(network, ReportNode.NO_OP) + .loads("LOAD", "LOAD2") + .variationValue(20) + .build()); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java index 89a9205b9..e24208211 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -14,6 +14,7 @@ import com.powsybl.dynawo.xml.DydXml; import com.powsybl.dynawo.xml.AbstractDynamicModelXmlTest; import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.iidm.network.Load; import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; @@ -32,6 +33,11 @@ class LoadVariationAreaXmlTest extends AbstractDynamicModelXmlTest { @Override protected void setupNetwork() { network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + network.getLoad("LOAD").setP0(400); + network.getLoad("LOAD2").setP0(200); + Load load3 = network.getLoad("LOAD3"); + load3.setP0(100); + load3.getTerminal().connect(); } @Override @@ -44,8 +50,8 @@ protected void setupDynawoContext() { MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); List loadsVariationList = List.of( - new LoadsVariation(List.of(network.getLoad("LOAD")), 2, LoadsVariation.VariationMode.PROPORTIONAL), - new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 5, LoadsVariation.VariationMode.PROPORTIONAL)); + new LoadsVariation(List.of(network.getLoad("LOAD")), 20), + new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); } diff --git a/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml b/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml index c2aca9c34..519be206e 100644 --- a/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml +++ b/dynawo-security-analysis/src/test/resources/load_variation_area_par.xml @@ -1,12 +1,12 @@ - - - - - - + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/load_variations.json b/dynawo-security-analysis/src/test/resources/load_variations.json index f85aaec38..907574f83 100644 --- a/dynawo-security-analysis/src/test/resources/load_variations.json +++ b/dynawo-security-analysis/src/test/resources/load_variations.json @@ -1,25 +1,12 @@ { "variations": [ { - "loadsIds": [ - { - "id": "LOAD" - } - ], - "variationValue": 12, - "variationMode": "PROPORTIONAL" + "loadsIds": ["LOAD", "LOAD2"], + "variationValue": 20 }, { - "loadsIds": [ - { - "id": "LOAD2" - }, - { - "id": "LOAD3" - } - ], - "variationValue": 5, - "variationMode": "PROPORTIONAL" + "loadsIds": ["LOAD3"], + "variationValue": 10.2 } ] } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3e4f7e22c..ea042ee37 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ 17 - 6.6.0 + 6.7.0-SNAPSHOT 4.0.14 0.3.2 2.17.1 From bda6a0b2e50b16258e17db58b00dbb12e51c8079 Mon Sep 17 00:00:00 2001 From: lisrte Date: Tue, 7 Jan 2025 13:04:24 +0100 Subject: [PATCH 23/28] Fix maven.yml Signed-off-by: lisrte --- .github/workflows/maven.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index eff5b36e3..b4ab378d2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,18 +34,21 @@ jobs: with: java-version: 17 + - name: Build and install powsybl-core with Maven + run: mvn --batch-mode -DskipTests=true --file ./powsybl-core/pom.xml install + - name: Build with Maven if: matrix.os == 'ubuntu-latest' - run: mvn --batch-mode -Pintegration-tests,jacoco install + run: mvn --batch-mode -Pintegration-tests,jacoco --file ./main/pom.xml install - name: Build with Maven if: matrix.os != 'ubuntu-latest' - run: mvn --batch-mode install + run: mvn --batch-mode --file ./main/pom.xml install - name: Run SonarCloud analysis if: matrix.os == 'ubuntu-latest' run: > - mvn --batch-mode -DskipTests sonar:sonar + mvn --batch-mode -DskipTests --file ./main/pom.xml sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=powsybl-ci-github -Dsonar.projectKey=com.powsybl:powsybl-dynawo From 4cb15fef79510ea60c1c86cd3260db0272240088 Mon Sep 17 00:00:00 2001 From: lisrte Date: Tue, 7 Jan 2025 14:50:29 +0100 Subject: [PATCH 24/28] Add test coverage Signed-off-by: lisrte --- .../ContingencyEventModelsFactory.java | 9 +-- .../algorithms/DynawoAlgorithmsReports.java | 34 ++++++++++ .../MarginCalculationParameters.java | 15 ++--- .../LoadVariationAreaAutomationSystem.java | 6 +- .../supplier/LoadsVariationUtils.java | 31 ---------- .../xml/MultipleJobsXml.java | 5 +- .../DynamicSecurityAnalysisReports.java | 8 --- .../ContingencyEventModelsTest.java | 3 +- .../xml/MultiplesJobsXmlTest.java | 62 +++++++++++++++++++ .../security/xml/MultiplesJobsXmlTest.java | 2 +- .../src/test/resources/multipleJobs_mc.xml | 10 +++ .../{multipleJobs.xml => multipleJobs_sa.xml} | 0 .../models/loads/BaseLoadControllable.java | 8 +-- ...java => DefaultControllableLoadModel.java} | 2 +- .../dynawo/models/loads/DefaultLoad.java | 2 +- 15 files changed, 132 insertions(+), 65 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsReports.java delete mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java create mode 100644 dynawo-security-analysis/src/test/resources/multipleJobs_mc.xml rename dynawo-security-analysis/src/test/resources/{multipleJobs.xml => multipleJobs_sa.xml} (100%) rename dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/{ControllableLoadModel.java => DefaultControllableLoadModel.java} (86%) diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java index 571d94b8d..63bf9d8c9 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsFactory.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.algorithms; -import com.powsybl.commons.PowsyblException; import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; import com.powsybl.contingency.ContingencyElement; @@ -20,12 +19,14 @@ import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.parameters.ParametersSet; -import com.powsybl.dynawo.security.DynamicSecurityAnalysisReports; import com.powsybl.iidm.network.Network; import com.powsybl.iidm.network.TwoSides; import java.util.*; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsReports.createContingencyVoltageIdNotFoundReportNode; +import static com.powsybl.dynawo.algorithms.DynawoAlgorithmsReports.createNotSupportedContingencyTypeReportNode; + /** * @author Laurent Issertial */ @@ -85,14 +86,14 @@ private static BlackBoxModel createContingencyEventModel(ContingencyElement elem if (side != null) { builder.disconnectOnly(side); } else { - DynamicSecurityAnalysisReports.createContingencyVoltageIdNotFoundReportNode(reportNode, + createContingencyVoltageIdNotFoundReportNode(reportNode, sidedElement.getId(), sidedElement.getVoltageLevelId()); return null; } } BlackBoxModel bbm = builder.build(); if (bbm == null) { - throw new PowsyblException("Contingency element " + element.getType() + " not supported"); + createNotSupportedContingencyTypeReportNode(reportNode, element.getType().toString()); } if (bbm instanceof ContextDependentEvent cde) { cde.setEquipmentHasDynamicModel(context); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsReports.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsReports.java new file mode 100644 index 000000000..7e2b99824 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/DynawoAlgorithmsReports.java @@ -0,0 +1,34 @@ +/** + * 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.dynawo.algorithms; + +import com.powsybl.commons.report.ReportNode; + +/** + * @author Laurent Issertial {@literal } + */ +public final class DynawoAlgorithmsReports { + + private DynawoAlgorithmsReports() { + } + + public static ReportNode createContingencyVoltageIdNotFoundReportNode(ReportNode reportNode, String contingencyId, String voltageLevelId) { + return reportNode.newReportNode() + .withMessageTemplate("contingencyVlIdNotFound", "Voltage id '${voltageLevelId}' of contingency '${contingencyId}' not found, contingency will be skipped") + .withUntypedValue("voltageLevelId", voltageLevelId) + .withUntypedValue("contingencyId", contingencyId) + .add(); + } + + public static ReportNode createNotSupportedContingencyTypeReportNode(ReportNode reportNode, String contingencyType) { + return reportNode.newReportNode() + .withMessageTemplate("contingencyNotSupported", "Contingency element '${contingencyType}' not supported, contingency will be skipped") + .withUntypedValue("contingencyType", contingencyType) + .add(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java index 5909392aa..891c0b703 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java @@ -27,7 +27,7 @@ public final class MarginCalculationParameters { public static final double DEFAULT_LOAD_INCREASE_STOP_TIME = 50; public static final double DEFAULT_CONTINGENCIES_START_TIME = 120; public static final CalculationType DEFAULT_CALCULATION_TYPE = CalculationType.GLOBAL_MARGIN; - public static final double DEFAULT_ACCURACY = 2; + public static final int DEFAULT_ACCURACY = 2; public static final LoadModelsRule DEFAULT_LOAD_MODELS_RULE = LoadModelsRule.EVERY_MODELS; public enum CalculationType { @@ -38,6 +38,7 @@ public enum CalculationType { /** * Indicates how to handle loads in the first phase */ + //TODO rename public enum LoadModelsRule { /** * Remove every specific loads dynamic models @@ -58,7 +59,7 @@ public static class Builder { private double loadIncreaseStopTime = DEFAULT_LOAD_INCREASE_STOP_TIME; private double contingenciesStartTime = DEFAULT_CONTINGENCIES_START_TIME; private CalculationType calculationType = DEFAULT_CALCULATION_TYPE; - private double accuracy = DEFAULT_ACCURACY; + private int accuracy = DEFAULT_ACCURACY; private LoadModelsRule loadModelsRule = DEFAULT_LOAD_MODELS_RULE; /** @@ -114,7 +115,7 @@ public Builder setCalculationType(CalculationType calculationType) { return this; } - public Builder setAccuracy(double accuracy) { + public Builder setAccuracy(int accuracy) { this.accuracy = accuracy; return this; } @@ -180,7 +181,7 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi c.getOptionalDoubleProperty("loadIncrease.stopTime").ifPresent(builder::setLoadIncreaseStopTime); c.getOptionalDoubleProperty("contingencies-start-time").ifPresent(builder::setContingenciesStartTime); c.getOptionalEnumProperty("calculation-type", CalculationType.class).ifPresent(builder::setCalculationType); - c.getOptionalDoubleProperty("accuracy").ifPresent(builder::setAccuracy); + c.getOptionalIntProperty("accuracy").ifPresent(builder::setAccuracy); c.getOptionalEnumProperty("loads-models-rule", LoadModelsRule.class).ifPresent(builder::setLoadModelsRule); }); return builder.build(); @@ -193,10 +194,10 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi private final double loadIncreaseStopTime; private final double contingenciesStartTime; private final CalculationType calculationType; - private final double accuracy; + private final int accuracy; private final LoadModelsRule loadModelsRule; - private MarginCalculationParameters(double startTime, double stopTime, double marginCalculationStartTime, double loadIncreaseStartTime, double loadIncreaseStopTime, double contingenciesStartTime, CalculationType calculationType, double accuracy, LoadModelsRule loadModelsRule) { + private MarginCalculationParameters(double startTime, double stopTime, double marginCalculationStartTime, double loadIncreaseStartTime, double loadIncreaseStopTime, double contingenciesStartTime, CalculationType calculationType, int accuracy, LoadModelsRule loadModelsRule) { this.startTime = startTime; this.stopTime = stopTime; this.marginCalculationStartTime = marginCalculationStartTime; @@ -236,7 +237,7 @@ public CalculationType getCalculationType() { return calculationType; } - public double getAccuracy() { + public int getAccuracy() { return accuracy; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java index e2d779f09..7fd4e8e57 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/LoadVariationAreaAutomationSystem.java @@ -11,7 +11,7 @@ import com.powsybl.dynawo.builders.ModelConfig; import com.powsybl.dynawo.models.AbstractPureDynamicBlackBoxModel; import com.powsybl.dynawo.models.VarConnection; -import com.powsybl.dynawo.models.loads.ControllableLoadModel; +import com.powsybl.dynawo.models.loads.DefaultControllableLoadModel; import com.powsybl.dynawo.models.macroconnections.MacroConnectAttribute; import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; import com.powsybl.dynawo.parameters.ParametersSet; @@ -54,13 +54,13 @@ public void createMacroConnections(MacroConnectionsAdder adder) { int index = 0; for (LoadsVariation lv : loadsVariations) { for (Load load : lv.loads()) { - adder.createMacroConnections(this, load, ControllableLoadModel.class, this::getVarConnectionsWith, MacroConnectAttribute.ofIndex1(index)); + adder.createMacroConnections(this, load, DefaultControllableLoadModel.class, this::getVarConnectionsWith, MacroConnectAttribute.ofIndex1(index)); index++; } } } - private List getVarConnectionsWith(ControllableLoadModel connected) { + private List getVarConnectionsWith(DefaultControllableLoadModel connected) { return List.of(new VarConnection("DeltaPc_load_@INDEX@", connected.getDeltaPVarName()), new VarConnection("DeltaQc_load_@INDEX@", connected.getDeltaQVarName())); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java deleted file mode 100644 index 03f7f95d7..000000000 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.dynawo.margincalculation.loadsvariation.supplier; - -import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; -import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; - -import java.io.InputStream; -import java.nio.file.Path; - -/** - * @author Laurent Issertial {@literal } - */ -public final class LoadsVariationUtils { - - private LoadsVariationUtils() { - } - - public static LoadsVariationSupplier createLoadsVariationSupplier(InputStream is) { - return (n, r) -> new SupplierJsonDeserializer<>(new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(n, r))).deserialize(is); - } - - public static LoadsVariationSupplier createLoadsVariationSupplier(Path path) { - return (n, r) -> new SupplierJsonDeserializer<>(new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(n, r))).deserialize(path); - } -} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java index c744b2988..17888952c 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java @@ -22,11 +22,11 @@ import static com.powsybl.dynawo.DynawoSimulationConstants.JOBS_FILENAME; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.PHASE_2_JOBS_FILENAME; +import static com.powsybl.dynawo.margincalculation.xml.MarginCalculationConstant.LOAD_VARIATION_AREA_FILENAME; /** * @author Laurent Issertial */ -//TODO add tests public final class MultipleJobsXml { private MultipleJobsXml() { @@ -43,9 +43,10 @@ private static void writeMarginCalculation(XMLStreamWriter writer, MarginCalcula MarginCalculationParameters parameters = context.getMarginCalculationParameters(); writer.writeStartElement("marginCalculation"); writer.writeAttribute("calculationType", parameters.getCalculationType().toString()); - writer.writeAttribute("accuracy", Double.toString(parameters.getAccuracy())); + writer.writeAttribute("accuracy", Integer.toString(parameters.getAccuracy())); writeScenarios(writer, context.getContingencyEventModels()); writer.writeEmptyElement("loadIncrease"); + writer.writeAttribute("id", LOAD_VARIATION_AREA_FILENAME); writer.writeAttribute("jobsFile", JOBS_FILENAME); writer.writeEndElement(); } catch (XMLStreamException e) { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynamicSecurityAnalysisReports.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynamicSecurityAnalysisReports.java index ed00ca1da..591141ef3 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynamicSecurityAnalysisReports.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/security/DynamicSecurityAnalysisReports.java @@ -23,12 +23,4 @@ public static ReportNode createDynamicSecurityAnalysisReportNode(ReportNode repo .withUntypedValue("networkId", networkId) .add(); } - - public static ReportNode createContingencyVoltageIdNotFoundReportNode(ReportNode reportNode, String contingencyId, String voltageLevelId) { - return reportNode.newReportNode() - .withMessageTemplate("contingencyVlIdNotFound", "Voltage id '${voltageLevelId}' of contingency '${contingencyId}' not found, contingency will be skipped") - .withUntypedValue("voltageLevelId", voltageLevelId) - .withUntypedValue("contingencyId", contingencyId) - .add(); - } } diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java index ea081f3ea..d6a3104f6 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingencyEventModelsTest.java @@ -51,7 +51,8 @@ void test() { Contingency.load("LOAD"), Contingency.generator("GEN"), Contingency.line(NHV1_NHV2_1, VLHV1), - Contingency.branch(NHV1_NHV2_2, "WRONG_ID")); + Contingency.branch(NHV1_NHV2_2, "WRONG_ID"), + Contingency.battery("BATTERY")); List contingencyEvents = ContingencyEventModelsFactory.createFrom(contingencies, context, macroConnectionsAdder, 2, ReportNode.NO_OP); diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java new file mode 100644 index 000000000..eec56421a --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java @@ -0,0 +1,62 @@ +/** + * 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.dynawo.margincalculation.xml; + +import com.powsybl.contingency.Contingency; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; +import com.powsybl.dynawo.xml.AbstractDynamicModelXmlTest; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXException; + +import javax.xml.stream.XMLStreamException; +import java.io.IOException; +import java.util.List; + +import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; + +/** + * @author Laurent Issertial + */ +class MultiplesJobsXmlTest extends AbstractDynamicModelXmlTest { + + @Override + protected void setupNetwork() { + network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + } + + @Override + protected void addDynamicModels() { + // no models + } + + @Override + protected void setupDynawoContext() { + List contingencies = List.of( + Contingency.load("LOAD"), + Contingency.builder("DisconnectLineGenerator") + .addLine("NHV1_NHV2_1") + .addGenerator("GEN2") + .build()); + MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + List loadsVariationList = List.of( + new LoadsVariation(List.of(network.getLoad("LOAD"), network.getLoad("LOAD2")), 10)); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + parameters, dynawoSimulationParameters, contingencies, loadsVariationList); + } + + @Test + void writeMultiplesJobs() throws SAXException, IOException, XMLStreamException { + MultipleJobsXml.write(tmpDir, (MarginCalculationContext) context); + validate("multipleJobs.xsd", "multipleJobs_mc.xml", tmpDir.resolve(MULTIPLE_JOBS_FILENAME)); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java index bb3c17984..21dd15dfb 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/security/xml/MultiplesJobsXmlTest.java @@ -39,7 +39,7 @@ void writeMultiplesJobs() throws SAXException, IOException, XMLStreamException { SecurityAnalysisContext context = new SecurityAnalysisContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, parameters, dynawoSimulationParameters, contingencies); MultipleJobsXml.write(tmpDir, context); - validate("multipleJobs.xsd", "multipleJobs.xml", tmpDir.resolve(MULTIPLE_JOBS_FILENAME)); + validate("multipleJobs.xsd", "multipleJobs_sa.xml", tmpDir.resolve(MULTIPLE_JOBS_FILENAME)); } } diff --git a/dynawo-security-analysis/src/test/resources/multipleJobs_mc.xml b/dynawo-security-analysis/src/test/resources/multipleJobs_mc.xml new file mode 100644 index 000000000..74a121647 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/multipleJobs_mc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/multipleJobs.xml b/dynawo-security-analysis/src/test/resources/multipleJobs_sa.xml similarity index 100% rename from dynawo-security-analysis/src/test/resources/multipleJobs.xml rename to dynawo-security-analysis/src/test/resources/multipleJobs_sa.xml diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java index 6646293fd..f6f69cf3b 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/BaseLoadControllable.java @@ -8,12 +8,13 @@ package com.powsybl.dynawo.models.loads; import com.powsybl.dynawo.builders.ModelConfig; +import com.powsybl.dynawo.models.events.ControllableEquipmentModel; import com.powsybl.iidm.network.Load; /** * @author Laurent Issertial {@literal } */ -public class BaseLoadControllable extends BaseLoad implements ControllableLoadModel { +public class BaseLoadControllable extends BaseLoad implements ControllableEquipmentModel { protected BaseLoadControllable(String dynamicModelId, Load load, String parameterSetId, ModelConfig modelConfig) { super(dynamicModelId, load, parameterSetId, modelConfig); @@ -23,9 +24,4 @@ protected BaseLoadControllable(String dynamicModelId, Load load, String paramete public String getDeltaPVarName() { return "load_deltaP"; } - - @Override - public String getDeltaQVarName() { - return "load_deltaQ"; - } } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultControllableLoadModel.java similarity index 86% rename from dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java rename to dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultControllableLoadModel.java index be14f832c..c81450759 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/ControllableLoadModel.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultControllableLoadModel.java @@ -12,7 +12,7 @@ /** * @author Laurent Issertial {@literal } */ -public interface ControllableLoadModel extends ControllableEquipmentModel { +public interface DefaultControllableLoadModel extends ControllableEquipmentModel { String getDeltaQVarName(); } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java index 70a76de40..94680f1b4 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/models/loads/DefaultLoad.java @@ -12,7 +12,7 @@ /** * @author Laurent Issertial {@literal } */ -public class DefaultLoad extends AbstractInjectionDefaultModel implements ControllableLoadModel { +public class DefaultLoad extends AbstractInjectionDefaultModel implements DefaultControllableLoadModel { public DefaultLoad(String staticId) { super(staticId); From a0f15c468cd10ddc46e497b0206ed4a27727e147 Mon Sep 17 00:00:00 2001 From: lisrte Date: Wed, 8 Jan 2025 16:25:41 +0100 Subject: [PATCH 25/28] Phase2 MC predicate Handle dynawo version in MC context Add integration test Signed-off-by: lisrte --- .../dynawo/it/DynawoSecurityAnalysisTest.java | 1 + .../dynawo/it/MarginCalculationTest.java | 119 ++++++++++++++++++ .../resources/ieee14/dynamicModels.groovy | 31 +++++ .../margin-calculation/load_variations.json | 12 ++ .../MarginCalculationContext.java | 41 ++++-- .../MarginCalculationProvider.java | 7 +- .../xml/Phase2GlobalXmlTest.java | 77 ++++++++++++ .../xml/Phase2HybridXmlTest.java | 78 ++++++++++++ .../src/test/resources/phase1_global_dyd.xml | 16 +++ .../src/test/resources/phase1_hybrid_dyd.xml | 29 +++++ .../src/test/resources/phase2_global_dyd.xml | 20 +++ .../src/test/resources/phase2_hybrid_dyd.xml | 7 ++ .../dynawo/DynawoSimulationContext.java | 1 - .../com/powsybl/dynawo/xml/JobsXmlTest.java | 1 + 14 files changed, 426 insertions(+), 14 deletions(-) create mode 100644 dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java create mode 100644 dynawo-integration-tests/src/test/resources/ieee14/dynamicModels.groovy create mode 100644 dynawo-integration-tests/src/test/resources/ieee14/margin-calculation/load_variations.json create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java create mode 100644 dynawo-security-analysis/src/test/resources/phase1_global_dyd.xml create mode 100644 dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml create mode 100644 dynawo-security-analysis/src/test/resources/phase2_global_dyd.xml create mode 100644 dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index 005d1c335..c1c08077a 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -71,6 +71,7 @@ void testIeee14DSA(String criteriaPath, List contingencies, String Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm"))); GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( + //TODO use the MC groovyscript getResourceAsStream("/ieee14/dynamic-security-analysis/dynamicModels.groovy"), GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java new file mode 100644 index 000000000..497d723f7 --- /dev/null +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2022, 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/. + */ +package com.powsybl.dynawo.it; + +import com.powsybl.commons.datasource.ResourceDataSource; +import com.powsybl.commons.datasource.ResourceSet; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.contingency.Contingency; +import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension; +import com.powsybl.dynamicsimulation.groovy.GroovyDynamicModelsSupplier; +import com.powsybl.dynamicsimulation.groovy.GroovyExtension; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.DynawoSimulationProvider; +import com.powsybl.dynawo.algorithms.DynawoAlgorithmsConfig; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationProvider; +import com.powsybl.dynawo.margincalculation.MarginCalculationRunParameters; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; +import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +import com.powsybl.dynawo.parameters.ParametersSet; +import com.powsybl.dynawo.xml.ParametersXml; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.VariantManagerConstants; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Laurent Issertial + */ +class MarginCalculationTest extends AbstractDynawoTest { + + private MarginCalculationProvider provider; + + private MarginCalculationParameters parameters; + + private DynawoSimulationParameters dynawoSimulationParameters; + + @Override + @BeforeEach + void setUp() throws Exception { + super.setUp(); + provider = new MarginCalculationProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), true)); + parameters = MarginCalculationParameters.builder() + .setStartTime(0) + .setLoadIncreaseStartTime(10) + .setLoadIncreaseStopTime(70) + .setMarginCalculationStartTime(100) + .setContingenciesStartTime(110) + .setStopTime(200) + .build(); + dynawoSimulationParameters = new DynawoSimulationParameters(); + } + + @ParameterizedTest + @MethodSource("provideSimulationParameter") + void testIeee14MC(String criteriaPath, List contingencies) throws IOException { + Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm"))); + + GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( + getResourceAsStream("/ieee14/dynamicModels.groovy"), + GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); + + List modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/models.par")); + ParametersSet networkParameters = ParametersXml.load(getResourceAsStream("/ieee14/network.par"), "8"); + ParametersSet solverParameters = ParametersXml.load(getResourceAsStream("/ieee14/solvers.par"), "2"); + dynawoSimulationParameters.setModelsParameters(modelsParameters) + .setNetworkParameters(networkParameters) + .setSolverParameters(solverParameters) + .setSolverType(DynawoSimulationParameters.SolverType.IDA) + .setCriteriaFilePath(Path.of(Objects.requireNonNull(getClass() + .getResource(criteriaPath)).getPath())); + + ReportNode reportNode = ReportNode.newRootReportNode() + .withMessageTemplate("mc_test", "Margin calculation integration test") + .build(); + + MarginCalculationRunParameters runParameters = new MarginCalculationRunParameters() + .setComputationManager(computationManager) + .setMarginCalculationParameters(parameters) + .setReportNode(reportNode); + + LoadsVariationSupplier loadsVariationSupplier = (n, r) -> List.of( + new LoadsVariationBuilder(n, r) + .loads("_LOAD___3_EC", "_LOAD___6_EC", "_LOAD___9_EC") + .variationValue(10) + .build()); + + List results = provider.run(network, VariantManagerConstants.INITIAL_VARIANT_ID, + dynamicModelsSupplier, n -> contingencies, loadsVariationSupplier, runParameters) + .join() + .getResults(); + + //TODO assert results + assertThat(results).isNotEmpty(); + } + + private static Stream provideSimulationParameter() { + return Stream.of( + Arguments.of("/ieee14/dynamic-security-analysis/convergence/criteria.crt", + List.of(Contingency.line("_BUS____1-BUS____5-1_AC", "_BUS____5_VL"), + Contingency.generator("_GEN____2_SM"))) + ); + } +} diff --git a/dynawo-integration-tests/src/test/resources/ieee14/dynamicModels.groovy b/dynawo-integration-tests/src/test/resources/ieee14/dynamicModels.groovy new file mode 100644 index 000000000..93892b2c6 --- /dev/null +++ b/dynawo-integration-tests/src/test/resources/ieee14/dynamicModels.groovy @@ -0,0 +1,31 @@ +package ieee14 +/** + * 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 + */ + +import com.powsybl.iidm.network.Load + +for (Load load : network.loads) { + LoadAlphaBeta { + staticId load.id + parameterSetId "LAB" + } +} + +for (gen in ["_GEN____1_SM", "_GEN____2_SM", "_GEN____3_SM"]) { + GeneratorSynchronousFourWindingsProportionalRegulations { + staticId gen + parameterSetId "GSFWPR" + gen + } +} + +for (gen in ["_GEN____6_SM", "_GEN____8_SM"]) { + GeneratorSynchronousThreeWindingsProportionalRegulations { + staticId gen + parameterSetId "GSTWPR" + gen + } +} \ No newline at end of file diff --git a/dynawo-integration-tests/src/test/resources/ieee14/margin-calculation/load_variations.json b/dynawo-integration-tests/src/test/resources/ieee14/margin-calculation/load_variations.json new file mode 100644 index 000000000..bd61a0178 --- /dev/null +++ b/dynawo-integration-tests/src/test/resources/ieee14/margin-calculation/load_variations.json @@ -0,0 +1,12 @@ +{ + "variations": [ + { + "loadsIds": ["_LOAD___3_EC_", "_LOAD___6_EC_", "_LOAD___9_EC_"], + "variationValue": 20 + }, + { + "loadsIds": ["LOAD3"], + "variationValue": 10.2 + } + ] +} \ No newline at end of file diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index f3ed1779d..7b5124625 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -12,12 +12,14 @@ import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DynawoSimulationConstants; import com.powsybl.dynawo.commons.DynawoConstants; +import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadVariationAreaAutomationSystem; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsProportionalScalable; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.models.BlackBoxModel; +import com.powsybl.dynawo.models.loads.AbstractLoad; import com.powsybl.dynawo.models.macroconnections.MacroConnect; import com.powsybl.dynawo.models.macroconnections.MacroConnector; import com.powsybl.dynawo.algorithms.ContingencyEventModels; @@ -25,10 +27,13 @@ import com.powsybl.dynawo.xml.DydDataSupplier; import com.powsybl.iidm.modification.scalable.Scalable; import com.powsybl.iidm.modification.scalable.ScalingParameters; +import com.powsybl.iidm.network.Identifiable; import com.powsybl.iidm.network.Network; import java.util.*; import java.util.function.BiConsumer; +import java.util.function.Predicate; +import java.util.stream.Collectors; /** * @author Laurent Issertial @@ -47,7 +52,8 @@ public MarginCalculationContext(Network network, String workingVariantId, DynawoSimulationParameters dynawoSimulationParameters, List contingencies, List loadsVariations) { - this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, loadsVariations, ReportNode.NO_OP); + this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, + loadsVariations, DynawoConstants.VERSION_MIN, ReportNode.NO_OP); } public MarginCalculationContext(Network network, String workingVariantId, @@ -56,18 +62,21 @@ public MarginCalculationContext(Network network, String workingVariantId, DynawoSimulationParameters dynawoSimulationParameters, List contingencies, List loadsVariations, + DynawoVersion currentVersion, ReportNode reportNode) { super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), - //TODO fix - //TODO calculate phase 2 predicate - hande dyna version - new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), dynawoSimulationParameters, null, DynawoConstants.VERSION_MIN, reportNode); + //TODO fix parameters handling + new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), + dynawoSimulationParameters, + configurePhase2Predicate(parameters.getLoadModelsRule(), loadsVariations), currentVersion, reportNode); this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); - this.contingencyEventModels = ContingencyEventModelsFactory.createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime, reportNode); + this.contingencyEventModels = ContingencyEventModelsFactory + .createFrom(contingencies, this, macroConnectionsAdder, contingenciesStartTime, reportNode); this.loadVariationArea = new LoadVariationAreaAutomationSystem(loadsVariations, parameters.getLoadIncreaseStartTime(), parameters.getLoadIncreaseStopTime(), - getScalableConfig(network)); + configureScaling(network)); macroConnectionsAdder.setMacroConnectorAdder(loadVariationMacroConnectorsMap::computeIfAbsent); macroConnectionsAdder.setMacroConnectAdder(loadVariationMacroConnectList::add); @@ -75,10 +84,6 @@ public MarginCalculationContext(Network network, String workingVariantId, loadVariationArea.createDynamicModelParameters(this, getDynamicModelsParameters()::add); } - private static void splitDynamicModels(List dynamicModels) { - //TODO - } - public MarginCalculationParameters getMarginCalculationParameters() { return marginCalculationParameters; } @@ -112,7 +117,21 @@ public String getParFileName() { }; } - private static BiConsumer getScalableConfig(Network network) { + private static Predicate configurePhase2Predicate(MarginCalculationParameters.LoadModelsRule rule, + List loadsVariations) { + return switch (rule) { + case EVERY_MODELS -> AbstractLoad.class::isInstance; + case HYBRID -> { + Set loadIds = loadsVariations.stream() + .flatMap(l -> l.loads().stream()) + .map(Identifiable::getId) + .collect(Collectors.toSet()); + yield bbm -> bbm instanceof AbstractLoad eBbm && loadIds.contains(eBbm.getStaticId()); + } + }; + } + + private static BiConsumer configureScaling(Network network) { ScalingParameters scalingParameters = new ScalingParameters() .setScalingConvention(Scalable.ScalingConvention.LOAD) .setConstantPowerFactor(true); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java index 8f8eef824..9ce1cd374 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -16,6 +16,7 @@ import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationProvider; import com.powsybl.dynawo.commons.DynawoUtil; +import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.commons.PowsyblDynawoVersion; import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; @@ -61,7 +62,7 @@ public CompletableFuture run(Network network, String wo ReportNode mcReportNode = MarginCalculationReports.createMarginCalculationReportNode(runParameters.getReportNode(), network.getId()); network.getVariantManager().setWorkingVariant(workingVariantId); ExecutionEnvironment execEnv = new ExecutionEnvironment(Collections.emptyMap(), WORKING_DIR_PREFIX, config.isDebug()); - DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWO_LAUNCHER_PROGRAM_NAME, false); + DynawoVersion currentVersion = DynawoUtil.requireDynaMinVersion(execEnv, runParameters.getComputationManager(), getVersionCommand(config), DYNAWO_LAUNCHER_PROGRAM_NAME, false); MarginCalculationParameters parameters = runParameters.getMarginCalculationParameters(); MarginCalculationContext context = new MarginCalculationContext(network, workingVariantId, BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, mcReportNode), @@ -69,7 +70,9 @@ public CompletableFuture run(Network network, String wo //TODO fix DynawoSimulationParameters.load(), contingenciesProvider.getContingencies(network), - loadsVariationSupplier.getLoadsVariations(network)); + loadsVariationSupplier.getLoadsVariations(network, mcReportNode), + currentVersion, + mcReportNode); return runParameters.getComputationManager().execute(execEnv, new MarginCalculationHandler(context, getCommand(config, "MC", "dynawo_dynamic_mc"), mcReportNode)); diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java new file mode 100644 index 000000000..e9fd6eddc --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java @@ -0,0 +1,77 @@ +/** + * 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.dynawo.margincalculation.xml; + +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; +import com.powsybl.dynawo.models.generators.BaseGeneratorBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.xml.AbstractDynamicModelXmlTest; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import static com.powsybl.dynawo.DynawoSimulationConstants.DYD_FILENAME; +import static com.powsybl.dynawo.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Laurent Issertial + */ +class Phase2GlobalXmlTest extends AbstractDynamicModelXmlTest { + + @Override + protected void setupNetwork() { + network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + } + + @Override + protected void addDynamicModels() { + dynamicModels.add( + BaseGeneratorBuilder.of(network) + .staticId("GEN") + .parameterSetId("gen") + .build()); + dynamicModels.add( + BaseLoadBuilder.of(network) + .staticId("LOAD") + .parameterSetId("lab") + .build()); + dynamicModels.add( + BaseLoadBuilder.of(network) + .staticId("LOAD2") + .parameterSetId("lab") + .build()); + } + + @Override + protected void setupDynawoContext() { + MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + List loadsVariationList = List.of( + new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + } + + @Test + void writeDyd() throws SAXException, IOException { + DydXml.write(tmpDir, context); + assertThat(context.getPhase2DydData()).isPresent(); + DydXml.write(tmpDir, PHASE_2_DYD_FILENAME, context.getPhase2DydData().get()); + validate("dyd.xsd", "phase1_global_dyd.xml", tmpDir.resolve(DYD_FILENAME)); + validate("dyd.xsd", "phase2_global_dyd.xml", tmpDir.resolve(PHASE_2_DYD_FILENAME)); + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java new file mode 100644 index 000000000..c11d0d98f --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java @@ -0,0 +1,78 @@ +/** + * 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.dynawo.margincalculation.xml; + +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationContext; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; +import com.powsybl.dynawo.models.generators.BaseGeneratorBuilder; +import com.powsybl.dynawo.models.loads.BaseLoadBuilder; +import com.powsybl.dynawo.xml.AbstractDynamicModelXmlTest; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.iidm.network.test.EurostagTutorialExample1Factory; +import org.junit.jupiter.api.Test; +import org.xml.sax.SAXException; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import static com.powsybl.dynawo.DynawoSimulationConstants.DYD_FILENAME; +import static com.powsybl.dynawo.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Laurent Issertial + */ +class Phase2HybridXmlTest extends AbstractDynamicModelXmlTest { + + @Override + protected void setupNetwork() { + network = EurostagTutorialExample1Factory.createWithMultipleConnectedComponents(); + } + + @Override + protected void addDynamicModels() { + dynamicModels.add( + BaseGeneratorBuilder.of(network) + .staticId("GEN") + .parameterSetId("gen") + .build()); + dynamicModels.add( + BaseLoadBuilder.of(network) + .staticId("LOAD") + .parameterSetId("lab") + .build()); + dynamicModels.add( + BaseLoadBuilder.of(network) + .staticId("LOAD2") + .parameterSetId("lab") + .build()); + } + + @Override + protected void setupDynawoContext() { + MarginCalculationParameters parameters = MarginCalculationParameters.builder() + .setLoadModelsRule(MarginCalculationParameters.LoadModelsRule.HYBRID).build(); + DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + List loadsVariationList = List.of( + new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + } + + @Test + void writeDyd() throws SAXException, IOException { + DydXml.write(tmpDir, context); + assertThat(context.getPhase2DydData()).isPresent(); + DydXml.write(tmpDir, PHASE_2_DYD_FILENAME, context.getPhase2DydData().get()); + validate("dyd.xsd", "phase1_hybrid_dyd.xml", tmpDir.resolve(DYD_FILENAME)); + validate("dyd.xsd", "phase2_hybrid_dyd.xml", tmpDir.resolve(PHASE_2_DYD_FILENAME)); + } +} diff --git a/dynawo-security-analysis/src/test/resources/phase1_global_dyd.xml b/dynawo-security-analysis/src/test/resources/phase1_global_dyd.xml new file mode 100644 index 000000000..a6778e060 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/phase1_global_dyd.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml b/dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml new file mode 100644 index 000000000..e407da502 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/phase2_global_dyd.xml b/dynawo-security-analysis/src/test/resources/phase2_global_dyd.xml new file mode 100644 index 000000000..cf449d13a --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/phase2_global_dyd.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml b/dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml new file mode 100644 index 000000000..7f038b589 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index 9b46e9254..e7835a50f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -79,7 +79,6 @@ public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, Predicate phase2ModelsPredicate, DynawoVersion currentVersion, ReportNode reportNode) { - //TODO change predicate to Identifiable ? ReportNode contextReportNode = DynawoSimulationReports.createDynawoSimulationContextReportNode(reportNode); DynawoVersion dynawoVersion = Objects.requireNonNull(currentVersion); this.network = Objects.requireNonNull(network); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index 7eea4ab00..e974fd85f 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -54,6 +54,7 @@ private static Stream provideParameters() { void writeJobWithPhase2() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); + //TODO wrap start/stop time in context (use phase2 Config with predicate + stop time 2) DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, outputVariables, parameters, dynawoParameters, bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD2"), From 82237beabb3da0ba107c845934aaf320b9bf195b Mon Sep 17 00:00:00 2001 From: lisrte Date: Mon, 13 Jan 2025 17:44:11 +0100 Subject: [PATCH 26/28] Handle MC dynawo parameters Write phase 2 jobs and dyd Signed-off-by: lisrte --- .../dynawo/it/MarginCalculationTest.java | 3 +- .../algorithms/xml/AlgorithmsConstants.java | 2 -- .../MarginCalculationContext.java | 29 ++++++++--------- .../MarginCalculationHandler.java | 7 +++++ .../MarginCalculationParameters.java | 31 ++++++++++++++----- .../MarginCalculationProvider.java | 5 +-- .../xml/MultipleJobsXml.java | 2 +- .../xml/LoadVariationAreaXmlTest.java | 8 ++--- .../xml/MultiplesJobsXmlTest.java | 8 ++--- .../xml/Phase2GlobalXmlTest.java | 8 ++--- ...mlTest.java => Phase2TargetedXmlTest.java} | 15 ++++----- ...hybrid_dyd.xml => phase1_targeted_dyd.xml} | 0 ...hybrid_dyd.xml => phase2_targeted_dyd.xml} | 0 .../dynawo/DynawoSimulationConstants.java | 3 +- .../dynawo/DynawoSimulationContext.java | 16 +++++++--- .../java/com/powsybl/dynawo/Phase2Config.java | 21 +++++++++++++ .../java/com/powsybl/dynawo/xml/JobsXml.java | 21 +++++-------- ...stractParametrizedDynamicModelXmlTest.java | 7 +++-- .../dynawo/xml/ContextPhase2XmlTest.java | 3 +- .../com/powsybl/dynawo/xml/JobsXmlTest.java | 8 ++--- .../src/test/resources/jobsWithPhase2.xml | 2 +- 21 files changed, 115 insertions(+), 84 deletions(-) rename dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/{Phase2HybridXmlTest.java => Phase2TargetedXmlTest.java} (84%) rename dynawo-security-analysis/src/test/resources/{phase1_hybrid_dyd.xml => phase1_targeted_dyd.xml} (100%) rename dynawo-security-analysis/src/test/resources/{phase2_hybrid_dyd.xml => phase2_targeted_dyd.xml} (100%) create mode 100644 dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Config.java diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java index 497d723f7..dc837304b 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java @@ -55,6 +55,7 @@ class MarginCalculationTest extends AbstractDynawoTest { void setUp() throws Exception { super.setUp(); provider = new MarginCalculationProvider(new DynawoAlgorithmsConfig(Path.of("/dynaflow-launcher"), true)); + dynawoSimulationParameters = new DynawoSimulationParameters(); parameters = MarginCalculationParameters.builder() .setStartTime(0) .setLoadIncreaseStartTime(10) @@ -62,8 +63,8 @@ void setUp() throws Exception { .setMarginCalculationStartTime(100) .setContingenciesStartTime(110) .setStopTime(200) + .setDynawoParameters(dynawoSimulationParameters) .build(); - dynawoSimulationParameters = new DynawoSimulationParameters(); } @ParameterizedTest diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java index e706365a0..179d5d0e0 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/algorithms/xml/AlgorithmsConstants.java @@ -14,8 +14,6 @@ public final class AlgorithmsConstants { public static final String MULTIPLE_JOBS_FILENAME = "multiple_jobs.xml"; - public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; - private AlgorithmsConstants() { } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java index 7b5124625..fa540d77c 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationContext.java @@ -11,13 +11,13 @@ import com.powsybl.contingency.Contingency; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DynawoSimulationConstants; +import com.powsybl.dynawo.Phase2Config; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.commons.DynawoVersion; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadVariationAreaAutomationSystem; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsProportionalScalable; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.loads.AbstractLoad; import com.powsybl.dynawo.models.macroconnections.MacroConnect; @@ -32,7 +32,6 @@ import java.util.*; import java.util.function.BiConsumer; -import java.util.function.Predicate; import java.util.stream.Collectors; /** @@ -49,26 +48,24 @@ public class MarginCalculationContext extends DynawoSimulationContext { public MarginCalculationContext(Network network, String workingVariantId, List dynamicModels, MarginCalculationParameters parameters, - DynawoSimulationParameters dynawoSimulationParameters, List contingencies, List loadsVariations) { - this(network, workingVariantId, dynamicModels, parameters, dynawoSimulationParameters, contingencies, + this(network, workingVariantId, dynamicModels, parameters, contingencies, loadsVariations, DynawoConstants.VERSION_MIN, ReportNode.NO_OP); } public MarginCalculationContext(Network network, String workingVariantId, List dynamicModels, MarginCalculationParameters parameters, - DynawoSimulationParameters dynawoSimulationParameters, List contingencies, List loadsVariations, DynawoVersion currentVersion, ReportNode reportNode) { - super(network, workingVariantId, dynamicModels, List.of(), Collections.emptyList(), - //TODO fix parameters handling - new DynamicSimulationParameters(parameters.getStartTime(), parameters.getStopTime()), - dynawoSimulationParameters, - configurePhase2Predicate(parameters.getLoadModelsRule(), loadsVariations), currentVersion, reportNode); + super(network, workingVariantId, dynamicModels, Collections.emptyList(), Collections.emptyList(), + new DynamicSimulationParameters(parameters.getStartTime(), parameters.getMarginCalculationStartTime()), + parameters.getDynawoParameters(), + configurePhase2(parameters, loadsVariations), + currentVersion, reportNode); this.marginCalculationParameters = parameters; double contingenciesStartTime = parameters.getContingenciesStartTime(); this.contingencyEventModels = ContingencyEventModelsFactory @@ -117,16 +114,16 @@ public String getParFileName() { }; } - private static Predicate configurePhase2Predicate(MarginCalculationParameters.LoadModelsRule rule, - List loadsVariations) { - return switch (rule) { - case EVERY_MODELS -> AbstractLoad.class::isInstance; - case HYBRID -> { + private static Phase2Config configurePhase2(MarginCalculationParameters parameters, List loadsVariations) { + return switch (parameters.getLoadModelsRule()) { + case ALL_LOADS -> new Phase2Config(parameters.getStopTime(), AbstractLoad.class::isInstance); + case TARGETED_LOADS -> { Set loadIds = loadsVariations.stream() .flatMap(l -> l.loads().stream()) .map(Identifiable::getId) .collect(Collectors.toSet()); - yield bbm -> bbm instanceof AbstractLoad eBbm && loadIds.contains(eBbm.getStaticId()); + yield new Phase2Config(parameters.getStopTime(), + bbm -> bbm instanceof AbstractLoad eBbm && loadIds.contains(eBbm.getStaticId())); } }; } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java index c48a88f45..8d0a9732f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationHandler.java @@ -16,11 +16,14 @@ import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; import com.powsybl.dynawo.margincalculation.results.XmlMarginCalculationResultParser; import com.powsybl.dynawo.margincalculation.xml.MultipleJobsXml; +import com.powsybl.dynawo.xml.DydXml; +import com.powsybl.dynawo.xml.JobsXml; import javax.xml.stream.XMLStreamException; import java.io.IOException; import java.nio.file.Path; +import static com.powsybl.dynawo.DynawoSimulationConstants.PHASE_2_DYD_FILENAME; import static com.powsybl.dynawo.commons.DynawoConstants.AGGREGATED_RESULTS; /** @@ -46,5 +49,9 @@ protected void writeMultipleJobs(Path workingDir) throws XMLStreamException, IOE MultipleJobsXml.write(workingDir, context); ContingenciesDydXml.write(workingDir, context.getContingencyEventModels()); ContingenciesParXml.write(workingDir, context.getContingencyEventModels()); + JobsXml.writePhase2(workingDir, context); + if (context.getPhase2DydData().isPresent()) { + DydXml.write(workingDir, PHASE_2_DYD_FILENAME, context.getPhase2DydData().get()); + } } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java index 891c0b703..317e9e667 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java @@ -9,6 +9,7 @@ import com.powsybl.commons.config.ModuleConfig; import com.powsybl.commons.config.PlatformConfig; +import com.powsybl.dynawo.DynawoSimulationParameters; import java.nio.file.FileSystem; import java.nio.file.FileSystems; @@ -17,7 +18,6 @@ /** * @author Laurent Issertial */ -//TODO reuse core parameters ? public final class MarginCalculationParameters { public static final double DEFAULT_START_TIME = 0; @@ -28,7 +28,7 @@ public final class MarginCalculationParameters { public static final double DEFAULT_CONTINGENCIES_START_TIME = 120; public static final CalculationType DEFAULT_CALCULATION_TYPE = CalculationType.GLOBAL_MARGIN; public static final int DEFAULT_ACCURACY = 2; - public static final LoadModelsRule DEFAULT_LOAD_MODELS_RULE = LoadModelsRule.EVERY_MODELS; + public static final LoadModelsRule DEFAULT_LOAD_MODELS_RULE = LoadModelsRule.ALL_LOADS; public enum CalculationType { GLOBAL_MARGIN, @@ -36,18 +36,17 @@ public enum CalculationType { } /** - * Indicates how to handle loads in the first phase + * Indicates how to handle load dynamic models in the first phase */ - //TODO rename public enum LoadModelsRule { /** * Remove every specific loads dynamic models */ - EVERY_MODELS, + ALL_LOADS, /** * Remove dynamic models on loads affected by the margin calculation */ - HYBRID + TARGETED_LOADS } public static class Builder { @@ -61,6 +60,7 @@ public static class Builder { private CalculationType calculationType = DEFAULT_CALCULATION_TYPE; private int accuracy = DEFAULT_ACCURACY; private LoadModelsRule loadModelsRule = DEFAULT_LOAD_MODELS_RULE; + private DynawoSimulationParameters dynawoParameters = new DynawoSimulationParameters(); /** * Set dynamic simulation start time, must be greater than 0 @@ -125,6 +125,11 @@ public Builder setLoadModelsRule(LoadModelsRule loadModelsRule) { return this; } + public Builder setDynawoParameters(DynawoSimulationParameters dynawoParameters) { + this.dynawoParameters = dynawoParameters; + return this; + } + public MarginCalculationParameters build() { if (startTime < 0) { throw new IllegalStateException("Start time should be zero or positive"); @@ -145,7 +150,7 @@ public MarginCalculationParameters build() { throw new IllegalStateException("Load increase stop time should be between load increase start time and margin calculation start time"); } return new MarginCalculationParameters(startTime, stopTime, marginCalculationStartTime, loadIncreaseStartTime, - loadIncreaseStopTime, contingenciesStartTime, calculationType, accuracy, loadModelsRule); + loadIncreaseStopTime, contingenciesStartTime, calculationType, accuracy, loadModelsRule, dynawoParameters); } } @@ -184,6 +189,7 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi c.getOptionalIntProperty("accuracy").ifPresent(builder::setAccuracy); c.getOptionalEnumProperty("loads-models-rule", LoadModelsRule.class).ifPresent(builder::setLoadModelsRule); }); + builder.setDynawoParameters(DynawoSimulationParameters.load(platformConfig, fileSystem)); return builder.build(); } @@ -196,8 +202,12 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi private final CalculationType calculationType; private final int accuracy; private final LoadModelsRule loadModelsRule; + private final DynawoSimulationParameters dynawoParameters; - private MarginCalculationParameters(double startTime, double stopTime, double marginCalculationStartTime, double loadIncreaseStartTime, double loadIncreaseStopTime, double contingenciesStartTime, CalculationType calculationType, int accuracy, LoadModelsRule loadModelsRule) { + private MarginCalculationParameters(double startTime, double stopTime, double marginCalculationStartTime, + double loadIncreaseStartTime, double loadIncreaseStopTime, + double contingenciesStartTime, CalculationType calculationType, + int accuracy, LoadModelsRule loadModelsRule, DynawoSimulationParameters dynawoParameters) { this.startTime = startTime; this.stopTime = stopTime; this.marginCalculationStartTime = marginCalculationStartTime; @@ -207,6 +217,7 @@ private MarginCalculationParameters(double startTime, double stopTime, double ma this.calculationType = calculationType; this.accuracy = accuracy; this.loadModelsRule = loadModelsRule; + this.dynawoParameters = dynawoParameters; } public double getStartTime() { @@ -244,4 +255,8 @@ public int getAccuracy() { public LoadModelsRule getLoadModelsRule() { return loadModelsRule; } + + public DynawoSimulationParameters getDynawoParameters() { + return dynawoParameters; + } } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java index 9ce1cd374..38154a152 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -13,7 +13,6 @@ import com.powsybl.computation.ExecutionEnvironment; import com.powsybl.contingency.ContingenciesProvider; import com.powsybl.dynamicsimulation.DynamicModelsSupplier; -import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.DynawoSimulationProvider; import com.powsybl.dynawo.commons.DynawoUtil; import com.powsybl.dynawo.commons.DynawoVersion; @@ -35,7 +34,7 @@ /** * @author Laurent Issertial {@literal } */ -//TODO add an interface and API +//TODO add an interface, API and itools command public class MarginCalculationProvider implements Versionable { private static final String WORKING_DIR_PREFIX = "dynawo_mc_"; @@ -67,8 +66,6 @@ public CompletableFuture run(Network network, String wo MarginCalculationContext context = new MarginCalculationContext(network, workingVariantId, BlackBoxSupplierUtils.getBlackBoxModelList(dynamicModelsSupplier, network, mcReportNode), parameters, - //TODO fix - DynawoSimulationParameters.load(), contingenciesProvider.getContingencies(network), loadsVariationSupplier.getLoadsVariations(network, mcReportNode), currentVersion, diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java index 17888952c..d3d9ff0a1 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/xml/MultipleJobsXml.java @@ -20,8 +20,8 @@ import java.util.Objects; import static com.powsybl.dynawo.DynawoSimulationConstants.JOBS_FILENAME; +import static com.powsybl.dynawo.DynawoSimulationConstants.PHASE_2_JOBS_FILENAME; import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.MULTIPLE_JOBS_FILENAME; -import static com.powsybl.dynawo.algorithms.xml.AlgorithmsConstants.PHASE_2_JOBS_FILENAME; import static com.powsybl.dynawo.margincalculation.xml.MarginCalculationConstant.LOAD_VARIATION_AREA_FILENAME; /** diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java index e24208211..687bc9024 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/LoadVariationAreaXmlTest.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.margincalculation.xml; -import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.margincalculation.MarginCalculationContext; import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; @@ -47,13 +46,12 @@ protected void addDynamicModels() { @Override protected void setupDynawoContext() { - MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); - DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + MarginCalculationParameters parameters = MarginCalculationParameters.load(); List loadsVariationList = List.of( new LoadsVariation(List.of(network.getLoad("LOAD")), 20), new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); - context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, - parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, parameters, Collections.emptyList(), loadsVariationList); } @Test diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java index eec56421a..cfe59738b 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/MultiplesJobsXmlTest.java @@ -8,7 +8,6 @@ package com.powsybl.dynawo.margincalculation.xml; import com.powsybl.contingency.Contingency; -import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.margincalculation.MarginCalculationContext; import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; @@ -46,12 +45,11 @@ protected void setupDynawoContext() { .addLine("NHV1_NHV2_1") .addGenerator("GEN2") .build()); - MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); - DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + MarginCalculationParameters parameters = MarginCalculationParameters.load(); List loadsVariationList = List.of( new LoadsVariation(List.of(network.getLoad("LOAD"), network.getLoad("LOAD2")), 10)); - context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, - parameters, dynawoSimulationParameters, contingencies, loadsVariationList); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, parameters, contingencies, loadsVariationList); } @Test diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java index e9fd6eddc..839d03d05 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2GlobalXmlTest.java @@ -7,7 +7,6 @@ */ package com.powsybl.dynawo.margincalculation.xml; -import com.powsybl.dynawo.DynawoSimulationParameters; import com.powsybl.dynawo.margincalculation.MarginCalculationContext; import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; @@ -58,12 +57,11 @@ protected void addDynamicModels() { @Override protected void setupDynawoContext() { - MarginCalculationParameters parameters = MarginCalculationParameters.builder().build(); - DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + MarginCalculationParameters parameters = MarginCalculationParameters.load(); List loadsVariationList = List.of( new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); - context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, - parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, parameters, Collections.emptyList(), loadsVariationList); } @Test diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2TargetedXmlTest.java similarity index 84% rename from dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java rename to dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2TargetedXmlTest.java index c11d0d98f..595b026f2 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2HybridXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/xml/Phase2TargetedXmlTest.java @@ -30,7 +30,7 @@ /** * @author Laurent Issertial */ -class Phase2HybridXmlTest extends AbstractDynamicModelXmlTest { +class Phase2TargetedXmlTest extends AbstractDynamicModelXmlTest { @Override protected void setupNetwork() { @@ -59,12 +59,13 @@ protected void addDynamicModels() { @Override protected void setupDynawoContext() { MarginCalculationParameters parameters = MarginCalculationParameters.builder() - .setLoadModelsRule(MarginCalculationParameters.LoadModelsRule.HYBRID).build(); - DynawoSimulationParameters dynawoSimulationParameters = DynawoSimulationParameters.load(); + .setLoadModelsRule(MarginCalculationParameters.LoadModelsRule.TARGETED_LOADS) + .setDynawoParameters(DynawoSimulationParameters.load()) + .build(); List loadsVariationList = List.of( new LoadsVariation(List.of(network.getLoad("LOAD2"), network.getLoad("LOAD3")), 30)); - context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, - parameters, dynawoSimulationParameters, Collections.emptyList(), loadsVariationList); + context = new MarginCalculationContext(network, network.getVariantManager().getWorkingVariantId(), + dynamicModels, parameters, Collections.emptyList(), loadsVariationList); } @Test @@ -72,7 +73,7 @@ void writeDyd() throws SAXException, IOException { DydXml.write(tmpDir, context); assertThat(context.getPhase2DydData()).isPresent(); DydXml.write(tmpDir, PHASE_2_DYD_FILENAME, context.getPhase2DydData().get()); - validate("dyd.xsd", "phase1_hybrid_dyd.xml", tmpDir.resolve(DYD_FILENAME)); - validate("dyd.xsd", "phase2_hybrid_dyd.xml", tmpDir.resolve(PHASE_2_DYD_FILENAME)); + validate("dyd.xsd", "phase1_targeted_dyd.xml", tmpDir.resolve(DYD_FILENAME)); + validate("dyd.xsd", "phase2_targeted_dyd.xml", tmpDir.resolve(PHASE_2_DYD_FILENAME)); } } diff --git a/dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml b/dynawo-security-analysis/src/test/resources/phase1_targeted_dyd.xml similarity index 100% rename from dynawo-security-analysis/src/test/resources/phase1_hybrid_dyd.xml rename to dynawo-security-analysis/src/test/resources/phase1_targeted_dyd.xml diff --git a/dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml b/dynawo-security-analysis/src/test/resources/phase2_targeted_dyd.xml similarity index 100% rename from dynawo-security-analysis/src/test/resources/phase2_hybrid_dyd.xml rename to dynawo-security-analysis/src/test/resources/phase2_targeted_dyd.xml diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java index bc03faa3e..831b5544f 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationConstants.java @@ -33,9 +33,10 @@ public final class DynawoSimulationConstants { public static final String LOGS_FILENAME = "dynawo.log"; - // TODO use it in dyna algo ? public static final String PHASE_2_DYD_FILENAME = "phase_2_powsybl_dynawo.dyd"; + public static final String PHASE_2_JOBS_FILENAME = "phase_2.jobs"; + private DynawoSimulationConstants() { } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index e7835a50f..ed2e411e0 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -63,6 +63,7 @@ public class DynawoSimulationContext implements DydDataSupplier { private final FrequencySynchronizerModel frequencySynchronizer; private final List dynamicModelsParameters = new ArrayList<>(); protected final MacroConnectionsAdder macroConnectionsAdder; + private final Phase2Config phase2Config; private Phase2Models phase2Models; public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, @@ -78,13 +79,14 @@ public DynawoSimulationContext(Network network, String workingVariantId, List dynamicModels, List eventModels, List outputVariables, DynamicSimulationParameters parameters, DynawoSimulationParameters dynawoSimulationParameters, - Predicate phase2ModelsPredicate, DynawoVersion currentVersion, ReportNode reportNode) { + Phase2Config phase2Config, DynawoVersion currentVersion, ReportNode reportNode) { ReportNode contextReportNode = DynawoSimulationReports.createDynawoSimulationContextReportNode(reportNode); DynawoVersion dynawoVersion = Objects.requireNonNull(currentVersion); this.network = Objects.requireNonNull(network); this.workingVariantId = Objects.requireNonNull(workingVariantId); this.parameters = Objects.requireNonNull(parameters); this.dynawoSimulationParameters = Objects.requireNonNull(dynawoSimulationParameters); + this.phase2Config = phase2Config; Stream uniqueIdsDynamicModels = Objects.requireNonNull(dynamicModels).stream() .filter(distinctByDynamicId(contextReportNode) @@ -95,8 +97,8 @@ public DynawoSimulationContext(Network network, String workingVariantId, List phase2DynamicModels = List.of(); - if (phase2ModelsPredicate != null) { - Map> splitModels = uniqueIdsDynamicModels.collect(Collectors.partitioningBy(phase2ModelsPredicate)); + if (phase2Config != null) { + Map> splitModels = uniqueIdsDynamicModels.collect(Collectors.partitioningBy(phase2Config.phase2ModelsPredicate())); this.dynamicModels = splitModels.get(false); phase2DynamicModels = splitModels.get(true); } else { @@ -192,8 +194,12 @@ public String getWorkingVariantId() { return workingVariantId; } - public DynamicSimulationParameters getParameters() { - return parameters; + public double getStartTime(boolean isPhase2) { + return isPhase2 ? parameters.getStopTime() : parameters.getStartTime(); + } + + public double getStopTime(boolean isPhase2) { + return isPhase2 ? phase2Config.phase2stopTime() : parameters.getStopTime(); } public DynawoSimulationParameters getDynawoSimulationParameters() { diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Config.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Config.java new file mode 100644 index 000000000..e28e3c512 --- /dev/null +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/Phase2Config.java @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2025, 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.dynawo; + +import com.powsybl.dynawo.models.BlackBoxModel; + +import java.util.function.Predicate; + +/** + * Configures the dynamic simulation phase 2 + * @param phase2stopTime Simulation phase 2 stop time, start time will be equal to phase 1 stop time + * @param phase2ModelsPredicate Discriminate models used only during phase 2 + * @author Laurent Issertial {@literal } + */ +public record Phase2Config(double phase2stopTime, Predicate phase2ModelsPredicate) { +} diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java index 4bf4964c2..992142e08 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/JobsXml.java @@ -6,7 +6,6 @@ */ package com.powsybl.dynawo.xml; -import com.powsybl.dynamicsimulation.DynamicSimulationParameters; import com.powsybl.dynawo.DumpFileParameters; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; @@ -33,21 +32,17 @@ public final class JobsXml extends AbstractXmlDynawoSimulationWriter criteriaFileName = parameters.getCriteriaFileName(); if (criteriaFileName.isPresent()) { writer.writeStartElement(DYN_URI, "simulation"); } else { writer.writeEmptyElement(DYN_URI, "simulation"); } - writer.writeAttribute("startTime", Double.toString(dynamicSimulationParameters.getStartTime())); - writer.writeAttribute("stopTime", Double.toString(dynamicSimulationParameters.getStopTime())); + writer.writeAttribute("startTime", Double.toString(startTime)); + writer.writeAttribute("stopTime", Double.toString(stopTime)); writer.writeAttribute("precision", Double.toString(parameters.getPrecision())); if (criteriaFileName.isPresent()) { writer.writeEmptyElement(DYN_URI, "criteria"); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java index 910bf2ec6..e91007a93 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/AbstractParametrizedDynamicModelXmlTest.java @@ -14,6 +14,7 @@ import com.powsybl.dynamicsimulation.OutputVariable; import com.powsybl.dynawo.DynawoSimulationContext; import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.Phase2Config; import com.powsybl.dynawo.commons.DynawoConstants; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.iidm.network.Network; @@ -33,7 +34,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import java.util.function.Predicate; import static com.powsybl.commons.test.ComparisonUtils.assertTxtEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -66,10 +66,11 @@ void setupDynawoContext() { setupDynawoContext(null); } - protected void setupDynawoContext(Predicate phase2ModelsPredicate) { + protected void setupDynawoContext(Phase2Config phase2Config) { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); - context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, outputVariables, parameters, dynawoParameters, phase2ModelsPredicate, DynawoConstants.VERSION_MIN, reportNode); + context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, + eventModels, outputVariables, parameters, dynawoParameters, phase2Config, DynawoConstants.VERSION_MIN, reportNode); } protected void checkReport(String report) throws IOException { diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java index 6d0cb7fe5..fb284fb2c 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/ContextPhase2XmlTest.java @@ -7,6 +7,7 @@ */ package com.powsybl.dynawo.xml; +import com.powsybl.dynawo.Phase2Config; import com.powsybl.dynawo.models.BlackBoxModel; import com.powsybl.dynawo.models.loads.BaseLoadBuilder; import com.powsybl.dynawo.models.shunts.BaseShuntBuilder; @@ -36,7 +37,7 @@ class ContextPhase2XmlTest extends AbstractParametrizedDynamicModelXmlTest { void setup(String dydName, String phase2DydName, Predicate phase2ModelsPredicate) { setupNetwork(); addDynamicModels(); - setupDynawoContext(phase2ModelsPredicate); + setupDynawoContext(new Phase2Config(200, phase2ModelsPredicate)); } protected void setupNetwork() { diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index e974fd85f..082e32df4 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -8,10 +8,7 @@ import com.powsybl.commons.report.ReportNode; import com.powsybl.dynamicsimulation.DynamicSimulationParameters; -import com.powsybl.dynawo.DumpFileParameters; -import com.powsybl.dynawo.DynawoSimulationConstants; -import com.powsybl.dynawo.DynawoSimulationContext; -import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.*; import com.powsybl.dynawo.commons.DynawoConstants; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -54,10 +51,9 @@ private static Stream provideParameters() { void writeJobWithPhase2() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); - //TODO wrap start/stop time in context (use phase2 Config with predicate + stop time 2) DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), dynamicModels, eventModels, outputVariables, parameters, dynawoParameters, - bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD2"), + new Phase2Config(200, bbm -> bbm.getDynamicModelId().equalsIgnoreCase("BBM_LOAD2")), DynawoConstants.VERSION_MIN, ReportNode.NO_OP); JobsXml.writePhase2(tmpDir, context); diff --git a/dynawo-simulation/src/test/resources/jobsWithPhase2.xml b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml index 2e064c2af..617ad6a39 100644 --- a/dynawo-simulation/src/test/resources/jobsWithPhase2.xml +++ b/dynawo-simulation/src/test/resources/jobsWithPhase2.xml @@ -9,7 +9,7 @@
- + From e1f78d53e29b226bc8196fbc03438f5d93d93d5d Mon Sep 17 00:00:00 2001 From: lisrte Date: Wed, 15 Jan 2025 17:31:36 +0100 Subject: [PATCH 27/28] Fix tests Factorize Aggregated result parser Signed-off-by: lisrte --- .../AbstractXmlAggregatedResultParser.java | 53 ++++++ .../powsybl/dynaflow/results/ResultsUtil.java | 1 - .../results/XmlScenarioResultParser.java | 33 +--- .../dynawo/it/DynawoSecurityAnalysisTest.java | 3 +- .../dynawo/it/MarginCalculationTest.java | 18 ++- .../margincalculation/MarginCalculation.java | 152 ++++++++++++++++++ .../results/LoadIncreaseResult.java | 4 + .../XmlMarginCalculationResultParser.java | 33 +--- .../algorithms/ContingenciesXmlTest.java | 2 - .../dynawo/DynawoSimulationContext.java | 1 - .../java/com/powsybl/dynawo/xml/DydXml.java | 1 - .../com/powsybl/dynawo/xml/JobsXmlTest.java | 4 +- 12 files changed, 230 insertions(+), 75 deletions(-) create mode 100644 dynaflow/src/main/java/com/powsybl/dynaflow/results/AbstractXmlAggregatedResultParser.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/AbstractXmlAggregatedResultParser.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/AbstractXmlAggregatedResultParser.java new file mode 100644 index 000000000..579e850d8 --- /dev/null +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/AbstractXmlAggregatedResultParser.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2025, 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.dynaflow.results; + +import com.powsybl.commons.exceptions.UncheckedXmlStreamException; +import com.powsybl.commons.xml.XmlUtil; +import com.powsybl.dynawo.commons.AbstractXmlParser; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + +/** + * @author Laurent Issertial {@literal } + */ +public abstract class AbstractXmlAggregatedResultParser extends AbstractXmlParser { + + protected static final String STATUS = "status"; + private static final String ID = "id"; + private static final String TIME = "time"; + + protected static boolean readScenarioResult(String elementName, XMLStreamReader xmlReader, Consumer scenarioConsumer) { + if (elementName.equals("scenarioResults")) { + String id = xmlReader.getAttributeValue(null, ID); + String status = xmlReader.getAttributeValue(null, STATUS); + List failedCriteria = new ArrayList<>(); + XmlUtil.readSubElements(xmlReader, subElementName -> readFailedCriterion(subElementName, xmlReader, failedCriteria::add)); + ResultsUtil.createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); + return true; + } + return false; + } + + protected static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { + try { + if (elementName.equals("criterionNonRespected")) { + String description = xmlReader.getAttributeValue(null, ID); + String time = xmlReader.getAttributeValue(null, TIME); + XmlUtil.readEndElementOrThrow(xmlReader); + ResultsUtil.createFailedCriterion(description, time).ifPresent(resultConsumer); + } + } catch (XMLStreamException e) { + throw new UncheckedXmlStreamException(e); + } + } +} diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java index ebdb03599..840d2994d 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/ResultsUtil.java @@ -20,7 +20,6 @@ /** * @author Laurent Issertial {@literal } */ -//TODO move results and factorize with load margin results public final class ResultsUtil { private ResultsUtil() { diff --git a/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java b/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java index 5d21cddd0..ce75706cd 100644 --- a/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java +++ b/dynaflow/src/main/java/com/powsybl/dynaflow/results/XmlScenarioResultParser.java @@ -7,25 +7,17 @@ */ package com.powsybl.dynaflow.results; -import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.xml.XmlUtil; -import com.powsybl.dynawo.commons.AbstractXmlParser; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import java.util.ArrayList; -import java.util.List; import java.util.function.Consumer; /** * @author Laurent Issertial {@literal } */ -public final class XmlScenarioResultParser extends AbstractXmlParser { - - private static final String STATUS = "status"; - private static final String ID = "id"; - private static final String TIME = "time"; +public final class XmlScenarioResultParser extends AbstractXmlAggregatedResultParser { @Override protected void read(XMLStreamReader xmlReader, Consumer consumer) throws XMLStreamException { @@ -35,27 +27,4 @@ protected void read(XMLStreamReader xmlReader, Consumer consumer } XmlUtil.readSubElements(xmlReader, elementName -> readScenarioResult(elementName, xmlReader, consumer)); } - - public static void readScenarioResult(String elementName, XMLStreamReader xmlReader, Consumer scenarioConsumer) { - if (elementName.equals("scenarioResults")) { - String id = xmlReader.getAttributeValue(null, ID); - String status = xmlReader.getAttributeValue(null, STATUS); - List failedCriteria = new ArrayList<>(); - XmlUtil.readSubElements(xmlReader, subElementName -> readFailedCriterion(subElementName, xmlReader, failedCriteria::add)); - ResultsUtil.createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); - } - } - - public static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { - try { - if (elementName.equals("criterionNonRespected")) { - String description = xmlReader.getAttributeValue(null, ID); - String time = xmlReader.getAttributeValue(null, TIME); - XmlUtil.readEndElementOrThrow(xmlReader); - ResultsUtil.createFailedCriterion(description, time).ifPresent(resultConsumer); - } - } catch (XMLStreamException e) { - throw new UncheckedXmlStreamException(e); - } - } } diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java index c1c08077a..0c0e3236d 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/DynawoSecurityAnalysisTest.java @@ -71,8 +71,7 @@ void testIeee14DSA(String criteriaPath, List contingencies, String Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm"))); GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( - //TODO use the MC groovyscript - getResourceAsStream("/ieee14/dynamic-security-analysis/dynamicModels.groovy"), + getResourceAsStream("/ieee14/dynamicModels.groovy"), GroovyExtension.find(DynamicModelGroovyExtension.class, DynawoSimulationProvider.NAME)); List modelsParameters = ParametersXml.load(getResourceAsStream("/ieee14/models.par")); diff --git a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java index dc837304b..6ba30c9c9 100644 --- a/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java +++ b/dynawo-integration-tests/src/test/java/com/powsybl/dynawo/it/MarginCalculationTest.java @@ -10,6 +10,8 @@ import com.powsybl.commons.datasource.ResourceSet; import com.powsybl.commons.report.ReportNode; import com.powsybl.contingency.Contingency; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynaflow.results.Status; import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension; import com.powsybl.dynamicsimulation.groovy.GroovyDynamicModelsSupplier; import com.powsybl.dynamicsimulation.groovy.GroovyExtension; @@ -31,7 +33,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import java.io.IOException; import java.nio.file.Path; import java.util.List; import java.util.Objects; @@ -69,7 +70,7 @@ void setUp() throws Exception { @ParameterizedTest @MethodSource("provideSimulationParameter") - void testIeee14MC(String criteriaPath, List contingencies) throws IOException { + void testIeee14MC(String criteriaPath, List contingencies) { Network network = Network.read(new ResourceDataSource("IEEE14", new ResourceSet("/ieee14", "IEEE14.iidm"))); GroovyDynamicModelsSupplier dynamicModelsSupplier = new GroovyDynamicModelsSupplier( @@ -106,8 +107,17 @@ void testIeee14MC(String criteriaPath, List contingencies) throws I .join() .getResults(); - //TODO assert results - assertThat(results).isNotEmpty(); + List expectedResults = contingencies.stream() + .map(c -> new ScenarioResult(c.getId(), Status.CONVERGENCE)) + .toList(); + assertThat(results).containsExactly( + new LoadIncreaseResult(0, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(50, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(75, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(88, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(94, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(97, Status.CONVERGENCE, expectedResults), + new LoadIncreaseResult(99, Status.CONVERGENCE, expectedResults)); } private static Stream provideSimulationParameter() { diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java new file mode 100644 index 000000000..c71b27522 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation; + +import com.powsybl.commons.Versionable; +import com.powsybl.contingency.ContingenciesProvider; +import com.powsybl.dynamicsimulation.DynamicModelsSupplier; +import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; +import com.powsybl.iidm.network.Network; + +import java.util.concurrent.CompletableFuture; + +/** + * Margin calculation main API. It is a utility class (so with only static methods) used as an entry point for running + * a margin calculation (Dynawo being the only implementation). + * + * @author Laurent Issertial {@literal } + */ +public final class MarginCalculation { + + private MarginCalculation() { + throw new IllegalStateException("Utility class should not been instantiated"); + } + + /** + * A margin calculation runner is responsible for providing convenient methods on top of {@link MarginCalculationProvider}: + * several variants of synchronous and asynchronous run with default parameters. + */ + public static final class Runner implements Versionable { + + private final MarginCalculationProvider provider; + + public Runner() { + provider = new MarginCalculationProvider(); + } + + public CompletableFuture runAsync(Network network, String workingVariantId, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return provider.run(network, workingVariantId, dynamicModelsSupplier, contingenciesProvider, + loadsVariationSupplier, runParameters); + } + + public CompletableFuture runAsync(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return provider.run(network, network.getVariantManager().getWorkingVariantId(), dynamicModelsSupplier, contingenciesProvider, + loadsVariationSupplier, runParameters); + } + + public CompletableFuture runAsync(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier) { + return provider.run(network, network.getVariantManager().getWorkingVariantId(), dynamicModelsSupplier, contingenciesProvider, + loadsVariationSupplier, MarginCalculationRunParameters.getDefault()); + } + + public MarginCalculationResult run(Network network, String workingVariantId, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return runAsync(network, workingVariantId, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier, + runParameters).join(); + } + + public MarginCalculationResult run(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return runAsync(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier, + runParameters).join(); + } + + public MarginCalculationResult run(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier) { + return runAsync(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier).join(); + } + + @Override + public String getName() { + return provider.getName(); + } + + @Override + public String getVersion() { + return provider.getVersion(); + } + } + + public static CompletableFuture runAsync(Network network, String workingVariantId, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return new Runner().runAsync(network, workingVariantId, dynamicModelsSupplier, contingenciesProvider, + loadsVariationSupplier, runParameters); + } + + public static CompletableFuture runAsync(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return new Runner().runAsync(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier, runParameters); + } + + public static CompletableFuture runAsync(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier) { + return new Runner().runAsync(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier); + } + + public static MarginCalculationResult run(Network network, String workingVariantId, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return new Runner().run(network, workingVariantId, dynamicModelsSupplier, contingenciesProvider, + loadsVariationSupplier, runParameters); + } + + public static MarginCalculationResult run(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier, + MarginCalculationRunParameters runParameters) { + return new Runner().run(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier, runParameters); + } + + public static MarginCalculationResult run(Network network, + DynamicModelsSupplier dynamicModelsSupplier, + ContingenciesProvider contingenciesProvider, + LoadsVariationSupplier loadsVariationSupplier) { + return new Runner().run(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java index 066fffa8d..8e7976d58 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/LoadIncreaseResult.java @@ -20,6 +20,10 @@ public record LoadIncreaseResult(double loadLevel, Status status, List scenarioResults, List failedCriteria) { + public LoadIncreaseResult(double loadLevel, Status status, List scenarioResults) { + this(loadLevel, status, scenarioResults, Collections.emptyList()); + } + public LoadIncreaseResult(double loadLevel, Status status) { this(loadLevel, status, Collections.emptyList(), Collections.emptyList()); } diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java index d2e83b8bb..bb0d87214 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/XmlMarginCalculationResultParser.java @@ -7,11 +7,10 @@ */ package com.powsybl.dynawo.margincalculation.results; -import com.powsybl.commons.exceptions.UncheckedXmlStreamException; import com.powsybl.commons.xml.XmlUtil; +import com.powsybl.dynaflow.results.AbstractXmlAggregatedResultParser; import com.powsybl.dynaflow.results.FailedCriterion; import com.powsybl.dynaflow.results.ScenarioResult; -import com.powsybl.dynawo.commons.AbstractXmlParser; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; @@ -20,18 +19,12 @@ import java.util.List; import java.util.function.Consumer; -import static com.powsybl.dynaflow.results.ResultsUtil.createFailedCriterion; -import static com.powsybl.dynaflow.results.ResultsUtil.createScenarioResult; - /** * @author Laurent Issertial {@literal } */ -public final class XmlMarginCalculationResultParser extends AbstractXmlParser { +public final class XmlMarginCalculationResultParser extends AbstractXmlAggregatedResultParser { private static final String LOAD_LEVEL = "loadLevel"; - private static final String STATUS = "status"; - private static final String ID = "id"; - private static final String TIME = "time"; @Override protected void read(XMLStreamReader xmlReader, Consumer consumer) throws XMLStreamException { @@ -54,28 +47,8 @@ private static void readLoadIncreaseResult(String elementName, XMLStreamReader x } private static void readLoadIncreaseResultSubElements(String elementName, XMLStreamReader xmlReader, Consumer scenarioConsumer, Consumer criterionConsumer) { - if (elementName.equals("scenarioResults")) { - String id = xmlReader.getAttributeValue(null, ID); - String status = xmlReader.getAttributeValue(null, STATUS); - List failedCriteria = new ArrayList<>(); - XmlUtil.readSubElements(xmlReader, subElementName -> readFailedCriterion(subElementName, xmlReader, failedCriteria::add)); - createScenarioResult(id, status, failedCriteria).ifPresent(scenarioConsumer); - } else { + if (!readScenarioResult(elementName, xmlReader, scenarioConsumer)) { readFailedCriterion(elementName, xmlReader, criterionConsumer); } } - - //TODO factorize - private static void readFailedCriterion(String elementName, XMLStreamReader xmlReader, Consumer resultConsumer) { - try { - if (elementName.equals("criterionNonRespected")) { - String message = xmlReader.getAttributeValue(null, ID); - String time = xmlReader.getAttributeValue(null, TIME); - XmlUtil.readEndElementOrThrow(xmlReader); - createFailedCriterion(message, time).ifPresent(resultConsumer); - } - } catch (XMLStreamException e) { - throw new UncheckedXmlStreamException(e); - } - } } diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java index 220cd4c33..fafecfdc3 100644 --- a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/algorithms/ContingenciesXmlTest.java @@ -25,7 +25,6 @@ /** * @author Laurent Issertial */ -//TODO replace SecurityAnalysisContext class ContingenciesXmlTest extends DynawoTestUtil { @Test @@ -49,5 +48,4 @@ void writeDyds() throws SAXException, IOException, XMLStreamException { validate("parameters.xsd", "LOAD_par.xml", tmpDir.resolve("LOAD.par")); validate("parameters.xsd", "DisconnectLineGenerator_par.xml", tmpDir.resolve("DisconnectLineGenerator.par")); } - } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java index ed2e411e0..f2b45ced3 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationContext.java @@ -348,7 +348,6 @@ public List getDynamicModelsParameters() { return dynamicModelsParameters; } - //TODO remove ? public String getSimulationParFile() { return getNetwork().getId() + ".par"; } diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java index 70c12f8a7..b3dd53bdc 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/xml/DydXml.java @@ -43,7 +43,6 @@ public static void write(Path workingDir, String fileName, DydDataSupplier dataS public void write(XMLStreamWriter writer, DydDataSupplier dataSupplier) throws XMLStreamException { // loop over the values of the map indexed by dynamicIds to write only once objects with the same dynamicId String parFileName = dataSupplier.getParFileName(); - //TODO merge all models in one parameter file ? if (parFileName == null || parFileName.isEmpty()) { for (BlackBoxModel model : dataSupplier.getBlackBoxDynamicModels()) { model.write(writer); diff --git a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java index 082e32df4..656f1ac29 100644 --- a/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java +++ b/dynawo-simulation/src/test/java/com/powsybl/dynawo/xml/JobsXmlTest.java @@ -48,7 +48,7 @@ private static Stream provideParameters() { } @Test - void writeJobWithPhase2() throws SAXException, IOException { + void writePhase2Job() throws SAXException, IOException { DynamicSimulationParameters parameters = DynamicSimulationParameters.load(); DynawoSimulationParameters dynawoParameters = DynawoSimulationParameters.load(); DynawoSimulationContext context = new DynawoSimulationContext(network, network.getVariantManager().getWorkingVariantId(), @@ -57,6 +57,6 @@ void writeJobWithPhase2() throws SAXException, IOException { DynawoConstants.VERSION_MIN, ReportNode.NO_OP); JobsXml.writePhase2(tmpDir, context); - validate("jobs.xsd", "jobsWithPhase2.xml", tmpDir.resolve(DynawoSimulationConstants.JOBS_FILENAME)); + validate("jobs.xsd", "jobsWithPhase2.xml", tmpDir.resolve(DynawoSimulationConstants.PHASE_2_JOBS_FILENAME)); } } From 0adfdedfc29013968f76bad0cc250863fc4e6202 Mon Sep 17 00:00:00 2001 From: lisrte Date: Thu, 16 Jan 2025 17:43:27 +0100 Subject: [PATCH 28/28] Add itools support and MC API Add MC results and parameters JSON serialization Signed-off-by: lisrte --- dynawo-security-analysis/pom.xml | 4 + .../margincalculation/MarginCalculation.java | 4 + .../MarginCalculationParameters.java | 3 +- .../MarginCalculationProvider.java | 1 - .../json/JsonMarginCalculationParameters.java | 85 ++++++ ...rginCalculationParametersDeserializer.java | 59 ++++ ...MarginCalculationParametersJsonModule.java | 22 ++ ...MarginCalculationParametersSerializer.java | 43 +++ .../MarginCalculationResultDeserializer.java | 144 +++++++++ .../MarginCalculationResultSerializer.java | 106 +++++++ .../LoadsVariationJsonDeserializer.java | 2 + .../supplier/LoadsVariationSupplierUtils.java | 25 ++ .../results/MarginCalculationResult.java | 1 + .../JsonMarginCalculationParametersTest.java | 68 +++++ .../json/MarginCalculationResultJsonTest.java | 59 ++++ .../tool/MarginCalculationTool.java | 273 ++++++++++++++++++ .../MarginCalculationParameters.json | 64 ++++ .../MarginCalculationParametersError.json | 6 + .../resources/MarginCalculationResult.json | 33 +++ .../MarginCalculationResultError.json | 4 + .../test/resources/parametersSet/models.par | 7 + .../test/resources/parametersSet/network.par | 9 + .../test/resources/parametersSet/solvers.par | 11 + .../dynawo/DynawoSimulationParameters.java | 6 +- 24 files changed, 1036 insertions(+), 3 deletions(-) create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParameters.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersDeserializer.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersJsonModule.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersSerializer.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultDeserializer.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultSerializer.java create mode 100644 dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplierUtils.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParametersTest.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultJsonTest.java create mode 100644 dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/tool/MarginCalculationTool.java create mode 100644 dynawo-security-analysis/src/test/resources/MarginCalculationParameters.json create mode 100644 dynawo-security-analysis/src/test/resources/MarginCalculationParametersError.json create mode 100644 dynawo-security-analysis/src/test/resources/MarginCalculationResult.json create mode 100644 dynawo-security-analysis/src/test/resources/MarginCalculationResultError.json create mode 100644 dynawo-security-analysis/src/test/resources/parametersSet/models.par create mode 100644 dynawo-security-analysis/src/test/resources/parametersSet/network.par create mode 100644 dynawo-security-analysis/src/test/resources/parametersSet/solvers.par diff --git a/dynawo-security-analysis/pom.xml b/dynawo-security-analysis/pom.xml index 683813844..21f77addf 100644 --- a/dynawo-security-analysis/pom.xml +++ b/dynawo-security-analysis/pom.xml @@ -35,6 +35,10 @@ ${project.groupId} powsybl-dynaflow + + com.powsybl + powsybl-contingency-dsl + diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java index c71b27522..2bb98d977 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculation.java @@ -102,6 +102,10 @@ public String getVersion() { } } + public static Runner getRunner() { + return new Runner(); + } + public static CompletableFuture runAsync(Network network, String workingVariantId, DynamicModelsSupplier dynamicModelsSupplier, ContingenciesProvider contingenciesProvider, diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java index 317e9e667..eb72c1981 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationParameters.java @@ -131,6 +131,7 @@ public Builder setDynawoParameters(DynawoSimulationParameters dynawoParameters) } public MarginCalculationParameters build() { + //TODO add values to exception if (startTime < 0) { throw new IllegalStateException("Start time should be zero or positive"); } @@ -187,7 +188,7 @@ public static MarginCalculationParameters load(PlatformConfig platformConfig, Fi c.getOptionalDoubleProperty("contingencies-start-time").ifPresent(builder::setContingenciesStartTime); c.getOptionalEnumProperty("calculation-type", CalculationType.class).ifPresent(builder::setCalculationType); c.getOptionalIntProperty("accuracy").ifPresent(builder::setAccuracy); - c.getOptionalEnumProperty("loads-models-rule", LoadModelsRule.class).ifPresent(builder::setLoadModelsRule); + c.getOptionalEnumProperty("load-models-rule", LoadModelsRule.class).ifPresent(builder::setLoadModelsRule); }); builder.setDynawoParameters(DynawoSimulationParameters.load(platformConfig, fileSystem)); return builder.build(); diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java index 38154a152..af6260b2f 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/MarginCalculationProvider.java @@ -34,7 +34,6 @@ /** * @author Laurent Issertial {@literal } */ -//TODO add an interface, API and itools command public class MarginCalculationProvider implements Versionable { private static final String WORKING_DIR_PREFIX = "dynawo_mc_"; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParameters.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParameters.java new file mode 100644 index 000000000..ccccf4e1a --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParameters.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.powsybl.commons.json.JsonUtil; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; + +/** + * Provides methods to read and write MarginCalculationParameters from and to JSON. + * + * @author Laurent Issertial {@literal } + */ +public class JsonMarginCalculationParameters { + + /** + * Reads parameters from a JSON file (will NOT rely on platform config). + */ + public static MarginCalculationParameters read(Path jsonFile) { + Objects.requireNonNull(jsonFile); + + try (InputStream is = Files.newInputStream(jsonFile)) { + return read(is); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + /** + * Reads parameters from a JSON file (will NOT rely on platform config). + */ + public static MarginCalculationParameters read(InputStream jsonStream) { + try { + ObjectMapper objectMapper = createObjectMapper(); + return objectMapper.readerFor(MarginCalculationParameters.class).readValue(jsonStream); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + /** + * Writes parameters as JSON to a file. + */ + public static void write(MarginCalculationParameters parameters, Path jsonFile) { + Objects.requireNonNull(jsonFile); + + try (OutputStream outputStream = Files.newOutputStream(jsonFile)) { + write(parameters, outputStream); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + /** + * Writes parameters as JSON to an output stream. + */ + public static void write(MarginCalculationParameters parameters, OutputStream outputStream) { + try { + ObjectMapper objectMapper = createObjectMapper(); + ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); + writer.writeValue(outputStream, parameters); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + private static ObjectMapper createObjectMapper() { + return JsonUtil.createObjectMapper() + .registerModule(new MarginCalculationParametersJsonModule()); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersDeserializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersDeserializer.java new file mode 100644 index 000000000..d90b49a72 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersDeserializer.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.powsybl.dynawo.json.DynawoSimulationParametersSerializer; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; + +import java.io.IOException; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationParametersDeserializer extends StdDeserializer { + + MarginCalculationParametersDeserializer() { + super(MarginCalculationParameters.class); + } + + @Override + public MarginCalculationParameters deserialize(JsonParser parser, DeserializationContext context) throws IOException { + + MarginCalculationParameters.Builder builder = MarginCalculationParameters.builder(); + while (parser.nextToken() != JsonToken.END_OBJECT) { + switch (parser.currentName()) { + case "version" -> parser.nextToken(); + case "startTime" -> builder.setStartTime(parser.getValueAsDouble()); + case "stopTime" -> builder.setStopTime(parser.getValueAsDouble()); + case "marginCalculationStartTime" -> builder.setMarginCalculationStartTime(parser.getValueAsDouble()); + case "loadIncreaseStartTime" -> builder.setLoadIncreaseStartTime(parser.getValueAsDouble()); + case "loadIncreaseStopTime" -> builder.setLoadIncreaseStopTime(parser.getValueAsDouble()); + case "contingenciesStartTime" -> builder.setContingenciesStartTime(parser.getValueAsDouble()); + case "calculationType" -> { + parser.nextToken(); + builder.setCalculationType(parser.readValueAs(MarginCalculationParameters.CalculationType.class)); + } + case "accuracy" -> builder.setAccuracy(parser.getValueAsInt()); + case "loadModelsRule" -> { + parser.nextToken(); + builder.setLoadModelsRule(parser.readValueAs(MarginCalculationParameters.LoadModelsRule.class)); + } + case "dynawoParameters" -> { + parser.nextToken(); + builder.setDynawoParameters(new DynawoSimulationParametersSerializer().deserialize(parser, context)); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.currentName()); + } + } + return builder.build(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersJsonModule.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersJsonModule.java new file mode 100644 index 000000000..48ec02af8 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersJsonModule.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationParametersJsonModule extends SimpleModule { + + public MarginCalculationParametersJsonModule() { + addDeserializer(MarginCalculationParameters.class, new MarginCalculationParametersDeserializer()); + addSerializer(MarginCalculationParameters.class, new MarginCalculationParametersSerializer()); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersSerializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersSerializer.java new file mode 100644 index 000000000..b36fca14b --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationParametersSerializer.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.powsybl.dynawo.json.DynawoSimulationParametersSerializer; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; + +import java.io.IOException; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationParametersSerializer extends StdSerializer { + + MarginCalculationParametersSerializer() { + super(MarginCalculationParameters.class); + } + + @Override + public void serialize(MarginCalculationParameters parameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeStartObject(); + jsonGenerator.writeNumberField("startTime", parameters.getStartTime()); + jsonGenerator.writeNumberField("stopTime", parameters.getStopTime()); + jsonGenerator.writeNumberField("marginCalculationStartTime", parameters.getMarginCalculationStartTime()); + jsonGenerator.writeNumberField("loadIncreaseStartTime", parameters.getLoadIncreaseStartTime()); + jsonGenerator.writeNumberField("loadIncreaseStopTime", parameters.getLoadIncreaseStopTime()); + jsonGenerator.writeNumberField("contingenciesStartTime", parameters.getContingenciesStartTime()); + jsonGenerator.writeStringField("calculationType", parameters.getCalculationType().toString()); + jsonGenerator.writeNumberField("accuracy", parameters.getAccuracy()); + jsonGenerator.writeStringField("loadModelsRule", parameters.getLoadModelsRule().toString()); + jsonGenerator.writeFieldName("dynawoParameters"); + new DynawoSimulationParametersSerializer().serialize(parameters.getDynawoParameters(), jsonGenerator, serializerProvider); + jsonGenerator.writeEndObject(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultDeserializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultDeserializer.java new file mode 100644 index 000000000..a7c8dcd26 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultDeserializer.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.powsybl.commons.json.JsonUtil; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynaflow.results.Status; +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; + +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationResultDeserializer extends StdDeserializer { + + MarginCalculationResultDeserializer() { + super(MarginCalculationResult.class); + } + + public static MarginCalculationResult read(InputStream is) throws IOException { + Objects.requireNonNull(is); + ObjectMapper objectMapper = JsonUtil.createObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addDeserializer(MarginCalculationResult.class, new MarginCalculationResultDeserializer()); + objectMapper.registerModule(module); + return objectMapper.readValue(is, MarginCalculationResult.class); + } + + public static MarginCalculationResult read(Path jsonFile) { + Objects.requireNonNull(jsonFile); + try (InputStream is = Files.newInputStream(jsonFile)) { + return read(is); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public MarginCalculationResult deserialize(JsonParser parser, DeserializationContext ctx) throws IOException { + List loadIncreaseResults = new ArrayList<>(); + while (parser.nextToken() != JsonToken.END_OBJECT) { + switch (parser.currentName()) { + case "version" -> parser.nextToken(); // skip + case "loadIncreases" -> { + parser.nextToken(); + deserializeLoadIncreaseResults(parser, loadIncreaseResults); + } + default -> throw getUnexpectedFieldException(parser); + } + } + return new MarginCalculationResult(loadIncreaseResults); + } + + private void deserializeLoadIncreaseResults(JsonParser parser, List loadIncreaseResults) throws IOException { + while (parser.nextToken() != JsonToken.END_ARRAY) { + double loadLevel = 0; + Status status = null; + List failedCriteria = new ArrayList<>(); + List scenarioResults = new ArrayList<>(); + while (parser.nextToken() != JsonToken.END_OBJECT) { + switch (parser.currentName()) { + case "loadLevel" -> loadLevel = parser.getValueAsDouble(); + case "status" -> { + parser.nextToken(); + status = parser.readValueAs(Status.class); + } + case "failedCriteria" -> { + parser.nextToken(); + deserializeFailedCriteria(parser, failedCriteria); + } + case "scenarioResults" -> { + parser.nextToken(); + deserializeScenarioResults(parser, scenarioResults); + } + default -> throw getUnexpectedFieldException(parser); + } + } + loadIncreaseResults.add(new LoadIncreaseResult(loadLevel, status, scenarioResults, failedCriteria)); + } + } + + private void deserializeFailedCriteria(JsonParser parser, List failedCriteria) throws IOException { + while (parser.nextToken() != JsonToken.END_ARRAY) { + String description = null; + double time = 0; + while (parser.nextToken() != JsonToken.END_OBJECT) { + switch (parser.currentName()) { + case "description" -> description = parser.getValueAsString(); + case "time" -> time = parser.getValueAsDouble(); + default -> throw getUnexpectedFieldException(parser); + } + } + failedCriteria.add(new FailedCriterion(description, time)); + } + } + + private void deserializeScenarioResults(JsonParser parser, List scenarioResults) throws IOException { + while (parser.nextToken() != JsonToken.END_ARRAY) { + String id = null; + Status status = null; + List failedCriteria = new ArrayList<>(); + while (parser.nextToken() != JsonToken.END_OBJECT) { + switch (parser.currentName()) { + case "id" -> id = parser.getValueAsString(); + case "status" -> { + parser.nextToken(); + status = parser.readValueAs(Status.class); + } + case "failedCriteria" -> { + parser.nextToken(); + deserializeFailedCriteria(parser, failedCriteria); + } + default -> throw getUnexpectedFieldException(parser); + } + } + scenarioResults.add(new ScenarioResult(id, status, failedCriteria)); + } + } + + private static IllegalStateException getUnexpectedFieldException(JsonParser parser) throws IOException { + return new IllegalStateException("Unexpected field: " + parser.currentName()); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultSerializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultSerializer.java new file mode 100644 index 000000000..4432eb0e8 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultSerializer.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.powsybl.commons.json.JsonUtil; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynamicsimulation.DynamicSimulationResult; +import com.powsybl.dynamicsimulation.json.DynamicSimulationResultSerializer; +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; + +/** + * @author Laurent Issertial {@literal } + */ +public class MarginCalculationResultSerializer extends StdSerializer { + + private static final String VERSION = "1.0"; + + MarginCalculationResultSerializer() { + super(MarginCalculationResult.class); + } + + public static void write(MarginCalculationResult result, Path jsonFile) { + Objects.requireNonNull(result); + Objects.requireNonNull(jsonFile); + try { + try (OutputStream os = Files.newOutputStream(jsonFile)) { + ObjectMapper objectMapper = JsonUtil.createObjectMapper(); + SimpleModule module = new SimpleModule(); + module.addSerializer(MarginCalculationResult.class, new MarginCalculationResultSerializer()); + objectMapper.registerModule(module); + ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter(); + writer.writeValue(os, result); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public void serialize(MarginCalculationResult result, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + jsonGenerator.writeStartObject(); + jsonGenerator.writeStringField("version", VERSION); + jsonGenerator.writeFieldName("loadIncreases"); + jsonGenerator.writeStartArray(); + for (LoadIncreaseResult loadIncrease : result.getResults()) { + jsonGenerator.writeStartObject(); + jsonGenerator.writeNumberField("loadLevel", loadIncrease.loadLevel()); + jsonGenerator.writeStringField("status", loadIncrease.status().toString()); + writeFailedCriteria(loadIncrease.failedCriteria(), jsonGenerator); + jsonGenerator.writeFieldName("scenarioResults"); + jsonGenerator.writeStartArray(); + for (ScenarioResult scenario : loadIncrease.scenarioResults()) { + writeScenarioResult(scenario, jsonGenerator); + } + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } + + private void writeFailedCriteria(List failedCriteria, JsonGenerator jsonGenerator) throws IOException { + jsonGenerator.writeFieldName("failedCriteria"); + jsonGenerator.writeStartArray(); + for (FailedCriterion criterion : failedCriteria) { + writeFailedCriterion(criterion, jsonGenerator); + } + jsonGenerator.writeEndArray(); + } + + private void writeFailedCriterion(FailedCriterion failedCriterion, JsonGenerator jsonGenerator) throws IOException { + jsonGenerator.writeStartObject(); + jsonGenerator.writeStringField("description", failedCriterion.description()); + jsonGenerator.writeNumberField("time", failedCriterion.time()); + jsonGenerator.writeEndObject(); + } + + private void writeScenarioResult(ScenarioResult scenarioResult, JsonGenerator jsonGenerator) throws IOException { + jsonGenerator.writeStartObject(); + jsonGenerator.writeStringField("id", scenarioResult.id()); + jsonGenerator.writeStringField("status", scenarioResult.status().toString()); + writeFailedCriteria(scenarioResult.failedCriteria(), jsonGenerator); + jsonGenerator.writeEndObject(); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java index 7d82530d7..2c2d67b2b 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationJsonDeserializer.java @@ -13,7 +13,9 @@ import com.powsybl.commons.json.JsonUtil; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariation; import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Objects; diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplierUtils.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplierUtils.java new file mode 100644 index 000000000..41dcf9f60 --- /dev/null +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/loadsvariation/supplier/LoadsVariationSupplierUtils.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.loadsvariation.supplier; + +import com.powsybl.dynawo.margincalculation.loadsvariation.LoadsVariationBuilder; +import com.powsybl.dynawo.suppliers.SupplierJsonDeserializer; + +import java.nio.file.Path; + +/** + * @author Laurent Issertial {@literal } + */ +public class LoadsVariationSupplierUtils { + + public static LoadsVariationSupplier getLoadsVariationSupplierForJson(Path loadVariationsPath) { + return (n, r) -> new SupplierJsonDeserializer<>( + new LoadsVariationJsonDeserializer(() -> new LoadsVariationBuilder(n, r))) + .deserialize(loadVariationsPath); + } +} diff --git a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java index 0f506c2c7..49255e9c2 100644 --- a/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java +++ b/dynawo-security-analysis/src/main/java/com/powsybl/dynawo/margincalculation/results/MarginCalculationResult.java @@ -18,6 +18,7 @@ public class MarginCalculationResult { private final List loadIncreaseResults; + //TODO remove ? private byte[] logBytes; public static MarginCalculationResult empty() { diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParametersTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParametersTest.java new file mode 100644 index 000000000..10672f808 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/JsonMarginCalculationParametersTest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.powsybl.commons.config.InMemoryPlatformConfig; +import com.powsybl.commons.test.AbstractSerDeTest; +import com.powsybl.dynawo.DynawoSimulationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Objects; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * @author Laurent Issertial {@literal } + */ +class JsonMarginCalculationParametersTest extends AbstractSerDeTest { + + private static final String USER_HOME = "/home/user/"; + + private InMemoryPlatformConfig platformConfig; + + @BeforeEach + @Override + public void setUp() throws IOException { + super.setUp(); + platformConfig = new InMemoryPlatformConfig(fileSystem); + Files.createDirectories(fileSystem.getPath(USER_HOME)); + copyFile("/parametersSet/models.par", DynawoSimulationParameters.DEFAULT_INPUT_PARAMETERS_FILE); + copyFile("/parametersSet/network.par", DynawoSimulationParameters.DEFAULT_INPUT_NETWORK_PARAMETERS_FILE); + copyFile("/parametersSet/solvers.par", DynawoSimulationParameters.DEFAULT_INPUT_SOLVER_PARAMETERS_FILE); + } + + private void copyFile(String name, String parametersFile) throws IOException { + Path path = platformConfig.getConfigDir() + .map(cd -> cd.resolve(fileSystem.getPath(parametersFile))) + .orElse(fileSystem.getPath(parametersFile)); + Objects.requireNonNull(getClass().getResourceAsStream(name)) + .transferTo(Files.newOutputStream(path)); + } + + @Test + void roundTrip() throws IOException { + MarginCalculationParameters parameters = MarginCalculationParameters.builder() + .setDynawoParameters(DynawoSimulationParameters.load(platformConfig)) + .build(); + roundTripTest(parameters, JsonMarginCalculationParameters::write, JsonMarginCalculationParameters::read, "/MarginCalculationParameters.json"); + } + + @Test + void readError() throws IOException { + try (var is = getClass().getResourceAsStream("/MarginCalculationParametersError.json")) { + IllegalStateException e = assertThrows(IllegalStateException.class, () -> JsonMarginCalculationParameters.read(is)); + assertEquals("Unexpected field: unknownParameter", e.getMessage()); + } + } +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultJsonTest.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultJsonTest.java new file mode 100644 index 000000000..ff016706f --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/json/MarginCalculationResultJsonTest.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.json; + +import com.powsybl.commons.test.AbstractSerDeTest; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynaflow.results.Status; +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +/** + * @author Laurent Issertial {@literal } + */ +class MarginCalculationResultJsonTest extends AbstractSerDeTest { + + private static MarginCalculationResult create() { + return new MarginCalculationResult(List.of( + new LoadIncreaseResult(100.0, + Status.CRITERIA_NON_RESPECTED, + Collections.emptyList(), + Collections.singletonList(new FailedCriterion("Failed crit1", 23.2))), + new LoadIncreaseResult(75.0, + Status.DIVERGENCE, + List.of( + new ScenarioResult("cont1", Status.CONVERGENCE), + new ScenarioResult("cont2", Status.CRITERIA_NON_RESPECTED, + Collections.singletonList(new FailedCriterion("Failed crit", 3.3))) + )), + new LoadIncreaseResult(50.0, Status.CONVERGENCE))); + } + + @Test + void roundTripTest() throws IOException { + roundTripTest(create(), MarginCalculationResultSerializer::write, MarginCalculationResultDeserializer::read, "/MarginCalculationResult.json"); + } + + @Test + void handleErrorTest() throws IOException { + try (var is = getClass().getResourceAsStream("/MarginCalculationResultError.json")) { + IllegalStateException e = assertThrows(IllegalStateException.class, () -> MarginCalculationResultDeserializer.read(is)); + assertEquals("Unexpected field: err", e.getMessage()); + } + } + +} diff --git a/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/tool/MarginCalculationTool.java b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/tool/MarginCalculationTool.java new file mode 100644 index 000000000..c5a8b0794 --- /dev/null +++ b/dynawo-security-analysis/src/test/java/com/powsybl/dynawo/margincalculation/tool/MarginCalculationTool.java @@ -0,0 +1,273 @@ +/** + * Copyright (c) 2025, 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.dynawo.margincalculation.tool; + +import com.google.auto.service.AutoService; +import com.powsybl.commons.PowsyblException; +import com.powsybl.commons.io.table.*; +import com.powsybl.commons.report.ReportNode; +import com.powsybl.contingency.ContingenciesProvider; +import com.powsybl.contingency.dsl.GroovyDslContingenciesProviderFactory; +import com.powsybl.dynaflow.results.FailedCriterion; +import com.powsybl.dynaflow.results.ScenarioResult; +import com.powsybl.dynamicsimulation.DynamicModelsSupplier; +import com.powsybl.dynamicsimulation.groovy.DynamicSimulationSupplierFactory; +import com.powsybl.dynawo.margincalculation.MarginCalculation; +import com.powsybl.dynawo.margincalculation.MarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.MarginCalculationRunParameters; +import com.powsybl.dynawo.margincalculation.json.JsonMarginCalculationParameters; +import com.powsybl.dynawo.margincalculation.json.MarginCalculationResultSerializer; +import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplier; +import com.powsybl.dynawo.margincalculation.loadsvariation.supplier.LoadsVariationSupplierUtils; +import com.powsybl.dynawo.margincalculation.results.LoadIncreaseResult; +import com.powsybl.dynawo.margincalculation.results.MarginCalculationResult; +import com.powsybl.iidm.network.ImportConfig; +import com.powsybl.iidm.network.Network; +import com.powsybl.iidm.network.tools.ConversionToolUtils; +import com.powsybl.tools.Command; +import com.powsybl.tools.Tool; +import com.powsybl.tools.ToolRunningContext; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.UncheckedIOException; +import java.io.Writer; +import java.nio.file.Path; +import java.util.List; +import java.util.Properties; + +/** + * @author Laurent Issertial {@literal } + */ +@AutoService(Tool.class) +//TODO add tests +public class MarginCalculationTool implements Tool { + + private static final String CASE_FILE = "case-file"; + private static final String DYNAMIC_MODELS_FILE = "dynamic-models-file"; + private static final String CONTINGENCIES_FILE = "contingencies-file"; + private static final String LOAD_VARIATIONS_FILE = "load-variations-file"; + private static final String PARAMETERS_FILE = "parameters-file"; + private static final String OUTPUT_FILE = "output-file"; + private static final String OUTPUT_LOG_FILE = "output-log-file"; + + @Override + public Command getCommand() { + return new Command() { + @Override + public String getName() { + return "margin-calculation"; + } + + @Override + public String getTheme() { + return "Computation"; + } + + @Override + public String getDescription() { + return "Run margin calculation"; + } + + @Override + public Options getOptions() { + return new Options() + .addOption(Option.builder().longOpt(CASE_FILE) + .desc("the case path") + .hasArg() + .argName("FILE") + .required() + .build()) + .addOption(Option.builder().longOpt(DYNAMIC_MODELS_FILE) + .desc("dynamic models description as a Groovy file: defines the dynamic models to be associated to chosen equipments of the network") + .hasArg() + .argName("FILE") + .required() + .build()) + .addOption(Option.builder().longOpt(CONTINGENCIES_FILE) + .desc("contingencies description as a Groovy file") + .hasArg() + .argName("FILE") + .required() + .build()) + .addOption(Option.builder().longOpt(LOAD_VARIATIONS_FILE) + .desc("load variations description as a JSON file") + .hasArg() + .argName("FILE") + .required() + .build()) + .addOption(Option.builder().longOpt(PARAMETERS_FILE) + .desc("margin calculation parameters as a JSON file") + .hasArg() + .argName("FILE") + .build()) + .addOption(Option.builder().longOpt(OUTPUT_FILE) + .desc("margin calculation results output path") + .hasArg() + .argName("FILE") + .build()) + .addOption(Option.builder().longOpt(OUTPUT_LOG_FILE) + .desc("margin calculation logs output path") + .hasArg() + .argName("FILE") + .build()) + .addOption(ConversionToolUtils.createImportParametersFileOption()) + .addOption(ConversionToolUtils.createImportParameterOption()); + } + + @Override + public String getUsageFooter() { + return null; + } + }; + } + + @Override + public void run(CommandLine line, ToolRunningContext context) throws Exception { + + ReportNode reportNode = ReportNode.newRootReportNode() + .withMessageTemplate("marginCalculationTool", "Margin Calculation Tool") + .build(); + Path caseFile = context.getFileSystem().getPath(line.getOptionValue(CASE_FILE)); + // process a single network: output-file/output-format options available + + context.getOutputStream().println("Loading network '" + caseFile + "'"); + Properties inputParams = ConversionToolUtils.readProperties(line, ConversionToolUtils.OptionType.IMPORT, context); + Network network = Network.read(caseFile, context.getShortTimeExecutionComputationManager(), ImportConfig.load(), inputParams); + if (network == null) { + throw new PowsyblException("Case '" + caseFile + "' not found"); + } + + MarginCalculation.Runner runner = MarginCalculation.getRunner(); + Path dydFile = context.getFileSystem().getPath(line.getOptionValue(DYNAMIC_MODELS_FILE)); + DynamicModelsSupplier dynamicModelsSupplier = DynamicSimulationSupplierFactory.createDynamicModelsSupplier(dydFile, runner.getName()); + Path contingenciesFile = context.getFileSystem().getPath(line.getOptionValue(CONTINGENCIES_FILE)); + ContingenciesProvider contingenciesProvider = new GroovyDslContingenciesProviderFactory().create(contingenciesFile); + Path loadVariationsFile = context.getFileSystem().getPath(line.getOptionValue(LOAD_VARIATIONS_FILE)); + LoadsVariationSupplier loadsVariationSupplier = LoadsVariationSupplierUtils.getLoadsVariationSupplierForJson(loadVariationsFile); + MarginCalculationParameters parameters = line.hasOption(PARAMETERS_FILE) ? + JsonMarginCalculationParameters.read(context.getFileSystem().getPath(line.getOptionValue(PARAMETERS_FILE))) + : MarginCalculationParameters.builder().build(); + MarginCalculationRunParameters runParameters = new MarginCalculationRunParameters() + .setMarginCalculationParameters(parameters) + .setComputationManager(context.getShortTimeExecutionComputationManager()) + .setReportNode(reportNode); + + MarginCalculationResult result = runner.run(network, dynamicModelsSupplier, contingenciesProvider, loadsVariationSupplier, runParameters); + //Results + Path outputLogFile = line.hasOption(OUTPUT_LOG_FILE) ? context.getFileSystem().getPath(line.getOptionValue(OUTPUT_LOG_FILE)) : null; + if (outputLogFile != null) { + exportLog(reportNode, context, outputLogFile); + } else { + printLog(reportNode, context); + } + Path outputFile = line.hasOption(OUTPUT_FILE) ? context.getFileSystem().getPath(line.getOptionValue(OUTPUT_FILE)) : null; + if (outputFile != null) { + exportResult(result, context, outputFile); + } else { + printResult(result, context); + } + } + + private void printLog(ReportNode reportNode, ToolRunningContext context) throws IOException { + Writer writer = new OutputStreamWriter(context.getOutputStream()); + reportNode.print(writer); + writer.flush(); + } + + private void exportLog(ReportNode reportNode, ToolRunningContext context, Path outputLogFile) throws IOException { + context.getOutputStream().println("Writing logs to '" + outputLogFile + "'"); + reportNode.print(outputLogFile); + } + + private void printResult(MarginCalculationResult result, ToolRunningContext context) { + Writer writer = new OutputStreamWriter(context.getOutputStream()); + AsciiTableFormatterFactory asciiTableFormatterFactory = new AsciiTableFormatterFactory(); + printDynamicSimulationResult(result, writer, asciiTableFormatterFactory, TableFormatterConfig.load()); + } + + private void exportResult(MarginCalculationResult result, ToolRunningContext context, Path outputFile) { + context.getOutputStream().println("Writing results to '" + outputFile + "'"); + MarginCalculationResultSerializer.write(result, outputFile); + } + + private void printDynamicSimulationResult(MarginCalculationResult results, Writer writer, + TableFormatterFactory formatterFactory, + TableFormatterConfig formatterConfig) { + try (TableFormatter formatter = formatterFactory.create(writer, + "dynamic simulation results", + formatterConfig, + new Column("Result"))) { + for (LoadIncreaseResult result : results.getResults()) { + formatter.writeCell(result.loadLevel()); + formatter.writeCell(result.status().toString()); + + List failedCriteria = result.failedCriteria(); + if (failedCriteria.isEmpty()) { + formatter.writeEmptyCells(2); + } else { + formatter.writeCell("Failed criteria (%s)".formatted(failedCriteria.size())); + formatter.writeEmptyCell(); + } + + List scenarioResults = result.scenarioResults(); + if (scenarioResults.isEmpty()) { + formatter.writeEmptyCells(4); + } else { + formatter.writeCell("Scenarios (%s)".formatted(scenarioResults.size())); + formatter.writeEmptyCells(3); + } + + for (FailedCriterion criterion : failedCriteria) { + formatter.writeEmptyCells(2); + formatter.writeCell(criterion.description()); + formatter.writeCell(criterion.time()); + formatter.writeEmptyCells(4); + } + + for (ScenarioResult scenarioResult : scenarioResults) { + formatter.writeEmptyCells(4); + formatter.writeCell(scenarioResult.id()); + formatter.writeCell(scenarioResult.status().toString()); + formatter.writeEmptyCells(2); + List scenarioCriteria = scenarioResult.failedCriteria(); + if (scenarioCriteria.isEmpty()) { + formatter.writeEmptyCells(2); + } else { + formatter.writeCell("Scenario failed criteria (%s)".formatted(scenarioCriteria.size())); + formatter.writeEmptyCell(); + } + for (FailedCriterion criterion : failedCriteria) { + formatter.writeEmptyCells(6); + formatter.writeCell(criterion.description()); + formatter.writeCell(criterion.time()); + } + } + + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + private static Column[] getColumns() { + return new Column[]{ + new Column("Load level"), + new Column("Status"), + new Column("Failed criteria"), + new Column("Failed criteria time"), + new Column("Scenarios"), + new Column("Scenarios Status"), + new Column("Scenarios failed criteria"), + new Column("Scenarios failed criteria time") + }; + } +} diff --git a/dynawo-security-analysis/src/test/resources/MarginCalculationParameters.json b/dynawo-security-analysis/src/test/resources/MarginCalculationParameters.json new file mode 100644 index 000000000..58a0b27f2 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/MarginCalculationParameters.json @@ -0,0 +1,64 @@ +{ + "startTime" : 0.0, + "stopTime" : 200.0, + "marginCalculationStartTime" : 100.0, + "loadIncreaseStartTime" : 10.0, + "loadIncreaseStopTime" : 50.0, + "contingenciesStartTime" : 120.0, + "calculationType" : "GLOBAL_MARGIN", + "accuracy" : 2, + "loadModelsRule" : "ALL_LOADS", + "dynawoParameters" : { + "networkParameters" : { + "id" : "1", + "parameters" : { }, + "references" : [ ] + }, + "solverParameters" : { + "id" : "1", + "parameters" : { + "order" : { + "name" : "order", + "type" : "INT", + "value" : "1" + }, + "absAccuracy" : { + "name" : "absAccuracy", + "type" : "DOUBLE", + "value" : "1e-4" + } + }, + "references" : [ ] + }, + "solverType" : "SIM", + "mergeLoads" : false, + "useModelSimplifiers" : false, + "dumpFileParameters" : { + "exportDumpFile" : false, + "useDumpFile" : false, + "dumpFileFolder" : null, + "dumpFile" : null + }, + "precision" : 1.0E-6, + "timelineExportMode" : "TXT", + "logLevelFilter" : "INFO", + "specificLogs" : [ ], + "criteriaFilePath" : null, + "modelsParameters" : [ { + "id" : "test", + "parameters" : { + "boolean" : { + "name" : "boolean", + "type" : "BOOL", + "value" : "true" + }, + "string" : { + "name" : "string", + "type" : "STRING", + "value" : "aString" + } + }, + "references" : [ ] + } ] + } +} \ No newline at end of file diff --git a/dynawo-security-analysis/src/test/resources/MarginCalculationParametersError.json b/dynawo-security-analysis/src/test/resources/MarginCalculationParametersError.json new file mode 100644 index 000000000..6365f3ac1 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/MarginCalculationParametersError.json @@ -0,0 +1,6 @@ +{ + "version" : "1.0", + "startTime" : 0, + "stopTime" : 1, + "unknownParameter": "" +} \ No newline at end of file diff --git a/dynawo-security-analysis/src/test/resources/MarginCalculationResult.json b/dynawo-security-analysis/src/test/resources/MarginCalculationResult.json new file mode 100644 index 000000000..78e45210c --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/MarginCalculationResult.json @@ -0,0 +1,33 @@ +{ + "version" : "1.0", + "loadIncreases" : [ { + "loadLevel" : 100.0, + "status" : "CRITERIA_NON_RESPECTED", + "failedCriteria" : [ { + "description" : "Failed crit1", + "time" : 23.2 + } ], + "scenarioResults" : [ ] + }, { + "loadLevel" : 75.0, + "status" : "DIVERGENCE", + "failedCriteria" : [ ], + "scenarioResults" : [ { + "id" : "cont1", + "status" : "CONVERGENCE", + "failedCriteria" : [ ] + }, { + "id" : "cont2", + "status" : "CRITERIA_NON_RESPECTED", + "failedCriteria" : [ { + "description" : "Failed crit", + "time" : 3.3 + } ] + } ] + }, { + "loadLevel" : 50.0, + "status" : "CONVERGENCE", + "failedCriteria" : [ ], + "scenarioResults" : [ ] + } ] +} \ No newline at end of file diff --git a/dynawo-security-analysis/src/test/resources/MarginCalculationResultError.json b/dynawo-security-analysis/src/test/resources/MarginCalculationResultError.json new file mode 100644 index 000000000..b58e465cc --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/MarginCalculationResultError.json @@ -0,0 +1,4 @@ +{ + "version" : "1.0", + "err" : "4" +} \ No newline at end of file diff --git a/dynawo-security-analysis/src/test/resources/parametersSet/models.par b/dynawo-security-analysis/src/test/resources/parametersSet/models.par new file mode 100644 index 000000000..be611df2b --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/parametersSet/models.par @@ -0,0 +1,7 @@ + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/parametersSet/network.par b/dynawo-security-analysis/src/test/resources/parametersSet/network.par new file mode 100644 index 000000000..e3ed13644 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/parametersSet/network.par @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/dynawo-security-analysis/src/test/resources/parametersSet/solvers.par b/dynawo-security-analysis/src/test/resources/parametersSet/solvers.par new file mode 100644 index 000000000..f15ad1128 --- /dev/null +++ b/dynawo-security-analysis/src/test/resources/parametersSet/solvers.par @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationParameters.java b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationParameters.java index 69e739e32..698b73498 100644 --- a/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationParameters.java +++ b/dynawo-simulation/src/main/java/com/powsybl/dynawo/DynawoSimulationParameters.java @@ -274,7 +274,11 @@ public Set getSpecificLogs() { } public DynawoSimulationParameters setSpecificLogs(Set specificLogs) { - this.specificLogs = EnumSet.copyOf(specificLogs); + if (specificLogs.isEmpty()) { + this.specificLogs = EnumSet.noneOf(SpecificLog.class); + } else { + this.specificLogs = EnumSet.copyOf(specificLogs); + } return this; }