Please enable JavaScript to view this site.

Vensim Help

In Vensim, subscripts allow a single variable to represent multiple types.  This can cause problems if you mix incompatible types, as exemplified by the following equation:

income[USA] = workers[USA]*wage_rate[USA] ~~|

Income[USSR] = INTEG((planned_income[USSR] -Income[USSR])/PLAN_TIME, 
planned_income[USSR]) ~~|

Here, income attempts to act as both Auxiliary and Level, which is not permissible.  Here are permissible mixtures with the arrow showing how variables of mixed types will be treated:

       Data, Constant ----> Data

       Auxiliary, Data, Initial, Constant ---> Auxiliary

       Level, Constant, Data ---> Level

You cannot mix Levels with initial conditions.  However, you can accomplish the same thing with INTEG(0,initial_condition).

You cannot mix Lookups with anything else.

In addition to the defined variable types, there is an implicit type called missing.  Missing simply means that there are no equations defining some components for the variable.  Although you can sometimes use missing types intentionally, if you refer to a missing component of a variable, you will receive an error message.

For example:

country: CANADA,USA,MEXICO ~~|

population[USA] = 240E6 ~~|

population[CANADA] = 23E6 ~~|

births[country] = .02*population[country] ~~|

yields the error message

ERROR: Used, not Computed - POPULATION[MEXICO]

If you do not define any component of a variable with an equation, Vensim assumes the variable is exogenous in all its subscripts regardless of whether all of its subscripts are used.  Thus, if you have the equation

profit[GM] = revenue[GM] - COSt[gm] ~~|

PROfit[other] ~~|

and no equation for COSt, you must enter values for COSt for all manufacturers.  If you add the equation

COSt[GM] ~~|

you no longer need to do so.