Garden 2.0

Garden 2.0 preview image

1 collaborator

Default-person Becca Shareff (Author)

Tags

agriculture 

Tagged by Becca Shareff over 5 years ago

biology 

Tagged by Becca Shareff over 5 years ago

complex systems 

Tagged by Becca Shareff over 5 years ago

ecology 

Tagged by Becca Shareff over 5 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.2 • Viewed 450 times • Downloaded 22 times • Run 0 times
Download the 'Garden 2.0' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This view of a garden bed shows what happens when a farmer tries to plant and grow a variety of crops. Balance to the ecosystem involves careful planning and regular intervention from the farmer, so that the garden doesn't get overrun by weeds, develop fungus, or deplete the soil nutrients.

HOW IT WORKS

You act as the farmer, and can select how many seeds to plant, how far apart they should be spaced, and what additives you'd like to put into the soil. You can also harvest your plants, sell them, and seed again.

HOW TO USE IT

Set the slider buttons on the top of the screen to the value that you'd like, then press 'Setup'. When you're ready to start, press 'Start/Stop', and then the farmer will follow your mouse. Hold down the mouse button to harvest a plant. You can click the interface buttons (light purple) at any time while the model is running, or press 'Start/Stop' again to pause it.

THINGS TO NOTICE

The graphs will constantly update based on what is happening in the model. Watch to see how they change directly after pressing a button like "Apply Compost", "Apply herbicide", or "Water Garden".

What happens to the color of the soil as you let the model run?

THINGS TO TRY

Toggle on the drought mode or flood mode and see how the model behaves differently.

You can approach the model with many goals in mind:

  • Make the most money
  • Grow organically
  • Support pollinator populations
  • Strategize for the effects of climate change

EXTENDING THE MODEL

Try changing the rules related to the plant varieties so that they are more or less drought tolerant. (For example, the level of hydration the soil must have for them to eat, the amount of energy they get from eating)

Currently the only way to add nutrients to the soil is to either make a purchase by Aplying compost, or to let plants die and recycle themselves. Can you create another animal in the ecosystem that might add nutrients to the soil, given certain conditions?

You can also change the shape and appearance of the plants and weeds. Can you design a crop you know? How would it behave? What does it add or take away from the soil? What are the stages of its growth? What does it look like from seed to fruit to flower?

RELATED MODELS

Garden Ecosystem (MultiRow)

CREDITS AND REFERENCES

Developed by Rebecca Shareff, UC Berkeley (2019) https://ocf.berkeley.edu/~beccashareff

Michelle Wilkerson and Dor Abrahamson supported the development of this model.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;                                             OVERVIEW OF TERMS                                             ;;
;;                                                                                                           ;;
;;   In this model, the 'breeds' or AGENTS are the things you see within the garden interface that can move, ;;
;;     change size, appear, or disappear.                                                                    ;;
;;   The breeds are collectively called TURTLES, and most of them are living things.                         ;;
;;   The code tells you what to call them in plural or singular terms.                                       ;;
;;   PATCHES are the background squares of the model, in this case, they represent the soil of the garden.   ;;
;;   GLOBALS are variables in the model that are determined by buttons or actions on the interface.          ;;
;;                                                                                                           ;;
;;   Together these three items (TURTLES, PATCHES, GLOBALS) make up all that is defined by the model.        ;;
;;   Everything else in the code defines the PROCEDURES that define the rules of the model                   ;;
;;   PROCEDURES come after the word "to" and are followed by "end"                                           ;;
;;   Some procedures might be defined on the interface page (inside a button) as opposed to the code         ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

breed [farmers farmer]
breed [plants plant]
breed [weeds weed]
breed [drops drop]
breed [fungi fungus]
breed [bees bee]

turtles-own [
  energy            ; the life force of the creatures
  my-heading        ; which direction it is facing
  ]


patches-own [       ; Each patch of soil has these three qualities.
  nutrients         ; determines the soil quality
  fertile           ; determines whether a seed can be sprouted there, connected to spacing.
  hydration         ; how much water is in the soil
  ]

globals [
total-harvested     ; The total pounds of produce harvested by the farmer
money               ; Starts off as your initial budget, and is updated based on the actions you take as the farmer.
crop                ; When plants are harvested, they are then called crop.
pesticide-ppm       ; Pesticide ppm = parts per million. This number increases when you add herbicide
]

to setup            ; The actions that happen when you press the setup button
  clear-all
  setup-patches
  setup-turtles
  make-farmer
  reset-ticks
  set money (budget - (count plants * plant-cost))
end 

to setup-patches
  ask patches [
   set nutrients (random 15)       ; Each patch has a random amount of nutrients between 1 and 15 at first
   set hydration (random 10)]      ; Each patch has a random amount of hydration between 1 and 10 at first
  repeat 5 [diffuse nutrients 1]   ; The diffuse command 'smoothes out' the random numbers, so that a patch with 15 isn't next to a patch with 1
  repeat 2 [diffuse hydration 1]
  ask patches [
   set pcolor scale-color brown nutrients  10 0   ; How dark or light brown the patches are relates to the level of nutrients
   if remainder pxcor spacing = 0 and remainder pycor spacing = 0 [set fertile true ]]  ; The patches where crops grow depends on the spacing
end 

to setup-turtles
  create-weeds 0
  create-drops 0
  create-fungi 0
  create-bees 0
end 

to make-farmer
  create-farmers 1 [
    set color cyan                 ; Change colors using the color swatch (see 'tips and tricks' sheet)
    set size 3                     ; Change size
    set shape "farmer"             ; You can find more possible shapes online (http://ccl.northwestern.edu/netlogo/docs/shapes.html)
    setxy 0 0
    set heading 90
    set my-heading 270
    run "seed"
  ]
end 

to seed                            ; This procedure is how all of the crops get set up
  repeat (number-plants)
[
 ask farmers [
  (ask patch-here [
      if fertile = true and not any? plants-here [  ; No two crops can grow in the same space
        sprout-plants 1 [
          set shape "plant small"
          set size 0.2
          set color 53
          set energy 2
        ]]])
  fd (spacing)
  if not can-move? 1 [
    set heading 0
    fd spacing
    set heading my-heading
    ifelse my-heading = 90 [set my-heading 270] [set my-heading 90]

  ]]

]
end 

to re-seed                        ; Basically the same as seeding
  repeat (number-plants * spacing)
[
  ask farmers [fd spacing
  (ask patch-here [
      if fertile = true and not any? plants-here [
        sprout-plants 1 [
          set shape "plant small"
          set size 0.2
          set energy 2
        ]]])
  if not can-move? 1 [
    set heading 0
    fd spacing
    set heading my-heading
    ifelse my-heading = 90 [set my-heading 270] [set my-heading 90]

  ]]]
end 

to go
      animate                   ; The main sequence of procedures for the garden to grow
      harvest-plants            ; This + harvest-weeds define actions you take with the mouse
      harvest-weeds
       tick
end 

to animate                                                     ; Happens every 'tick' while the model is running
 if drought [ask patches [set hydration (hydration - 0.1)]]    ; This will happen constantly in drought mode
 if flood [ask patches [set hydration (hydration + 0.2)]]      ; This will happen constantly in flood mode
 ask turtles [                                                 ; All turtles run through these procedures
   run word breed "-grow"
   run word breed "-check-if-dead"
   run word breed "-eat" ]

if count (patches with [any? plants-here with [size > 3.5]]) > 6    ; Conditions that determine if bees show up
 [ ask one-of patches with [any? plants-here with [size > 3.5]]     ; Can you find out what is significant about this size number?
   [sprout-bees 1
     [set shape "bee 2"
       set color 4
       set energy 5
       set size 1]
   ]]


 if any? patches with [                                      ; Conditions that would enable weeds to grow
   not any? plants-here and nutrients > 5 and hydration > 2] ; Weeds are more likely to appear in spaces with high nutrient levels
 [
   ask one-of patches with [                                 ; The growth is random to one of those patches
     not any? plants-here and nutrients > 5 and hydration > 2]
   [
    sprout-weeds 1
    [
      set breed weeds
      set shape "flower budding"
      set color lime
      set energy 1
      set size 0.03

    ]]]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;               The following lines indicate how the particular agents in the model GROW.                   ;;
;;                                                                                                           ;;
;;   Note that some agents don't grow at all.                                                                ;;
;;   You can try changing the RATE that agents grow by increasing or decreasing the number following         ;;
;;     the "set size +/-" command                                                                            ;;
;;   You can also try changing the CONDITIONS that determine when an agent grows by changing the numbers     ;;
;;     before or after the inequalities (< or >)                                                             ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to plants-grow
  if (energy > 3) [set size size + 0.02]
  if (size > 0.8) [set shape "plant medium"]
  if (size > 1.6) [set shape "plant"]
  if (size > 3.5) [set shape "flower 1"]
end 

to weeds-grow;;
    if (energy > 2) [set size size + 0.04] ; How do these numbers compare to the conditions for plant growth?
end 

to farmers-grow
end 

to drops-grow
end 

to fungi-grow
if (hydration > 7) [set size size + 0.01]
if (hydration < 7) [set size size - 0.2]
end 

to bees-grow            ; Bees don't actually grow in size in the model, so this shows how they look for food.
rt random 50             ; rt = "right turn", and a random number between 1 and 50
lt random 50             ; lt = "left turn". This positions the bees in a random direction before they move.
fd spacing               ; You could change this to any number.
set energy energy - 2.5  ; How much energy they lose each time they fly
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;               The following lines indicate how the particular agents in the model EAT.                    ;;
;;  Note that some agents don't have code to eat because it isn't necessary to their function in the model.  ;;
;;  How do the agents interact differently with nutrients and hydration of the soil?                         ;;
;;  What impacts the gain or loss of energy?                                                                 ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to plants-eat
  if (nutrients >= 1 and (hydration >= 1  and hydration < 10)) ; Conditions that let the plant eat
  [
      set energy energy + 1
      set nutrients (nutrients - 0.2)
      set hydration (hydration - 0.2)
      ask neighbors4 [set nutrients (nutrients - 0.05)         ; "neighbors4" are the four patches with sides directly next to the patch
        set hydration (hydration - 0.05)                       ; How does the impact on the neighbor patches differ from the main patch?
        ask neighbors [set nutrients (nutrients - .02)         ; "neighbors" are the 8 patches adjacent/ in a circle around the patch
        set pcolor scale-color brown nutrients 10 0]           ; The color of the patches updates based on their new nutrient level
      set pcolor scale-color brown nutrients 10 0]]

  if (nutrients < 1  or hydration < 1)                         ; Conditions where the plant is unable to eat
  [
      set energy energy - 0.1]                                 ; If no nutrients in the soil, this rate is how fast they will die

  if (hydration > 12) [                                        ; Conditions that lead to fungus also impact soil quality
    set nutrients (nutrients - 2)
 ask neighbors4
 [set nutrients (nutrients - .8)]
 ask neighbors4 [
    sprout-fungi 1
  [
  set shape "mushroom"
   set color white
   set size 0.3]]]
end 

to weeds-eat
  if (nutrients >= 1) [                                      ; Do weeds have more or less restrictive conditions than other plants?
  set energy energy + 1
  set nutrients (nutrients - 0.1)                            ; How do weeds affect the soil quality, compared to other plants?
   set hydration (hydration - 0.1)
  ask neighbors4 [
     set hydration (hydration - 0.05)
    set nutrients (nutrients - 0.08)
    set pcolor scale-color brown nutrients 10 0]
  set pcolor scale-color brown nutrients 10 0]

  if (nutrients < 1) [                                       ; Conditions where the weed is unable to eat
  set energy energy - 0.1]
end 

to farmers-eat
end 

to drops-eat
end 

to fungi-eat
    set nutrients (nutrients - 0.1)
    set pcolor scale-color brown nutrients 10 0
end 

to bees-eat                                                 ; How could you change this procedure to better represent pollination?
if any? plants-on neighbors [
   set energy energy + 5                                    ; Bees get energy from being near plants
   ask plants-on neighbors [set energy energy + 3]          ; Bees also give energy to the flowers they visit
     ]
end 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;               The following lines indicate how the particular agents in the model DIE.                    ;;
;;             Note that some agents don't have code to die because they are always in the model.            ;;
;;                                                                                                           ;;                                                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to plants-check-if-dead
  if (energy <= 0) [
    set nutrients (nutrients + 0.5)    ; Plants add nutrients to the soil when they die
    set pcolor scale-color brown nutrients 10 0
    die
    ]
end 

to weeds-check-if-dead
  if (energy <= 0) [ die ]            ; Weeds don't produce compost when they die
end 

to farmers-check-if-dead
end 

to drops-check-if-dead                ; Even though water isn't technically living, this removes them from the model
  set size size - 0.2
  die
end 

to fungi-check-if-dead
if (hydration < 5) [die]
end 

to bees-check-if-dead
  if (energy <= 0) [die]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;            The code below describes how you can harvest plants and weeds from the model                   ;;
;;                                                                                                           ;;
;;   Some things can be harvested, but don't count towards your 'total harvested' button.                    ;;
;;   Do you think this is fair? Which things should or should not be able to be sold for money?              ;;
;;   What else would you want to harvest? What else would you want to do with crops or weeds you pull up?    ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to harvest-plants
  ask farmers [
    set hidden? not mouse-inside?
    setxy mouse-xcor mouse-ycor              ; Farmer follows your mouse
  ]
  if mouse-inside? and mouse-down?           ; Mouse-down means you are clicking/ holding click button
  [
    set crop plants with [                   ; Determining what counts as 'crop'
      distance one-of farmers < (size / 2)   ; Closeness to farmer
      and size < 3.5]                        ; Size restrictions
    if any? crop [
      let weight sum [size] of crop          ; 'Weight' is a new global being defined here in this sequence
      set total-harvested (                  ; It uses the size of the plant to determine how to increase your total harvest amount
        total-harvested +
        (ceiling (1.5 * weight * count crop  ; 'Ceiling' rounds up to the nearest whole number
            )))
ask crop [ die ]
    ]

    let flowers plants with [
      distance one-of farmers < (size / 2) and size > 3.5]
    if any? flowers [
      ask flowers [die]]
  ]
end 

to harvest-weeds
  ask farmers [
    set hidden? not mouse-inside?
    setxy mouse-xcor mouse-ycor
  ]
  if mouse-inside? and mouse-down? [
    let weedable weeds with [distance one-of farmers < (size * 2)]
    if any? weedable [

ask weedable [ die ]
    ]
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                                                           ;;
;;             The code below describes the procedures for adding inputs to your garden                      ;;
;;                                                                                                           ;;
;;   Currently it contains compost, water, and herbicide (fungicide is defined inside the button             ;;
;;       on the interface.)                                                                                   ;;
;;   Do you think the way they function is realistic? What else should adding these things do?               ;;
;;   Is there anything else you would want to add to the garden? What about where these things get added?    ;;
;;   Currently these inputs all cost money. Do the prices seem realistic? Should they ever change?           ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to add-compost
  ask patches [                                   ; All patches get compost
    set nutrients (nutrients + 5)
    set pcolor scale-color brown nutrients 10 0   ; The color updates after based on new nutrient level
    ]
set money (money - 20)
end 

to add-water
if not drought [                                 ; This procedure won't run during drought mode
ask patches [ set hydration (hydration + 5)
  sprout-drops 1
  [ set breed drops
    set shape "drop"
    set color sky
    set size 0.6]
    set pcolor scale-color blue hydration 10 0]  ; The color updates to show you the new hydration level
set money (money - 20)]
end 

to add-herbicide
  ask weeds [die]
  ask plants [
    set energy energy - 2]
  ask patches [set nutrients (nutrients - 2)
    set pcolor scale-color brown nutrients 10 0 ]
set money (money - 30)
set pesticide-ppm (pesticide-ppm + 1)           ; This keeps track of how many times you apply chemicals
end 

There is only one version of this model, created over 5 years ago by Becca Shareff.

Attached files

File Type Description Last updated
Garden 2.0.png preview Preview for 'Garden 2.0' over 5 years ago, by Becca Shareff Download

This model does not have any ancestors.

This model does not have any descendants.