Lookup Table
Module for creating lookup tables and lookup table equations.
- exception rtctools_simulation.lookup_table.GridCoordinatesNotFoundError[source]
Error when unable to extract coordinates from a rectangular grid.
- rtctools_simulation.lookup_table.get_empty_lookup_table(name: str, var_in: str | list[str], var_out: str) Function[source]
Get a lookup table that always returns zero.
- Parameters:
name – name of the lookup table.
var_in – Input variable(s) of the lookup table.
var_out – Output variable of the lookup table.
- Returns:
lookup table in the form of a Casadi function.
- rtctools_simulation.lookup_table.get_lookup_table_equations_from_csv(file: Path, lookup_tables: Dict[str, Function], variables: Dict[str, MX], allow_missing_lookup_tables=False) List[MX][source]
Get a list of lookup-table equations described by a csv file.
- Parameters:
file –
CSV File that describes equations involving lookup tables. These equations are of the form var_out = lookup_table(var_in). The csv file consists of the following columns:
lookup_table: Name of the lookup table.
var_in: Input variable(s) of the lookup table. Should be defined in the model. In case of multiple input variables, they should be separated by a whitespace.
var_out: Output variable of the lookup table. Should be defined in the model.
lookup_tables – Dict of lookup tables.
variables – Dict of symbolic variables used in the model.
allow_missing_lookup_tables – If True, replace missing lookup tables with empty tables.
- Returns:
list of equations.
- rtctools_simulation.lookup_table.get_lookup_table_from_csv(name: str, file: Path, var_in: str | list[str], var_out: str) Function[source]
Get a lookup table from a csv file.
- Parameters:
name – name of the lookup table
file – CSV file containing data points for different variables.
var_in – Input variable(s) of the lookup table. Should be one of the CSV file columns.
var_out – Output variable of the lookup table. Should be one of the CSV file columns.
- Returns:
lookup table in the form of a Casadi function.
- rtctools_simulation.lookup_table.get_lookup_tables_from_csv(file: Path, data_dir: Path = None) Dict[str, Function][source]
Get a dict of lookup tables described by a csv file.
- Parameters:
file – CSV File that describes lookup tables. The column names correspond to the parameters of
get_lookup_table_from_csv(). In case of multiple input variables, they should be separated by a whitespace.data_dir – Directory that contains the interpolation data for the lookup tables. By default, the directory of the csv file is used.
- Returns:
dict of lookup tables.