Buffer Titration
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
How does a buffer behave differently from a strong acid or a strong base during titration? Check this model. Starting at the same pH level, see how much more titrant is needed to cause a significant pH change.
HOW IT WORKS
A strong acid and an acid buffer are compared side by side. They both start at a ph of 3 and are titrated by NaOH. Ka = 1.8E-5
A strong base and an alkaline buffer are compared side by side. They both start at a ph of 11 and are titrated by HCl. Kb = 1.8E-5
The starting pHs are 3 for acidic solutions and 11 for basic solutions. We do not let users set up a random starting pH because every buffer has a particular buffer zone.
HOW TO USE IT
- Choose a test, and then determine the titrant concentration and dose.
- Run the model to titrate.
Note: -Don't change the titrant's concentration and dose during titration. -Use switches to hide some molecules or ions to help observations.
THINGS TO NOTICE
- Dissociation of the strong acid/base and weak acid/base.
- The pH changes in the titration processes of the strong acid/base and buffer.
RELATED MODELS
See more chemistry models at https://sites.google.com/view/3d-science-abm/physics-chemistry
CREDITS AND REFERENCES
Dr. Lin Xiang created this module at the University of Kentucky in 2022. If you mention this model in a publication, we ask that you include the citations below.
Xiang, L. (2022). Buffer Titration. Department of STEM Education, University of Kentucky, Lexington, KY.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/.
Comments and Questions
breed [HAs HA] breed [A-s A-] breed [Bs B] breed [BHs BH] breed [H3OS H30] breed [OHs OH] breed [legends legend] turtles-own[ ] globals [Starting-pH kb ka Num-H-l Num-H-r Num-OH-l Num-OH-r num-B-l num-B-r num-BH-l num-BH-r num-HA-l num-HA-r num-A-l num-A-r vol-1-l vol-1-r vol-titrant-l vol-titrant-r current-conc-H-l current-conc-H-r current-conc-OH-l current-conc-OH-r current-conc-B-l current-conc-B-r current-conc-BH-l current-conc-BH-r current-conc-A-l current-conc-A-r current-conc-HA-l current-conc-HA-r current-ph-l current-ph-r current-pOH-l current-pOH-r M-H-l M-H-r M-T-l M-T-r M-OH-l M-OH-r M-BH-l M-BH-r M-B-l M-B-r M-B-1-l M-B-1-r M-HA-l M-HA-r M-HA-1-l M-HA-1-r M-A-l M-A-r unit-num-b unit-num-ha ] ;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; Setup procedures ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;; to setup (ifelse Choose-a-test = "Strong Acid and Acidic Buffer" [ ca set-shapes set-bk set Starting-pH 3 set-legends-a set-HCl set-acetic-acid] Choose-a-test = "Strong Base and Alkaline Buffer" [ca set-shapes set-bk set Starting-pH 11 set-legends-b set-NaOH set-NH3]) reset-ticks end to set-shapes set-default-shape ohs "ab-oh-1" set-default-shape h3os "ab-h3o-1" set-default-shape has "ab-ha-1" set-default-shape a-s "ab-ha-2" set-default-shape bs "ab-b-1" set-default-shape bhs "ab-b-2" end to set-bk ask patches [set pcolor 91.5 + random-float 0.5] ask patches with [ pycor >= max-pycor - 1 or pycor < 3] [set pcolor 101] ask patches with [ pxcor = max-pxcor or pxcor = min-pxcor] [set pcolor 101] ask patches with [ pxcor = 33 or pxcor = 34 or pxcor = 35] [set pcolor 101] end to set-tt-properties-l set size 1.25 setxy 1 + random-float 31 4 + random-float (max-pycor - 7) end to set-tt-properties-r set size 1.25 setxy 36 + random-float 31 4 + random-float (max-pycor - 7) end to set-legends-a create-legends 10 ask legend 0 [set shape "ab-h3o-1" set size 1.75 setxy 12.5 1] ask legend 1 [set shape "blank" set size 1.5 set label "Hydronium (H3O+)" set label-color white setxy 22 1.3] ask legend 2 [set shape "ab-OH-1" set size 1.75 set color 85 setxy 25 1] ask legend 3 [set shape "blank" set size 1.5 set label "Hydroxide (OH-)" set label-color white setxy 33 1.3] ask legend 4 [set shape "ab-ha-1" set size 1.75 set color 116.5 setxy 36.5 1] ask legend 5 [set shape "blank" set size 1.5 set label "Acid molecule" set label-color white setxy 43.8 1.3] ask legend 6 [set shape "ab-ha-2" set size 1.75 set color 113.5 setxy 47.5 1] ask legend 7 [set shape "blank" set size 1.5 set label "Conjugate base" set label-color white setxy 55.5 1.3] ask legend 8 [set shape "blank" set size 3 set label "Hydrocloric Acid (HCl)" set label-color white setxy 19.5 36.5] ask legend 9 [set shape "blank" set size 3 set label "Acetic acid/Acetate Buffer (CH3COOH/CH3COO-)" set label-color white setxy 62 36.5] end to set-legends-b create-legends 10 ask legend 0 [set shape "ab-h3o-1" set size 1.75 setxy 13.5 1] ask legend 1 [set shape "blank" set size 1.5 set label "Hydronium (H3O+)" set label-color white setxy 22 1.3] ask legend 2 [set shape "ab-OH-1" set size 1.75 set color 85 setxy 25.5 1] ask legend 3 [set shape "blank" set size 1.5 set label "Hydroxide (OH-)" set label-color white setxy 33 1.3] ask legend 4 [set shape "ab-b-1" set size 1.75 set color 42.5 setxy 36.5 1] ask legend 5 [set shape "blank" set size 1.5 set label "Base molecule" set label-color white setxy 43.5 1.3] ask legend 6 [set shape "ab-b-2" set size 1.75 set color 62.5 setxy 47.5 1] ask legend 7 [set shape "blank" set size 1.5 set label "Conjugate acid" set label-color white setxy 55 1.3] ask legend 8 [set shape "blank" set size 3 set label "Sodium Hydroxide (NaOH)" set label-color white setxy 20 36.5] ask legend 9 [set shape "blank" set size 3 set label "Ammonia-Ammonium Chloride Buffer (NH3/NH4+)" set label-color white setxy 62 36.5] end to set-HCl set vol-1-l 100 set vol-titrant-l 0 set current-conc-H-l 10 ^ (- Starting-pH) ;starting ph of hcl is 3.5 set current-ph-l Starting-pH set M-H-l current-conc-H-l * vol-1-l * 0.001 ;determine the mole of H+ set M-A-l M-H-l set M-HA-l M-H-l set current-conc-A-l (M-A-l / (vol-1-l * 0.001)) ;determine initial HA concentration set current-conc-HA-l 0 ;there is no HA set current-Conc-OH-l 10 ^ (-14) / current-conc-H-l ;calculate the concentration of OH- set M-OH-l current-Conc-OH-l * vol-1-l * 0.001 ;calculate exisitng mole of OH- set num-H-l round (1000 * (1.3895 ^ (-1 * current-ph-l))) ;find the amount of visual H+ set num-OH-l round (10000 / (num-H-l)) ;find the amount of visual OH- if Hide-acid-molecule-and-conjugate-base? = false [create-a-s num-H-l [set-tt-properties-l set size 1.25 set color 113.5]] if Hide-hydronium-and-hydroxide? = false [set num-H-l round (1000 * (1.3895 ^ (-1 * current-ph-l))) ;find the amount of visual H+ set num-OH-l round (10000 / (num-H-l)) ;find the amount of visual OH- create-h3os num-H-l [set-tt-properties-l set size 1.25 ] create-ohs num-OH-l [set-tt-properties-l set size 1.25 set color 85]] end to set-acetic-acid set ka 1.8 * (10 ^ -5) set vol-1-r 100 set vol-titrant-r 0 set current-conc-H-r 10 ^ (- Starting-pH) set current-ph-r Starting-pH set current-conc-HA-r (current-conc-H-r * (current-conc-H-r + ka) / ka) ;determine initial HA concentration set current-conc-A-r current-conc-H-r ;determine initial HA concentration set M-HA-r current-conc-HA-r * vol-1-r * 0.001 ;determine the mole of HA set M-H-r current-conc-H-r * vol-1-r * 0.001 ;determine the mole of H+ set M-A-r M-H-r if Hide-acid-molecule-and-conjugate-base? = false [ set num-HA-r round (2500 * sqrt (sqrt (M-HA-r))) set num-A-r round (100 * sqrt (sqrt (M-A-r))) create-has num-HA-r [set-tt-properties-r set size 1.25 set color 116.5] create-a-s num-A-r [set-tt-properties-r set size 1.25 set color 113.5] set unit-num-ha (M-HA-r / num-ha-r) ] if Hide-hydronium-and-hydroxide? = false [set num-H-r round (1000 * (1.3895 ^ (-1 * current-ph-r))) ;find the amount of visual H+ set num-OH-r round (10000 / (num-H-r)) ;find the amount of visual OH- create-h3os num-H-r [set-tt-properties-r set size 1.25 ] create-ohs num-OH-r [set-tt-properties-r set size 1.25 set color 85]] end to set-NaOH set vol-1-l 100 set vol-titrant-l 0 set current-conc-OH-l 10 ^ (- (14 - Starting-pH)) set current-ph-l Starting-pH set M-OH-l current-conc-OH-l * vol-1-l * 0.001 ;determine the mole of hydroxide set M-B-l M-OH-l set M-BH-l M-OH-l set current-conc-BH-l (M-BH-l / (vol-1-l * 0.001)) ;determine initial conjugate acid concentration set current-conc-B-l 0 ;there is no base molecule set current-Conc-H-l 10 ^ (-14) / current-conc-OH-l ;calculate the concentration of H+ set M-H-l current-Conc-H-l * vol-1-l * 0.001 ;calculate exisitng mole of H+ set num-H-l round (1000 * (1.3895 ^ (-1 * current-ph-l))) ;find the amount of visual H+ set num-OH-l round (10000 / (num-H-l)) ;find the amount of visual OH- if Hide-base-molecule-and-conjugate-acid? = false [create-BHs num-OH-l [set-tt-properties-l set size 1.25 set color 62]] if Hide-hydronium-and-hydroxide? = false [set num-H-l round (1000 * (1.3895 ^ (-1 * current-ph-l))) ;find the amount of visual H+ set num-OH-l round (10000 / (num-H-l)) ;find the amount of visual OH- create-h3os num-H-l [set-tt-properties-l set size 1.25 ] create-ohs num-OH-l [set-tt-properties-l set size 1.25 set color 85]] end to set-NH3 set kb 1.8 * (10 ^ -5) set vol-1-r 100 set vol-titrant-r 0 set current-conc-OH-r 10 ^ (- (14 - Starting-pH)) set current-ph-r Starting-pH set current-conc-B-r (current-conc-OH-r * (current-conc-OH-r - kb) / kb) ;determine initial Base concentration set current-conc-BH-r current-conc-OH-r ;determine initial conjugate acid concentration set M-B-r current-conc-B-r * vol-1-r * 0.001 ;determine the mole of base set M-OH-r current-conc-OH-r * vol-1-r * 0.001 ;determine the mole of OH- set M-BH-r M-OH-r if Hide-base-molecule-and-conjugate-acid? = false [set num-B-r round (2500 * sqrt (sqrt (M-B-r))) set num-BH-r round (100 * sqrt (sqrt (M-BH-r))) create-Bs num-B-r [set-tt-properties-r set size 1.25 set color 42] create-BHs num-BH-r[set-tt-properties-r set size 1.25 set color 62] set unit-num-b (M-b-r / num-b-r)] if Hide-hydronium-and-hydroxide? = false [set num-H-r round (1000 * (1.3895 ^ (-1 * current-ph-r))) ;find the amount of visual H+ set num-OH-r round (10000 / (num-H-r)) ;find the amount of visual OH- create-h3os num-H-r [set-tt-properties-r set size 1.25 ] create-ohs num-OH-r [set-tt-properties-r set size 1.25 set color 85]] end ;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; GO procedures ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;; to go move (ifelse Choose-a-test = "Strong Acid and Acidic Buffer" [if current-conc-BH-r != 0 [setup] titration-HCl titration-acetic-acid (ifelse Hide-acid-molecule-and-conjugate-base? = true and count a-s > 0 [if any? a-s [ask a-s [die]] if any? has [ask has [die]]] Hide-acid-molecule-and-conjugate-base? = false and count a-s > 0 [dissociation-a] Hide-acid-molecule-and-conjugate-base? = false and count a-s <= 0 [ ;right box set M-HA-1-r (current-conc-HA-r * vol-1-r * 0.001) let num-HA-to-be round (M-HA-1-r / unit-num-ha) create-has num-HA-to-be [set-tt-properties-r set size 1.25 set color 116.5] create-a-s (num-HA-r - num-HA-to-be + num-A-r)[set-tt-properties-r set size 1.25 set color 113.5] ; left box create-a-s round (1000 * (1.3895 ^ ( - Starting-pH))) [set-tt-properties-l set size 1.25 set color 113.5]]) (ifelse Hide-hydronium-and-hydroxide? = true and count OHs > 0 [ask h3os [die] ask ohs [die]] Hide-hydronium-and-hydroxide? = false and count ohs > 0 [acid-base-equilibrium] Hide-hydronium-and-hydroxide? = false and count ohs <= 0 [;left box set num-H-l round (1000 * (1.3895 ^ (-1 * current-pH-l))) set num-OH-l round (10000 / (num-H-l)) create-h3os num-H-l [set-tt-properties-l set size 1.25 ] create-ohs num-OH-l [set-tt-properties-l set size 1.25 set color 85] ;right box set num-H-r round (1000 * (1.3895 ^ (-1 * current-pH-r))) set num-OH-r round (10000 / (num-H-r)) create-h3os num-H-r [set-tt-properties-r set size 1.25 ] create-ohs num-OH-r [set-tt-properties-r set size 1.25 set color 85] ]) if (vol-titrant-l + vol-titrant-r) / 2 >= (Total-mL-of-titrant-added - 0.05) [user-message "Have added the specified amount of titrant." stop] ] Choose-a-test = "Strong Base and Alkaline Buffer" [ if current-conc-A-r != 0 [setup] titration-NaOH titration-NH3 (ifelse Hide-base-molecule-and-conjugate-acid? = true and count BHs > 0 [if any? BHs [ask BHs [die]] if any? Bs [ask Bs [die]]] Hide-base-molecule-and-conjugate-acid? = false and count BHs > 0 [dissociation-b] Hide-base-molecule-and-conjugate-acid? = false and count BHs <= 0 [;right box set M-B-1-r (current-conc-B-r * vol-1-r * 0.001) let num-B-to-be round (M-B-1-r / unit-num-b) create-bs num-b-to-be [set-tt-properties-r set size 1.25 set color 42] create-BHs (num-b-r - num-b-to-be + num-BH-r)[set-tt-properties-r set size 1.25 set color 62] ;left box create-BHs round (1000 * (1.3895 ^ ( - Starting-pH))) [set-tt-properties-l set size 1.25 set color 62]]) (ifelse Hide-hydronium-and-hydroxide? = true and count OHs > 0 [ask h3os [die] ask ohs [die]] Hide-hydronium-and-hydroxide? = false and count ohs > 0 [acid-base-equilibrium] Hide-hydronium-and-hydroxide? = false and count ohs <= 0 [;left box set num-H-l round (1000 * (1.3895 ^ (-1 * current-pH-l))) set num-OH-l round (10000 / (num-H-l)) create-h3os num-H-l [set-tt-properties-l set size 1.25 ] create-ohs num-OH-l [set-tt-properties-l set size 1.25 set color 85] ;right box set num-H-r round (1000 * (1.3895 ^ (-1 * current-pH-r))) set num-OH-r round (10000 / (num-H-r)) create-h3os num-H-r [set-tt-properties-r set size 1.25 ] create-ohs num-OH-r [set-tt-properties-r set size 1.25 set color 85]]) if (vol-titrant-l + vol-titrant-r) / 2 >= (Total-mL-of-titrant-added - 0.05) [user-message "Have added the specified amount of titrant." stop] ]) tick end to move ask turtles with [breed != legends] ;ask non-legend turtles [rt random 360 ;rotate if [pcolor] of patch-at dx dy <= 92 and [pcolor] of patch-at dx dy >= 91.5 ;if the patch-ahead has the proper color [fd 0.5 ;move forward if ycor < 4 [set ycor 4] ;if ycor is low, put ycor higher ]] end to acid-base-equilibrium ;left box set num-H-l round (1000 * (1.3895 ^ (-1 * current-pH-l))) set num-OH-l round (10000 / (num-H-l)) let current-H-l count H3Os with [xcor < 33] let current-OH-l count OHs with [xcor < 33] (ifelse (num-H-l) > current-H-l [create-h3os abs ((num-H-l) - current-H-l) [set-tt-properties-l set size 1.25]] (num-H-l) < current-H-l [ask n-of abs ((num-H-l) - current-H-l) h3os with [xcor < 33][die]]) (ifelse (num-OH-l) > current-OH-l [create-ohs abs ((num-OH-l) - current-OH-l) [set-tt-properties-l set size 1.25 set color 85]] (num-OH-l) < current-OH-l [ask n-of abs ((num-OH-l) - current-OH-l) OHs with [xcor < 33] [die]]) ;right box set num-H-r round (1000 * (1.3895 ^ (-1 * current-pH-r))) set num-OH-r round (10000 / (num-H-r)) let current-H-r count H3Os with [xcor > 35] let current-OH-r count OHs with [xcor > 35] (ifelse (num-H-r) > current-H-r [create-h3os abs ((num-H-r) - current-H-r) [set-tt-properties-r set size 1.25]] (num-H-r) < current-H-r [ask n-of abs ((num-H-r) - current-H-r) h3os with [xcor > 35][die]]) (ifelse (num-OH-r) > current-OH-r [create-ohs abs ((num-OH-r) - current-OH-r) [set-tt-properties-r set size 1.25 set color 85]] (num-OH-r) < current-OH-r [ask n-of abs ((num-OH-r) - current-OH-r) OHs with [xcor > 35] [die]]) end to dissociation-b set M-B-1-r (current-conc-b-r * vol-1-r * 0.001) let num-b-to-be round (M-b-1-r / unit-num-b) let current-num-b count bs with [xcor > 35] if current-num-b > num-b-to-be [if any? bs with [xcor > 35] [ask up-to-n-of (current-num-b - num-b-to-be) bs with [xcor > 35] [set breed bhs set color 62]]] let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of H+ in this tick if M-B-r - M-T-r <= -0.5 * t-of-tick [if any? bs with [xcor > 35] [ask bs with [xcor > 35] [set breed bhs set color 62]]] end to dissociation-a set M-HA-1-r (current-conc-HA-r * vol-1-r * 0.001) let num-HA-to-be round (M-HA-1-r / unit-num-ha) let current-num-ha count has with [xcor > 35] if current-num-ha > num-HA-to-be [if any? Has with [xcor > 35] [ask up-to-n-of (current-num-ha - num-HA-to-be) has with [xcor > 35] [set breed a-s set color 113]]] let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of OH- in this tick if M-HA-r - M-T-r <= -0.5 * t-of-tick [if any? Has with [xcor > 35] [ask has with [xcor > 35] [set breed a-s set color 113]]] end to titration-NaOH set current-Conc-H-l 10 ^ (-14) / current-conc-OH-l ;calculate the concentration of H+ set M-H-l current-Conc-H-l * (vol-1-l) * 0.001 ;calculate exisitng mole of H+ set vol-titrant-l vol-titrant-l + Titrant-dose ;increase Titrant volume set vol-1-l vol-1-l + Titrant-dose ;increase total volume let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of H+ in this tick set M-T-l (M-T-l + t-of-tick) ;update total mole of titant (ifelse current-conc-OH-l >= 10 ^ (-7) ;if base + acid [(ifelse M-B-l > M-T-l ;if more OH- than H+ [set current-conc-OH-l (M-B-l - M-T-l) / (vol-1-l * 0.001) ;calculate the concentration of OH- ifelse current-conc-OH-l > 10 ^ (-6) [set current-ph-l (14 - (- log current-conc-OH-l 10))] ;calculate the ph [set current-conc-OH-l (10 ^ (-7) + current-conc-OH-l) ;consider water self-ionizaiton set current-ph-l (14 - (- log current-conc-OH-l 10))]] ; find current pH M-B-l < M-T-l [set M-H-l (M-T-l - M-B-l) ;if more H+ than OH-,calculate left mole of H+ set current-conc-H-l M-H-l / (vol-1-l * 0.001) ;calculate the concentration of OH- ifelse current-conc-H-l > 10 ^ (-6) [set current-ph-l (- log current-conc-H-l 10)] ;calculate the concentration of H+ [set current-conc-H-l ((10 ^ (-7) + current-conc-H-l)) ;consider water self-ionizaiton set current-ph-l (- log current-conc-H-l 10)]] ;calculate the concentration of H+ M-B-l = M-T-l [set current-conc-H-l 10 ^ (-7) set current-ph-l (- log current-conc-H-l 10)]) ] current-conc-OH-l < 10 ^ (-7) ;if acid + acid [let total-H-l (M-H-l + T-of-tick) ;calculate the total mole of H+ set current-conc-H-l total-H-l / (vol-1-l * 0.001) ;calculate the concentration of OH- set current-ph-l (- log current-conc-H-l 10)]) ;Find ph end to titration-NH3 set vol-titrant-r vol-titrant-r + Titrant-dose ;increase Titrant volume set vol-1-r vol-1-r + Titrant-dose ;increase total volume let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of OH- in this tick set M-T-r (M-T-r + t-of-tick) ;update total mole of titant (ifelse (M-B-r - M-T-r) >= T-of-tick * 0.5 ;if more base (half tick mole) than H+, i.e., before the equivalent point [set current-conc-B-r (M-B-r - M-T-r) / (vol-1-r * 0.001) ;update base concentration ifelse ((M-BH-r + M-T-r) / (vol-1-r * 0.001)) - (M-T-r / (vol-1-r * 0.001)) > 0.0008 ;update BH concentration. consider the initial BH concentration [set current-conc-BH-r ((M-BH-r + M-T-r) / (vol-1-r * 0.001))] [set current-conc-BH-r (M-T-r / (vol-1-r * 0.001))] set current-conc-OH-r (kb * current-conc-B-r / current-conc-BH-r) ;find current OH- concentration set current-ph-r (14 - (- log current-conc-OH-r 10))] ; find current pH M-B-r - M-T-r < T-of-tick * 0.5 and M-B-r - M-T-r > -0.5 * T-of-tick ;if at the equivalent point [set current-conc-BH-r (M-B-r / (vol-1-r * 0.001)) ;update A- concentration let ka-r (10 ^ (-14) / kb) set current-conc-H-r (-0.5 * (ka-r - sqrt (ka-r * ka-r + 4 * ka-r * current-conc-BH-r))) ;find H+ concentration using Ka set current-pH-r (- log current-conc-H-r 10) ;find current ph using pH set current-conc-b-r current-conc-h-r] ;update Base molecule concentration M-B-r - M-T-r <= -0.5 * T-of-tick ; if after the equivalent point [set current-conc-b-r 0 ;update Base molecule concentration set current-conc-BH-r (M-B-r) / (vol-1-r * 0.001) ;update BH concentration set current-conc-H-r ((M-T-r - M-B-r) / (vol-1-r * 0.001)) ; find H+ concentration set current-ph-r (- log current-conc-H-r 10)]) ;find current ph using pOH end to titration-HCl set current-Conc-OH-l 10 ^ (-14) / current-conc-H-l ;calculate the concentration of OH- set M-OH-l current-Conc-OH-l * (vol-1-l) * 0.001 ;calculate exisitng mole of OH- set vol-titrant-l vol-titrant-l + Titrant-dose ;increase Titrant volume set vol-1-l vol-1-l + Titrant-dose ;increase total volume let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of OH- in this tick set M-T-l (M-T-l + t-of-tick) ;update total mole of titant (ifelse current-conc-H-l >= 10 ^ (-7) ;if acid + base [(ifelse M-HA-l > M-T-l ;if more H+ than OH- [set current-conc-H-l (M-HA-l - M-T-l) / (vol-1-l * 0.001) ;calculate the concentration of H+ set current-conc-A-l (M-HA-l / (vol-1-l * 0.001)) ifelse current-conc-H-l > 10 ^ (-6) [set current-ph-l (- log current-conc-H-l 10)] ;calculate the ph [set current-conc-H-l (10 ^ (-7) + current-conc-H-l);consider water self-ionizaiton set current-ph-l (- log current-conc-H-l 10)]] ; find current pH M-HA-l < M-T-l [set M-OH-l (M-T-l - M-HA-l) ;if more OH- than H+,calculate left mole of OH- set current-conc-OH-l M-OH-l / (vol-1-l * 0.001) ;calculate the concentration of OH- set current-conc-A-l (M-HA-l / (vol-1-l * 0.001)) ifelse current-conc-OH-l > 10 ^ (-6) [set current-conc-H-l 10 ^ (-14) / current-conc-OH-l set current-ph-l (- log current-conc-H-l 10)] ;calculate the concentration of H+ [set current-conc-OH-l (10 ^ (-7) + current-conc-OH-l) ;consider water self-ionizaiton set current-conc-H-l 10 ^ (-14) / current-conc-OH-l set current-ph-l (- log current-conc-H-l 10)]] ;calculate the concentration of H+ M-HA-l = M-T-l [set current-conc-A-l (M-HA-l / (vol-1-l * 0.001)) set current-conc-H-l 10 ^ (-7) set current-ph-l (- log current-conc-H-l 10)]) ] current-conc-H-l < 10 ^ (-7) ;if base + base [set current-conc-A-l (M-HA-l / (vol-1-l * 0.001)) let total-OH-l (M-OH-l + T-of-tick) ;calculate the total mole of OH- set current-conc-OH-l total-OH-l / (vol-1-l * 0.001) ;calculate the concentration of OH- set current-conc-H-l 10 ^ (-14) / current-conc-OH-l ;calculate the concentration of H+ set current-ph-l (- log current-conc-H-l 10)]) ;Find ph end to titration-acetic-acid set vol-titrant-r vol-titrant-r + Titrant-dose ;increase Titrant volume set vol-1-r vol-1-r + Titrant-dose ;increase total volume let T-of-tick Titrant-concentration * 0.001 * Titrant-dose ;calculate the added mole of OH- in this tick set M-T-r (M-T-r + t-of-tick) ;update total mole of titant (ifelse M-HA-r - M-T-r > 0.5 * t-of-tick ;if more HA than OH-, i.e., before the equivalent point [set current-conc-HA-r (M-HA-r - M-t-r) / (vol-1-r * 0.001) ;update HA concentration ifelse ((M-A-r + M-T-r) / (vol-1-r * 0.001)) - (M-T-r / (vol-1-r * 0.001)) > 0.0008 ;update A- concentration. consider the initial A concentration [set current-conc-A-r ((M-A-r + M-T-r) / (vol-1-r * 0.001))] [set current-conc-A-r (M-T-r / (vol-1-r * 0.001))] set current-conc-H-r (ka * current-conc-HA-r / current-conc-A-r) ;find current H+ concentration set current-ph-r (- log current-conc-H-r 10)] ; find current pH M-HA-r - M-T-r <= 0.5 * t-of-tick and M-HA-r - M-T-r > -0.5 * t-of-tick ;if at the equivalent point [set current-conc-A-r (M-HA-r / (vol-1-r * 0.001)) ;update A- concentration let kb-r (10 ^ (-14) / ka) set current-conc-OH-r (-0.5 * (kb-r - sqrt (kb-r * kb-r + 4 * kb-r * current-conc-A-r))) ;find OH- concentration using Kb set current-pOH-r (- log current-conc-OH-r 10) ;find current ph using pOH set current-ph-r (14 - current-pOH-r) ;find current ph using pOH set current-conc-HA-r current-conc-OH-r] ;update HA concentration M-HA-r - M-T-r <= -0.5 * t-of-tick ; if after the equivalent point [set current-conc-HA-r 0 ;update HA concentration set current-conc-A-r (M-HA-r / (vol-1-r * 0.001)) ;update A- concentration set current-conc-OH-r ((M-T-r - M-HA-r) / (vol-1-r * 0.001)) ; find OH- concentration set current-ph-r (14 - (- log current-conc-OH-r 10))]) ;find current ph using pOH end
There are 3 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.