QualityModelBase#

module wntr.msx.base

class QualityModelBase[source]#

Bases: ABC

Abstract multi-species water quality model

This is an abstract class for a water quality model. 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__() or super().__init__(filename).

name

Name for the model, or the MSX model filename (no spaces allowed)

title

Title line from the MSX file, must be a single line

description

Longer description; note that multi-line descriptions may not be represented well in dictionary form

_orig_file

Protected original filename, if provided in the constructor

_options

Protected options data object

_rxn_system

Protected reaction system object

_net_data

Protected network data object

_wn

Protected water network object


__init__(filename=None)[source]#

QualityModel ABC init method.

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

super().__init__(filename=filename)
Parameters:

filename (str, optional) – File to use to populate the initial data

abstract classmethod from_dict(data)[source]#

Create a new model from a dictionary

Parameters:

data (dict) – Dictionary representation of the model

Returns:

New concrete model

Return type:

QualityModelBase

abstract to_dict()[source]#

Represent the object as a dictionary

description: str#

Longer description; note that multi-line descriptions may not be represented well in dictionary form

name: str#

Name for the model, or the MSX model filename (no spaces allowed)

abstract property network_data: NetworkDataBase#

Network-specific values added to this model

Concrete classes should implement this with the appropriate typing.

abstract property options#

Model options structure

Concrete classes should implement this with the appropriate typing and also implement a setter method.

abstract property reaction_system: ReactionSystemBase#

Reaction variables defined for this model

Concrete classes should implement this with the appropriate typing.

title: str#

Title line from the MSX file, must be a single line