BeeSmart Waggle Dance 3D

No preview image

1 collaborator

Default-person Bryan Guo (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 3D 5.2.0 • Viewed 540 times • Downloaded 35 times • Run 0 times
Download the 'BeeSmart Waggle Dance 3D' 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 explains how a waggle dance encodes spatial information of a hive site. In the view, a swarm is placed at the center. A honeybee is on the surface of the swarm, which is perpendicular to the ground. The sun is in the sky and a hive site is on the ground. For more information about honeybees' hive-finding behavior, see BeeSmart Hive Finding in the NetLogo Models Library.

## HOW IT WORKS

The model calculates the angle between the sun, the swarm, and the hive site (Angle sun-swarm-site) by using atan of the coordinates of the projects of these objects on the xy plane (the ground). Then the bee on the swarm produces waggle dance patterns (a circle with a squiggly inside) to represent the location information of the hive site in relation to the position of the sun.

## HOW TO USE IT

When the setup button is clicked, a bird view of the world is presented. Click and hold any part of the view and drag upwards until the view turns 90 degree and the blue arrow on the swarm at the center is pointing upwards. Click go to run the model.

## THINGS TO NOTICE

Notice the angle between the sun, the swarm, and the hive site (Angle sun-swarm-site) and the angle between the up direction (the blue arrow) and the squiggly. These two angles should be the same.

Also notice the relationship between the length of the squiggly and the distance between the swarm and the hive site. The farther the site, the longer the squiggly.

## THINGS TO TRY

Use the site-quality and the sun-position sliders to change these two parameters, and observe how the dance pattern change accordingly. You may need to click setup for the changes in the sliders to take effect.

Click the one-plane button and then unclick it. Notice how all objects are sunk to the ground plane. Click the ground-clone button to create a clone of the bee. This clone dances exactly the same pattern, but the dance is on the ground plane with the "up" direction pointing to the sun. Compare and find the relations between the dance on the vertical swarm plane and the ground plane.

## EXTENDING THE MODEL

Now the hive site is placed randomly in the world. One way to extend the model is to add sliders to control the position of the hive site.

Currently, the sun does not move as time passes. However, in the real world, the sun does move. Adding an automatic sun movement is another way to extend this model.

## NETLOGO FEATURES

This model uses NetLogo 3D, where the patches are actually cubes. The movement of the swarm is actually recoloring of patch cubes that cannot move.

## RELATED MODELS

Guo, Y. and Wilensky, U. (2014). NetLogo BeeSmart - Hive Finding model. http://ccl.northwestern.edu/netlogo/models/BeeSmart-HiveFinding. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

## CREDITS AND REFERENCES

Guo, Y., & Wilensky, U. (2014) Beesmart: a microworld for swarming behavior and for learning complex systems concepts. Proceedings of the Constructionism 2014 Conference. Vienna, Austria. August 2014.

Seeley, T. D. (2010). Honeybee democracy. Princeton, NJ: Princeton University Press.

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 [sites site]
breed [suns sun]
bees-own [ground-bee? target target-angle interest dist-to-hive circle-switch temp-x-dance temp-y-dance temp-z-dance beetimer dancing? dance-time]
patches-own [swarm? suitable?]
suns-own [init-x init-y init-z]
sites-own [dist-to-center quality]
globals [sun-angle ];oneplane?]

to setup
  ca
  setup-swarm
  setup-ground
  setup-sky
  setup-site
  setup-sun
  setup-bee
 ; set oneplane? false
  reset-ticks
end 

to setup-swarm
  ask patches with [
    pxcor > -10 and pxcor < 10 and 
    pzcor > -10 and pzcor < 10 and 
    pycor = 0 and distancexyz 0 0 0 < 5
    ] [set pcolor brown set swarm? true]
end 

to setup-ground
  ask patches with [pzcor = -16 ] [set pcolor green ];if distancexyz 0 0 -16 > 8 [set suitable? true]]
end 

to setup-sky
  ask patches with [pycor = 16 ] [set pcolor scale-color blue pzcor 20 0]
    ask patches with [abs pxcor = 16 ] [set pcolor scale-color blue pzcor 20 0]
end 

to setup-site
    create-sites 1 [
      set heading 0 
      set pitch 0 
      set roll 0 
      set shape "square" 
      set size 4 
      set color pink 
      set quality site-quality
      set label word "Q= " quality
      place-site
      set dist-to-center distancexyz 0 0 -14
      ask patch-at -1 -3 -2 [set plabel word "X= " [xcor] of myself]
      ask patch-at 1 0 -2 [set plabel word "Y= " [ycor] of myself]
      ]
end 

to place-site
  set xcor 14 - random 29 set ycor 14 - random 29 set zcor -14 if distancexyz 0 0 -14 < 8 [place-site]
end 

to setup-sun
  create-suns 1 [
    setxyz sun-position 14 14 
    set init-x 14 set init-y 14 set init-z 14 
    set shape "circle" 
    set size 4 
    set color red
    ]
end 

to setup-bee
  create-bees 1 [
    set ycor -1 set shape "bee" set size 2       
    set heading 0 
    set pitch 90 
    set roll 0 
  draw-arrow
    set dancing? true
    set ground-bee? false
    set target one-of sites
    set dist-to-hive [dist-to-center] of target
    set interest [quality] of target
    set color [color] of target
    set circle-switch 1
      ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;run time;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  every 0.1 [
  ask suns [set xcor sun-position]
  ask bees [if dancing? [dance]]
  tick]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;dance;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report dance-angle
   let site-angle atan [xcor] of one-of sites [ycor] of one-of sites 
   set sun-angle atan [xcor] of one-of suns [ycor] of one-of suns
   report site-angle - sun-angle
end 

to dance
  ifelse dance-time <= interest [
    pd
      repeat 2 [                      
      waggle 
      make-semicircle 
      set dance-time dance-time + 1
    ]
      ][
      pu
      set dancing? false
      ]
end 

to make-semicircle
  let num-of-turns 1 / interest * 2600          ;calculate the size of the semicircle. 2600 and 5 (in pi / 5) are numbers selected by trial and error to make the dance path look good 
  let angle-per-turn 180 / num-of-turns
  let semicircle dist-to-hive * pi / 6
  if circle-switch = 1 [
  ifelse ground-bee? [set heading sun-angle set pitch 0 set roll 0][set heading 0 set pitch 90 set roll 0]
   rt dance-angle 
 lt 90
    repeat num-of-turns [
      lt angle-per-turn fd (semicircle / 180 * angle-per-turn)
    ]
  ]
  if circle-switch = -1 [
  ifelse ground-bee? [set heading sun-angle set pitch 0 set roll 0][set heading 0 set pitch 90 set roll 0]
      rt dance-angle  
      rt 90 
    repeat num-of-turns [
      rt angle-per-turn fd (semicircle / 180 * angle-per-turn)
    ]
  ]
  set circle-switch circle-switch * -1
  setxyz temp-x-dance temp-y-dance temp-z-dance 
  wait 0.1
end 

to waggle                                       ; pointing the zigzag direction to the targe
  ifelse ground-bee? [set heading sun-angle set pitch 0 set roll 0][set heading 0 set pitch 90 set roll 0]
  rt dance-angle     
    set temp-x-dance xcor set temp-y-dance ycor set temp-z-dance zcor
  let waggle-switch 1                                    ; switch toggles between 1 and -1, which makes a bee dance a zigzag line by turning left and right
  lt 60 fd .2                                            ; first part of a zigzag line
  repeat (dist-to-hive - 2) * 2 [                        ; correlates the number of turns in the zigzag line with the distance between the swarm and the hive. the number 2 is selected by trial and error to make the dance path look good
    if waggle-switch = 1 [rt 120 fd .4]                  ; alternates left and right along the diameter line that points to the target
    if waggle-switch = -1 [lt 120 fd .4]
    set waggle-switch waggle-switch * -1
  ]
  ifelse waggle-switch = -1 [lt 120 fd .2][rt 120 fd .2] ; finish the last part of the zigzag line
  wait 0.1
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;one-plane;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to one-plane
;  ifelse oneplane? [stop][
  clear-drawing
  let bottom-swarm patch-set patches with [
  pxcor > -10 and pxcor < 10 and 
  pzcor < -5 and pzcor > -16 and
  pycor = 0 and 
  distancexyz 0 0 -15 < 5
    ]
  ask bees [if zcor > -14 [set zcor zcor - 1] ]
  ask suns [if zcor > -14 [set zcor zcor - 1]]
  ask-concurrent patches with [pcolor = brown] [if not member? self bottom-swarm [set pcolor 0] ask patch pxcor pycor (pzcor - 1) [set pcolor brown]]
  ask patches with [pzcor = -16] [set pcolor green]
  let slit patch-set patches with [pxcor > -5 and pxcor < 5 and pycor = 0 and pzcor = -16]
  if (item 0 [zcor] of bees with [not ground-bee?]) < -13 [ask bees [hatch 1 [set heading 0
    set pitch 90 
    set roll 0 
    draw-arrow die]] stop]
;  if any? slit with [pcolor = brown] [set oneplane? true]
;  ]
end 

to ground-clone
  ask one-of bees [hatch 1 [
      set ground-bee? true
      set heading sun-angle 
    set pitch 0 
    set roll 0 
draw-arrow
    set color [color] of target
  ]]
end 

to draw-arrow
  set color blue
  pd
  fd 4 rt 150 fd 1 bk 1 lt 300 fd 1 bk 1 rt 150 bk 4
  pu
end 

There is only one version of this model, created over 9 years ago by Bryan Guo.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.