Homepage

Lookup table

The lookup table block computes an approximation to some function y=f(t) given data vector y. By default t is the current time point of the simulation, but can also be sent as an argument when calling the lookup table.

Creating a lookup table

From the Projects window

  • Expand the Project to which you wish to add the lookup table by clicking the + symbol next to it. Right-click on ‘Blocks’, or a sub-system in ‘Blocks’, and select Lookup Table from the pop-up menu.

From the Matrix window

  • Right click an empty diagonal cell of the matrix and select Other | Lookup Table from the the pop-up menu.

From the Blocks window

  • Place the mouse cursor over the table and right-click on it. Select New | Lookup Table from the pop-up menu, or

  • In the title bar, select Lookup Table from the Type drop-down list and click on the New button.

Editing a lookup table

The block editor is shown by right-clicking the block in a window and selecting Edit. In the Blocks window, you can also show the block editor by selecting the block and clicking the Edit button, or by double-clicking the right-most “validation” column of the block.

The block editor has three tabs:

Properties

Note Most block properties can be edited directly in the Blocks window.

This page lets you edit basic properties such as name, sub-system and base unit. See editing properties for more information.

Appearance

This page lets you edit the visual properties of the block in the matrix window and graph window. See editing appearance for more information.

Values

This page lets you specify time series, values and interpolation options.

Dimension - You can specify the dimension of the block by using the Type drop down list. Depending on the dimension the index drop down lists are activated.

Interpolation - The interpolation field will determine how values before, between and after the time-points are interpolated/extrapolated.

  • Interpolation-Extrapolation – Values between the specified time-points are linearly interpolated. Values before the first time point and after the last time-point will be extrapolated.

  • Interpolation-Use end values – Values between the specified time-points are linearly interpolated. The value for the first time point will be used when time is less than the first time point. The value for the last time point will be used when time is larger than the last time point.

  • Use input nearest – For each simulation time point the value for the nearest specified time is used.

  • Use input below – For each simulation time point the value for the nearest of the lower specified time points is used. If none of the specified time points is lower, then the nearest of all specified time points is used.

  • Use input above – For each simulation time point the value for the nearest of the higher specified time points is used. If none of the specified time points is higher, then the nearest of all specified time points is used.

Cyclic - When selected the time series will be “looped” and all values repeated. This feature is useful for periodic data, for instance one year dayly data of precipitation. Note that for cyclic lookup tables the final value(s) must be the same as the first value(s).

Lookup key - The key used when looking up data in the table.

  • Current time - Use the current simulation time point when looking up values.
  • As argument - Let the caller of the lookup table specify the lookup key (see the section about arguments below)

Import - This button lets you import values for this lookup table from an Excel file. The recommended practise for importing values is to first export an empty lookup table with the correct indices and options as a template. In Excel, open the template and copy-paste the values into the template. When the data is added, the template can be imported into Ecolego again.

Export - This button lets you export values for this lookup table from an Excel file.

Data - The table always displays an empty last row where you can enter new values. Please note that values must be entered for each time point, although you may have different time points for different indices. If the lookup table has more than one dependency, a drop down list will be presented for each dependency where you can select the indices for which you enter data. The lookup table contains the following columns:

  • Time – This is where you enter the time series. If you have data in Excel, you can copy / paste a column from Excel directly into this table.

  • Data – This is where you enter the lookup data. If you have data in Excel, you can copy / paste a column from Excel directly into this table.

Link - Instead of filling in data manually, link the lookup table to a simulation result.

  • Select… - Click to select a result to which to link.

  • Linked - Select to activate/disactivate the link.

Arguments

In most cases the lookup table is used for which is time dependent measurements, and where the data for the current time point is used. However, in some cases it can be useful to use the lookup table for other types of data. For instance,

  • A table with soil densities as a function of depth
  • Accessing data from a time dependent measurement but for another time point than the current time point.

In these cases the caller - the equation(s) referring to the lookup table - must specify the lookup key X. Also, the lookup table must be configured to require the lookup key rather than using the current time point.

As with expressions, a lookup table which requires arguments will never yield a simulation result.

Specifying argument

In the Options section of the Values tab, change the Lookup key from Current time to As argument. The name of the “time” column in the Data table should now change to “X”.

Calling a lookup table with an argument

As with any block, you specify the name or ID of the lookup table. You then specify the lookup key as a function argument using parenthesis.

Examples:

  • Retreiving the flowrate 100 time units before the current time point; the lookup table is named FlowRate: FlowRate( time - 100 )
  • Retreiving the number of ants depending on the size of the ant hill: AntCount( widthheightvolume )

See also