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 103 times • Downloaded 3 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.)


WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

(suggested things for the user to notice while running the model)

THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

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 2 months ago by keisha siahaan.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.