Invasiv art i systemet
No preview image
Model was written in NetLogo 6.2.2
•
Viewed 41 times
•
Downloaded 5 times
•
Run 0 times
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
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
globals [ birds-color ;; color of birds bugs-color ;; color of bugs grass-color ;; color of patches/grass dirt-color ;; color of areas that have no grass right now, but will grow grass back shortly invasive-color ;; color of invaders bugs-stride ;; how much a bug moves in each simulation step invaders-stride ;; how much an invader moves in each simulation step birds-stride ;; how much a bird moves in each simulation step bird-size ;; size of birds bug-size ;; size of bugs invader-size ;; size of invaders bug-reproduce-age ;; min age of bugs before they can reproduce invader-reproduce-age ;; min age of invaders before they can reproduce bird-reproduce-age ;; min age of birds before they can reproduce max-bugs-age ;; max age of bugs before they automatically die max-birds-age ;; max age of birds before they automatically die max-invaders-age ;; max age of invaders before they automatically die birds-energy-gain-from-bugs ;; how much energy birds gain from eating bugs birds-energy-gain-from-invaders ;; how much energy birds gain from eating invaders min-reproduce-energy-bugs ;; energy required for reproduction by bugs min-reproduce-energy-invaders ;; energy required for reproduction by invaders max-bugs-offspring ;; maximum number of offspring per reproductive event for a bug max-birds-offspring ;; maximum number of offspring per reproductive event for a bird max-invaders-offspring ;; maximum number of offspring per reproductive event for an invader max-plant-energy ;; maximum amount of energy a plant can "grow" to store in a patch sprout-delay-time ;; delay time before a plant begins to grow back, after all of its foliage has been eaten plant-growth-rate ;; amount of energy the plant stores as food per tick as it grows back ] breed [ bugs bug ] breed [ invaders invader ] breed [ birds bird ] breed [ disease-markers disease-marker ] ;; turtles that mark the location of where a bug was removed from disease. breed [embers ember] ;; turtles that mark the location of the flames and embers of the fire. turtles-own [ energy current-age max-age ] ;; these three variables are used for bugs, invaders, and birds ;; fertile? are patches that can grow grass ;; plant-energy keeps track of the amount of food or foliage at that patch ;; countdown keeps track of how much longer until the sprout-delay-time has elapsed for this patch patches-own [ fertile? plant-energy countdown] to setup clear-all set max-plant-energy 100 set plant-growth-rate 10 set sprout-delay-time 25 set bugs-stride 0.3 set invaders-stride 0.3 set birds-stride 0.4 ;; a larger birds-stride than bugs-stride leads to scenarios where less birds ;; can keep a larger number of bugs in balance. set bug-reproduce-age 20 set invader-reproduce-age 20 set bird-reproduce-age 40 set max-birds-age 100 set max-invaders-age 100 set max-bugs-age 100 set birds-energy-gain-from-bugs 25 set birds-energy-gain-from-invaders 25 set min-reproduce-energy-bugs 10 set min-reproduce-energy-invaders 10 set max-bugs-offspring 3 set max-invaders-offspring 3 set max-birds-offspring 2 set bird-size 2.5 set bug-size 1.2 set invader-size 1.5 set birds-color (red - 1) set bugs-color (violet) set invasive-color (blue - 3) set grass-color (green) set dirt-color (white) set-default-shape bugs "bug" set-default-shape birds "bird" set-default-shape invaders "mouse" add-starting-grass add-bugs add-birds reset-ticks end to go if ticks >= 1000 and simulera-endast-1000-tidssteg? [ stop ] ask disease-markers [ age-disease-markers ] ask turtles [ ;; we need invaders and bugs to eat at the same time ;; so one breed doesn't get all the tasty grass before ;; the others get a chance at it. (ifelse breed = bugs [ bugs-live reproduce-bugs ] breed = invaders [ invaders-live reproduce-invaders ] breed = birds [ birds-live reproduce-birds ] [ ] ; anyone else doesn't do anything ) ] ask patches [ ;; only the fertile patches can grow grass set countdown random sprout-delay-time grow-grass ] tick end to remove-a-%-bugs let number-bugs count bugs ask n-of floor (number-bugs * %-minskning-insekter / 100) bugs [ hatch-disease-markers 1 [ set current-age 0 set size 1.5 set color red set shape "x" ] die ] end to age-disease-markers set current-age (current-age + 1) set size (1.5 - (1.5 * current-age / 20)) if current-age > 25 or (ticks = 999 and simulera-endast-1000-tidssteg?) [die] end to start-fire ask patches [ set countdown sprout-delay-time set plant-energy 0 color-grass] end to add-starting-grass ;; setup patch procedure to add grass based on initial settings let number-patches-with-grass (floor (andel-markvegetation * (count patches) / 100)) ask patches [ set fertile? false set plant-energy 0 ] ask n-of number-patches-with-grass patches [ set fertile? true set plant-energy max-plant-energy / 2;; (max-plant-energy - random max-plant-energy) ] ask patches [color-grass] end to add-bugs ;; setup bugs procedure to add bugs based on initial settings create-bugs antal-insekter-vid-start [ ;; create the bugs, then initialize their variables set color bugs-color set energy 20 + random 20 - random 20 ;;randomize starting energies set current-age 0 + random max-bugs-age ;;don't start out with everyone at the same age set max-age max-bugs-age set size bug-size setxy random world-width random world-height ] end to add-birds ;; setup birds procedure create-birds antal-fåglar-vid-start ;; create the bugs, then initialize their variables [ set color birds-color set energy 40 + random 40 - random 40 ;;randomize starting energies set current-age 0 + random max-birds-age ;;don't start out with everyone at the same age set max-age max-birds-age set size bird-size setxy random world-width random world-height ] end to add-invaders create-invaders antal-av-invasiv-art-som-läggs-till ;; create the bugs, then initialize their variables [ set color invasive-color set energy 20 + random 20 - random 20 ;;randomize starting energies set current-age 0 + random max-invaders-age ;;don't start out with everyone at the same age set max-age max-invaders-age set size invader-size setxy random world-width random world-height ] end to bugs-live ;; bugs procedure move-bugs set energy (energy - 1) ;; bugs lose energy as they move set current-age (current-age + 1) bugs-eat-grass death end to birds-live ;; birds procedure move-birds set energy (energy - 1) ;; birds lose energy as they move set current-age (current-age + 1) birds-eat-prey death end to invaders-live ;; invaders procedure move-invaders set energy (energy - 1) ;; invaders lose energy as they move set current-age (current-age + 1) invaders-eat-grass death end to move-bugs ;; bugs procedure rt random 50 - random 50 fd bugs-stride end to move-birds ;; birds procedure rt random 50 - random 50 fd birds-stride end to move-invaders ;; invaders procedure rt random 40 - random 40 fd invaders-stride end to bugs-eat-grass ;; bugs procedure ;; if there is enough grass to eat at this patch, the bugs eat it ;; and then gain energy from it. if plant-energy > hur-effektivt-insekterna-äter [ ;; plants lose ten times as much energy as the bugs gains (trophic level assumption) set plant-energy (plant-energy - (hur-effektivt-insekterna-äter * 10)) set energy (energy + hur-effektivt-insekterna-äter) ;; bugs gain energy by eating ] ;; if plant-energy is negative, make it positive if plant-energy <= hur-effektivt-insekterna-äter [set plant-energy 0] end to invaders-eat-grass ;; invaders procedure ;; if there is enough grass to eat at this patch, the invaders eat it ;; and then gain energy from it. if plant-energy > hur-effektivt-invasiva-arten-äter [ ;; plants lose 10 * as much energy as the invader gains (trophic level assumption) set plant-energy (plant-energy - (hur-effektivt-invasiva-arten-äter * 10)) set energy energy + hur-effektivt-invasiva-arten-äter ;; bugs gain energy by eating ] ;; if plant-energy is negative, make it positive if plant-energy <= hur-effektivt-invasiva-arten-äter [set plant-energy 0] end to birds-eat-prey ;; birds procedure if (any? bugs-here and not any? invaders-here) [ask one-of bugs-here [die] set energy (energy + birds-energy-gain-from-bugs) ] if (any? invaders-here and not any? bugs-here) [ask one-of invaders-here [die] set energy (energy + birds-energy-gain-from-invaders) ] if (any? invaders-here and any? bugs-here) [ifelse random 2 = 0 ;; 50/50 chance to eat an invader or a bug if both are on this patch [ask one-of invaders-here [die] set energy (energy + birds-energy-gain-from-invaders) ] [ask one-of bugs-here [die] set energy (energy + birds-energy-gain-from-bugs) ] ] end to reproduce-bugs ;; bugs procedure let number-offspring (random (max-bugs-offspring + 1)) ;; set number of potential offspring from 1 to (max-bugs-offspring) if (energy > ((number-offspring + 1) * min-reproduce-energy-bugs) and current-age > bug-reproduce-age) [ if random 2 = 1 ;;only half of the fertile bugs reproduce (gender) [ set energy (energy - (number-offspring * min-reproduce-energy-invaders)) ;;lose energy when reproducing- given to children hatch number-offspring [ set size bug-size set color bugs-color set energy min-reproduce-energy-bugs ;; split remaining half of energy amongst litter set current-age 0 rt random 360 fd bugs-stride ] ;; hatch an offspring set it heading off in a random direction and move it forward a step ] ] end to reproduce-invaders ;; bugs procedure let number-offspring (random (max-invaders-offspring + 1)) ;; set number of potential offspring from 1 to (max-invaders-offspring) if (energy > ((number-offspring + 1) * min-reproduce-energy-invaders) and current-age > invader-reproduce-age) [ if random 2 = 1 ;;only half of the fertile invaders reproduce (gender) [ set energy (energy - ( number-offspring * min-reproduce-energy-invaders)) ;;lose energy when reproducing - given to children hatch number-offspring [ set size invader-size set color invasive-color set energy min-reproduce-energy-invaders ;; split remaining half of energy amongst litter set current-age 0 rt random 360 fd invaders-stride ] ;; hatch an offspring set it heading off in a random direction and move it forward a step ] ] end to reproduce-birds ;; bugs procedure let number-offspring (random (max-birds-offspring + 1)) ;; set number of potential offspring from 1 to (max-invaders-offspring) if (energy > ((number-offspring + 1) * energinivå-för-fortplantning-fågel) and current-age > bird-reproduce-age) [ if random 2 = 1 ;;only half of the fertile bugs reproduce (gender) [ set energy (energy - (number-offspring * energinivå-för-fortplantning-fågel)) ;;lose energy when reproducing - given to children hatch number-offspring [ set current-age 0 set size bird-size set color birds-color set energy energinivå-för-fortplantning-fågel;; split remaining half of energy amongst litter set current-age 0 rt random 360 fd birds-stride ] ;; hatch an offspring set it heading off in a random direction and move it forward a step ] ] end to death ;; common procedure for bugs, birds & invaders to die ;; die when energy dips below zero (starvation), or get too old if (current-age > max-age) or (energy < 0) [ die ] end to grow-grass ;; patch procedure set countdown (countdown - 1) ;; fertile patches gain 1 energy unit per turn, up to a maximum max-plant-energy threshold if fertile? and countdown <= 0 [set plant-energy (plant-energy + plant-growth-rate) if plant-energy > max-plant-energy [set plant-energy max-plant-energy]] if not fertile? [set plant-energy 0] if plant-energy < 0 [set plant-energy 0 set countdown sprout-delay-time] color-grass end to color-grass ;; patch procedure ifelse fertile? [ ifelse plant-energy > 0 ;; scale color of patch from whitish green for low energy (less foliage) to green - high energy (lots of foliage) [set pcolor (scale-color green plant-energy (max-plant-energy * 2) 0)] [set pcolor dirt-color] ] [set pcolor dirt-color] end ; Copyright 2011 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created about 2 years ago by Ammie Berglund.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.