SimTimeCondition#
module wntr.network.controls
- class SimTimeCondition[source]#
Bases:
ControlCondition
Condition based on time since start of the simulation. Generally, the relation should be
None
(converted to “at”) – then it is only evaluated “at” specific times. Using greater-than or less-than type relationships should be reserved for complex, multi-condition statements and should not be used for simple controls. Ifrepeat
is used, the relationship will automatically be changed to an “at time” evaluation, and a warning will be raised.- Parameters:
model (WaterNetworkModel) – The model that the time threshold is being compared against
relation (str or None) – String options are ‘at’, ‘after’ or ‘before’. The ‘at’ and None are equivalent, and only evaluate as True during the simulation step the time occurs. After evaluates as True from the time specified until the end of simulation, before evaluates as True from start of simulation until the specified time.
threshold (float or str) – The time (a
float
in decimal hours) used in the condition; if provided as a string in ‘[dd-]hh:mm[:ss]’ format, then the time will be parsed from the string;repeat (bool or float, default=False) – If True, then repeat every 24-hours; if non-zero float, reset the condition every repeat seconds after the first_time.
first_time (float, default=0) – Start rule at first_time, using that time as 0 for the condition evaluation
- requires()[source]#
Returns a set of objects required to evaluate this condition
- Returns:
required_objects
- Return type:
OrderedSet of object