Garden multi-row

Garden multi-row 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 5.3.1 • Viewed 359 times • Downloaded 22 times • Run 0 times
Download the 'Garden multi-row' 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

In this model, you have two types of plants you can grow in the same plot of land. For each, select how many you would like on the sliders ('Num-plants-1' and 'Num-plants-2'), as well as how far apart they should be spaced ('spacing-1' and 'spacing-2'). You can try out multiple layouts until you find one you are happy with.

When you're ready to start, press 'Start/Stop', and then the farmer will follow your mouse. Things will begin to grow in the garden, 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

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 dissapear.                                                                    ;;
;;   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 [plants1 plant1]
breed [plants2 plant2]
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 qualities.
  nutrients         ; determines the soil quality
  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 plants1) + (count plants2)) * 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
  ]
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-1"
    run "seed-2"
  ]
end 

to seed-1                           ; This procedure sets up all of the first variety of plant
  repeat (num-plants-1)
[
 ask farmers [
  (ask patch-here [
      if not any? plants1-here [    ; No two crops can grow in the same space
        sprout-plants1 1 [
          set shape "plant small"
          set size 0.3
          set color 55
          set energy 2
        ]]])
  fd (spacing-1)
  if not can-move? spacing-1 [
    set heading 0
    fd spacing-1
    set heading my-heading
    ifelse my-heading = 90 [set my-heading 270] [set my-heading 90]
  ]]]
end 

to seed-2                           ; This procedure sets up the second variety of plant
  setxy 0 4                         ; They start planting at coordinate (0, 4) in the field (top half)
  set heading 90
  set my-heading 270
  repeat (num-plants-2)
[
 ask farmers [
  (ask patch-here [
      if not any? plants2-here [
        sprout-plants2 1 [
          set shape "plant small2"  ; The shape, size, and color of plant2 are different from plant1
          set size 0.2
          set color 68
          set energy 2
        ]]])
  fd (spacing-2)
  if not can-move? spacing-2 [
    set heading 0
    fd spacing-2
    set heading my-heading
    ifelse my-heading = 90 [set my-heading 270] [set my-heading 90]
  ]]]
end 

to re-seed                         ; How you re-plant once the model is running
run "seed-1"
run "seed-2"
set money (money - ((count plants1) + (count plants2)) * plant-cost)
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 any? patches with [                                 ; Conditions that would enable weeds to grow
   not any? plants1-here and
   not any? plants2-here and
   nutrients > 5 and                                    ; Weeds are more likely to appear in spaces with high nutrient levels
   hydration > 2]
 [
   ask one-of patches with [                            ; The growth is random to one of those patches
     not any? plants1-here and
     not any? plants2-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
    ]


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

    ]
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 >)                                                             ;;
;;   How do the two types of plant grow differently from each other?                                         ;;
;;                                                                                                           ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to plants1-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 plants2-grow
  if (energy > 3) [set size size + 0.01]
  if (size > 0.7) [set shape "plant medium 2"]
  if (size > 1.4) [set shape "tomato plant"]
  if (size > 3) [set shape "flower2"]
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-1             ; 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 plants1-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 


;;  This breed of plant (2) is more drought resilient, so it needs less water to be able to survive.      ;;
;;        But, it also grows slower.                                                                      ;;
;;  Try to change some of its properties (numbers written in brown) to make it behave differently.        ;;
;;  What other plants could you try to program based on how they interact with water and the soil?        ;;

to plants2-eat
  if (nutrients >= 1 and (hydration >= -5  and hydration < 15))
  [
      set energy energy + 1
      set nutrients (nutrients - 0.2)
      set hydration (hydration - 0.2)
      ask neighbors4 [set nutrients (nutrients - 0.05)
        set hydration (hydration - 0.05)
        ask neighbors [set nutrients (nutrients - .02)
        set pcolor scale-color brown nutrients 10 0]
      set pcolor scale-color brown nutrients 10 0]]
  if (nutrients < 1  or hydration < 1)
  [
      set energy energy - 0.1]

  if (hydration > 20) [
    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? plants1-on neighbors [
 set energy energy + 5                             ; Bees get energy from being near plants
 ask plants1-on neighbors [set energy energy + 3]  ; Bees also give energy to the plants they visit
   ]
if any? plants2-on neighbors [
 set energy energy + 7
 ask plants2-on neighbors [set energy energy + 5]  ; Plant-2 gives the bees more energy
   ]
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 plants1-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 plants2-check-if-dead
  if (energy <= 0) [
    set nutrients (nutrients + 0.4)
    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 plants1 with                       ; Determining what counts as 'crop'
    [distance one-of farmers < (size / 2) and   ; Closeness to farmer
      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 ('let' does this)
      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 plants1 with [distance one-of farmers < (size / 2) and size > 3.5]
    if any? flowers [
      ask flowers [die]]
  ]



   ask farmers [                                ; Harvesting the second breed of plant
    set hidden? not mouse-inside?
    setxy mouse-xcor mouse-ycor
  ]
  if mouse-inside? and mouse-down? [
    let crop2 plants2 with
    [distance one-of farmers < (size / 2) and
      size < 3.5]
    if any? crop2 [
      let weight sum [size * 1.5] of crop2      ; This crop has a higher value when it is harvested
      set total-harvested (total-harvested +
        (ceiling (1.5 * weight * count crop2)))
ask crop2 [ die ]
    ]
    let flowers2 plants2 with [distance one-of farmers < (size / 2) and size > 3]
    if any? flowers2 [
      ask flowers2 [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 plants1 [
    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 multi-row.png preview Preview for 'Garden multi-row' over 5 years ago, by Becca Shareff Download

This model does not have any ancestors.

This model does not have any descendants.