Please enable JavaScript to view this site.

Vensim Help

Navigation: Appendix > Files > .mdl Model Files

Objects

Scroll Prev Top Next More

The remaining lines till a new \\\---/// marker are all interpreted as objects.  Each line begins with 2 numbers.  The first is the object type, the second the object id.  Normally id's begin with 1 and count up, though there may be gaps due to movements and deletions.  The interpretation of the information after these two numbers depends on the first number.

1 - Arrows

The format for an arrow line is

1,id,from,to,shape,hid,pol,thick,hasf,dtype,res,color,font,np|plist

for example

1,3,5,1,4,0,0,22,0,0,0,-1--1--1,,1|(204,71)|

from,to - These are the words the arrow connect (from and to in the direction of causality).  The words are numbers  corresponding the id numbers used in the definition of the words.

shape - determines the shape of the arrow (arc, polyline and so on).

hid - hidden - Indicates whether or not the arrow is hidden. If nonzero it specifies the hide level.

pol - polarity - this is the ASCII code of the polarity character to be displayed with the arrow (note that only ASCII characters are supported, not any Unicode sequences).

thickness - The thickness of the arrow connecting words.  Larger than 20 is used for double parallel lines.

hasf - hasfont - Indicates what if any changes should be applied to the arrow relative to the sketch default font and color.  This is a bitwise or with bit 1 for arrow color, 2 for polarity color, 4 for polarity size, 5 for polarity attributes and 6 for polarity face.

dtype - delay type - Used to indicate the delay marking for the arrow.

res - reserved - reserved should be 0.

color - this is the color of the arrow or -1--1--1.  The color is only relevant if the first bit of hasfont is set.

font - A full font or just a color for the polarity or blank.  This is only used if hasfont is bigger than one.  Which parts of the font are relevant is determined by hasfont.

nc - number of points - The number of intermediate points in the arrow.  This is always 1 for arc arrows, but may be more for polyline and perpline arrows.

pointlist - The coordinates of the points.  Must be one for each point.  In the format (x,y)|(x2,y2)|...

10, 11, 12, 30, 31- Variables, Valves, Comments, Bitmaps, Metafiles

Variables, valves and comments all have pretty much the same information.  

n,id,name,x,y,w,h,sh,bits,hid,hasf,tpos,bw,nav1,nav2,box,fill,font

where n is 10, 11, 12, 30 or 31 for variables, valves, comments, bitmaps and metafiles respectively.

name - name is the name of the model variable the word represents as in

10,1,Population,275,69,40,20,3,3,0,0,0,0,0,0

In the case of a valve it is a number that will be ignored as in:

11,5,48,167,71,6,8,34,3,0,0,1,0,0,0

Comments and IO Objects

In the case of a comment the name is just index of the icon for the comment as in

12,7,48,487,70,8,8,0,3,0,0,-1,0,0,0

where the 48th icon is the cloud.  The comment index will be ignored if the comment does not display an icon.  Note that if the bit in the 3rd position of bits is set (the number includes 4 when written as the sum of powers of 2), the text for comments will appear on the line that follows the basic comment information. For example:

12,16,0,269,22,37,9,8,4,0,0,-1,0,0,0

Comment

Input output objects are stored like comments except that the 4th bit of bits (8) is set. The type of the input object is specified in the tpos entry with 0 for a slider, 1 for a custom graph, and 2 for a variable name and workbench tool. The line following the declaration contains the definition for the object control. Custom sliders appear as

variable,min,max,increment

(the 7th bit of bits, normally used signal causality does not propagate, is set if the slider should be labeled below by the variable name).

For Custom Graph objects the line contains simply the name of the custom graph. For Workbench tools it contains

variable,toolname

Navigation links normally use the line following their declaration to store the text to be displayed just as any other comment. However, when the navigation link is set to either open a file or a web site the file or web site name appears first, then a vertical bat | followed by the text as in

http://www.vensim.com|open vensim.com

 

For bitmaps and metafiles the name on the line below is actually a name of a file containing the bitmap or metafile.

x,y - is the position of the word.  All coordinates refer the center of the word.  x increases to the right, and y downward.  These are interpreted in pixels.

w,h - width,height - the width and height of the word.  Each is actually half the total value.  Subtracting width from x is the left side, adding width to x is the right side and so on.

sh - shape - the shape around the word.  The first 5 bits refer to the shape.  The sixth bit (1<<5) is used to indicate that the word is attached to a valve (or the valve to another word), the seventh bit is used to indicate that the shape is determined by type and the 8th bit is reserved.  

bits - This is a bitwise or'd value to indicate whether in arrows are allows (bit 1) and whether arrows can start from the word (bit 2).  Bit 3 is used to indicate if there is a comment string that will follow on a second line. Bit 4 is used to indicate that the object is an IO object. Bits 5 and 6 are used internally as hints about sizing and position during sketch editing. Bit 7 is used to indicate that the no causes propagate through the comment. Bit 8 is used to indicate that the use has set the size of the word specifically.

hid - hidden – specifies the hide level of the word. 0 means not hidden then 1 through 16 for different hide levels. Bit 6 of hid is set for comments that are supposed to appear only at the exact hide level specified.

hasf - hasfont - indicates whether or not the word has a special font - this is a bitwise or'd flag.    The first bit is set if there is a special box color, the second for a word color, the third for a fill color, the forth for a font size, the fifth for font attributes and the sixth for a font face.

tpos - textpos - textpos indicates the position of the word relative to the shape.  0 is inside, 1 below, 2 left, 3 above, 4 right. For input output objects 0 is a slider, 1 a custom graph and 2 a variable and workbench tool.

bw - boxwidth - boxwidth indicates the width of the box surrounding the word.  0 is the default (1 pixel on the screen).

nav1 – navigation 1. The sketch number to navigate for navigation links. If nav2 is 251 then a 0 in this position means previous view and a 1 means next view. If nav2 is 253 and nav1 is 253 this signals an external navigation line, so that a file or website should be opened.  Otherwise this number specifies the 1 based view number to navigate to.

nav2 – Normally this is 0 except for the cases noted above. However, if a model has more than 255 Views the view number is determined by nav1 + 256*nav2.

The following may be empty if hasfont is 0.

box -  box color - indicates the color of the shape for the word - check hasfont.

fill - fill color - This indicates the fill color for the shape - check hasfont.

font - If the font has face, color or attributes set a font or color will appear here.

NOTEThe end of a sketch definition is marked by the end of the file or a new view starting \\\---///.

Input Output Objects are recorded as comments. The 4th bit in bits is set to indicate it is an Input Output object.  The type of object is recorded in the tpos field and the contents appear in the comment field in the form varname,action or just action for Custom Graph output objects.