Options#

Water network options are stored in an Options class which divides options into the following sections:

All of these options can be modified in WNTR and then written to an EPANET INP file.

The options are appended to the WaterNetworkModel. In the example below, an empty WaterNetworkModel is created and the options are set to default values. If the WaterNetworkModel is created using an EPANET INP file, then the options are defined using values from that file.

>>> wn = wntr.network.model.WaterNetworkModel()
>>> wn.options  

Individual sections are selected as follows.

>>> wn.options.time  
>>> wn.options.hydraulic  
>>> wn.options.quality  
>>> wn.options.reaction  
>>> wn.options.energy  
>>> wn.options.report  
>>> wn.options.graphics  
>>> wn.options.user  

Options can be modified, as shown in the example below (note, duration is in seconds and required pressure is in meters).

>>> wn.options.time.duration = 86400
>>> wn.options.hydraulic.demand_model = 'PDD'
>>> wn.options.hydraulic.required_pressure = 21.097 # 30 psi = 21.097 m

Note that EPANET 2.00.12 does not use the demand model, minimum pressure, required pressure, or pressure exponent from the hydraulic section. Options that directly apply to hydraulic simulation that are not used in the WNTRSimulator are described in Limitations.

The easiest way to view options is to print the options as a dictionary. For example, hydraulic options are shown below.

>>> print(dict(wn.options.hydraulic)) 
{'accuracy': 0.001,
 'checkfreq': 2,
 'damplimit': 0.0,
 'demand_model': None,
 'demand_multiplier': 1.0,
 ...