BaseControlAction#

module wntr.network.controls

class BaseControlAction[source]#

Bases: Subject

A base class for deriving new control actions. The control action is run by calling run_control_action. This class is not meant to be used directly. Derived classes must implement the run_control_action, requires, and target methods.


__init__()[source]#
notify()#

Call the update method for all observers of this subject.

abstract requires()[source]#

Returns a set of objects used to evaluate the control

Returns:

req – The objects required to run the control action.

Return type:

OrderedSet

abstract run_control_action()[source]#

This method is called to run the corresponding control action.

subscribe(observer)#

Subscribe observer to this subject. The update method of any observers of this subject will be called when notify is called on this subject.

Parameters:

observer (Observer)

abstract target()[source]#

Returns a tuple (object, attribute) containing the object and attribute that the control action may change

Returns:

target – A tuple containing the target object and the attribute to be changed (target, attr).

Return type:

tuple

unsubscribe(observer)#

Unsubscribe observer from this subject.

Parameters:

observer (Observer)