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

Split collecting subnetwork demand into internal sources and main network phases #1235

Merged
merged 39 commits into from
Apr 2, 2024

Conversation

SouthEndMusic
Copy link
Collaborator

Fixes #1207.

@SouthEndMusic SouthEndMusic marked this pull request as draft March 12, 2024 13:44
@SouthEndMusic
Copy link
Collaborator Author

SouthEndMusic commented Mar 13, 2024

To do:

  • Add an @assert within allocate! to make sure that for the main network only OptimizationType.allocate is used;
  • Add set_initial_demands_level! and adjust_demands_level! analogous to those for user demand (this eventually also has to be done for flow demand);
  • Make sure the optimization types are properly handled in all functions called within allocate!;
  • Make sure when using OptimizationType.collect_demands, the used demands within the subnetwork are those reduced by what is allocated for OptimizationType.internal_sources;
  • Update docstrings;
  • Update documentation
  • Add tests for reduced subnetwork demands when the subnetworks have internal sources with a modified version of the main_network_with_subnetworks model

@test subnetwork_demands[(NodeID(:Basin, 2), NodeID(:Pump, 11))] ≈ [4.0, 4.0, 0.0]
@test subnetwork_demands[(NodeID(:Basin, 6), NodeID(:Pump, 24))] ≈ [0.004, 0.0, 0.0]
@test subnetwork_demands[(NodeID(:Basin, 10), NodeID(:Pump, 38))] ≈
[0.001, 0.002, 0.0011]
@test subnetwork_demands[(NodeID(:Basin, 10), NodeID(:Pump, 38))][1:2] ≈ [0.001, 0.002]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For an explanation of why I removed testing the last value of this vector see #1327.

@SouthEndMusic SouthEndMusic requested a review from visr March 27, 2024 09:31
@SouthEndMusic SouthEndMusic marked this pull request as ready for review March 27, 2024 09:34
docs/core/allocation.qmd Outdated Show resolved Hide resolved
docs/core/allocation.qmd Outdated Show resolved Hide resolved
docs/core/allocation.qmd Outdated Show resolved Hide resolved
docs/core/allocation.qmd Outdated Show resolved Hide resolved
core/src/solve.jl Outdated Show resolved Hide resolved
SouthEndMusic and others added 6 commits April 2, 2024 08:53
Co-authored-by: Martijn Visser <mgvisser@gmail.com>
Co-authored-by: Martijn Visser <mgvisser@gmail.com>
Co-authored-by: Martijn Visser <mgvisser@gmail.com>
@SouthEndMusic SouthEndMusic merged commit 5974e08 into main Apr 2, 2024
24 checks passed
@SouthEndMusic SouthEndMusic deleted the better_subnetwork_demand_collection branch April 2, 2024 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Take source preference into account when collecting subnetwork demands
2 participants