Ophiocordyceps Unilateralis Model

Ophiocordyceps Unilateralis Model preview image

1 collaborator

Default-person Hunter Clark (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 155 times • Downloaded 7 times • Run 0 times
Download the 'Ophiocordyceps Unilateralis Model' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

turtles-own [   ;Determines the variables that the ant can have.
    sick?
    sick-time
    ticks-since-here]

patches-own [  ;Determines the variables that the patches can have.
  countdown ]

globals
  [            ;This is where we define our variable
    chance-reproduce
    carrying-capacity
    plant-heal-time

]

to setup
  clear-all
  setup-constants    ;Runs the setup-constants command
  setup-turtles      ;Runs the setup-turtles command
  update-display     ;Runs the update-display command

  ask patches [      ;Sets up the "dirt" and gives all patches a random heal time for plants
    set pcolor brown
    set countdown random plant-heal-time
  ]

  ask n-of plants patches [ set pcolor green ] ;Asks random patches equal to the number of plants you've selected on the slider to become plants

  ask n-of(Initial-Infections) patches with [pcolor = green]
      [ set pcolor 12 ]                        ;Makes a percentage of the population infected, you are able to control this with the slider on the interface


  reset-ticks
end 

to setup-turtles                         ;Sets up the ants as an agent
  create-turtles number-of-ants
  [ set shape "bug"                      ;Changes the ants shape from a dot to an ant
     setxy random-xcor random-ycor       ;This creates the ants and places them randomly throughout the lattice
     set sick-time 0                     ;Makes sure that the ants do not start off infected
     set size 1.5                        ;Sets the size of the ants to be 1.5 times the size of the patches
      get-healthy ]                      ;Ensures the ants start off as healthy
end 

to get-sick                             ;This is a command to ensure the infected ants turn red
  set sick? true
  set color red
  set sick-time 0
end 

to get-healthy                          ;This is a command to ensure healthy ants turn black and don't gain the side effects of being sick
  set sick? false
  set sick-time 0
end 

to setup-constants
  set carrying-capacity 500                      ;Fixed Carrying Capacity of the model
  set chance-reproduce 0.5                       ;As there is not a functional queen, we are purely looking at foragers. To keep the population from plummiting we add a chance to reproduce
  set plant-heal-time (4 + random-float 6) * 7   ;As the model runs quite quickly, this command makes it so the heal time of the plant is converted to weeks. The process still takes 4 - 10 days but it is scaled to weeks for the sake of the model.
end 

to go
  ask turtles[                                         ;This is the checklist the ant goes through per tick, it ages, moves, and checks for infection.
    reproduce                                          ;Runs the reproduce command
    infect                                             ;Runs the infect command
    if sick? [ time-to-die ]                           ;If the ant is sick, it will run the time to die command
    if sick? [ set sick-time sick-time + 1 ]           ;If the ant is sick, starts up the command for sick time as a countdown for the time to die command

    ask turtles with [ not sick?] [                    ;If the turtle is healthy, then it just moves

      move

    ]


  ]
  ask turtles [                                                         ;This set of code is used to mimic the ant finding a plant in the wild to death grip
    if sick?[
      face min-one-of patches with [pcolor = green] [distance myself]   ;Asks the ant to face the direction of the closest green plant
      if pcolor = brown [                                               ;Asks the ant if the patch underneath is brown, if so then it must continue to move
        move ]
      if pcolor = green [                                               ;Asks the ant if the patch underneath is green, if so then it must stop and start the infect-plant command
        infect-plant]
      if pcolor = 12 [                                                  ;Forces the ant to stay stationary once the plant has turned red
        forward 0]
    ]
  ]
  ask patches with [pcolor = 12] [                                      ;Asks if the plant is infected, if so then start the heal plant command
    heal-plant]
  ;excel                                                                ;Allows for easy data collection
  tick
end 

to update-display                                                                      ;Just stops rainbow coloured ants from occuring
  ask turtles                                                                          ;Just asks the turtles what their health conditions are like. If they are healthy then they get coloured black, if sick then they are coloured red
      [set color ifelse-value sick? [ red ] [ black ] ]
end 

to Time-to-die                                                                         ;Used to kill off sick ants who haven't sucessfully completed the Death Grip
   if sick-time > (4 + random-float 6)                                                 ;This is how long it takes for the whole life cycle to occur 4-10 days. Thus if it has not successfully completed a stage in its life cycle then it shall die out
    [die]                                                                              ;Pretty self explanitory
end 

to reproduce                                                                           ;This is to stabalize the ant population, its a randomized birth rate.
  ask turtles with [not sick?] [                                                       ;Asks if the number of ants on the screen is less than the carrying capacity,
    if count turtles < carrying-capacity and random-float 250 < chance-reproduce       ;if so then all healthy ants have a chance to produce an offspring
    [ hatch 1[
      lt 45 fd 1                                                                       ;Movement pattern for the new ant
      get-healthy                                                                      ;Makes sure the new ant is healthy
      ]
    ]
  ]
end 

to move                                       ;Used to mimic ants movement
  rt random 100                               ;Right turn x amount
  lt random 100                               ;Left turn x amount
  forward 1                                   ;forward 1
end 

to infect                                               ;Infects ants that come into contact with plant
  ask turtles with [not sick?] [
    if pcolor = 12[                                     ;This asks all the turtles that are not sick if they are on an infected plant
      if random-float 100 < (10 + random-float 15)[     ;Statistical chance of being infected from the spores, this was taken from a study stating that 10 - 15% of the forager population was infected from the spores.
        get-sick                                        ;Starts the get-sick procedure
        forward 10                                      ;This is a feature added to stop the ant from being locked to the infected plant
    ]
    ]

  ]
end 

to infect-plant                                                     ;This is the code equivalent of the Death Grip
  ask one-of turtles [
    if sick?[                                                       ;This asks each of the ant if they are sick, if true then move onto the next line of code.
      if pcolor = green[                                            ;It then confirms if the patch the ant occupies is green, it cannot be red or brown as these are not viable plants
        if random-float 100 < (61.8 - (hyperparasite * 55.4)) [       ;This is the statistical chance of a proper a successful inoculation. There is a 64% chance of being successful without hyperparasites involed. If you select the hyperparasites to be in the model, it changes from a zero to a one. This allows for the subtraction of 55.4% success rate as the parasite is only has 8.6% success rate when hyperparasites are involved
            set pcolor 12]                                          ;Changes the green plant into an infected red plant
      ]
    ]
  ]
end 

to heal-plant                                ;Allows for the plant to become non contagious
  if pcolor = 12 [                           ;Asks if the patch colour is dark red
    ifelse countdown <= 0                    ;Asks if the countdown is less than or equal to zero, if true then it can run the next command
      [ set pcolor green                     ;Sets the patch color back to green
        set countdown plant-heal-time ]      ;Restarts the plant heal time to zero because it is no longer infected
      [ set countdown countdown - 1 ]        ;If the countdown was greater than zero, this command runs which just subtracts one from the countdown
  ]
end 

;to excel                                                           ;This section of the model is for data collection, It is greyed out so you don't make random excel files on your computer
  ;if ticks >= 300 [                                                ;Allows the model to run for 300 ticks prior to running the save command
    ;export-all-plots  (word "High " random-float 1.0 ".csv")       ;The premise is that this code will export the plot as a .csv file with the name "high" followed by a randomly generated number. We do this to ensure that the file is not overwritten within the folder.
    ;export-all-plots  (word "Medium " random-float 1.0 ".csv")
    ;export-all-plots  (word "Low " random-float 1.0 ".csv")
    ;export-all-plots  (word "Hyper-High " random-float 1.0 ".csv")
    ;export-all-plots  (word "Hyper-Medium " random-float 1.0 ".csv")
    ;export-all-plots  (word "Hyper-Low " random-float 1.0 ".csv")

    ;setup]                                                         ;Allows for the model to restart to insure a loop is created
;end

There is only one version of this model, created about 2 years ago by Hunter Clark.

Attached files

File Type Description Last updated
Ophiocordyceps Unilateralis Model.png preview Preview for 'Ophiocordyceps Unilateralis Model' about 2 years ago, by Hunter Clark Download

This model does not have any ancestors.

This model does not have any descendants.