cdmAmsIIg-methodology.RmdThis vignette demonstrates how to reproduce the AMS-II.G calculations
using cdmAmsIIg. The methodology covers cookstove and
thermal energy efficiency programmes that reduce the consumption of
non-renewable biomass. The workflow applies non-renewable biomass
fractions, converts resulting quantities to thermal energy, multiplies
by emission factors, and accounts for any leakage to produce emission
reductions.
library(cdmAmsIIg)
baseline_example <- tibble::tibble(
baseline_biomass_consumption_tonnes = c(12, 14),
baseline_non_renewable_fraction = c(0.84, 0.88)
)
project_example <- tibble::tibble(
project_biomass_consumption_tonnes = c(7.2, 8.0),
project_non_renewable_fraction = c(0.42, 0.39)
)
monitoring_example <- tibble::tibble(
baseline_biomass_consumption_tonnes = 12,
baseline_non_renewable_fraction = 0.85,
baseline_net_calorific_value_mj_per_tonne = 15.2,
baseline_emission_factor_tco2_per_mj = 0.00009,
project_biomass_consumption_tonnes = 7.4,
project_non_renewable_fraction = 0.4,
project_net_calorific_value_mj_per_tonne = 15.3,
project_emission_factor_tco2_per_mj = 0.00005
)
check_applicability_efficiency_improvement_iig(baseline_example, project_example)## [1] TRUE
check_applicability_fraction_bounds_iig(monitoring_example)## [1] TRUE
check_applicability_monitoring_iig(monitoring_example)## [1] TRUE
set.seed(123)
example_data <- simulate_ams_iig_dataset(n_sites = 3, n_periods = 4, seed = 123)
quiet_kable(
head(example_data),
format = "html",
digits = 3
)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| site_id | period | year | month | day | monitoring_date | monitoring_label | baseline_biomass_consumption_tonnes | baseline_non_renewable_fraction | baseline_net_calorific_value_mj_per_tonne | baseline_emission_factor_tco2_per_mj | project_biomass_consumption_tonnes | project_non_renewable_fraction | project_net_calorific_value_mj_per_tonne | project_emission_factor_tco2_per_mj | leakage_emissions_tco2e | service_level_indicator |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| site_01 | 1 | 2024 | 1 | 15 | 2024-01-15 | 2024-01 | 14.384 | 0.819 | 14.902 | 0 | 7.911 | 0.334 | 14.944 | 0 | 0.118 | 0.922 |
| site_01 | 2 | 2024 | 2 | 19 | 2024-02-19 | 2024-02 | 16.689 | 0.821 | 15.746 | 0 | 9.179 | 0.370 | 15.868 | 0 | 0.137 | 0.922 |
| site_01 | 3 | 2024 | 3 | 14 | 2024-03-14 | 2024-03 | 10.373 | 0.841 | 14.439 | 0 | 5.705 | 0.394 | 14.883 | 0 | 0.087 | 0.963 |
| site_01 | 4 | 2024 | 4 | 3 | 2024-04-03 | 2024-04 | 17.549 | 0.837 | 15.236 | 0 | 9.652 | 0.444 | 15.276 | 0 | 0.147 | 0.968 |
| site_02 | 1 | 2024 | 1 | 10 | 2024-01-10 | 2024-01 | 15.058 | 0.807 | 15.242 | 0 | 8.282 | 0.392 | 15.695 | 0 | 0.121 | 1.008 |
| site_02 | 2 | 2024 | 2 | 18 | 2024-02-18 | 2024-02 | 19.310 | 0.847 | 14.468 | 0 | 10.620 | 0.416 | 14.632 | 0 | 0.163 | 0.923 |
The simulated monitoring data include site identifiers, period labels, baseline and project biomass consumption, non-renewable fractions, net calorific values, emission factors, leakage placeholders, and a simple service-level indicator.
baseline_nrb <- calculate_baseline_non_renewable_biomass_iig(
example_data,
group_cols = c("site_id", "monitoring_label")
)
project_nrb <- calculate_project_non_renewable_biomass_iig(
example_data,
group_cols = c("site_id", "monitoring_label")
)
baseline_energy <- calculate_baseline_thermal_energy_iig(
baseline_nrb,
baseline_data = example_data,
group_cols = c("site_id", "monitoring_label")
)
project_energy <- calculate_project_thermal_energy_iig(
project_nrb,
project_data = example_data,
group_cols = c("site_id", "monitoring_label")
)
baseline_emissions <- calculate_emissions_from_energy_iig(
baseline_energy,
energy_col = "baseline_thermal_energy_mj",
factor_data = example_data,
emission_factor_col = "baseline_emission_factor_tco2_per_mj",
group_cols = c("site_id", "monitoring_label"),
output_col = "baseline_emissions_tco2e"
)
project_emissions <- calculate_emissions_from_energy_iig(
project_energy,
energy_col = "project_thermal_energy_mj",
factor_data = example_data,
emission_factor_col = "project_emission_factor_tco2_per_mj",
group_cols = c("site_id", "monitoring_label"),
output_col = "project_emissions_tco2e"
)
leakage_emissions <- calculate_leakage_emissions_iig(
example_data,
group_cols = c("site_id", "monitoring_label"),
leakage_col = "leakage_emissions_tco2e"
)
emission_reductions <- calculate_emission_reductions_iig(
baseline_emissions,
project_emissions,
leakage_emissions,
group_cols = c("site_id", "monitoring_label")
)
quiet_kable(head(emission_reductions), format = "html", digits = 4)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| site_id | monitoring_label | emission_reductions_tco2e |
|---|---|---|
| site_01 | 2024-01 | -0.1051 |
| site_01 | 2024-02 | -0.1222 |
| site_01 | 2024-03 | -0.0787 |
| site_01 | 2024-04 | -0.1319 |
| site_02 | 2024-01 | -0.1091 |
| site_02 | 2024-02 | -0.1474 |
period_summary <- aggregate_monitoring_periods_iig(
monitoring_data = example_data,
group_cols = "site_id",
period_cols = c("monitoring_label")
)
quiet_kable(head(period_summary), format = "html", digits = 4)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| site_id | monitoring_label | baseline_biomass_consumption_tonnes | project_biomass_consumption_tonnes | baseline_non_renewable_fraction | project_non_renewable_fraction | baseline_net_calorific_value_mj_per_tonne | project_net_calorific_value_mj_per_tonne | baseline_emission_factor_tco2_per_mj | project_emission_factor_tco2_per_mj | leakage_emissions_tco2e |
|---|---|---|---|---|---|---|---|---|---|---|
| site_01 | 2024-01 | 14.3845 | 7.9115 | 0.8186 | 0.3344 | 14.9016 | 14.9443 | 1e-04 | 1e-04 | 0.1178 |
| site_01 | 2024-02 | 16.6892 | 9.1790 | 0.8207 | 0.3700 | 15.7458 | 15.8676 | 1e-04 | 1e-04 | 0.1370 |
| site_01 | 2024-03 | 10.3727 | 5.7050 | 0.8414 | 0.3935 | 14.4394 | 14.8828 | 1e-04 | 1e-04 | 0.0873 |
| site_01 | 2024-04 | 17.5494 | 9.6522 | 0.8366 | 0.4443 | 15.2362 | 15.2757 | 1e-04 | 1e-04 | 0.1468 |
| site_02 | 2024-01 | 15.0580 | 8.2819 | 0.8066 | 0.3924 | 15.2422 | 15.6951 | 1e-04 | 1e-04 | 0.1215 |
| site_02 | 2024-02 | 19.3095 | 10.6202 | 0.8466 | 0.4165 | 14.4681 | 14.6319 | 1e-04 | 1e-04 | 0.1635 |
estimate_emission_reductions_ams_iig(
baseline_data = example_data,
project_data = example_data,
leakage_data = example_data,
group_cols = c("site_id", "monitoring_label")
)## # A tibble: 12 × 10
## site_id monitoring_label baseline_non_renewable_biom…¹ project_non_renewabl…²
## <chr> <chr> <dbl> <dbl>
## 1 site_01 2024-01 11.8 2.65
## 2 site_01 2024-02 13.7 3.40
## 3 site_01 2024-03 8.73 2.25
## 4 site_01 2024-04 14.7 4.29
## 5 site_02 2024-01 12.1 3.25
## 6 site_02 2024-02 16.3 4.42
## 7 site_02 2024-03 13.5 1.99
## 8 site_02 2024-04 12.2 2.88
## 9 site_03 2024-01 9.48 2.69
## 10 site_03 2024-02 13.7 3.12
## 11 site_03 2024-03 13.8 3.65
## 12 site_03 2024-04 11.6 3.36
## # ℹ abbreviated names: ¹baseline_non_renewable_biomass_tonnes,
## # ²project_non_renewable_biomass_tonnes
## # ℹ 6 more variables: baseline_thermal_energy_mj <dbl>,
## # project_thermal_energy_mj <dbl>, baseline_emissions_tco2e <dbl>,
## # project_emissions_tco2e <dbl>, leakage_emissions_tco2e <dbl>,
## # emission_reductions_tco2e <dbl>
function_reference <- tibble::tibble(
Function = c(
"`calculate_baseline_non_renewable_biomass_iig()`",
"`calculate_project_non_renewable_biomass_iig()`",
"`calculate_baseline_thermal_energy_iig()`",
"`calculate_project_thermal_energy_iig()`",
"`calculate_emissions_from_energy_iig()`",
"`calculate_leakage_emissions_iig()`",
"`calculate_emission_reductions_iig()`",
"`aggregate_monitoring_periods_iig()`",
"`estimate_emission_reductions_ams_iig()`",
"`simulate_ams_iig_dataset()`"
),
Signature = c(
"`calculate_baseline_non_renewable_biomass_iig(baseline_data, consumption_col = \"baseline_biomass_consumption_tonnes\", fraction_col = \"baseline_non_renewable_fraction\", group_cols = NULL, output_col = \"baseline_non_renewable_biomass_tonnes\")`",
"`calculate_project_non_renewable_biomass_iig(project_data, project_consumption_col = \"project_biomass_consumption_tonnes\", project_fraction_col = \"project_non_renewable_fraction\", group_cols = NULL, output_col = \"project_non_renewable_biomass_tonnes\")`",
"`calculate_baseline_thermal_energy_iig(non_renewable_biomass, biomass_col = \"baseline_non_renewable_biomass_tonnes\", baseline_data, ncv_col = \"baseline_net_calorific_value_mj_per_tonne\", group_cols = NULL, output_col = \"baseline_thermal_energy_mj\")`",
"`calculate_project_thermal_energy_iig(non_renewable_biomass, biomass_col = \"project_non_renewable_biomass_tonnes\", project_data, ncv_col = \"project_net_calorific_value_mj_per_tonne\", group_cols = NULL, output_col = \"project_thermal_energy_mj\")`",
"`calculate_emissions_from_energy_iig(energy_data, energy_col = \"baseline_thermal_energy_mj\", factor_data, emission_factor_col = \"baseline_emission_factor_tco2_per_mj\", group_cols = NULL, output_col = \"baseline_emissions_tco2e\")`",
"`calculate_leakage_emissions_iig(leakage_data = NULL, leakage_col = \"leakage_emissions_tco2e\", group_cols = NULL, output_col = \"leakage_emissions_tco2e\")`",
"`calculate_emission_reductions_iig(baseline_emissions, project_emissions, leakage_emissions = NULL, group_cols = NULL, output_col = \"emission_reductions_tco2e\")`",
"`aggregate_monitoring_periods_iig(monitoring_data, group_cols = \"site_id\", period_cols = c(\"year\", \"month\"), baseline_consumption_col = \"baseline_biomass_consumption_tonnes\", baseline_fraction_col = \"baseline_non_renewable_fraction\", baseline_ncv_col = \"baseline_net_calorific_value_mj_per_tonne\", baseline_emission_factor_col = \"baseline_emission_factor_tco2_per_mj\", project_consumption_col = \"project_biomass_consumption_tonnes\", project_fraction_col = \"project_non_renewable_fraction\", project_ncv_col = \"project_net_calorific_value_mj_per_tonne\", project_emission_factor_col = \"project_emission_factor_tco2_per_mj\", leakage_col = \"leakage_emissions_tco2e\")`",
"`estimate_emission_reductions_ams_iig(baseline_data, project_data, leakage_data = NULL, group_cols = NULL, baseline_consumption_col = \"baseline_biomass_consumption_tonnes\", baseline_fraction_col = \"baseline_non_renewable_fraction\", baseline_ncv_col = \"baseline_net_calorific_value_mj_per_tonne\", baseline_emission_factor_col = \"baseline_emission_factor_tco2_per_mj\", project_consumption_col = \"project_biomass_consumption_tonnes\", project_fraction_col = \"project_non_renewable_fraction\", project_ncv_col = \"project_net_calorific_value_mj_per_tonne\", project_emission_factor_col = \"project_emission_factor_tco2_per_mj\", leakage_col = \"leakage_emissions_tco2e\")`",
"`simulate_ams_iig_dataset(n_sites = 5, n_periods = 4, start_year = 2024, start_month = 1, seed = NULL, baseline_consumption_mean = 14, efficiency_gain = 0.45, baseline_fraction_mean = 0.85, project_fraction_mean = 0.4)`"
),
Purpose = c(
"Applies the non-renewable fraction to baseline biomass consumption.<br>\\(NRB^{BL}_y = \\sum_i FC^{BL}_{i,y} \\times f^{NR}_{i,y}\\)",
"Applies project non-renewable fractions to monitored biomass use.<br>\\(NRB^{PR}_y = \\sum_i FC^{PR}_{i,y} \\times f^{NR}_{i,y}\\)",
"Converts baseline non-renewable biomass into thermal energy.<br>\\(E^{BL}_y = NRB^{BL}_y \\times NCV^{BL}_y\\)",
"Converts project non-renewable biomass into thermal energy.<br>\\(E^{PR}_y = NRB^{PR}_y \\times NCV^{PR}_y\\)",
"Derives emissions from thermal energy using the relevant factors.<br>\\(EM_y = \\sum_i E_{i,y} \\times EF_{i,y}\\)",
"Summarises leakage emissions associated with biomass supply chains.<br>\\(LE_y = \\sum_i LE_{i,y}\\)",
"Computes net emission reductions from baseline, project, and leakage inputs.<br>\\(ER_y = BE_y - PE_y - LE_y\\)",
"Aggregates monitoring data to reporting periods with derived quantities.<br>\\(ER_{p,y} = BE_{p,y} - PE_{p,y} - LE_{p,y}\\)",
"Meta-function orchestrating the AMS-II.G equation helpers.<br>\\(ER_y = BE_y - PE_y - LE_y\\)",
"Generates representative monitoring datasets for testing and demos."
)
)
quiet_kable(function_reference, format = "html", escape = FALSE)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| Function | Signature | Purpose |
|---|---|---|
calculate_baseline_non_renewable_biomass_iig()
|
calculate_baseline_non_renewable_biomass_iig(baseline_data, consumption_col = "baseline_biomass_consumption_tonnes", fraction_col = "baseline_non_renewable_fraction", group_cols = NULL, output_col = "baseline_non_renewable_biomass_tonnes")
|
Applies the non-renewable fraction to baseline biomass
consumption. |
calculate_project_non_renewable_biomass_iig()
|
calculate_project_non_renewable_biomass_iig(project_data, project_consumption_col = "project_biomass_consumption_tonnes", project_fraction_col = "project_non_renewable_fraction", group_cols = NULL, output_col = "project_non_renewable_biomass_tonnes")
|
Applies project non-renewable fractions to monitored biomass
use. |
calculate_baseline_thermal_energy_iig()
|
calculate_baseline_thermal_energy_iig(non_renewable_biomass, biomass_col = "baseline_non_renewable_biomass_tonnes", baseline_data, ncv_col = "baseline_net_calorific_value_mj_per_tonne", group_cols = NULL, output_col = "baseline_thermal_energy_mj")
|
Converts baseline non-renewable biomass into thermal
energy. |
calculate_project_thermal_energy_iig()
|
calculate_project_thermal_energy_iig(non_renewable_biomass, biomass_col = "project_non_renewable_biomass_tonnes", project_data, ncv_col = "project_net_calorific_value_mj_per_tonne", group_cols = NULL, output_col = "project_thermal_energy_mj")
|
Converts project non-renewable biomass into thermal
energy. |
calculate_emissions_from_energy_iig()
|
calculate_emissions_from_energy_iig(energy_data, energy_col = "baseline_thermal_energy_mj", factor_data, emission_factor_col = "baseline_emission_factor_tco2_per_mj", group_cols = NULL, output_col = "baseline_emissions_tco2e")
|
Derives emissions from thermal energy using the relevant
factors. |
calculate_leakage_emissions_iig()
|
calculate_leakage_emissions_iig(leakage_data = NULL, leakage_col = "leakage_emissions_tco2e", group_cols = NULL, output_col = "leakage_emissions_tco2e")
|
Summarises leakage emissions associated with biomass supply
chains. |
calculate_emission_reductions_iig()
|
calculate_emission_reductions_iig(baseline_emissions, project_emissions, leakage_emissions = NULL, group_cols = NULL, output_col = "emission_reductions_tco2e")
|
Computes net emission reductions from baseline, project, and leakage
inputs. |
aggregate_monitoring_periods_iig()
|
aggregate_monitoring_periods_iig(monitoring_data, group_cols = "site_id", period_cols = c("year", "month"), baseline_consumption_col = "baseline_biomass_consumption_tonnes", baseline_fraction_col = "baseline_non_renewable_fraction", baseline_ncv_col = "baseline_net_calorific_value_mj_per_tonne", baseline_emission_factor_col = "baseline_emission_factor_tco2_per_mj", project_consumption_col = "project_biomass_consumption_tonnes", project_fraction_col = "project_non_renewable_fraction", project_ncv_col = "project_net_calorific_value_mj_per_tonne", project_emission_factor_col = "project_emission_factor_tco2_per_mj", leakage_col = "leakage_emissions_tco2e")
|
Aggregates monitoring data to reporting periods with derived
quantities. |
estimate_emission_reductions_ams_iig()
|
estimate_emission_reductions_ams_iig(baseline_data, project_data, leakage_data = NULL, group_cols = NULL, baseline_consumption_col = "baseline_biomass_consumption_tonnes", baseline_fraction_col = "baseline_non_renewable_fraction", baseline_ncv_col = "baseline_net_calorific_value_mj_per_tonne", baseline_emission_factor_col = "baseline_emission_factor_tco2_per_mj", project_consumption_col = "project_biomass_consumption_tonnes", project_fraction_col = "project_non_renewable_fraction", project_ncv_col = "project_net_calorific_value_mj_per_tonne", project_emission_factor_col = "project_emission_factor_tco2_per_mj", leakage_col = "leakage_emissions_tco2e")
|
Meta-function orchestrating the AMS-II.G equation
helpers. |
simulate_ams_iig_dataset()
|
simulate_ams_iig_dataset(n_sites = 5, n_periods = 4, start_year = 2024, start_month = 1, seed = NULL, baseline_consumption_mean = 14, efficiency_gain = 0.45, baseline_fraction_mean = 0.85, project_fraction_mean = 0.4)
|
Generates representative monitoring datasets for testing and demos. |
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| Step | Purpose |
|---|---|
| Input biomass monitoring data | Collect baseline, project, and leakage parameters for each site-period. |
| calculate_baseline_non_renewable_biomass_iig | Translate baseline biomass use into non-renewable quantities. |
| calculate_project_non_renewable_biomass_iig | Translate project biomass use into non-renewable quantities. |
| calculate_baseline_thermal_energy_iig | Convert baseline non-renewable biomass into thermal energy. |
| calculate_project_thermal_energy_iig | Convert project non-renewable biomass into thermal energy. |
| calculate_emissions_from_energy_iig | Multiply energy terms by emission factors to obtain emissions. |
| calculate_emission_reductions_iig | Combine baseline, project, and leakage emissions into reductions. |
| estimate_emission_reductions_ams_iig | Return a tidy tibble with emission reductions and supporting diagnostics. |