Lotka-Volterra Equation: Phase Plane

Lotka-Volterra Equation: Phase Plane preview image

1 collaborator

Tags

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.1 • Viewed 1234 times • Downloaded 75 times • Run 0 times
Download the 'Lotka-Volterra Equation: Phase Plane' 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

Error opening the file

I have just downloaded the last version of NetLogo, and when I try to open the model it says: "Expected nlogo to have 12 sections, this had 10" What is going on? Thank you!

Posted almost 7 years ago

The error while opening the model

Since the model was built in NetLogo 6.0.1 this might be the problem and solution. Although the two version 6.0.1 and 6.0.2 are 'compatible' the problem may be because of the model building 'procedure': part of the model was created in SDM than converted to 'regular' Netlogo. You can download the 6.0.1 version and try to open the model with it. Regards, The author

Posted almost 7 years ago

Click to Run Model

globals [
mylist-x
mylist-y
  sheep-birth-rate
  predation-rate
  predator-efficiency
  wolf-death-rate
  sheep
  wolves
  dt
]

to setup
  ;clear-all
  clear-globals
  clear-ticks
  clear-patches
  clear-all-plots
  ask patches with [ pxcor = 0 ] [  set pcolor white ]
  ask patches with [ pycor = 0 ] [  set pcolor white ]
  setup-coordinates
  set mylist-x list 0 (sheep)
  set mylist-y list 0 (wolves)
  system-dynamics-setup
  system-dynamics-do-plot
end 

to system-dynamics-setup
  reset-ticks
  set dt 0.009
  set sheep-birth-rate sheep-birth-rate-slider
  set predation-rate predation-rate-slider
  set predator-efficiency .8
  set wolf-death-rate 0.15
  set sheep sheep-num
  set wolves wolves-num
end 

to clear-picture
  ca
end 

to go
  system-dynamics-go
  system-dynamics-do-plot
  set mylist-x lput result-x mylist-x
  set mylist-y lput result-y mylist-y
  crt 1 [
    set color select-phase-plot-color
    set xcor (last mylist-x * 0.15)
    set ycor (last mylist-y * 0.15)
    set size 0.5
    set shape "circle"
  ]

  if ticks >= 300 [ stop ]
end 

to system-dynamics-go

  let local-sheep-births sheep-births
  let local-sheep-deaths sheep-deaths
  let local-wolf-births wolf-births
  let local-wolf-deaths wolf-deaths

  let new-sheep max( list 0 ( sheep + local-sheep-births - local-sheep-deaths ) )
  let new-wolves max( list 0 ( wolves + local-wolf-births - local-wolf-deaths ) )
  set sheep new-sheep
  set wolves new-wolves

  tick-advance dt
end 

to-report sheep-births
  report ( sheep-birth-rate * sheep
  ) * dt
end 

to-report sheep-deaths
  report ( sheep * predation-rate * wolves
  ) * dt
end 

to-report wolf-births
  report ( wolves * predator-efficiency * predation-rate * sheep
  ) * dt
end 

to-report wolf-deaths
  report ( wolves * wolf-death-rate
  ) * dt
end 

to-report result-x
  report sheep
end 

to-report result-y
    report  wolves
end 

to setup-coordinates
  ask patch -5 5
  [ set plabel "0"
    set plabel-color white ]

  ask patch -7 160
  [ set plabel "1000"
    set plabel-color white ]

  ask patch -7 80
  [ set plabel "500"
    set plabel-color white ]

  ask patch 160 -5
  [ set plabel "1000"
    set plabel-color white ]

  ask patch 320 -5
  [ set plabel "2000"
    set plabel-color white ]

  ask patch -5 -48
  [ set plabel "-50"
    set plabel-color white ]

  ask patch -40 -5
  [ set plabel "-50"
    set plabel-color white ]

  ask patch -10 193
  [ set plabel "Wolves"
    set plabel-color blue ]

  ask patch 380 -10
  [ set plabel "Sheep"
    set plabel-color red ]
end 

to system-dynamics-do-plot
  if plot-pen-exists? "sheep" [
    set-current-plot-pen "sheep"
    plotxy ticks sheep
  ]
  if plot-pen-exists? "wolves" [
    set-current-plot-pen "wolves"
    plotxy ticks wolves
  ]
end 

There is only one version of this model, created about 7 years ago by Victor Iapascurta.

Attached files

File Type Description Last updated
Lotka-Volterra Equation: Phase Plane.png preview Preview for 'Lotka-Volterra Equation: Phase Plane' about 7 years ago, by Victor Iapascurta Download

This model does not have any ancestors.

This model does not have any descendants.