Skip to content

Commit

Permalink
Implement zero loss fix of PR pywr#266
Browse files Browse the repository at this point in the history
  • Loading branch information
s-simoncelli committed Oct 10, 2024
1 parent 40e1fcd commit 8191e31
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pywr-schema/src/nodes/river.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ impl RiverNode {
) -> Result<(), SchemaError> {
if let Some(loss_factor) = &self.loss_factor {
let factors = loss_factor.load(network, args)?;
if factors.is_none() {
// Loaded a constant zero factor; ensure that the loss node has zero flow
network.set_node_max_flow(self.meta.name.as_str(), Self::loss_node_sub_name(), Some(0.0.into()))?;
}
network.set_aggregated_node_relationship(self.meta.name.as_str(), Self::agg_sub_name(), factors)?;
}

Expand Down

0 comments on commit 8191e31

Please sign in to comment.