to move-crw
set state "null"
let dmd (get-bird-dmd (body-mass * 1e3) disperser-mode) / 1e3
let curr-speed dmd / active-hours-per-day
let step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
rt random-normal 0 crw-turn
;; Move the disperser
fd step-length
set real-x real-x + (dx * step-length)
set real-y real-y + (dy * step-length)
let D 0
ifelse length real-xcor-list > 0
[
set D eucl-distance real-x real-y (last real-xcor-list) (last real-ycor-list)
]
[
set D eucl-distance real-x real-y [pxcor] of start-patch [pycor] of start-patch
]
;; Update seeds with distance to location where seed was consumed
update-seeds-xy D
;; Keep track of where the organism is in 'unwrapped' space
update-disperser-xy step-length curr-speed
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Nomads ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to move-nomad-syndrome
;; Set starting coordinates, can be offset if spatially explicit
;; Movement can be divided into those associated with foraging (slow), travelling (mid-speed)
;; with occasional bursts of escape (flee)
get-disperser-state
let start-move (list xcor ycor)
let step-length 0
let curr-speed 0
ifelse random-float 1 < p-lazy
[
set state "lazy"
set color white
set curr-speed 0 ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length 0 ; convert to tick interval (min) and to m (from km)
set heading random-float 360
if commentate? [show "indolent wretch"]
]
[
if state = "forage"
[
set color blue
;let curr-speed (get-step-length 0.01 0.001 disperser-mass "beta") ; speed (km / home-range) in this tick
set curr-speed (get-step-length state1-mean state1-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
; Uniform distribution for direction
set heading random-float 360
]
if state = "search"
[
set color red
;;let curr-speed (get-step-length 0.1 0.01 disperser-mass "beta") ; speed (km / home-range) in this tick
set curr-speed (get-step-length state2-mean state2-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
let last-heading heading
set heading random-normal last-heading return-turn ; BCRW under search
]
if state = "flee"
[
set color green
set curr-speed (get-step-length state3-mean state3-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set heading random-float 360
]
]
;; Move the disperser
fd step-length
set real-x real-x + (dx * step-length)
set real-y real-y + (dy * step-length)
let D 0
ifelse length real-xcor-list > 0
[
set D eucl-distance real-x real-y (last real-xcor-list) (last real-ycor-list)
]
[
set D eucl-distance real-x real-y [pxcor] of start-patch [pycor] of start-patch
]
;; Update seeds with distance to location where seed was consumed
update-seeds-xy D
;; Keep track of where the organism is in 'unwrapped' space
update-disperser-xy step-length curr-speed
end
;; Territorial movement syndrome -> explore edges of defined area
;; Home range defined by mass and then organism move depending on:
; in core = move towards edge (so longer steps)
; in buffer = shorter steps
; ourside hr = move back to within range
to move-territorial-syndrome
get-disperser-state
let start-move (list xcor ycor)
let step-length 0
let curr-speed 0
let ang-return 0
ifelse random-float 1 < p-lazy
[
set state "lazy"
set color white
set curr-speed 0 ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length 0 ; convert to tick interval (min) and to m (from km)
set heading random-float 360
if commentate? [show "indolent wretch"]
]
[
; Shortish, uncorrelated steps if distance from origin is less than home range size
if state = "inside"
[
set color white
set curr-speed (get-step-length state1-mean state1-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
; Uniform distribution for direction
;set heading random-float 360
set heading (r-wrappedcauchy 1 (heading * (pi / 180)) bw-concentration true) * (180 / pi)
;; to-report r-wrappedcauchy [n mu rho as-rad]
]
; Outside the home-range area so reorientate towards it
if state = "outside"
[
set color red
; As maintain heading towards origin if outside of core area
set curr-speed (get-step-length state2-mean state2-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; Need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
ifelse real-x != start-x and real-y != start-y
[
set ang-return atan ( - (real-x - start-x)) ( - (real-y - start-y))
]
[
set ang-return 180 - heading
]
set heading random-normal ang-return return-turn
]
; If inside of the core area, return to normal functioning
if state = "buffer"
[
set color blue
; As maintain heading towards origin if outside of core area
set curr-speed (get-step-length state3-mean state3-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set heading random-float 360
;set ang-return atan ( - (real-x - start-x)) ( - (real-y - start-y))
;set heading random-normal ang-return return-turn
]
if state = "flee"
[
set color green
set curr-speed (get-step-length state4-mean state4-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set heading random-float 360
]
]
;; Move the disperser
fd step-length
set real-x real-x + (dx * step-length)
set real-y real-y + (dy * step-length)
let D 0
ifelse length real-xcor-list > 0
[
set D eucl-distance real-x real-y (last real-xcor-list) (last real-ycor-list)
]
[
set D eucl-distance real-x real-y [pxcor] of start-patch [pycor] of start-patch
]
;; Update seeds with distance to location where seed was consumed
update-seeds-xy D
;; Keep track of where the organism is in 'unwrapped' space
update-disperser-xy step-length curr-speed
if commentate? [type state type " " type distance-from-start type " " print curr-speed]
end
;;;;;;;;;;;;;;;;;;;;
;; Central place movement syndrome -> explore centre of defined area
;; Home range defined by mass and then organism move depending on:
; in core = short, uncorrelated longer step
; in buffer = slightly longer steps
; ourside hr = move back to within range
to move-central-syndrome
get-disperser-state
let start-move (list xcor ycor)
let step-length 0
let curr-speed 0
let ang-return 0
ifelse random-float 1 < p-lazy
[
set state "lazy"
set color white
set curr-speed 0 ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length 0 ; convert to tick interval (min) and to m (from km)
set heading random-float 360
if commentate? [show "indolent wretch"]
]
[
; Shortish, uncorrelated steps if distance from origin is less than home range size
if state = "inside"
[
set color white
set curr-speed (get-step-length state1-mean state1-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
; biased movement
set heading random-float 360
]
; Outside the home-range area so reorientate towards it
if state = "outside"
[
set color red
; As maintain heading towards origin if outside of core area
set curr-speed (get-step-length state2-mean state2-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; Need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set ang-return atan ( - (real-x - start-x)) ( - (real-y - start-y))
set heading random-normal ang-return return-turn
]
; If inside of the core area, return to normal functioning
if state = "buffer"
[
set color blue
; As maintain heading towards origin if outside of core area
set curr-speed (get-step-length state3-mean state3-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set ang-return atan ( - (real-x - start-x)) ( - (real-y - start-y))
set heading random-normal ang-return return-turn
]
if state = "flee"
[
set color green
set curr-speed (get-step-length state4-mean state4-var max-speed speed-distribution) ; speed (km / home-range) in this tick
; need step-length in grid cell units in NetLogo
set step-length (curr-speed * 1000 * (mins-per-tick / 60)) / patch-grain ; convert to tick interval (min) and to m (from km)
set heading random-float 360
]
]
;; Move the disperser
fd step-length
set real-x real-x + (dx * step-length)
set real-y real-y + (dy * step-length)
let D 0
ifelse length real-xcor-list > 0
[
set D eucl-distance real-x real-y (last real-xcor-list) (last real-ycor-list)
]
[
set D eucl-distance real-x real-y [pxcor] of start-patch [pycor] of start-patch
]
;; Update seeds with distance to location where seed was consumed
update-seeds-xy D
;; Keep track of where the organism is in 'unwrapped' space
update-disperser-xy step-length curr-speed
if commentate? [type state type " " type distance-from-start type " " print curr-speed]
end
; Get disperser state *at each tick* drawing on syndromes described by Abrahams et al.
to get-disperser-state
;; Nomad disperser syndrome
if move-syndrome = "nomad"
[
ifelse ticks > 0
[
set prev-state state
let rand random-float 1
if prev-state = "flee" [ set state "search" ]
if rand <= p-leave-forage and prev-state = "forage" [ set state "search" ]
if rand <= p-leave-search and prev-state = "search" [ set state "forage" ]
]
[
ifelse random-float 1 >= 0 ;; 50-50 at the start
[ set state "forage" ]
[ set state "search" ]
]
if random-float 1 < p-flee [set state "flee" ]
]
;; Territorial and central place syndromes
if move-syndrome = "central" or move-syndrome = "territorial"
[
if ticks > 0 [ set prev-state state ]
if (distance-from-start < home-range-radius and distance-from-start < core-radius) [set state "inside"]
if (distance-from-start > home-range-radius and distance-from-start > core-radius) [set state "outside"]
if (distance-from-start < home-range-radius and distance-from-start > core-radius) [set state "buffer" ]
]
if random-float 1 < p-flee [set state "flee" ]
end
to disperser-consume
if length seed-drop-time <= max-feeding-events
[
let event-srt random-exponential mean-srt ;; this is time to drop seed in mins => assume exp as it is single parameter.
if truncate-srt != 0 and event-srt > truncate-srt * 60 [ set event-srt ((truncate-srt * 60) * random-normal 1 0.05) ]
;set event-srt event-srt - random mins-per-tick ;; randomise within time unit when consumption occurs (see Viana et al. 2013 Am Nat)
set seed-drop-time lput floor (elapsed-time-mins + event-srt) seed-drop-time ;; list storing times of when to drop seed
set seed-travel-distance lput 0 seed-travel-distance
set seed-dx lput 0 seed-dx
set seed-dy lput 0 seed-dy
]
end