Skip to content
Snippets Groups Projects
Commit 73ef8109 authored by Martin Lange's avatar Martin Lange
Browse files

complated basic model by adding dispersal

parent 136b289e
No related branches found
No related tags found
1 merge request!3Building the Rabies model from ODD
Pipeline #15929 passed with stage
in 19 seconds
......@@ -16,6 +16,7 @@ patches-own [
state
infected-neighbours
ticks-to-death
dispersal-tick
]
```
......@@ -43,15 +44,18 @@ set R 3
```netlogo
;- Go
to go
if ticks mod 12 = 0 [
assign-dispersal
]
disperse
infect-patches
age-infection
update-patches
tick
end
; ==> Infection.
; ==> Disease course.
; ==> Update patches.
; ==> Submodels.
```
### Design concepts
......@@ -80,6 +84,46 @@ end
### Submodels
```netlogo
;- Submodels
; ==> Dispersal.
; ==> Infection.
; ==> Disease course.
; ==> Update patches.
```
#### Dispersal
```netlogo
;- Dispersal
to assign-dispersal
ask patches with [ state != EMPTY ] [
set dispersal-tick (ticks + start-dispersal + random length-dispersal)
]
end
```
```netlogo
;- Dispersal
to disperse
ask patches with [ state != EMPTY and dispersal-tick = ticks ] [
let candidates other patches
in-radius dispersal-radius
with [ state = EMPTY ]
let num-candidates num-offspring
if count candidates < num-candidates [
set num-candidates count candidates
]
ask n-of num-candidates candidates [
set state S ; no dispersal of infected
; alternative:
; set state [state] of myself
; set ticks-to-death [ticks-to-death] of myself
]
]
end
```
#### Infection
```netlogo
......
......@@ -78,9 +78,9 @@ HORIZONTAL
SLIDER
10
100
95
215
133
128
ticks-infected
ticks-infected
1
......@@ -91,6 +91,66 @@ ticks-infected
NIL
HORIZONTAL
SLIDER
10
155
215
188
start-dispersal
start-dispersal
0
11
8.0
1
1
NIL
HORIZONTAL
SLIDER
10
190
215
223
length-dispersal
length-dispersal
1
11
3.0
1
1
NIL
HORIZONTAL
SLIDER
10
250
215
283
dispersal-radius
dispersal-radius
1
5
3.0
0.5
1
NIL
HORIZONTAL
SLIDER
10
285
215
318
num-offspring
num-offspring
0
10
4.0
1
1
NIL
HORIZONTAL
@#$#@#$#@
## WHAT IS IT?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment