From 73ef810944423df1314ac0c7b221c7495b9cee39 Mon Sep 17 00:00:00 2001 From: Martin Lange <martin.lange@ufz.de> Date: Mon, 8 Feb 2021 01:12:36 +0100 Subject: [PATCH] complated basic model by adding dispersal --- README.md | 50 +++++++++++++++++++++++++++++++++--- nlogo/Model.nlogo | 64 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 109 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6b9dd26..52002b0 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/nlogo/Model.nlogo b/nlogo/Model.nlogo index 4ce1411..afbc970 100644 --- a/nlogo/Model.nlogo +++ b/nlogo/Model.nlogo @@ -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? -- GitLab