Please enable JavaScript to view this site.

Vensim Help

Navigation: Release Notes > Prior Version Release Notes > Version 4.1 and 4.2

Function and Language Changes

Scroll Prev Top Next More

The NPV function has changed and there have been a number of new functions added.  

NPV(s,r,ini,m)

The NPV (Net Present Value) function has been changed so that the reported value includes the current activity.  That is NPV(income,.1,0,1) used to start at 0 and will now start at income*Time Step.  

NPVE(s,r,ini,m)

The NPVE function is the same as the NPV function except that it values the stream at the end of each interval and treats intervals as discrete.  This function computes NPV the same way Excel does and so may be easier for some purposes.

DELAY_BATCH(in,bs,bt,ibs,ibo,ibl)  causes a batch delay of the input in  which will cumulate until it is at least as big as the batch size bs  at which time it will begin processing to be released at Time+bt where bt  is the batch time.  While a batch is in process no other batches will begin processing.  If the initial batch size ibs is positive then it will initialize with that batch in process and release it at the initial batch output time ibo.  Note that if ibo is less than or equal to INITIAL TIME the initial output will be ibs.  You can use the initial backlog ibl to specify material initially available for processing but not in process.

DELAY_CONVEYOR(in,t,lr,ip,iq,it) creates a conveyor of the input in  with conveyance time t and leakage rate lr.  Leakage occurs across all material in the conveyor, including that which has just come in.  The initial profile of material is specified by the lookup ip  with iq giving the initial total quantity of material in the conveyor. it  specified the initial conveyance time and should almost always be the same at t.  You can change t to speed or slow the conveyor.

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,im) Returns :NA: if t is before the beginning or after the end of the data series, otherwise returns value.  If im  is -1 it returns the value that occurs at a time less than or equal to the specified time, is im  is +1 it returns the value at a time greater than or equal to the specified time and if im is 0 it returns an interpolated value.  Note that a data value occurring within 1/2 of a Time Step of t is treated as occuring at t.  If t is :NA: the first datapoint is returned.

GET DATA FIRST TIME(d)Returns the time for the first data value in the data variable d.  

GET DATA LAST TIME(d)Returns the time for the last data value in the data variable d.  

GET DATA TOTAL POINTS(d)Returns the total number of data points for the data variable d.  

LOOKUP INVERT(look,y)Returns the value of x which, when passed through the lookup look would return y.  If no value of x would generate y then :NA: is returned so it is important to test this output.  If multiple values of x would generate y the smallest value will be returned.

LOOKUP SLOPE(look,y,mode)Returns the slope of the lookup.  If mode is -1 then NA is returned outside the Lookup’s domain.  If mode is 0 then 0 is returned out of the Lookup’s domain..  If mode is 1 then the first slope is reported below the Lookup domain, and the last slope reported above it.

VECTOR SORT ORDER(a,d) Returns the order that the elements of the vector a  must be arranged in to be increasing (if d is +1) or decreasing (is d is -1).  This is useful for finding the index of the biggest or smallest element and also for reordering a vector using the VECTOR REORDER function.  For example

company : (c1-c5)->scompany

scompany <-> company

so[scompany]=VECTOR SORT ORDER(revenue[company],1)

minrev = VECTOR ELM MAP(revenue[c1],so[c1])

maxrev = VECTOR ELM MAP(revenue[c1],so[c5])

sorted rev[scompany] = VECTOR REORDER(

         revenue[company],so[scompany])

 

Note that it is not necessary to use the subscript scompany in the above example, all the equations could have been written with company and the results would have been the same.  The use of scompany was to emphasize that the meaning of the order has changed.

The values returned are 0 based so that they can be used with the VECTOR ELM MAP function.  That is, the first entry is the number of steps from the first element of the underlying vector to the position of the minimum/maximum element.

VECTOR REORDER(a,so)Sorts the elements of the Vector a according to the order defined in so.  See the above example.  

 

Language Changes

In the range for each variable you can include an increment in addition to the minimum and maximum values.  This is only used for setting slider ranges in SyntheSim.  The format is just units [minval,maxval,increment] or, in the equation editor, you can fill in the three separate edit boxes.

(Pro and DSS Only)  You can specify unsubscripted model variables inside of macro definitions by applying a $ suffix.  For example Time$ can be used to represent time and TIME STEP$ to represent TIME STEP.  Those are actually the two most useful variables to have available without requiring them as argments in the MACRO use.