WaterStrategy
English
English
  • WaterStrategy Documentation
  • Support
  • Getting Started
    • Creating an Account
    • Logging In
    • Tour of WaterStrategy
    • Creating a new Project and Network
    • Sharing Projects and Networks
    • Exporting and Importing Models
    • Dealing with Model Errors
    • Uploading External Data
  • Modeling Basics
    • Water Resource System Modeling?
    • What is Pywr?
    • Pywr Concepts
    • Node Types
      • Water Input
        • Input Node
        • Catchment Node
        • Proportional Input Node
      • Water Transport
        • Link Node
        • River Node
        • Delay Node
        • RiverSplit Node
        • RiverSplitWithGauge Node
        • RiverGauge Node
        • BreakLink Node
        • PiecewiseLink Node
        • MultiSplitLink Node
      • Water Storage
        • Storage Node
        • Reservoir Node
        • VirtualStorage Node
        • RollingVirtualStorage Node
        • AnnualVirtualStorage Node
        • SeasonalVirtualStorage Node
        • AggregatedStorage Node
      • Water Output
        • Output Node
        • Loss Link Node
      • Hydropower
        • Turbine Node
      • Others
        • AggregatedNode
    • Allocation Penalties
    • Scenarios
      • WaterStrategy Scenarios
      • Pywr-Scenarios
        • Parameter and pywr-scenario Integration
    • Parameters
      • Base Parameter Class
        • Parameter
        • IndexParameter
      • Simple Parameters
        • Constant
        • Constant Scenario Parameter
        • Constant Scenario Index Parameter
      • Combining multiple parameters
        • Aggregated Parameter
        • Aggregated Index Parameter
        • Division Parameter
        • Negative Parameter
        • MaxParameter
        • Negative MaxParameter
        • MinParameter
        • Negative MinParameter
        • Offset Parameter
      • Time Series and Profiles
        • Daily Profile
        • Weekly Profile
        • Monthly Profile
        • Uniform Drawdown Profile
        • Scenario Daily Profile
        • Scenario Weekly Profile
        • Scenario Monthly Profile
        • Array Indexed Scenario Monthly Factors
        • RBF Profile
      • DataFrame Parameter
      • HDF5 Parameter
      • Array Based Parameters
        • Array Indexed Parameter
        • Array Indexed Scenario Parameter
        • Indexed Array Parameter
      • Threshold Parameters
        • Abstract Threshold
        • Storage Threshold
        • Node Threshold
        • Parameter Threshold
        • Recorder Threshold
        • Current Year Threshold
        • Current Ordinal Day Threshold
      • Interpolation Parameters
        • Interpolated Parameter
        • Interpolated Quadrature
        • Interpolated Flow
        • Interpolated Volume
      • Control Curve Parameters
        • Base Control Curve
        • Control Curve Interpolated Parameter
        • Control Curve Piecewise Interpolated Parameter
        • Control Curve Index Parameter
      • Hydropower Parameters
      • Others
        • Annual Harmonic Series Parameter
        • Deficit Parameter
        • Scenario Wrapper Parameter
        • Piecewise Integral Parameter
        • Flow Parameter
        • Flow Delay Parameter
        • Discount Factor Parameter
    • Recorders
      • Base Recorder
        • Recorder
        • Node Recorder
        • Storage Recorder
        • Parameter Recorder
        • Index Parameter Recorder
        • Aggregator
      • Numpy Array Recorders
        • Numpy Array Node Recorder
        • Numpy Array Storage Recorder
        • Numpy Array Level Recorder
        • Numpy Array Area Recorder
        • Numpy Array Parameter Recorder
        • Numpy Array Index Parameter Recorder
        • Numpy Array Daily Profile Parameter Recorder
      • Flow Duration Curve Recorders
        • Flow Duration Curve Recorder
        • Storage Duration Curve Recorder
        • Flow Duration Curve Deviation Recorder
        • Seasonal Flow Duration Curve Recorder
      • Deficit Recorders
        • Numpy Array Node Deficit Recorder
        • Numpy Array Node Supplied Ratio Recorder
        • Numpy Array Node Curtailment Ratio Recorder
        • Total Deficit Node Recorder
        • Deficit Frequency Node Recorder
      • Statistical Recorders
        • Aggregated Recorder
        • Mean Flow Node Recorder
        • Total Flow Node Recorder
        • Annual Total Flow Recorder
        • Mean Parameter Recorder
        • Total Parameter Recorder
        • Rolling Mean Flow Node Recorder
        • Minimum Volume Storage Recorder
        • Minimum Threshold Volume Storage Recorder
        • Timestep Count Index Parameter Recorder
        • Annual Count Index Threshold Recorder
        • Rolling Window Parameter Recorder
      • Index Recorders
        • Annual Count Index Parameter Recorder
      • File Recorders
        • CSV Recorder
        • Tables Recorder
      • Hydro-power Recorders
        • Hydropower Recorder
        • Total Hydro Energy Recorder
  • Applied Modeling
    • Reservoir and Storage Nodes
  • Tutorials
    • Creating and running a simple model
      • Creating and Running a Model
        • Setting up a Project and Network
        • Adding Nodes and Links (Edges)
        • Add Data to the Nodes
        • Setting the Time Horizon
        • Running the Model and Visualizing its Outputs
        • Creating a New Scenario
        • Exercise
      • Making Changes to a Model
        • Adding a Reservoir
        • Adding Basic Operating Rules
    • Modelling basin reservoir systems
      • Creating a New Project and Network
      • Adding a Dam (Reservoir)
      • Adding a Demand
      • Adding a Water Treatment Works with Losses
      • Adding a Source Representing Groundwater
      • Additional Exercises
      • Adding reservoir bathymetry, evaporation, and rainfall
        • Background on Evaporation and Precipitation on Reservoirs
        • Adding reservoir bathymetry (Area)
        • Adding reservoir bathymetry (Level)
        • Adding monthly evaporation and rainfall
      • Using allocation penalties and control rules to balance sources
      • Control Curves and Demand Savings
        • Adding reservoir control curves and demand savings (reductions)
    • Using Allocation Penalties to Allocate Water
      • Exercise 1a Two nodes
      • Exercise 1b Two demands
      • Exercise 1c Minimum Flow Properties
      • Exercise 2a Simple system with reservoir draw downs
      • Exercise 2b Simple system with overflow
    • Pywr-scenarios reading external DataFrame and adding Custom Rules
      • Uploading Files
      • Reading CSV DataFrame
      • Running pywr-scenarios
      • Reading h5 DataFrame for pywr-scenarios
      • Create Custom Rule - TranscientDecisionParameter
Powered by GitBook
On this page
  • Node
  • Edge
  • Constraint
  • Allocation Penalty or 'Cost'
  • Parameter
  • Recorder
  • Scenario

Was this helpful?

Export as PDF
  1. Modeling Basics

Pywr Concepts

Key terms used in Pywr.

PreviousWhat is Pywr?NextNode Types

Last updated 7 months ago

Was this helpful?

Pywr, a Python library used by WaterStrategy, enables simulating resource allocation by representing a resource system as a network using 'Nodes' and 'Edges'. Resource allocation is driven by operating rules using 'Allocation Penalties', 'Constraints' and 'Parameters' and model outputs are captured and saved using 'Recorders'. Variations of model inputs can be specified and run in parallel using 'Scenarios'.

While the general concepts used to create a resource allocation simulation model in Pywr are similar to those of other tools, the use of terms can differ. In this section, we define key Pywr terms and their roles in simulation models.

Node

Nodes represent locations in the simulated water system where water is added, stored, used, consumed, or transmitted. There are different node types in Pywr to help you build your water system model; you can learn more about them in the section. The data that define the physical characteristics and behavior of a node can be added directly to the node or indirectly by referring to a Parameter (described below).

Edge

To form a network, nodes are connected using links representing water conveyance. Pywr calls these 'Edges'. An edge has a starting and an ending node, and water flows from the starting node to the ending node. Pywr does not assign information to these connections (the edges), rather it assigns data to the source and destination nodes. All data required to simulate water management is stored on nodes, the edges only determine the direction of water flow. A Pywr modeler would say 'Pywr edges determine the network topology' which means 'the connections between nodes determine how water moves in the computer model'.

Constraint

Constraints can be set on various node types to help represent system behavior. For instance, a river node can have maximum and/or minimum flow values to represent the conveyance capacity. In Pywr, many nodes have the 'max_flow' and 'min_flow' attributes to set the upper and lower limits of the flow through the node if needed. The 'max_flow' attribute doesn't require that the flow through this node reach this value, but if the water volume and priority are sufficient, the model will try to meet the 'Max Flow.' Minimum flow constraints should be used carefully as they can result in model infeasibility if the minimum cannot be met.

Allocation Penalty or 'Cost'

Allocation penalties are node attributes that control water allocation priority. These are typically expressed as penalties or 'costs', and the model allocates water first to the node with the lowest penalty. If you prefer allocating by benefit, sending water to where it has the highest benefit first, you'll need to express your priorities in Pywr as negative costs (i.e., use negative numbers). In fact, both can be used together, so for example if 3 nodes have penalties -10, 2, 6, they will get water in that order (the node with a penalty of -10 gets water first, and the node with allocation penalty 6 gets water last).

Parameter

Parameters in Pywr provide a flexible and convenient way to provide inputs to Nodes. For example, a particular parameter type can be used to load inflow or demand data from a Microsoft Excel file. Parameters also offer a flexible and customizable way to define a system's operating rules (e.g., rules governing reservoir releases). Most model input data can be provided using parameters.

Recorder

Pywr Recorders are used to post-process results. By creating a recorder, you can observe and save simulation results. Some recorders enable aggregating results over time (e.g., from daily to annual) and space (e.g., water allocated to a group of nodes).

Scenario

In Pywr you can create and simulate scenarios with different input data on supply, demand or other changes. Water planners increasingly use long-term simulations with many scenarios to evaluate future changes or test possible interventions. Being able to quickly simulate many plausible future scenarios is one of Pywr's main benefits.

Note:

For further details, please refer to the open-access paper entitled: .

Node types
A water resource simulator in Python