Hurricane Simulation Phase 1

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.2.0 • Viewed 333 times • Downloaded 41 times • Run 0 times
Download the 'Hurricane Simulation Phase 1' 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

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

Click to Run Model

globals [
  ocean-top      ;; x coordinate of top row of ocean
  mangrove-top    ;; x coordinate of top row of mangrove
  land-top        ;; x coordinate of top row of land
  energy   ;;overall energy
   speed;; speed of hurricane
]


breed [hurricanes hurricane];; hurricane

to setup ;; set-up button
  clear-all
  set-default-shape hurricanes "target";; sets appearance of hurricane
  create-hurricanes 1 [ setxy min-pxcor + 2 random-ycor ];; places hurricane at edge of ocean but random  y coordinate
  ask hurricanes [ set color grey set size category] ;; sets appearance of hurricane
  reset-ticks; resets time
  setup-world; sets appearance of world
  setup-energy;; sets energy of hurricane
end 

to setup-world ;; sets appearance of world
  set ocean-top min-pxcor ;; ocean on left side of screen
  set mangrove-top 5 ;; x coordinate of mangrove
  set land-top mangrove-top + 1 ;; sets width of mangrove
  ask patches [  ;; set colors for the different sections of the world
    
    if pxcor >= ocean-top and pxcor < mangrove-top  ;; ocean
     [ set pcolor scale-color blue pxcor -20 20
    ]
    if pxcor >= mangrove-top and pxcor < land-top ;; mangrove
      [ set pcolor red + 3 ]
    if pxcor >= land-top ;;land
    [set pcolor brown  ]
  ]
end 

to setup-energy ;;  sets energy level based on caregory
  if category = 1 [set energy  1]
  if category = 2 [set energy  2]
  if category = 3 [set energy  3]
  if category = 4 [set energy  4]
  if category = 5 [set energy  5]  
end 

to go;; go button
  ask hurricanes [progress-hurricane]
  progress-time
end 

to progress-time
  tick
end 

to progress-hurricane
  move-hurricane
  change-energy
end  

to move-hurricane;; moves hurricane
  ask hurricanes [
    ;;right random 360 ;; changes direction
    movebasedonenergy
    set xcor xcor + speed
    set ycor ycor + .05 * xcor * speed 
  ]
end 

to change-energy;; changes energy levels
 
  if pxcor >= ocean-top and pxcor < mangrove-top [set energy  energy + .2]
  if pxcor >= mangrove-top and pxcor < land-top [set energy  energy - 1]
  if pxcor >= land-top [set energy  energy - .5]
  if energy <= 0 [set energy 0]
  if energy = 0 [ die] 
  if energy >= 100 [die]
end 

to movebasedonenergy;; determines speed of hurricane based on energy level
    if energy >= 5 [set speed 1]
    if energy < 5 and energy >= 4 [ set speed .5]
    if energy < 4 and energy >= 3 [set speed .25]
    if energy < 3 and energy >= 2 [set speed .125]
    if energy < 2 and energy >= 1 [set speed .0625]
    if energy < 1 and energy > 0 [set speed .03125]
    if energy <= 0 [forward 0]
end  

There is only one version of this model, created almost 10 years ago by Kirsten Stallings.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.