Data Structures

pyomo.contrib.mpc.data.get_cuid.get_indexed_cuid(var, sets=None, dereference=None, context=None)[source]

Attempt to convert the provided “var” object into a CUID with wildcards

Parameters:
  • var – Object to process. May be a VarData, IndexedVar (reference or otherwise), ComponentUID, slice, or string.

  • sets (Tuple of sets) – Sets to use if slicing a vardata object

  • dereference (None or int) – Number of times we may access referent attribute to recover a “base component” from a reference.

  • context (Block) – Block with respect to which slices and CUIDs will be generated

Returns:

ComponentUID corresponding to the provided var and sets

Return type:

ComponentUID

class pyomo.contrib.mpc.data.scalar_data.ScalarData(data, time_set=None, context=None)[source]

An object to store scalar data associated with time-indexed variables.

to_serializable()[source]

Convert to json-serializable object.

class pyomo.contrib.mpc.data.series_data.TimeSeriesData(data, time, time_set=None, context=None)[source]

An object to store time series data associated with time-indexed variables.

concatenate(other, tolerance=0.0)[source]

Extend time list and variable data lists with the time points and variable values in the provided TimeSeriesData. The new time points must be strictly greater than the old time points.

extract_variables(variables, context=None, copy_values=False)[source]

Only keep variables specified.

get_data_at_time(time=None, tolerance=0.0)[source]

Returns the data associated with the provided time point or points. This function attempts to map time points to indices, then uses get_data_at_time_indices to actually extract the data. If a provided time point does not exist in the time-index map, binary search is used to find the closest value within a tolerance.

Parameters:
  • time (Float or iterable) – The time point or points corresponding to returned data.

  • tolerance (Float) – Tolerance within which we will search for a matching time point. The default is 0.0, meaning time points must be specified exactly.

Returns:

TimeSeriesData containing only the specified time points or dict mapping CUIDs to values at the specified scalar time point.

Return type:

TimeSeriesData or ScalarData

get_data_at_time_indices(indices)[source]

Returns data at the specified index or indices of this object’s list of time points.

get_time_points()[source]

Get time points of the time series data

shift_time_points(offset)[source]

Apply an offset to stored time points.

to_serializable()[source]

Convert to json-serializable object.

class pyomo.contrib.mpc.data.series_data.TimeSeriesTuple(data, time)
data

Alias for field number 0

time

Alias for field number 1

class pyomo.contrib.mpc.data.interval_data.IntervalData(data, intervals, time_set=None, context=None)[source]
concatenate(other, tolerance=0.0)[source]

Extend interval list and variable data lists with the intervals and variable values in the provided IntervalData

extract_variables(variables, context=None, copy_values=False)[source]

Only keep variables specified.

shift_time_points(offset)[source]

Apply an offset to stored time points.

to_serializable()[source]

Convert to json-serializable object.

pyomo.contrib.mpc.data.interval_data.IntervalDataTuple

alias of IntervalTuple

pyomo.contrib.mpc.data.interval_data.assert_disjoint_intervals(intervals)[source]

This function takes intervals in the form of tuples and makes sure that they are disjoint.

Parameters:

intervals (iterable) – Iterable of tuples, each containing the low and high values of an interval.