pywr.parameters.control_curves.ControlCurveInterpolatedParameter

class pywr.parameters.control_curves.ControlCurveInterpolatedParameter(model, storage_node, control_curves, values=None, parameters=None, **kwargs)

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_nodeStorage

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

control_curveslist 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.

valueslist of float

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

parametersiterable Parameter objects or None, optional

If values is None then parameters can specify a Parameter object to use at each of the control curves. The number of parameters 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__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

after(self)

before(self)

finish(self)

get_all_values(self)

get_constant_value(self)

Return a constant value.

get_double_lower_bounds(self)

get_double_upper_bounds(self)

get_double_variables(self)

get_integer_lower_bounds(self)

get_integer_upper_bounds(self)

get_integer_variables(self)

get_value(self, ScenarioIndex scenario_index)

load(type cls, model, data)

register(type cls)

reset(self)

set_double_variables(self, double[)

set_integer_variables(self, int[)

setup(self)

unregister(type cls)

value(self, Timestep ts, ...)

Attributes

children

comment

comment: unicode

control_curves

double_size

double_size: 'int'

integer_size

integer_size: 'int'

is_constant

is_variable

is_variable: 'bool'

model

name

parameters

parameters: list

parents

size

storage_node

tags

tags: dict

values