📄 ---strong acid.nlogo
字号:
breeds [ water ;; water molecules hydronium ;; acid molecules hydroxide ;; base molecules]hydronium-own [ reacting? ] ;; used to prevent hydroniums from reacting with more than one ;; hydroxide simultaneouslyglobals [ pH base-added ;; use to keep track of how much total base has been added]to setup ca set-default-shape water "molecule2" set-default-shape hydronium "molecule3" set-default-shape hydroxide "molecule1" create-custom-water 100 ;; creates constant volume of water in which to dilute acid [ set color blue ] create-custom-hydronium vol-acid ;; creates VOL-ACID of hydronium ions [ set color green set reacting? false ] ask turtles ;; randomize position and heading of turtles [ setxy (random screen-size-x) (random screen-size-y) rt random 360 ] set base-added 0 calculate-pH plot-pHendto go every ln (10 / speed) [ ask hydroxide [ react ] ask turtles [ fd 1 ;; move turtles randomly rt (random 10 - random 10) ] ;; around the screen calculate-pH plot-pH ]end;; adds hydroxide molecules to the solutionto add-base create-custom-hydroxide vol-base [ set color red fd 1 rt random 360 ] set base-added base-added + vol-baseend;; hydroxide procedureto react locals [ partner ] set partner random-one-of hydronium-here ;; tells hydroxide to recognize hydronium if (partner != nobody) ;; if you are a base molecule and you encounter a hydronium [ if not reacting?-of partner [ set reacting?-of partner true set breed-of partner water ;; then turn your partner into water set color-of partner blue set breed water ;; and turn yourself into water too set color blue ] ]end;; calculates the pH from the amount of the various ions in solution;;; note that for simplicity the calculations don't take the true molar;; concentration of water into account, but instead use an arbitrarily;; chosen factor of 1000 to produce numbers lying in a reasonable rangeto calculate-pH locals [ volume concH concOH pOH ] set volume count turtles set concH (count hydronium / volume) set concOH (count hydroxide / volume) ifelse (concH = concOH) [ set pH 7 ] [ ifelse (concH > concOH) [ set pH (0 - log (concH / 1000) 10) ] [ set pOH (0 - log (concOH / 1000) 10) set pH 14 - pOH ] ]end;; plotting proceduresto plot-pH set-current-plot "pH Curve" plot pHendto record-pH set-current-plot "Titration Curve" plotxy base-added pHend; ***NetLogo Model Copyright Notice***; This model was created 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.; Copyright 2001 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.; To refer to this model in academic publications, please use:; Wilensky, U. (2001). NetLogo Strong Acid model.; http://ccl.northwestern.edu/netlogo/models/StrongAcid.; Center for Connected Learning and Computer-Based Modeling,; Northwestern University, Evanston, IL.; ***End NetLogo Model Copyright Notice***@#$#@#$#@GRAPHICS-WINDOW33510685360121214.011000CC-WINDOW258365686495Command CenterMONITOR265186324235pHpH21SLIDER65319286vol-acidvol-acid0100311moleculesSLIDER687192120vol-basevol-base110010011moleculesBUTTON9107043setupsetupNIL1TOBSERVERSLIDER1431027043speedspeed1.010.09.20.11NILBUTTON761013743gogoT1TOBSERVERBUTTON2196629599add-baseadd-baseNIL1TOBSERVERBUTTON257327333360record pHrecord-pHNIL1TOBSERVERPLOT11319254495Titration CurveVolume basepH0.0100.00.014.0truefalsePENS"pH" 1.0 0 -16776961 truePLOT11134254317pH CurveTimepH0.0100.00.014.0truefalsePENS"pH" 1.0 0 -65536 true@#$#@#$#@WHAT IS IT?-----------This model demonstrates how chemists and biologists measure the pH of a solution. The value of pH, like many other chemical measurements, emerges from the interactions and relative ratios of the composite molecules within a solution.Specifically, pH is a measurement of the amount of hydronium ions (H+ or H3O+) that are present in a solution. Hydronium ions are generated when an acid molecule donates a proton to the a water molecule. Bases have the opposite effect on water -- they take a hydrogen from a water molecule and generate hydroxide ions (OH-). These two reactions are listed below. Note the balance of charge and conversion of atoms. H-A denotes a strong acid and B denotes a strong base. + - - +H 0 + H-A --------> H O + A B + H O --------> OH + H-B 2 3 2It is important to note that this model simulates a strong acid and a strong base interacting. Acids and bases that are classified as strong dissociate completely in water. That means that all the H-A is converted to hydronium ions and all of the B is protonated, so that concentration of the original acid is equal to the concentration of hydronium ion. pH meters are capable of detecting how many hydronium ions or hydroxide ions are present in a solution. The formula for measuring pH is listed below. One can also calculate the pOH in a similar manner. [] indicates concentration in MOLARITY. pH = -log [H+] pOH = -log [OH-]Hydronium ions and hydroxide ions are oppositely charged and react readily together. When they react, a hydrogen atom is transferred and two water molecules are generated in the process. Chemists often titrate acids and bases together to determine how stable the pH of a particular acid or base is. This experiment is done by taking a known amount of acid and adding various amounts of base to it. The titration curve is generated by plotting the pH against the volume of base added.HOW TO USE IT--------------Decide how much acid should be present at the start of the simulation with the VOL-ACID slider and press SETUP. Turtles will be distributed randomly across the screen. BLUE turtles represent water molecules and GREEN turtles represent hydronium ions. A set amount of water molecules is added each time to the solution.Press GO. The turtles will move randomly across the screen and the pH of the solution will be plotted over time and displayed in the pH monitor.To observe the effect of adding base to the solution, set the volume of base to be added with the VOL-BASE slider and press ADD-BASE to add the red base molecules.To perform a titration experiment, set the sliders to desired values and press GO. While the model is running, press ADD-BASE. This will add VOL-BASE to the acid on the screen. Wait for the pH to stabilize as you would in a real experiment and then press RECORD-PH. A point is then plotted on the curve with each addition of base so that the user can observe how the value of pH is related to the amount of base added to the solution.THINGS TO NOTICE----------------Observe the shape of the titration curve, especially where the slope approaches one. Can you explain this phenomenon? What are the minimum and maximum values of pH in this model? Can you think of a way to alter their values?Why are there no acid molecules in the simulation? Similarly, why aren't A and H-B shown in the model?THINGS TO TRY-------------Plot a titration curve using various settings of VOL-BASE. How does this affect the titration curve? Is it more advisable to use large or small amounts of base? Should you use constant amounts of base?Hit ADD-BASE a few times and observe the pH vs. time plot. Do you feel this is a useful plot for experiments? What does it tell you?Can you alter the pH of the solution without adding base to the solution?EXTENDING THE MODEL-------------------The code currently generates two water molecules every time a hydronium and hydroxide molecule collide. Alter the code to generate behavior for hydroxide and water collision, according to the chemical equation above. How does this change the model?What if only one water molecule were generated and the hydroxide molecule were destroyed when the two collided? How would this affect the pH?Add a button to add more acid to the solution at any point in time, can you use it to adjust the pH to a target value?NETLOGO FEATURES----------------Notice that in the calculate-pH procedure the model makes use of the count-turtles and count-<BREED> primitives to convert the number of turtles on the screen into concentrations that are often used in the chemistry laboratory.It is a little tricky to ensure that a hydronium never participates in two reactions simultaneously. The turtle variable REACTING? is used to control this. In the future, a primitive called GRAB may be added to NetLogo; then REACTING? won't be needed.CREDITS AND REFERENCES----------------------Thanks to Mike Stieff for his work on this model.To refer to this model in academic publications, please use: Wilensky, U. (2001). NetLogo Strong Acid model. http://ccl.northwestern.edu/netlogo/models/StrongAcid. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.@#$#@#$#@defaulttrue0Polygon -7566196 true true 150 5 40 250 150 205 260 250molecule3true0Circle -7566196 true true 92 92 118Circle -1 true false 120 32 60Circle -1 true false 58 183 60Circle -1 true false 185 183 60molecule1true0Circle -7566196 true true 80 80 142Circle -1 true false 52 195 61molecule2true0Circle -7566196 true true 78 79 146Circle -1 true false 40 41 69Circle -1 true false 194 42 71@#$#@#$#@NetLogo 1.1@#$#@#$#@@#$#@#$#@@#$#@#$#@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -