;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CRW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
to move-crw
set state "null"
let curr-speed constant-speed
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-tsfw-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 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 ; directional CRW 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
; Get disperser state *at each tick* drawing on syndromes described by Abrahams et al.
to get-disperser-state
;; Nomad disperser syndrome
if move-syndrome = "tsfw"
[
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
let event-srt 0
if length seed-drop-time <= max-feeding-events
[
ifelse truncate-srt != 0 ;; truncate-srt == 0 means unconstrained (allometric)
[
let srt-ok? false
while [not srt-ok?]
[
set event-srt random-exponential mean-srt ;; this is time to drop seed in mins => assume exp as it is single parameter.
if event-srt <= truncate-srt [set srt-ok? true]
]
]
[
set event-srt random-exponential mean-srt ;; this is time to drop seed in mins => assume exp as it is single parameter.
]
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