NetLogo Models Library:
## 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.
## HOW IT WORKS
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 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<sub>2</sub>O + H-A —> H<sub>3</sub>O<sup>+</sup> + A<sup>-</sup>
> B + H<sub>2</sub>O —> OH<sup>-</sup> + H-B<sup>+</sup>
It 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 world. 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 world 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 in the world. 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` primitive and some math to convert the number of turtles in the world into concentrations like those seen in the laboratory.
## CREDITS AND REFERENCES
Thanks to Mike Stieff for his work on this model.
## HOW TO CITE
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
* Stieff, M. and 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.
Please cite the NetLogo software as:
* Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
## COPYRIGHT AND LICENSE
Copyright 2001 Uri Wilensky.
![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at email@example.com.
This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.