Although the .vgd file commands for each tool can contain different information, there are common elements and rules governing the use of keywords, labels, references to runs, and variables in all .vgd files. A sample .vgd file might contain:
:GRAPH Test Graph one |
:VAR V1|Volume |
:DATASET *2 |
:GRAPH Test Graph 2 |
:Var myvar[ott] |
:DATASET exper1 |
Two graphs are defined. The following concepts help structure these graph definitions.
Keywords (such as ":GRAPH") are used to describe output.All keywords must begin with a colon :. The keyword can begin anywhere on a line, but must be the first element on the line. The keyword must be separated from the rest of the line by a space or an equal sign =.
Labels (such as "Volume") are strings that will appear in the output exactly as entered in the .vgd file.Labels appear after a vertical bar | and continue to the first comma , or until the end of the line . Quotes, more vertical bars, and everything else except commas , are included directly in the label without alteration. Labels cannot include new lines or commas.
Nesting is shown with indentation but interpreted solely by context. Graph and table descriptions are often hierarchical. In the documentation, this hierarchy is indicated with indentation, but Vensim itself does not pay attention to indentation. Vensim keeps track of hierarchy by keywords and acts accordingly. For example, the beginning of a graph or table description, as occurs with the second ":GRAPH" above, always ends the current graph or table description.
Datasets (such as "exper1") can be accessed whether or not they are loaded. When you refer to a dataset in a description, Vensim searches the disk to find the dataset. If the dataset is not already loaded in Vensim, it will be loaded while the output is produced and then unloaded. If the dataset does not exist, an error message is displayed.
Wildcard datasets (such as "*1") can be used to refer to one of the currently loaded datasets. Instead of explicitly naming a dataset, you may use an asterisk * and a number from 1 to 9 to denote the corresponding dataset in the Dataset Control dialog. For example, "baserun" would use values from the file baserun.vdf, whereas *2 would use the second loaded dataset. If you omit references to a dataset, Vensim uses the first or last loaded dataset (depending on whether Vensim is configured to load datasets in first or last position - see Dataset Control Panel). Use *B to refer to the last loaded dataset. Use * to refer to all loaded datasets. Use # followed by a number (such as "#3") to refer to all loaded datasets up to and including that one. For example #3 will use the first, second, and third loaded datasets.
Wildcard variables (such as "myvar[ott]") can be used to access different instances of subscripted variables. A subscripted variable can represent more than a single value. If you enter a variable name with no subscripts and that variable is subscripted, Vensim searches the associated Subscript Selection dialog and uses the first entry determined from these. If you explicitly include Subscript Ranges in the variable name, Vensim will refer to the subscript selection list and use all entries determined from these. For example, if ott is a Subscript Range having elements ONE,TWO,THREE, with TWO and THREE selected, then myvar is the same as myvar[TWO], and myvar[ott] yields myvar[TWO] and myvar[THREE].
Long lines can be continued with a backslash \ followed immediately by a new line.
NOTE.vgd files are not case sensitive.