-
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 disconnection event for bus (#408)
* Add disconnection event for bus * Add DSA integration test with divergence * Allow divergent ScenarioResult to have failed criteria Signed-off-by: lisrte <[email protected]>
- Loading branch information
Showing
21 changed files
with
422 additions
and
31 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
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
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 |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
package eventWarnings | ||
|
||
Disconnect { | ||
staticId "NGEN" | ||
staticId "WRONG_ID" | ||
startTime 1 | ||
} |
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
34 changes: 34 additions & 0 deletions
34
...gration-tests/src/test/resources/ieee14/dynamic-security-analysis/divergence/criteria.crt
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,34 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- | ||
Copyright (c) 2022, RTE (http://www.rte-france.com) | ||
See AUTHORS.txt | ||
All rights reserved. | ||
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 | ||
This file is part of Dynawo, an hybrid C++/Modelica open source suite | ||
of simulation tools for power systems. | ||
--> | ||
<criteria xmlns="http://www.rte-france.com/dynawo"> | ||
<busCriteria> | ||
<parameters id ="Risque modele" scope="FINAL" type="LOCAL_VALUE" uMinPu="0.8" uNomMin="225"/> | ||
<country id="AF"/> | ||
<country id="AFGHANISTAN"/> | ||
</busCriteria> | ||
<loadCriteria> | ||
<parameters id ="Risque protection" scope="FINAL" type="LOCAL_VALUE" pMax="4"> | ||
<voltageLevel uMaxPu="2"/> | ||
</parameters> | ||
<country id="AF"/> | ||
<country id="AFGHANISTAN"/> | ||
</loadCriteria> | ||
<generatorCriteria> | ||
<parameters id ="Risque protection" scope="FINAL" type="LOCAL_VALUE" pMin="-4"> | ||
<voltageLevel uMaxPu="2"/> | ||
</parameters> | ||
<country id="AF"/> | ||
<country id="AFGHANISTAN"/> | ||
</generatorCriteria> | ||
</criteria> |
57 changes: 57 additions & 0 deletions
57
...gration-tests/src/test/resources/ieee14/dynamic-security-analysis/divergence/results.json
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,57 @@ | ||
{ | ||
"version" : "1.7", | ||
"preContingencyResult" : { | ||
"status" : "CONVERGED", | ||
"limitViolationsResult" : { | ||
"limitViolations" : [ { | ||
"subjectId" : "_BUS____1-BUS____2-1_AC", | ||
"subjectName" : "BUS 1-BUS 2-1", | ||
"limitType" : "CURRENT", | ||
"limitName" : "permanent", | ||
"limit" : 836.74, | ||
"limitReduction" : 1.0, | ||
"value" : 1248.0773003764798, | ||
"side" : "ONE" | ||
} ], | ||
"actionsTaken" : [ ] | ||
}, | ||
"networkResult" : { | ||
"branchResults" : [ ], | ||
"busResults" : [ ], | ||
"threeWindingsTransformerResults" : [ ] | ||
} | ||
}, | ||
"postContingencyResults" : [ { | ||
"contingency" : { | ||
"id" : "Disconnect", | ||
"elements" : [ { | ||
"id" : "_BUS____1-BUS____5-1_AC", | ||
"type" : "LINE" | ||
}, { | ||
"id" : "_GEN____2_SM", | ||
"type" : "GENERATOR" | ||
}, { | ||
"id" : "_BUS____1_TN", | ||
"type" : "BUS" | ||
} ] | ||
}, | ||
"status" : "SOLVER_FAILED", | ||
"limitViolationsResult" : { | ||
"limitViolations" : [ ], | ||
"actionsTaken" : [ ] | ||
}, | ||
"networkResult" : { | ||
"branchResults" : [ ], | ||
"busResults" : [ ], | ||
"threeWindingsTransformerResults" : [ ] | ||
}, | ||
"connectivityResult" : { | ||
"createdSynchronousComponentCount" : 0, | ||
"createdConnectedComponentCount" : 0, | ||
"disconnectedLoadActivePower" : 0.0, | ||
"disconnectedGenerationActivePower" : 0.0, | ||
"disconnectedElements" : [ ] | ||
} | ||
} ], | ||
"operatorStrategyResults" : [ ] | ||
} |
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
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
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
93 changes: 93 additions & 0 deletions
93
dynawo-simulation/src/main/java/com/powsybl/dynawo/models/events/EventBusDisconnection.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,93 @@ | ||
/** | ||
* 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.events; | ||
|
||
import com.powsybl.dynawo.DynawoSimulationContext; | ||
import com.powsybl.dynawo.DynawoSimulationReports; | ||
import com.powsybl.dynawo.builders.EventModelInfo; | ||
import com.powsybl.dynawo.models.VarConnection; | ||
import com.powsybl.dynawo.models.buses.ActionConnectionPoint; | ||
import com.powsybl.dynawo.models.macroconnections.MacroConnectionsAdder; | ||
import com.powsybl.dynawo.parameters.ParametersSet; | ||
import com.powsybl.iidm.network.Bus; | ||
import com.powsybl.iidm.network.IdentifiableType; | ||
|
||
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.parameters.ParameterType.BOOL; | ||
import static com.powsybl.dynawo.parameters.ParameterType.DOUBLE; | ||
|
||
/** | ||
* @author Laurent Issertial {@literal <laurent.issertial at rte-france.com>} | ||
*/ | ||
public class EventBusDisconnection extends AbstractEvent implements ContextDependentEvent { | ||
|
||
private final boolean disconnect; | ||
private boolean hasDefaultModel; | ||
|
||
protected EventBusDisconnection(String eventId, Bus equipment, EventModelInfo eventModelInfo, double startTime, boolean disconnect) { | ||
super(eventId, equipment, eventModelInfo, startTime); | ||
this.disconnect = disconnect; | ||
} | ||
|
||
private List<VarConnection> getVarConnectionsWith(ActionConnectionPoint connected) { | ||
return connected.getStateValueVarName() | ||
.map(sv -> List.of(new VarConnection("event_state1_value", sv))) | ||
.orElse(Collections.emptyList()); | ||
} | ||
|
||
@Override | ||
public void createMacroConnections(MacroConnectionsAdder adder) { | ||
if (hasDefaultModel) { | ||
adder.createMacroConnections(this, getEquipment(), ActionConnectionPoint.class, this::getVarConnectionsWith); | ||
} else { | ||
DynawoSimulationReports.reportFailedDynamicModelHandling(adder.getReportNode(), getName(), getDynamicModelId(), IdentifiableType.BUS.toString()); | ||
} | ||
} | ||
|
||
@Override | ||
public String getLib() { | ||
return "EventConnectedStatus"; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return getClass().getSimpleName(); | ||
} | ||
|
||
@Override | ||
public void createDynamicModelParameters(DynawoSimulationContext context, Consumer<ParametersSet> parametersAdder) { | ||
if (hasDefaultModel) { | ||
ParametersSet paramSet = new ParametersSet(getParameterSetId()); | ||
createEventSpecificParameters(paramSet); | ||
parametersAdder.accept(paramSet); | ||
} | ||
} | ||
|
||
@Override | ||
protected void createEventSpecificParameters(ParametersSet paramSet) { | ||
paramSet.addParameter("event_tEvent", DOUBLE, Double.toString(getStartTime())); | ||
paramSet.addParameter("event_open", BOOL, Boolean.toString(disconnect)); | ||
} | ||
|
||
@Override | ||
public final void setEquipmentHasDynamicModel(DynawoSimulationContext context) { | ||
hasDefaultModel = !hasDynamicModel(context); | ||
} | ||
|
||
@Override | ||
public void write(XMLStreamWriter writer, String parFileName) throws XMLStreamException { | ||
if (hasDefaultModel) { | ||
super.write(writer, parFileName); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.