patches-own [ x y rod? ] globals [ power old-power old-power-2 ; Used to compute average-power old-power-3 ; Used to compute average-power old-power-4 ; Used to compute average-power average-power power-change rod-length n-rods ; Number of rods r ; Constant for half the reactor size ] to setup ca setup-globals ask patches [ set x (abs pxcor) set y (abs pycor) set rod? false build-reactor setup-nuclear-fuel ] setup-control-rods setup-plot plot-power end to setup-globals set power 0 set old-power 0 set old-power-2 0 set old-power-3 0 set old-power-4 0 set r (reactor-size / 2) set rod-length rod-depth set n-rods (reactor-size / (rod-spacing + 1)) - 1 end to build-reactor ;; Patch Procedure if ((x = r) and (y <= r)) or ((y = r) and (x <= r)) [ set pcolor grey set rod? false ] end to setup-nuclear-fuel ;; Patch Procedure if (pcolor = black) and (x < r) and (y < r) [ set pcolor red ] end to setup-control-rods locals [ rod-x ] if rod-depth > reactor-size [set rod-depth reactor-size] if (rod-spacing = 5 or rod-spacing = 6 and reactor-size = 10) [ show "Spacing too large for reactor size. Spacing set to 4." set rod-spacing 4 set n-rods 1 ] set rod-x 1 - r + rod-spacing ;; Make the rods more evenly spaced at particular settings if (rod-spacing = 2 and reactor-size != 30 and reactor-size != 60) [ set rod-x rod-x + 1 ] if (rod-spacing = 3 and (reactor-size mod 20) != 0) [ set n-rods n-rods + 1 set rod-x rod-x - 1 ] if (rod-spacing = 5 and (reactor-size = 20 or reactor-size = 40 or reactor-size = 70)) [ ifelse (reactor-size = 20) [ set rod-x rod-x + 1 ] [ set rod-x rod-x + 2 ] ] if (rod-spacing = 6 and (reactor-size mod 20) = 0) [ set n-rods n-rods + 1 ifelse (reactor-size = 80) [ set rod-x rod-x - 2 ] [ set rod-x rod-x - 1 ] ] repeat n-rods [ ask patches with [ pxcor = rod-x ] [ set rod? true ] set rod-x rod-x + rod-spacing + 1 ] ask patches [ build-reactor ] place-control-rods end to setup-plot set-current-plot "power-plot" set-plot-y-range 0 (3 * power-rated) end ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Run Time Procedures ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;Forever Button to auto-react ifelse power-change >= 0 [ if (power - power-rated) >= 0 [ set rod-length ( rod-length + 50 ) ] ] [ if (power - power-rated) < 0 [ set rod-length ( rod-length - 10 ) ] ] if rod-length < 0 [ set rod-length 0 ] if rod-length > reactor-size [ set rod-length reactor-size ] react if not any? turtles [stop] end ;;Forever Button to manu-react if rod-depth > reactor-size [set rod-depth reactor-size] set rod-length rod-depth react if not any? turtles [stop] end to react place-control-rods set power 0 ask turtles [ fd 1 if (pcolor = grey or pcolor = cyan) [ die ] if (pcolor = red) [ fission ] ] set average-power ((power + old-power + old-power-2 + old-power-3 + old-power-4) / 5) set power-change (power - old-power) set old-power-4 old-power-3 set old-power-3 old-power-2 set old-power-2 old-power set old-power power plot-power end to release-neutron ;; Button locals [whom] cct 1 [ set color yellow set xcor ((random (reactor-size - 2)) - r) set ycor ((random (reactor-size - 2)) - r) rt random 360 set whom who if (pcolor = cyan) [ die ] ] if turtle whom = nobody [ release-neutron ] end to place-control-rods ask patches with [ rod? ] [ ifelse (pycor >= (r - rod-length)) [ set pcolor cyan ] [ set pcolor black ] ] end to fission ;; Turtle Procedure locals [ gain ] rt random 360 if (pcolor = red) [ if (spend-fuel?) [ stamp brown ] set gain (1 / count turtles-here) set power power + gain hatch ((2 + random 2) * gain) [ rt random 360 ] ] end to plot-power set-current-plot-pen "power-rated" plot power-rated set-current-plot-pen "avg-power" plot average-power end ; *** NetLogo Model Copyright Notice *** ; ; This model was originally 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 Reactor X-Section model. ; http://ccl.northwestern.edu/netlogo/models/ReactorX-Section. ; 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/ReactorX-Section ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 276 11 650 406 45 45 4.0 0 10 1 1 1 CC-WINDOW 276 414 640 536 Command Center SLIDER 9 140 159 173 power-rated power-rated 0.0 100.0 35.0 1.0 1 NIL SLIDER 9 41 159 74 reactor-size reactor-size 10 80 70 10 1 NIL BUTTON 9 263 91 296 Setup setup NIL 1 T OBSERVER T BUTTON 183 263 269 296 Manual manu-react T 1 T OBSERVER T BUTTON 91 263 183 296 Automatic auto-react T 1 T OBSERVER T MONITOR 167 41 268 90 Power power 3 1 MONITOR 167 91 268 140 Power change power-change 3 1 PLOT 9 301 269 497 power-plot time power 0.0 250.0 0.0 105.0 true false PENS "power-rated" 1.0 0 -16776961 true "avg-power" 1.0 0 -65536 true SLIDER 9 181 159 214 rod-depth rod-depth 0 80 0 1 1 NIL BUTTON 106 223 269 256 Release Neutron release-neutron NIL 1 T OBSERVER T SLIDER 9 74 159 107 rod-spacing rod-spacing 1 6 4 1 1 NIL SWITCH 9 107 159 140 spend-fuel? spend-fuel? 0 1 -1000 @#$#@#$#@ WHAT IS IT? ----------- This project simulates a nuclear fission reaction in a nuclear power plant. In a fission reaction, free neutrons hit uranium atoms, causing each uranium atom to generate 2 or 3 neutrons and a unit of energy. The uranium atom itself splits into two smaller atoms. The newly generated neutrons, together with the neutron that caused the reaction, keep moving and continue to hit more uranium atoms, which release more neutrons, etc. This is the chain reaction that happens inside an atomic bomb. Most nuclear energy is used for peaceful purpose, however. Generated in a nuclear power plant, nuclear fission goes on in a much more controlled fashion. Heavy metal plates made of lead help to absorb the free neutrons, thus fewer atoms of uranium are smashed, which in turn limits how much energy is released. This model simulates the process of a nuclear fission reaction inside such a plant. The reactor core is built of concrete, with adjustable control rods to help control the speed of the reaction. The reactor has a built-in automatic controller, and has a set of manual controls as well. HOW TO USE IT ------------- -- The REACTOR-SIZE slider controls the size of the reactor. -- The ROD-SPACING slider controls the distance between the control rods. -- The SPEND-FUEL switch controls whether or not the fuel is used up when a neutron hits it. -- The POWER-RATED slider controls the rated power, which is used for automatic control. -- The ROD-DEPTH slider controls the rod depth when under manual control. -- The RELEASE NEUTRON button introduces a neutron into the reactor. It can be used at anytime before or during the reaction. Press the SETUP button to set up the reactor. When MANUAL is on, use the ROD-DEPTH slider to control the rod depth. If they are too short, too many neutrons can escape and the reactor will generate too much power. If they are too long, all free neutrons will be absorbed, and no power will be generated. When AUTO-REACT is on, the reactor will adjust itself as needed to keep power production under control. THE POWER monitor shows the current power output. The POWER-CHANGE monitor shows the change in power over the last clock tick. Look at the POWER-PLOT plot to see the power curve. THINGS TO NOTICE ---------------- Observe the fluctuation of the power curve. The blue line is the rated-power line and the red line is the actually generated power line. THINGS TO TRY ------------- There are two procedures, one for manual control, one for automatic control. (Respectively called 'manu-react' and 'auto-controller'.) The manual controls are very simple. The ROD-DEPTH slider controls how deep the control rods are inserted into the reactor. The automatic controller is basically an ON and OFF controller. It is based on 1) comparison of power generated and power rated and 2) the power change. The mechanism is described in the following table: | Power > Power Rated Power < Power Rated | ------------------- ------------------- | Power Change > 0: Increase Length Do Nothing | | Power Change < 0: Do nothing Decrease Length The controller should be fine-tuned, and the length to increase and decrease varies. * In Manual Mode: Use the slider to adjust the control rod length according to the information given through the two monitors and the plot. You want the power curve to be as flat as possible. The height of the curve should be close to the horizontal line representing the power-rate. * In Automatic Mode: Fine tune the controller by changing the mechanisms to get a flat power curve with the least fluctuation. EXTENDING THE MODEL ------------------- The automatic controller used is just an on and off controller. Try using Proportional, Integral and Differential (PID) controllers to make the reaction more smooth. You could also use some ideas of fuzzy logic (e.g. fuzzy membership) to build a fuzzy controller. Absorbing free neutrons to control the reaction process is only one of the control mechanisms and is not the most important one. The important factor in controlling the reaction is to keep the speed of a neutron lower than a certain level (to stimulate fission reaction). The speeds of free neutrons depend on the density of the steam. Higher density yields lower speed and vice-versa. This is by nature a negative feedback control mechanism. It works as follows. If generated power is high, then the steam temperature is high and the density of the steam is low, thus the speed of free neutrons is high and is less likely to stimulate fission reaction. Hence a lower generated power. Try to incorporate this process into the automatic controller. RELATED MODELS -------------- Together with the Nuclear Reactor (top-down) model you can get a decent representation of how a Nuclear Reactor might work in three dimensions. These two models are variations of one another based off of the Fission model from StarLogoT. NETLOGO FEATURES ----------------- More so than most other NetLogo models, the plot of 'Nuclear Reactor' plays an active role in the simulation. When using the manual controller, it is quite helpful to watch the power curve, to tell when things are getting out of hand. CREDITS AND REFERENCES ---------------------- To refer to this model in academic publications, please use: Wilensky, U. (1998). NetLogo Reactor X-Section model. http://ccl.northwestern.edu/netlogo/models/ReactorX-Section. 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/ReactorX-Section 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 release-neutron repeat 45 [ auto-react ] @#$#@#$#@ @#$#@#$#@