pywr.parameters.control_curves.ControlCurveInterpolatedParameter

class pywr.parameters.control_curves.ControlCurveInterpolatedParameter

A control curve Parameter that interpolates between three or more values

Return values are linearly interpolated between control curves, with the first and last value being 100% and 0% respectively.

Parameters:
storage_node : Storage

The storage node to compare the control curve(s) to.

control_curves : list of Parameter or floats

A list of parameters representing the control curve(s). These are often MonthlyProfileParameters or DailyProfileParameters, but may be any Parameter that returns values between 0.0 and 1.0. If floats are passed they are converted to ConstantParameter.

values : list of float

A list of values to return corresponding to the control curves. The length of the list should be 2 + len(control_curves).

Examples

In the example below the cost of a storage node is related to it’s volume. At 100% full the cost is 0. Between 100% and 50% the cost is linearly interpolated between 0 and -5. Between 50% and 30% the cost is interpolated between -5 and -10. Between 30% and 0% the cost is interpolated between -10 and -20

Volume:  100%             50%      30%       0%
          |----------------|--------|--------|
  Cost:  0.0            -5.0     -10.0   -20.0
>>> storage_node = Storage(model, "reservoir", max_volume=100, initial_volume=100)
>>> ccs = [ConstantParameter(0.5), ConstantParameter(0.3)]
>>> values = [0.0, -5.0, -10.0, -20.0]
>>> cost = ControlCurveInterpolatedParameter(storage_node, ccs, values)
>>> storage_node.cost = cost
__init__($self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

after
before
finish
get_all_values
get_double_lower_bounds
get_double_upper_bounds
get_double_variables
get_integer_lower_bounds
get_integer_upper_bounds
get_integer_variables
get_value
load
lower_bounds
register
reset
set_double_variables
set_integer_variables
setup
unregister
update
upper_bounds
value

Attributes

children
comment
control_curves
double_size
integer_size
is_variable
model
name
parents
size
storage_node
values