Aquaponic-edu

Aquaponic-edu preview image

1 collaborator

Default-person Asmaa AlJuhani (Author)

Tags

ecosystem 

Tagged by Asmaa AlJuhani over 11 years ago

Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 1239 times • Downloaded 96 times • Run 0 times
Download the 'Aquaponic-edu' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

;;; Asmaa aljuhani
;;; Agent Based Modeling
;; Aquaponics

breed [fish a-fish]
breed [plants plant]
breed [water a-water]
breed [food a-food]

plants-own [
  seed
  head-to ;; to arrange the growth of the plants 
  ]

water-own [
  head-to ;; this variable is to arrange the flow of water ( to make crossing tunnels easy)
  clean  ;; this variable holds arrange of int from 1-5 (1 is clean and 5 is toxic)
  ]

fish-own [
  tank ;; variable that hold how the amount of food a fish eat 
  waste ;; amount of waste a-fish produce
  
]

globals [window-edge
  growbed-size
 t2b-entrance t2b-exit
 b2t-entrance b2t-exit
 day day-change?]

to setup-empty
  ca
  draw-environment
  reset-ticks
end 

to setup
  ca
  draw-environment
  add-water tank-size
  add-fish number-of-fish
  add-plants number-of-seeds
  add-food amout-of-food/fish
  reset-ticks
end 

to go
  if day-change?
  [
   add-food amout-of-food/fish
  ]

  ask fish [
    is-env-healthy  ;; this function is to check whether the surrounding environment is healthy for the fish , if not it dies
    swim
    eat
    grow-produce
    produce-ammonia
  ]
  
  ask water[
    circulate 
    cross-tunnels 
    recolor ;; to recolor water depends on how clean it is
    ;; hide water in grow bed
    ifelse ( hide-water-in-growbed? and xcor < 0 )
    [ht]
    [st]
  ]

ask plants ;with [ any? water with [clean > 1] in-radius 2] 
    [
      ifelse (color = brown)[
        grow
      ]
      [ 
        move-leaves
      ]
    ]    
  
  
  ask food [
   break-down-into-toxins 
  ]
  
  
  ifelse ticks mod 100 = 0
  [
   set day day + 1
   set day-change? true
  ]
  [
   set day-change? false
  ]
 tick 
end 


;;;;;;;;;;;;;;;;;;;;;;;;; setup functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to draw-environment
   ask patches [set pcolor brown + 3]
   
  draw-tank
  draw-grow-bed
  draw-walls
  draw-tunnels
  
  set growbed-size count patches with [pxcor < 0]
  set t2b-entrance tank-to-bed-tunnel-entrance
  set t2b-exit tank-to-bed-tunnel-exit
  set b2t-entrance bed-to-tank-tunnel-entrance
  set b2t-exit bed-to-tank-tunnel-exit
  set day-change? false
  
   ;;;create pump
  crt 1 [
    set shape "pump"
    set size 5
    setxy 35 -10
    set heading 0
    set label "pump"
  ]
end 

to draw-tank
  ask patches with [pxcor > max-pxcor / 3]
  [
   set pcolor blue ;scale-color (blue) ((random-float 2.0) + 5) 0 10
  ]
end 

to draw-grow-bed
  ask patches with [pxcor < 0][
    set pcolor scale-color (gray) ((random-float 2.0) + 5) 0 10
  ]
end 

to draw-walls
  ;; don't let the window be bigger than the right chamber
  if (2 > (max-pycor - 1))
    [ set window-edge (max-pycor - 2) ]
  ask patches with [(pxcor = min-pxcor) or
                    ((pxcor < 0) and (abs pycor = max-pycor)) or
                    (pxcor >= max-pxcor - 2) or
                    ((pxcor > max-pxcor / 3) and (abs pycor >= max-pycor - 2))]
    [ set pcolor black ]
  ask patches with [pxcor = 0 or pxcor = 11 or pxcor = 12 or pxcor = 13]
    [ ifelse abs pycor < window-edge
        [ set pcolor black ]
        [ set pcolor black ] ]
  ;; make sure no turtles are embedded in the middle wall
  ;; if the window size changed
end 

to draw-tunnels
  ask patches with [(pycor = max-pycor / 2 + 1 or pycor = max-pycor / 2 - 1)
                     or (pycor = (- max-pycor / 2 + 1) or pycor =(- max-pycor / 2 - 1))]
  [
    if (pxcor > -1 and pxcor < max-pxcor / 3 )[
      set pcolor black
    ]
   
  ]
  ask patches with [pycor = max-pycor / 2 or pycor = (- max-pycor / 2)]
  [
    if (pxcor > -1 and pxcor < max-pxcor / 3 )[
      set pcolor brown + 3
    ]
  ]
end 

;; turtle procedure that randomizes position on the growbed

to arrange-within-growbed
    setxy (abs random-xcor * -1)
        random-ycor
  if any? patches in-radius 2 with [pcolor = black or pcolor = brown + 3]
    [ arrange-within-growbed ] ;; try again until we don't land on or near green
  set seed self
end 

;; turtle procedure that randomizes  position on the tanks

to arrange-within-tank
   setxy abs random-xcor
        random-ycor
  if any? patches in-radius 2 with [pcolor = black or pcolor = brown + 3]
    [ arrange-within-tank ] ;; try again until we don't land on or near black
end 


;;;                          ;;;
;;;    turtles procedures    ;;;
;;;                          ;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FISH PROCEDURS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to add-fish [numfish]
   ;;;create fish
  create-fish numfish [
   set shape "fish"
   set color orange
   set size 2
   set tank 0
   set waste 0 
   arrange-within-tank  ;; function to randomize fish withen the tank
  ]
end 

;;;turtle procedure that let fish to swim within the tank

to swim
  fd 1
  rt 3
  if any? patches in-radius 2 with [pcolor = black][
    rt 180
  ]
end 

to produce-ammonia 

 if waste > 0 
 [
   let drops  water in-radius (size / 2)
   if drops != nobody
   [ 
     set waste waste - 1
     ask drops
     [
       if clean < 5
       [
         set clean (clean + 1) 
       ]
     ]
   ] 
 ]
end 

to eat
  let target-food  one-of food with [color > 11] in-radius 3;Min-one-of food [distance myself] ;one-of food with [color > 11] in-radius 3;  
  if target-food != nobody
   [
     set tank tank + 1
     set waste waste + 1
     face [patch-here] of target-food   
     ask target-food [
       die
     ]
   ]
end 

to grow-produce
  if day-change?
  [
    set size size + .01
  ]
end 

to is-env-healthy
  let water-arround-me water in-radius 2 with [clean > 4]
  if count water-arround-me > 5
   [
    die
   ]
end  

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PLANTS PROCEDURS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to add-plants [numseed]
   ;;;create Plants
  create-plants numseed [
   set shape "leaf2"
   set color brown
   set size 0.5
   set head-to 0
   arrange-within-growbed ;; function to randomize plants withen the growbed
  ]
end 

to grow
 let a-drop one-of water with [clean > 1] in-radius 2
 if a-drop != nobody
 [
  filter-ammonia a-drop
    ask seed
    [
      let h head-to
      hatch 1
      [
        set color green 
        set size 0.6 * sqrt distance seed
        set heading h * .62 * 360
      ]   
      set head-to head-to + 1
    ]
 ]
end 

to move-leaves
  if  color != brown and not any? patches in-radius 1 with [pcolor = black or pcolor = brown + 3] 
        [
          fd  .02
          set size 0.6 * sqrt distance seed
        ]
end 

to filter-ammonia [drop]
  ask drop [
    set clean (clean - 1)
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WATER PROCEDURS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to add-water[gallon]
  ;;;create water
  create-water gallon * 100 [
   set shape "drop"
   set color scale-color (blue) ((random-float 2.0) + 5) 0 10
   set size 1
   set clean 1
   arrange-within-tank ;; function to randomize drops withen the tank
  ]  
end 

to circulate

  if ( (xcor >= max-pxcor / 3 or  xcor <= 0 ) and head-to = 0)
  [
    flow
  ]
  ;; for water in the lower part of the tank --> move towards the tunnel
  if (random 10 = 1 and floor ycor = [pycor] of t2b-exit and xcor > 0); max-pycor / -3 and xcor > max-pxcor / 3)
  [ face t2b-exit
    set head-to t2b-exit
    ;set color red
    ]
  
  ;; after crosseing the tunnel --> flow in the grow bed or tank
   if ((xcor < -1 and ycor < 0) or (xcor > max-pxcor / 3 + 1 and ycor > 0))
    [
      set head-to 0
    ]

 ;; for water in the upper part of the grow-bed --> move towards the tunnle
   if (random 10 = 1 and floor ycor = [pycor] of b2t-exit and xcor < 0 );and shade-of? blue color)
   [
     ;; water will return back to the tank after reaching 40%
     ;if (count water with [xcor < 0] * 100 / count water > 40) [
    ; if (color = blue) [
       face b2t-exit
       set head-to b2t-exit
       ;set color yellow
    ; ]
    ]
end  

to flow
  fd 1
  rt random 10
  if any? patches in-radius 2 with [pcolor = black][
  rt 180
  ]
end 

to cross-tunnels
  if (head-to = t2b-exit or head-to = b2t-exit )
  [
    fd 1
  ]
end 

to recolor
  ifelse clean > 1
  [
    set color scale-color (brown) (( 2.0) + 5) clean 10
  ]
  [
    set color scale-color (blue) ((random-float 2.0) + 5) 0 10
  ]
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FOOD PROCEDURS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to break-down-into-toxins
  if color > 10.1 and ticks mod 5 = 1
  [
   set color color - .1
   if ( floor color = 10) ; when food is black , increase toxic at water to the max
   [
    let a-drop water-here
    if a-drop != nobody
    [
     ask a-drop [ set clean 5]
     die
    ] 
   ]  
  ]
end 

to add-food [amount]
   create-food amount * count fish [
   set shape "circle"
   set color red
   set size .5
  arrange-within-tank  ;; function to randomize food withen the tank
  ]
end  

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;                          ;;;
;;;    helper reporters      ;;;
;;;                          ;;;

to-report tank-to-bed-tunnel-entrance
  report patch ((max-pxcor / 3) + 1) (max-pycor / -2)
end 

to-report tank-to-bed-tunnel-exit
  report patch (-1) (max-pycor / -2)
end 

to-report bed-to-tank-tunnel-entrance
  report patch (-1) (max-pycor / 2)
end 

to-report bed-to-tank-tunnel-exit
  report patch ((max-pxcor / 3) + 1) (max-pycor / 2)
end 

There are 4 versions of this model.

Uploaded by When Description Download
Asmaa AlJuhani over 11 years ago related models added Download this version
Asmaa AlJuhani over 11 years ago final Download this version
Asmaa AlJuhani over 11 years ago v2 Download this version
Asmaa AlJuhani over 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Aljuhani_Asmaa_FinalPaper.docx word Final Paper over 11 years ago, by Asmaa AlJuhani Download
Aljuhani_Asmaa_Poster.jpg jpeg Aquaponics_poster over 11 years ago, by Asmaa AlJuhani Download
Aljuhani_Asmaa_Slam.pptx powerpoint Poster Slam over 11 years ago, by Asmaa AlJuhani Download
AljuhaniAsmaa_June3.docx word Progress Report over 11 years ago, by Asmaa AlJuhani Download
AljuhaniAsmaa_May13.docx word Progress Report over 11 years ago, by Asmaa AlJuhani Download
AljuhaniAsmaa_May20.docx word Progress Report over 11 years ago, by Asmaa AlJuhani Download
AljuhaniAsmaa_May27.docx word Progress Report over 11 years ago, by Asmaa AlJuhani Download
Aquaponic-edu.png preview Preview for 'Aquaponic-edu' over 11 years ago, by Asmaa AlJuhani Download
Aquaponics.pptx powerpoint Educational Material - Presentation over 11 years ago, by Asmaa AlJuhani Download
Aquaponics_WorkSheets.docx word Educational Material - WorkSheet over 11 years ago, by Asmaa AlJuhani Download

This model does not have any ancestors.

This model does not have any descendants.