-
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
Compute reference active power flows for sensitivity analysis #206
Conversation
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
438e157
to
2d924e3
Compare
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
…s within the main component Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
src/main/java/com/powsybl/openloadflow/network/util/ActivePowerDistribution.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/network/util/ActivePowerDistribution.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
…alization when having successive contingencies Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
fd67e6b
to
c114a33
Compare
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
But this could be solved by a pre-check on sensi DC side and keep the utility class generic |
src/main/java/com/powsybl/openloadflow/network/util/ActivePowerDistribution.java
Outdated
Show resolved
Hide resolved
src/main/java/com/powsybl/openloadflow/network/util/GenerationActionPowerDistributionStep.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
src/main/java/com/powsybl/openloadflow/network/util/GenerationActionPowerDistributionStep.java
Outdated
Show resolved
Hide resolved
DcLoadFlowParameters dcLoadFlowParameters = new DcLoadFlowParameters(lfParametersExt.getSlackBusSelector(), matrixFactory, | ||
true, lfParametersExt.isDcUseTransformerRatio(), lfParameters.isDistributedSlack(), lfParameters.getBalanceType()); | ||
DcLoadFlowResult dcLoadFlowResult = new DcLoadFlowEngine(lfNetworks, dcLoadFlowParameters).run(); | ||
private GraphDecrementalConnectivity<LfBus> createConnectivity(LfNetwork lfNetwork) { |
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.
@floriand-e2r Can you move this function to a network util class ?
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.
I've put it in LfNetwork directly (similarly to createZeroImpedanceSubGraph()
)
Map<LfBus, BusState> busStates = new HashMap<>(); | ||
if (lfParameters.isDistributedSlack()) { | ||
double mismatch; | ||
if (connectivity != null) { |
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.
@floriand-e2r we have to think about making this "common".
src/main/java/com/powsybl/openloadflow/sensi/DcSensitivityAnalysis.java
Outdated
Show resolved
Hide resolved
participatingElements = step.getParticipatingElements(lfNetwork); | ||
ParticipatingElement.normalizeParticipationFactors(participatingElements, "bus"); | ||
return participatingElements; | ||
return getParticipatingElements(lfNetwork, loadFlowParameters, element -> true); |
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.
I am not sure to get the aim of this function...
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.
It allows you to get the normalized participating elements
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.
Indeed I get it, it is to filter. Now, you have on bus a boolean on bus isDisabled
. Do you think that it is possible to use that attribute to deal with connectivity? Then it will update the participating elements.
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.
It is possible to use the isDisabled attribute, but it less efficient.
To use the isDisabled parameter, I think we would need to:
- Save all the buses states
- Go through all the buses and disconnect the one that needs to be disconnected
- Go through all the buses to get the non-disconnected participating elements
- Restore all the buses states
With the current filtering in the DC getParticipatingElements, we are just doing:
- Go through all the buses to get participating elements and get the one in the right connected component
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.
I was thinking about save the state of the bus that initial contains a participating element. Then, you disabled those that are not in the main connected component of this connectivity. Then, you can use the classical getParticipatingElements. Then you restore the buses that initially contain participating element. It is just to ensure coherence in the code, but it is not a bit deal.
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
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.
I first thought that you needed a change in GraphDecrementalConnectivity
to simplify your connectivity code, but in fact you can use getSmallComponents()
instead of getComponentNumber()
almost everywhere, if not everywhere. There is two places where I'm not so sure about that:
areVariableAndFunctionDisconnected()
: do you really need to know if variable and function are in two distinct "small" connected components?getElementsToReconnect()
: I don't think we can avoid usinggetComponentNumber()
, do you agree on that?
Why am I trying to make those changes? Because in implementations of decremental connectivity the getComponentNumber needs some additional time to compute the map giving the number from the vertex.
// set buses injections and transformers to 0 outside the main connected component | ||
int mainComponentNumber = connectivity.getComponentNumber(network.getSlackBus()); | ||
List<Integer> columnsToSetToZero = network.getBuses().stream() | ||
.filter(lfBus -> connectivity.getComponentNumber(lfBus) != mainComponentNumber) |
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.
To get the buses which are not in the main component you should use directly connectivity.getSmallComponents()
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.
Unfortunately, I think getSmallComponents() returns the smallest components in size, but it has nothing to do with the slack bus (the slack could be in a small component). What I want here are the buses that are not in the same component than the slack bus.
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.
lfFactors.forEach(factor -> factor.setPredefinedResult(null)); | ||
cutConnectivity(lfNetwork, connectivity.getConnectivity(), breakingConnectivityCandidates); | ||
cutConnectivity(lfNetwork, connectivity, breakingConnectivityCandidates); | ||
int mainComponent = connectivity.getComponentNumber(lfNetwork.getSlackBus()); |
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.
Always equal to 0
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.
See previous comment, I am not sure about this
// check if the factor function and variable are in different connected components | ||
if (factor.areVariableAndFunctionDisconnected(connectivity)) { | ||
factor.setPredefinedResult(0d); | ||
} else if (!factor.isConnectedToComponent(mainComponent, connectivity)) { |
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.
You always call isConnectedToComponent
with mainComponent, so in fact you could rename it to isConnectedToMaintComponent
and use getSmallComponents()
instead of getComponentNumber()
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.
See previous conversation
Signed-off-by: Anne Tilloy <anne.tilloy@rte-france.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
…or get branch Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
547ce9a
to
2b53ee1
Compare
…not need to set alpha 1 to 0 Signed-off-by: Gael Macherel <gael.macherel@artelys.com>
Kudos, SonarCloud Quality Gate passed! |
Signed-off-by: Gael Macherel gael.macherel@artelys.com
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the rest#205