WNTRSimulator#

module wntr.sim.core

class WNTRSimulator[source]#

Bases: WaterNetworkSimulator

WNTR simulator class. The WNTR simulator uses a custom newton solver and linear solvers from scipy.sparse.

Parameters:

wn (WaterNetworkModel object) – Water network model

Note

The mode parameter has been deprecated. Please set the mode using Options.hydraulic.demand_model


__init__(wn)[source]#
run_sim(solver=<class 'wntr.sim.solvers.NewtonSolver'>, backup_solver=None, solver_options=None, backup_solver_options=None, convergence_error=False, HW_approx='default', diagnostics=False)[source]#

Run an extended period simulation (hydraulics only).

Parameters:
  • solver (object) – NewtonSolver or Scipy solver

  • backup_solver (object) – NewtonSolver or Scipy solver

  • solver_options (dict) – See NewtonSolver for possible options

  • backup_solver_options (dict)

  • convergence_error (bool (optional)) – If convergence_error is True, an error will be raised if the simulation does not converge. If convergence_error is False, partial results are returned, a warning will be issued, and results.error_code will be set to 0 if the simulation does not converge. Default = False.

  • HW_approx (str) – Specifies which Hazen-Williams headloss approximation to use. Options are ‘default’ and ‘piecewise’. Please see the WNTR documentation on hydraulics for details.

  • diagnostics (bool) – If True, then run with diagnostics on