Graphical builtins

The graphical builtins allow you to use the x,y pairs in a graphical variable in other variables, and for other forms of computation. The simplest LOOKUP allows a different x input into the graphical. The others provide different variations.

This section describes the following builtins:

LOOKUP(<graphical variable>, <expression>)

The LOOKUP builtin evaluates the <graphical variable> at the given <expression> (versus using the equation stored in the graphical function itself). This function uses the interpolation model (Continuous, Extrapolated or Discrete) specified in the graphical.

LOOKUPAREA(<graphical variable>, [<tox>, <fromx>])

The LOOKUPAREA builtin returns the area under the <graphical variable> for all X values between <fromx> and <tox>. For example, a graphical that is constant at 1 will have an area given by the <tox>-<fromx>. This is a convenient function for normalizing the output of graphical.

If <fromx> is omitted, the computation will be made from the beginning of the graphical. If both <fromx> and <tox> are omitted the computation will be made over the entire graphical. You can change the order of <fromx> and <tox) - so that LOOKUPAREA(var,3,5) is the same as LOOKUPAREA(var,5,3).

For continuous and stepwise graphicals LOOKUPAREA will ignore (effectively treat as 0) values below the minimum X value of the graphical or above the maximum X value.

For extrapolated graphicals the area is computed using the extrapolated value.

LOOKUPINV(<graphical variable>, <expression>)

The LOOKUPINV builtin reverses the normal lookup logic returning the x value in the <graphical variable> that would generate the given <expression> as output. As long as the graphical is monotonic (the y value getting bigger for each successive x value, or the y value getting smaller for each successive x value) it will return a value. If the graphical is marked as Extrapolated it will use extrapolation to compute a value, otherwise it will return the first or last point when out of range.

If a graphical is not monotonic (including starting of stopping with a flat spot), the first x value to generate the y value will be returned. If there y value is out of range then NAN will be returned.

LOOKUPMAX(<graphical variable>, [ <tox>, <fromx>])

LOOKUPMEAN(<graphical variable>, [ <tox>, <fromx>])

LOOKUPMIN(<graphical variable>, [ <tox>, <fromx>])

These LOOKUP builtins (along with LOOKUPAREA above), allow you to get information about the values in a graphical function. LOOKUPMIN and LOOKUPMAX  find the minimum and maximum Y values in a graphical. LOOKUPMEAN is different in that it finds the mean X value treating the Y values as probabilities (to find the mean Y values use LOOKUPEA(var,x1,x2)/(x2-x1). All take the same arguments.

<graphical variable> is a variable that is a graphical. If the variable is not a graphical these builtins will all return NAN. If the graphical values are being controlled via import, a change from the Results Panela, or a Graphical Input Device on the interface the newly set graphical will be used. If it is being controlled at a constant value (for example via a slider), the original graphical will be used. If this argument is used by itself then the full range of the X axis will be used.

<tox> is the last value of X to consider. If there is no value for <fromx> the first X value in the graphical will be used.

<fromx> is the first value of X to consider.

Note The values of <tox> and <fromx> can be provided in either order. So that LOOKUPMAX(var,1,7) and LOOKUPMAX(var,7,1) return the same value.

LOOKUPMEAN Notes

LOOKUPMEAN is a specialized builtin that will normally be called with only a single argument. It treats the graphical values between <fromx> and <tox> as describing a probability density function (pdf) and computes what amounts to the expected value of X given that pdf. This can be very useful when working with LOOKUPRANDOM, and adjusting the delay time for a conveyor using a profile as described in Spreading Conveyor Inputs.

Most commonly, LOOKUPMEAN will be used on a distribution with the x axis ranging from 0 to 1. For example, to determine the appropriate transit time for a conveyor to achieve a desired average delay you would use:

delay_profile ((0,0),(0.5,1),(0.8,0.01),(0.1,0))

average_delay = 8

transit_time=INIT(average_delay/LOOKUPMEAN(delay_profile)

The conveyor would then use transit_time as the transit time, and the inflow would use delay_profile as the profile.

Note The above equations require that the graphical be defined on the range 0 to 1, otherwise the max value will be distorted and the mean transit time through the conveyor will not be average_delay. Alternatively, using INIT(average_delay/(LOOKUPMEAN(delay_profile)-x_min)/(x_max-x_min)) would work

Concept Link IconSee Also