Referencing a Lookup Table

Lookup Table elements are unique in that you don’t reference them in the same manner that you reference the outputs of other elements.  Instead, you reference them in the way that you would reference a built-in function (like sin or min).  That is, once you define a table, you reference it in input expressions for other elements as if it were a custom function:

This is referred to as a  table function. This expression instructs GoldSim to use the 2-D lookup table defined by the element X_Table and compute an output value based on a value for the row variable of 15m and a value for the column variable of 150kg.

Of course, once you have defined the table, you can reference it at multiple locations (i.e., in the input fields for various elements) using different input arguments (different independent variables) in the same manner as you would use the built-in functions provided by GoldSim multiple times.  For example, elsewhere in the model you could reference X_Table(10ft, 135kg).

The argument(s) to a table function must have dimensions that are the same as those of the independent variables with which the Lookup Table was originally defined. Hence, in the example above, if you referenced the table as X_Table(10 day, 150 kg), GoldSim would produce an error message, since based on the way that X_Table was defined, the first argument (the Row Variable) must have dimensions of length.

The dimensions of the table function are determined by the Result Units specified when the Lookup Table was defined.

Table functions are always referenced as follows:

1-D Tables: Tablename(Row Variable)

2-D Tables: Tablename(Row Variable, Column Variable)

3-D Tables: Tablename(Row Variable, Column Variable, Layer Variable)

The arguments to a table function do not need to be numbers; they can be links from other elements.

Table functions can also accept arrays as input arguments (and subsequently produce arrays as outputs).  For example, if ABC was a two-dimensional lookup table, ABC(1,2) would return a scalar value.  However, if X and Y were vectors (e.g., of “Days”), then ABC(X,Y) would return a vector of days.  The items would be evaluated by the lookup table on a term-by-term basis.

When you create a Lookup Table, GoldSim automatically lists the table function in the Function menu that is accessible from the context menu within an input field:

Graphical user interface, application, Word

Description automatically generated

There are two ways to add a Lookup Table to an expression:

1.  You can use the context menu to insert a Table function (as shown above).

2.  You can use the Insert Link cursor to reference the table directly:

In either case, the table is inserted as a function (i.e., with parentheses for arguments, and commas if there are multiple arguments):

In addition to the Lookup Tables you have created, there are two additional specialized functions in the Table Functions list (tablemin and tablemax).  Both of these functions require as their argument the name of a Lookup Table element.  They return the mimnimum and maximum vlaue, respectively, of the dependent variable.

In addition to referencing a Lookup Table as described above, GoldSim also provides some specialized ways to reference a 1-D table (i.e., to do an “inverse lookup” and to compute the integral or derivative of a 1-D Table).  These options are discussed in the topics below.

Related Topics…

Learn more about: