-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SetPoint model replacing OmegaRef if a InfiniteBus is present in the model Signed-off-by: lisrte <laurent.issertial@rte-france.com>
- Loading branch information
Showing
21 changed files
with
436 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...altz-dsl/src/main/groovy/com/powsybl/dynawaltz/dsl/models/buses/AbstractBusBuilder.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
.../src/main/groovy/com/powsybl/dynawaltz/dsl/models/buses/InfiniteBusGroovyExtension.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
dynawaltz-dsl/src/test/resources/dynamicModels/infiniteBus.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/AbstractBus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* 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.models.buses; | ||
|
||
import com.powsybl.commons.PowsyblException; | ||
import com.powsybl.dynawaltz.DynaWaltzContext; | ||
import com.powsybl.dynawaltz.models.AbstractEquipmentBlackBoxModel; | ||
import com.powsybl.dynawaltz.models.MacroConnectAttribute; | ||
import com.powsybl.iidm.network.Bus; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* @author Laurent Issertial <laurent.issertial at rte-france.com> | ||
*/ | ||
public abstract class AbstractBus extends AbstractEquipmentBlackBoxModel<Bus> implements BusModel { | ||
|
||
public AbstractBus(String dynamicModelId, Bus bus, String parameterSetId) { | ||
super(dynamicModelId, parameterSetId, bus); | ||
} | ||
|
||
@Override | ||
public List<MacroConnectAttribute> getMacroConnectToAttributes() { | ||
List<MacroConnectAttribute> attributesConnectTo = new ArrayList<>(super.getMacroConnectToAttributes()); | ||
attributesConnectTo.add(MacroConnectAttribute.of("name2", getStaticId())); | ||
return attributesConnectTo; | ||
} | ||
|
||
@Override | ||
public void createMacroConnections(DynaWaltzContext context) { | ||
checkLinkedDynamicModels(equipment, context); | ||
} | ||
|
||
private void checkLinkedDynamicModels(Bus bus, DynaWaltzContext context) { | ||
bus.getConnectedTerminalStream() | ||
.map(t -> t.getConnectable().getId()) | ||
.filter(context::isWithoutBlackBoxDynamicModel) | ||
.findAny() | ||
.ifPresent(id -> { | ||
throw new PowsyblException(String.format("The equipment %s linked to the %s %s does not possess a dynamic model", | ||
id, this.getClass().getSimpleName(), getStaticId())); | ||
}); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return getLib(); | ||
} | ||
|
||
@Override | ||
public Optional<String> getSwitchOffSignalVarName() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<String> getNumCCVarName() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<String> getUImpinVarName() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<String> getUpuImpinVarName() { | ||
return Optional.empty(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
dynawaltz/src/main/java/com/powsybl/dynawaltz/models/buses/InfiniteBus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.models.buses; | ||
|
||
import com.powsybl.iidm.network.Bus; | ||
|
||
/** | ||
* @author Laurent Issertial <laurent.issertial at rte-france.com> | ||
*/ | ||
public class InfiniteBus extends AbstractBus { | ||
|
||
private final String lib; | ||
|
||
public InfiniteBus(String dynamicModelId, Bus bus, String parameterSetId, String lib) { | ||
super(dynamicModelId, bus, parameterSetId); | ||
this.lib = lib; | ||
} | ||
|
||
@Override | ||
public String getLib() { | ||
return lib; | ||
} | ||
|
||
@Override | ||
public String getTerminalVarName() { | ||
return "infiniteBus_terminal"; | ||
} | ||
} |
Oops, something went wrong.