Honey Bee Colony Collapse Disorder Model

Honey Bee Colony Collapse Disorder Model preview image

1 collaborator

Default-person Stan Huang (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by the author
Model was written in NetLogo 5.2.0 • Viewed 1127 times • Downloaded 96 times • Run 0 times
Download the 'Honey Bee Colony Collapse Disorder 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

breed [bees bee]  
breed [hives hive]
breed [flowers flower]
turtles-own [
  energy
  age
  visible-neighbors
  closest-neighbor
  ]       
bees-own [
  pollen 
  infected
  ]
hives-own [
  nectar
  growth-num
  ]
flowers-own [
  pollen-count
  pollinated?
  ]
patches-own [
  countdown
  ]

to setup
  clear-all
  ask patches [ set pcolor 55.5 ]
  
   set-default-shape hives "hex"
  create-hives initial-number-hives  ;; create the hives, then initialize their variables
  [
    set color yellow
    set size 1  ;; easier to see
    set energy 200
    set age random 1000
    setxy random-xcor random-ycor
  ]
  
  set-default-shape bees "bee"
  create-bees initial-number-bees  ;; create the bees, then initialize their variables
  [
    
    set size 0.5 
    set energy random (2 * bees-gain-from-food)
    set age random 1000
    setxy 
     [xcor] of hive 0 [ycor] of hive 0
    if random-float 100 < mite-infection-rate [ 
      set infected 1
    ]
  ]

  set-default-shape flowers "flower"
  create-flowers initial-number-flowers ;; create the flowers, then initialize their variables
  [
    set pollen-count random 20
    set age (random 1000 - count flowers) ;; Set random age, the more flowers there are the smaller lifespan new flowers have
    set size 3  ;; easier to see
    setxy random-xcor random-ycor
  ]
  reset-ticks
end 

to go
  if not any? turtles [ stop ]
  if mouse-interaction = "pesticide" [ ;; If the mouse-interaction is set to pesticide, mouse clicking will spray pesticides
    pesticides
  ]
  if mouse-interaction = "roads" [ ;; If the mouse-interaction is set to roads, mouse clicking will build roads
    deforestation
  ]
  if mouse-interaction = "grass" [ ;; If the mouse-interaction is set to grass, mouse clicking will make grass
    grass
  ]
  ask patches [
    pesticide-countdown ;; count down pesticide fading
  ]
  ask bees [
    ifelse pollen > 5[                        ;; If bees have more than 5 pollen, return to hive and deposit
      deposit-to-hive                         ;; Call deposit-to-hive procedure
    ]
    [
      set visible-neighbors (other flowers in-cone 10 120)  ;; Else, go find flowers in cone of vision
      ifelse any? visible-neighbors [
        set closest-neighbor min-one-of visible-neighbors [distance myself]   ;; If flower found, go towards it
        face closest-neighbor
        fd 0.5
        collect-pollen                                ;; Call collect-pollen procedure
      ]
      [
        move                                          ;; If flwoer not found, move randomly
      ]
    ]
    if energy < bees-gain-from-food [                 ;; If energy is lover than bees-gain-from-food, eat pollen if any and gain energy
      if pollen > 0 [
        set pollen (pollen - 1)
        set energy (energy + bees-gain-from-food)
      ]
    ]
    corn-syrup                                        ;; Call corn-syrup procedure
    if (ticks + random 5) mod 10 = 0 [                ;; Every 10 ticks or so, reproduce bees from hive
      reproduce-bees
    ]
    set energy (energy - 1)                           ;; Bees lose energy every tick
    if member? ([pcolor] of patch-here) (list 17 19 59) [
      set energy (energy - pesticide-strength)        ;; If flying on pesticides, lose energy based on pesticide-strength
      if corn-syrup? [
        set energy (energy - pesticide-strength)      ;; If corn syrup is on, lose twice as much energy
      ]
    ]
    if mites? [                                       ;; If mites are on,lose energy based on mite-damage every 5 ticks or so
      mite-effects                                    ;; Call mite-effects procedure
    ]
    set age (age - 1)                                ;; Age bees every tick
    death                                            ;; Die if no energy or too old
  ]

  ask hives [
    if count bees = 0 [                              ;; If no more bees, start hive collapse
        set energy energy - 1                        ;; hives lose energy per tick in collapse
    ]
    if hive 0 != nobody [
      reproduce-hives                                ;; Make adjacent hives when growing
    ]
    death                                            ;; Die in collapse
  ]
  ask flowers [
    if [pcolor] of patch-here = 2 or [pcolor] of neighbors = 2 [ ;; Die on roads/Never spawn
      die
    ]
    if any? hives-here or any? hives-on neighbors[               ;; Can't spawn on hives
      die
    ]                     
    if random-float 100 < flower-pollen-rate [                   ;; Produce pollen per tick based on flower-pollen-rate
      set pollen-count (pollen-count + 1)
    ]
    if age < 600 [
      if (ticks + random 5) mod 10 = 0[                          ;; Every 10 ticks or so when a flower has under 600 ticks of age left, a flower has the chance of reproducing if pollinated already
        if pollinated? = 1 [
          reproduce-flowers
        ]
      ]
    ]
    if test-pesticides? [
      ask patch-here [                                             ;; For testing purposes only, spray all flowers
        set pcolor 17
      ]
    ]
    set age (age - 1)
    death                                                        ;; Age and die if too old
  ]
  tick
end 

to move  ;; turtle procedure, moves turtle randomly
  rt random 50
  lt random 50
  fd 0.25
end 

;; REPRODUCTION

to reproduce-bees  ;; bees procedure, reproduces the bees
  if random-float 100 < bees-reproduce [  ;; throw "dice" to see if you will reproduce
    ask hive 0 [
      hatch-bees 1 [ 
        set size 0.5  
        set age random 1000
        set energy random (2 * bees-gain-from-food)
        rt random-float 360 fd 0.5
        if random-float 100 < mite-infection-rate [  ;; Set infection by mite (no effect unless mite? switch turned on)
          set infected 1
        ]
      ] 
    ]
  ]
end 

to reproduce-hives  ;; hive procedure to reproduce hives
  if [growth-num] of hive 0 > 100 [  ;; If growth number reaches 100 (100 nectar put into hive), reproduce another yellow rectangle onto it
    hatch 1 [ 
      set energy random 100          ;; Energy within 100
      rt random-float 360 fd 0.5
      ]  ;; hatch an offspring and move it forward 0.5 step next to first hive
    ask hive 0 [
      set growth-num 0               ;; Reset growth number     
    ]
  ]
end 

to reproduce-flowers  ;; Flower procedure, reproduces flowers
  if random-float 100 < flower-reproduce [                          ;; throw "dice" to see if you will reproduce
    hatch 1 [ 
      set pollen-count 0
      set color (color + (random 2) - (random 2))                   ;; Spawn color is a variant of parent color
      set age (random 1000 - count flowers)
      set size 3  ;; easier to see
      rt random-float 360 fd random 15                              ;; Set spawn placement at most 15 patches away
      while [any? other flowers-here or any? flowers-on neighbors][ ;; If flower already here, randomly move 2 to find different patch
        rt random-float 360 fd 2
      ]
      if any? hives-here or any? hives-on neighbors[                ;; Can't spawn on hives
        die
      ]
      set pollinated? 0
      if [pcolor] of patch-here = 2 or [pcolor] of neighbors = 2 [ ;; Can't spawn on roads
        die
      ]
    ]
    set pollinated? 0                                               ;; Flower not pollinated anymore
  ]
end 

;; POLLEN PROCEDURES

to collect-pollen  ;; bee procedure to collect pollen from flowers
  let buddy one-of flowers-here                    ;; grab flower present
  if buddy != nobody[
    if [pollen-count] of buddy > 0                 ;; did we get one?  if so,
    [ 
      ask buddy [                                  ;; collect pollen from flower, and pollinate it
        set pollen-count (pollen-count - 1)
        set pollinated? 1
 
      ]
      set pollen (pollen + 1)

    ] 
  ]
end 

to deposit-to-hive                        ;; Procedure to deposit pollen into hive which is converted to nectar
  face hive 0
  fd 0.5
  let home-hive one-of hives-here         
  if home-hive = hive 0 [
    set pollen (pollen - 5)               ;; Deposit pollen
    ask hive 0 [
      set nectar (nectar + 1)
      set growth-num (growth-num + 1)     ;; increase nectar and growth number
    ]
  ]
end 

;; PESTICIDES 

to pesticides ;; CCD Factor procedure, mouse click to set pesticides
  if mouse-down?[ 
    ask patch mouse-xcor mouse-ycor [ 
      if pcolor = 55.5 [
        set pcolor 17
        set countdown 1000
      ]
        ask neighbors [                         ;; Also set it on neighbors
          if pcolor = 55.5 [
            set pcolor 17
            set countdown 1000
          ]
        ]
    ] 
   ]
end 

to pesticide-countdown          ;; Patch procedure to cause pesticide fading
  if pcolor = 17 [              ;; This block of code will make pesticide sprayed grass turn light pink after 100 ticks, then light green, then back to green (grass).
    if countdown = 0 [          ;; When the grass is green again, the pesticides have faded away. This entire procedure is done through the use of a countdown variable.
      set pcolor 19
      set countdown 1000
    ]
  ]
  if pcolor = 19 [
    if countdown = 0 [
      set pcolor 59
      set countdown 1000
    ]
  ]
  if pcolor = 59 [
    if countdown = 0 [
      set pcolor 55.5           
    ]
  ]
  if countdown > 0 [
    set countdown (countdown - 1) ;; End block of fading pesticides
  ]
end 

;; VARROA MITES

to mite-effects
  if infected = 1 [
    if (ticks + random 5) mod 5 = 0 [
      set energy (energy - mite-damage)
      if corn-syrup? [                            ;; If corn syrup is on, lose twice as much energy
        set energy (energy - mite-damage)
      ]
    ]
  ]
end 

;; HIGH FRUCTOSE CORN SYRUP

to corn-syrup                              ;; Turn on corn syrup and feed bees every 10 ticks or so
  if (ticks + random 5) mod 10 = 0 [
    set energy (energy + corn-syrup-value)
  ]
end 

;; DEFORESTATION

to deforestation ;; CCD Factor procedure, mouse click to set roads
  if mouse-down?[ 
    ask patch mouse-xcor mouse-ycor [ 
      set pcolor 2
      ask neighbors [                      ;; Also set on neighbors
        set pcolor 2
        ]
      ] 
    ]
end 

;; SET GRASS

to grass ;; Patch procedure, change patches back to grass
  if mouse-down?[ 
    ask patch mouse-xcor mouse-ycor [ 
      set pcolor 55.5
      ask neighbors [                      ;; Also set on neighbors
        set pcolor 55.5
        ]
      ] 
    ]
end 

to death  ;; turtle procedure, cause death
  ;; when energy or age dips below zero, die
  if energy < 0 [ die ]
  if age < 1 [die]
end 


 

There are 6 versions of this model.

Uploaded by When Description Download
Stan Huang almost 9 years ago Fixed small issue Download this version
Stan Huang almost 9 years ago Added some comments Download this version
Stan Huang almost 9 years ago Completed model and Info tab Download this version
Stan Huang almost 9 years ago Added last two CCD factorrs Download this version
Stan Huang almost 9 years ago Updated lots of things, first two detrimental factors working Download this version
Stan Huang almost 9 years ago Initial upload Download this version

Attached files

File Type Description Last updated
372 Poster.pdf pdf Poster for Poster Fair almost 9 years ago, by Stan Huang Download
Honey Bee Colony Collapse Disorder Model.png preview Preview Image almost 9 years ago, by Stan Huang Download
Honey Bee Colony Collapse Disorder Model.png preview Preview Image Fixed almost 9 years ago, by Stan Huang Download
Huang_Stan_Slam.pdf pdf Poster Slam Slides almost 9 years ago, by Stan Huang Download
Project Proposal.docx word Old Project Proposal (Original Idea) almost 9 years ago, by Stan Huang Download
Project_Proposal.pdf pdf Project Proposal for this Model almost 9 years ago, by Stan Huang Download
Stan_HuangFinalReport.pdf pdf Final Report of Model almost 9 years ago, by Stan Huang Download
StanHuang_June1.pdf pdf 3rd Progress Report almost 9 years ago, by Stan Huang Download
StanHuang_May18.pdf pdf First Progress Report (project revamped later so disregard content) almost 9 years ago, by Stan Huang Download
StanHuang_May25.pdf pdf 2nd Progress report almost 9 years ago, by Stan Huang Download

This model does not have any ancestors.

This model does not have any descendants.