In some cases, you may wish an external program to directly generate a look-up table that you can use to dynamically define a Lookup Table element.
To facilitate this, GoldSim allows you to define the table using an External element. The entire table then becomes an output of the External element, which can subsequently be linked to a Lookup Table element.
In order to specify that an output of the External element is a table, you must indicate that the Data Type of the output is a 1D, 2D, or 3D Table Definition (when you define the Type… for an output argument):
As seen above, in addition to defining an output of an External element as a Value or a Condition, you can also define an output whose data type is a 1D, 2D, or 3D Table Definition. These three special data types can only be produced by an External element and outputs of these types can only be used in special locations within GoldSim (i.e., an input defining a Table element's data).
Since the table itself is being defined by an external function (and will subsequently be linked to a Lookup Table element), it is necessary to specify the units for the numbers representing the table that are being passed into GoldSim by the external function.
As a result, when you add an output argument and define it as a Lookup Table, the dialog for defining the output differs depending on whether the data type is a 1D, 2D, or 3D Table Definition. In all cases, the External Units represent the units for the independent variable. For a 1D Table Definition, you must also define the units for a single independent (Row) variable. For a 2D Table Definition, you must define the units for the two independent (Row and Column) variables. For a 3D Table Definition, you must define the units for the three independent (Row, Column and Layer) variables. Here is an example of what the output argument dialog looks like for a 2D Table Definition:
You link a Lookup Table to an external function by selecting “External DLL” from the Data Source field at the bottom of the Lookup Table dialog:
When you do so, a new tab (External DLL) is added to the dialog. You use this tab to specify the name of the External element output that defines the table.
Note: In order to link a 1D, 2D, or 3D Table Definition output from an External element to a Table element, the dimensions of the External Units specified in the dialog for the output must be consistent with the Result Units and the independent variable units specified when defining the Lookup Table element.
Note: After you have defined a Lookup Table element externally and run the model (so that the DLL has loaded the table into the Lookup Table element), you can view the table definition created by the external function by pressing View Data…. In addition, if you have run the model and you subsequently "uncouple" the External element from the Lookup Table element (by selecting “None” from the Data Source drop-list in the Lookup Table dialog), the data in the table will become accessible (by pressing Edit Table…).
The specific format in which an external function passes table definitions to GoldSim is discussed in Appendix C of the GoldSim User’s Guide.
Learn more about: