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

Add parameter to output flow decomposition results for paired dangling lines #162

Closed
wants to merge 14 commits into from

Conversation

caioluke
Copy link
Member

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

Feature

What is the current behavior?

As of today, it is not possible to have flow decomposition results for each half line (paired dangling line) of a tie line.

What is the new behavior (if this is a feature change)?
A new flow decomposition parameter (boolean - enableResultsForPairedHalfLines) will allow to produce flow decomposition results for these paired half lines.

Does this PR introduce a breaking change or deprecate an API?

  • Yes
  • No

@caioluke caioluke self-assigned this Sep 24, 2024
@caioluke
Copy link
Member Author

@OpenSuze if you validate the idea (adding a flow decomposition parameter), I will add some docs!

allocatedAndLoopFlowsMatrix.toMap()
.forEach((branchId, decomposedFlow) -> {
String xnecId = DecomposedFlow.getXnecId(contingencyId, branchId);
decomposedFlowMap.put(xnecId, createDecomposedFlow(branchId, decomposedFlow, decomposedFlowRescaler, network));
if (!enableResultsForPairedHalfLine) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a test on enableResultsForPairedHalfLine and the rest of the code inside instead of testing !enableResultsForPairedHalfLine and returning is easier on the reader.

if (!enableResultsForPairedHalfLine) {
return acTerminalReferenceFlows;
}
xnecList.stream().filter(TieLine.class::isInstance).forEach(xnec -> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few process are duplicated code here, maybe use functions to make it more readable.

Signed-off-by: Caio Luke <[email protected]>
Copy link
Contributor

@OpenSuze OpenSuze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR !
Sorry for the delay

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the XnecProvider interface instead of adding a new parameter please ?

For example, when using XnecProviderByIds with a dangling line Id, the results should contain a DecomposedFlow for this Id.

This will require to ensure that the dangling line is paired (to find the corresponding tie line) because flow decomposition on an unpaired dangling line does not make sense for me (no loop flow).

Maybe, you could provide a new XnecProvider implementation called XnecProviderAllPairedDanglingLines

Copy link

sonarcloud bot commented Oct 16, 2024

@caioluke
Copy link
Member Author

After some discussion in this similar PR, I understand that having different flow decompositions for paired dangling lines makes no sense.
Thanks for the help!

@caioluke caioluke closed this Oct 28, 2024
@caioluke caioluke deleted the decomposed_flow_for_dangling_lines branch October 28, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants