INTEG (rate, initial value)

Numerical INTEGration

Top  Previous  Next

Returns the integral of the rate.  The rate is numerically integrated.  The initial value is the value of the variable on the left-hand side of the equation at the start of the simulation.

Restrictions: INTEG must directly follow the equal sign.  It signals Vensim that the variable on the left-hand side of the equation is a Level or State variable.  In the Equation Editor selecting Variable type Level, subtype Normal (the default for variables with boxes around them) will automatically select the INTEG function.

Units:INTEG ( unit / time, unit ) --> unit

The units of the integral must be the same as the units of the initial condition.  The rate must have the same units, divided by the units of TIME STEP.  

Examples

Valid

L = INTEG( R * SUM( A[ S1! ]), 0.0 )

L = INTEG( MAX( A, B ), C )

Invalid

L = A + INTEG( R, 0.0 )   

L = INTEG( B, 0.0 ) + 1     

L = 2.0 * INTEG( R, 0.0 ) + 1.0

INTEG must follow the equal sign, and it cannot be part of a more complex mathematical expression.  These formulations are made valid by defining an auxiliary variable to perform the indicated operations, e.g.

L = INTEG( R, 0.0 )

aux = A + L

 

See also: SINTEG, Computational Sequence

Sample model: INTEG.mdl in FunctionExamples