-
Notifications
You must be signed in to change notification settings - Fork 8
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
Disable switch without removing variables #455
Merged
Merged
Changes from 26 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
1fb6021
Refactor phase control update
geofjamg 03114f0
Next
geofjamg 1879aec
Next
geofjamg ca2a056
Next
geofjamg df0beba
Next
geofjamg c0edcaa
Next
geofjamg 101c958
Next
geofjamg 10ea1f1
Next
geofjamg dcc9572
Merge branch 'main' into remove_equation_util2
geofjamg d4e9a1f
Merge branch 'main' into remove_equation_util2
geofjamg d83164a
Fix merge
geofjamg 0f50dd6
Refactoring
geofjamg 8f46e05
Remove FIXME
geofjamg 6852c30
Fix
geofjamg a1c4743
Merge branch 'main' into remove_equation_util2
geofjamg cabac5b
Merge branch 'main' into remove_equation_util2
geofjamg 15b5dc6
Switch open refactoring
geofjamg 6ad190e
Keep same variables when opening/closing the switch
geofjamg d57117f
Add comments
geofjamg b1a6cdb
Merge branch 'main' into switch_open
geofjamg 746065e
Merge branch 'main' into switch_open
geofjamg c0b7e9c
Fix
geofjamg f1284aa
Refactor
geofjamg 1cdddae
Merge branch 'main' into switch_open
geofjamg 1a0db00
Merge branch 'main' into switch_open
geofjamg f5c4c66
Fix merge
geofjamg 7c365c2
Merge.
annetill File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
63 changes: 63 additions & 0 deletions
63
src/test/java/com/powsybl/openloadflow/ac/NonImpedantBranchDisablingTest.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,63 @@ | ||
/** | ||
* Copyright (c) 2022, 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.iidm.network.Network; | ||
import com.powsybl.loadflow.LoadFlowParameters; | ||
import com.powsybl.math.matrix.DenseMatrixFactory; | ||
import com.powsybl.openloadflow.OpenLoadFlowParameters; | ||
import com.powsybl.openloadflow.ac.outerloop.AcLoadFlowContext; | ||
import com.powsybl.openloadflow.ac.outerloop.AcLoadFlowParameters; | ||
import com.powsybl.openloadflow.ac.outerloop.AcloadFlowEngine; | ||
import com.powsybl.openloadflow.graph.EvenShiloachGraphDecrementalConnectivityFactory; | ||
import com.powsybl.openloadflow.network.LfNetwork; | ||
import com.powsybl.openloadflow.network.NameSlackBusSelector; | ||
import com.powsybl.openloadflow.network.NodeBreakerNetworkFactory; | ||
import com.powsybl.openloadflow.network.impl.LfNetworkLoaderImpl; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* @author Geoffroy Jamgotchian <geoffroy.jamgotchian at rte-france.com> | ||
*/ | ||
class NonImpedantBranchDisablingTest { | ||
|
||
@Test | ||
void test() { | ||
Network network = NodeBreakerNetworkFactory.create(); | ||
network.getSwitch("B3").setRetained(false); | ||
network.getSwitch("C").setRetained(true); | ||
AcLoadFlowParameters parameters = OpenLoadFlowParameters.createAcParameters(new LoadFlowParameters(), | ||
new OpenLoadFlowParameters(), | ||
new DenseMatrixFactory(), | ||
new EvenShiloachGraphDecrementalConnectivityFactory<>(), | ||
Reporter.NO_OP, | ||
true, | ||
false); | ||
parameters.getNetworkParameters().setSlackBusSelector(new NameSlackBusSelector("VL1_1")); | ||
LfNetwork lfNetwork = LfNetwork.load(network, new LfNetworkLoaderImpl(), parameters.getNetworkParameters()).get(0); | ||
|
||
try (AcLoadFlowContext context = new AcLoadFlowContext(lfNetwork, parameters)) { | ||
var engine = new AcloadFlowEngine(context); | ||
engine.run(); | ||
assertEquals(8, context.getEquationSystem().getSortedVariablesToFind().size()); | ||
var l1 = lfNetwork.getBranchById("L1"); | ||
var l2 = lfNetwork.getBranchById("L2"); | ||
assertEquals(3.01884, l1.getP1().eval(), 10e-5); | ||
assertEquals(3.01884, l2.getP1().eval(), 10e-5); | ||
|
||
lfNetwork.getBranchById("C").setDisabled(true); | ||
|
||
engine.run(); | ||
assertEquals(8, context.getEquationSystem().getSortedVariablesToFind().size()); // we have kept same variables!!! | ||
assertEquals(0, l1.getP1().eval(), 10e-5); | ||
assertEquals(6.07782, l2.getP1().eval(), 10e-5); | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impedendant?