Please enable JavaScript to view this site.

Vensim Help

The use of a Lookup function is the same as that of the predefined functions that take one variable, as in:

outvar = lookup name(invar) ~~|

Units NOTE:Variables coming into a Lookup function are recommended to be dimensionless, and a warning message is given during units checking if they are not.  The output of a Lookup function has the dimensions specified in the definition of the Lookup.

When used in the above manner the value of the output is determined by linear interpolation of the lookup, as in:

Here the dark circles represent the points on the Lookup, corresponding to ((0,0),(1,2),(2,3)).  The dashed line connecting the points shows how the lookup is interpolated.  The dashed lines to the right and left show that if the input is below 0, the output will be 0, and if the input is above 2, the output will be 3.  Three sample inputs (.67,1,1.7) and their respective outputs (1.3,2.0,2.7) are shown.

Lookups in Vensim will always hold the first or last value when the input goes outside the range of the Lookup.  You will receive a warning message whenever this happens.  

If you wish to have Lookups extrapolate, you should use the LOOKUP EXTRAPOLATE function, or define a large minimum or maximum input value as in:

extrap up lookup ((0,0),(.5,7),(.75,.9),(1,1),
       (2,2),(1E6,1E6))

Example 1

effect energy tab (
(0.0,0.0), (0.1,0.2), (0.2,0.4),(0.3,0.6), (0.4,0.7), (0.5,0.8), (0.6,0.85), (0.7,0.9), (0.8,0.95), (0.9,0.98), (1.0,1.0), (1.2,1.02), (2,1.02) )

~dimensionless

~ The effect of energy availability on industrial production.
|
production = nominal production
* effect energy tab( US energy
* fraction available - energy losses )
~ quads / year
~ energy-availability limited production rate

|

Example 2

effect energy tab(0, 0.5, 1.0, 2.0, 
        0, 0.7, 1.0, 1.1)
~  dimensionless
~ The effect of energy availability on industrial production.
|
production = nominal production 
* effect energy tab( energy availability )
~ quads / year
~ production rate limited by energy availability
|

The x,y pairs for a Lookup can be altered at runtime, and the number of x,y pairs specified in a Lookup can be increased or decreased.