Please enable JavaScript to view this site.

Vensim Help

Navigation: Appendix > Converting Models

Converting DYNAMO Models to Vensim

Scroll Prev Top Next More

If you installed the sample models, you will have a utility named dyn2ven.exe that converts DYNAMO format files to Vensim format.  Since the placement of comments and units is more structured in Vensim than in DYNAMO, there are a number of options for the conversion.

1.A single source file in which the equations are followed by comments (after a space or new line).  The comments end with the units of measure enclosed in parentheses.  For example,

A deaths.k=pop.k*drn  Total number deaths.(person/year)

2.Same as 1, except the units are at the beginning of the comment,

A deaths.k=pop.k*drn (person/year) Total number deaths.

3.A separate definition file contains the comments, with the equation file containing the units of measurement,

A deaths.k=pop.k*drn (person/year)

and the definition file containing the definition,

deaths   The total number of deaths.

4.Again a separate definition file, but where the units are included in the definition file with the equation file containing only the equations,

A deaths.k=pop.k*drn

and in the definition file,

deaths The total number of deaths.  (person/year)

NOTE In all cases units must be in parentheses.

To invoke dyn2ven at the DOS prompt (this is not a Windows application) type

dyn2ven -3 rabbit.dyn rabbit.def rabbit.vmf

where the numberĀ  -3 corresponds to the format of your DYNAMO model.  If no number is specified, -1 is assumed.  If the DYNAMO model contains no comments or units, the first option will still translate correctly.  

On the Macintosh double click on the Dyn2Ven icon and you will be prompted for a file name.  When you select the file you want to convert you will be queried for additional options.  Type them in the same format used for DOS but skipping the first named file.

The conversion process is generally not completely automatic.  Some elements (especially FINAL_TIME, SAVEPER, and INITIAL_TIME) are different.  Defaults are put in, but, some editing is usually required after conversion.   To illustrate this, there are three files on the models disk that you can compare:   burnout.dyn, burnout.vm1, and burnout.vmf. The file burnout.vm1 is the output of the conversion process.  It was created using the command

dyn2ven -1 burnout.dyn burnout.vm1

The file burnout.vmf is a working Vensim model.  The last few lines differ between these two models, showing what additional editing was required.

Variable Names

There is a switch in dyn2ven that will allow you to translate comments into variable names.  This can be helpful if the comments are both descriptive and unique.  If the comments are not unique this is not useful at all.  To translate comments to variable names follow the format number by a 0 and, optionally, the number of letters per word, and the number of words to be retained (the default is 3 letters and 6 words).  For example

dyn2ven -1046 b1.dyn b1.vmf

would use the first 4 letters of the first 6 words in the comment, while

dyn2ven -10ZZ b1.dyn b1.vmf  

would use the entire comment.

Things to Look Out for

Because Vensim macro have a different convention for directly using model variables (that is you must add the suffic $) look out for macros that use Time, TIME_STEP and possibly other variables as arguments.

The file dynamo.mac contains macro definitions for functions in Dynamo that are not directly supported in Vensim.  Where possible the translation program will attempt to be sure the arguments passed are sufficient to compute the macros.

Dynamo N equations for Time may not be correctly translated.  Initializing time should be done using an INITIAL_TIME = equation.