Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InfiniteBus model #217

Merged
merged 5 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/

package com.powsybl.dynawaltz.dsl.models.builders

import com.powsybl.dsl.DslException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com/)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.dynawaltz.dsl.models.buses

import com.powsybl.dsl.DslException
import com.powsybl.dynawaltz.dsl.models.builders.AbstractDynamicModelBuilder
import com.powsybl.iidm.network.Bus
import com.powsybl.iidm.network.Network

/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
abstract class AbstractBusBuilder extends AbstractDynamicModelBuilder {

Bus bus

AbstractBusBuilder(Network network) {
super(network)
}

void checkData() {
super.checkData()
bus = network.getBusBreakerView().getBus(staticId)
if (bus == null) {
throw new DslException("Bus static id unknown: " + staticId)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
package com.powsybl.dynawaltz.dsl.models.buses

import com.google.auto.service.AutoService
import com.powsybl.dsl.DslException
import com.powsybl.dynamicsimulation.DynamicModel
import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension
import com.powsybl.dynawaltz.dsl.AbstractEquipmentGroovyExtension
import com.powsybl.dynawaltz.dsl.models.builders.AbstractDynamicModelBuilder
import com.powsybl.dynawaltz.models.buses.StandardBus
import com.powsybl.iidm.network.Bus
import com.powsybl.iidm.network.Network

/**
Expand All @@ -34,22 +31,12 @@ class BusGroovyExtension extends AbstractEquipmentGroovyExtension<DynamicModel>
new BusBuilder(network)
}

static class BusBuilder extends AbstractDynamicModelBuilder {

Bus bus
static class BusBuilder extends AbstractBusBuilder {

BusBuilder(Network network) {
super(network)
}

void checkData() {
super.checkData()
bus = network.getBusBreakerView().getBus(staticId)
if (bus == null) {
throw new DslException("Bus static id unknown: " + staticId)
}
}

@Override
StandardBus build() {
checkData()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright (c) 2023, RTE (http://www.rte-france.com/)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*/
package com.powsybl.dynawaltz.dsl.models.buses

import com.google.auto.service.AutoService
import com.powsybl.dynamicsimulation.DynamicModel
import com.powsybl.dynamicsimulation.groovy.DynamicModelGroovyExtension
import com.powsybl.dynawaltz.dsl.AbstractEquipmentGroovyExtension
import com.powsybl.dynawaltz.models.buses.InfiniteBus
import com.powsybl.iidm.network.Network

/**
* @author Laurent Issertial <laurent.issertial at rte-france.com>
*/
@AutoService(DynamicModelGroovyExtension.class)
class InfiniteBusGroovyExtension extends AbstractEquipmentGroovyExtension<DynamicModel> implements DynamicModelGroovyExtension {

protected static final String BUSES = "infiniteBuses"

InfiniteBusGroovyExtension() {
ConfigSlurper config = new ConfigSlurper()
modelTags = config.parse(this.getClass().getClassLoader().getResource(MODELS_CONFIG)).get(BUSES).keySet() as List
}

@Override
protected BusBuilder createBuilder(Network network, String currentTag) {
new BusBuilder(network, currentTag)
}

static class BusBuilder extends AbstractBusBuilder {

String tag

BusBuilder(Network network, String tag) {
super(network)
this.tag = tag
}

@Override
InfiniteBus build() {
checkData()
new InfiniteBus(dynamicModelId, bus, parameterSetId, tag)
}
}
}
6 changes: 6 additions & 0 deletions dynawaltz-dsl/src/main/resources/models.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ hvdc {
HvdcVSCEmulation
}

infiniteBuses {
InfiniteBus
InfiniteBusWithImpedance
InfiniteBusWithVariations
}

loadsAlphaBeta {
LoadAlphaBeta
LoadAlphaBetaRestorative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.powsybl.dynawaltz.models.automatons.UnderVoltageAutomaton;
import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterIAutomaton;
import com.powsybl.dynawaltz.models.automatons.phaseshifters.PhaseShifterPAutomaton;
import com.powsybl.dynawaltz.models.buses.InfiniteBus;
import com.powsybl.dynawaltz.models.buses.StandardBus;
import com.powsybl.dynawaltz.models.generators.GeneratorFictitious;
import com.powsybl.dynawaltz.models.generators.GeneratorSynchronous;
Expand Down Expand Up @@ -102,6 +103,7 @@ private static Stream<Arguments> provideEquipmentModelData() {
Arguments.of("loadTwoTransformers", LoadTwoTransformers.class, EurostagTutorialExample1Factory.create(), "LOAD", "LOAD", "LTT", "LoadTwoTransformers"),
Arguments.of("loadTwoTransformersTapChangers", LoadTwoTransformersTapChangers.class, EurostagTutorialExample1Factory.create(), "LOAD", "LOAD", "LTT", "LoadTwoTransformersTapChangers"),
Arguments.of("hvdc", HvdcModel.class, HvdcTestNetwork.createVsc(), "L", "BBM_HVDC_L", "HVDC", "HvdcPV"),
Arguments.of("infiniteBus", InfiniteBus.class, HvdcTestNetwork.createVsc(), "B1", "BBM_BUS", "b", "InfiniteBusWithVariations"),
Arguments.of("line", StandardLine.class, EurostagTutorialExample1Factory.create(), "NHV1_NHV2_1", "BBM_NHV1_NHV2_1", "LINE", "Line"),
Arguments.of("genFictitious", GeneratorFictitious.class, EurostagTutorialExample1Factory.create(), "GEN", "BBM_GEN", "GF", "GeneratorFictitious"),
Arguments.of("gen", GeneratorSynchronous.class, EurostagTutorialExample1Factory.create(), "GEN", "BBM_GEN", "GSFWPR", "GeneratorSynchronousFourWindingsProportionalRegulations"),
Expand Down
15 changes: 15 additions & 0 deletions dynawaltz-dsl/src/test/resources/dynamicModels/infiniteBus.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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 dynamicModels

InfiniteBusWithVariations {
staticId "B1"
dynamicModelId "BBM_BUS"
parameterSetId "b"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<dyn:parametersSet xmlns:dyn="http://www.rte-france.com/dynawo">
<dyn:set id="OMEGA_REF">
<dyn:set id="FREQ_SYNC_PAR">
<dyn:par type="DOUBLE" name="weight_gen_0" value="6539.400000000001"/>
<dyn:par type="DOUBLE" name="weight_gen_1" value="7056.0"/>
<dyn:par type="DOUBLE" name="weight_gen_2" value="9281.25"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</dyn:blackBoxModel>
<dyn:blackBoxModel id="CLA_2_4" lib="CurrentLimitAutomaton" parFile="models.par" parId="CLA_2_4"/>
<dyn:blackBoxModel id="CLA_2_5" lib="CurrentLimitAutomaton" parFile="models.par" parId="CLA_2_5"/>
<dyn:blackBoxModel id="OMEGA_REF" lib="DYNModelOmegaRef" parFile="ieee14bus.par" parId="OMEGA_REF"/>
<dyn:blackBoxModel id="FREQ_SYNC" lib="DYNModelOmegaRef" parFile="ieee14bus.par" parId="FREQ_SYNC_PAR"/>
<dyn:blackBoxModel id="Disconnect__BUS____1-BUS____5-1_AC" lib="EventQuadripoleDisconnection" parFile="ieee14bus.par" parId="Disconnect__BUS____1-BUS____5-1_AC"/>
<dyn:macroConnector id="MC_LoadAlphaBeta-NetworkBus">
<dyn:connect var1="load_terminal" var2="@NAME@_ACPIN"/>
Expand Down Expand Up @@ -118,15 +118,15 @@
<dyn:macroConnect connector="MC_GeneratorSynchronousThreeWindingsProportionalRegulations-NetworkBus" id1="_GEN____8_SM" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_CurrentLimitAutomatonSide2-NetworkLine" id1="CLA_2_4" id2="NETWORK" name2="_BUS____2-BUS____4-1_AC"/>
<dyn:macroConnect connector="MC_CurrentLimitAutomatonSide2-NetworkLine" id1="CLA_2_5" id2="NETWORK" name2="_BUS____2-BUS____5-1_AC"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="0" id2="_GEN____1_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="0" id2="NETWORK" name2="_BUS____1_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="1" id2="_GEN____2_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="1" id2="NETWORK" name2="_BUS____2_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="2" id2="_GEN____3_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="2" id2="NETWORK" name2="_BUS____3_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="OMEGA_REF" index1="3" id2="_GEN____6_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="3" id2="NETWORK" name2="_BUS____6_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="OMEGA_REF" index1="4" id2="_GEN____8_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="4" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="0" id2="_GEN____1_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="0" id2="NETWORK" name2="_BUS____1_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="1" id2="_GEN____2_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="1" id2="NETWORK" name2="_BUS____2_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="2" id2="_GEN____3_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="2" id2="NETWORK" name2="_BUS____3_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="FREQ_SYNC" index1="3" id2="_GEN____6_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="3" id2="NETWORK" name2="_BUS____6_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="FREQ_SYNC" index1="4" id2="_GEN____8_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="4" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_EventQuadripoleDisconnection-NetworkLine" id1="Disconnect__BUS____1-BUS____5-1_AC" id2="NETWORK" name2="_BUS____1-BUS____5-1_AC"/>
</dyn:dynamicModelsArchitecture>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<dyn:parametersSet xmlns:dyn="http://www.rte-france.com/dynawo">
<dyn:set id="OMEGA_REF">
<dyn:set id="FREQ_SYNC_PAR">
<dyn:par type="DOUBLE" name="weight_gen_0" value="6539.400000000001"/>
<dyn:par type="DOUBLE" name="weight_gen_1" value="7056.0"/>
<dyn:par type="DOUBLE" name="weight_gen_2" value="9281.25"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<dyn:blackBoxModel id="_GEN____8_SM" lib="GeneratorSynchronousThreeWindingsProportionalRegulations" parFile="models.par" parId="GSTWPR_GEN____8_SM" staticId="_GEN____8_SM">
<dyn:macroStaticRef id="MSR_GeneratorSynchronousThreeWindingsProportionalRegulations"/>
</dyn:blackBoxModel>
<dyn:blackBoxModel id="OMEGA_REF" lib="DYNModelOmegaRef" parFile="ieee14bus.par" parId="OMEGA_REF"/>
<dyn:blackBoxModel id="FREQ_SYNC" lib="DYNModelOmegaRef" parFile="ieee14bus.par" parId="FREQ_SYNC_PAR"/>
<dyn:blackBoxModel id="Disconnect__BUS____1-BUS____5-1_AC" lib="EventQuadripoleDisconnection" parFile="ieee14bus.par" parId="Disconnect__BUS____1-BUS____5-1_AC"/>
<dyn:macroConnector id="MC_LoadAlphaBeta-NetworkBus">
<dyn:connect var1="load_terminal" var2="@NAME@_ACPIN"/>
Expand Down Expand Up @@ -109,15 +109,15 @@
<dyn:macroConnect connector="MC_GeneratorSynchronousFourWindingsProportionalRegulations-NetworkBus" id1="_GEN____3_SM" id2="NETWORK" name2="_BUS____3_TN"/>
<dyn:macroConnect connector="MC_GeneratorSynchronousThreeWindingsProportionalRegulations-NetworkBus" id1="_GEN____6_SM" id2="NETWORK" name2="_BUS____6_TN"/>
<dyn:macroConnect connector="MC_GeneratorSynchronousThreeWindingsProportionalRegulations-NetworkBus" id1="_GEN____8_SM" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="0" id2="_GEN____1_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="0" id2="NETWORK" name2="_BUS____1_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="1" id2="_GEN____2_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="1" id2="NETWORK" name2="_BUS____2_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="OMEGA_REF" index1="2" id2="_GEN____3_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="2" id2="NETWORK" name2="_BUS____3_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="OMEGA_REF" index1="3" id2="_GEN____6_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="3" id2="NETWORK" name2="_BUS____6_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="OMEGA_REF" index1="4" id2="_GEN____8_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="OMEGA_REF" index1="4" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="0" id2="_GEN____1_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="0" id2="NETWORK" name2="_BUS____1_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="1" id2="_GEN____2_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="1" id2="NETWORK" name2="_BUS____2_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousFourWindingsProportionalRegulations" id1="FREQ_SYNC" index1="2" id2="_GEN____3_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="2" id2="NETWORK" name2="_BUS____3_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="FREQ_SYNC" index1="3" id2="_GEN____6_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="3" id2="NETWORK" name2="_BUS____6_TN"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-GeneratorSynchronousThreeWindingsProportionalRegulations" id1="FREQ_SYNC" index1="4" id2="_GEN____8_SM"/>
<dyn:macroConnect connector="MC_DYNModelOmegaRef-NetworkBus" id1="FREQ_SYNC" index1="4" id2="NETWORK" name2="_BUS____8_TN"/>
<dyn:macroConnect connector="MC_EventQuadripoleDisconnection-NetworkLine" id1="Disconnect__BUS____1-BUS____5-1_AC" id2="NETWORK" name2="_BUS____1-BUS____5-1_AC"/>
</dyn:dynamicModelsArchitecture>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<dyn:parametersSet xmlns:dyn="http://www.rte-france.com/dynawo">
<dyn:set id="OMEGA_REF">
<dyn:set id="FREQ_SYNC_PAR">
<dyn:par type="DOUBLE" name="weight_gen_0" value="6539.400000000001"/>
<dyn:par type="DOUBLE" name="weight_gen_1" value="7056.0"/>
<dyn:par type="DOUBLE" name="weight_gen_2" value="9281.25"/>
Expand Down
Loading