globals [ initial-green-trees ;; how many trees (green patches) we started with initial-brown-trees ;; how many trees (brown patches) we started with total-initial ;; total number of green and brown trees burned-green-trees ;; how many green trees have burned so far burned-brown-trees ;; how many brown trees have burned so far total-burned ;; total number of burned trees ] patches-own [ burned? ;; has this tree burned yet? ] to setup ca ask patches [ set burned? false ;; put a wall around the forest to prevent "wrapping" if (pxcor = (0 - screen-edge-x)) or (pycor = (0 - screen-edge-y)) or (pycor = screen-edge-y) [ set pcolor blue ] ;; make some green(live) trees if pcolor != blue and pxcor > (1 - screen-edge-x) [ if (random 100) < density_green_trees [ set pcolor green ] ] ;; make some brown(dead) trees if pcolor != blue and pcolor != green and pxcor > (1 - screen-edge-x) [ if (random 100) < density_dead_trees [ set pcolor brown ] ] ;; make a column of burning trees if pcolor != blue and pxcor = (1 - screen-edge-y) [ if (random 100) < density_fire [ set pcolor red set burned? true ] ] ] set initial-green-trees count patches with [pcolor = green] set initial-brown-trees count patches with [pcolor = brown] set burned-green-trees 0 set burned-brown-trees 0 set total-burned 0 set total-initial initial-green-trees + initial-brown-trees end to go if not any patches with [burning?] [ stop ] ask patches with [pcolor = green] [ if any neighbors with [burned?] [ set pcolor red set burned-green-trees burned-green-trees + 1 set total-burned total-burned + 1 ] ] ask patches with [pcolor = brown] [ if any neighbors4 with [burned?] [ set pcolor red set burned-brown-trees burned-brown-trees + 1 set total-burned total-burned + 1] ] ask patches with [pcolor = red] ;EAST WIND [ if East_Wind? [ask patch-at 2 0 [ if pcolor = green [ set pcolor red set burned-green-trees burned-green-trees + 1 set total-burned total-burned + 1 ] if pcolor = brown [ set pcolor brown set burned-brown-trees burned-brown-trees + 1 set total-burned total-burned + 1 ] ] ] ] ask patches with [pcolor = red] ;NORTH WIND [ if North_Wind? [ ask patch-at 0 2 [ if pcolor = green [ set pcolor red set burned-green-trees burned-green-trees + 1 set total-burned total-burned + 1 ] if pcolor = brown [ set pcolor brown set burned-brown-trees burned-brown-trees + 1 set total-burned total-burned + 1 ] ] ] ] ask patches with [pcolor = red] ;SOUTH WIND [ if South_Wind? [ask patch-at 0 -2 [ if pcolor = green [ set pcolor red set burned-green-trees burned-green-trees + 1 set total-burned total-burned + 1 ] if pcolor = brown [ set pcolor brown set burned-brown-trees burned-brown-trees + 1 set total-burned total-burned + 1 ] ] ] ] ;; having these two separate "ask patches" commands ;; ensures that all patches have inspected their ;; neighbors' burned? variable before any newly ;; burned patches set that variable to true -- this ;; ensures that the fire only spreads a distance of ;; one patch per turn ask patches with [burning?] [ set burned? true set pcolor pcolor - 0.3 ] end to-report burning? ;; patch procedure report (pcolor > (red - 4)) and (pcolor < (red + 1)) end to-report total-trees-burned ifelse (total-initial) > 0 [ report (total-burned / total-initial) * 100 ] [ report 0 ] end to-report green-trees-burned ifelse (initial-green-trees > 0 ) [ report (burned-green-trees / initial-green-trees ) * 100 ] [ report 0 ] end to-report brown-trees-burned ifelse (initial-brown-trees > 0 ) [ report (burned-brown-trees / initial-brown-trees ) * 100 ] [ report 0 ] end ; *** NetLogo Model Copyright Notice *** ; ; This model was created as part of the project: CONNECTED MATHEMATICS: ; MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL ; MODELS (OBPML). The project gratefully acknowledges the support of the ; National Science Foundation (Applications of Advanced Technologies ; Program) -- grant numbers RED #9552950 and REC #9632612. ; ; Copyright 1998 by Uri Wilensky. All rights reserved. ; ; Permission to use, modify or redistribute this model is hereby granted, ; provided that both of the following requirements are followed: ; a) this copyright notice is included. ; b) this model will not be redistributed for profit without permission ; from Uri Wilensky. ; Contact Uri Wilensky for appropriate licenses for redistribution for ; profit. ; ; This model was converted to NetLogo as part of the project: ; PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN ; CLASSROOMS. The project gratefully acknowledges the support of the ; National Science Foundation (REPP program) -- grant number REC #9814682. ; Converted from StarLogoT to NetLogo, 2001. Updated 2002. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (1998). NetLogo Fire model. ; http://ccl.northwestern.edu/netlogo/models/Fire. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 257 10 684 437 30 30 7.0 1 10 0 0 CC-WINDOW 281 454 636 551 Command Center MONITOR 47 453 194 502 Total Trees Burned % total-trees-burned 1 1 SLIDER 7 109 254 142 density_green_trees density_green_trees 0.0 99.0 16.0 1.0 1 % BUTTON 137 23 206 59 go go T 1 T OBSERVER BUTTON 57 23 127 59 setup setup NIL 1 T OBSERVER SLIDER 7 156 252 189 density_dead_trees density_dead_trees 0 100 22 1 1 % MONITOR 49 325 198 374 Green Trees Burned % green-trees-burned 1 1 MONITOR 47 387 195 436 Brown Trees Burned % brown-trees-burned 1 1 SLIDER 7 62 253 95 density_fire density_fire 0 100 100 1 1 % SWITCH 56 196 188 229 East_Wind? East_Wind? 0 1 -1000 SWITCH 58 278 188 311 North_Wind? North_Wind? 0 1 -1000 SWITCH 56 235 187 268 South_Wind? South_Wind? 0 1 -1000 @#$#@#$#@ WHAT IS IT? ----------- This project simulates the spread of a fire through a forest. The fire starts on the left edge of the forest, and spreads to neighboring trees. The fire spreads in four directions: north, east, south, and west. The fire can spread in all eight directions if it spreads to a green tree and four directions (north, east, south, and west) if it spreads to a dead (brown) tree. There is no wind in this particular model as it is. So, the fire must have trees along its path in order to advance. That is, the fire cannot skip over an unwooded area (patch), so such a patch blocks the fire's motion in that specific direction The fire's chance of reaching the right edge of the forest depends critically on the density of live(green) and dead(brown) trees in the forest. HOW TO USE IT ------------- Click the SETUP button to set up the trees (green) and fire (red on the left-hand side). Click the GO button to start the simulation. The North_Wind?, South_Wind?, and East_Wind? buttons activate the wind condition factor. When they are turned on, the fire can spread 2 spaces in that direction if there is a green patch The density_fire slider controls the density of the originating fire in the forest. The density_green_trees slider controls the density of the green trees in the forest. The density_brown_trees slider controls the density of the brown trees in the forest. (Note: Changes in the DENSITY slider do not take effect until the next SETUP.) THINGS TO NOTICE ---------------- Set the density of green trees to 20% and the density of brown trees to 10%. At this setting, there is virtually no chance that the fire will reach the right edge of the forest. Set the density of green trees to 50%. At this setting, it is almost certain that the fire will reach the right edge. There is a sharp transition around 38% density. At 38% density, the fire has about a 50/50 chance of reaching the right edge. Also when the east wind is turned on, the fire spreads farther. The south and north winds don't seem to affect the fire as much. The blue "walls" prevent the fire from spreading off the edges of the screen. Because no turtles are moving on the screen, one could say that the motion of the fire is a construction in our mind. This is an example of an emergent phenomena: each tree is either burning or not burning, but these collective local behaviors amount to an overall effect. The effect (moving fire) is created by the local agents (trees, here), even though it is not experienced by the local agents. So is an emergent phenomenon the same as an optical illusion? That is, do you think that the motion of fire is an optical illusion? Is this the same as the illusion of motion running through a sequence of flashing neon lights? If not, why not? Arguably, there is no "thing" running along the neon lights - just lights flashing. So, is fire a "thing" at all? If not, then how can it move? Moreover, how can it burn? NETLOGO FEATURES ----------------- This project uses only patches, no turtles. Green trees use the "neighbors" primitive and brown trees use the "neighbors4" primitive to determine whether any of the surrounding trees are on fire. Notice how the program gradually decreases the patch color of the red patches to achieve the visual effect of burning out. CREDITS AND REFERENCES ---------------------- This model was developed at the MIT Media Lab. See Resnick, M. (1994) "Turtles, Termites and Traffic Jams: Explorations in Massively Parallel Microworlds." Cambridge, Ma: MIT Press. Adapted to StarLogoT, 1997, as part of the Connected Mathematics Project. Adapted to NetLogo, 2000, as part of the Participatory Simulations Project. To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Fire model. http://ccl.northwestern.edu/netlogo/models/Fire. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 @#$#@#$#@ NetLogo 1.2beta2 @#$#@#$#@ @#$#@#$#@ @#$#@#$#@