Predicting methane and biogas production with the biogas package
Theory for predicting biogas production based on substrate composition and degradability is well-developed. But the calculations are tedious and seldom done. The ‘biogas’ package includes a single function predBg() to make these predictions. This document describes usage of the predBg() function through examples. In a final section, the methods behind the calculations are presented.
1 Getting started
To use the ‘biogas’ package, it must be installed on your computer. Since the package is available on CRAN (The Comprehensive R Archive Network)11 1 You can download the package manually and find more information on getting started with the package at https://cran.r-project.org/web/packages/biogas/index.html. , it can be installed with the following command.
install.packages("biogas")
To use any installed package, it must be loaded. Use the next command to load the ‘biogas’ package.
library(biogas)
2 Methane production from defined substrates
2.1 Cellulose control in BMP test
Cellulose is often included in biochemical methane potential (BMP) experiments as a positive control–a comparison between the measured and expected quantity of CH4 produced is used to evaluate the accuracy of the measurements. How much CH4 should we expect from cellulose? To predict this we only need the chemical formula of cellulose.
predBg(form = "C6H10O5")
## [1] 413.7274
So if it were all converted to CH4, we should see about 414 mL of CH4 (dry, at 101.325 kPa and 0∘C)22 2 All volumes returned by the function are standardised to dry conditions at C and 101.325 kPa (1.0 atm). They can be converted to different conditions using stdVol(). per g of cellulose. This quantity is sometimes referred to as the theoretical BMP.
Since form is the first argument, we can easily omit the form = tag and use positional matching–we’ll do this in the remainder of the document.
predBg("C6H10O5")
## [1] 413.7274
By default, the result is per 1 g of substrate, but any mass can be used using the mass argument33 3 Alternatively, the moles or total chemical oxygen demand (COD) can be specified with the mol and COD arguments. .
You can see all the arguments and some default values using the arg() function.
args(predBg)
## function (form = NULL, mass = 1, mol = NULL, fs = 0, fd = 1, ## mcomp = NULL, COD = NULL, conc.sub = NULL, pH = NULL, temp = NULL, ## mu = 0.1, shortform = NULL, value = "CH4") ## NULL
The only required argument is form, or an alternative called mcomp. All these arguments will be described below. In this section, we’ll focus on form and mass only.
Continuing with our example, to predict CH4 from 5.75 g of cellulose, set mass = 5.75.
predBg("C6H10O5", mass = 5.75)
## [1] 2378.933
In this case we should expect about 2400 mL of CH4. For a pure degradable compound like microcrystaline cellulose, it is reasonable to expect that 100% of the added mass is degraded by the microbial community. In other cases (e.g., when the substrate is plant biomass), we should reduce the degradability using the fd argument (which has a default of unity). But even for a substrate that is completely consumed by the bacteria and archaea in an anaerobic reactor (like microcrystaline cellulose) not all of the substrate is converted to CH4. This is beacuse the microorganisms use some fraction of it to synthesize their own cell biomass. The fraction of substrate that is used for cell synthesis can be set with the fs argument (which has a default of zero). In our example, we might expect fs between 5% and 25%, so we might find it useful to compare results from the calls below.
predBg("C6H10O5", mass = 5.75, fs = 0)
## [1] 2378.933
predBg("C6H10O5", mass = 5.75, fs = 0.05)
## [1] 2259.986
predBg("C6H10O5", mass = 5.75, fs = 0.20)
## [1] 1903.146
But the function is vectorized in almost all arguments, so the single call below is a better option.
predBg("C6H10O5", mass = 5.75, fs = c(0, 0.05, 0.2))
## [1] 2378.933 2259.986 1903.146
We can conclude that CH4 production from our 5.75 g of cellulose should be at least 1900 mL.
2.2 Designing a methanogen activity assay
Any chemical formula–for a pure compound, a mixture, or an empirical biomass formula–can be used for the form argument. For example, in methanogen activity tests, media typically include acetate, formate, or propionate as substrates. Let’s assume we are developing an assay and want to determine how much substrate to use. We can start by comparing theoretical CH4 production from each substrate on mass and molar bases.
predBg(c("CHOOH", "CH3COOH", "CH3CH2COOH"), mol = 1)
## [1] 5590.147 22360.588 39131.029
predBg(c("CHOOH", "CH3COOH", "CH3CH2COOH"), mass = 1)
## [1] 121.4563 372.3538 528.2409
From these results we can see that CH4 production increases with the molecular mass of the acid, on both a mass and mole basis44 4 This trend is consistent with the relative degree of oxidation: the O content is the same for these three acids is 2 moles per mole acid while the quantity of C and H increases with size. . For a particular assay, assume we plan on using 60 mL of medium containing formic acid:acetic acid at 1:1 (mole basis) in a 100 mL serum bottle, and need at least 5 mL of CH4 for accurate quantification. We can specify predict CH4 production from such a mixture using the notation for form shown below.
predBg("(CHOOH)0.5 (CH3COOH)0.5", mass = 1)
## [1] 263.4923
predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 1)
## [1] 13975.37
What concentration should we use? We should have total production much higher than our 5 mL limit, since only a fraction of substrate is consumed during an activity assay. If we assume we need a predicted maximum of at least 50 mL, the required substrate quantity using the following call.
50/predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 1)
## [1] 0.003577723
Based on this result, we could plan on 3.6 mmol of our combined substrate. Let’s double-check to make sure it would provide a maximum of 50 mL of CH4.
predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 0.0036)
## [1] 50.31132
A quantity of 3.6 mmol in a 60 mL solution requires a concentration of exactly 60 mmol L-1, which is therefore the concentration we should select based on our results.
3 Output options
So far all our examples have used the default value of the value argument to specify the type of output that is returned: "CH4". If we set the value argument to "all", more details are provided. Let’s illustrate this with the acetic acid/formic acid example from above.
predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 0.0036, value = "all")
## form mass mol.mass moles COD hydro ## 1 (CHOOH)0.5 (CH3COOH)0.5 0.1909404 53.039 0.0036 0.144 -0.0162144 ## fCH4 vCH4 mCH4 mCO2 ## 1 0.4166667 50.31132 0.0360945 0.1386315
In the ouput we can see the substrate formula (form) and mass (mass, g), along with its molar mass (mol.mass, g mol-1), and calculated oxygen demand (COD, g). The response variable that we are interested in (and the one we worked with above) is the predicted CH4 volume vCH4, in mL. The remaining columns show hydrolytic water consumption (hydro, g of H2O) (in this example, H2O is produced, not consumed), the molar fraction of CH4 in the reaction products (CH4 + CO2) (fCH4), and the masses of of CH4 and CO2 produced (mCH4 and mCO2, g).
In contrast to the default output (value = "CH4"), which is a vector, here output is a data frame. This difference isn’t really apparent unless we get multiple sets of results. To illustrate, let’s modify the previous call by adding four fs values. This addition will result in multiple rows in the output, as well as some additional columns.
predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 0.0036, fs = c(0, 0.01, 0.05, 0.1), value = "all")
## form mass mol.mass moles COD fs fe fd ## 1 (CHOOH)0.5 (CH3COOH)0.5 0.1909404 53.039 0.0036 0.144 0.00 1.00 1 ## 2 (CHOOH)0.5 (CH3COOH)0.5 0.1909404 53.039 0.0036 0.144 0.01 0.99 1 ## 3 (CHOOH)0.5 (CH3COOH)0.5 0.1909404 53.039 0.0036 0.144 0.05 0.95 1 ## 4 (CHOOH)0.5 (CH3COOH)0.5 0.1909404 53.039 0.0036 0.144 0.10 0.90 1 ## hydro fCH4 vCH4 mCH4 mCO2 m.bio ## 1 -0.01621440 0.4166667 50.31132 0.03609450 0.1386315 0.000000000 ## 2 -0.01686298 0.4159664 49.80821 0.03573356 0.1376413 0.001018017 ## 3 -0.01945728 0.4130435 47.79576 0.03428978 0.1336804 0.005090085 ## 4 -0.02270016 0.4090909 45.28019 0.03248505 0.1287292 0.010180170 ## N.req ## 1 0.000000000 ## 2 0.000126063 ## 3 0.000630315 ## 4 0.001260630
Since fs is given, substrate partitioning parameters fs and fe (as well as degradability fd). Substrate partitioning parameters fs and fe are the fraction of substrate used for cell synthesis and energy production, and always sum to unity. With these parameters, biomass production (m.bio, g) and the reduced N requirement (NH) for biomass production (N.req, g) can be calculate and are returned.
Now we have enough information to answer a second question: how much N is required in our medium? To get the most useful anser, let’s switch our call a bit to use concentrations and not total masses. The only needed change is in mol, which we will switch from the total substrate quantity to the concentration (60 mmol L-1).
predBg("(CHOOH)0.5 (CH3COOH)0.5", mol = 0.06, fs = c(0, 0.05, 0.08, 0.1, 0.15), value = "all")
## form mass mol.mass moles COD fs fe fd ## 1 (CHOOH)0.5 (CH3COOH)0.5 3.18234 53.039 0.06 2.4 0.00 1.00 1 ## 2 (CHOOH)0.5 (CH3COOH)0.5 3.18234 53.039 0.06 2.4 0.05 0.95 1 ## 3 (CHOOH)0.5 (CH3COOH)0.5 3.18234 53.039 0.06 2.4 0.08 0.92 1 ## 4 (CHOOH)0.5 (CH3COOH)0.5 3.18234 53.039 0.06 2.4 0.10 0.90 1 ## 5 (CHOOH)0.5 (CH3COOH)0.5 3.18234 53.039 0.06 2.4 0.15 0.85 1 ## hydro fCH4 vCH4 mCH4 mCO2 m.bio N.req ## 1 -0.2702400 0.4166667 838.5220 0.6015750 2.310525 0.00000000 0.00000000 ## 2 -0.3242880 0.4130435 796.5959 0.5714963 2.228006 0.08483475 0.01050525 ## 3 -0.3567168 0.4107143 771.4403 0.5534490 2.178495 0.13573560 0.01680840 ## 4 -0.3783360 0.4090909 754.6698 0.5414175 2.145487 0.16966950 0.02101050 ## 5 -0.4323840 0.4047619 712.7437 0.5113388 2.062969 0.25450425 0.03151575
For methanogens, fs should not exceed 0.08[4], but to provide a safety factor, we could use the N need from the case where fs = 0.15. So we can conclude that we need at least 31 mg L-1 of NH in our medium.
4 Unknown composition: using COD
If the composition of a substrate is not known, it is still possible to predict CH4 production based on a measured chemical oxygen demand (COD). For example, assume we have a waste stream with a COD of 2600 mg L-1. What is the maximum volume of CH4 that could be produced?
predBg(COD = 2.6)
## [1] 908.3989
We should expect no more than 908 mL CH4, and probably much less, depending on the degradability of our substrate. For example, perhaps we have data indicating that the organic matter in the waste stream is 60% degradable, and we assume that fs is 0.10.
predBg(COD = 2.6, fd = 0.6, fs = 0.1)
## [1] 490.5354
5 Complex substrates
Most real substrates are more complex than a single chemical compound such as cellulose or acetic acid. For example, both animal manure and wastewater sludge are mixtures of many types of compounds. Composition of biomass substrates are sometimes described based on macromolecular characterization, as in [3] The mcomp argument55 5 Short for “macromolecular composition” or “mass composition”. is designed for this approach. The approach is based on default empirical formulas for macromolecular groups, such as carbohydrates and proteins. The mcomp argument is given as a named numeric vector, where values are relative or absolute mass-based concentrations within the substrate. For example, for cattle manure sample 2 in [3], we could use reported relative concentrations: carbohydrate, 682 mg g-1; protein 158 mg g-1; lipids, 54 mg g-1; organic acids, 31 mg g-1; and lignin, 75 mg g-1 (all g per g organic matter) as shown below.
predBg(mcomp = c(carbohydrate = 0.682, protein = 0.158, lipid = 0.054, VFA = 0.031, lignin = 0.075), mass = 1, fd = 0.4, fs = 0.1)
## [1] 175.3243
The predBg() function uses a single representative composition for each group and the relative masses provided to calculate an overall empirical formula. The empirical formula of the substrate, calculated using the provided macromolecular composition, can be seen by setting value = "all".
predBg(mcomp = c(carbohydrate = 0.682, protein = 0.158, lipid = 0.054, VFA = 0.031, lignin = 0.075), mass = 1, fd = 0.4, fs = 0.1, value = "all")
## form mass mol.mass moles COD fs ## 1 C22.7452H36.9966O14.2950N1.0000 1 553.1894 0.001807699 1.393915 0.1 ## fe fd hydro fCH4 vCH4 mCH4 mCO2 m.bio ## 1 0.9 0.4 0.08038705 0.5332337 175.3243 0.1257817 0.3020592 0.03941749 ## N.req ## 1 -0.005247033
To see which formulas are used for each macromolecular group, use shortform = FALSE. The ouput now shows an alternative expression for the empirical formula.
predBg(mcomp = c(carbohydrate = 0.682, protein = 0.158, lipid = 0.054, VFA = 0.031, lignin = 0.075), mass = 1, fd = 0.4, fs = 0.1, shortform = FALSE, value = "all")
## form ## 1 (C6H10O5)68.97(C4H6.1O1.2N)29.64(C57H104O6)1(C2H4O2)8.464(C10H13O3)6.786 ## mass mol.mass moles COD fs fe fd hydro fCH4 ## 1 1 16396.54 6.098848e-05 1.393915 0.1 0.9 0.4 0.08038724 0.5332334 ## vCH4 mCH4 mCO2 m.bio N.req ## 1 175.3242 0.1257816 0.3020595 0.03941747 -0.005247033
This approach is only needed if an empirical formula is not available for a substrate. If the elemental composition of a substrate has been determined, an empirical chemical formula can be calculated, and this formula can be used with predBg(). For example, we could take the empirical formula calculated above, C29.2587H46.984O18.9464N1, round it for simplicity to C29.3H47O18.9N and use it as the form argument.
predBg("C29.2H47O18.9N", mass = 1, fd = 0.4, fs = 0.1, shortform = FALSE, value = "all")
## form mass mol.mass moles COD fs fe fd hydro ## 1 C29.2H47O18.9N 1 714.475 0.001399629 1.377235 0.1 0.9 0.4 0.07352903 ## fCH4 vCH4 mCH4 mCO2 m.bio N.req ## 1 0.5296651 173.2263 0.1242765 0.3027526 0.0389458 -0.003019109
This results are slightly different than the result from above, but only because we rounded our formula.
The mcomp argument can also be used for mixtures of pure chemicals. For example, crude glycerol is a waste product from biodiesel production, and is often added to anaerobic digesters. It isn’t uncommon for glycerol to make up of the waste. We’ll mix it with manure here, assuming a glycerol:manure VS ratio of 0.25:1.
predBg(mcomp = c(carbohydrate = 0.682, protein = 0.158, lipid = 0.054, VFA = 0.031, lignin = 0.075, C3H8O3 = 0.25), mass = 1, fd = 0.4, fs = 0.1)
## Warning in predBg(mcomp = c(carbohydrate = 0.682, protein = 0.158, lipid = 0.054, : Sum of mcomp != 1.0 so dividing all elements by the sum for calculation of formula.
## [1] 170.8523
Alternatively, since we now have an approximate empirical formula for this manure, we could use the following approach, which makes it easier to keep track of masses of the components of our mixture.
predBg(mcomp = c(C29.2H47O18.9N = 0.8, C3H8O3 = 0.2), mass = 1, fd = 0.4, fs = 0.1)
## [1] 169.1733
We can see that predicted CH4 production per g of (mixed) substrate increases substantially when crude glycerol is added. Any chemical formula can be used in this way through the mcomp argument. But one limitation at the present is that a single degradability parameter fd applies to the complete mixture.
Both form and mcomp can be used to specify mixed substrates. There are two differences between them: mcomp can be used with both macromolecular groups (e.g., carbohydrate) and chemical formulas, and quantities are mass-based, while form can only accept chemical formulas, and quantities are mole-based. An example may clarify these differences. Assume we are working with a mixture of waste paper (primarily cellulose) and waste vegetable oil at a 5:1 ratio (dry mass basis). The easiest approach here is to use mcomp66 6 To avoid the resulting warning, be sure that the sum of the mcomp vector is unity. .
predBg(mcomp = c(C6H10O5 = 5, C54H100O7 = 1), mass = 1)
## Warning in predBg(mcomp = c(C6H10O5 = 5, C54H100O7 = 1), mass = 1): Sum of mcomp != 1.0 so dividing all elements by the sum for calculation of formula.
## [1] 508.1105
To use form in this case, we need to translate this mass ratio to a mole ratio, which requires an additional step (where errors could be introduced). In this case the calculation is shown below.
1/5*molMass("C6H10O5")/molMass("C54H100O7")
## [1] 0.03764832
predBg("(C6H10O5)1 (C54H100O7)0.037648")
## [1] 508.1053
6 Total biogas production and composition
Predicting total biogas production is complicated by the behavior of CO2 after it is produced. Unlike CH4, which is only sparingly soluble in water, a significant fraction of CO2 produced remains in solution, and therefore does not contribute to biogas volume or affect its composition. Let’s continue with the paper and vegetable oil example from the last section77 7 But change our masses to avoid a warning. .
predBg(mcomp = c(C6H10O5 = 5/6, C54H100O7 = 1/6), mass = 1, value = "all")
## form mass mol.mass moles COD hydro ## 1 C1.52618H2.61516O1.00000 1 36.9655 0.02705225 1.454303 0.181493 ## fCH4 vCH4 mCH4 mCO2 ## 1 0.550384 508.1105 0.3645301 0.8169628
The fCH4 value is in our example, which is not the same as the CH4 fraction in biogas. The difference is caused by a significant fraction of the CO2 remaining in solution as CO2 (aq), H2CO3, HCO, and CO. The predBg() function can also predict this partitioning of inorganic carbon between biogas and solution, if values are provided for three additional arguments: conc.sub, which is substrate concentration in g per kg H2O; pH, which is the pH of the final solution; and temp, which is the system temperature in ∘C. Here, we’ll assume the pH is well-buffered at pH 7.5, and our total substrate concentration is 50 g kg-1. We will also assume that degradability is high (fd = 0.8) and substrate used for cell synthesis is typical (fs = 0.1).
predBg(mcomp = c(C6H10O5 = 5/6, C54H100O7 = 1/6), mass = 1, fd = 0.8, fs = 0.1, conc.sub = 50, pH = 7.5, temp = 35, value = "all")
## form mass mol.mass moles COD fs fe fd ## 1 C1.52618H2.61516O1.00000 1 36.9655 0.02705225 1.454303 0.1 0.9 0.8 ## conc.sub temp pH hydro fCH4 xCH4 vCH4 vCO2 ## 1 50 35 7.5 0.09279292 0.5566161 0.6380063 365.8395 206.6652 ## vBg mCH4 mCO2 mCO2Bg mCO2.sol cTIC m.bio ## 1 572.5047 0.2624617 0.5735654 0.4085402 0.1650252 0.1874861 0.08225028 ## N.req ## 1 0.01018521
Only after specifying values for these additional arguments will predBg return a column with biogas composition: xCH4 gives the mole fraction of CH4 in dry biogas. In this example, we can see that at 62% xCH4 is substantially higher than based on stoichiometry alone (fCH4). The difference between the two is, as explained above, TIC in solution. Additional new columns in this output give data for the volume of CO2 in biogas (vCO2, mL), the total volume of (dry, standardized) biogas (vBg, mL), the mass of CO2 in biogas and in solution (mCO2Bg and mCO2.sol, g), and the total inorganic carbon concentration in solution (cTIC, mol kg-1). In fact, nearly one-third of all the CO2 produced ends up in the solution in this example–it may be higher in other cases.
How might pH affect biogas composition? Let’s look at a range of values.
bg1 <- predBg(mcomp = c(C6H10O5 = 5/6, C54H100O7 = 1/6), mass = 1, fd = 0.8, fs = 0.1, conc.sub = 50, pH = c(6.5 + 0:10*0.2), temp = 35, value = "all")
plot(xCH4 ~ pH, data = bg1, type = 'o', col = "red")
plot(vBg ~ pH, data = bg1, type = 'o', ylim = c(0, max(bg1$vBg)), col = "blue")
Clearly, pH alone could have a major effect on biogas quality and volume!
Predicting production and quality of biogas when the starting solution contains inorganic carbon is more complicated. The method assumes that all CO2 in the system is accounted by the empirical formula (form). This may not be the case–for example if a bicarbonate (HCO) salt is included as a buffer in our BMP test with cellulose, or for our manure example, there is certainly significant TIC in raw manure. Here we need to be careful, and understand where our empirical formula came from. Does it include all C, or just the amount in the organic fraction? Does it include the O in TIC? Additional TIC could easily be added in with the predBg() function, but it is necessary to first determine the mole or mass ratio of substrate:TIC to correctly specify the resulting mixture using form or mcomp.
7 Calculation methods
How are the calculations presented above carried out? Stoichiometry of a complete biomethanation reaction is determined based on [4].
| (1) |
| (2) |
| (3) |
Here, and are the fraction of substrate electrons going to cell synthesis and energy production, respectively, the formula C5H7O2N is an empirical formula for cell biomass88 8 Presently it is not possible to use a different formula. , and . In addition to providing estimates of CH4 production, this approach allows predBg() to return production of CO299 9 More accurately, total inorganic carbon (TIC), which includes both CO2 and HCO from the above reaction. , consumption or production of ammonia, and production of cell biomass. Predicted CH4 is always expressed in mL (cm3) at standard conditions of 101.325 kPa (1.0 atm) and 0∘C (273.15 K).
For these estimates to approach observed values, it is necessary to include and accurately set . How should a value be selected? Based on [4], is related to the intrinsic value , the solids retention time , the rate of microbial biomass decay (d-1), and the degradabiilty of microbial biomass (fraction).
| (4) |
Values of are given in [4]. For acetate fermenting methanogens, , and for hydrogen oxidizing methanogens, . But most calculations should be based on an overall value for the entire microbial community, which includes fermentative bacteria as well. Table 13.2 in [4] gives estimates for and for various types of wastes: ranges from 0.06 for lipids to 0.28 for carbohydrates, and ranges from 0.02 d-1 for proteins to 0.05 for most other types of substrates. Calculated values of are shown for three types of substrates below, assuming [4].
To determine “theororetical BMP”, should be set to zero (), which is the default.
Complex substrates are not completely degraded during anaerobic digestion, and the amount of the “degradable” (perhaps “degraded” is more accurate) fraction can be specified with the argument. For complex substrates, the degradability of different components within a single substrate will differ, e.g., cellulose is much more degradable than lignin. But the current approach used for predBg() assumes that all components have the same degradability .
The predBg() function can also calculate CH4 production from COD. In this case, CH4 volume is calculated based on the oxidation of CH4 with O21010 10 This reaction is based on a single electron equivalent. [4]:
| (5) |
which gives a ratio of CH4 to O2 of . Based on conservation of COD, potential CH4 production of a substrate with COD is therefore:
| (6) |
where molar volume of CH4 (22361 mL g-1, defined at 1 atm and 0∘C [2]) and is the molar mass of O2 (32.0 g mol-1). If and are available, they reduce the fraction of COD converted.
| (7) |
The approach used to calculate CO2 partitioning is based on equilibrium speciation as described in [1] and should be accurate for continuous reactors with stable operation at least. Predictions for batch reactors are more difficult and results will probably be less accurate.
References
- [1] S. D. Hafner, F. Montes, and C. A. Rotz. The role of carbon dioxide in emission of ammonia from manure. Atmospheric Environment, 66:63–71, 2012.
- [2] P.J. Linstrom and W.G. Mallard, editors. NIST Chemistry WebBook, NIST Standard Reference Database Number 69. National Institute of Standards and Technology, Gaithersburg, MD, 2011.
- [3] H.B. Moller, S.G. Sommer, and B.K. Ahring. Methane productivity of manure, straw and solid fractions of manure. Biomass and Bioenergy, 26(5):485–495, May 2004.
- [4] B. E. Rittmann and P. L. McCarty. Environmental Biotechnology: Principles and Applications. McGraw-Hill series in water resources and environmental engineering. McGraw-Hill, Boston, 2001.