This page was automatically generated by NetLogo 5.0RC4.

powered by NetLogo

view/download model file: potatoes.nlogo

WHAT IS IT?

WE regard the Irish Potato Famine of 1845 as a complex dynamical system with many nodes, eg, English Parliament, English market for beef and dairy products, absentee landlors, middlement, farmers, laborers, potato crops, all other crops, various deadly fevers, and of course, the late potato blight. This NetLogo model, made with Rev 5.0RC4, simulates a minimal subsystem including the tenants subsisting on potatoes, potato crops, potatotes in storaage, and the blight. Time ticks indicate months of a 12-month growing season.

HOW IT WORKS

The key to understanding the rapid and deadly blight attacks is the combined effect of two climate factors: temperature and humidity. When these two factors (shown by a turtle moving in an XY plot in the left side of the Graphics Window) stay in the danger zone (yellow rectangle) for two successsive days, the dormant blight spores spring to life.
Then the potatoe crop (center of Graphic Window and the potato storage (right side) turn to mush.

HOW TO USE IT

Click on the :setup“ button, then experiment with the other buttons to learn their function. The ”go" button begins an animiation of a 12-month growing season.
as the model uses real data formonthly aveerages of the temperature and humidity and these values avoid the danger zone, famine will not occur unless the user figures out how to perturb the climate from the Command Center.

THINGS TO NOTICE

The tenant family consume potatoes at a constant rate of about 1000 lbs per month.

THINGS TO TRY

TRy changing the wweather from the Command Center. You must read the Code to figure this out.

EXTENDING THE MODEL

Add buttoms to apply random perturbations to the temperature and humidity.

NETLOGO FEATURES

WE mad our own XY plot becuase NetLogo did not allow us to easily draw the danger zone in the backgrount of the Plot widget (but, there is a way).

RELATED MODELS

Check out Wolves and Sheep.

CREDITS AND REFERENCES

Check out this site: http://www.ralph-abraham.org/courses/ross-sys-2011/models.html. AS usual, we owe a huge debt to Uri Wilensky and his team.

CODE

;;; potatoes-01.nlogo, firt draft model for irish famine
;;; ralph abraham, visual math institute, 26 nov 2011

;;; BREEDS ;;;
breed [ plants plant ]
breed [ potatoes potato ]

;;; GLOBALS ;;;
globals [
  margin ;;; between windows
  width-1 ;;; width of window 1
  width-2
  width-3
  x-offset-1
  x-offset-2
  x-offset-3
  high
  month
  templist
  humidlist
  monthlist
  umin umax vmin vmax ;;; from def of map-u and map-v (from dorband)
  xmin xmax ymin ymax ;;; from Graphics Window attributes
  deltau deltav deltax deltay
]
;;; PROCS ;;;

to init-globals ;;; determine geometry
  let temp max-pxcor / 18 ;;; this is 1
  set margin 1
  set x-offset-1 margin
  set width-1 ( 4 * temp ) ;;; this is 4
  set x-offset-2 ( margin + width-1 + margin )
  set width-2 ( 6 * temp )
  set x-offset-3 ( margin + width-1 + margin + width-2 )
  set width-3 ( 4 * temp )
  set high max-pycor - ( 2 * margin )
  set month 0
  set templist [ 2 2 3 4 6 9 11 11 9 7 4 3 ]
  set humidlist [ 92 91 88 83 79 80 84 87 89 91 92 92 ]
  set monthlist [ "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec" ]
  ;;;;;;; these or conversion reporters
  set xmin 1.5 ;;; to left edge of first window IN TURTLE COORDS
  set xmax 4.5
  set ymin 1.5
  set ymax 4.5
  set deltax ( width-1 - 1 ) ;;; width of window 1
  set deltay ( width-1 - 1 ) ;;; height of window 1
  set umin 75 ;;; u is relative humidity
  set umax 100
  set vmin 0 ;;; v is temperature deg C
  set vmax 12
  set deltau (umax - umin) 
  set deltav (vmax - vmin)
end

to setup-0 ;;; basic clear-all
  ca ;;; clear all
  init-globals
  reset-ticks ;;; for plots
end

to setup-1 ;;; for the xy-plot
  ask patches [ 
    if ( pxcor > margin ) and ( pxcor < margin + width-1 ) ;;; >= 2 and < 5 (is it 3 x 3 ??????????
        and ( pycor < margin + high ) and ( pycor > margin )
        [ set pcolor blue ] 
    if ( pxcor > margin + 2 ) and ( pxcor < margin + width-1 ) 
        and ( pycor < margin + high ) and ( pycor > margin + 2 )
        [ set pcolor red ] 
    ]
   crt 1 ;;; plot-turtle
        [ 
          set size 1 
          set shape "turtle" 
          set heading 0 
          my-plotxy 0
          set color yellow 
          pd
       ]
end

to setup-2 ;;; for the potato patch
  ask patches [ 
    if ( pxcor > margin + width-1 + margin ) and ( pxcor < margin + width-1 + margin + width-2 ) 
        and ( pycor < margin + high ) and ( pycor > margin )
        [ set pcolor brown ] 
    ]
end

to planting 
  create-plants 10
      [ set shape "flower"
        set size 1
        set heading 0
        set color green
      ]
      ask plant 1 [ setxy ( x-offset-2 + 1 ) ( margin + 1.25 ) ]
      ask plant 2 [ setxy ( x-offset-2 + 2 ) ( margin + 1.25 ) ]
      ask plant 3 [ setxy ( x-offset-2 + 3 ) ( margin + 1.25 ) ]
      ask plant 4 [ setxy ( x-offset-2 + 4 ) ( margin + 1.25 ) ]
      ask plant 5 [ setxy ( x-offset-2 + 5 ) ( margin + 1.25 ) ]
      ask plant 6 [ setxy ( x-offset-2 + 1 ) ( margin + 2.5 ) ]
      ask plant 7 [ setxy ( x-offset-2 + 2 ) ( margin + 2.5 ) ]
      ask plant 8 [ setxy ( x-offset-2 + 3 ) ( margin + 2.5 ) ]
      ask plant 9 [ setxy ( x-offset-2 + 4 ) ( margin + 2.5 ) ]
      ask plant 10 [ setxy ( x-offset-2 + 5 ) ( margin + 2.5 ) ]
end

to setup-3 ;;; for the cellar stock
  ask patches [ 
    if ( pxcor > margin + width-1 + margin + width-2 + margin ) 
        and ( pxcor < margin + width-1 + margin + width-2 + margin + width-3) 
        and ( pycor < margin + high ) and ( pycor > margin )
        [ set pcolor yellow ] 
    ]
end

to storing
    create-potatoes 12
      [ set shape "circle"
        set size 0.5
        set heading 0
        set color brown
      ]
      ask potato 11 [ setxy ( x-offset-3 + 2 ) ( margin + 1 ) ]
      ask potato 12 [ setxy ( x-offset-3 + 2.7 ) ( margin + 1 ) ]
      ask potato 13 [ setxy ( x-offset-3 + 3.4 ) ( margin + 1 ) ]
      ask potato 14 [ setxy ( x-offset-3 + 4 ) ( margin + 1 ) ]
      ask potato 15 [ setxy ( x-offset-3 + 2 ) ( margin + 2 ) ]
      ask potato 16 [ setxy ( x-offset-3 + 2.7 ) ( margin + 2 ) ]
      ask potato 17 [ setxy ( x-offset-3 + 3.4 ) ( margin + 2 ) ]
      ask potato 18 [ setxy ( x-offset-3 + 4 ) ( margin + 2 ) ]
      ask potato 19 [ setxy ( x-offset-3 + 2 ) ( margin + 3 ) ]
      ask potato 20 [ setxy ( x-offset-3 + 2.7 ) ( margin + 3 ) ]
      ask potato 21 [ setxy ( x-offset-3 + 3.4 ) ( margin + 3 ) ]
      ask potato 22 [ setxy ( x-offset-3 + 4 ) ( margin + 3 ) ]
end

to clear-garden
  ask plants [ ht ]
end

to replant
  ask plants [
    st ;;; un-hide
    set size 1 ;;; become seedlings again
  ]
end

to harvest
  clear-garden
  ask potatoes [ st ] ;;; un-hide
end

to step
  let temp ( 22 - month )
  ask plants [ set size ( size + 0.1 ) ]
  ask potato temp [ ht ]
  if ( month < 11 ) [ set month ( month + 1 ) ]
  my-plotxy month
  tick ;;; to make plots work
end

to my-plotxy [ mo ]
  let u ( item mo humidlist  )
  let x horizdeconvert u
  let v ( item mo templist )
  let y vertdeconvert v
  ask turtle 0 [ setxy x y ]
;  show u
;  show v
;  show x
;  show y
end

to go
  repeat 12 [ 
    wait 0.5
    step 
    ]
  set month 0 ;;; get ready for a second show
end

;;; reporters (from dorband)
;;; ==============================================
;;; conversion functions, world-coords <--> turtle-screen-coords:
;;; horizontal: (u <--> x), vertical (v <--> y)
;;; ----------------------------------------------
;;; (u <-- x): u = convert(x)
to-report horizconvert [ x ]
  let u (deltau * ( x - xmin ) / deltax) + umin
  report u
end

;;; (u --> x): x = deconvert(u)
to-report horizdeconvert [ u ]
  let x (deltax * ( u - umin ) / deltau) + xmin
  report x
end

;;; (v <-- y): v = convert(y)
to-report vertconvert [ y ]
  let v (deltav * ( y - ymin ) / deltay) + vmin
  report v
end

;;; (v --> y): y = deconvert(v)
to-report vertdeconvert [ v ]
  let y (deltay * ( v - vmin ) / deltav) + ymin
  report y
end
;;; ==============================================


;;; END CODE ;;;