cdmAmsIIId-methodology.RmdAMS-III.D covers methane recovery from animal manure management
systems. This vignette demonstrates how cdmAmsIIId
operationalises the methodology with tidyverse data structures. We
simulate digesters, verify applicability, walk through equation-level
helpers, and complete the monitoring workflow.
We begin by simulating monitoring data and running the three applicability helpers.
monitoring <- simulate_ams_iiid_dataset(n_farms = 2, n_periods = 4, seed = 2025)
tibble::tibble(
system = check_applicability_system_type_iiid(monitoring, group_cols = "farm_id")$system_type_applicable,
frequency = check_applicability_measurement_frequency_iiid(monitoring, group_cols = "farm_id")$measurement_frequency_applicable,
controls = check_applicability_leakage_control_iiid(monitoring, group_cols = "farm_id")$leakage_controls_applicable
) |>
tidyr::pivot_longer(everything(), names_to = "criterion", values_to = "applicable") |>
quiet_kable(caption = "Applicability outcomes for each AMS-III.D criterion")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| criterion | applicable |
|---|---|
| system | TRUE |
| frequency | TRUE |
| controls | FALSE |
| system | TRUE |
| frequency | TRUE |
| controls | TRUE |
The simulated dataset provides methane generation parameters and monitoring metadata for each period.
head(monitoring) |>
quiet_kable(caption = "Excerpt of simulated AMS-III.D monitoring data")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| farm_id | monitoring_period | year | month | days_in_period | volatile_solids_kg_per_day | methane_potential_m3_per_kg_vs | baseline_mcf_fraction | project_mcf_fraction | capture_efficiency_fraction | destruction_efficiency_fraction | methane_recovered_m3 | leakage_emissions_tco2e | system_type | measurements_per_month | leakage_controls_in_place |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| farm_01 | 1 | 2024 | 1 | 30 | 38.25897 | 0.2358604 | 0.7973926 | 0.5953660 | 0.8152952 | 0.9744679 | 6825.638 | 0.0302362 | anaerobic lagoon | 9 | TRUE |
| farm_01 | 2 | 2024 | 2 | 30 | 35.18712 | 0.2484258 | 0.8208835 | 0.5479459 | 0.9151712 | 0.9672106 | 6780.003 | 0.0269570 | uncovered digester | 11 | TRUE |
| farm_01 | 3 | 2024 | 3 | 30 | 39.05906 | 0.2352516 | 0.7343653 | 0.5632880 | 0.9083011 | 0.9527681 | 7162.925 | 0.0291299 | anaerobic lagoon | 10 | FALSE |
| farm_01 | 4 | 2024 | 4 | 30 | 41.68057 | 0.2189394 | 0.9214510 | 0.6020286 | 0.8499133 | 0.9698346 | 7241.613 | 0.0309192 | liquid slurry store | 11 | TRUE |
| farm_02 | 1 | 2024 | 1 | 30 | 36.94762 | 0.2349484 | 0.7877715 | 0.5847947 | 0.8394437 | 0.9827634 | 6697.171 | 0.0285704 | anaerobic lagoon | 7 | TRUE |
| farm_02 | 2 | 2024 | 2 | 30 | 34.14501 | 0.2491789 | 0.8366893 | 0.6289050 | 0.8278704 | 0.9742211 | 6901.316 | 0.0301146 | uncovered digester | 9 | TRUE |
Equation helpers operate on tidy tables and can be combined sequentially. We aggregate to the farm level for clarity.
aggregated <- aggregate_monitoring_periods_iiid(monitoring, group_cols = "farm_id")
baseline <- calculate_baseline_methane_emissions_iiid(aggregated, group_cols = "farm_id")
project <- calculate_project_methane_emissions_iiid(aggregated, group_cols = "farm_id")
recovered <- calculate_recovered_methane_iiid(aggregated, group_cols = "farm_id")
leakage <- calculate_leakage_emissions_iiid(aggregated, group_cols = "farm_id")
list(
Baseline = baseline,
Project = project,
Recovered = recovered,
Leakage = leakage
) |>
purrr::imap_dfr(~ dplyr::mutate(.x, component = .y), .id = NULL) |>
dplyr::relocate(component) |>
quiet_kable(caption = "Equation-level outputs across components")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| component | farm_id | baseline_emissions_tco2e | project_emissions_tco2e | recovered_methane_tco2e | leakage_emissions_tco2e |
|---|---|---|---|---|---|
| Baseline | farm_01 | 66.65810 | NA | NA | NA |
| Baseline | farm_02 | 66.57075 | NA | NA | NA |
| Project | farm_01 | NA | 7.399157 | NA | NA |
| Project | farm_02 | NA | 7.680403 | NA | NA |
| Recovered | farm_01 | NA | NA | 507.6419 | NA |
| Recovered | farm_02 | NA | NA | 522.9936 | NA |
| Leakage | farm_01 | NA | NA | NA | 0.1172423 |
| Leakage | farm_02 | NA | NA | NA | 0.1192977 |
When working with period-level data, use
aggregate_monitoring_periods_iiid() to roll up flows while
averaging coefficients.
aggregate_monitoring_periods_iiid(monitoring, group_cols = "farm_id") |>
quiet_kable(caption = "Aggregated monitoring data by farm")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| farm_id | volatile_solids_kg_per_day | methane_recovered_m3 | leakage_emissions_tco2e | days_in_period | methane_potential_m3_per_kg_vs | baseline_mcf_fraction | project_mcf_fraction | capture_efficiency_fraction | destruction_efficiency_fraction |
|---|---|---|---|---|---|---|---|---|---|
| farm_01 | 154.1857 | 28010.18 | 0.1172423 | 120 | 0.2346193 | 0.8185231 | 0.5771571 | 0.8721702 | 0.9660703 |
| farm_02 | 142.7575 | 28491.09 | 0.1192977 | 120 | 0.2436492 | 0.8501690 | 0.6113661 | 0.8580228 | 0.9784856 |
The meta-function composes equation helpers to produce emission reductions in a single call.
reductions <- estimate_emission_reductions_ams_iiid(
baseline_data = monitoring,
project_data = monitoring,
recovery_data = monitoring,
leakage_data = monitoring,
group_cols = "farm_id"
)
reductions |>
quiet_kable(caption = "Net emission reductions from AMS-III.D workflow")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| farm_id | emission_reductions_tco2e |
|---|---|
| farm_01 | 522.2207 |
| farm_02 | 537.5060 |
reference <- tibble::tribble(
~Function, ~Signature, ~Purpose,
"check_applicability_system_type_iiid", "(data, system_type_col, allowed_types, group_cols)", "Validate manure system eligibility.",
"check_applicability_measurement_frequency_iiid", "(data, frequency_col, minimum_frequency, group_cols)", "Confirm monitoring frequency requirements.",
"check_applicability_leakage_control_iiid", "(data, control_indicator_col, group_cols)", "Ensure leakage controls are documented.",
"calculate_baseline_methane_emissions_iiid", "(data, volatile_solids_col, methane_potential_col, methane_conversion_factor_col)", "Baseline methane emissions.<br>\\(BE_y = \\sum_i VS_{i,y} \\times B0_{i,y} \\times MCF^{BL}_{i,y} \\times d_{i,y} \\times \\rho_{CH4} \\times GWP_{CH4}\\)",
"calculate_project_methane_emissions_iiid", "(data, project_methane_conversion_factor_col, capture_efficiency_col)", "Project methane emissions.<br>\\(PE_y = \\sum_i \\big(VS_{i,y} \\times B0_{i,y} \\times MCF^{PR}_{i,y} - DEST_{i,y}\\big) \\times \\rho_{CH4} \\times GWP_{CH4}\\)",
"calculate_recovered_methane_iiid", "(data, methane_recovered_col, destruction_efficiency_col)", "Destroyed methane from recovery.<br>\\(DEST_y = \\sum_i MREC_{i,y} \\times DE_{i,y} \\times \\rho_{CH4} \\times GWP_{CH4}\\)",
"calculate_leakage_emissions_iiid", "(data, leakage_col)", "Leakage totals.<br>\\(LE_y = \\sum_i LE_{i,y}\\)",
"calculate_emission_reductions_iiid", "(baseline, project, recovered, leakage, group_cols)", "Net emission reductions.<br>\\(ER_y = (BE_y - PE_y) - LE_y\\)",
"aggregate_monitoring_periods_iiid", "(data, group_cols, sum_cols, mean_cols)", "Roll up monitoring periods.<br>\\(ER_{p,y} = (BE_{p,y} - PE_{p,y}) - LE_{p,y}\\)",
"estimate_emission_reductions_ams_iiid", "(baseline_data, project_data, recovery_data, leakage_data, group_cols)", "Meta-estimator for AMS-III.D.<br>\\(ER_y = (BE_y - PE_y) - LE_y\\)"
)
quiet_kable(reference, escape = FALSE)
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| Function | Signature | Purpose |
|---|---|---|
| check_applicability_system_type_iiid | (data, system_type_col, allowed_types, group_cols) | Validate manure system eligibility. |
| check_applicability_measurement_frequency_iiid | (data, frequency_col, minimum_frequency, group_cols) | Confirm monitoring frequency requirements. |
| check_applicability_leakage_control_iiid | (data, control_indicator_col, group_cols) | Ensure leakage controls are documented. |
| calculate_baseline_methane_emissions_iiid | (data, volatile_solids_col, methane_potential_col, methane_conversion_factor_col) | Baseline methane
emissions. |
| calculate_project_methane_emissions_iiid | (data, project_methane_conversion_factor_col, capture_efficiency_col) | Project methane
emissions. |
| calculate_recovered_methane_iiid | (data, methane_recovered_col, destruction_efficiency_col) | Destroyed methane from
recovery. |
| calculate_leakage_emissions_iiid | (data, leakage_col) | Leakage
totals. |
| calculate_emission_reductions_iiid | (baseline, project, recovered, leakage, group_cols) | Net emission
reductions. |
| aggregate_monitoring_periods_iiid | (data, group_cols, sum_cols, mean_cols) | Roll up monitoring
periods. |
| estimate_emission_reductions_ams_iiid | (baseline_data, project_data, recovery_data, leakage_data, group_cols) | Meta-estimator for
AMS-III.D. |
overview <- tibble::tribble(
~Step, ~Description, ~Function,
"1", "Generate or collect monitoring data by period.", "simulate_ams_iiid_dataset()",
"2", "Confirm system eligibility, monitoring frequency, and leakage controls.", "check_applicability_*_iiid()",
"3", "Aggregate monitoring periods to the reporting unit.", "aggregate_monitoring_periods_iiid()",
"4", "Apply equation helpers to compute baseline, project, recovered, and leakage emissions.", "calculate_*_iiid()",
"5", "Compose results into emission reductions.", "estimate_emission_reductions_ams_iiid()"
)
quiet_kable(overview, caption = "High-level AMS-III.D workflow")
#> Warning: 'xfun::attr()' is deprecated.
#> Use 'xfun::attr2()' instead.
#> See help("Deprecated")| Step | Description | Function |
|---|---|---|
| 1 | Generate or collect monitoring data by period. | simulate_ams_iiid_dataset() |
| 2 | Confirm system eligibility, monitoring frequency, and leakage controls. | check_applicability_*_iiid() |
| 3 | Aggregate monitoring periods to the reporting unit. | aggregate_monitoring_periods_iiid() |
| 4 | Apply equation helpers to compute baseline, project, recovered, and leakage emissions. | calculate_*_iiid() |
| 5 | Compose results into emission reductions. | estimate_emission_reductions_ams_iiid() |