From bc9eeaec4e5f4d0b54d981a1b9e48acfbd98e800 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Tue, 3 Dec 2024 14:59:01 +0100 Subject: [PATCH] Comments adressed --- core/src/callback.jl | 5 ++++- core/src/read.jl | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/callback.jl b/core/src/callback.jl index cda123cff..467e71060 100644 --- a/core/src/callback.jl +++ b/core/src/callback.jl @@ -802,11 +802,14 @@ function update_allocation!(integrator)::Nothing end # Reset the mean flows - for mean_flows in (mean_input_flows..., mean_realized_flows) + for mean_flows in mean_input_flows for edge in keys(mean_flows) mean_flows[edge] = 0.0 end end + for edge in keys(mean_realized_flows) + mean_realized_flows[edge] = 0.0 + end end "Load updates from 'TabulatedRatingCurve / time' into the parameters" diff --git a/core/src/read.jl b/core/src/read.jl index 17e020b78..e99d207e0 100644 --- a/core/src/read.jl +++ b/core/src/read.jl @@ -1283,8 +1283,11 @@ function Allocation(db::DB, config::Config, graph::MetaGraph)::Allocation id_source, _ = edge if id_source.type in boundary_source_nodetypes (; subnetwork_id) = graph[id_source] - subnetwork_idx = searchsortedfirst(subnetwork_ids, subnetwork_id) - mean_input_flows[subnetwork_idx][edge] = 0.0 + # Check whether the source node is part of a subnetwork + if subnetwork_id ≠ 0 + subnetwork_idx = searchsortedfirst(subnetwork_ids, subnetwork_id) + mean_input_flows[subnetwork_idx][edge] = 0.0 + end end end