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 callsuper().__init__()
at the beginning of its own initialization.Name/ID of this variable, must be a valid EPANET/MSX ID
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:
- Raises:
KeyExistsError – Name is already taken
ValueError – Name is a reserved word