# Calculate BMP with data from a laboratory BMP test, and calculate and compare results for
# cellulose to the expected value
data("vol2")
data("comp2")
data("setup2")
# vol2 has measured biogas volumes
head(vol2)
# comp2 has measured biogas composition
head(comp2)
# setup2 has information on batch reactor content
head(setup2)
# Calculate cumulative biogas and methane production volumes at dry conditions and
# 0 degrees C and 1.0 atm
cprod <- cumBg(vol2,temp=20,comp=comp2,id.name="bottle",time.name="days",dat.name="meas.vol",
comp.name="CH4.conc",extrap=TRUE)
head(cprod)
# Now we can get methane production from a common time for all reactors (60 d here)
# (interpolation is used if needed), calculate and subtract out the inoculum contribution,
# and normalize by substrate VS mass
bmps <- summBg(vol=cprod,setup=setup2,when=60,id.name="bottle",time.name="days",
descrip.name="description",inoc.name="Inoculum",inoc.m.name="inoc.mass",
norm.name="sub.vs")
bmps
# Or, to see all cumulative values at 60 d
bmpobs <- summBg(vol=cprod,setup=setup2,when=60,id.name="bottle",time.name="days",
descrip.name="description",inoc.name="Inoculum",inoc.m.name="inoc.mass",
norm.name="sub.vs",show.obs=TRUE)
bmpobs
# When individual observations are shown like this, the separate contributions of substrate
# and inoculum are also returned, along with total production (including inoculum
# contribution).
# It is possible to get results for more than one time
bmps2 <- summBg(vol=cprod,setup=setup2,when=c(10,30,60),id.name="bottle",time.name="days",
descrip.name="description",inoc.name="Inoculum",inoc.m.name="inoc.mass",
norm.name="sub.vs")
bmps2
# bmps, bmps2, and bmpobs results are corrected for inoculum and normalized to 1 g substrate VS
# To just get all cumulative methane values, don't provide values for inoc.name, inoc.m.name,
# and norm.name
allresults <- summBg(vol=cprod,setup=setup2,when=60,id.name="bottle",time.name="days",
descrip.name="description", show.obs=TRUE)
allresults
# How much methane should we expect to get from pure cellulose?
predBg("C6H10O5")
# Let's assume 10% is used to produce microbial biomass
predBg("C6H10O5",fs=0.05)
predBg("C6H10O5",fs=0.05,value="all")
# Compare to measurement
bmps
bmps[bmps$description=="Cellulose","mean"]/predBg("C6H10O5",fs=0.05)
# About 15% higher than expected
Run the code above in your browser using DataLab