Bats

Bats preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person P. Pease (Author)

Tags

abm 

"agents are bats and disease"

Tagged by P. Pease almost 11 years ago

disease 

"G. destructans spreads throughout bat population"

Tagged by P. Pease almost 11 years ago

habitats 

"karst area for caves where bats hibernate"

Tagged by P. Pease almost 11 years ago

humans carry disease 

"Geomyces destructans carried into caves"

Tagged by P. Pease almost 11 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 765 times • Downloaded 47 times • Run 0 times
Download the 'Bats' modelDownload this modelEmbed this model

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


Comments and Questions

Bats ABM model - needs help

This is a version of the same model uplodaed before - but I have included the file. I will delete the other file so as not to cause any duplication or confusion. The problems ran into on this was in regard to initialising patches, and getting bats to 'hatch' based on the slider selection that users can use . I believe my code is flawed in those areas! Needs help!

Posted almost 11 years ago

setup problem for model (Question)

Maybe this is not a question for this forum, but I wonder if anyone could advise me on why I cannot get past the setup of this model - It crashes before it starts - I think from the error message that it has to do with initialization of patches, or the fact that there are no 'bats' because it cannot setup and commence. Thank you.

Posted over 10 years ago

Error "Value expected"

Hello ! I tried to download this model, but when I ran it on Netlogo, it appears an error after "hatch n-of 100", they tell me ""Expectetd a constant". Thank you !

Posted about 7 years ago

Click to Run Model

extensions [bitmap]        ; allows for import of png map (later in code - during setup)

globals 
     [habitats]
                           ; some globals seen in other models - seemed applicable, these 
                          ; represent things that all agents interact with so apply to all in model
breed [bats bat]
breed [peoples people]
breed [specialists specialist]
breed [caves cave]        ; names the different agentsets in the model
breed [lands land]


bats-own
  [age 
  days
  eat-bugs
  fly-around
  check-death
  bat-energy
  hibernate         ; defines specific bat behavior attributes
  max-lifespan
  gets-sick
  average-offspring
  ]
  
peoples-own 
   [visit-caves
   carries-disease 
]
                            ; some of visitors will carry disease into cave
patches-own 
    [habitat-cave         ; differentiates between area that is cave,
    caves-with-disease         ;; whether cave has G. destructans growing
    habitat-land          ; and whether area is open land for bats to fly around
]

specialists-own
   [inspect-caves
   find-cave-has-disease
   ]                                          ; defines what wildlife specialists do
                                              ; label caves that have WNS (color is white, 9.9)  

to setup                                           
  __clear-all-and-reset-ticks             ; (for this model to work with NetLogo's new plotting features
  
  import-pcolors-rgb "Bat-caves.png"      ; the map used that shows W.Va and Va.cave areas in karst topo
  create-bats number-bats [
  setup-habitats
  setup-agents
  ]
  do-plots
end 

to setup-habitats
  ask patches [
         if pcolor > 1 and pcolor < 6 [
           set pcolor 47
           set habitats habitat-cave
         ]
         if pcolor > 31 and pcolor < 38 [
           set pcolor 47
           set habitats habitat-cave
         ]
         if pcolor > 51 and pcolor < 68 [          ; this section of the code changes the perception of the
           set pcolor 47                                       ; bitmap for agents so that some areas (near kartst, where there a                                      ; be green for bat habitat in which they fly, eat and then hiberna                           ; (and in some cases get sick) in the caves
           set habitats habitat-cave
           ]
  ask patches [ 
           if pcolor > 47 and pcolor < 47 [
            set pcolor 67 
            set habitats habitat-land
  ]]]
end   

to setup-agents 
  ask bats [set shape "bats"
           set size .5 
           set color 35]
  
  ask specialists [set shape "person"
                  set size 2 
                  set color green
             set inspect-caves 12] 
                                                ; distinguishes shapes sizes and colors 
  ask peoples [set shape "person"
              set size 2 
              set color black]                  ; of 3 diff. agents: bats, people & specialists         
end 

to setup-bats
  ask patches[
    hatch n-of 100 [number-bats]
      set bat-energy random 30 
      set age random 25               ; starts bats with shape, energy, color and lifespan of 25 max
      show count gets-sick                  ; average offspring is set to 5 (in nature is 5 or 6)
      set max-lifespan 25
      set average-offspring 5
      if bat-energy = 0 [die]
  ]
end 

to go 
      move-bats  
     if not any? bats [stop]
     if count bats > 1200 [stop]           ; these are the basics to start up the model with moving bats
      set hibernate ticks                   ; people and wildlife specialists, but to first check that
      move-people                           ; there are in fact bats, (when there are none model will stop or if
                                            ; there are so many, like  1200                           
      set carries-disease random 3         ; this only allows for up to 3 people to carry the disease to caves
      inspect habitat-cave                                ; for this size model
      do-plots
      tick
end 

to move-bats  
    ask bats [set age age + 1]
    if age > 25 [die]
      if average-offspring < 5 [                  ; the most challenging part of the code was to get
        hatch 1]                                  ; bats to move, eat, gain and lose energy, hibernate
      set bat-energy bat-energy - 25              ; graze, reproduce and get sick if in contact with
      ask bats [                                  ; cave patches carrying G. destructans
        set bat-energy bat-energy + 25
   ]                                               ; to identify their two parts of habitat (caves and land)
   ask bats [
     set hibernate habitat-cave
     let c one-of (habitat-cave in-radius 1)
      move-to habitat-cave
      if days = 75 [ 
         move-to habitat-cave 
         set hibernate habitat-cave = 25 
         set bat-energy bat-energy - 10
      if patch-here ? pcolor white 
           set gets-sick]
    [if (bats-on or if bat 0 bat 2 bat 9 gets-sick)
       self gets-sick] [
    set bat-energy bat-energy - 20
      ]]
     
  ]]]
end   

to move-people
  ask people [ 
    let p n-of 5 people                                   ; should move people (6 per year?) into caves randomly, 
    move-to visit-caves                                   ; and this would leave disease if person is a carrier
    let k min-one-of habitat-cave [distance myself]
    face k
    move-to k  fd 2 rt 30 fd 1 lt 30 fd 2 lt 180 fd 5]
    let d n-of 1 carries-disease
    if carries-disease [
      ask one-of patches [set pcolor white]             ; the cave patch turns white to show it has disease now
    ]
end 

to check-for-disease
  ask specialist [
    let s n-of 3 specialist 
    move-to habitat-cave 
    let t min-one-of habitat-cave [distance myself]       ; specialists inspect and label the caves that have disease
    face t 
    move-to t [range-of-view 60 radius 2]
     fd 2 rt 30 fd 1 rt 30 fd 2 lt 45 fd 1 lt 60]
     if patch [self] pcolor white
        [set cave-with-disease
          add count + 1
]
end 

to do-plots
    ; update plots with new values
  
  set-current-plot "Bat Population" 
  set-current-plot-pen "healthy/" 
  plot count bats                                ; plot Total number of bats
  set-current-plot-pen "sick bats"                ; plot number of bats sick
  plot count becomes-sick  
  set-current-plot "Human visits to caves"
  set-current-plot-pen "people visit caves"
  plot count visit-caves
end 

to ruler    
                                                               ; set up the white ruler lines around the edge of the model window
                                                               ; to give an approximate linear scale to the 'map'
  ask patches with [pxcor = max-pxcor ][set pcolor 78]         ; a nice touch taken from Orangatango model
  ask patches with [pycor = max-pycor ][set pcolor 78]
  ask patches with [pxcor = min-pxcor ][set pcolor 78]
  ask patches with [pycor = min-pycor ][set pcolor 78]

    ask patches with [pxcor mod 10 = 0 and
                    pycor < (min-pycor + 2)]
    [ set pcolor black ]     
    ask patches with [pxcor mod 100 = 0 and
                    pycor < (min-pycor + 8)]
    [ set pcolor black ]     
    ask patches with [pxcor < (min-pxcor + 2) and
                    pycor mod 10 = 0]
    [ set pcolor black ]
    ask patches with [pxcor < (min-pxcor + 8) and
                    pycor mod 100 = 0]
    [ set pcolor black ]
end 

There is only one version of this model, created almost 11 years ago by P. Pease.

Attached files

File Type Description Last updated
Bat-caves.png png USGS map area - approximately 156,400 hectares of area almost 11 years ago, by P. Pease Download
Bats.png preview Preview for 'Bats' almost 11 years ago, by P. Pease Download

This model does not have any ancestors.

This model does not have any descendants.