No preview image

1 collaborator

Default-person Soutrik Banerjee (Author)



Tagged by Soutrik Banerjee 11 months ago

infection rates 

Tagged by Soutrik Banerjee 11 months ago


Tagged by Soutrik Banerjee 11 months ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 322 times • Downloaded 15 times • Run 0 times
Download the 'COVID-19_mask-use-transmission' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This model simulates the spread of the SARS-CoV-2, via human to human transmission, in a small isolated population. It illustrates the utility of masks in the population. It is not intended to measure the recovery rate from Coronavirus, as seen in SIRD / SEIRD models.

As it is understood that COVID-19 is spread from human to human through forceful explusion by coughing of virus-laden aerosols by an infected individual. The aerosols can directly enter the susceptible individual if within 2 metres of distance from the infected or the aerosols that can keep the virus alive on objects that a susceptile individual may touch and later the virus can enter her/his body through nose, mouth and eyes among the major portals of entry, or through gestures as hugging, handshaking, close proximity, health-care delivery, etc. that can transmit the virus from the infected to the susceptible. COVID-19 can remain alive for different lengths of time periods on different materials, but this model does not try to highlight this property of the virus. Neither this model tries to capture the transmission of COVID-19 by indirect method by contact exposure of contaminated surfaces by the susceptible and then entry of virus into the individual. Rather the goal of this model is to examine the infection rate among susceptible individuals, which will potentially change with time, by the use or not of masks that is putatively thought to influence the spread of the disease in the community and closed-space arenas like hospitals, public transport and places of public gatherings like markets.

The model examines the emergent effects of four scenarios of mask use. The user controls the the amount of time two (or more) individuals will stay in close proximity as that can influence the spread.

Regular identification of individuals infected by the virus could have significant public health impacts.


The model uses "close-up" to represent two people engaged close proximity like hugging, handshaking, health-care delivery, etc. If an individual stays 1 hour in close proximity, that assumes 1/24 probability of disease transmission to someone theoretically lives 24 hours in close proximity. In the same way, someone staying 2 hours in close proximity will have 1/12 probability of disease transmission and so on. This is irrespective of mask use, which is in influencer of the transmission rate among agents.

The presence of the mask in the population is represented by symbols of the agents. Two colours are used to denote if the agent is infect or susceptible: green individuals are uninfected, and red individuals are infected. In reality, after some time, it happens that infected individuals will be removed from the population at-risk by either death or recovery. But this model will not explore that feature currently.


The SETUP button creates individuals with particular behavioural tendencies according to the values of the interface's sliders (described below). Once the simulation has been setup, you are now ready to run it, by pushing the GO button. GO starts the simulation and runs it continuously until GO is pushed again. During a simulation initiated by GO, adjustments in sliders can affect the behavioral tendencies of the population.

A monitor shows the % of the population that is infected by COVID-19. In this model, each time-step is considered one day; the number of days that have passed is shown in the toolbar.

Here is a summary of the sliders in the model. They are explained in more detail below:

  • INITIAL-PEOPLE: How many people simulation begins with (100--500).
  • AVERAGE-HOURS-PROXIMITY: How many hours proximity typically lasts (0--12).
  • AVERAGE-PROXIMITY-TENDENCY: General chance a member of population to use a mask (0--10).

The total number of individuals in the simulation is controlled by the slider INITIAL-PEOPLE (initialised to vary between 100--500), which must be set before SETUP is pushed.

During the model's setup procedures, all individuals are given a RANDOM-NEAR tendency around AVERAGE-PROXIMITY-TENDENCY. These tendencies are generally assigned in a normal distribution, so that, for instance, if a tendency slider is set at 8, the most common value for that tendency in the population will be 8. Less frequently, individuals will have values 7 or 9 for that tendency, and even less frequently will individuals have values 6 or 10 (and so on). Decreasing this to low values like 1 or 2 will result in a condition akin to flattening the curve by a stricter lockdown situation or imposing restrictions on individual movements. In a complete lockdown scenario, the infections will not increase.

The slider AVERAGE-HOURS-PROXIMITY (0--12) determines how long individuals are likely to stay in close-up situation (hours). Again, the tendencies of both individuals to stay in a close distance are considered; the proximity duration only lasts as long as is allowed by the tendency of the neighbour with a shorter commitment tendency.

INITIAL-NUMBER-MASKS (0--75) assigns masked individuals at the beginning of the simulation. It is kept from no use to 1/4th of the default population size of 300 in the current model.

INITIAL-INFECTED-PROP (0--1) is the proportion of initially infected population, which is @33%.

TRANSMIT-PROB-MASK-MASK, TRANSMIT-PROB-NOMASK-MASK, TRANSMIT-PROB-MASK-NOMASK, TRANSMIT-PROB-NOMASK-NOMASK represents the different transmission probabilities (0--1) between the partner and the agent, respectively.


Set the INITIAL-PEOPLE slider to 300, and AVERAGE-PROXIMITY-TENDENCY to 5. Push SETUP and then push GO. These close-ups represent proximity tendency between the two individuals.

Finally, set INITIAL-PEOPLE to 500 to notice that proximities can form on top of each other. Watch the simulation until you see individuals by themselves, but standing still and with a gray patch behind them indicating proximity. Underneath one of its neighbours, is the individuals partner. This apparent bug in the program is necessary because individuals need to be able to couple fairly freely. If space constraints prohibited coupling, unwanted emergent behaviour would occur with high population densities.


Run a number of experiments with the GO button to find out the effects of different variables on the spread of Coronavirus. Try using good controls in your experiment. Good controls are when only one variable is changed between trials. For instance, to find out what effect the average hours of a proximity has, run four experiments with the AVERAGE-PROXIMITY-TENDENCY slider set at 0 the first time, 1 the second time, 2 the third time, and 10 the last. How much does the prevalence of COVID-19 increase in each case? Does this match your expectations of flattening the curve aking to a lockdown scenario with low values of this slider?


Like all computer simulations of human behaviours, this model has necessarily simplified its subject area substantially. The model therefore provides numerous opportunities for extension:

The model depicts transmission potential as two people standing next to each other. This suggests that all proximities have risk of spread, and that lockdown is only practiced in singlehood. The model could be changed to reflect a more realistic view of what proximities are. Individuals could be in proximities without spreading. To show transmission then, a new graphical representation would have to be employed. Perhaps transmission could be symbolised by having the patches beneath the couple flash briefly to a different colour.

The model does not distinguish between genders. This is an obvious over-simplification chosen. However, extending the model by adding genders would make the model more realistic.

The model assumes that individuals who are infected / tested positive do not necessarily use mask. This portrayal of human behaviour is clearly not entirely realistic, but it does create interesting emergent behaviour that has genuine relevance to certain public health debate. However, an interesting extension of the model would be to change individuals' reactions to knowledge of Coronavirus tested status.

The model does not assume that mask use is always 100% effective even if both individuals in proximity have mask. In fact, responsible mask use is actually slightly less than ideal protection from the transmission of Coronavirus, which is thought to be the best using PPE or complete locked down scenario. A line code is added to the INFECT procedure to check for a slight random chance that a particular episode of mask-use is not effective.

Finally, certain significant changes can easily be made in the model by simply changing the value of certain global variables in the procedure SETUP-GLOBALS.


Notice that the four procedures that assign the different tendencies generate many small random numbers and add them together. This produces a normal distribution of tendency values. A random number between 0 and 100 is as likely to be 1 as it is to be 99. However, the sum of 20 numbers between 0 and 5 is much more likely to be 50 than it is to be 99.

Notice that the global variables SLIDER-CHECK-1, and so on are assigned with the values of the various sliders so that the model can check the sliders against the variables while the model is running. Every time-step, a slider's value is checked against a global variable that holds the value of what the slider's value was the time-step before. If the slider's current value is different than the global variable, NetLogo knows to call procedures that adjust the population's tendencies. Otherwise, those adjustment procedures are not called.


Wilensky, U. (1997). NetLogo AIDS model.


Copyright April 2020, Soutrik Banerjee.

It is an extension / adaptation of the NetLogo library original AIDS model by Uri Wilensky. Centre for Connected Learning and Computer-Based Modelling, Northwestern University, Evanston, USA.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; observer SLIDERS
;; initial-people - initial total population of the world
;; initial-number-masks - inital population of masked people
;; initial-infected-prop - initial number of infected population
;; transmit-prob-mask-mask - transmission probability {partner-agent} from infected to non-infected depending on who wears mask
;; transmit-prob-nomask-mask - transmission probability {partner-agent} from infected to non-infected depending on who wears mask
;; transmit-prob-mask-nomask - transmission probability {partner-agent} from infected to non-infected depending on who wears mask
;; transmit-prob-nomask-nomask - transmission probability {partner-agent} from infected to non-infected depending on who wears mask

globals [
  slider-check-1     ;; Temporary variables for slider values, so that if sliders
  slider-check-2     ;;   are changed on the fly, the model will notice and
                     ;;   change people's tendencies appropriately.

breed [ masks mask ]
breed [ nomasks nomask ]

turtles-own [
  infected?          ;; If true, the person is infected.
  close-proximity?   ;; If true, the person is in close proximity (assumed to be <2 mt).
  close-duration     ;; How long the person HAS BEEN in close proximity (hours).
  partner            ;; The person that is to our current partner in close proximity.

  ;; the next 2 values are controlled by SLIDERS
  hours-proximity    ;; How long the person LIKELY to stay in close proximity.
  proximity-tendency ;; How likely the person is to engage in close proximity.
                     ;;   Akin to a lockdown (y/n) scenario if population's proximity-tendency is low/high.


to setup

to setup-globals
  set slider-check-1 average-hours-proximity
  set slider-check-2 average-proximity-tendency

;; Triangle ('mask') and face neutral ('sans mask') breeds
;;   and, some of both are infected.  Also, assign colours to people with the ASSIGN-COLOUR routine.

to setup-breeds
  ;; masked - triangle
  set-default-shape masks "triangle"
  create-masks initial-number-masks
    set size 3
    setxy random-xcor random-ycor
    set partner nobody
    set close-proximity? false
    set infected? (who < initial-number-masks * initial-infected-prop)

  ;; non-masked - face neutral
  set-default-shape nomasks "face neutral"
  create-nomasks initial-people - initial-number-masks
    set size 2
    setxy random-xcor random-ycor
    set partner nobody
    set close-proximity? false
    set infected? (who < (initial-people - initial-number-masks) * initial-infected-prop)

;; People are displayed in 2 different colours depending on infection status:
;;   green not infected
;;   red infected

to assign-colour ;; turtle procedure
  ifelse infected?
  [ set color red ]
  [ set color green ]

to assign-hours-proximity ;; turtle procedure
  set hours-proximity random-near average-hours-proximity

to assign-proximity-tendency ;; turtle procedure
  set proximity-tendency random-near average-proximity-tendency

to-report random-near [centre] ;; turtle {helper} procedure
  let result 0
  repeat 40
    [ set result (result + random-float centre) ]
  report result / 20


to go
  if all? turtles [ infected? ] ;; or ticks > 90
  [ stop ]
  ask turtles
  [ if not close-proximity?
    [ move ] ]
  ask turtles
  [ if not close-proximity? and (random-float 10 < proximity-tendency)
    [ closeup ] ]
  ask turtles
  [ if close-proximity?
    [ set close-duration close-duration + 0.5 ] ]
  ask turtles [ infect ]
  ask turtles [ assign-colour ]
  ask turtles [ unclose ]

;; Each tick a check is made to see if sliders have been changed.
;;   if one has been, the corresponding turtle variable is adjusted

to check-sliders
  if (slider-check-1 != average-hours-proximity)
  [ ask turtles [ assign-hours-proximity ]
    set slider-check-1 average-hours-proximity ]
  if (slider-check-2 != average-proximity-tendency)
  [ ask turtles [ assign-proximity-tendency ]
    set slider-check-2 average-proximity-tendency ]

;; People move about at random.

to move ;; turtle procedure
  right random-float 360
  forward 1

;; People have a chance to close up depending on their tendency, if they meet.
;; To better show that close-proximity has occurred, the patches below
;;   the close up turns grey.

to closeup ;; turtle procedure
  let tmpPart one-of other turtles-here
  if tmpPart != nobody
  [ set close-proximity? true
    set partner tmpPart
    ask partner [ set close-proximity? true ]
    ask partner [ set partner myself ]
    ;; ask patch-here [ set pcolor gray - 3 ]

;; If two peoples are close for longer than either person's hours-proximity variable
;;   allows, the close up ends.

to unclose ;; turtle procedure
  if close-proximity?
  [ if (close-duration > hours-proximity) or ([ close-duration ] of partner) > ([ hours-proximity ] of partner)
    [ ;; ask patch-here [ set pcolor black ]
      set close-proximity? false
      set close-duration 0
      ask partner [ set close-duration 0 ]
      ask partner [ set partner nobody ]
      ask partner [ set close-proximity? false ]
      set partner nobody

to infect ;; turtle procedure
  let infectMaskPart one-of other turtles-here with [ close-proximity? and infected? and breed = masks ]
  if infectMaskPart != nobody
  [ set partner infectMaskPart ]
  if close-proximity? and not infected? and breed = masks and random-float 1 < transmit-prob-mask-mask
  [ set infected? true ]

  let infectNoMaskPart one-of other turtles-here with [ close-proximity? and infected? and breed = nomasks ]
  if infectNoMaskPart != nobody
  [ set partner infectNoMaskPart ]
  if close-proximity? and not infected? and breed = masks and random-float 1 < transmit-prob-nomask-mask
  [ set infected? true ]

  let noInfectMaskPart one-of other turtles-here with [ close-proximity? and not infected? and breed = masks ]
  if noInfectMaskPart != nobody
  [ set partner noInfectMaskPart ]
  if close-proximity? and infected? and breed = nomasks and random-float 1 < transmit-prob-mask-nomask
  [ ask partner [set infected? true ] ]

  let noInfectNoMaskPart one-of other turtles-here with [ close-proximity? and not infected? and breed = nomasks ]
  if noInfectNoMaskPart != nobody
  [ set partner noInfectNoMaskPart ]
  if close-proximity? and infected? and breed = nomasks and random-float 1 < transmit-prob-nomask-nomask
  [ ask partner [set infected? true ] ]


to-report %infected
  ifelse any? turtles
  [ report (count turtles with [ infected? ] / count turtles) * 100 ]
  [ report 0 ]

There is only one version of this model, created 11 months ago by Soutrik Banerjee.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.