A variety of functions are available in the Vensim modeling language. This chapter:
• | Contains a full description of all the predefined functions and keywords in Vensim. |
• | Explains the syntax and usage of each function. |
• | Shows how each function treats units of measure. |
• | Discusses Lookup functions, with which you can specify an arbitrary nonlinear relationship. |
The functions in this chapter are listed in alphabetical order, but there are a number of different categorizations that can be useful. To simplify selection, the Equation Editor uses:
• | Common functions are the most often used and this is the default list the Equation Editor presents. |
• | Simple functions have no inherent dynamics. They determine the value of output based solely on the current values of inputs. A function, in mathematical usage, usually refers to a simple function. |
• | All lists all the built-in and external functions - essentially everything in this chapter plus any external function that might have been created. It does not list Lookups or User Macros. |
• | Dynamic functions impart some dynamics, so that the output depends on more than the current value of inputs. Dynamic functions in Vensim are implemented as Macros to enable complete causal tracing. |
• | Delay functions are functions that introduce delays and are useful for tracking discrete elements including attributes in queues. |
• | Financial functions are functions that allow the adding up and manipulation of things within a fiscal period that might be different from the Time Step of the model. These functions operate like both Dynamic and Simple functions at the same time. |
• | Lookup functions are those that have been defined for the model. |
• | Reality Check functions are those that relate to writing Reality Check Equations. These can only be used in Reality Check equations. |
• | Data Only functions are only used with data. Data equations relate to vectors of values over time, and the data-only functions allow some additional manipulation of those vectors. |
• | Array functions are those that relate to arrays (SUM and so on). (Only available with DSS or Professional Vensim) |
• | Macros are Macros that you have entered into the model using :MACRO: definitions. |
There are a number of functions which define a variable's type. Defining functions must appear first on the right hand side of an equation and can not be followed by anything else. The most important defining function is the INTEG function, which defines a variable as a Level variable. Defining function are accessed in the Equation Editor by selecting the type and subtype for the variable.
The keywords listed in the following table are described in detail in the chapters referenced in their descriptions.