Moths

Moths preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Rick Orlina (Author)

Tags

biology 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 539 times • Downloaded 70 times • Run 1 time
Download the 'Moths' 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 model demonstrates moths flying in circles around a light. Each moth follows a set of simple rules. None of the rules specify that the moth should seek and then circle a light. Rather, the observed pattern arises out of the combination of the moth's random flight and the simple behavioral rules described below.

Scientists have proposed several explanations for why moths are attracted to and then circle lights. For example, scientists once believed that moths navigated through the sky by orienting themselves to the moon, and that the moths' attraction to nearby, earthly light sources (such as a street lamp) arose because they mistook the terrestrial lights for the moon. However, while this explanation may seem reasonable, it is not supported by available scientific evidence.

HOW IT WORKS

Moths exhibit two basic kinds of behavior. When they detect a light source from a distance (as far as 200 feet away) moths tend to fly straight toward the light. Then, when moths get close to the light, they tend to turn away from the light in order to avoid it.

First, moths sense the light in their immediate vicinity and turn toward the direction where the light is greatest.

Second, moths compare the light immediately ahead of them with the light at their current position. If the ratio of 'light just ahead' to 'light here' is below a threshold value, then the moths fly forward toward the light. If the ratio of 'light just ahead' to 'light here' is above a threshold value, then moths turns away from the light. The threshold is determined by the moths' sensitivity to light.

If the moths do not detect any light, or if there simply are no lights in the space where the moths are flying, then the moths flutter about randomly.

Note that light energy is represented in this model as decreasing with the square of the distance from the light source. This characteristic is known as a "one over r-squared relationship," and is comparable to the way electrical field strength decreases with the distance from an electrical charge and the way that gravitational field strength decreases with the distance from a massive body.

HOW TO USE IT

Click the SETUP button to create NUMBER-LIGHTS with LUMINANCE and NUMBER-MOTHS. Click the GO button to start the simulation.

NUMBER-MOTHS: This slider determines how many lights will be created when the SETUP button is pressed.

NUMBER-LIGHTS: This slider determines how many lights will be created when the SETUP button pressed. Note that this value only affects the model at setup.

LUMINANCE: This slider influences how bright the lights will be. When a light is created, it is assigned a luminance of 20 plus a random value between 0 and LUMINANCE. Lights with a higher luminance can be sensed by moths from farther away. Note that changing LUMINANCE while the model is running has no effect.

SENSITIVITY: This slider determines how sensitive the moths are to light. When SENSITIVITY is higher, moths are able to detect a given light source from a greater distance and will turn away from the light source at a greater distance.

TURN-ANGLE: This slider determines the angle that moths turn away when they sense that the ratio of 'light ahead' to 'light here' is above their threshold value.

THINGS TO NOTICE

When the model begins, notice how moths are attracted to the two lights. What happens when the lights are created very close together? What happens when the lights are created very far apart?

Do all of the moths circle the same light? When a moth begins to circle one light, does it ever change to circling the other light? Why or why not?

THINGS TO TRY

Run the simulation without any lights. What can you say about the moths' flight patterns?

With the simulation stopped, use the following values:

  • NUMBER-LIGHTS: 1
  • LUMINANCE: 1
  • NUMBER-MOTHS: 10
  • SENSITIVITY: 1.00
  • TURN-ANGLE: 95 Notice that, at first, some moths might fly about randomly while others are attracted to the light immediately. Why?

While the model is running increase SENSITIVITY. What happens to the moths' flight patterns? See if you can create conditions in which one or more of the moths can 'escape' from its state of perpetually circling the light.

Vary the TURN-ANGLE. What happens? Why do you think the moths behave as observed with different values of TURN-ANGLE? What value or values do you think are most realistic?

It would be interesting to better understand the flight patterns of the moths in the model. Add code to the model that allows you to track the movements of one or more moths (for example, by using the pen features). Do you see a pattern? Why might such a pattern appear and how can it be altered?

EXTENDING THE MODEL

This model offers only one set of rules for generating moths' circular flight around a light source. Can you think of different ways to define the rules?

Alternatively, can you imagine a way to model an earlier theory of moth behavior in which moths navigate straight lines by orienting themselves to the moon? Do rules that allow moths to navigate according to their position relative to the moon lead to the observed circling behavior around light sources that are much, much closer than the far-away moon?

NETLOGO FEATURES

This model creates a field of light across the patches, using scale-color to display the value, and the moths use face and max-one-of to traverse the light field.

RELATED MODELS

Ants, Ant Lines, Fireflies, Flocking

CREDITS AND REFERENCES

Adams, C. (1989). Why are moths attracted to bright lights? Retrieved May 1, 2005, from http://www.straightdope.com/classics/a5_038.html

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (2005). NetLogo Moths model. http://ccl.northwestern.edu/netlogo/models/Moths. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 2005 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

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

Click to Run Model

breed [ lights light ]
breed [ moths moth ]

globals
[
  scale-factor  ;; to control the form of the light field
]

lights-own
[
  intensity
]

moths-own
[
  ;; +1 means the moths turn to the right to try to evade a bright light
  ;; (and thus circle the light source clockwise). -1 means the moths
  ;; turn to the left (and circle the light counter-clockwise)
  ;; The direction tendency is assigned to each moth when it is created and does not
  ;; change during the moth's lifetime.
  direction
]

patches-own
[
  light-level ;; represents the light energy from all light sources
]

to setup
  clear-all
  set-default-shape lights "circle 2"
  set-default-shape moths "butterfly"
  set scale-factor 50
  if number-lights > 0
  [
    make-lights number-lights
    ask patches [ generate-field ]
  ]
  make-moths number-moths
  reset-ticks
end 

to go
  ask moths [ move-thru-field ]
  tick
end 

;;;;;;;;;;;;;;;;;;;;;;
;; Setup Procedures ;;
;;;;;;;;;;;;;;;;;;;;;;

to make-lights [ number ]
  create-lights number [
    set color white
    jump 10 + random-float (max-pxcor - 30)
    set intensity random luminance + 20
    set size sqrt intensity
  ]
end 

to make-moths [ number ]
  create-moths number [
    ifelse (random 2 = 0)
      [ set direction 1 ]
      [ set direction -1 ]
    set color white
    jump random-float max-pxcor
    set size 5
  ]
end 

to generate-field ;; patch procedure
  set light-level 0
  ;; every patch needs to check in with every light
  ask lights
    [ set-field myself ]
  set pcolor scale-color blue (sqrt light-level) 0.1 ( sqrt ( 20 * max [intensity] of lights ) )
end 

;; do the calculations for the light on one patch due to one light
;; which is proportional to the distance from the light squared.

to set-field [p]  ;; turtle procedure; input p is a patch
  let rsquared (distance p) ^ 2
  let amount intensity * scale-factor
  ifelse rsquared = 0
    [ set amount amount * 1000 ]
    [ set amount amount / rsquared ]
  ask p [ set light-level light-level + amount ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;
;; Runtime Procedures ;;
;;;;;;;;;;;;;;;;;;;;;;;;

to move-thru-field    ;; turtle procedure
  ifelse (light-level <= ( 1 / (10 * sensitivity) ))
  [
    ;; if there is no detectable light move randomly
    rt flutter-amount 45
  ]
  [
    ifelse (random 25 = 0)
    ;; add some additional randomness to the moth's movement, this allows some small
    ;; probability that the moth might "escape" from the light.
    [
      rt flutter-amount 60
    ]
    [
      ;; turn toward the brightest light
      maximize
      ;; if the light ahead is not above the sensitivity threshold  head towards the light
      ;; otherwise move randomly
      ifelse ( [light-level] of patch-ahead 1 / light-level > ( 1 + 1 / (10 * sensitivity) ) )
      [
        lt ( direction * turn-angle )
      ]
      [
        rt flutter-amount 60
      ]
    ]
  ]
  if not can-move? 1
    [ maximize ]
  fd 1
end 

to maximize  ;; turtle procedure
  face max-one-of patches in-radius 1 [light-level]
end 

to-report flutter-amount [limit]
  ;; This routine takes a number as an input and returns a random value between
  ;; (+1 * input value) and (-1 * input value).
  ;; It is used to add a random flutter to the moth's movements
  report random-float (2 * limit) - limit
end 


; Copyright 2005 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Moths Download this version

Attached files

File Type Description Last updated
Moths.png preview Preview for 'Moths' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.