Lookup tables¶

class
rtctools.optimization.csv_lookup_table_mixin.
LookupTable
(inputs: List[casadi.casadi.MX], function: casadi.casadi.Function, tck: Tuple = None)[source]¶ Bases:
object
Lookup table.

__call__
(*args) → Union[float, numpy.ndarray, rtctools.optimization.timeseries.Timeseries][source]¶ Evaluate the lookup table.
Parameters: args (Float, iterable of floats, or Timeseries
) – Input values.Returns: Lookup table evaluated at input values. Example use:
y = lookup_table(1.0) [y1, y2] = lookup_table([1.0, 2.0])


class
rtctools.optimization.csv_lookup_table_mixin.
CSVLookupTableMixin
(**kwargs)[source]¶ Bases:
rtctools.optimization.optimization_problem.OptimizationProblem
Adds lookup tables to your optimization problem.
During preprocessing, the CSV files located inside the
lookup_tables
subfolder are read. In every CSV file, the first column contains the output of the lookup table. Subsequent columns contain the input variables.Cubic BSplines are used to turn the data points into continuous lookup tables.
Optionally, a file
curvefit_options.ini
may be included inside thelookup_tables
folder. This file contains, grouped per lookup table, the following options: monotonicity:
 is an integer, magnitude is ignored
 if positive, causes spline to be monotonically increasing
 if negative, causes spline to be monotonically decreasing
 if 0, leaves spline monotonicity unconstrained
 curvature:
 is an integer, magnitude is ignored
 if positive, causes spline curvature to be positive (convex)
 if negative, causes spline curvature to be negative (concave)
 if 0, leaves spline curvature unconstrained
Note
Currently only onedimensional lookup tables are fully supported. Support for two dimensional lookup tables is experimental.
Variables:  csv_delimiter – Column delimiter used in CSV files. Default is
,
.  csv_lookup_table_debug – Whether to generate plots of the spline fits. Default is
false
.  csv_lookup_table_debug_points – Number of evaluation points for plots. Default is
100
.