- Create a new Stock named Healthy.
- Create a new Stock named Infected.
- The model diagram should now look something like this:
- Create a new Flow going from the primitive Healthy to the primitive Infected. Name that flow Infection.
- The model diagram should now look something like this: The basic model structure has been laid-out, we can start to define parameter values and equations. We'll start with a very simple model containing a population of 100 people and where 2 people becoming sick each year.
- Change the Initial Value of the primitive Healthy to 100.
- Change the Flow Rate of the primitive Infection to 2.
- Run the model. Here are sample results: The results are as we would expect. However this is not a model of an infectious disease as the infection rate does not depend on the presence of infected individuals. Let's change the infection rate so it depends on the contact rates between sick and healthy people.
- Change the Flow Rate of the primitive Infection to 0.006*[Healthy]*[Infected].
- Run the model. Here are sample results: That's strange. No one ever gets sick. Why is that? It turns out it is because we start the simulation with no infected people in the model. Since we're modeling an infectious disease, this means there is no one to start the epidemic! Let's change that we'll add a single infected person to get the epidemic started.
- Change the Initial Value of the primitive Infected to 1.
- Run the model. Here are sample results: That looks about right. Before moving on, let's spend a moment to improve our model structure. Right now if we wanted to edit the infection rate, we would have to dig down in the equations to find the right number. Let's make our model more modular, without changing any results, by separating the infection rate into its own variable.
- Create a new Variable named Infection Rate.
- Create a new Link going from the primitive Infection Rate to the primitive Infection.
- The model diagram should now look something like this:
- Change the Equation of the primitive Infection Rate to 0.006.
- Change the Flow Rate of the primitive Infection to [Infection Rate]*[Healthy]*[Infected].
- Run the model. Here are sample results: We can hide the display of the infection rate primitive by configuring the display.
- Run the model. Here are sample results: Now that we have our basic model working, let's extend it by adding the phenomena of people recovering from the disease. We'll model something like the Chicken Pox where people become immune to the disease after they recover.
- Create a new Stock named Immune.
- Create a new Flow going from the primitive Infected to the primitive Immune. Name that flow Recovery.
- Create a new Variable named Recovery Rate.
- Create a new Link going from the primitive Recovery Rate to the primitive Recovery.
- The model diagram should now look something like this:
- Change the Equation of the primitive Recovery Rate to 0.1.
- Change the Flow Rate of the primitive Recovery to [Recovery Rate]*[Infected].
- Change the Equation of the primitive Infection Rate to 0.008.
- Run the model. Here are sample results: Fantastic! Now we have a working disease simulation. You can experiment with different population sizes, infection rates and recovery rates to see how the results change.

This tutorial describes how to construct a model of an infectious disease. Before starting the tutorial, make sure you have familiarized yourself with how to create primitives and run models.