This page was automatically generated by NetLogo 5.0.5.
The applet requires Java 5 or higher. Java must be enabled in your browser settings. Mac users must have Mac OS X 10.4 or higher. Windows and Linux users may obtain the latest Java from Oracle's Java site.
In order for this to work, this file, your model file (Quabbin_3-31-09.nlogo), and the files NetLogoLite.jar and NetLogoLite.jar.pack.gz must all be in the same directory. (You can copy NetLogoLite.jar and NetLogoLite.jar.pack.gz from the directory where you installed NetLogo.)
On some systems, you can test the applet locally on your computer before uploading it to a web server. It doesn't work on all systems, though, so if it doesn't work from your hard drive, please try uploading it to a web server.
You don't need to include everything in this file in your page. If you want, you can just take the HTML code beginning with <applet> and ending with </applet>, and paste it into any HTML file you want. It's even OK to put multiple <applet> tags on a single page.
If the NetLogoLite files and your model are in different directories, you must modify the archive= and value= lines in the HTML code to point to their actual locations. (For example, if you have multiple applets in different directories on the same web server, you may want to put a single copy of the NetLogoLite files in one central place and change the archive= lines of all the HTML files to point to that one central copy. This will save disk space for you and download time for your users.)
powered by NetLogo
view/download model file: Quabbin_3-31-09.nlogo
This section could give a general understanding of what the model is trying to show or explain.
This section could explain what rules the agents use to create the overall behavior of the model.
This section could explain how to use the model, including a description of each of the items in the interface tab.
This section could give some ideas of things for the user to notice while running the model.
This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with 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.
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.
This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.
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.
globals [ sp_param colorlist Tjan Tjuly] breed [trees tree] breed [speciesnames speciesname] patches-own [ steepness soiltype moisture elevation trees-on-plot temperature light_available_at_floor] trees-own [ age species species_index diameter height diametermax diameter-growth heightmax G B2 B3 agemax canopy leaf_index light_type light_available light_relative_growth growth_modifier status DEGD DEGDmax DEGDmin TDEGD TF ba max_saplings_per_year] speciesnames-own [ speciesindex colorindex species0 diametermax0 heightmax0 G0 B20 B30 agemax0 leaf_index0 light_type0 growth_modifier0 DEGD0 DEGDmax0 DEGDmin0 TDEGD0 max_saplings_per_year0 ] ;; ba is basal area in square meters, diameter is in cm ;; status used in 1990 & 2000: 1=new 2=growing 3=standing dead 4=fallen 5=cut to setup ;; (for this model to work with NetLogo's new plotting features, ;; __clear-all-and-reset-ticks should be replaced with clear-all at ;; the beginning of your setup procedure and reset-ticks at the end ;; of the procedure.) __clear-all-and-reset-ticks load-species-data set-default-shape trees "tree" initialize_1980 ask patches [ set pcolor brown + 1 + random-float 1 ] do-histogram end to clearcut ask trees with [ycor < 5 and ycor > 2] [ die ] end ;; This procedure loads in the parameters for tree species 1 in the order speciesnumber agemax diametermax heightmax B2 B3 G leaf_index light_type to load-species-data ifelse ( file-exists? "SpeciesParameterData.txt" ) [ ;; We check to make sure the file exists first set sp_param [] ;; We will save the data into a matrix, initialized to be empty. set colorlist [ 54 45 13 15 17 73 6 66 96 ] file-open "SpeciesParameterData.txt" ;; This opens the file, so we can read it. let spnum 0 while [ not file-at-end? ] [ ;; Reads data for each species in file. set sp_param sentence sp_param (list (list file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read file-read)) ;; Each iteration we append the next 13-tuple to the current matrix (as a new row); indexing starts at 0 create-speciesnames 1 [ set speciesindex spnum set species0 item 0 item spnum sp_param set agemax0 item 1 item spnum sp_param set diametermax0 item 2 item spnum sp_param set heightmax0 item 3 item spnum sp_param set B20 item 4 item spnum sp_param set B30 item 5 item spnum sp_param set G0 item 6 item spnum sp_param set leaf_index0 item 7 item spnum sp_param set light_type0 item 8 item spnum sp_param set DEGDmin0 item 9 item spnum sp_param set DEGDmax0 item 10 item spnum sp_param set growth_modifier0 item 11 item spnum sp_param set max_saplings_per_year0 item 12 item spnum sp_param set colorindex item spnum colorlist hide-turtle ] set spnum spnum + 1 ] file-close ;; Done reading in patch information. Close the file. ] [ user-message "There is no SpeciesParameterData.txt file in current directory!" ];; reports error if no such file end to initialize_1980 ifelse ( file-exists? "Plot206diameters.txt" ) [ ;; We check to make sure the file exists first file-open "Plot206diameters.txt" ;; This opens the file, so we can read it. while [ not file-at-end? ] [ ;; Reads diameter of each tree in file. create-trees 1 [ let spnum file-read set species_index spnum set species item 0 item spnum sp_param set diameter file-read;;cm set color item spnum colorlist set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (random-float 4 - 0.5) (random-float 2 - 0.5) ;; random position within world set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax ;; rough estimate of age in years using agemax*diameter/diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param ] ] file-close ;; Done reading in patch information. Close the file. ] [ user-message "There is no Plot206diameters.txt file in current directory!" ];; reports error if no such file ifelse ( file-exists? "Plot346diameters.txt" ) [ ;; We check to make sure the file exists first file-open "Plot346diameters.txt" ;; This opens the file, so we can read it. while [ not file-at-end? ] [ ;; Reads diameter of each tree in file. create-trees 1 [ let spnum file-read set species_index spnum set species item 0 item spnum sp_param set diameter file-read;;cm set color item spnum colorlist set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (random-float 4 - 0.5) (random-float 2 + 1.5) ;; random position within world set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax ;; rough estimate of age in years using agemax*diameter/diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param ] ] file-close ;; Done reading in patch information. Close the file. ] [ user-message "There is no Plot346diameters.txt file in current directory!" ];; reports error if no such file ifelse ( file-exists? "Plot401diameters.txt" ) [ ;; We check to make sure the file exists first file-open "Plot401diameters.txt" ;; This opens the file, so we can read it. while [ not file-at-end? ] [ ;; Reads diameter of each tree in file. create-trees 1 [ let spnum file-read set species_index spnum set species item 0 item spnum sp_param set diameter file-read;;cm set color item spnum colorlist set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (random-float 4 - 0.5) (random-float 2 + 3.5) ;; random position within world set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax ;; rough estimate of age in years using agemax*diameter/diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param ] ] file-close ;; Done reading in patch information. Close the file. ] [ user-message "There is no Plot401diameters.txt file in current directory!" ];; reports error if no such file ifelse ( file-exists? "Plot540diameters.txt" ) [ ;; We check to make sure the file exists first file-open "Plot540diameters.txt" ;; This opens the file, so we can read it. while [ not file-at-end? ] [ ;; Reads diameter of each tree in file. create-trees 1 [ let spnum file-read set species_index spnum set species item 0 item spnum sp_param set diameter file-read;;cm set color item spnum colorlist set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (random-float 4 - 0.5) (random-float 2 + 5.5) ;; random position within world set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax ;; rough estimate of age in years using agemax*diameter/diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param ] ] file-close ;; Done reading in patch information. Close the file. ] [ user-message "There is no Plot540diameters.txt file in current directory!" ];; reports error if no such file end to go ;ifelse stop_after_20 [ ; if ticks = 20 ; [ do-histogram ; stop ]] ; [do-histogram] set Tjan 24 + Temp_change set Tjuly 70 + Temp_change mortality calculate_light grow ;; trees regenerate do-plots do-histogram ;ask trees with [status = 2] [ set label round diameter ] tick end to mortality ask trees with [status = 2] [ let prob_die (2.987 * (age / agemax) ^ 6 - 8.960 * (age / agemax) ^ 5 + 10.907 * (age / agemax) ^ 4 - 6.880 * (age / agemax) ^ 3 + 2.447 * (age / agemax) ^ 2 - 0.500 * (age / agemax) + 0.05) if random-float 1 < prob_die [;set status 3 ;set color brown die ] ] end to grow ask trees with [status = 2] [ set diameter-growth (G * diameter * ((1 - (diameter * (137 + (B2 * diameter) - (B3 * diameter ^ 2))) / (diametermax * heightmax)) * (light_relative_growth * TF * growth_modifier)) / (274 + (3 * B2 * diameter) - (4 * B3 * diameter ^ 2))) set diameter diameter + diameter-growth set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set age age + 1 set ba pi * (diameter / 200) ^ 2 set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size ] end to calculate_light ;; need to include environmental fudge factor ask trees with [status = 2] [ let currh height ; ifelse patch-based-light [ set canopy trees-here with [height > currh and status = 2] set light_available Exp (-1 * sum [leaf_index * (diameter ^ 2) * 0.0000756] of canopy);] ;[ set canopy other trees in-radius .5 with [height > currh and status < 4] ;;change trees affecting light to be within a certain radius of the tree, rather than the tree's patch ; ifelse any? canopy ; [ let currx xcor ; let curry ycor ; set light_available Exp (-1 * sum [leaf_index * (diameter ^ 2) * 0.0000756] of canopy / (1 + sum [sqrt((currx - xcor) ^ 2 + (curry - ycor) ^ 2)] of canopy )) ] ;;weights how much trees affect the light of other trees by their distance ; [ set light_available 1 ] ;] if light_type = 1 [set light_relative_growth 1.218 * (1 - Exp (-1.136 * light_available - .097 )) ] if light_type = 2 [set light_relative_growth 0.9875 * (1 - Exp (-4.62 * light_available - .0637 )) ] if light_type = 3 [set light_relative_growth 1.045 * (1 - Exp (-5.3592 * light_available - .0637 )) ] if light_relative_growth < 0 [set light_relative_growth 0] set DEGD ((365 / (2 * 3.14)) * (Tjuly - Tjan)) - ((365 / 3.14) * (40 - ((Tjuly + Tjan) / 2 ))) + (365 / 3.14) * (((40 - ((Tjuly - Tjan) / 2)) ^ 2) / (Tjuly - Tjan) ) set TDEGD (4 * (DEGD - DEGDmin) * (DEGDmax - DEGD)) / ((DEGDmax - DEGDmin) ^ 2) ifelse TDEGD > 0 [set TF TDEGD] [set TF 0] ] end to regenerate ask patches [ set light_available_at_floor Exp (-1 * sum [leaf_index * (diameter ^ 2) * 0.0000756] of trees-here with [status = 2]) let xx pxcor let yy pycor ifelse light_available_at_floor > 0.5 [ let light_relative_gr 1.218 * (1 - Exp (-1.136 * light_available_at_floor - .097 )) ; environmental factor ? ask speciesnames with [ light_type0 = 1 ] [ let spnum speciesindex hatch-trees round random-float ( light_relative_gr * max_saplings_per_year0) [ set species_index spnum set species item 0 item spnum sp_param set diameter random-float 10 + 10;;cm set color item spnum colorlist;51 + species_index set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (xx - 0.5 + random-float 1) (yy - 0.5 + random-float 1) set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param show-turtle ]]] [ ifelse light_available_at_floor > 0.12 [ let light_relative_gr 0.9875 * (1 - Exp (-4.62 * light_available_at_floor - .0637 )) ask speciesnames with [ light_type0 = 2 ] [ let spnum speciesindex hatch-trees round random-float ( light_relative_gr * max_saplings_per_year0) [ set species_index spnum set species item 0 item spnum sp_param set diameter random-float 10 + 10;;cm set color item spnum colorlist;51 + species_index set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (xx - 0.5 + random-float 1) (yy - 0.5 + random-float 1) set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param show-turtle ]] ] [ let light_relative_gr 1.045 * (1 - Exp (-5.3592 * light_available_at_floor - .0637 )) ask speciesnames with [ light_type0 = 3 ] [ let spnum speciesindex hatch-trees round random-float ( light_relative_gr * max_saplings_per_year0) [ set species_index spnum set species item 0 item spnum sp_param set diameter random-float 10 + 10;;cm set color item spnum colorlist;51 + species_index set diametermax item 2 item spnum sp_param set size diameter / diametermax / 1 ;;scale by diameter to indicate relative size setxy (xx - 0.5 + random-float 1) (yy - 0.5 + random-float 1) set ba pi * (diameter / 200) ^ 2 ;; in square meters set agemax item 1 item spnum sp_param set age agemax * diameter / diametermax set heightmax item 3 item spnum sp_param set B2 item 4 item spnum sp_param set B3 item 5 item spnum sp_param set G item 6 item spnum sp_param set height 137 + (B2 * diameter) - (B3 * diameter ^ 2) set leaf_index item 7 item spnum sp_param set light_type item 8 item spnum sp_param set DEGDmin item 9 item spnum sp_param set DEGDmax item 10 item spnum sp_param set status 2 set growth_modifier item 11 item spnum sp_param set max_saplings_per_year item 12 item spnum sp_param show-turtle ]]] ] ] end to do-plots set-current-plot "Number of growing trees per 100 sq m" set-plot-x-range 0 100 set-plot-y-range 0 10 set-current-plot-pen "WhitePine" plot count trees with [species = 1 and status = 2] / count patches ;* 8 set-current-plot-pen "Hemlock" plot count trees with [species = 6 and status = 2] / count patches ;* 8 set-current-plot-pen "RedPine" plot count trees with [species = 11 and status = 2] / count patches ;* 8 set-current-plot-pen "RedMaple" plot count trees with [species = 21 and status = 2] / count patches ;* 8 set-current-plot-pen "RedOak" plot count trees with [species = 30 and status = 2] / count patches ;* 8 set-current-plot-pen "BlackOak" plot count trees with [species = 31 and status = 2] / count patches ;* 8 set-current-plot-pen "WhiteOak" plot count trees with [species = 40 and status = 2] / count patches ;* 8 set-current-plot-pen "BlackBirch" plot count trees with [species = 51 and status = 2] / count patches ;* 8 set-current-plot-pen "WhiteAsh" plot count trees with [species = 55 and status = 2] / count patches ;* 8 ; set-current-plot "Basal area of trees per 100 sq m" ; set-plot-x-range 0 100 ; set-plot-y-range 0 1.5 ; set-current-plot-pen "WhitePine" ; plot sum [ ba ] of trees with [species = 1 and status = 2] / count patches ;* 8 ;; report basal area in square meters ; set-current-plot-pen "Hemlock" ; plot sum [ ba ] of trees with [species = 6 and status = 2] / count patches ;* 8 ; set-current-plot-pen "RedPine" ; plot sum [ ba ] of trees with [species = 11 and status = 2] / count patches ;* 8 ; set-current-plot-pen "RedMaple" ; plot sum [ ba ] of trees with [species = 21 and status = 2] / count patches ;* 8 ; set-current-plot-pen "RedOak" ; plot sum [ ba ] of trees with [species = 30 and status = 2] / count patches ;* 8 ; set-current-plot-pen "BlackOak" ; plot sum [ ba ] of trees with [species = 31 and status = 2] / count patches ;* 8 ; set-current-plot-pen "WhiteOak" ; plot sum [ ba ] of trees with [species = 40 and status = 2] / count patches ;* 8 ; set-current-plot-pen "BlackBirch" ; plot sum [ ba ] of trees with [species = 51 and status = 2] / count patches ;* 8 ; set-current-plot-pen "WhiteAsh" ; plot sum [ ba ] of trees with [species = 55 and status = 2] / count patches ;* 8 end to do-histogram set-current-plot "Histogram of white pine diameters" set-plot-x-range 0 100 set-plot-y-range 0 1 set-current-plot-pen "Species1" ;set-histogram-num-bars 10 histogram [diameter] of trees with [species = 1 and status = 2] set-current-plot "Histogram of red maple diameters" set-plot-x-range 0 100 set-plot-y-range 0 1 set-current-plot-pen "Species21" ;set-histogram-num-bars 10 histogram [diameter] of trees with [species = 21 and status = 2] ; set-current-plot "Histogram of black birch diameters" ; set-plot-x-range 0 100 ; set-plot-y-range 0 1 ; set-current-plot-pen "BlackBirch" ; ;set-histogram-num-bars 10 ; histogram [diameter] of trees with [species = 30 and status = 2 ] ; set-current-plot "Histogram of population of each species" ; set-plot-x-range 0 9 ; set-plot-y-range 0 5 ; set-current-plot-pen "default" ; set-plot-pen-mode 1 ; set-plot-pen-interval 1 ; histogram [species_index] of trees with [status = 2] end