Learn R Programming

biogas (version 1.0.1)

mass2vol: Calculate Biogas Production Gravimetrically

Description

mass2vol calculates biogas volume based on measured reactor mass loss.

Usage

mass2vol(mass, xCH4, temp, pres = 1, unit.pres = "atm", unit.temp = "C", pres.std = NULL, 
         temp.std = NULL, value = "CH4", headspace = NULL, headcomp = "N2")

Arguments

mass
reactor mass loss in g. A numeric vector.
xCH4
mole fraction of methane in biogas (dry, methane + carbon dioxide only). A numeric vector.
temp
the temperature of biogas as it exited the reactor. A length-one numeric vector. Degrees Celcius by default (see unit.temp argument).
pres
the pressure of biogas as it exited the reactor. A length-one numeric vector. Atmospheres (atm) by default (see unit.pres argument).
unit.pres
pressure units for pres and pres.std arguments. Options are "atm" (the default), "Pa", "kPa", "hPa", and "bar".
unit.temp
temperature units for temp and temp.std arguments. Options are "C" (degrees Celcius, the default), "F", and "K".
pres.std
standard pressure for presentation of biogas and methane results. Default value is 1.0 atm. Length one numeric vector.
temp.std
standard temperature for presentation of biogas and methane results. Default value is 0 degrees C.
value
what should be returned? Default is "CH4", which returns methane volume in mL. "all" returns biogas, methane, and carbon dioxide volumes.
headspace
(optional) reactor headspace volume in mL. Used to correct for effect of initial reactor headspace on mass loss. A numeric vector.
headcomp
(optional) composition of the initial reactor headspace. Only required if headspace argument is specified. Currently, the only option is "N2" for dinitrogen gas. Use of any other value will be ignored with a warnin

Value

  • volume of methane in mL as a numeric vector (if value="CH4") or a matrix with columns for biogas, methane, and carbon dioxide volumes in mL.
  • vBgstandardized volume of biogas in mL
  • vCH4standardized volume of methane in mL
  • vCH4standardized volume of carbon dioxyde in mL
  • All volumes are standardized using pres.std and temp.std arguments (see stdVol).

concept

biogas

Details

This function uses the method described in Hafner et al. (in review) to calculate biogas production from reactor mass loss. It is essential that the only change in reactor mass is due to biogas removal! Users are advised to read the original reference before applying the method. This function is vectorized. Instead of using this function directly when working with multiple measurements on multiple reactors, use the cumBg function (which can call up mass2vol).

References

Hafner, S.D., Rennuit, C., Triolo, J.M., Richards, B.K. In review. A gravimetric method for measuring biogas production. Biomass and Bioenergy.

See Also

vol2mass, stdVol, cumBg

Examples

Run this code
# Volume of methane if measured mass loss was 3.1 g
  mass2vol(3.1,xCH4=0.65,temp=35)
  # More details
  mass2vol(3.1,xCH4=0.65,temp=20,value="all")
  
  # Vectorized
  data("massw")
  massw$massloss <- massw$start - massw$end
  massw$vCH4 <- mass2vol(massw$massloss,xCH4=0.65,temp=37)
  massw

Run the code above in your browser using DataLab