ReactionBase#

module wntr.msx.base

class ReactionBase[source]#

Bases: ABC

Water quality reaction class.

This is an abstract class for water quality reactions with partial concrete attribute and method definitions. All parameters and methods documented here must be defined by a subclass except for the following:

Concrete attributes

The __init__() method defines the following attributes concretely. Thus, a subclass should call super().__init__(species_name, note=note) at the beginning of its own initialization.

_species_name

Protected name of the species

note

Optional note regarding the reaction (see NoteType)

Concrete properties

The species name is protected, and a reaction cannot be manually assigned a new species. Therefore, the following property is defined concretely.

species_name

Name of the species that has a reaction being defined.

Concrete methods

The following methods are concretely defined, but can be overridden.

__str__

Return the name of the species and the reaction type, indicated by an arrow.

__repr__

Return a representation of the reaction from the dictionary representation - see to_dict()


__init__(species_name, *, note=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

abstractmethod to_dict()[source]#

Represent the object as a dictionary

note: str | dict | ENcomment#

Optional note regarding the reaction (see NoteType)

abstract property reaction_type: Enum#

Reaction type (reaction location).

property species_name: str#

Name of the species that has a reaction being defined.