ReactionSystemBase#

module wntr.msx.base

class ReactionSystemBase[source]#

Bases: ABC

Abstract class for reaction systems, which contains variables and reaction expressions.

This class contains the functions necessary to perform dictionary-style addressing of variables by their name. It does not allow dictionary-style addressing of reactions.

This is an abstract class with some concrete attributes and methods. 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__() or super().__init__(filename).

_vars

Variables registry, which is mapped to dictionary functions on the reaction system object

_rxns

Reactions dictionary

Concrete methods

The following special methods are concretely provided to directly access items in the _vars attribute.

__contains__

__eq__

Return self==value.

__ne__

Return self!=value.

__getitem__

__iter__

__len__


__init__()[source]#

Constructor for the reaction system.

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

super().__init__()
abstract add_reaction(obj)[source]#

Add a reaction to the system

abstract add_variable(obj)[source]#

Add a variable to the system

abstract reactions()[source]#

Generator looping through all reactions

abstract to_dict()[source]#

Represent the reaction system as a dictionary

abstract variables()[source]#

Generator looping through all variables