Skip to content

Commit

Permalink
Add synchronized loads
Browse files Browse the repository at this point in the history
Edit models.json with SYNCHRONIZED properties for "Motor" loads

Signed-off-by: lisrte <[email protected]>
  • Loading branch information
Lisrte authored and flo-dup committed Oct 9, 2024
1 parent f391e9c commit b119084
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public BaseLoad build() {
if (isInstantiable()) {
if (modelConfig.isControllable()) {
return new BaseLoadControllable(dynamicModelId, getEquipment(), parameterSetId, modelConfig);
} else if (modelConfig.isSynchronized()) {
return new SynchronizedLoad(dynamicModelId, getEquipment(), parameterSetId, modelConfig);
} else {
return new BaseLoad(dynamicModelId, getEquipment(), parameterSetId, modelConfig);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* 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.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.Load;

import java.util.List;

/**
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>}
*/
public class SynchronizedLoad extends BaseLoad implements FrequencySynchronizedModel {

protected SynchronizedLoad(String dynamicModelId, Load load, String parameterSetId, ModelConfig modelConfig) {
super(dynamicModelId, load, parameterSetId, modelConfig);
}

@Override
public List<VarConnection> getOmegaRefVarConnections() {
return List.of(
new VarConnection("omegaRef_grp_@INDEX@_value", getOmegaRefPuVarName()),
new VarConnection("running_grp_@INDEX@", getRunningVarName())
);
}

@Override
public String getOmegaRefPuVarName() {
return "load_omegaRefPu_value";
}

@Override
public String getRunningVarName() {
return "load_running";
}

@Override
public Bus getConnectableBus() {
return BusUtils.getConnectableBus(equipment);
}
}
20 changes: 19 additions & 1 deletion dynawo-simulation/src/main/resources/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@
"lib": "LoadAlphaBetaRestorativeLimitsRecalc"
},
{
"lib": "LoadAlphaBetaMotor"
"lib": "LoadAlphaBetaMotor",
"properties": [
"SYNCHRONIZED"
]
},
{
"lib": "LoadPQ",
Expand All @@ -475,22 +478,37 @@
},
{
"lib": "LoadAlphaBetaMotorFifthOrder",
"properties": [
"SYNCHRONIZED"
],
"minVersion": "1.7.0"
},
{
"lib": "LoadAlphaBetaMotorSimplified",
"properties": [
"SYNCHRONIZED"
],
"minVersion": "1.7.0"
},
{
"lib": "LoadAlphaBetaThreeMotorFifthOrder",
"properties": [
"SYNCHRONIZED"
],
"minVersion": "1.7.0"
},
{
"lib": "LoadAlphaBetaTwoMotorFifthOrder",
"properties": [
"SYNCHRONIZED"
],
"minVersion": "1.7.0"
},
{
"lib": "LoadAlphaBetaTwoMotorSimplified",
"properties": [
"SYNCHRONIZED"
],
"minVersion": "1.7.0"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,40 @@ protected void addDynamicModels(Function< Network, BlackBoxModel> loadConstructo
@MethodSource("provideLoads")
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));
validate("dyd.xsd", dydName, tmpDir.resolve(DynawoSimulationConstants.DYD_FILENAME));
}

private static Stream<Arguments> provideLoads() {
return Stream.of(
Arguments.of("load_alpha_beta_dyd", (Function<Network, BlackBoxModel>) n -> BaseLoadBuilder.of(n, "LoadAlphaBeta")
Arguments.of("load_alpha_beta_dyd.xml", (Function<Network, BlackBoxModel>) n -> BaseLoadBuilder.of(n, "LoadAlphaBeta")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LAB")
.build()),
Arguments.of("load_one_transformer_dyd", (Function<Network, BlackBoxModel>) n -> LoadOneTransformerBuilder.of(n, "LoadOneTransformer")
Arguments.of("load_one_transformer_dyd.xml", (Function<Network, BlackBoxModel>) n -> LoadOneTransformerBuilder.of(n, "LoadOneTransformer")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LOT")
.build()),
Arguments.of("load_one_transformer_tap_changer_dyd", (Function<Network, BlackBoxModel>) n -> LoadOneTransformerTapChangerBuilder.of(n, "LoadOneTransformerTapChanger")
Arguments.of("load_one_transformer_tap_changer_dyd.xml", (Function<Network, BlackBoxModel>) n -> LoadOneTransformerTapChangerBuilder.of(n, "LoadOneTransformerTapChanger")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LOTTC")
.build()),
Arguments.of("load_two_transformers_dyd", (Function<Network, BlackBoxModel>) n -> LoadTwoTransformersBuilder.of(n, "LoadTwoTransformers")
Arguments.of("load_two_transformers_dyd.xml", (Function<Network, BlackBoxModel>) n -> LoadTwoTransformersBuilder.of(n, "LoadTwoTransformers")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LTT")
.build()),
Arguments.of("load_two_transformers_tap_changers_dyd", (Function<Network, BlackBoxModel>) n -> LoadTwoTransformersTapChangersBuilder.of(n, "LoadTwoTransformersTapChangers")
Arguments.of("load_two_transformers_tap_changers_dyd.xml", (Function<Network, BlackBoxModel>) n -> LoadTwoTransformersTapChangersBuilder.of(n, "LoadTwoTransformersTapChangers")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LTTTC")
.build()),
Arguments.of("load_synchronized.xml", (Function<Network, BlackBoxModel>) n -> BaseLoadBuilder.of(n, "LoadAlphaBetaMotor")
.dynamicModelId(DYN_LOAD_NAME)
.staticId(LOAD_NAME)
.parameterSetId("LAB")
.build())
);
}
Expand Down
26 changes: 26 additions & 0 deletions dynawo-simulation/src/test/resources/load_synchronized.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<dyn:dynamicModelsArchitecture xmlns:dyn="http://www.rte-france.com/dynawo">
<dyn:blackBoxModel id="BBM_LOAD" lib="LoadAlphaBetaMotor" parFile="models.par" parId="LAB" staticId="LOAD">
<dyn:macroStaticRef id="MSR_LoadAlphaBetaMotor"/>
</dyn:blackBoxModel>
<dyn:blackBoxModel id="FREQ_SYNC" lib="DYNModelOmegaRef" parFile="sim1.par" parId="FREQ_SYNC_PAR"/>
<dyn:macroConnector id="MC_LoadAlphaBetaMotor-DefaultEquipmentConnectionPoint">
<dyn:connect var1="load_terminal" var2="@STATIC_ID@@NODE@_ACPIN"/>
<dyn:connect var1="load_switchOffSignal1" var2="@STATIC_ID@@NODE@_switchOff"/>
</dyn:macroConnector>
<dyn:macroConnector id="MC_DYNModelOmegaRef-LoadAlphaBetaMotor">
<dyn:connect var1="omegaRef_grp_@INDEX@_value" var2="load_omegaRefPu_value"/>
<dyn:connect var1="running_grp_@INDEX@" var2="load_running"/>
</dyn:macroConnector>
<dyn:macroConnector id="MC_DYNModelOmegaRef-DefaultBusOfFrequencySynchronized">
<dyn:connect var1="numcc_node_@INDEX@" var2="@@NAME@@@NODE@_numcc"/>
</dyn:macroConnector>
<dyn:macroStaticReference id="MSR_LoadAlphaBetaMotor">
<dyn:staticRef var="load_PPu" staticVar="p"/>
<dyn:staticRef var="load_QPu" staticVar="q"/>
<dyn:staticRef var="load_state" staticVar="state"/>
</dyn:macroStaticReference>
<dyn:macroConnect connector="MC_LoadAlphaBetaMotor-DefaultEquipmentConnectionPoint" id1="BBM_LOAD" id2="NETWORK"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-LoadAlphaBetaMotor" id1="FREQ_SYNC" index1="0" id2="BBM_LOAD"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-DefaultBusOfFrequencySynchronized" id1="FREQ_SYNC" index1="0" id2="NETWORK" name2="LOAD"/>
</dyn:dynamicModelsArchitecture>

0 comments on commit b119084

Please sign in to comment.