-
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.
Transformer voltage control outer loop after generator control mode (#…
…439) Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com> Signed-off-by: Geoffroy Jamgotchian <geoffroy.jamgotchian@gmail.com>
- Loading branch information
Showing
8 changed files
with
208 additions
and
34 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
51 changes: 51 additions & 0 deletions
51
src/main/java/com/powsybl/openloadflow/ac/AbstractTransformerVoltageControlOuterLoop.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,51 @@ | ||
/** | ||
* Copyright (c) 2020, 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/. | ||
*/ | ||
package com.powsybl.openloadflow.ac; | ||
|
||
import com.powsybl.openloadflow.ac.outerloop.OuterLoop; | ||
import com.powsybl.openloadflow.ac.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 org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* @author Anne Tilloy <anne.tilloy at rte-france.com> | ||
*/ | ||
public abstract class AbstractTransformerVoltageControlOuterLoop implements OuterLoop { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTransformerVoltageControlOuterLoop.class); | ||
|
||
protected OuterLoopStatus roundVoltageRatios(LfNetwork network) { | ||
OuterLoopStatus status = OuterLoopStatus.STABLE; | ||
for (LfBranch branch : network.getBranches()) { | ||
TransformerVoltageControl voltageControl = branch.getVoltageControl().orElse(null); | ||
if (voltageControl != null) { | ||
branch.setVoltageControlEnabled(false); | ||
|
||
// round the rho shift to the closest tap | ||
PiModel piModel = branch.getPiModel(); | ||
double r1Value = piModel.getR1(); | ||
piModel.roundR1ToClosestTap(); | ||
double roundedR1Value = piModel.getR1(); | ||
LOGGER.trace("Round voltage ratio of '{}': {} -> {}", branch.getId(), r1Value, roundedR1Value); | ||
|
||
status = OuterLoopStatus.UNSTABLE; | ||
} | ||
} | ||
return status; | ||
} | ||
|
||
@Override | ||
public void cleanup(LfNetwork network) { | ||
for (LfBranch branch : network.getBranches()) { | ||
branch.getVoltageControl().ifPresent(voltageControl -> branch.setVoltageControlEnabled(true)); | ||
} | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
src/main/java/com/powsybl/openloadflow/ac/SimpleTransformerVoltageControlOuterLoop.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,31 @@ | ||
/** | ||
* Copyright (c) 2020, 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/. | ||
*/ | ||
package com.powsybl.openloadflow.ac; | ||
|
||
import com.powsybl.commons.reporter.Reporter; | ||
import com.powsybl.openloadflow.ac.outerloop.OuterLoopContext; | ||
import com.powsybl.openloadflow.ac.outerloop.OuterLoopStatus; | ||
|
||
/** | ||
* @author Anne Tilloy <anne.tilloy at rte-france.com> | ||
*/ | ||
public class SimpleTransformerVoltageControlOuterLoop extends AbstractTransformerVoltageControlOuterLoop { | ||
|
||
@Override | ||
public String getType() { | ||
return "Simple transformer voltage control"; | ||
} | ||
|
||
@Override | ||
public OuterLoopStatus check(OuterLoopContext context, Reporter reporter) { | ||
OuterLoopStatus status = OuterLoopStatus.STABLE; | ||
if (context.getIteration() == 0) { | ||
status = roundVoltageRatios(context.getNetwork()); | ||
} | ||
return status; | ||
} | ||
} |
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