Please enable JavaScript to view this site.

Vensim Help

Navigation: Reference Guide > Simulating Models > Changing Constant and Lookup Values

Constant Input Files (Not PLE or PLE Plus)

Scroll Prev Top Next More

If you name a changes file in the Changes tab of the Simulation Control, Vensim searches for it when the simulation begins, or when you start making interactive Constant or Lookup changes.  By naming a changes file and then making interactive Constant and Lookup changes, you can easily build on previous scenarios.

Changes files can have any extension, but they default to .cin if no extension is specified.  The format for .cin (Constant INput) files is much the same as that of Constant and Lookup equations, except that the tildes ~ and bars | are not needed.  A constant file might look like this:

CONSTANT NAME  1= 123.4

CONSTANT NAME 2[sub]= 3,2,7

constant name 3= 120.0

CONSTANT NAME N= 332.2

LOOKUP NAME 1( 1,2,3,4,5,0,2,4,5,9)

LOOKUP NAME 2(-1000,0,1,2,3,4,5,1000, 0,0,2,5,7,8,9,9)

LOOKUP NAME 3((0,0),(1,1),(2,1))

STRINGVAR NAME :IS: 'literal string'

The order of entries, spacing, and capitalization is arbitrary.  Spaces and underbars _ are considered the same, and multiple contiguous spaces and underbars are collapsed to a single space.  Repeated changes to a Constant, Lookup or String Variable will overwrite the old values.  The number of entries in a Lookup can change from the number in the model.  Subscript Ranges can be used in Constant equations just as in the modeling language.  You cannot change something that is not a Constant, Lookup or string Variable. Changes files are read after any GET XLS... calls and will override values from these calls.

Variables that cannot be found or are misspelled cause errors.

For convenience, the format of the optimization control file is also supported in the Changes file reader.  Thus the lines:

0.0<= NORM FRAC BIRTH[CHINA] = .015 <= .1 FRAC

and

NORM FRAC BIRTH[CHINA] = .015 

have the same effect.

To add comments to Changes files, add :C to the beginning of lines, as in

:C Low resource run
INITIAL RESOURCE=100E4

:C high resource run

:C INITIAL RESOURCE = 100E12

You can also add comments to the end of lines by entering the comment after a tilde ~, or to the middle of lines by enclosing a comment in curly brackets {}, just as in a model.  Comments are ignored.  The following examples are all valid ways of adding comments to lines.

INITIAL RESOURCE={100E4}100E12 ~Low/high choice

~INITIAL RESOURCE=100E30 ~ unbelievably big 

{INITIAL RESOURCE= 100e2} {real tiny }

This first line sets INITIAL RESOURCE to 100E12.  The second and third lines do not do anything but could easily be commented back in.  The choice of ~ or {} is purely aesthetic.

Messages

You can also control message sent during a simulation from the changes file. To suppress the message that the change file is being read as the fist line enter

:NOMSG

Or, if you would like a custom message to be displayed then include as the first line something such as:

:MSG Changes based on information collected as of March 7, 2008

The :NOMSG and :MSG lines must appear as the first line or the will be ignored.

It is also possible to selectively suppress messages about data availability and range exceptions that appear during simulation. All of these can be entered anywhere in a changes file and take the form

:key var[sub]

where key is one of  NODATA, BEFORE, AFTER, BELOW, ABOVE, LBELOW and LABOVE and var[sub] is a model variable subscripted as in the model with either subscript ranges or subscript elements.

:NODATA – is used to suppress the message that there are no values found for the variable in the data files. If the data equation uses GET XLS DATA then this happens when the specified row or column is blank.

:BEFORE – is used to suppress the message that the simulation starts before values are available for an exogenous variable. The message stating the simulation time has come into range of the data is also suppressed.

:AFTER – is used to suppress the message that the simulation time has based the available data for an exogenous variable.

:BELOW – is used to suppress the message indicating a variable is below its range. The message indicating the variable has come back into range from below is also suppressed.

:ABOVE – is used to suppress the message indicating a variable is above its range. The message indicating the variable has come back into range from above is also suppressed.

:LBELOW – is used to suppress the message that the input to a Lookup function is below the first x value in the set of lookup pairs. Note that the variable refers to the place the Lookup is used, not the Lookup itself (though these are the same for an Auxiliary with Lookup). When the input comes back into range the message is also suppressed. If a variable uses multiple Lookups this applies to all of them.

:LABOVE – is used to suppress the message that the input to a Lookup function is above the last x value in the set of lookup pairs. Note that the variable refers to the place the Lookup is used, not the Lookup itself (though these are the same for an Auxiliary with Lookup). When the input comes back into range the message is also suppressed. If a variable uses multiple Lookups this applies to all of them.