Delta Smelt Population Simulation

No preview image

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

1 collaborator

Default-person Noah Price (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.3.1 • Viewed 206 times • Downloaded 14 times • Run 0 times
Download the 'Delta Smelt Population Simulation' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

breed [smelts]
breed [clouds]
breed [bass]
breed [contaminants]
breed [contaminants2]
breed [waterweed]
breed [shrimp]

turtles-own [age energy]
contaminants2-own[touched]

globals [temperature]

to setup

  ca
  reset-ticks
  set temperature initial_temperature

  create-waterweed initial_waterweed [
    set shape "waterweed"
    set size 5
    ifelse random 2 = 1 [
      set heading 270] [
      set heading 90]
    setxy -65 + random 160 7]

  ask patches [set pcolor scale-color 76 (pycor) -70 (160 - (count waterweed + temperature))] ;; water green-blue

  ask patches with [pycor > -10 and pycor < 0 and pxcor > 80]
  [set pcolor scale-color 5 (pxcor) 40 140] ;;contaminant pipe

  ask patches with [pxcor < -70]
  [set pcolor scale-color 35 (pxcor) -130 -20] ;; levee brown

  ask patches with [pycor > -40 and pycor < -30 and pxcor < -60]
  [set pcolor scale-color 5 (pxcor) -120 -20] ;; diversion pump

  ask patches with [pycor > 10]
  [set pcolor scale-color 86 (pycor) -30 70] ;; sky blue

  create-turtles 1 [
    set shape "levee"
    setxy -85.2 13.3
    set heading 0
    set size 60
    set color scale-color 35 (pxcor) -130 -20] ;;make levee

  create-turtles 1 [
    set shape "sun"
    setxy 98 48
    set heading 180
    set size 40
    set color 46] ;; sun

  create-clouds 3 [
    set shape "cloud"
    set xcor -70 + random 140
    set ycor 20 + random 20
    set color scale-color 8 (pycor) -20 50
    set size 20
    ifelse random 2 = 1 [
      set heading 90] [
      set heading 270]] ;; cloud


  create-smelts initial_smelts [
    set age random 10
    set shape "smelt"
    set size 5
    set ycor -50 + random 60
    set xcor -60 + random 145
    set color [255 215 0 60]] ;;smelt

  create-turtles 1 [
    set shape "person"
    set color black
    set size 15
    setxy -86 22
    set heading 90] ;; person on levee

  create-bass initial_bass [
    set shape "bass"
    set size 10
    set heading 45
    setxy -86 22
    set color blue] ;striped bass

  create-shrimp initial_shrimp [
    set shape "shrimp"
    set size 1
    set ycor -50 + random 60
    set xcor -60 + random 145
    set color red]
end 

to reproduce [nums] ;reproduction

  set nums first nums

  set energy energy + 1

  if energy = 40 + random 10 [
    hatch nums [set energy random 10 set age random 10]]
end 

to get_old ;;all aging process of turtles

  set age age + 1

  if temperature > 70 [set age age + 1] ;;hot temperature ages smelt
  if temperature > 80 [set age age + 1]
  if temperature > 90 [set age age + 1]

  if temperature < 60 [set age age + 1] ;;cold temperature ages smelt
  if temperature < 50 [set age age + 1]
  if temperature < 40 [set age age + 1]

  if any? contaminants2 in-radius 2 [set age age + 3]

  if age > 280 - count waterweed * 2 + random 40 [die]
end 

to float ;;movement of clouds

  fd .3

  if xcor >= 95 [set heading 270]
  if xcor <= -95 [set heading 90]
end 

to float_waterweed ;floating movement for waterweed

  fd .3

  if xcor <= -65 [set heading 90]
  if xcor >= 95 [set heading 270]
end 

to move ;;movement in water

  if ticks mod 10 = 0 [set heading random 360]

  if xcor > 98 [set heading 190 + random 160]

  if ycor > 5 [set heading 100 + random 160]

  if ycor < -48 [set heading 280 + random 160]

  if xcor < -65 [
    if ycor > 0 [
      set heading 100 + random 70]
    set heading 10 + random 160]

  fd 1
end 

to bass_move ;;movement of bass

  if ticks < 40 [set heading ticks * 3 + 50 fd 2] ;;arc of bass being thrown
  if ticks > 40 and ticks < 45 [set heading 130 fd 1.5]
  if ticks > 45 and ticks < 60 [set heading 100 + random 135 fd 1] ;;
  if ticks > 60 [move]
end 

to contaminant_behavior ;;contaminants die when touched "touched" number of times and move towards the center before diffusing

  if ticks mod 100 < 40 [
    face one-of patches with [pycor = -49 + random 60] fd 2]

  if ticks mod 100 = 40 [hatch 1 [set breed contaminants2 set shape "dot"] die]

  fd 1
end 

to go

  no-display
  wait 0.05
  tick

  ifelse temperature < 100 and temperature > 40 [
    if temperature_change = "Extreme Increase" [ifelse random 4 > 0 [set temperature temperature + 1] [set temperature temperature - 1]]
    if temperature_change = "Gradual Increase" [ifelse random 4 > 1 [set temperature temperature + 1] [set temperature temperature - 1]]
    if temperature_change = "Random Change" [ifelse random 2 = 0 [set temperature temperature + 1] [set temperature temperature - 1]]
    if temperature_change = "Gradual Decrease" [ifelse random 4 > 1 [set temperature temperature - 1] [set temperature temperature + 1]]
    if temperature_change = "Extreme Decrease" [ifelse random 4 > 0 [set temperature temperature - 1] [set temperature temperature + 1]]] [
    ifelse temperature = 100 [set temperature temperature - 1] [set temperature temperature + 1]]
  ask patches with [pxcor >= -70 and pycor <= 10] [set pcolor scale-color 76 (pycor) -70 (160 - (count waterweed + temperature))] ;; water green-blue

  ask patches with [pycor > -40 and pycor < -30 and pxcor < -60]
  [set pcolor scale-color 5 (pxcor) -120 -20] ;; diversion pump

  ask patches with [pycor > -10 and pycor < 0 and pxcor > 80]
  [set pcolor scale-color 5 (pxcor) 40 140] ;;contaminant pipe

  ask clouds [float]

  ask waterweed [float_waterweed]

  ask smelts [move]
  ask smelts [if count smelts < 100 [reproduce [2]]]
  ask smelts [get_old]
  ask smelts [if count shrimp < 5 and random 50 < 10 [die]]
  ask smelts [if count smelts < 100 and count bass < 3 [reproduce [1]]]

  ask bass [bass_move]
  ask bass [if count bass < 20 [reproduce [1]]]
  ask bass [get_old]
  ask bass [if count smelts < 5 and random 50 < 10 [die]]

  ask shrimp [get_old]
  ask shrimp [move]
  ask shrimp [if count shrimp < 600 [reproduce [4]]]

  if ticks = 10 or ticks mod 100 = 0 [create-contaminants initial_contaminants [
    set shape "dot"
    set size 1
    setxy 82 -6
    set heading 90 + random 270
    ifelse random 2 = 1 [
      set color black] [
      set color white]
    if ticks = 0 [hide-turtle]]] ;;contaminants

  ask contaminants [if count contaminants2 < 500 [contaminant_behavior]]
  ask contaminants2 [move fd 1]
  ask contaminants2 [if any? smelts in-radius 2 [set touched touched + 2]]
  ask contaminants2 [if any? bass in-radius 2 [set touched touched + 4]]
  ask contaminants2 [if any? shrimp in-radius 2 [set touched touched + 1]]
  ask contaminants2 [if touched > 6 [die]]

  ask shrimp [if any? smelts in-radius 3 [die]]
  ask shrimp [if any? bass in-radius 3 [die]]

  ask smelts [if any? bass in-radius 4 [die]]
  ask smelts [if any? shrimp in-radius 3 [ set age age - 100]]

  ask bass [if any? smelts in-radius 4 [set age age - 50]]

  display
end 

There is only one version of this model, created over 2 years ago by Noah Price.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.