TimeSeries#

module wntr.network.elements

class TimeSeries[source]#

Bases: object

Time series class.

A TimeSeries object contains a base value, Pattern object, and category. The object can be used to store changes in junction demand, source injection, pricing, pump speed, and reservoir head. The class provides methods to calculate values using the base value and a multiplier pattern.

Constructor

Parameters:
  • base (number) – A number that represents the baseline value.

  • pattern_registry (PatternRegistry) – The pattern registry for looking up patterns

  • pattern (str, optional) – If None, then the value will be constant. Otherwise, the Pattern will be used. (default = None)

  • category (string, optional) – A category, description, or other name that is useful to the user (default = None).

Raises:

ValueError – If base or pattern are invalid types


__init__(model, base, pattern_name=None, category=None)[source]#
at(time)[source]#

Returns the value at a specific time.

Parameters:

time (int) – Time in seconds

to_dict()[source]#

Dictionary representation of the time series

property base_value#

Returns the baseline value.

property category#

Returns the category.

property pattern#

Returns the Pattern object.

property pattern_name#

Returns the name of the pattern.