Reaction#

module wntr.msx.elements

class Reaction[source]#

Bases: ReactionBase

Water quality reaction dynamics definition for a specific species.

Parameters:
  • species_name – Species (object or name) this reaction is applicable to.

  • reaction_type – Reaction type (location), from {PIPE, TANK}

  • expression_type – Expression type (left-hand-side) of the equation, from {RATE, EQUIL, FORMULA}

  • expression – Mathematical expression for the right-hand-side of the reaction equation.

  • note (str | dict | wntr.epanet.util.ENcomment) – Supplementary information regarding this variable, by default None

  • _vars – Reaction system this species is a part of, by default None


__init__(species_name, reaction_type, expression_type, expression, *, note=None, _vars=None)[source]#

Reaction ABC init method.

Make sure you call this method from your concrete subclass __init__ method:

super().__init__(species_name, note=note)
Parameters:
  • species_name (str) – Name of the chemical or biological species being modeled using this reaction

  • note ((str | dict | ENcomment), optional keyword) – Supplementary information regarding this reaction, by default None (see-also NoteType)

Raises:

TypeError – If expression_type is invalid

to_dict()[source]#

Dictionary representation of the object

expression: str#

Mathematical expression (right-hand-side)

property expression_type: ExpressionType#

Expression type (left-hand-side), either RATE, EQUIL, or FORMULA

note: str | dict | ENcomment#

Optional note regarding the reaction (see NoteType)

property reaction_type: ReactionType#

Reaction type (location), either PIPE or TANK

property species_name: str#

Name of the species that has a reaction being defined.