Fungal Bioremediation
Model was written in NetLogo 6.2.2
•
Viewed 94 times
•
Downloaded 6 times
•
Run 0 times
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
extensions [table] globals [ ec-added ;;keeps track of contaminants added ms ;;model speed adjuster. Not fully implemented Kr ;;Enzyme Kinetics Options Kc Kd view-number ;;Used to name the image downloaded with 'export view' interface-number complexes-formed ;;Keeps track of Enzyme + Substrate complexes formed. Used to calculate % dissociate dissociated ;; Count of dissociated complexes fungi-option ;;stores name of fungi species selected status-1 ;; (Comment) I can do this more efficiently status-2 status-3 my-list1 ;;Used by clock. The code is inside the plot options my-list2 intracellularly ;; Used to count EC's degraded intracellularly fungi-dict ;;Dictionary/Table of values unique to each fungi species adjuster-enzymes ;; adjusts production and efficiency of enzymes based on amount of them. Capped at 280 adjuster-fungi ;;Used to decide amount of starting NH4 given to offsprings ;;eph ;;fph ;;ftemp ] fungi-own [ age energy NH4 partner ] patches-own [ glucose O2 ;; (Comment) Remove eventually lignin ] enzymes-own [ age partner turn pause-time ;; Enzyme won't go into complex again, right after dissociating ] ECs-own [ partner locked-time ;; Counts time in Enzyme Substrate complex or Intracellular process taken ;; True if being degraded Intracellularly ] breed [fungi fungus] breed [ECs EC] breed [enzymes enzyme] to setup clear-all setup-globals setup-patches setup-fungi setup-ECs reset-ticks end to go if ticks > 400 and not any? ECs [ output-print (word "Success! All Contaminants Removed in " ticks " ticks.") stop] if ticks > 1000 [ output-print (word (ec-added - count ECs)" of " ec-added " Contaminants Removed.") stop] if fungi-species != fungi-option [ setup stop] diffuse glucose (0.5 + (0.01 * temperature)) ;;diffuse glucose in patches diffuse O2 (0.5 + (0.01 * temperature)) set adjuster-enzymes round max(list ((count enzymes)^(1 / 4)) 1) set adjuster-fungi round max(list ((count enzymes)^(1 / 5)) 1) ;;if background-color [color-patches] move break-down-lignin eat-glucose replenish-O2 reproduce ;;produce-enzymes ;; called with if/else in reproduce produce-ECs age-fungus age-enzymes check-death nutrient-status intracellular-degrade denature change-rate degrade-ECs tick end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup-globals set ms 0.5 set view-number 1 set interface-number 1 set fungi-option fungi-species set status-1 false set status-2 false set status-3 false set fungi-dict table:make end to setup-patches ask patches [ set pcolor blue set glucose 4 set lignin 100 set O2 25 ;;Net values are 32 * 32 * of these ] end to setup-fungi create-fungi 6 [;;set the starting number of fungi if fungi-species = "Phanerodontia Chrysosporium" [ set shape "fungi-tendrils" set size 2.25 table:put fungi-dict "fungi-growth-temp" 30 table:put fungi-dict "fungi-growth-pH" 2 table:put fungi-dict "enzyme-production-cost" 1 table:put fungi-dict "enzyme-production-pH" 4 ;;intracellular-radius ] if fungi-species = "Trametes Versicolor" [ set shape "turkey-tail-3" set size 2 table:put fungi-dict "fungi-growth-temp" 24 table:put fungi-dict "fungi-growth-pH" 1 table:put fungi-dict "enzyme-production-cost" 1 table:put fungi-dict "enzyme-production-pH" 3.75 ] if fungi-species = "Pleurotus Ostreatus" [ set shape "Button-Mushroom" set size 2 table:put fungi-dict "fungi-growth-temp" 33.5 table:put fungi-dict "fungi-growth-pH" 4 table:put fungi-dict "enzyme-production-cost" 2.5 table:put fungi-dict "enzyme-production-pH" 5 ] ;;table:put fungi-dict "enzyme-denature-pH" 4 ;;table:put fungi-dict "enzyme-reaction-pH" 4 ;; I'm gonna hard code these in set color 1 setxy random -28 + 14 random -28 + 14 ;;place the fungi at random locations, but not edges (display is -16 to 16) set energy 30 set NH4 12 set partner nobody ] ;;set eph table:get fungi-dict "enzyme-production-pH" ;;set fph table:get fungi-dict "fungi-growth-pH" ;;set ftemp table:get fungi-dict "fungi-growth-temp" end to setup-ECs set ec-added 40 create-ECs 40 ;;If changed, change above as well [ set size 1 set shape "substrate" set color 26 setxy (random -32 + 16) one-of [ -16 16 ] ;;place the ECs at random locations along the bottom or top set partner nobody set hidden? false set taken false ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to color-patches ask patches [ set pcolor (blue + glucose / 3) ;;changes patch color based on amount of glucose ] end to move ask enzymes [ if partner = nobody [ if ticks mod 3 = 0 [ set turn (random 120) - 60 ;; A turn is decided every 3 ticks, and then carried out in 3 pieces over that time. Very smooth ] right turn / 3 ifelse (xcor > 14.5) [ ;; These 4 blocks redirect the enzyme if it is near an edge and heading towards that edge if (0 < heading and heading <= 90) [left 20] if (90 < heading and heading < 180) [right 20] ][ ifelse (xcor < -14.5) [ if (270 <= heading and heading < 360) [right 20] if (180 < heading and heading < 270) [left 20] ][ ifelse (ycor < -14.5) [ if (270 > heading and heading > 180) [right 20] if (180 >= heading and heading > 90) [left 20] ][ if (ycor > 14.5) [ if (0 <= heading and heading < 90) [right 20] if (270 < heading and heading < 360) [left 20] ] ] ] ] forward 0.12 ] ] ask ECs [ if partner = nobody [ ifelse ticks < 150 [ ;; This moves the EC's towards the center horizontal at the start of the game. ;; This is needed as the first EC's start on the top and bottom let ec-heading heading if ycor > 6 [set heading 180] if ycor < -6 [set heading 0] forward 0.05 set heading ec-heading ] [ ;;This keeps them closer to the center horizontal during the rest of the game let ec-heading heading ifelse ycor > 12 [set heading 180][ ifelse ycor < -12 [set heading 0][ ifelse xcor < -12 [set heading 90] [ if xcor > 12 [set heading 270] ] ] ] forward 0.02 set heading ec-heading ] right -45 + random 90 ;; No turn setup. More erratic if (xcor > 14.5) [ if (0 < heading and heading < 90) [left 20] if (90 < heading and heading < 180) [right 20] ] if (xcor < -14.5) [ if (270 < heading and heading < 360) [right 20] if (180 < heading and heading < 270) [left 20] ] if (ycor < -14.5) [ if (270 > heading and heading > 180) [right 20] if (180 > heading and heading > 90) [left 20] ] if (ycor > 14.5) [ if (0 < heading and heading < 90) [right 20] if (270 < heading and heading < 360) [left 20] ] forward 0.06 ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to break-down-lignin ask enzymes with [partner = nobody] [ if lignin >= 2 [ set lignin (lignin - 2) set glucose (glucose + 1) ;;(Comment) later try / adjuster-enzyme ] ] if (count enzymes) < 80 [ ask fungi [ if lignin >= 1 [ set lignin lignin - 0.5 set glucose glucose + 0.25 ] ] ] end to eat-glucose ask patches [ ;;(Comment) try to simplify or remove this section let fungus-count count fungi-here if fungus-count > 0 [ let g glucose / fungus-count ask fungi-here [ set O2 (O2 + (g * 2)) ] ] ] ask fungi [ ifelse glucose >= 5 and O2 >= 30 [ set glucose (glucose - 5) set O2 (O2 - 30) set energy (energy + (5 * 0.25)) ][ if O2 >= glucose * 3 [ let m (glucose / count fungi-here) set glucose (glucose - m) set O2 (O2 - (m * 3)) set energy (energy + (m * 0.25)) ] ] ] end to replenish-O2 if (ticks mod 5 = 0) [ ask patches [ if O2 <= 50 [ set O2 (O2 + 30) ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to reproduce ask fungi [ ifelse age > 16 and random(2 * (abs(table:get fungi-dict "fungi-growth-pH" - pH))^ 2)= 0 and energy > (random 8 + 2 + (abs(table:get fungi-dict "fungi-growth-temp" - temperature) ^ 2) * 2 + (abs(2 - table:get fungi-dict "fungi-growth-pH"))^ 2) [ ;;Affected by age, pH, energy and temp let En (energy / 2) set energy En let L glucose / 2 set glucose L set NH4 NH4 - 0.5 hatch-fungi 1 [ let p max-one-of patches in-radius 3 with [pycor < 15 and pycor > -15 and pxcor < 15 and pxcor > -15] [glucose] face p set energy En + (5.5 - (2 * abs(table:get fungi-dict "fungi-growth-pH" - pH))) + (table:get fungi-dict "enzyme-production-cost" * 1.5) set NH4 3.5 / adjuster-fungi set age 0 forward 1 ;;set glucose L set partner nobody ] ] [produce-enzymes] ;;Enzymes can only be produced when the fungi cannot reproduce ] end to produce-enzymes if (sum [glucose] of patches in-radius 2) < 120 and (energy < 20 or ticks < 12) and NH4 >= (max(list 1 (abs(table:get fungi-dict "enzyme-production-pH" - pH) * (table:get fungi-dict "enzyme-production-cost"))) * table:get fungi-dict "enzyme-production-cost") and (random(((abs(table:get fungi-dict "enzyme-production-pH" - pH))^ 3) * 50) = 0 or ticks < 12) and ((random 100) + count enzymes) < 280 [ ;;Affected by nearby glucose, energy, NH4, ticks, enzyme count and pH set NH4 NH4 - (max(list 1 (abs(table:get fungi-dict "enzyme-production-pH" - pH) * (table:get fungi-dict "enzyme-production-cost"))) * table:get fungi-dict "enzyme-production-cost") hatch-enzymes 1 [ set size 1 set color white set shape "enzyme" set partner nobody set age 0 ] ] end to produce-ECs if ticks > 32 and ticks < 400 and ticks mod 6 = 0 [ ;;EC's produced every 6 ticks after the first 32 create-ECs 2 [ set size 1 set shape "substrate" set color 26 setxy (random 20 - 10) (random 20 - 10) ;; Placed closer to the center of the display set partner nobody set hidden? false set ec-added ec-added + 1 set taken false ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to age-fungus ask fungi [ set energy energy - 0.7 set NH4 NH4 + 0.08 / (adjuster-enzymes * 1.5) ;;All fungus get NH4 at a set rate every tick set age (age + 1) set color age * 0.15 ;;lighten color as fungi age if energy <= 0 [set age age + 0.6] if color > 9.9 [ set color 9.9] if energy < 0 [set energy 0] ] end to age-enzymes ask enzymes [ set age (age + 1) ;;add 1 to enzymes' age ] end to check-death ask fungi [ if age > 200 * (1 / ms) and partner = nobody [die];;die when age exceeds 400 ] ask enzymes [ if age > 275 * (1 / ms) and partner = nobody [die] ;;enzymes die when their age exceeds 550 ] end to nutrient-status ;;This reports the lignin remaining to the user ;;I'm trying to draw attention to the graphs if sum [lignin] of patches < (51200) and status-1 = false [output-print ("Lignin at 50%") ;ask status 1 [set whether true set status-1 true] if sum [lignin] of patches < (76800) and status-2 = false [output-print ("Lignin at 75%") set status-2 true] if sum [lignin] of patches < (26600) and status-3 = false [output-print ("Lignin at 25%") set status-3 true] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to intracellular-degrade ;;Some contaminants are removed by intracellular enzymes ;;This happens when they approach an unpaired fungus ask fungi with [partner = nobody] [ if any? ECs in-radius 0.5 with [partner = nobody] [ set partner one-of ECs in-radius 0.5 with [partner = nobody] ask partner [ set partner myself set taken true] ] ] Ask ECs with [taken = true] [ set locked-time locked-time + 1 if locked-time > 34 [ set intracellularly intracellularly + 1 ;;Counter for % removed intracellularly ask partner [set partner nobody] die ] set size 1 - (locked-time / 34) ;;Shrink each tick and move slightly forward fd 0.007 ;;this is 1 / 15 rounded ] end to denature ;;parameters for denaturing enzymes let aging-amount 0.5 + 0.1 * (table:get fungi-dict "enzyme-production-pH" - pH) ^ 2 + (count enzymes / 500) ;;All enzymes age the same amount, based on pH the count of enzymes ask enzymes [ set age age + aging-amount ] ;;if ticks mod 80 = 0 [ ;;Optional randomizer. Sometimes a lot of enzymes die at once, this would prevent that ;;ask enzymes with [partner = nobody] [ ;;set age age + (random 20) - 10 ;;] end to change-rate set Kc round (1) ;;(Comment) If these first two are going to be constant. Define them in setup globals once and for all set Kd round (60) set Kr round(3 * abs(32 - temperature) + 3) ;;multiply Kr by the multipliers for temperature, pH end to degrade-ECs ask enzymes [form-complex] ask enzymes [dissociate] ask ECs [react-forward] end to form-complex ifelse pause-time < 0 ;;Enzymes won't reform immediately after dissociating [set pause-time pause-time + 1] [if partner = nobody and (any? other ECs-here with [partner = nobody and not taken]) [ ;;and random Kc = 0 [ set partner one-of (other ECs-here with [partner = nobody and not taken]) set complexes-formed complexes-formed + 1 let h heading ask partner [ set partner myself set hidden? true move-to partner ;;These two make it so the EC matches the Enzyme position exactly. set heading h ;;if they dissociate it will look like a clean separation ] set shape "complex" ] ] end to react-forward if (partner != nobody and not taken) [ set locked-time locked-time + 1 ;;Won't react forward right after joining. if locked-time > 25 and random Kr = 0 [ ;set breed products ;set color green ;set shape "substrate" ;set hidden? false ask partner [ set partner nobody set shape "enzyme" set color white set age age - 15] ;;Age lowers so enzyme won't die right after leaving complex. That would be confusing for the user set partner nobody die ] ] end to dissociate if partner != nobody and random Kd = 0 [set dissociated dissociated + 1 set pause-time -15 ask partner [ set partner nobody set hidden? false set locked-time 0] set partner nobody set shape "enzyme" set age age - 15 ;;Age lowers so enzyme won't die right after leaving complex. That would be confusing for the user ] end
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Fungal Bioremediation.png | preview | Model Image | almost 2 years ago, by Quinn Gebeaux | Download |
This model does not have any ancestors.
This model does not have any descendants.