VariableBase#

module wntr.msx.base

class VariableBase[source]#

Bases: ABC

Multi-species water quality model variable

This is an abstract class for water quality model variables with partial definition of 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__() at the beginning of its own initialization.

name

Name/ID of this variable, must be a valid EPANET/MSX ID

note

Optional note regarding the variable (see NoteType)

Concrete methods

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

__str__

Return the name of the variable

__repr__

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


__init__(name, *, note=None)[source]#

Variable ABC init method.

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

super().__init__(name, note=note)
Parameters:
  • name (str) – Name/symbol for the variable. Must be a valid MSX variable name

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

Raises:
to_dict()[source]#

Represent the object as a dictionary

name: str#

Name/ID of this variable, must be a valid EPANET/MSX ID

note: str | dict | ENcomment#

Optional note regarding the variable (see NoteType)

abstract property var_type: Enum#

Type of reaction variable