virus 2
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
turtles-own [ sick? ;; if true, the turtle is infectious immune? ;; if true, the turtle can't be infected sick-count ;; how long the turtle has been infectious age ] ;; how many weeks old the turtle is globals [ %infected ;; what % of the population is infectious %immune ;; what % of the population is immune lifespan ;; the average lifespan of a turtle average-offspring ;; the average number of offspring a turtle could have carrying-capacity ;; the number of turtles that can be in the world at one time ] ;; The setup is divided into three subroutines to setup clear-all setup-constants setup-turtles update-global-variables reset-ticks end ;; We create a variable number of turtles of which 10 are infectious, ;; and distribute them randomly to setup-turtles set-default-shape turtles "person" crt people [ setxy random-xcor random-ycor set age random lifespan set sick-count 0 set immune? false set size 1.5 ;; easier to see get-healthy ] ask n-of 10 turtles [ get-sick ] end to get-sick ;; turtle procedure set sick? true set immune? false set color red end to get-healthy ;; turtle procedure set sick? false set immune? false set sick-count 0 set color green end to become-immune ;; turtle procedure set sick? false set sick-count 0 set immune? true set color gray end to setup-constants set lifespan 100 set carrying-capacity 750 set average-offspring 4 end to go get-older move infect recover reproduce update-global-variables tick end to update-global-variables if count turtles > 0 [ set %infected (count turtles with [sick?]) / (count turtles) * 100 set %immune (count turtles with [immune?]) / (count turtles) * 100 ] end ;;Turtle counting variables are advanced. to get-older ask turtles [ set age age + 1 if sick? [ set sick-count (sick-count + 1) ] ;; Turtles die of old age once their age equals the ;; lifespan (set at 1500 in this model). if age > lifespan [ die ] ] end ;;Turtles move about at random. to move ask turtles [ rt random 100 lt random 100 fd 1 ] end ;; If a turtle is sick, it infects other turtles on the same patch. ;; Immune turtles don't get sick. to infect ask turtles with [sick?] [ ask other turtles-here with [ not immune? ] [ if (random-float 100) < infectiousness [ get-sick ] ] ] end ;; Once the turtle has been sick long enough, it ;; either recovers (and becomes immune) or it dies. to recover ask turtles with [sick?] [ if (random sick-count) > (lifespan * (duration / 100)) ;; If the turtle has survived past the virus' duration, then [ ifelse ((random-float 100) < chance-recover) ;; either recover or die [ become-immune ] [ die ] ] ] end ;; If there are less turtles than the carrying-capacity ;; then turtles can reproduce. ;; The probability of reproduction depends on average number ;; of offspring per life. In this model it is 4 per life (e.g. ;; 4 per 100 weeks. The chance, therefore, for a turtle to ;; reproduce at any given turn is 0.04 (if the population ;; is below carrying-capacity). to reproduce ask turtles with [not sick?] [ if (count turtles) < carrying-capacity and (random lifespan) < average-offspring [ hatch 1 [ set age 1 lt 45 fd 1 get-healthy ] ] ] end ; Copyright 2013 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created over 12 years ago by xarty ulep.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
virus 2.nlogo | extension | hey there | over 12 years ago, by xarty ulep | Download |
virus 2.png | preview | Preview for 'virus 2' | over 12 years ago, by xarty ulep | Download |
This model does not have any ancestors.
This model does not have any descendants.
xarty ulep
virus 2 (Question)
This model simulates the transmission and perpetuation of a virus in a human population. removed stat infacted
Posted over 12 years ago