AnyLogic supports special type of functions - table functions. A table function is a function defined in the table form. You can simply make it continuous by interpolating and/or extrapolating. You may need table functions to define a complex non-linear relationship which cannot be described as a composition of standard functions, or to bring experimental data defined as a table function to a continuous mode.
Table function works in the following way: the user defines a function by giving a number of (argument, value) pairs, i.e. a number of base points on XY chart. AnyLogic builds the table function based on the given data and the chosen interpolation type. A call of a function with some value passed as a function argument, will return a (possibly, interpolated) value of the function. A number of behaviors are supported for the case x, which is out of original argument range.
To define a
- To load table data from the existing Anylogic database, check the Loaded from database option and select the DB table from the Table drop-down list. If needed, define the conditions specifying the particular value you want to select from the database table in the Choice conditions option. Specify the Argument column and Value column by selecting the database table columns from the drop-down lists.
- If you have table data already defined in any other application or a file, you can simply copy it to clipboard and then paste it into the Table Data using the Paste from Clipboard button. Make sure to previously uncheck the Loaded from database option.
- You can also enter the table data manually into the table (that is shown in the Table data properties section if the Loaded from database option is unchecked). Each "argument-value" pair is specified in an individual row of the table. To define pair of values, go to the last row of the table and enter the argument value in the Argument cell and the function value in the Value cell. To remove a pair of values, select the corresponding row of the table and click the Delete button. You may sort entries by argument (in ascending order) by clicking the Sort button.
Name – The name of the table function. The name is used to identify and access the function.
Show name – If selected, the function name is displayed on a presentation diagram.
Ignore – If selected, the table function is excluded from the model.
Visible – If selected, the table function's icon is visible on the presentation at model runtime.Interpolation – Specifies how the table function is interpolated:
Table – Can be used to manually define data of the table function. Each Argument-Value pair is specified in an individual row of the table. You can add , remove , arrange ( , ) a pair of values, paste it from the clipboard or copy it to the clipboard.
selected, the table function is static. Static
function is initialized once and has the same data for all instances of
this agent type. This is very useful in agent based
models, in case your agents have some table function defined. Making a
table function static, AnyLogic engine does not waste time
this function several times for numerous agents.
System dynamics units – If selected, you will be able to specify units of measurements for the value returned by this function in the edit box to the right. Having specified units for elements of your model, you may perform unit checking to find out dimension inconsistencies in the model.
Table function interpolation
Function behavior in infeasible area
table function values
API Reference: TableFunction Class