WNTR uses Pandas data objects to store simulation results. The use of Pandas facilitates a comprehensive set of time series analysis options that can be used to evaluate results. For more information on Pandas, see http://pandas.pydata.org/.
Results are stored in Pandas Panels. A Panel is a 3-dimensional database. One Panel is used to store nodes results and one Panel is used to store link results. The Panels are indexed by:
- Node or link attribute
- Time in seconds from the start of the simulation
- Node or link name
Conceptually, Panels can be visualized as blocks of data with 3 axis, as shown in Figure 8.
Node attributes include:
- Expected demand (only when the WNTRSimulator is used)
- Leak demand (only when the WNTRSimulator is used)
- Quality (only when the EpanetSimulator is used. Water age, tracer percent, or chemical concentration is stored, depending on the mode of water quality analysis)
- Type (junction, tank, or reservoir)
Link attributes include:
- Status (0 indicates closed, 1 indicates open)
- Type (pipe, pump, or valve)
The example simulation_results.py demonstrates use cases of simulation results. Node and link results are accessed using:
The indices can be used to extract specific information from the Panels. For example, to access the pressure and demand at node ‘123’ at 1 hour:
To access the pressure for all nodes and times (the “:” notation returns all variables along the specified axis):
Attributes can be plotted as a time-series, as shown in Figure 9:
pressure_at_node123 = results.node.loc['pressure',:,'123'] pressure_at_node123.plot()
Attributes can be plotted on the water network model, as shown in Figure 10. In this figure, the node pressure at 1 hr and link flowrate at 1 hour are plotted on the network. A colorbar is included for both node and link attributes:
pressure_at_1hr = results.node.loc['pressure',3600,:] flowrate_at_1hr = results.link.loc['flowrate',3600,:] wntr.graphics.plot_network(wn, node_attribute=pressure_at_1hr, link_attribute=flowrate_at_1hr)
Network and time-series graphics can be customized to add titles, legends, axis labels, etc.
Panels can be saved to Excel files using: