wntr.network.options module

The wntr.network.options module includes simulation options.

Contents

WaterNetworkOptions() Water network model options class.
TimeOptions() Options related to simulation and model timing.
GraphicsOptions() Options related to graphics.
HydraulicOptions() Options related to hydraulic model, including hydraulics.
ResultsOptions() Options related to results outputs.
QualityOptions() Options related to water quality modeling.
EnergyOptions() Options related to energy calculations.
SolverOptions() Options related to solver options (for any solver).
UserOptions() Options defined by the user.
class wntr.network.options.WaterNetworkOptions[source]

Bases: object

Water network model options class.

These options mimic options in the EPANET User Manual. The class uses the __slots__ syntax to ensure that older code will raise an appropriate error – for example, trying to set the options.duration value will result in an error rather than creating a new attribute (which would never be used and cause undiagnosable errors). The user attribute is a generic python class object that allows for dynamically created attributes that are user specific.

Attributes:
energy

Options related to energy calculations

graphics

Options related to graphics and mapping

hydraulic

Options related to the hydraulic model

quality

Options related to the water quality model

results

Options related to the saving or presentation of results

solver

Options related to solver configuration

time

Options related to model timing

user

User defined options

Methods

todict() Dictionary representation of the model options
tostring() String representation of the model options
time

Options related to model timing

hydraulic

Options related to the hydraulic model

results

Options related to the saving or presentation of results

quality

Options related to the water quality model

energy

Options related to energy calculations

solver

Options related to solver configuration

graphics

Options related to graphics and mapping

user

User defined options

todict()[source]

Dictionary representation of the model options

tostring()[source]

String representation of the model options

class wntr.network.options.TimeOptions[source]

Bases: object

Options related to simulation and model timing.

Attributes:
duration : int, default 0

Simulation duration in seconds

hydraulic_timestep : int, default 3600

Hydraulic timestep in seconds

quality_timestep : int, default 360

Water quality timestep in seconds

rule_timestep : int, default 360

Rule timestep in seconds

pattern_timestep : int, default 3600

Pattern timestep in seconds

pattern_start : int, default 0

Time offset (in seconds) to find the starting pattern step; changes where in pattern the pattern starts out, not what time the pattern starts

report_timestep : int, default 3600

Reporting timestep in seconds

report_start : int, default 0

Start time of the report in seconds from the start of the simulation

start_clocktime : int, default 0

Time of day in seconds from 12 am at which the simulation begins

Methods

todict() Dictionary representation of the time options
tostring() String representation of the time options
todict()[source]

Dictionary representation of the time options

tostring()[source]

String representation of the time options

class wntr.network.options.GraphicsOptions[source]

Bases: object

Options related to graphics.

May be used to contain custom, user defined values. Default attributes comprise the EPANET “backdrop” section options.

Attributes:
dimensions : 4-tuple or list

(x, y, dx, dy) Dimensions for backdrop image

units : str

Units for backdrop image

offset : 2-tuple or list

(x,y) offset for the network

image_filename : string

Filename where image is located

map_filename : string

Filename used to store node coordinates in (node, x, y) format

Methods

todict() Dictionary representation of the graphics options
tostring() String representation of the graphics options
todict()[source]

Dictionary representation of the graphics options

tostring()[source]

String representation of the graphics options

class wntr.network.options.HydraulicOptions[source]

Bases: object

Options related to hydraulic model, including hydraulics.

Attributes:
units : str, default ‘GPM’

Input/output units (EPANET); options are CFS, GPM, MGD, IMGD, AFD, LPS, LPM, MLD, CMH, and CMD

headloss : str, default ‘H-W’

Formula to use for computing head loss through a pipe. Options are H-W, D-W, and C-M

hydraulics : str, default None

Indicates if a hydraulics file should be read in or saved; options are None, USE and SAVE (default None)

hydraulics_filename : str

Filename to use if hydraulics = SAVE

viscosity : float, default 1.0

Kinematic viscosity of the fluid

specific_gravity : float, default 1.0

Specific gravity of the fluid

pattern : str, default None

Name of the default pattern for junction demands. If None, the junctions with demands but without patterns will be held constant

demand_multiplier : float, default 1.0

The demand multiplier adjusts the values of baseline demands for all junctions

emitter_exponent : float, default 0.5

The exponent used when computing flow from an emitter

Methods

todict() Dictionary representation of the hydraulic options
tostring() String representation of the hydraulic options
todict()[source]

Dictionary representation of the hydraulic options

tostring()[source]

String representation of the hydraulic options

class wntr.network.options.ResultsOptions[source]

Bases: object

Options related to results outputs.

Attributes:
statistic : str, default ‘None’

Output results as statistical values, rather than time-series; options are AVERAGED, MINIMUM, MAXIUM, RANGE, and NONE (as defined in the EPANET User Manual)

rpt_filename : str

Provides the filename to use for outputting an EPANET report file. By default, this will be the prefix plus “.rpt”.

status : str, default ‘NO’

Output solver status (‘YES’, ‘NO’, ‘FULL’). ‘FULL’ is only useful for debugging

summary : str, default ‘YES’

Output summary information (‘YES’ or ‘NO’)

energy : str, default ‘NO’

Output energy information

nodes : bool, default False

Output node information in report file

links : bool, default False

Output link information in report file

Methods

todict() Dictionary representation of the results options
tostring() String representation of the results options
todict()[source]

Dictionary representation of the results options

tostring()[source]

String representation of the results options

class wntr.network.options.QualityOptions[source]

Bases: object

Options related to water quality modeling.

Attributes:
mode : str, default ‘None’

Type of water quality analysis. Options are NONE, CHEMICAL, AGE, and TRACE

trace_node : str, default None

Trace node name if quality = TRACE

wq_units : str, default None

Units for quality analysis; concentration for ‘chemical’, ‘s’ for ‘age’, ‘%’ for ‘trace’

chemical : str, default None

Chemical name for ‘chemical’ analysis

diffusivity : float, default 1.0

Molecular diffusivity of the chemical (default 1.0)

bulk_rxn_order : float, default 1.0

Order of reaction occurring in the bulk fluid

wall_rxn_order : float, default 1.0

Order of reaction occurring at the pipe wall

tank_rxn_order : float, default 1.0

Order of reaction occurring in the tanks

bulk_rxn_coeff : float, default 0.0

Reaction coefficient for bulk fluid and tanks

wall_rxn_coeff : float, default 0.0

Reaction coefficient for pipe walls

limiting_potential : float, default None

Specifies that reaction rates are proportional to the difference between the current concentration and some limiting potential value, off if None

roughness_correl : float, default None

Makes all default pipe wall reaction coefficients related to pipe roughness, off if None

Methods

todict() Dictionary representation of the quality options
tostring() String representation of the quality options
todict()[source]

Dictionary representation of the quality options

tostring()[source]

String representation of the quality options

class wntr.network.options.EnergyOptions[source]

Bases: object

Options related to energy calculations.

Attributes:
global_price : float, default 0

Global average cost per Joule

global_pattern : str, default None

ID label of time pattern describing how energy price varies with time

global_efficiency : float, default 75.0

Global pump efficiency as percent; i.e., 75.0 means 75%

demand_charge : float, default None

Added cost per maximum kW usage during the simulation period, or None

Methods

todict() Dictionary representation of the energy options
tostring() String representation of the energy options
todict()[source]

Dictionary representation of the energy options

tostring()[source]

String representation of the energy options

class wntr.network.options.SolverOptions[source]

Bases: object

Options related to solver options (for any solver).

Attributes:
trials : int, default 40

Maximum number of trials used to solve network hydraulics

accuracy : float, default 0.001

Convergence criteria for hydraulic solutions (default 0.001)

unbalanced : str, default ‘STOP’

Indicate what happens if a hydraulic solution cannot be reached. Options are STOP and CONTINUE

unbalanced_value : int, default None

Number of additional trials if unbalanced = CONTINUE

tolerance : float, default 0.01

Convergence criteria for water quality solutions

checkfreq : int, default 2

Number of solution trials that pass between status check

maxcheck : int, default 10

Number of solution trials that pass between status check

damplimit : float, default 0.0

Accuracy value at which solution damping begins

Methods

todict() Dictionary representation of the solver options
tostring() String representation of the solver options
todict()[source]

Dictionary representation of the solver options

tostring()[source]

String representation of the solver options

class wntr.network.options.UserOptions[source]

Bases: object

Options defined by the user.

Provides an empty class that accepts getattribute and setattribute methods to create user-defined options. For example, if using WNTR for uncertainty quantification, certain options could be added here that would never be used directly by WNTR, but which would be saved on pickling and could be used by the user-built analysis scripts.

Methods

todict() Dictionary representation of the user options
tostring() String representation of the user options
todict()[source]

Dictionary representation of the user options

tostring()[source]

String representation of the user options