Let'sGoLocal

No preview image

1 collaborator

Default-person Tanya Flores (Author)

Tags

(This model has yet to be categorized with any tags)
Model group Stanford-BBA-Spr10 | Visible to everyone | Changeable by the author
Model was written in NetLogo 4.1 • Viewed 228 times • Downloaded 17 times • Run 5 times
Download the 'Let'sGoLocal' 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 section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

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

Click to Run Model

globals [ 
  farmers-x    ;;x-coordinate for the top of the farmersmarket
  farmers-y    ;;y-coordinate for the top of the farmersmarket
  supermarket-x    ;;x-coordinate for the top of the supermarket
  supermarket-y    ;;y-coordinate for the top of the supermarket
  percent-locavore
  number-trucks
  overall-emission
  overall-emission-counter
  number-laborers
  overall-economy
  overall-health-risk
]
breed [supermarkets supermarket]
breed [farmersmarkets farmersmarket]
breed [shoppers shopper]
breed [trucks truck]
breed [labors labor]
shoppers-own [
  locavore?     
  health-risk
  locavore-length
  identity
  at-store?
]
;;
;;SETUP Procedure
;;
;;This procedure sets up the world with all the characters and default variable values.
;;half of the population of shoppers starts at the top-left corner while the other half starts
;;at the bottom right corner. This is arbitrary, but helps control the characters and easier to see
;;them if they are not directly on top of one another. 

to setup
  clear-all
  reset-ticks 
  set-default-shape shoppers "person service"
  set-default-shape supermarkets "building store"
  set-default-shape farmersmarkets "house ranch"
  set-default-shape trucks "truck"
  set-default-shape labors "person farmer"
  
  set percent-locavore  (locavore-propensity / 100)   ;;percent of the population that will be locavore at the end of the time period
  set number-trucks floor (population * .05)         ;;there is a new truck (shipment of food to the supermarket) for every 5% of the population non-locavore
  set overall-emission (number-trucks * 5845)        ;;every truck averages 5845 tons of CO2 emissions. because the world starts with everyone non-locavore this is default. 
  set number-laborers 1    ;;we will assume the farmer is running the show on his own
  set overall-economy 1    ;;because there are no new employees the economy is at 1
  
  create-shoppers (population / 2)
    [setxy -16 14
    set size 1.5
    set color 37
    set heading 135
    set health-risk .20   ;;The average american has a 20% risk of hypertension (high-blood pressure)
    set at-store? false
    set locavore? false
    set locavore? (who < population * .0125)     ;;On average only 1.25% of the population is locavore
    if locavore? [
      set color green]]
  create-shoppers (population / 2) 
    [setxy 16 -14
    set size 1.5
    set color 37
    set heading 315
    set health-risk .20    ;;The average american has a 20% risk of hypertension (high-blood pressure)
    set at-store? false
    set locavore? false
    set locavore? (who < population * .0125)     ;;On average only 1.25% of the population is locavore
    if locavore? [
      set color green]]
  
  create-world
end 
;;Helper function that creates some of the additional characters in the world. 

to create-world
  set farmers-x -12
  set farmers-y -8
  set supermarket-x 8
  set supermarket-y 10
  
  ask patches 
    [set  pcolor (green + 1)
    
    if (pxcor < farmers-y) and (pycor < farmers-x) 
      [set pcolor green]
    if (pxcor > supermarket-x) and (pycor > supermarket-y)
      [set pcolor blue]] 
  
  create-supermarkets 1 
    [setxy 13 13
    set color 4  
    set size 6]
  
  create-farmersmarkets 1 
    [setxy -13 -14
    set color 104
    set size 5] 
  
  create-trucks number-trucks
   [setxy 9 (floor ((random-float 1) * 4) + 12)    ;;random number between 8 and 16     ;;random number between 9 and 14
     set color white
     set size 2
     set heading 315]
end 

;;
;; GO Procedure
;;
;;This is starts the moving behaviors and at every click calculates and stores information
;;about the individual shoppers as well as the entire community. The model is only intended to 
;;last 100 ticks. This is done so that the user gets a realistic idea of how a community could
;;benefit from locally grown foods within a given time period. 

to go
  tick
  if all? shoppers [locavore?]
    [stop]
  
  if ticks >= 100     
    [stop]
  
  ask shoppers 
    [start-moving  
    stop-for-food
    choose-lifestyle
    calculate-health-risk]        
  
  ask trucks
     [trucks-moving
      calculate-environment-impact]  
 calculate-economy   
 total-health-risk 
 ;update-plot-locavore
 update-plot-healthrisk
 update-plot-environment
 update-plot-economy
end  
;This procedure moves the shoppers and relocates them to the road once they are done shopping. 

to start-moving
  if not can-move? 1 [right 180]
  if who >= random population [stop]   ;; delay some of the shoppers from heading out
  if at-store? 
    [ifelse random-float 100 < 50      ;;50% of the shoppers will return to the top-left corner of the world after shopping
      [setxy 16 -14                      
        set at-store? false ]
      [setxy -14 16                   ;;50% of the shoppers will start from the bottom-right corner of the world after shopping
        set at-store? false]]
  forward random 2
end 

;;This procedure is similar to the start-moving, but it is for the trucks. They are confined to a small space near the 
;;grocery store and only move up and down. 

to trucks-moving
  ifelse ycor > 14 and ycor > 16
      [forward random 2]
      [right 180
        forward random 2]
end 
;;This procedure checks if the shopper is currently at a store (based on its location in the world
;;If it at a store the procedure will stop; if it is not at the store this is where the shopper will decide
;;based on his lifestyle choice whether to go to the farmer's market or to the supermarket

to stop-for-food
  let sx  floor ((random-float 1) * 8) + 9    ;;random number between 8 and 16 - possible x-cors for the supermarket
  let sy  floor ((random-float 1) * 6) + 11   ;;random number between 10 and 16 - possible y-cors for the supermarket 
  let fx  floor ((random-float -1) * 8) - 8   ;;random number between -8 and -16 - possible x-cors for the farmer's market
  let fy  floor ((random-float -1) * 4) - 12   ;;random number between -12 and -16 - possible y-cors for the farmer's market
    
    ifelse at-store? 
    [stop]
    [ifelse locavore?                   
      [if random-float 100 < 10       ;;10% of the locavores will go to the farmers market at every click 
        [setxy fx fy
        set at-store? true]]
      [if random-float 100 < 2         ;;2% of the non-locavores will go to the supermarket at every click
        [setxy  sx sy
          set at-store? true]]]
end 

;;Currently only 1.25% of the population are locavores. It is estimated that this number is growing
;;at about 2% per year. For the sake of this model, every 100 tick marks will represent one year. Based
;;on the locavore-propensity the user sets, we can see increase the number of localvores linearly over
;;that one year.  

to choose-lifestyle
  let x count shoppers with [locavore?]
  
  if x < percent-locavore * population   
    [if remainder ticks 10 = 0 
      [if random-float 100 < (percent-locavore * population / 10) and not at-store? 
        [set locavore? true
        set locavore-length locavore-length + 1]]
        if locavore?
        [set color green]]
end 

;;Health risks are associated with consumption of processed foods. Appel (1997) clinical-trial 
;;results showed that adopting a diet consisting of locally-grown foods  reduces the risk of high blood 
;;pressure reduces by 55%. In America, the average risk of high blood pressure
;;is 20%. For locavores the risk of high blood pressure is estimated at 10%. For this project we have initated
;;the shoppers individual health risk at 20%. Shoppers who continue eat non-local foods will continue to 
;;increase their health-risk at a modest 2% increase (consistent with American Heart Association estimates for
;;average Americans)

to calculate-health-risk
  if health-risk >= 1 [stop]
  ifelse locavore? 
   [set health-risk health-risk * .55]  
   [set health-risk health-risk * 1.02]
end 

to total-health-risk
    set  overall-health-risk mean [health-risk] of shoppers
end 
;;The US States Environmental Protection Agency estimates that on average for every 1 mile of 
;;distance traveled to supply food products to grocery stores about 1.18 tons of combined carbon 
;;monoxide, nitrogen oxide, and sulfur dioxide are emmitted into the environment. Locally-foods
;;create 0 emmissions through transport as the foods are grown locally. The average distance travelled
;;to stock a supermarket produce section is estimated to be 5845 miles. For every 5% of the population
;;that eats locally, one truck shipment will no longer be delivered to the competing supermarket.

to calculate-environment-impact
  let x count shoppers with [locavore?]
  let y floor ((x / population) / .05 )
  
  if y = overall-emission-counter [stop] 
  
  set overall-emission (overall-emission - ((y - overall-emission-counter) * 5845) )
  set overall-emission-counter y
  
  if (number-trucks + y != population * .05)
    [if who = random number-trucks [die]
      set number-trucks number-trucks - 1 ]
end  

;;One measure of economic growth is the increase in the employees only as the sale of the products 
;;they produce generates new fresh dollars for the local region. In farmer's markets, all the sale money that
;;is gained goes directly to fresh dollars because the employees and the owners live and buy from that same community
;;as opposed to shippers, transporters, etc. where the money will be used in a different community. 
;;For this model we will assume that for each 10 new people that eat locally-grown foods, 1 new employee will be 
;;hired by the farm. Economic growth will be based on total number of new employees * a multplier. I have chosen a health
;;economic growth multiplier

to calculate-economy
   let x count shoppers with [locavore?]
   let y floor (x / 10)
   
   if y = number-laborers [stop]
     
   set overall-economy  floor( 1.2 * (overall-economy + y - number-laborers))
   set number-laborers y
   
   create-labors (y - number-laborers)
    [setxy -9 (floor ((random-float -1) * 4) - 12)    ;;random number between 8 and 16     ;;random number between 9 and 14
     set color green + 3
     set size 2]
end  

;;
;;PLOTS
;;

to update-plot-healthrisk
  set-current-plot "Health-Risk"
  set-current-plot-pen "health"
  plot overall-health-risk
end 

to update-plot-environment
  set-current-plot "Environmental Impact"
  set-current-plot-pen "environment"
  plot overall-emission
end 

to update-plot-economy
  set-current-plot "Economy Impact"
  set-current-plot-pen "economy"
  plot overall-economy
end 
;to update-plot-locavore
;  set-current-plot "Locavores"
;  set-current-plot-pen "locavores"
;  plot count shoppers with [locavore?]
;end

There is only one version of this model, created almost 14 years ago by Tanya Flores.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.