Photosynthesis in Leaves

Photosynthesis in Leaves preview image

1 collaborator

Default-person Michael Novak (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.1 • Viewed 298 times • Downloaded 22 times • Run 0 times
Download the 'Photosynthesis in Leaves' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed [co2s co2]
breed [o2s o2]
breed [h2os h2o]
breed [sugars sugar]
breed [photons photon]
breed [chloroplasts chloroplast]
breed [atps atp]
breed [panels panelp]
breed [carbon-complexes carbon-complex]
breed [flows flow]
breed [key-labels key-label]
breed [side-panels side-panel]

co2s-own [for-key]
o2s-own [for-key]
h2os-own [bound-to for-key]
photons-own [bound-to for-key]
atps-own [pair my-chloroplast state for-key]
sugars-own [for-key]
key-labels-own [for-key]


panels-own [pair my-chloroplast state age]
carbon-complexes-own [my-chloroplast ]
patches-own [region]


globals [
  #-co2-molecules
  #-o2-molecules
  #-glucose-molecules-produced
]

to start-up
  setup
end 

to setup
  clear-all
  ;import-world "Zoom.csv"
  ; import-drawing "Zoom.png"

  set #-co2-molecules initial-co2
  set #-o2-molecules 0
  set #-glucose-molecules-produced 0


  create-co2s initial-co2 [setxy (-10 + random-float 20) random 20  set-shape-size ]


  create-sugars 1      [setxy 15 -6.5 set-shape-size set for-key 1]
  create-key-labels 1  [setxy 18 -7.8 set shape "empty" set label "sugar (glucose) molecule"]
  create-co2s 1        [setxy 15 -3 set-shape-size set for-key 1]
  create-key-labels 1  [setxy 18 -3.7 set shape "empty" set label "carbon dioxide molecule"]
  create-o2s 1         [setxy 15 0.5 set-shape-size set for-key 1]
  create-key-labels 1  [setxy 16.8 -0.2 set shape "empty" set label "oxygen molecule"]

  create-h2os 1        [setxy 15 4 set-shape-size set for-key 1]
  create-key-labels 1  [setxy 16.5 3.5 set shape "empty" set label "water molecule"]

  create-photons 1 [setxy 15 7.5 set-shape-size set for-key 1]
  create-key-labels 1  [setxy 16.5 7 set shape "empty" set label "light (photon)"]
  make-initial-chloroplasts
  reset-ticks
end 

to set-shape-size
  if breed = sugars [set shape "sugar" set color black set size 2 ]
  if breed = chloroplasts [set color [0 200 0 150] set shape "circle" set size 4 ]
  if breed = h2os [set shape "h20"  set color black set size 2 ]
  if breed = co2s [set shape "co2" set color black set size 2 ]
  if breed = o2s [set shape "o2" set color black set size 2 ]
  if breed = photons [set color yellow + 3 set size 0.4 set heading 135 set shape "ray"]
end 

to make-initial-chloroplasts
  let angle-increment 0
  repeat initial-#-of-chloroplasts [
  create-chloroplasts 1 [

    set heading (angle-increment * 50 + random 20)
    fd (5.5 + random-float 3)
    set-shape-size
    ]
    set angle-increment angle-increment + 1
  ]
  create-flows 1 [set heading 90 set hidden? true]
  ask chloroplasts [
    let atp-count 0
    let atp-offset random 60
    let this-chloroplast self
    let this-pair 0
    set heading 0


    repeat 3 [
      repeat 2 [
        hatch 1 [set breed atps set heading (atp-offset + (atp-count * 60)) set my-chloroplast this-chloroplast set hidden? true set pair this-pair set state 0]
        set atp-count atp-count + 1
      ]

      set this-pair this-pair + 1
    ]
  ]
  ask patches [
    if ((pxcor < -10 or pxcor > 10) and (pycor = max-pycor or pycor = min-pycor)) or (pycor = max-pycor or pycor = min-pycor) or (pxcor = -10 or pxcor = 10 ) or (pycor = 0 and pxcor < -10 ) or (pxcor = min-pxcor or pxcor = max-pxcor) [
      sprout 1 [set breed side-panels set shape "square" set size 1.2 set color [180 180 180]]
    ]

    if ((pxcor = -10) or ((pxcor >= -10 and pxcor < 10) and pycor = max-pycor)) [set region 3]
    if (pxcor >  -10 and pxcor < 10 and pycor != max-pycor)    [set region 4]

    if ((pxcor = 10) or ((pxcor >= -10 and pxcor < 10) and pycor = min-pycor)) [set region 5]
    if (pxcor > 10)    [set region 6]


    if region = 4 [sprout 1  [set shape "square" set size 1.2 set color sky + 2 stamp die]]
    if region = 6 [sprout 1  [set shape "square" set size 1.2 set color gray stamp die]]

  ]
end 

to do-photon-flow

  if intensity-of-light > random 100 [
  ask n-of 1 patches with [region = 3] [
    sprout 1  [
      set breed photons
        set-shape-size
        set hidden? true
    ]

  ]
  ]
  ask photons [
    if for-key != 1 [fd 0.15 set bound-to 0]
    if for-key != 1 and region = 5 [die]
    if pxcor >= -9.6 [set hidden? false]
  ]
end 

to do-water-flow
  if water-flow-through-leaf > random 100 and random 3 = 0 [
    ask n-of 1 patches with [region = 3 and pycor < max-pycor]  [
      sprout 1 [
        set breed h2os
        set-shape-size
        set hidden? true
        create-link-from one-of flows [ tie set hidden? true ]
      ]
    ]
  ]
  ask h2os [
    if for-key != 1 [fd 0.01 rt random 10 lt random 10]
    if (pxcor >= 10 and for-key != 1 ) [die]
    if for-key = 1 [set hidden? false]
    if pxcor >= -9.6 [set hidden? false]
    if pycor > (max-pycor - .4) [set hidden? true]
    if pycor < (min-pycor + .4) [set hidden? true]
  ]
end 

to do-sugar-flow
    ask sugars [
    if for-key != 1 [fd 0.005 rt random 10 lt random 10]
    if (pxcor >= 10 and for-key != 1 )[die]
    if for-key = 1 [set hidden? false]
  ]
end 

to do-gas-flow
  ask co2s with [for-key != 1] [
    fd 0.08 rt random-float 0.005 lt random-float 0.005
    if xcor > 10 [set xcor -10]
    if xcor < -10 [set xcor 10]
  ]
  ask o2s with [for-key != 1]  [fd 0.05]
end 

to go

  ask turtles with [breed = co2s or breed = o2s or breed = h2os or breed = sugars or breed = photons] [
    ifelse region = 4 or for-key = 1 [set hidden? false][set hidden? true]
  ]
  do-photon-flow
  do-water-flow
  do-sugar-flow
  do-gas-flow
  ask flows [fd 0.05]
  ask side-panels [set hidden? false]




  ask atps with [state = 0] [
    let this-pair pair
    let this-chloroplasts my-chloroplast
    let h2os-near-me h2os in-radius 2
    let photons-near-me photons in-radius 2
    let total-atps atps with [pair = this-pair and my-chloroplast = this-chloroplasts  and state = 0]
    let other-charged-atps atps with [pair != this-pair and my-chloroplast = this-chloroplasts  and state = 1]
    if any? photons-near-me and any? h2os-near-me and not any? other-charged-atps  [
      if count h2os-near-me >= 2 and count total-atps = 2 [

        ask one-of h2os-near-me  [die]
        ask one-of other h2os-near-me [die]

        hatch 1 [set breed o2s set shape "o2" set size 2 set heading random 360]
        set hidden? false set state 1
        ask total-atps [set hidden? false set state 1]
    ]
    ]
  ]
  ask atps [ask photons in-radius 2 [die]]

  ask atps with [state = 1] [
    let this-pair pair
    let this-chloroplasts my-chloroplast
    let total-atps atps with [not hidden? and pair = this-pair and my-chloroplast = this-chloroplasts  and state = 1]

     ; show count total-atps
    if count total-atps = 2 [
      let co2s-near-me co2s in-radius 2
     ; show count co2s-near-me
      if count co2s-near-me >= 2 [

      let other-atps one-of other total-atps

      ask one-of co2s-near-me [
        set heading [heading] of myself
        setxy ([xcor] of myself) ([ycor] of myself)
        set breed carbon-complexes
        set my-chloroplast this-chloroplasts
        set shape "carbon-complexes"

        ask one-of other co2s-near-me [
          set heading [heading] of other-atps
          setxy ([xcor] of other-atps) ([ycor] of other-atps)
          set breed carbon-complexes
          set my-chloroplast this-chloroplasts
          set shape "carbon-complexes"
        ]
        hatch 1 [set breed o2s set shape "o2" set size 2 set heading random 360]
      ]
      ask total-atps [set state -1]

    ]

    ]
  ]
  ask atps with [state = 1] [set hidden? false set color (orange + 3 + random-float 1) set shape (word "electric-" random 10)]
  ask atps with [state != 1] [set hidden? true]

  ask chloroplasts [
    let this-chloroplast self
    let my-carbon-complexes carbon-complexes with [my-chloroplast = this-chloroplast]
    if count my-carbon-complexes = 6 [
      ask my-carbon-complexes with [my-chloroplast = this-chloroplast] [die]
      hatch 1 [set breed sugars set shape "sugar" set color black set heading random 360 set size 2 create-link-from one-of flows [ tie set hidden? true ]]
     set #-glucose-molecules-produced #-glucose-molecules-produced + 1
      ask atps with [my-chloroplast = this-chloroplast] [set hidden? true set state 0]
    ]

  ]
 update-counts
; wait delay

  tick
end 

to update-counts
  set #-co2-molecules count co2s with [for-key != 1]
 set #-o2-molecules count o2s  with [for-key != 1]
end 

There is only one version of this model, created over 6 years ago by Michael Novak.

Attached files

File Type Description Last updated
Photosynthesis in Leaves.png preview Preview for 'Photosynthesis in Leaves' over 6 years ago, by Michael Novak Download

This model does not have any ancestors.

This model does not have any descendants.