Lookup-Number-Interpolated

Purpose

To perform a linear interpolation using a set of X-Y points specified in the form of a lookup table and an option to do linear extrapolation for points outside of the specified X-minimum and X-maximum.

Type Name

‘lookup_number_interpolated’

Definition Syntax

[lookup_set_key] : [lookup_key_field: [extrapolate]

where:

  • ‘lookup_set_key’ is the key used to identify the lookup set in the Juno Cassandra model setup. For this function, the lookup set should have keys and values that are numerical values representing X, and Y value pairs, respectively.
  • ‘lookup_key_field’ is the key to extract the value from the value dictionary. This value will then be used as the X-value for which to calculate the interpolated value.
  • ‘extrapolate’ is a ‘true’ or ‘false’ value indicating if you want to extrapolate when the X-value is smaller than the minimum X or larger than the maximum X provided as keys in the lookup table.
Important

For the JFunction Lookup-Number-Interpolated to work, you should ensure that the values held in the ‘setting_key’ as well as the ‘setting_value’ columns of the lookups table are all numeric values with no repeating keys (i.e. X-values). If your values are not numeric, or if you repeat any of the keys an error will be thrown.

The Lookup-Number-Interpolated is basically a Piecewise-Linear JFunction with X-Y pairs specified in the form of a lookup table. This is a convenient formulation of a Piecewise Linear function when you have a number of fixed X-Y pairs.

Example

For this example, we assume your Juno Cassandra model setup file has on the mandatory sheet ‘lookups’ the following table:

Figure 1: JCass Lookup Sets

As you can see from the above figure, there are three ‘lookup sets’ with names/keys: ‘general’, ‘lookup_example’ and ‘defaults’.

Now, given the above setup for our JCass lookup sets, we can define a JFunction Number Lookup as follows:

‘lookup_example : f_surfAge : false’

This function definition instructs JCass to do the following:

  1. Use the lookup set with name/key = ‘lookup_example’
  2. Extract the value matching key ‘f_surfAge’ from the value dictionary, and
  3. Use the value from (2) to interpolate on the X-Y pairs (0,0), (10,1) and (20,0).

The three X-Y pairs basically define a triangular function with a zero value when X is zero or below, and when X is 20 or above. The apex of the triangular function is located at X = 10. For any X between zero and 20, linear interpolation will be applied. Thus if the value for ‘f_surfAge’ from the value dictionary is 15, the interpolated value will be 0.5. (You can of course define as many -X-Y pairs as you want to represent a function shape as needed by your model).

Since the flag for ‘Extrapolate’ was specified as ‘false’, if the value matching key ‘f_surfAge’ for the current element is -1, then this JFunction will return zero because -1 lies below the lowest X-value of zero.

See Also

Exact/Code Lookup

Number Lookup

Multi-Column Lookup

Piecewise-Linear Function