# Empirical Modeling of CO2 Concentrations in Freshwater Aquaria (long)

```Empirical Modeling of CO2 Concentrations in Freshwater Aquaria
Jeffery Ludwig (jjl22 at drexel_edu)
6 March 2002
Revision 1, Text Version

Introduction

The following model was developed to aid in the precise calculation of
CO2 concentrations in freshwater aquariums.  Current methods utilize a
look-up chart that needs to be interpolated to obtain intermediate
values.  While this method yields good results, it cannot be not readily
implemented in spreadsheets and various other electronic journals that
are popular in the hobby.   At the end of this report, instructions can
be found for creating user defined functions using this model for use in
Microsoft Excel.

Model and Limitations

The model is a derivative of the Henderson-Hasselbalch equation:

pH = pKa + log([HCO3-]/[H2CO3])

where [HCO3-] and [H2CO3] represent the alkalinity coming from a
carbonate buffer system and dissolved CO2 concentrations, respectively.
Rearranging and introducing coefficients to adjust the equations for
popular units and adding a constant and interaction term, the working
model becomes:

[CO2]=(Alpha*KH)/(10^(pH-Beta))+Gamma+Delta*pH*KH

The following coefficient values have been obtained using a Sum of the
Squares Error technique and a minimization procedure found in Microsoft
Excel 2002:

Alpha=9000.01
Beta=3.51494
Gamma=0.07852
Delta=0.00094

The following are limitations of the model presented above and need to
be considered:
1. KH tests measure total alkalinity, they do not isolate buffering due
to the carbonate system.  In most freshwater aquariums, KH will
approximate carbonate alkalinity.  This model will not work if another
buffering system is significant .  If pH adjustment buffers or peat
filtrating have been used, this model will not work.
2. To improve accuracy, the model has been limited to CO2 ranges of 1ppm
to 60ppm.  Use the charts if you feel your CO2 values are out of this
range.

The model yields a SSE of 6.44 which corresponds to an error of 0.29ppm
due to the model.  This value is quite acceptable, but does not include
the effects of testing errors.
Having a mathematical model allows us to conduct a detailed propagation
of error analysis and quantify the effects of testing errors.  The
propagated error becomes:

http://www.pages.drexel.edu/~jjl22/co2.pdf]

To re-iterate the significance of good test kits, at a pH=7.0 and
KH=0.4, if the accuracy of testing is +/- 0.2 pH and +/- 0.5 KH, the
average error in CO2 testing is (+/-) 7.095ppm.

Microsoft Excel Functions
1. Open Visual Basic Editor and go to Insert>Module.
2. Copy the following code:

Function co2point(pH As Double, KH As Double) As Double
co2point = (9000.01 * KH) / (10 ^ (pH - 3.51494)) + 0.07852 + pH * KH *
0.00094
End Function

Function co2low(pH As Double, KH As Double, d_pH As Double, d_KH As
Double) As Double
co2low = (9000.01 * KH) / (10 ^ (pH - 3.51494)) + 0.07852 + pH * KH *
0.00094 - ((-9000 * KH / (10 ^ (pH - 3.5149)) * 2.3025 + 0.00094 * KH) ^
2 * d_pH ^ 2 + (9000 / (10 ^ (pH - 3.5149)) + 0.00094 * pH) ^ 2 * d_KH)
^ (1 / 2)
End Function

Function co2high(pH As Double, KH As Double, d_pH As Double, d_KH As
Double) As Double
co2high = (9000.01 * KH) / (10 ^ (pH - 3.51494)) + 0.07852 + pH * KH *
0.00094 + ((-9000 * KH / (10 ^ (pH - 3.5149)) * 2.3025 + 0.00094 * KH) ^
2 * d_pH ^ 2 + (9000 / (10 ^ (pH - 3.5149)) + 0.00094 * pH) ^ 2 * d_KH)
^ (1 / 2)
End Function

3. When copying into Excel, be sure each function is only three lines
long.  The first line should be the function definition, the second line
should be co2xxx=xxxx and the third should just be "End Function".  You
may have to manually remove these breaks.

The functions are called using the following syntax:
co2point(pH, KH)
co2low(pH, KH, Accuracy of pH, Accuracy of KH)
co2high(pH, KH, Accuracy of pH, Accuracy of KH)

For example, if you wish to find the upper and lower bounds on a tank
that has a pH of 6.8 and a KH of 5, with an accuracy of 0.1 in pH and
0.5 in KH, you would enter:
"=co2high(6.8,5,0.1,0.5)" in a cell which should give 29.76 and
"=co2low(6.8,5,0.1,0.5)" which yields 17.17.  A note about the
interpretation of this result:  This simply means you can be very
confident your CO2 levels are between 17.17 and 29.76.

This does NOT mean that your actual CO2 values are more likely to be