Vensim
                 e s
                Chapter 6
     Building a Simulation Model



Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Naming Conventions
     g
     Levels – initial capital letters; e.g., Population
     Rates, auxiliaries, constants, lookups, data variables – all lower 
     Rates auxiliaries constants lookups data variables – all lower
     case; e.g., average lifetime




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Sketch Conventions
 Sketch Conventions
     Levels or stocks are entered with the Box Variable tool
     Levels or stocks are entered with the Box Variable tool
     Rates are entered with the Rate tool




         Box Variable - Level         Rate




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Sketching the Rabbit Model
        g
 File > New Model




                                     1                                           5
                                     2
                                                                           Type the name
                                                                         Population and press
                                     3                                           enter
                                                                                   t




                 4



Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim          December 2010
Sketching the Rabbit Model
        g

          9

                  7        8   6



          6                              5             6


                  8


                 7                                                       7



 A positive feedback loop from Population to births increases 
 Population, and a negative feedback loop from deaths 
 decreases Population
 decreases Population
Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim       December 2010
Writing Equations
      g q
 births = population * birth rate
 Birth rate has not causes; it is constant in the model
 Bi th t h        t         it i      t t i th      d l




                                                Equations                  All the variables in the
                                                                           model will turn black.

                                                                           The highlights indicate
                                                                           which variables still
                                                                           require equations or
                                                                           have incomplete
                                                                           equations


Vensim Chapter 6: Building a Simulation Model     Presented by Diana Lim          December 2010
Checking y
       g your model
 Model > Units Check




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Variable Type: Auxiliary
          yp           y
 Click on variable births


                                  2



      1




                            3




                   4

Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Variable Type: Level
              yp
     Click on variable population
                                       equation is already present in the equation editing box

                                       Rates constructed by clicking first outside, and then on the Level
                                       are considered positive (inwards) flows; rates constructed by
                                       clicking on the Level, and then outside the Level are considered
               2                       negative (draining) flows

1



               3




           4
    Vensim Chapter 6: Building a Simulation Model      Presented by Diana Lim            December 2010
Variable Type: Constant
          yp
 birth rate

                  2




 1



                        3    this means that the fractional birth
                             rate is measured in fraction (of
                             rabbits) per year.



              4

Vensim Chapter 6: Building a Simulation Model      Presented by Diana Lim   December 2010
Variable Type: Constant
          yp
 average lifetime


            1




                2




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Variable Type: Auxiliary
          yp           y
 Click on variable deaths


                            1




                 2




        3

Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Checking y
       g your model
 Model > Check Model




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Checking y
       g your model
 Model > Units Check




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Unit Equivalents ( y
      q          (Synonyms)
                       y )
 Fail in Units check because Vensim does not see the plural 
 form as the same word
 form as the same word
 Model > Settings...

                                    1




                     2



                         3


Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Simulating the Model
           g
                                                                  2
                                1
Double click on the Runname editing
box on the Toolbar and type equilib for
                        yp q
the first run name.




    Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Model Analysis
          y
 Click on the Level Population in the sketch.
 Click on the Graph t l A
 Cli k    th G h tool. A graph of Population i
                                 h fP      l ti is generated:
                                                         t d




2                                                       1
    Graph




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Model Analysis
          y




 Population appears as a flat line at the top of the graph at 
 P     l i                fl li        h       f h       h
 1000 rabbits. To check that no change is occurring,
 Click on the Table tool
   l k     h    bl     l
                                                                         Output window
                                                                          shows that
                                                                          Population is
                                                                          unchanging.


Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim    December 2010
Simulation Experiments
             p
 Click on the SyntheSim      button . Answer yes to 
 whether you want to overwrite the existing run.
 whether you want to overwrite the existing run
 The toolbar will change to 

 and you will see variable behavior for all elements on the 
 diagram.
 di




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Simulation Experiments
             p
 Click on the Runname editing box and replace equilib with the 
 name growth.
 name growth
 Drag the slider beneath birth rate up till it shows 0.2 as its 
 value.




 The blue lines show the current run and the red line the 
 equilib run results
         run results.
 Click on the Stop button to stop SyntheSim.
 View>Show Behavior to see behavior graphs again.
 Vi >Sh B h i t               b h i        h     i
Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Alternative Simulation Setup
                           p
 Click on the Set up a Simulation button
 The Toolbar changes to the simulation toolbar.
 The Toolbar changes to the simulation toolbar

 notice that the constants turn into yellow words with blue 
    ti th t th        t t t      i t    ll      d ith bl
 background
 Also, the sketch tools are grayed out, preventing work in the 
 Also the sketch tools are grayed out preventing work in the
 sketch window.
                                                             Click on the variable birth rate
                                                             and in the editing box
                                                             type the value 0.2

                                                             This is a temporary change for
                                                             this run only and does not
                                                             permanently alter the value in
                                                             your model.
                                                                       d l

Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim        December 2010
Causes Strip Graph
           p    p
 Click on Population to select it into the workbench.
 Click on the Control Panel button
 Cli k    th C t l P       l b tt
                                 1




                           2


                                                The last run you made (growth)
                                                is loaded first (at the top of the
                                                dialog).




Vensim Chapter 6: Building a Simulation Model    Presented by Diana Lim         December 2010
Causes Strip Graph
           p    p
 Click on the Graph tool. A graph will show both runs




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Causes Strip Graph
           p    p
   Now click on the Causes Strip tool.


Causes Strip




 Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Runs Compare
        p
  Click on the Runs Compare tool.
  shows the differences in the Constant birth rate for runs 
  equilib and growth.



Runs Compare




  Population grew in the growth run because the birth rate was 
  set to a higher value than the equilibrium value. This made the 
  positive feedback loop through births stronger than the 
  positive feedback loop through births stronger than the
  negative feedback loop through deaths, resulting in Population 
  growth over time.

 Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Exponential Decay
  p             y
 make changes to a model Constant to generate exponential 
 decay or decline in the population
 decay or decline in the population
                                          1
           1
                                                      4    2

                                                                         Drag the Slider under
                                                                         average lifetime till it
                                                                         displays
                                                                         di l a value of 4
                                                                                      l    f 4.

                                                                         Click on the Stop
                                                                         Button
                                                       3



 Click the Simulate button and the model will simulate


Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim         December 2010
Exponential Decay
  p             y
 Click on the Graph tool and compare the three runs.
                                          1



                                                                         double click
                                                                         on the run equilib in
                                                                         the right box; this will
                                                                          h i h b        hi ill
                                                                         unload the run so the
                                                2                        Analysis tools will
                                                                         not examine it
                                                                                      it.




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim         December 2010
Exponential Decay
  p             y
 Click on the Causes Strip tool 
 to show Population and its 
 to show Population and its
 causes— births and deaths, for 
 the two last runs.
 the two last runs

Population d li
P    l i declines i the d
                    in h decay run
because the average lifetime was set to a
lower value than the equilibrium value.
This made the negative feedback loop
through deaths stronger than the positive
feedback loop through births, resulting in
             p       g                 g
Population decline over time.



Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Input and Output Objects
  p          p     j
 Click on the Control Panel button and then select the 
 Graphs tab
         tab.
                                                1




                                                2




                                                                             3




Vensim Chapter 6: Building a Simulation Model       Presented by Diana Lim       December 2010
Input and Output Objects
  p          p     j


                                        1

                                                                         Do the same for
                                                                         births (select births
                                                                         from the list) and
                                                                         f      h li ) d
                                                                         deaths (select deaths
                                3                                        from the list)
                                                         4
                      2
   5




              6                                 5

Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim         December 2010
Input and Output Objects
  p          p     j
 Select the Input Output Object sketch tool


                   4                                                2


            1




                                                                                    3




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010
Input and Output Objects
  p          p     j
 Click the SyntheSim button
 Experiment with moving the sliders around and seeing 
 E      i   t ith      i th lid          d d      i
 the results on the graph.




Vensim Chapter 6: Building a Simulation Model   Presented by Diana Lim   December 2010

Vensim chapter 6 v1

  • 1.
    Vensim e s Chapter 6 Building a Simulation Model Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 2.
    Naming Conventions g Levels – initial capital letters; e.g., Population Rates, auxiliaries, constants, lookups, data variables – all lower  Rates auxiliaries constants lookups data variables – all lower case; e.g., average lifetime Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 3.
    Sketch Conventions Sketch Conventions Levels or stocks are entered with the Box Variable tool Levels or stocks are entered with the Box Variable tool Rates are entered with the Rate tool Box Variable - Level Rate Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 4.
    Sketching the RabbitModel g File > New Model 1 5 2 Type the name Population and press 3 enter t 4 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 5.
    Sketching the RabbitModel g 9 7 8 6 6 5 6 8 7 7 A positive feedback loop from Population to births increases  Population, and a negative feedback loop from deaths  decreases Population decreases Population Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 6.
    Writing Equations g q births = population * birth rate Birth rate has not causes; it is constant in the model Bi th t h t it i t t i th d l Equations All the variables in the model will turn black. The highlights indicate which variables still require equations or have incomplete equations Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 7.
    Checking y g your model Model > Units Check Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 8.
    Variable Type: Auxiliary yp y Click on variable births 2 1 3 4 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 9.
    Variable Type: Level yp Click on variable population equation is already present in the equation editing box Rates constructed by clicking first outside, and then on the Level are considered positive (inwards) flows; rates constructed by clicking on the Level, and then outside the Level are considered 2 negative (draining) flows 1 3 4 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 10.
    Variable Type: Constant yp birth rate 2 1 3 this means that the fractional birth rate is measured in fraction (of rabbits) per year. 4 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 11.
    Variable Type: Constant yp average lifetime 1 2 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 12.
    Variable Type: Auxiliary yp y Click on variable deaths 1 2 3 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 13.
    Checking y g your model Model > Check Model Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 14.
    Checking y g your model Model > Units Check Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 15.
    Unit Equivalents (y q (Synonyms) y ) Fail in Units check because Vensim does not see the plural  form as the same word form as the same word Model > Settings... 1 2 3 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 16.
    Simulating the Model g 2 1 Double click on the Runname editing box on the Toolbar and type equilib for yp q the first run name. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 17.
    Model Analysis y Click on the Level Population in the sketch. Click on the Graph t l A Cli k th G h tool. A graph of Population i h fP l ti is generated: t d 2 1 Graph Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 18.
    Model Analysis y Population appears as a flat line at the top of the graph at  P l i fl li h f h h 1000 rabbits. To check that no change is occurring, Click on the Table tool l k h bl l Output window shows that Population is unchanging. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 19.
    Simulation Experiments p Click on the SyntheSim button . Answer yes to  whether you want to overwrite the existing run. whether you want to overwrite the existing run The toolbar will change to  and you will see variable behavior for all elements on the  diagram. di Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 20.
    Simulation Experiments p Click on the Runname editing box and replace equilib with the  name growth. name growth Drag the slider beneath birth rate up till it shows 0.2 as its  value. The blue lines show the current run and the red line the  equilib run results run results. Click on the Stop button to stop SyntheSim. View>Show Behavior to see behavior graphs again. Vi >Sh B h i t b h i h i Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 21.
    Alternative Simulation Setup p Click on the Set up a Simulation button The Toolbar changes to the simulation toolbar. The Toolbar changes to the simulation toolbar notice that the constants turn into yellow words with blue  ti th t th t t t i t ll d ith bl background Also, the sketch tools are grayed out, preventing work in the  Also the sketch tools are grayed out preventing work in the sketch window. Click on the variable birth rate and in the editing box type the value 0.2 This is a temporary change for this run only and does not permanently alter the value in your model. d l Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 22.
    Causes Strip Graph p p Click on Population to select it into the workbench. Click on the Control Panel button Cli k th C t l P l b tt 1 2 The last run you made (growth) is loaded first (at the top of the dialog). Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 23.
    Causes Strip Graph p p Click on the Graph tool. A graph will show both runs Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 24.
    Causes Strip Graph p p Now click on the Causes Strip tool. Causes Strip Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 25.
    Runs Compare p Click on the Runs Compare tool. shows the differences in the Constant birth rate for runs  equilib and growth. Runs Compare Population grew in the growth run because the birth rate was  set to a higher value than the equilibrium value. This made the  positive feedback loop through births stronger than the  positive feedback loop through births stronger than the negative feedback loop through deaths, resulting in Population  growth over time. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 26.
    Exponential Decay p y make changes to a model Constant to generate exponential  decay or decline in the population decay or decline in the population 1 1 4 2 Drag the Slider under average lifetime till it displays di l a value of 4 l f 4. Click on the Stop Button 3 Click the Simulate button and the model will simulate Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 27.
    Exponential Decay p y Click on the Graph tool and compare the three runs. 1 double click on the run equilib in the right box; this will h i h b hi ill unload the run so the 2 Analysis tools will not examine it it. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 28.
    Exponential Decay p y Click on the Causes Strip tool  to show Population and its  to show Population and its causes— births and deaths, for  the two last runs. the two last runs Population d li P l i declines i the d in h decay run because the average lifetime was set to a lower value than the equilibrium value. This made the negative feedback loop through deaths stronger than the positive feedback loop through births, resulting in p g g Population decline over time. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 29.
    Input and OutputObjects p p j Click on the Control Panel button and then select the  Graphs tab tab. 1 2 3 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 30.
    Input and OutputObjects p p j 1 Do the same for births (select births from the list) and f h li ) d deaths (select deaths 3 from the list) 4 2 5 6 5 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 31.
    Input and OutputObjects p p j Select the Input Output Object sketch tool 4 2 1 3 Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010
  • 32.
    Input and OutputObjects p p j Click the SyntheSim button Experiment with moving the sliders around and seeing  E i t ith i th lid d d i the results on the graph. Vensim Chapter 6: Building a Simulation Model Presented by Diana Lim December 2010