Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Functions > Data Functions

GET VDF DATA('file','varname',start,slope) GET DATA from VDF file

Scroll Prev Top Next More

Returns time series data from an existing model run or imported data file.

Restrictions: Must appear directly following the data equals sign := and not be followed by anything. ‘filename’ and ‘varname’ must be Literals or String variables. start and slope must be numbers, not variables or expressions.

When a subscripted variable name is passed in varname the subscripts are expanded in the context of the current model. For example, if varname is pop[age,gender] then Vensim will look at the subscripts age and gender in the model to determine what elements they have. The variable will then be expanded (say to pop[young,male], pop[young,female], pop[old,male] and pop[old,female]) and the .vdf file will be queried for these names. If a Subscript is not a Subscript range in the model, it will be treated as a Subscript Element (even if it does not appear in the model at all). The variable name itself does not need to appear in the model, nor be subscripted in any specific manner in the model. Subscript range definitions, if any, associated with the vdf file being read are not used.

The GET VDF DATA function is invoked during simulation setup, before the active simulation begins.  It reads values from the existing .vdf file as time series Data. You can adjust the time base for the data using the start and slope arguments according to the equation

time (in model) = start + slope * time (in vdf)

Normally slope=1 and start=0. If slope is <= 0 both slope and start are ignored.

There are no restrictions on the number of Subscript Ranges used on the left hand side, but ‘varname’ must have the same number of elements. Be very careful when using subscript ranges that do no match exactly as no check is made on the order or families of the subscript elements.

If String variables are used the values of these as modified in any changes files, or though any Venapp commands, will be used.

Normally, if GET VDF DATA runs into any problems, it will return an error and prevent simulation. However, if ‘filename’ is empty then a data value of slope will be returned at time start. This is a useful construct if you want to compare model results with a base run and have not yet made the base run.

 

Units: GET VDF DATA is not part of units checking.  Specify units for the left hand side variable.

Example

size : small,med,large ~~|

shape : round,square ~~|

Baserun Inventory[shape,size] := GET VDF DATA('base.vdf',

         'Inventory[shape,size]',1,0) ~~|

Availability:  Not PLE.

See also: GET DIRECT DATA.

Sample model: GET VDF CONSTANTS DATA LOOKUPS.mdl and GET VDF CONSTANTS DATA LOOKUPS[ss].mdl in FunctionExamples