MsxReactionSystem#

module wntr.msx.model

class MsxReactionSystem[source]#

Bases: ReactionSystemBase

Registry for all the variables registered in the multi-species reactions model.

This object can be used like a mapping.


__init__()[source]#

Constructor for the reaction system.

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

super().__init__()
add_reaction(reaction)[source]#

Add a reaction to the model

Parameters:

reaction (Reaction) – Water quality reaction definition

Raises:
  • TypeError – If reaction is not a Reaction

  • KeyError – If the species_name in the reaction does not exist in the model

add_variable(variable)[source]#

Add a variable object to the registry.

The appropriate group is determined by querying the object’s var_type attribute.

Parameters:

variable (Constant | HydraulicVariable | MathFunction | Parameter | Species | Term) – Variable to add.

Raises:
  • TypeError – If variable is not an MsxVariable

  • KeyExistsError – If variable has a name that is already used in the registry

reactions()[source]#

Generator looping through all reactions

to_dict()[source]#

Dictionary representation of the MsxModel.

variables()[source]#

Generator looping through all variables

property constants: Dict[str, Constant]#

Dictionary view onto only constants

property parameters: Dict[str, Parameter]#

Dictionary view onto only parameters

property pipe_reactions: Dict[str, Reaction]#

Dictionary view onto pipe reactions

property species: Dict[str, Species]#

Dictionary view onto only species

property tank_reactions: Dict[str, Reaction]#

Dictionary view onto tank reactions

property terms: Dict[str, Term]#

Dictionary view onto only named terms