View source: R/netGas_calculation.R
| netGas | R Documentation |
Two functions that allow to calculate the net amount of biogas produced by fermentations in a BGF.
Both allow to subtract the amount of gas produced by blanks from fermentations, but differ in the way the netGas is calculated and also in the experimental data they need as input.
netGas(x, purity = 1, substract_blank = TRUE, pos = 7, feedback = FALSE)
netGasGC(
x,
purity,
percent = TRUE,
substract_blank = TRUE,
pos = 7,
na_replace = 0,
feedback = FALSE
)
x |
a |
purity |
either a |
substract_blank |
|
pos |
an |
feedback |
|
percent |
|
na_replace |
a |
The function netGas uses the 'product' column of the BioGasData layer of a BGF to calculate the 'net_product' and can be used if no gas quality measurements are available.
When called, it uses the same assumed purity of the product gas for blanks and fermentations.
The expected use case is the analysis of AMPTS II generated data, where a methane concentration of 100 vol.% can be assumed due to CO2 absorption units of that system.
The function netGasGC uses the 'production' column instead of the 'product' column to calculate the 'net_product' column of the BioGasData layer of a BGF.
It furthermore needs a column providing gas quality measurements added to the BioGasData layer.
a BGF
To be able of subtracting the amount of gas produced by blank fermentations from the other fermentations, it is essential to provide the information of how much blank was used to inoculate each fermentation. If this information is not known, it can be deduced from the inoculum to substrate ratio and the working load (mass or volume) of the fermentation.
# create an example BGF
myBGF <- BGF(
ReactorLayout = c("2*Blank","Cellulose","2*S1 ctrl","2*S1 7d","2*S1 4d",
"2*S2 ctrl","2*S2 4d","2*S2 6d"),
BlankLabel = "Blank",
name = "myBGF",
ProcessTemp = 42,
MeasurementType = "AMPTSV2")
# add data generated by an AMPTS II
myBGF <- add_bmp_measurement(
x = myBGF,
path = base::system.file("extdata","AMPTSV2.csv",package ="bgfanalyzer"))
# convert data columns
myBGF <- cols_to_numeric(myBGF)
# close gaps in data
myBGF <- close_gaps(myBGF)
# calculate netGas
myBGF <- netGas(myBGF)
# create a second example BGF
myBGF2 <- from_standard_record(
ReactorLayout = "A",
ProcessTemp = 80,
InocToSubRatio = .1,
path = base::system.file("extdata","Fermentation_A.tsv",package ="bgfanalyzer"),
time_col = 1,
product_col = 3)
# import gas quality data
gasq <- import_standard_record(
ipath = base::system.file(
"extdata",
"gasq_A.tsv",
package ="bgfanalyzer"),
mkFRTime = "2025-01-15 17:00:00",
FRTime_col = 1,
units = "hours")
# add gas quality data to
myBGF2 <- add_BG_parameter(myBGF2,gasq,"R1",3,2,name = "H2",cut_zero = TRUE)
# ensure data integrity
myBGF2 <- update_BGF(myBGF2)
# correct NA's
myBGF2 <- na_correction(myBGF2)
# calculate production
myBGF2 <- calculate_flow_from_volume(myBGF2)
# calculate net gas based on production
myBGF2 <- netGasGC(myBGF2,substract_blank = FALSE,purity = "H2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.