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

Improve transformer voltage control AFTER_GNERATOR_VOLTAGE_CONTROL #1032

Merged
merged 42 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8619fd0
Initial backport from investigation branch - before working on code …
vidaldid-rte May 17, 2024
cbf33bb
add a test in stable mode
vidaldid-rte May 17, 2024
b4efbc0
add a test for tht limit
vidaldid-rte May 17, 2024
4d6e6a8
remove a line to prevent checker style from striking
vidaldid-rte May 17, 2024
1b69e97
remove some sonar issues
vidaldid-rte May 17, 2024
c5ca6dc
test outofbound tap
vidaldid-rte May 17, 2024
e72da3b
another MAJOR problem to fix from style checker perspective.
vidaldid-rte May 17, 2024
74064e7
troubleshoot test issue on server
vidaldid-rte May 17, 2024
26201d8
correct network copy to ensure voltage controlis active
vidaldid-rte May 17, 2024
ffe1725
isolate test ith different results locally and on server for troubles…
vidaldid-rte May 17, 2024
e2d22de
add a paranoid trace to troubleshoot build issue
vidaldid-rte May 17, 2024
90fae0d
black magic discovered ?
vidaldid-rte May 17, 2024
40502c1
restore paranoic trace
vidaldid-rte May 17, 2024
26fe407
last try this week
vidaldid-rte May 17, 2024
08a5a27
Merge branch 'main' into tap_update_algo
annetill May 28, 2024
cff1ea8
Add header and author on new files
vidaldid-rte May 31, 2024
0682ad2
Merge branch 'main' into tap_update_algo
vidaldid-rte May 31, 2024
350a48c
Remove a THT that escaped previous cleaning
vidaldid-rte May 31, 2024
3a89bdc
Merge branch 'main' into tap_update_algo
annetill Jun 11, 2024
217445b
some renaming after review of merged PR
vidaldid-rte Jun 11, 2024
31b5990
one more renaming
vidaldid-rte Jun 11, 2024
2aed9ec
Small renaming and clean.
annetill Jun 12, 2024
84b22e7
rename parameter getter and setters to eactly match declared paramete…
vidaldid-rte Jun 12, 2024
488517d
Merge branch 'tap_update_algo' of https://github.com/powsybl/powsybl-…
vidaldid-rte Jun 12, 2024
7da2a7c
Clean TransformerRatioManager.
annetill Jun 14, 2024
34c9548
Merge branch 'tap_update_algo' of https://github.com/powsybl/powsybl-…
annetill Jun 14, 2024
fcf0605
Merge branch 'main' into tap_update_algo
geofjamg Jun 20, 2024
ce4897f
Fix rewriting.
annetill Jun 20, 2024
d6d98e8
Merge branch 'tap_update_algo' of https://github.com/powsybl/powsybl-…
annetill Jun 20, 2024
17f1034
review remark on naming consistency
vidaldid-rte Jun 21, 2024
9dcf651
protect class against unanticipated usages
vidaldid-rte Jun 21, 2024
a645092
Fix parameter name.
annetill Jun 21, 2024
650d436
code review - improve criteria to detect group behind VHV transformer(s)
vidaldid-rte Jun 21, 2024
61e8a83
Fix parameter name.
annetill Jun 21, 2024
4d200ce
Merge remote-tracking branch 'origin/tap_update_algo' into tap_update…
annetill Jun 21, 2024
b5e623a
Add documentation + add load tap changing capabilities in criteria.
annetill Jun 21, 2024
b3b28b7
Merge branch 'main' into tap_update_algo
annetill Jun 25, 2024
ca2c7bf
fix regression
vidaldid-rte Jun 28, 2024
7b39f5b
Merge branch 'tap_update_algo' of https://github.com/powsybl/powsybl-…
vidaldid-rte Jun 28, 2024
5323f52
Change method name.
annetill Jul 2, 2024
a161dc6
fix conflicts on parameters
vidaldid-rte Jul 2, 2024
a0e4246
Merge branch 'tap_update_algo' of https://github.com/powsybl/powsybl-…
vidaldid-rte Jul 2, 2024
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
17 changes: 17 additions & 0 deletions docs/loadflow/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,22 @@ If the user specifies only a sub-list of priorities, this sub-list is completed
order defined by default. Thus, if the user specifies only `["TRANSFORMER"]`,
it will be completed to `["TRANSFORMER", "GENERATOR", "SHUNT"]`.

**transformerVoltageControlUseInitialTapPosition**
This parameter is only used if the transformer voltage control is enabled and of mode `AFTER_GENERATOR_VOLTAGE_CONTROL`.
If this parameter is set to `true`, transformers of the same voltage control (meaning controlling the same bus) are merged
and the algorithm tries to maintain the initial difference between rhos. If the voltage at controlled bus is closed to the
target voltage at initial step of the outer loop, the algorithm blocks transformers at their initial tap positions.
The default value of this parameter is `false`.

**generatorVoltageControlMinNominalVoltage**
This parameter is only used if the transformer voltage control is enabled and of mode `AFTER_GENERATOR_VOLTAGE_CONTROL`.
In this mode, at the first step of the outer loop, the transformers that controlled voltage are disabled, only generators
are participating to voltage control. At second step, generators controlling voltage at a controlled bus above
`generatorVoltageControlMinNominalVoltage` have their voltage control disabled. This parameter overrides an automatic
detection of the minimal nominal voltage based on an analysis of nominal voltages controlled by transformers. The default
value of this parameter is $-1$: with this value the parameter is ignored and the outer loop relies only on the automatic
detection.

**fictitiousGeneratorVoltageControlCheckMode**
Specifies the active power checks exemption for fictitious generators voltage control.

Expand All @@ -410,6 +426,7 @@ The `fictitiousGeneratorVoltageControlCheckMode` option controls whether the abo

The default mode is `FORCED`.


## Configuration file example
See below an extract of a config file that could help:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ protected static Optional<AcOuterLoop> createMonitoringVoltageOuterLoop(OpenLoad
return Optional.empty();
}

protected static Optional<AcOuterLoop> createTransformerVoltageControlOuterLoop(LoadFlowParameters parameters, OpenLoadFlowParameters.TransformerVoltageControlMode controlMode,
int incrementalTransformerVoltageControlOuterLoopMaxTapShift, double generatorVoltageControlMinNominalVoltage) {
protected static Optional<AcOuterLoop> createTransformerVoltageControlOuterLoop(LoadFlowParameters parameters,
boolean useInitialTapPosition,
OpenLoadFlowParameters.TransformerVoltageControlMode controlMode,
int incrementalTransformerVoltageControlOuterLoopMaxTapShift,
double generatorVoltageControlMinNominalVoltage) {
if (parameters.isTransformerVoltageControlOn()) {
AcOuterLoop outerLoop = switch (controlMode) {
case WITH_GENERATOR_VOLTAGE_CONTROL -> new SimpleTransformerVoltageControlOuterLoop();
case AFTER_GENERATOR_VOLTAGE_CONTROL -> new TransformerVoltageControlOuterLoop(generatorVoltageControlMinNominalVoltage);
case AFTER_GENERATOR_VOLTAGE_CONTROL -> new TransformerVoltageControlOuterLoop(useInitialTapPosition, generatorVoltageControlMinNominalVoltage);
case INCREMENTAL_VOLTAGE_CONTROL -> new IncrementalTransformerVoltageControlOuterLoop(incrementalTransformerVoltageControlOuterLoopMaxTapShift);
};
return Optional.of(outerLoop);
Expand All @@ -70,6 +73,7 @@ protected static Optional<AcOuterLoop> createTransformerVoltageControlOuterLoop(

protected static Optional<AcOuterLoop> createTransformerVoltageControlOuterLoop(LoadFlowParameters parameters, OpenLoadFlowParameters parametersExt) {
return createTransformerVoltageControlOuterLoop(parameters,
parametersExt.isTransformerVoltageControlUseInitialTapPosition(),
parametersExt.getTransformerVoltageControlMode(),
parametersExt.getIncrementalTransformerRatioTapControlOuterLoopMaxTapShift(),
parametersExt.getGeneratorVoltageControlMinNominalVoltage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private static Optional<AcOuterLoop> createOuterLoop(String name, LoadFlowParame
case IncrementalShuntVoltageControlOuterLoop.NAME -> createShuntVoltageControlOuterLoop(parameters,
OpenLoadFlowParameters.ShuntVoltageControlMode.INCREMENTAL_VOLTAGE_CONTROL);
case IncrementalTransformerVoltageControlOuterLoop.NAME -> createTransformerVoltageControlOuterLoop(parameters,
parametersExt.isTransformerVoltageControlUseInitialTapPosition(),
OpenLoadFlowParameters.TransformerVoltageControlMode.INCREMENTAL_VOLTAGE_CONTROL,
parametersExt.getIncrementalTransformerRatioTapControlOuterLoopMaxTapShift(),
parametersExt.getGeneratorVoltageControlMinNominalVoltage());
Expand All @@ -56,10 +57,12 @@ private static Optional<AcOuterLoop> createOuterLoop(String name, LoadFlowParame
case ShuntVoltageControlOuterLoop.NAME -> createShuntVoltageControlOuterLoop(parameters,
OpenLoadFlowParameters.ShuntVoltageControlMode.WITH_GENERATOR_VOLTAGE_CONTROL);
case SimpleTransformerVoltageControlOuterLoop.NAME -> createTransformerVoltageControlOuterLoop(parameters,
parametersExt.isTransformerVoltageControlUseInitialTapPosition(),
OpenLoadFlowParameters.TransformerVoltageControlMode.WITH_GENERATOR_VOLTAGE_CONTROL,
parametersExt.getIncrementalTransformerRatioTapControlOuterLoopMaxTapShift(),
parametersExt.getGeneratorVoltageControlMinNominalVoltage());
case TransformerVoltageControlOuterLoop.NAME -> createTransformerVoltageControlOuterLoop(parameters,
parametersExt.isTransformerVoltageControlUseInitialTapPosition(),
OpenLoadFlowParameters.TransformerVoltageControlMode.AFTER_GENERATOR_VOLTAGE_CONTROL,
parametersExt.getIncrementalTransformerRatioTapControlOuterLoopMaxTapShift(),
parametersExt.getGeneratorVoltageControlMinNominalVoltage());
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/powsybl/openloadflow/OpenLoadFlowParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ public enum FictitiousGeneratorVoltageControlCheckMode {

public static final String VOLTAGE_TARGET_PRIORITIES_PARAM_NAME = "voltageTargetPriorities";

public static final String TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_PARAM_NAME = "transformerVoltageControlUseInitialTapPosition";

public static final String GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_PARAM_NAME = "generatorVoltageControlMinNominalVoltage";

public static final String FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE = "fictitiousGeneratorVoltageControlCheckMode";
Expand Down Expand Up @@ -331,6 +333,7 @@ public static <E extends Enum<E>> List<Object> getEnumPossibleValues(Class<E> en
new Parameter(REFERENCE_BUS_SELECTION_MODE_PARAM_NAME, ParameterType.STRING, "Reference bus selection mode", ReferenceBusSelector.DEFAULT_MODE.name(), getEnumPossibleValues(ReferenceBusSelectionMode.class)),
new Parameter(WRITE_REFERENCE_TERMINALS_PARAM_NAME, ParameterType.BOOLEAN, "Write Reference Terminals", WRITE_REFERENCE_TERMINALS_DEFAULT_VALUE),
new Parameter(VOLTAGE_TARGET_PRIORITIES_PARAM_NAME, ParameterType.STRING_LIST, "Voltage target priorities for voltage controls", LfNetworkParameters.VOLTAGE_CONTROL_PRIORITIES_DEFAULT_VALUE, getEnumPossibleValues(VoltageControl.Type.class)),
new Parameter(TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_PARAM_NAME, ParameterType.BOOLEAN, "Maintain initial tap position if possible", LfNetworkParameters.TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_DEFAULT_VALUE),
new Parameter(GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_PARAM_NAME, ParameterType.DOUBLE, "Nominal voltage under which generator voltage controls are disabled during transformer voltage control outer loop of mode AFTER_GENERATOR_VOLTAGE_CONTROL, < 0 means automatic detection", OpenLoadFlowParameters.GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_DEFAULT_VALUE),
new Parameter(FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE, ParameterType.STRING, "Specifies fictitious generators active power checks exemption for voltage control", OpenLoadFlowParameters.FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE_DEFAULT_VALUE.name(), getEnumPossibleValues(FictitiousGeneratorVoltageControlCheckMode.class))
);
Expand Down Expand Up @@ -504,6 +507,8 @@ public enum ReactiveRangeCheckMode {

private List<String> voltageTargetPriorities = LfNetworkParameters.VOLTAGE_CONTROL_PRIORITIES_DEFAULT_VALUE;

private boolean transformerVoltageControlUseInitialTapPosition = LfNetworkParameters.TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_DEFAULT_VALUE;

private double generatorVoltageControlMinNominalVoltage = GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_DEFAULT_VALUE;

private FictitiousGeneratorVoltageControlCheckMode fictitiousGeneratorVoltageControlCheckMode = FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE_DEFAULT_VALUE;
Expand Down Expand Up @@ -1172,6 +1177,15 @@ public OpenLoadFlowParameters setVoltageTargetPriorities(List<String> voltageTar
return this;
}

public boolean isTransformerVoltageControlUseInitialTapPosition() {
return transformerVoltageControlUseInitialTapPosition;
}

public OpenLoadFlowParameters setTransformerVoltageControlUseInitialTapPosition(boolean transformerVoltageControlUseInitialTapPosition) {
this.transformerVoltageControlUseInitialTapPosition = transformerVoltageControlUseInitialTapPosition;
return this;
}

/**
* Only if transformer voltage control is active and with mode `AFTER_GENERATOR_VOLTAGE_CONTROL`. Set the nominal
* voltage under which the generator voltage control are disabled during outer loop. This parameter overrides the
Expand Down Expand Up @@ -1269,6 +1283,7 @@ public static OpenLoadFlowParameters load(PlatformConfig platformConfig) {
.setReferenceBusSelectionMode(config.getEnumProperty(REFERENCE_BUS_SELECTION_MODE_PARAM_NAME, ReferenceBusSelectionMode.class, ReferenceBusSelector.DEFAULT_MODE))
.setWriteReferenceTerminals(config.getBooleanProperty(WRITE_REFERENCE_TERMINALS_PARAM_NAME, WRITE_REFERENCE_TERMINALS_DEFAULT_VALUE))
.setVoltageTargetPriorities(config.getStringListProperty(VOLTAGE_TARGET_PRIORITIES_PARAM_NAME, LfNetworkParameters.VOLTAGE_CONTROL_PRIORITIES_DEFAULT_VALUE))
.setTransformerVoltageControlUseInitialTapPosition(config.getBooleanProperty(TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_PARAM_NAME, LfNetworkParameters.TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_DEFAULT_VALUE))
.setGeneratorVoltageControlMinNominalVoltage(config.getDoubleProperty(GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_PARAM_NAME, GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_DEFAULT_VALUE)));
return parameters;
}
Expand Down Expand Up @@ -1418,6 +1433,8 @@ public OpenLoadFlowParameters update(Map<String, String> properties) {
.ifPresent(prop -> this.setWriteReferenceTerminals(Boolean.parseBoolean(prop)));
Optional.ofNullable(properties.get(VOLTAGE_TARGET_PRIORITIES_PARAM_NAME))
.ifPresent(prop -> this.setVoltageTargetPriorities(parseStringListProp(prop)));
Optional.ofNullable(properties.get(TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_PARAM_NAME))
.ifPresent(prop -> this.setTransformerVoltageControlUseInitialTapPosition(Boolean.parseBoolean(prop)));
Optional.ofNullable(properties.get(GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_PARAM_NAME))
.ifPresent(prop -> this.setGeneratorVoltageControlMinNominalVoltage(Double.parseDouble(prop)));
Optional.ofNullable(properties.get(FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE))
Expand Down Expand Up @@ -1492,6 +1509,7 @@ public Map<String, Object> toMap() {
map.put(REFERENCE_BUS_SELECTION_MODE_PARAM_NAME, referenceBusSelectionMode);
map.put(WRITE_REFERENCE_TERMINALS_PARAM_NAME, writeReferenceTerminals);
map.put(VOLTAGE_TARGET_PRIORITIES_PARAM_NAME, voltageTargetPriorities);
map.put(TRANSFORMER_VOLTAGE_CONTROL_USE_INITIAL_TAP_POSITION_PARAM_NAME, transformerVoltageControlUseInitialTapPosition);
map.put(GENERATOR_VOLTAGE_CONTROL_MIN_NOMINAL_VOLTAGE_PARAM_NAME, generatorVoltageControlMinNominalVoltage);
map.put(FICTITIOUS_GENERATOR_VOLTAGE_CONTROL_CHECK_MODE, fictitiousGeneratorVoltageControlCheckMode);
return map;
Expand Down Expand Up @@ -1870,6 +1888,7 @@ public static boolean equals(LoadFlowParameters parameters1, LoadFlowParameters
extension1.getMaxSusceptanceMismatch() == extension2.getMaxSusceptanceMismatch() &&
extension1.getNewtonRaphsonStoppingCriteriaType() == extension2.getNewtonRaphsonStoppingCriteriaType() &&
Objects.equals(extension1.getVoltageTargetPriorities(), extension2.getVoltageTargetPriorities()) &&
extension1.isTransformerVoltageControlUseInitialTapPosition() == extension2.isTransformerVoltageControlUseInitialTapPosition() &&
extension1.getGeneratorVoltageControlMinNominalVoltage() == extension2.getGeneratorVoltageControlMinNominalVoltage() &&
extension1.getFictitiousGeneratorVoltageControlCheckMode() == extension2.getFictitiousGeneratorVoltageControlCheckMode();
}
Expand Down Expand Up @@ -1962,6 +1981,7 @@ public static LoadFlowParameters clone(LoadFlowParameters parameters) {
.setNewtonRaphsonStoppingCriteriaType(extension.getNewtonRaphsonStoppingCriteriaType())
.setReferenceBusSelectionMode(extension.getReferenceBusSelectionMode())
.setVoltageTargetPriorities(extension.getVoltageTargetPriorities())
.setTransformerVoltageControlUseInitialTapPosition(extension.isTransformerVoltageControlUseInitialTapPosition())
.setGeneratorVoltageControlMinNominalVoltage(extension.getGeneratorVoltageControlMinNominalVoltage())
.setFictitiousGeneratorVoltageControlCheckMode(extension.getFictitiousGeneratorVoltageControlCheckMode());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/
package com.powsybl.openloadflow.ac.outerloop;

import com.powsybl.openloadflow.ac.AcOuterLoopContext;
import com.powsybl.openloadflow.lf.outerloop.OuterLoopStatus;
import com.powsybl.openloadflow.network.LfBranch;
import com.powsybl.openloadflow.network.LfNetwork;
import com.powsybl.openloadflow.network.PiModel;
import com.powsybl.openloadflow.network.TransformerVoltageControl;
import com.powsybl.openloadflow.network.VoltageControl;
Expand All @@ -32,9 +32,9 @@ public String getType() {
return TYPE;
}

protected OuterLoopStatus roundVoltageRatios(AcOuterLoopContext context) {
protected OuterLoopStatus roundVoltageRatios(LfNetwork network) {
OuterLoopStatus status = OuterLoopStatus.STABLE;
for (LfBranch controllerBranch : context.getNetwork().<LfBranch>getControllerElements(VoltageControl.Type.TRANSFORMER)) {
for (LfBranch controllerBranch : network.<LfBranch>getControllerElements(VoltageControl.Type.TRANSFORMER)) {
controllerBranch.setVoltageControlEnabled(false);

// round the rho shift to the closest tap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void initialize(AcOuterLoopContext context) {
public OuterLoopResult check(AcOuterLoopContext context, ReportNode reportNode) {
OuterLoopStatus status = OuterLoopStatus.STABLE;
if (context.getIteration() == 0) {
status = roundVoltageRatios(context);
status = roundVoltageRatios(context.getNetwork());
}
return new OuterLoopResult(this, status);
}
Expand Down
Loading