Bat Echolocation Model

Bat Echolocation Model preview image

1 collaborator

Default-person Lawrence Whitney (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 52 times • Downloaded 12 times • Run 0 times
Download the 'Bat Echolocation 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.)


WHAT IS IT?

This is a model of bats using echolocation to catch moths. The bats chirp, producing sound waves that indicate the direction of any moths they intersect.

HOW IT WORKS

Bats and moths are randomly distributed in the world of the model. The bats then echolocate the moths by chirping sound waves that move outward from the bat until they intersect with the nearest moth, if any. The bat turns to face the moth identified by the sound wave it generated. When bats fly into the same space as a moth, they catch and eat it. Bats ignore moths identified outside of their detection range, a cone of variable degree set by the user. They also avoid other bats that fly into their detection range. When there are no moths left, the model stops.

HOW TO USE IT

When you press the setup button, bats and moths will be randomly distributed throughout the world of the model and the bats will be labeled with a number. Interface sliders may be used prior to setup to set the population of bats, the population of moths, the energy of the echolocation waves the bats generate, which determines the radius of each echolocation sound wave, the detection range, which is the angle in front of each bat in which detected moths will be hunted, and the angle at which bats will turn to avoid other bats. When you press go, the bats and moths fly in random order, the moths turning randomly and then moving, whereas the bats only turn before moving if their echolocation identifies a moth or they will run into another bat. Each bat hatches a sound wave that moves outward, stopping if it detects a moth or when it runs out of energy. Bats turn toward any moths their sound waves identify. To be able to see the sound waves propagate, turn the tick rate slower. The number of moths each bat has eaten is shown in the monitor.

THINGS TO NOTICE

First, if you cannot see the sound waves the bats are generating, turn down the tick rate and they will become visible. You may also notice that moth flight is mostly random whereas the bats fly in a straight line unless they find a moth or encounter another bat. Because bats and moths cycle through their procedures in random order each turn, it is possible for a moth to escape getting eaten if it gets two moves after being identified before the bat moves again as long as its movement carries it outside the detection range of the bat.

THINGS TO TRY

How does increasing or decreasing the number of bats, the number of moths, or both change the average number of ticks it takes for the bats to catch all of the moths? You could answer this question by conducting an experiment with the model in BehaviorSpace. You may also want to see how expanding or contracting the detection range of the bats improves or hinders their hunting ability. Likewise, you can see how increasing to decreasing the energy of the echolocation waves, which impacts how far they range from the bat that chirps them, impacts hunting effectiveness.

EXTENDING THE MODEL

Right now, bats simply avoid other bats that are in their detection range within three patches. You could program them to avoid other bats using their echolocation. You could also add obstacles, such as trees or stalagmites or stalactites, and have the bats use their echolocation to avoid them, and have them die if they fail.

NETLOGO FEATURES

This model uses three breeds, one of which, waves, is hatched from the bat breed, spreading out and identifying the direction of any adjacent moth all during a single tick. The model uses subtract-headings to determine whether an identified moth is within the detection range of the bat that found it, and uses in-cone to avoid other bats in the detection-range. The use of subtract-headings with respect to the moths is to more closely mimic the way that bats use their echolocation to determine whether a moth is in-cone rather than relying on background functions in NetLogo, meaning it's more like real life.

RELATED MODELS

Flocking Model (in the model library) Wolf Sheep Predation (in the model library) [Doppler Effect Model] (https://ccl.northwestern.edu/netlogo/models/community/dopplereffectmodel)

CREDITS AND REFERENCES

This model was created by Lilly A. Whitney and Lawrence A. Whitney.

We were aided in understanding bats and echolocation by reading an article on [How Stuff Works] (https://animals.howstuffworks.com/mammals/bat.htm) and by visiting an exhibit on bats at the Peabody Essex Museum in Salem, Massachusetts. This model is available on Netlogo User Community Models.

LICENSE

Attribution should be made to Lilly A. Whitney and Lawrence A. Whitney. This work is licensed under CC BY-NC-SA 4.0 CC BY-NC-SA 3.0

Comments and Questions

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

Click to Run Model

;; This model was designed by Lilly A. Whitney and Lawrence A. Whitney

globals [
  wheading
]

breed [ bats bat ]
breed [ moths moth ]
breed [ waves wave ]

bats-own [ food ]
waves-own [ energy ]

to setup
  clear-all
  create-bats number-of-bats
  [
   set shape "hawk"
   set color brown
   set size 3
   setxy random-xcor random-ycor
  ]
  ;; Give each bat a consecutive number starting at 0.
  let num 0
  ask bats [
    set label num
    set num num + 1
  ]
  create-moths number-of-moths
  [
    set shape "butterfly 2"
    set color white
    set size 1
    setxy random-xcor random-ycor
  ]
  reset-ticks
end 

to go
  ask turtles [
    if breed = moths [ moth-fly ]
    if breed = bats
    [
      chirp  ;; Has bats create sound waves that help them find moths.
      bat-fly  ;; Has bats fly towards moths that they find using chirp.
    ]
  ]
  if not any? moths [ stop ]
  tick
end 

to moth-fly
  set heading heading + ( 360 * random-normal 0 0.1 )
  repeat 5 [ ask moths [ fd 0.1 ] display ]
end 

to chirp
  ;; wave grows outward from bat
  ;; waves that intersect moth stop, all others die
  ;; bat turns to face waves/moth
  let degree 0
  ;; creates a wave of 72 agents, 1 agent per 5 degrees
  hatch-waves 72 [
    set shape "dot"
    set size 0.5
    set color 96
    set label ""
    set energy wave-energy
    set heading heading + degree
    set degree degree + 5
  ]
  ;; Wave moves outward until it hits a moth.
  ;; Energy is how far a wave can go before it dies out.
  loop [
    ifelse count waves > 1 [
      ask waves [
        if energy < 1 [ die ]
        fd 0.3
        display
        set energy energy - 1
        if any? moths-here [
          ask other waves [ die ]
          set wheading heading
          stop
        ]
      ]
    ]
    [ ifelse count waves = 1 [
      ;; Determines if the moth the wave found is within the bats detection range.
      ;; If moth is within detection range, turns bat toward the moth.
      ifelse abs ( subtract-headings heading wheading ) <= detection-range [
        face one-of waves
        ask waves [ die ]
        stop
      ]
      [ ask waves [ die ]
        stop
      ]
      ]
      [ stop ]
    ]
  ]
end 

to bat-fly
  ;; Bats move according to their headings and eat any moths they encounter.
  repeat 15 [
    ;; bats determine if other bats are in their way, and if so turn to try to avoid them
    if any? other bats in-cone 5 detection-range [
      let direction random 2
      if direction = 0 [ set heading heading - bat-avoid ]
      if direction = 1 [ set heading heading + bat-avoid ]
    ]
    fd 0.2
    display
    if any? moths-here [
     set food food + count moths-here
     ask moths-here [ die ]
    ]
  ]
  output-show food  ;; Keeps a running tab of how many moths each bat has eaten.
  ask waves [ die ]
end 

There is only one version of this model, created about 1 month ago by Lawrence Whitney.

Attached files

File Type Description Last updated
Bat Echolocation Model.png preview Preview for 'Bat Echolocation Model' about 1 month ago, by Lawrence Whitney Download

This model does not have any ancestors.

This model does not have any descendants.