Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions

Summary List of Functions

Scroll Prev Top Next More

Table 4-1 is a summary table of the predefined functions, which you can use as a quick reference tool. Not all functions are available in all configurations.

 

Function Name

Description

A FUNCTION OF(#,A,B,C,,,)

Shows "generic" relationships -automatically generated by Sketch tool

ABS(A)

Returns the absolute value of A.

ACTIVE INITIAL(A,N)

Defines an Auxiliary with distinct active and initial values

ALLOCATE AVAILABLE(r,pp,a)

Allocates a scarce resource based on the request r, the amount available a and a preference profile pp

ALLOCATE BY PRIORITY (req,prio,siz,wid,sup)

Allocates a scarce resource based on the request, priority and supply over size elements with width

ALLOC P(req,prio,wid,mp)

Like ALLOCATE BY PRIORITY but using mp from MARKETP

:AND:

Logical AND

ARCCOS(X)

Arc-cosine of X in radians.

ARCSIN(X)

Arc-sine of X in radians

ARCTAN(x)

Arc-tangent of X in radians

COS(X)

Cosine of X

COSH(X)

Hyperbolic cosine of X

CUMULATE(A)

Cumulates values for the data series A.

CUMULATEF(A)

Cumulates data series A and stores only the final value as the result.

DELAY BATCH(X,S,T,IS,IT,IB)

Holds the input X till S  cumulates then delays T.  First batch IS output at IT  with IB already cumulated for the next batch.

DELAY CONVEYOR(X,T,L,IP,I,IT)

Delays the input X  on a conveyor for time T with leakage L. IP is the time profile of the initial material I which will has an initial convey time IT.

DELAY FIXED(X,T,I)

Delays the input X for a fixed time T starting with I.

Delays the input X for a variable time T starting with I discarding inputs if T decreases and holding inputs if T increases.

 

DELAY MATERIAL(X,T,I,M)

Delays the input X for a variable time T starting with I and conserving X except that M is used if no delayed inputs are available.

DELAY N(X,T,I,N)

N'th order exponential delay of the input X  starting at I  and conserving X.

DELAY PROFILE(P,X,T,I,G)

An arbitrary delay of X  with average delay time T distributed over a profile P (a Lookup) with initial value I  initially growing at rate G.

DELAY1(X,T)

First order exponential delay of X for time T conserving X

DELAY3(X,T)

A third order exponential delay of X for time T conserving X.

DELAY3I(X,T,I)

Same as DELAY3 but starting at I.

DELAYP(X,T:P)

Same as DELAY3 but also returning P the amount in the pipeline

DEMAND AT PRICE(q,pp,pr)

The quantity demanded given a satiation demand q, preference profile pp and price pr.

DEPRECIATE BY SCHEDULE(P,S,I,T,FS)

Depreciate a payment stream P over time T according the to schedule S with initial values I and the fiscal period starting at FS.

DEPRECIATE STRAIGHTLINE(P,T,F,I)

Depreciate a payment stream P over time T with Fiscal Period F and having initial output I.

ELMCOUNT(sub)

Returns the number of elements in the Subscript Range sub.

EXP(X)

Returns e(2.718...) to the X power.

FIND ZERO(...)

Used to find a zero value for a vector.

FORECAST(I,A,H)

Forecast for I over the time horizon H using an averaging time A.

GAME(X)

X except during gaming mode when the user input is used.

GAMMA LN(X)

Returns the natural log of GAMMA function on X (log of (X-1) factorial for integers).

GET 123 CONSTANTS('f','t','c')

Constants from tab 't' of the 123 file 'f' starting at cell 'c'.

GET 123 DATA('f','t','r','c')

Data from tab 't' of the 123 file 'f'  starting at cell 'c'  time in row or column 'r'.

GET DATA AT TIME(D,T)

The value for the data variable D at time T  or :NA: if not available

GET DATA BETWEEN TIMES(D,T,M)

The value for the data variable D at T  using interpolation rule M :NA: if out of range.

GET DATA FIRST TIME(D)

The first Time at which the data variable D has a value.

GET DATA LAST TIME(D)

The last Time at which the data variable D has a value

GET DATA TOTAL POINTS(D)

The total number of values for the data variable D.

GET XLS CONSTANTS('f','t','c')

Constants from tab 't' of the Excel file 'f' starting at cell 'c'.

GET XLS DATA('f','t','r','c')

Data from tab 't' of the Excel file 'f'  starting at cell 'c'  time in row or column 'r'(if 'r' is a number time  is read across, if a letter time is read down)

IF THEN ELSE(cond,X,Y)

Returns X if condition is non-zero, otherwise Y

INITIAL(A)

Returns the value of A at initialization time and holds it constant.

INTEG(R,N)

Performs numerical integration of R starting at N (defines a Level)

INTEGER(X)

Returns the integer part of X.

INTERNAL RATE OF RETURN(s,f,I,t)

Computes the internal rate of return of stream s with fiscal period f and initial investment/payment I made at time t.

INVERT MATRIX(M,n)

Inverts the Matrix M of dimension n.

LN(X)

Natural logarithm of X.

LOG(X,Y)

Base Y logarithm of X

LOOKUP AREA(L,X1,X2)

Area under the lookup L between X1 and X2.

LOOKUP BACKWARD(L,X)

The y value of L from to the largest x value smaller than or equal to X.

LOOKUP EXTRAPOLATE(L,X)

Returns a lookup value determined by extrapolating the extreme entries.

LOOKUP FORWARD(L,X)

The y value of L from to the first x value greater than or equal to X

The x value that would return Y when used in the Lookup L.

LOOKUP SLOPE(L,X,M)

The slope of the lookup L at X interpolating with mode M out of range.

MARKETP(req,prio,siz,wid,sup)

Returns the market priority (mp) for use with the ALLOC P function.

MAX(A,B)

The larger of A and B.

MESSAGE('msg',d)

Displays the Message 'msg' with display type d.

MIN(A,B)

The smaller of A and B.

MODULO(X,B)

The remainder resulting from dividing X by B.

NPV(S,D,I,F)

Net Present Value of S with discount rate D starting at I multiplied by F.

NPVE(S,D,I,F)

End of period net Present Value of S with discount rate D starting at I multiplied by F.

NET PRESENT VALUE(S,D,F,FS,FO)

Compute the net present value of S usind discount factor D on fiscal period F starting at FS and discount FO into the period.

POWER(A,B)

Raises A to the B power (same as A^B).

PROD( X[r!])

The product of all instances of X in the Subscript Range r

PULSE(S,D)

A pulse of height 1.0, starting at time S and lasting D time units.

PULSE TRAIN(S,D,R,E)

A repeated pulse of height 1.0, starting at time S, lasting B time units and repeating every R time unit until time E.

QUANTUM(A,B)

Largest number  <= A that is an integer multiple of B.

QUEUE AGE AVERAGE(Q,X)

Average age of oldest X elements in  the queue Q

QUEUE AGE IN RANGE(Q,M,X)

Number of elements in a queue between ages M and X  inclusive.

QUEUE AGE OLDEST(Q)

Age of the oldest element of the queue Q.

QUEUE ATTRIB AVERAGE(Q,X)

Average attribute value of the oldest X elements in the queue Q

QUEUE ATTRIB IN RANGE(Q,M,X)

The number of elements of Q with attributes between M and X inclusive

QUEUE ATTRIB MAX(Q)

Returns the maximum value of the attribute in the queue Q.

QUEUE ATTRIB MIN(Q)

Returns the minimum value of the attribute in the queue Q.

QUEUE ATTRIB QUANTITY(Q,X)

Number of elements in queue Q required to have a total attribute of X.

QUEUE FIFO(I,O,P,N,T)

Performs numerical integration of input I  and output O  tracking age with initial age distribution profile P (a Lookup) of quantity N over time T.

QUEUE FIFO ATTRIB(I,O,A,R,P,Q,N,M,T)

The attrib  variation adds in an incoming attribute A, a rate R at which existing attributes change, an initial distribution multiplier Q of the initial attribute M.

RAMP(S,T1,T2)

0 till T1 then a ramp with slope S until T2 and then constant.

 

RANDOM ..

Return random variable.  Almost all RANDOM functions have the common

arguments

m -minimum,

x-maximum,

h-shift relative to the referenced distribution,

r-stretch relative to reference,

s-seed.  Additional arguments are:

RANDOM 0 1 Obsolete - takes no arguments and returns a number uniformly distributed between 0 and 1.
RANDOM BETA(m,x,A,B,h,r,s)BETA alpha=A and beta-B.
RANDOM BINOMIAL(m,x,P,N,h,r,s)BINOMIAL on N trials of probability P (always an integer).
RANDOM EXPONENTIAL(m,x,h,r,s)EXPONENTIAL starting at 0 with mean 1.
RANDOM GAMMA(m,x,O,h,r,s) GAMMA of order O.
RANDOM LOOKUP(l,m,x,h,r,s)LOOKUP using the supplied lookup function as a probability density function.
RANDOM NEGATIVE  BINOMIAL(...) NEGATIVE BINOMIAL for N successes with probability P (integer >= N).
RANDOM NORMAL(m,x,h,r,s) NORMAL with mean 0 and variance 1.  
RANDOM POISSON(m,x,M,h,r,s)POISSON  with mean M (always returns an integer).
RANDOM TRIANGULAR(m,x,S,P,T,s) TRIANGULAR between S and T with peak at P.
RANDOM  UNIFORM(m,x,s)
RANDOM WEIBULL(m,x,S,h,r,s)WEIBULL with shape S starting at 0 with mean 1.

RC ...

Reality Check functions

RC COMPARE('r',var,f[,s[,d]])        Set output to f times var's value in run 'r' with optional start time and duration

RC COMPARE CHECK('r',var,g,f[,s[,d]]) After grace period g compare to f  times var in 'r'.        

RC DECAY(e,t[,s[,d]])        Set output to e decaying over t with optional start time and duration.

RC DECAY CHECK(g,e,t[,s[,d]])        After grace period g compare to e  decaying over time t.

RC GROW(e,g[,s[,d]])        Set output to e growing at rate g with optional start time and duration.

RC GROW CHECK(g,e,t[,s[,d]])        After grace period g compare to e growing at rate g.

RC RAMP(e,f[,st])        Set output to ramp to f times e over t with optional start time and duration.

RC RAMP CHECK(g,e,f[,st])        After grace period g compare to a ramp to e times f over ramp time t.

RC STEP(e,f[,st])Set output to f times e with optional start time and duration.
RC STEP CHECK(g,e,f[,st])After grace period g compare to e times f

REINITIAL(A)

Holds  first value of A but, unlike INITIAL, recomputes on resumed run.

SAMPLE IF TRUE(B,X,N)

Returns X if B is true otherwise holding the value.  Starts with N

SHIFT IF TRUE(V,B,N,A,I)

Shifts N elements of V if B is true accumulating if A is non-zero.  The first element of V is replaced by I.

SIN(X)

Returns the sine of X measured in radians

SINH(X)

Returns the hyperbolic sine of X measured in radians.

SINTEG(R,I,m,x,Q,S,T)

Performs numerical integration of R starting at I but stays bigger than m, smaller than x, is quantized by Q and is S when within T of S.

SMOOTH(X,T)

Returns a first order exponential smooth of X over time T.

SMOOTHI(X,T,I)

Returns a first order exponential delay of X over time T starting at I.

SMOOTH N(X,T,I,N)

Returns a N'th order exponential smooth of X over time T  starting at I.

SMOOTH3(X,T)

Returns a third order exponential smooth of X over time T.

SMOOTH3I(X,T,I)

Returns a third order exponential smooth of X over time T starting at I.

SQRT(X)

Returns the square root of X.

STEP(H,T)

Returns 0 till time T and then H.

SUM( X[r!] )

Returns the sum of instances of X in the Subscript Range r.

SUPPLY AT PRICE(q,pp,pr)

The quantity supplied given a capacity q, preference profile pp and price pr.

TABBED ARRAY( a        b  x         y)

Used to input tab delimited numbers as arrays of constant values.

TAN(X)

Returns the tangent of X (radians).

TANH(X)

Returns the hyperbolic tangent of X.

TIME BASE(start,slope)

Defines a time base for output customization

TIME SHIFT(data,shift)

Shifts data in time.

TREND(I,H,N)

Returns the fractional change rate of I over horizon H starting with N.

VECTOR ELM MAP(vec,offset)

Extracts elements of a vector without directly using their subscripts.

VECTOR RANK(vec,dir)

Returns the rank values for a vector in increasing or decreasing order.

VECTOR REORDER(vec,svec)

Reorders the vector according the specified sort order

VECTOR SELECT(sarray,vexp,mval,act,err)

Select elements of a Vector.

VECTOR SORT ORDER(vec,dir)

Returns the sort order for a vector in increasing or decreasing order

VMAX(X[r!])

Takes the maximum of X over the subscript range r

VMIN(X[r!])

Takes the minimum of X over the subscript range r.

Returns the y value of the xy pairs L# corresponding to x.

X IF MISSING(expr,X)

Replaces missing data with X specified value

XIDZ(A,B,X)

Returns X if dividing by zero (B =0) otherwise returns A divided by B.

ZIDZ(A,B)

Zero (0.0) if dividing by zero (B=0) otherwise returns A divided by B.