breeds [ reds greens ] turtles-own [ stuck ] ;;; ;;; Setup procedures ;;; to setup ca setup-patches create-molecules 400 reds red create-molecules 400 greens green end to setup-patches draw-absorber erode draw-walls end to draw-absorber ask patches [ if abs pycor < thickness [ set pcolor blue ] ;; if wall-effect? is on, create two channels near the edges if wall-effect? and (abs pxcor > (screen-edge-x - 15)) [ set pcolor black ] ] end to draw-walls ask patches [ if abs pxcor > (screen-edge-x - 3) [ set pcolor (violet - 1) ] ] end to erode cct number-of-pores [ set xcor (random-float screen-size-x) - (5 * screen-size-x) set ycor thickness set color black pendown dig-tunnel 180 90 ] end ; tunnels are dug using random walks to dig-tunnel [direction wiggle] ;; turtle procedure loop [ if ycor < (- thickness) [ die ] set heading direction + wiggle - 2 * random-float wiggle fd 2 ] end to create-molecules [number new-breed new-color] cct number [ set xcor (screen-edge-x - 3) - random-float (2 * (screen-edge-x - 3)) set ycor thickness + random-float (screen-edge-y - thickness) set breed new-breed set color new-color set stuck 0 ] end ;;; ;;; Running the model ;;; to go ask turtles [ if (ycor < 1 - screen-edge-y) [ die ] wander ] if not any? turtles [ stop ] do-plot end ; The red turtles are inert and don't stick to the blue patches ; Green turtles stick to blue. When a green turtle encounters ; a blue patch its stuck variable is set to stickiness and then ; decreases with time. When stuck hits zero the particle is ; no longer stuck. to wander set heading (270 - random-float 180) ifelse stuck = 0 [ if (pcolor-of patch-ahead 1) = black [ fd 1 ] if (breed = greens) and ((pcolor-of patch-ahead 1) = blue) [ set stuck stickiness ] ] [ set stuck stuck - 1 ] end ;;; ;;; Plotting procedures ;;; ; We need to compute concentrations of reds and greens that made ; it thru the absorbing layer. to do-plot locals [reds-out greens-out total] set-current-plot "Gas Output" set-current-plot-pen "Reds" set reds-out (count reds with [ycor < (- thickness)]) plot (100 * reds-out) / 400 set-current-plot-pen "Greens" set greens-out (count greens with [ycor < (- thickness)]) plot (100 * greens-out) / 400 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 Gas Chromatography model. ; http://ccl.northwestern.edu/netlogo/models/GasChromatography. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; In other publications, please use: ; Copyright 1998 by Uri Wilensky. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/GasChromatography ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 320 10 693 404 60 60 3.0 0 10 1 1 1 CC-WINDOW 320 406 683 514 Command Center PLOT 3 215 318 419 Gas Output Time Molecules 0.0 500.0 0.0 25.0 true false PENS "Reds" 1.0 0 -65536 true "Greens" 1.0 0 -11352576 true SLIDER 162 60 290 93 thickness thickness 1 40 15 1 1 NIL SLIDER 150 153 302 186 number-of-pores number-of-pores 0 120 70 1 1 NIL SLIDER 153 108 296 141 stickiness stickiness 0 10 5 1 1 NIL SWITCH 9 111 128 144 wall-effect? wall-effect? 1 1 -1000 BUTTON 7 50 62 83 setup setup NIL 1 T OBSERVER T BUTTON 77 50 132 83 go go T 1 T OBSERVER NIL @#$#@#$#@ WHAT IS IT? ----------- This is a model of gas chromatography. Much of modern chemistry depends on chromatography for the separation of chemicals. (Gas chromatography is one form of chromatography, involving gases.) Chromatography can even be so sensitive as to separate enantiomers (i.e., molecules that differ only by being mirror images of each other!). Chromatography separates chemicals using surface interactions. The idea is simple. Different chemicals have different tendencies to move through small spaces (for example, if they are of different sizes) and different tendencies to stick to surfaces. This can be observed in everyday life. For example, if you put a drop of water and a drop of glue on an inclined plane, the water will roll off, but the glue will stick where it was. Single molecules, too, can stick very differently to surfaces. For instance, water vapor will condense on a cold glass, but the oxygen in the air will not. This is because the bonds that oxygen can make with glass are not strong enough to hold the oxygen there. It takes only a small step to imagine using the different stickiness of molecules to separate them. Practically, in gas chromatography molecules are forced to pass through a porous medium, which acts as the sticky surface. A porous medium is a material that has holes in it -- like swiss cheese, but these holes are microscopic in size. The holes allow molecules to pass from one side of the medium to the other. One example would be packed silica. Under a microscope, packed silica looks not unlike a lump of wood shavings, so molecules can go through it like water would through the wood shavings. On the screen, the blue area represents the porous medium. The molecules start at the top; they are collected at the bottom. The red and green particles represent two different kind of molecules. (In real gas chromatography, these would typically be carried by an inert gas. The inert gas is forced through the medium by applying pressure. But gas chromatography can also be used to simply separate gases without a carrier.) Molecules in this model wander randomly downward through the medium. Red molecules don't stick to the medium, but green molecules do. Chemically, this is caused by a number of factors: surface interactions, geometry and size of the molecule, etc. The amount of stickiness is controlled by a slider. For example, if the stickiness is set to five, then green molecules sticks to each part of the blue medium for five cycles, essentially slowing its downward motion when compared to the red molecules. This leads to separation. This model also attempts to demonstrate the concept of "wall effect". If there is some space near the walls then the molecules can get through these channels. This will drastically reduce the quality of separation. The empty space near the walls may result from bad quality of absorber or from inadequate stuffing. HOW TO USE IT ------------- First set the porosity of the blue absorber with the NUMBER-OF-PORES slider. You can change the thickness of the absorbent layer with a slider named THICKNESS. The WALL-EFFECT? switch turns the wall effect on and off. To run the model, press SETUP, then press GO. The STICKINESS slider changes the stickiness parameter. The higher the value of stickiness the slower the green turtles move through absorbing layer. RUNNING the MODEL ----------------- The program works fastest when STICKINESS is between 3 and 7 and when NUMBER-OF-PORES is over 30. If STICKINESS is too high, or NUMBER-OF-PORES is too small, it might take a long time for the green turtles to pass through the absorbing layer. THINGS TO NOTICE ---------------- Separation depends on porosity. If porosity is too small the absorbent gets contaminated and clogged up and the process stops. If porosity is too high then there is not enough separation. Also wall effect reduces the quality of separation in a drastic way. THINGS TO TRY ------------- One could try to improve the plotting routine. In a real chromatograph there is only one output curve showing the rate at which molecules come out and a device called an integrator that tells the amount of matter that has come out. Try separating more than two gases. NETLOGO FEATURES ----------------- Notice the routine that digs tunnels. It is very easy to implement parallel random walk algorithms with NetLogo. CREDITS AND REFERENCES ---------------------- To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Gas Chromatography model. http://ccl.northwestern.edu/netlogo/models/GasChromatography. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 1998 by Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/GasChromatography for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 arrow true 0 Polygon -7566196 true true 150 300 300 150 195 150 195 7 105 7 105 150 105 150 0 150 box true 0 Polygon -7566196 true true 45 255 255 255 255 45 45 45 circle true 0 Circle -7566196 true true 35 35 230 person false 0 Circle -7566196 true true 155 20 63 Rectangle -7566196 true true 158 79 217 164 Polygon -7566196 true true 158 81 110 129 131 143 158 109 165 110 Polygon -7566196 true true 216 83 267 123 248 143 215 107 Polygon -7566196 true true 167 163 145 234 183 234 183 163 Polygon -7566196 true true 195 163 195 233 227 233 206 159 spacecraft true 0 Polygon -7566196 true true 150 300 120 165 45 45 75 60 150 120 225 60 255 45 180 165 thin-arrow true 0 Polygon -7566196 true true 150 300 300 150 180 150 180 4 120 4 120 150 120 150 0 150 truck-down false 0 Polygon -7566196 true true 225 30 225 270 120 270 105 210 60 180 45 30 105 60 105 30 Polygon -8716033 true false 195 75 195 120 240 120 240 75 Polygon -8716033 true false 195 225 195 180 240 180 240 225 truck-left false 0 Polygon -7566196 true true 120 135 225 135 225 210 75 210 75 165 105 165 Polygon -8716033 true false 90 210 105 225 120 210 Polygon -8716033 true false 180 210 195 225 210 210 truck-right false 0 Polygon -7566196 true true 180 135 75 135 75 210 225 210 225 165 195 165 Polygon -8716033 true false 210 210 195 225 180 210 Polygon -8716033 true false 120 210 105 225 90 210 turtle true 0 Polygon -7566196 true true 138 75 162 75 165 105 225 105 225 142 195 135 195 187 225 195 225 225 195 217 195 202 105 202 105 217 75 225 75 195 105 187 105 135 75 142 75 105 135 105 @#$#@#$#@ NetLogo 2.0beta5 @#$#@#$#@ setup repeat 125 [ go ] @#$#@#$#@ @#$#@#$#@