⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ---precisionranching2.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 3 页
字号:
globals [systime meanforage meangrass meanforbs meanbrowse month TA PPT ]patches-own [cattle? bison? elk? deer? neighborhood forage grass forbs browse drygrass litter road? fence? paddock?]breeds [cattle bison elk deer]   turtles-own [cons-grass cons-forbs cons-browse cons-litter vforage             wt maxwt pgain gain RE ecg RCAP RFILL DMIMax MEM MEI]to setup ; clear plots, initialize vegetation, draw fencelines  set-current-plot "Animal performance" clear-plot  set-current-plot "Vegetation" clear-plot  set-current-plot "Paddocks" clear-plot  set systime 0   reset-timer  ca  ask patches ; each patch is 0.01 ha or 10 x 10 = 100 m2. Vegetation measured as kg/100m2          [          set cattle? false set bison? false set elk? false set deer? false          set neighborhood patches in-radius 10          if (random-float 10) < 8               [set grass (0.2 * Kgrass) set forbs (0.2 * Kforbs) set browse (0.2 * Kbrowse)               set forage (0.2 * (Kgrass + Kforbs + Kbrowse))]          ]  repeat 2 [grow-forage cgc]  ask patches [set fence? false set road? false fence]endto fence ; draw fencelines for two 8 ha paddocks or four 4 ha paddocks  if abs pxcor = screen-edge-x [set pcolor red set fence? true ]  if pycor = screen-edge-y or pycor = (- screen-edge-y) [set pcolor red set fence? true ]  if pycor > 0 and pxcor < 0 [set paddock? 1]   if pycor > 0 and pxcor > 0 [set paddock? 2]   if pycor < 0 and pxcor < 0 [set paddock? 3]   if pycor < 0 and pxcor > 0 [set paddock? 4]   ifelse mixed?    [if pxcor = 0 [set pcolor red set fence? true ]]    [If pxcor = 0 or pycor = 0 [set pcolor red set fence? true ]]endto go ; generate daily conditions (from monthly means) and simulate hourly (agents) and daily (patches) changes  set systime systime + 1  set month  1 + int (systime / 30)  ; Seasonal environment - ambient temperature and precipitation  if month = 1 [set TA  random-normal  15 2 set PPT 100] ; May  if month = 2 [set TA  random-normal  18 2 set PPT 100] ; Jun  if month = 3 [set TA  random-normal  20 2 set PPT 100] ; Jul  if month = 4 [set TA  random-normal  18 2 set PPT 100] ; Aug  if month = 5 [set TA  random-normal  10 2 set PPT 100] ; Sep  if month = 6 [set TA  random-normal   5 2 set PPT 100] ; Oct  if month = 7 [set TA  random-normal   0 2 set PPT 100] ; Nov  if month = 8 [set TA  random-normal -10 2 set PPT 100] ; Dec  if month = 9 [set TA  random-normal -15 2 set PPT 100] ; Jan  if month = 10 [set TA random-normal  -5 2 set PPT 100] ; Feb  if month = 11 [set TA random-normal   5 2 set PPT 100] ; Mar  if month = 12 [set TA random-normal  10 2 set PPT 100] ; Apr    grow-forage  diffuse grass 0.1  diffuse forbs 0.08  diffuse browse 0.04  cgc  if (systime = introdate and mixed? = true) [intro-cattle]     if systime = introdate [intro-bison intro-elk intro-deer stop]   if systime = introdate + rotation [rotate1 stop]  if systime = introdate + 2 * rotation [rotate2 stop]  if systime = introdate + 3 * rotation [stop]  if systime > introdate [ask turtles [bouts]] endto grow-forage  ask patches    [      if ((grass > 0) and (road? = false) and (fence? = false))         [set grass (grass + (0.15 * grass * ( 1 - ((grass + litter) / Kgrass ))))        set drygrass grass * 0.03         set grass grass - drygrass        set litter litter + drygrass - 0.02 * drygrass] ; litter pool increased by maturing green and decreased by weathering      if ((forbs > 0)and (road? = false))        [set forbs (forbs + (0.10 * forbs * ( 1 - (forbs / Kforbs ))))]      if ((browse > 0)and (road? = false))        [set browse (browse + (0.05 * browse * ( 1 - (browse / Kbrowse))))]      set forage (grass + forbs + browse + litter)    ]   ; We need rates of regeneration in relation to site4 characteristics, TA and PPT   ; We need rules of how different forage classes interact      set meangrass mean values-from patches [grass]   set meanforbs mean values-from patches [forbs]   set meanbrowse mean values-from patches [browse]   set meanforage (meangrass + meanforbs + meanbrowse)   cgcend            to cgc ; scale color according to relative forage density   ask patches   [   set pcolor scale-color green forage (1.2 * (Kgrass + Kforbs + Kbrowse)) 0   if road? = true [set pcolor blue set grass 0 set forbs 0 set browse 0]    if fence? = true [set pcolor red set grass 0 set forbs 0 set browse 0]  ]endto intro-cattle  create-custom-cattle cattle-num [setxy (random-float (screen-edge-x)) (random-float screen-size-y)]  ask cattle    [set color violet    set vforage 10              ; saturation coefficient Michaelis-Menton function    set maxwt 455               ; mature weight    set wt 400                  ; initial weight (kg)    set gain 0.001 set pgain 0.001    set RCAP 0.105 * wt ^ 1.046 ; Rumen capacity kg wet wt    set RFILL 0.5 * RCAP        ; Intial rumen fill at rumen capacity   ]    ask patches with [paddock? = 2 or paddock? = 4][set cattle? true]endto intro-bisonifelse mixed? = true  [create-custom-bison int (bison-num * 2 / 3) [setxy (random-float (- (screen-edge-x - 3))) (1 + random-float (screen-size-y - 3))] ask patches with [paddock? = 1 or paddock? = 3] [set bison? true]] ; all paddocks; [create-custom-bison bison-num [setxy (random-float (- screen-edge-x)) (random-float screen-edge-y)]] ; Paddock 1  [create-custom-bison bison-num [setxy (random-float (screen-edge-x - 3)) (random-float (screen-edge-y - 3))] ask patches with [paddock? = 2] [set bison? true]] ; Paddock 2; [create-custom-bison bison-num [setxy (random-float (- screen-edge-x)) (random-float (- screen-edge-y))]] ; Paddock 3 ; allocate bison to pastures with ungrazed control in lower right quadrant Paddock 4  ask bison    [set color black    set vforage 6    set maxwt 440    set wt 350    set gain 0.001 set pgain 0.001    set RCAP 0.105 * wt ^ 1.046   ; Rumen capacity kg wet wt    set RFILL 0.5 * RCAP          ; Intial rumen fill at rumen capacity   ]  endto intro-elk  ifelse mixed? = true    [create-custom-elk int (elk-num * 2 / 3) [setxy (random-float (- (screen-edge-x - 3))) (random-float (screen-size-y - 3))] ask patches with [paddock? = 1 or paddock? = 3] [set elk? true]] ; all paddocks;  create-custom-elk elk-num [setxy (random-float (- screen-edge-x)) (random-float screen-edge-y)] ; Paddock 1;  create-custom-elk elk-num [setxy (random-float screen-edge-x) (random-float screen-edge-y) ] ; Paddock 2    [create-custom-elk elk-num [setxy (random-float (- (screen-edge-x - 3))) (random-float (- (screen-edge-y - 3))) ask patches with [paddock? = 3] [set elk? true]] ; Paddock 3     create-custom-elk elk-num [setxy (random-float (  screen-edge-x - 3)) (random-float (- (screen-edge-y - 3))) ask patches with [paddock? = 4] [set bison? true]]] ; Paddock 4  ask elk    [set color yellow    set vforage 5    set maxwt 320    set wt 250    set gain 0.001 set pgain 0.001    set RCAP 0.105 * wt ^ 1.046   ; Rumen capacity kg wet wt    set RFILL 0.5 * RCAP          ; Intial rumen fill at rumen capacity   ]endto intro-deer  ifelse mixed? = true  [create-custom-deer int (deer-num * 2 / 3) [setxy (random-float (- (screen-edge-x - 3))) (random-float (screen-size-y - 3))] ask patches with [paddock? = 1 or paddock? = 3] [set deer? true]] ; all paddocks  [create-custom-deer deer-num [setxy (random-float (- (screen-edge-x - 3))) (random-float (screen-edge-y - 3))] ask patches with [paddock? = 1] [set deer? true]] ; Paddock 1; create-custom-deer deer-num [setxy (random-float (  screen-edge-x)) (random-float screen-edge-x) ] ; Paddock 2; create-custom-deer deer-num [setxy (random-float (- screen-edge-x)) (random-float (- screen-edge-y))] ; Paddock 3; create-custom-deer deer-num [setxy (random-float (  screen-edge-x)) (random-float (- screen-edge-y))] ; Paddock 4  ask deer    [set color red    set vforage 4    set wt 55 set maxwt 73    set gain 0.0001 set pgain 0.0001    set RCAP 0.105 * wt ^ 1.046   ; Rumen capacity kg    set RFILL 0.5 * RCAP          ; Intial rumen fill at rumen capacity   ]endto graph-it  set-current-plot "Vegetation"    set-current-plot-pen "grass"  plot mean values-from patches [grass]    set-current-plot-pen "forbs"  plot mean values-from patches [forbs]     set-current-plot-pen "browse" plot mean values-from patches [browse]    set-current-plot-pen "litter" plot mean values-from patches [litter]      set-current-plot "Paddocks"    set-current-plot-pen "paddock1"  plot mean values-from patches with [paddock? = 1] [forage]    set-current-plot-pen "paddock2"  plot mean values-from patches with [paddock? = 2] [forage]    set-current-plot-pen "paddock3"  plot mean values-from patches with [paddock? = 3] [forage]    set-current-plot-pen "paddock4"  plot mean values-from patches with [paddock? = 4] [forage]      if (systime > 30 and count turtles > 0)  [     set-current-plot "Animal performance"    if (count bison > 0)  [set-current-plot-pen "bison"  plot mean values-from bison [wt]]    if (count elk > 0)    [set-current-plot-pen "elk"    plot mean values-from elk   [wt]]    if (count deer > 0)   [set-current-plot-pen "deer"   plot mean values-from deer  [wt]]    if (count cattle > 0) [set-current-plot-pen "cattle" plot mean values-from cattle [wt]]   ]endto bouts                                repeat 24 ; hourly bouts of consumption, expenditure, movement  [    ask bison  [if count bison > 0  [bison-life]]    ask elk    [if count elk > 0    [elk-life]]    ask deer   [if count deer > 0   [deer-life]]    ask cattle [if count cattle > 0 [cattle-life]]  ]endto cattle-life   set cons-grass 0 set cons-litter 0 set cons-forbs 0 set cons-browse 0   if (RFILL < 0.8 * RCAP) or gain < pgain  [   set DMIMax .006 * wt * max (list 1 min (list 1.6 (pgain / gain)))  set cons-grass max (list 0 (DMIMax * grass /(grass + vforage))) ; hourly grass consumption  set grass max (list 0 (grass - cons-grass))   set cons-litter max (list 0 (DMIMax * litter /(litter + vforage))) ; hourly grass consumption  set litter max (list 0 (litter - cons-litter))   set RFILL RFILL + cons-grass + cons-litter + cons-forbs + cons-browse - 0.01 * RFILL ; Filled by consump, emptied by rate of digestion and passage  ]  set MEI (cons-grass + cons-litter + cons-forbs + cons-browse) * 10 ; Intake MJ/h  set MEM (0.550 / 24 * wt ^ 0.75) ; Expenditure MJ/day  set ecg 16 * (wt / maxwt) ^ 0.37   ; energy content of gain MJ/kg  set pgain 0.06 - 0.06 * wt / maxwt ; Potential gain  set gain (MEI - MEM) / ecg  ; gain as retained energy/energy content of gain  set wt min (list maxwt (wt + gain)) set wt max (list wt (maxwt / 3))   if (RFILL < 0.8 * RCAP) [cattle-move] endto cattle-move  locals [empty-neighbors competitors leader]  set leader (value-from (min-one-of cattle [who])[who])  ifelse who = leader    [     set competitors turtles-from neighborhood [bison-here]     set empty-neighbors neighbors with [not any? competitors]     if any? empty-neighbors [set heading towards-nowrap max-one-of patches with [cattle?] [forage]]    ]    [ifelse (random 10 < gregarious + 4)       [set heading towards turtle leader]         ; follow leader        [set heading uphill grass + litter]         ; wander for local forage    ]  bounce  ifelse (RFILL > 0.8 * RCAP or forage > meanforage)      [fd random-float 0.1]      [fd random-float 0.3]endto bison-life  set cons-grass 0 set cons-litter 0 set cons-forbs 0 set cons-browse 0   if (RFILL < 0.8 * RCAP) or gain < pgain  [   set DMIMax .006 * wt * max (list 1.6 (pgain / gain))  set cons-grass max (list 0 (DMIMax * grass /(grass + vforage))) ; hourly grass consumption  set grass max (list 0 (grass - cons-grass))   set cons-litter max (list 0 (DMIMax * litter /(litter + vforage))) ; hourly grass consumption  set litter max (list 0 (litter - cons-litter))   set RFILL RFILL + cons-grass + cons-litter + cons-forbs + cons-browse - 0.01 * RFILL ; Filled by consump, emptied by rate of digestion and passage  ]  set MEI (cons-grass + cons-litter + cons-forbs + cons-browse) * 10 ; Intake MJ/h  set MEM (0.550 / 24 * wt ^ 0.75) ; Expenditure MJ/day  set ecg 16 * (wt / maxwt) ^ 0.37   ; energy content of gain MJ/kg  set pgain 0.06 - 0.06 * wt / maxwt ; Potential gain   set gain (MEI - MEM) / ecg  ; gain as retained energy/energy content of gain  set wt min (list maxwt (wt + gain)) set wt max (list wt (maxwt / 3))   if (RFILL < 0.8 * RCAP) [bison-move] endto bison-move ; assume bison follow leaders or search for graminoids locally  locals [empty-neighbors competitors leader]  set leader (value-from (min-one-of bison [who])[who])  ifelse who = leader    [     set competitors turtles-from neighborhood [cattle-here]     set empty-neighbors neighbors with [not any? competitors]     if any? empty-neighbors         [set heading towards-nowrap max-one-of patches with [bison?][forage]]    ]    [ifelse (random 10 < gregarious + 3)       [set heading towards turtle leader ]       ; follow leader        [set heading uphill grass + litter ]       ; wander for local forage    ]  bounce  ifelse (RFILL > 0.8 * RCAP or count bison in-radius 3 > 1 or forage > meanforage)      [fd random-float 0.1]      [fd random-float 0.2]endto elk-life  set cons-grass 0 set cons-litter 0 set cons-forbs 0 set cons-browse 0   if (RFILL < 0.8 * RCAP) or gain < pgain  [   set DMImax .006 * wt * max (list 1.6 (pgain / gain))  set cons-grass max (list 0 (DMIMax * grass / (grass + vforage)))  set cons-forbs max (list 0 ((DMIMax - cons-grass) * forbs / (forbs + vforage)))  set cons-browse max (list 0 ((DMIMax - cons-grass - cons-forbs) * browse / (browse + vforage)))  set grass max (list 0 (grass - cons-grass))   set forbs max (list 0 (forbs - cons-forbs))   set browse max (list 0 (browse - cons-browse))  set RFILL RFILL + cons-grass + cons-forbs + cons-browse - 0.05 * RFILL ; Filled by consump, emptied by digestion & passage  ]  set MEI (cons-grass + cons-litter + cons-forbs + cons-browse) * 10 ; Intake MJ/h  set MEM (0.550 / 24 * wt ^ 0.75) ; Expenditure MJ/day  set ecg 16 * (wt / maxwt) ^ 0.37   ; energy content of gain MJ/kg  set pgain 0.06 - 0.06 * wt / maxwt ; Potential gain  set gain (MEI - MEM) / ecg  ; gain as retained energy/energy content of gain  set wt min (list maxwt (wt + gain)) set wt max (list wt (maxwt / 3))   if (RFILL < 0.8 * RCAP) [elk-move] endto elk-move  ; assume elk either compromise local optimization of foraging and being with a dominant 'leader'. Other options are to follow most hungry, nervous, etc.locals [empty-neighbors competitors leader]  set leader (value-from (min-one-of elk [who])[who])  ifelse who = leader    [     set competitors turtles-from neighborhood [bison-here]     set empty-neighbors neighbors with [not any? competitors]     if any? empty-neighbors         [set heading towards-nowrap max-one-of patches with [elk?][grass + forbs + browse]]    ]    [ifelse (random 10 < gregarious + 2)                 ; elk considered moderately gregarious but can be increased by slider       [set heading towards turtle leader ]              ; follow leader        [set heading uphill grass + forbs + browse]       ; wander for local forage    ]  bounce ; animals bounce off fences  ifelse (RFILL > 0.8 * RCAP or count elk in-radius 3 > 1 or forage > meanforage)      [fd random-float 0.2]      [fd random-float 0.4]endto deer-life  set cons-grass 0 set cons-litter 0 set cons-forbs 0 set cons-browse 0  if (RFILL < 0.8 * RCAP) or gain < pgain  [   set DMIMax .006 * wt * max (list 1.6 (pgain / gain))  set cons-forbs max (list 0 (DMIMax * forbs / (forbs + vforage)))  set cons-browse max (list 0 ((DMIMax - cons-forbs) * browse / (browse + vforage)))  set cons-grass max (list 0 ((DMIMax - cons-forbs - cons-browse) * grass / (grass + vforage)))  set grass max (list 0 (grass - cons-grass))   set forbs max (list 0 (forbs - cons-forbs))   set browse max (list 0 (browse - cons-browse))  set RFILL RFILL + cons-grass + cons-forbs + cons-browse - 0.08 * RFILL ; Filled by consump, emptied by rate of digestion and passage  ]  set MEI (cons-grass + cons-forbs + cons-browse) * 10 ; Intake MJ/h  set MEM (0.550 / 24 * wt ^ 0.75) ; Expenditure MJ/day  set ecg 14 * (wt / maxwt) ^ 0.37   ; energy content of gain MJ/kg  set pgain 0.03 - 0.03 * wt / maxwt ; Potential gain  set gain (MEI - MEM) / ecg  ; gain as retained energy/energy content of gain  set wt min (list maxwt (wt + gain)) set wt max (list wt (maxwt / 3))   if (RFILL < 0.8 * RCAP) [deer-move] endto deer-move ; assume that deer either join any other deer or move to local abundances of forbs and browse ifelse (random-float 10 < gregarious)    [set heading towards max-one-of patches [count deer-here]]    [set heading uphill forbs + browse]    bounce  ifelse (RFILL > 0.8 * RCAP or count elk in-radius 3 < 1 or count deer in-radius 3 > 0 or forage > meanforage)    [fd random-float 0.2]    [fd random-float 0.4]endto patch-draw        ; draw water bodies, roads or other generally uninhabitable feature  if mouse-down?     ; reports true or false to indicate whether mouse button is down    [      ask patch-at mouse-xcor mouse-ycor        [ set pcolor blue set road? true set forage 0 set grass 0 set forbs 0]    ]endto bounce            ; respect fences  if (abs pxcor-of patch-ahead 2 = screen-edge-x) [ set heading (- heading) ]  if (abs pycor-of patch-ahead 2 = screen-edge-y) [ set heading (180 - heading) ]    if (road?-of patch-ahead 2 = true) [set heading (180 - heading)]    if (abs pxcor-of patch-ahead 2 = 0) [ set heading (- heading) ]  if mixed? = false and (abs pycor-of patch-ahead 1 = 0) [ set heading (180 - heading) ]    if (pcolor-of patch-ahead 1 = red) or (pcolor-of patch-ahead 2 = red) [set heading (- heading)]end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -