# Grazing

Model was written in NetLogo 6.0.1
•
Viewed 471 times
•
Downloaded 29 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

patches-own [ nutrient ;; the total of the manure and chicken-manure manure ;; the amount of manure added to patches by cows and sheep chicken-manure ;; the amount of manure added to patches by chickens energy ;; the health of the pasture (as measured by the amount of grass) ] breed [sheep a-sheep] breed [chickens chicken] breed [cows cow] to setup clear-all setup-patches setup-turtles reset-ticks end to setup-patches ask patches [ set pcolor 65 set energy 9 set manure 0 set chicken-manure 0 ] end to setup-turtles set-default-shape cows "cow" set-default-shape sheep "sheep" set-default-shape chickens "chicken" create-cows cow-number [ set color black set size 2 setxy random-xcor random-ycor ] create-sheep sheep-number [ set color white setxy random-xcor random-ycor ] create-chickens chicken-number [ set color red setxy random-xcor random-ycor ] end to go if all? patches [pcolor = 69.9] [stop] ;; when all the grass is down to lowest level of richness if mean [ energy ] of patches <= 0 [stop] ;; when the grass is on average at or below 0 energy, stop ask cows [ eat-grass-cows move-turtles ] ask sheep [ eat-grass-sheep move-turtles ] ask chickens [ eat-bugs move-chickens ] update-patches tick end to move-turtles uphill-energy ;; turn towards richest grass in front three patches forward 1 if not can-move? 1 [ rt random 150 ] ;; if stuck against one edge turn around end to move-chickens ;; move towards most manure in front three patches uphill-nutrient forward 1 if not can-move? 1 [ rt random 150 ] ;; if stuck against one edge end to eat-grass-cows ifelse energy >= 5 [ ;; if there's enough energy/grass for a full meal set energy energy - 5 ;; eat grass set manure manure + 6 ;; deposit manure ] [ ;; if there isn't enough energy/grass for a full meal set manure manure + energy * 1.2 ;; deposit manure in proportion to how much energy/grass there is set energy 0 ;; use up all the energy ] end to eat-grass-sheep ifelse (energy >= 1) [ ;; if there's enough energy/grass for a full meal set energy energy - 1 ;; eat grass set manure manure + 1.2 ;; deposit manure ] [ ;; if there isn't enough energy/grass for a full meal set manure manure + energy * 1.2 ;; deposit manure in proportion to how much energy/grass there is set energy 0 ;; use up all the energy ] end to eat-bugs if manure >= .05 and energy > 0 [ ;; scratch through manure, adding to decomposition set manure manure - .05 ;; I have no idea what this number should be, if even > 0 if (type-of-change = "linear") [set energy energy + .05] if (type-of-change = "nonlinear") [set energy energy + .16 / sqrt energy] ] if energy >= .2 [ ;; if there's enough energy/grass for a full meal set energy energy - .2 ;; eat grass set chicken-manure chicken-manure + .25 ;; deposit manure ] if energy < .2 [ ;; if there isn't enough energy/grass for a full meal set chicken-manure chicken-manure + energy * 1.2 ;; deposit manure in proportion to how much energy/grass there is set energy 0 ;; use up all the energy ] end to update-patches ask patches [ if manure >= .25 and energy > 0 [ ;; manure decays on its own, enriching grass, but only if there's still grass left set manure manure - .25 if (type-of-change = "linear") [set energy energy + .25] if (type-of-change = "nonlinear") [set energy energy + .8 / sqrt energy] ] if manure < .25 and energy > 0 [ ;; if there's very little manure set energy energy + manure ;; increase energy by amount of manure (use manure up) set manure 0 ] if chicken-manure >= .25 and energy > 0 [ set chicken-manure chicken-manure - .25 if (type-of-change = "linear") [set energy energy + .25] if (type-of-change = "nonlinear")[set energy energy + .8 / sqrt energy] ] if chicken-manure < .25 and energy > 0 [ ;; if there's very little chicken-manure set energy energy + chicken-manure ;; increase energy by amount of manure (use manure up) set chicken-manure 0 ] set nutrient manure + chicken-manure recolor-patch ] end ;; set colour of patch paler or darker according to richness, but not to black or white, so we can still see the livestock to recolor-patch if energy < 1 [ set pcolor 69.9 ] if energy > 1 [ if energy <= 3 [ set pcolor 69 ]] if energy > 3 [ if energy <= 5 [ set pcolor 68 ]] if energy > 5 [ if energy <= 7 [ set pcolor 67 ]] if energy > 7 [ if energy <= 9 [ set pcolor 66 ]] if energy > 9 [ if energy <= 11 [ set pcolor 65 ]] if energy > 11 [ if energy <= 13 [ set pcolor 64 ]] if energy > 13 [ if energy <= 15 [ set pcolor 63 ]] if energy > 15 [ set pcolor 62 ] end ;; move towards patch ahead with most manure to uphill-nutrient let manure-ahead nutrient-scent-at-angle 0 let manure-right nutrient-scent-at-angle 45 let manure-left nutrient-scent-at-angle -45 ;; if all patches ahead are equally rich, wiggle if (manure-right = manure-ahead) and (manure-left = manure-ahead) [ wiggle ] ;; if patches ahead vary in richness, go to richest if (manure-right > manure-ahead) or (manure-left > manure-ahead) [ ifelse manure-right > manure-left [ rt 45 ] [ lt 45 ] ] end ;; move randomly ahead to wiggle right random 90 left random 90 end ;; move towards richest patch of grass ahead to uphill-energy let energy-ahead energy-scent-at-angle 0 let energy-right energy-scent-at-angle 45 let energy-left energy-scent-at-angle -45 ;; if all patches ahead are equally manured, wiggle if (energy-right = energy-ahead) and (energy-left = energy-ahead) [ wiggle ] ;; if patches ahead vary in richness of manure, go to richest if (energy-right > energy-ahead) or (energy-left > energy-ahead) [ ifelse energy-right > energy-left [ rt 45 ] [ lt 45 ] ] end ;; check out which patch ahead has the most manure (cribbed from ants) to-report nutrient-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report 0 ] report [manure] of p end ;; check out which patch ahead has the richest grass (cribbed from ants) to-report energy-scent-at-angle [angle] let p patch-right-and-ahead angle 1 if p = nobody [ report -5 ] report [energy] of p end

There is only one version of this model, created about 7 years ago by Sarah Robertson.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Grazing.png | preview | Preview for 'Grazing' | about 7 years ago, by Sarah Robertson | Download |

This model does not have any ancestors.

This model does not have any descendants.