Pacific Salmon Simulation

No preview image

1 collaborator

Default-person keisha siahaan (Author)

Tags

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


Comments and Questions

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

Click to Run Model

globals [
  avg-salmon-size
  avg-spawn-time
  total-salmon
  fishing-season-start
  fishing-season-length
  max-salmon-population
  max-salmon-age
]

turtles-own [
  salmon-size
  age
  spawn-time
  reproductive-success
]

patches-own [
  water-temp
]

to setup
  clear-all
  set fishing-season-start fishing-start-slider
  set fishing-season-length (random (fishing-length-slider-max - fishing-length-slider-min + 1) + fishing-length-slider-min)
  set max-salmon-population 1000
  set max-salmon-age 7

  ask patches [
    set water-temp random 5 + 15
  ]

  create-turtles salmon-count-slider [
    setxy random-xcor random-ycor
    set salmon-size random-float (max-size-slider - min-size-slider) + min-size-slider
    set age 0
    set spawn-time random 3
    set reproductive-success 0
    set shape "dot"
    ifelse salmon-size < selectivity-threshold-slider [
      set color pink
    ] [
      set color red
    ]
  ]

  create-turtles boat-count-slider [
    setxy random-xcor random-ycor
    set shape "boat"
    set color brown
    set size 2
  ]

  update-stats
  reset-ticks
end 

to go
  if count turtles with [shape = "dot"] = 0 [
    user-message "All salmon are gone!"
    stop
  ]

  if count turtles with [shape = "dot"] > max-salmon-population [
    user-message "Population limit reached!"
    stop
  ]

  ask turtles with [shape = "dot"] [
    move-salmon
    grow
    update-salmon-appearance ;; <-- ADD THIS LINE HERE
    reproduce
    if age > max-salmon-age [ die ]
  ]

  if ticks >= fishing-season-start and ticks < (fishing-season-start + fishing-season-length) [
    fishing-behavior
  ]

  update-stats
  tick
  wait 0.3
end 

to move-salmon
  rt random 360
  fd 1
end 

to grow
  let growth-rate growth-rate-slider
  set salmon-size salmon-size + growth-rate
  if salmon-size > max-size-slider [ set salmon-size max-size-slider ]
  ifelse salmon-size < selectivity-threshold-slider [
    set color pink
  ] [
    set color red
  ]
end 

to reproduce
  if age > 3 and (
    (spawn-time = 0 and ticks mod 50 < 10) or
    (spawn-time = 1 and ticks mod 50 < 20) or
    (spawn-time = 2 and ticks mod 50 < 30)
  ) [
    if count turtles with [shape = "dot"] < max-salmon-population [
      hatch 1 [
        set salmon-size random-float (max-size-slider - min-size-slider) + min-size-slider
        set age 0
        set spawn-time random 3
        set reproductive-success 0
        set shape "dot"
        ifelse salmon-size < selectivity-threshold-slider [
          set color pink
        ] [
          set color red
        ]
      ]
    ]
  ]
  set age age + 1
end 

to fishing-behavior
  ask turtles with [shape = "boat"] [
    rt random 360
    fd 1
    ask turtles in-radius 1 with [shape = "dot" and salmon-size > selectivity-threshold-slider] [
      die
    ]
  ]
end 

to update-stats
  let fish turtles with [shape = "dot"]
  ifelse any? fish [
    set avg-salmon-size mean [salmon-size] of fish
    set avg-spawn-time mean [spawn-time] of fish
    set total-salmon count fish
    print (word "Avg Size: " avg-salmon-size
                "  Avg Spawn Time: " avg-spawn-time
                "  Total Salmon: " total-salmon)
  ] [
    set avg-salmon-size 0
    set avg-spawn-time 0
    set total-salmon 0
    print "No salmon left!"
  ]
end 

to update-salmon-appearance
  ask turtles with [shape = "dot"] [
    if salmon-size < selectivity-threshold-slider [
      set color pink
      set size 0.5
    ]
    if salmon-size >= selectivity-threshold-slider [
      set color red
      set size 1.5
    ]
  ]
end 

There is only one version of this model, created 4 days ago by keisha siahaan.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.