Inverse Lookup: Referencing a 1-D Lookup Table Using the Dependent Variable

In some cases, you may want to do an inverse lookup into a Lookup Table.  For example, suppose that you had defined a Lookup Table in which the independent variable is the volume of water in a pond, and the dependent variable is the water elevation in the pond (hence, the values in the table are determined by the shape of the pond). You would then use the Table to return a value for the water elevation for a specified value of the volume. However, what if you wanted to know the corresponding volume for a specified value of the water elevation? 

GoldSim supports this by allowing you to carry out a reverse lookup; that is, you can reference a 1-D table by sending it a value for the dependent variable, and the function will return the corresponding value for the independent variable.

To implement this, you must add a second argument to the table function:

Tablename(Row Variable, TBL_Inverse)

Using the example described above, if you had a Lookup Table (named Elevation) in which the independent variable is the volume of water in a pond, and the dependent variable is the water elevation in the pond, then the following expression would return the elevation corresponding to a volume of 150 m3:

and the following expression would return the volume corresponding to an elevation of 10 m:

Several points should be noted:

   If the argument is outside of the range of the table, GoldSim issues a fatal error (regardless of the Handling of Data Outside Bounds field setting).

   If the table is non-monotonic, the function returns the first value of the row variable that corresponds to the argument.

   The TBL_Inverse argument can only be used with 1-D tables.  It cannot be used by 2-D and 3-D tables.

An example model which illustrates the inverse function (TableFunctions.gsm) can be found in the General Examples/LookupTable folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu).

Related Topics…