-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an option that allow checking unrealistic voltage only on final s…
…tate of the loadflow. It allows outerloops to fix some voltage issues before failing. Signed-off-by: MURGEY Sebastien <[email protected]>
- Loading branch information
Showing
8 changed files
with
121 additions
and
37 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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/powsybl/openloadflow/ac/UnrealisticVoltageCheck.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,54 @@ | ||
/** | ||
* 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.openloadflow.ac; | ||
|
||
import com.powsybl.commons.report.ReportNode; | ||
import com.powsybl.openloadflow.ac.equations.AcEquationType; | ||
import com.powsybl.openloadflow.ac.equations.AcVariableType; | ||
import com.powsybl.openloadflow.ac.solver.NewtonRaphsonParameters; | ||
import com.powsybl.openloadflow.equations.*; | ||
import com.powsybl.openloadflow.network.LfNetwork; | ||
import com.powsybl.openloadflow.util.Reports; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.*; | ||
|
||
/** | ||
* @author Sebastien Murgey {@literal <sebastien.murgey at rte-france.com>} | ||
*/ | ||
public final class UnrealisticVoltageCheck { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(UnrealisticVoltageCheck.class); | ||
|
||
private UnrealisticVoltageCheck() { | ||
} | ||
|
||
public static boolean isStateUnrealistic(LfNetwork network, EquationSystem<AcVariableType, AcEquationType> equationSystem, NewtonRaphsonParameters parameters, ReportNode reportNode) { | ||
Map<String, Double> busesOutOfNormalVoltageRange = new LinkedHashMap<>(); | ||
for (Variable<AcVariableType> v : equationSystem.getIndex().getSortedVariablesToFind()) { | ||
if (v.getType() == AcVariableType.BUS_V && !network.getBus(v.getElementNum()).isFictitious()) { | ||
double value = equationSystem.getStateVector().get(v.getRow()); | ||
if (value < parameters.getMinRealisticVoltage() || value > parameters.getMaxRealisticVoltage()) { | ||
busesOutOfNormalVoltageRange.put(network.getBus(v.getElementNum()).getId(), value); | ||
} | ||
} | ||
} | ||
if (!busesOutOfNormalVoltageRange.isEmpty()) { | ||
if (LOGGER.isTraceEnabled()) { | ||
for (var e : busesOutOfNormalVoltageRange.entrySet()) { | ||
LOGGER.trace("Bus '{}' has an unrealistic voltage magnitude: {} pu", e.getKey(), e.getValue()); | ||
} | ||
} | ||
LOGGER.error("{} buses have a voltage magnitude out of range [{}, {}]: {}", | ||
busesOutOfNormalVoltageRange.size(), parameters.getMinRealisticVoltage(), parameters.getMaxRealisticVoltage(), busesOutOfNormalVoltageRange); | ||
|
||
Reports.reportNewtonRaphsonBusesOutOfRealisticVoltageRange(reportNode, busesOutOfNormalVoltageRange, parameters.getMinRealisticVoltage(), parameters.getMaxRealisticVoltage()); | ||
} | ||
return !busesOutOfNormalVoltageRange.isEmpty(); | ||
} | ||
} |
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
Oops, something went wrong.