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

Introduce flat demand vector and expose via BMI #1081

Merged
merged 3 commits into from
Feb 8, 2024

Conversation

SouthEndMusic
Copy link
Collaborator

Fixes #893.

@SouthEndMusic SouthEndMusic requested a review from visr February 6, 2024 15:30
@SouthEndMusic SouthEndMusic marked this pull request as draft February 6, 2024 15:30
@SouthEndMusic SouthEndMusic marked this pull request as ready for review February 8, 2024 10:03
core/src/create.jl Outdated Show resolved Hide resolved
core/src/create.jl Outdated Show resolved Hide resolved
Comment on lines +1286 to +1298
function get_user_demand(user::User, node_id::NodeID, priority_idx::Int)::Float64
(; demand) = user
user_idx = findsorted(user.node_id, node_id)
n_priorities = length(user.priorities)
return demand[(user_idx - 1) * n_priorities + priority_idx]
end

function set_user_demand!(
user::User,
node_id::NodeID,
priority_idx::Int,
value::Float64,
)::Nothing
Copy link
Member

Choose a reason for hiding this comment

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

Could use tests.

Comment on lines +684 to +685
elseif name == "demand"
model.integrator.p.demand
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to add a test on the ribasim_api side.

@SouthEndMusic SouthEndMusic merged commit ab16c9a into main Feb 8, 2024
21 checks passed
@SouthEndMusic SouthEndMusic deleted the expose_user_demands branch February 8, 2024 12:49
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.

Extend and exposing user demands for coupling with MetaSWAP
3 participants