Vensim performs error checking in the following order:
1. | Syntax checking. Vensim looks for any syntax errors that can be detected and reported locally. Vensim also checks for incomplete equations at this point. If Vensim finds a syntax error or an incomplete equation, it will not continue with any further error checking. See "Syntax Errors and Incomplete Equations" below. |
2. | Equation type checking. Vensim uses the equations for variables to assign them a variable type as discussed in Variable Types. For models containing subscripts, errors can occur if different variable types are incorrectly mixed within a single variable. See "Problems with Variable Types" below. |
3. | †Subscript Range checking. If a model contains subscripts with subranges or mappings, then mappings are checked to make sure the number of elements match and subranges are checked to be sure they are completely contained within the parent range. |
4. | Lookup usage checking. Vensim checks that any variables defined as Lookups are not used in a different manner, and that other variable types are not used in the way a Lookup function would be used. |
5. | †Subscript usage checking. If a variable is used in different places with different Subscript Ranges, or with a different number of Subscripts, an error will be reported. Vensim also checks that the subscripts appearing on the right and left hand sides of each equation are consistent. See "Subscript Errors" below. |
6. | Uses checking (message only). This flags variables that are not used anywhere in a model and also variables that are marked as Supplementary but also used. See "Usage Messages" below. If Vensim detected an error in stages two through five above, error checking will stop at this point. |
7. | Not defined checking (message only). If any variable appearing in a model does not have a defining equation Vensim will issue a message at this point and treat the variable as a Data variable. See "Usage Messages" below. |
8. | Constant checking. If an unsubscripted variable has a list of values (as in 1,1) an error is reported. †For subscripted variables the subscripts are checked to be sure they contain a single Subscript Range and the number of elements in the range is checked against the number of entries in the list. To fix the error, correct the number of entries in the list for this variable. Constants retrieved from spreadsheets using the GET 123 CONSTANTS or GET XLS CONSTANTS functions are also checked at this point and an error is reported if the values cannot be retrieved. |
9. | Lookup definition checking. Lookups are checked to make sure that they have at least two pairs of numbers. To fix the error, correct the number of entries. |
10. | Multiple equation checking. Unsubscripted variables are checked to be sure that they do not have more than one equation defined for them. †For subscripted variables, every element that is used is checked to make sure it is defined. Any duplicate definitions for elements are reported. See "Multiple Equations" below. If Vensim detects an error in stages eight through ten, error checking will stop. |
11. | Computational Sequence checking. The equations for the model are tested to make sure that they can be properly ordered for computation. Any Data equations are checked first, then Auxiliary definitions and finally the initialization equations. See "Simultaneous Equations" below. |
A number of the above errors that Vensim checks for will never occur if you are building a model using only the Sketch and Equation Editors. Since Vensim allows models to be built in a number of different ways, it checks for errors significantly beyond the scope of what would normally occur.
The following sections provide more detail on how to work with any problems that Vensim uncovers during error checking. In cases where there are significant differences, if you are working with the Text Editor (or loading in a model as text), these differences are discussed in a subsection.