Professional Documents
Culture Documents
Vensim-Tutorial Stepbystep v.2
Vensim-Tutorial Stepbystep v.2
Dynamics
Understanding Epidemics Using
VensimPLE
2
A simple
model that
captures the
dynamics of
an infectious
disease-
Covid 19
3
Getting Started…
4
Step 1: Open A New Model
5
Step 2: Initial Settings
6
Step 3: Save As “Covid_model_step_1”
Covid_model_step_1
7
Step 4: Load Italy_Covid_Cases.vdfx
Before beginning to develop your model, make sure the COVID data is loaded. Download
«Italy_Covid_Cases.vdfx»if you haven’t already and place the file in the same directory as
your model.
8
----Warning----
• We will compare our simulation data to the actual/historical
data in this file, so variable names need to match EXACTLY
9
Step 5: Population Susceptible to Covid
(stock/level)
11
Step 7: Infection Rate (flow/rate)
13
Step 9: Add Causal Arrow
14
Step 10: Right-click on Arrow “handle”
to Add Polarity
15
Step 11: Contacts Between Infected
and Uninfected People with sign
16
Step 12: Complete the Rest
of the Model + Label the Loops
17
Use comment tool to add labels
18
Step 13: Specify Equations
Highlighting
indicates that
the equation
for that
variable is
incomplete.
19
Exogeneous and Endogeneous
Variables
• Variables in SD models are classified as either
exogenous or endogenous:
– Exogenous variables are defined independent of other
variables of the model.
• They are functions of time (i.e., Exogenous Variable = f(t)).
• Of course the exogenous variables may be constants, in
which case they are called parameters.
– Endogenous variables are influenced by other
variables in the system
• Endogenous Variable = f(x, y, z), where x, y, z are other
variables in the model
20
Step 14: Define Infection Rate
21
Step 15: Define Population Susceptible
to COVİD
22
Step 16: Define Susceptible Contacts
Step 17: Define Contacts Between Infected and
Uninfected People
Step 18: Define Probability of Contact with Infected
Person
23
Step 19: Define Total Population
Note first that there are no inputs to this parameter, just as we specified in the
diagram, indicating that Total Population will be a constant. But what value should
that constant take? The data suggests that in the relevant portion of Italy the Total
Population was about 240500 persons, so enter that value into the equation box.
Remember to specify units of measure and provide a comment.
24
Step 20: Define Contact Frequency
Step 21: Define Infectivity
Following this example, complete the equations for the other two
parameters, Contact Frequency (Persons/Day) and Infectivity
(dimensionless – ie, enter Dmnl). Contact Frequency represents the
number of contacts between infected and uninfected people every day.
Infectivity represents the probability that each episode of contact results in
transmission of the infection.
25
Step 22: Define Population Infected
with Covid
Be careful !!!
Initial value of Infected with Covid should be 1 because of calculation of probabality of
cantact with infected person
26
Time Out and Run
27
Plotting Results
It should be selected
28
Optional: Permanent Graph
Use: I/O Object or Custom Graph
29
Step 23: Add Variables in the Dataset
30
Step 24: Add Infection Rate
(as a shadow variable)
31
Step 25: Add Causal Link and Polarity
32
Step 26: Define New Reported Cases
33
Step 27: Define Cumulative Reported
Cases
34
Step 28: Units Check
35
Step 29: Error!!!
36
Step 30: Redefine Contact Frequency
Alas, you have been intentionally led astray so that the teaching team can demonstrate
how to debug unit errors! The problem is that the equation for Susceptible Contacts is
not dimensionally consistent: The right and left sides of the equation have different
units. Susceptible Contacts is measured in contacts per day, but, in the current
formulation, multiplying the Population Susceptible to Covid by the Contact Frequency
yields a value with units of Persons*Person/Day.
The cause of the problem is that unit of measure for Contact Frequency is incorrect.
The Contact Frequency represents the number of contacts each person makes per day,
not the total number of contacts that occurs in the susceptible population (which is
captured by the variable Susceptible Contacts).
To fix this problem, change the units of measure for contact frequency to be
Persons/Person/Day. (Vensim should equate Person/Persons/People, following
settings in the Model>Settings>Units Equiv menu.) After you do this, run the units
check again. When you are done click OK
37
Step 31: Units Check – A. O. K.
38
Step 32: Rename Case – “Base” and
Run
39
Step 33: Plot Cumulative Reported
Cases
40
Step 34: Try Higher Contact Frequency
41
Step 35: Change Run Name
Select a name that helps describe the changes you made, for
example, “High Contact Frequency.”
42
Step 36: Displaying Multiple Runs
43
Step 37: Synthesim
44
Step 38: You’re done!
45
Most Frequently Encountered
Questions Regarding the Tutorial
46
How to document “equation listing”
Left hand side of Vensim main screen, click on “DOCUMENT ALL” to copy all Vensim
Equations for your model
47
Most Popular Questions: I can’t open the Italy Covid Case
48
Debugging Units Check Errors
- Default Model Settings - Correct Model Settings
49
Debugging Units Check Errors
Covid
Covid
Covid =
Covid People
Covid People
Covid
Covid
Covid
50
Floating Point Error
• It may be a couple of things. You may have unrealistic values for some of
the parameters, e.g. infectivity. Check your time step, dt ,of the
simulation. Make sure value of probabilities are defined btw 0-1.
– E.g. setting “infectivity” to a start value of 20 (by assuming 20%), instead of 0.2
51
Any Questions or Comments?