cdmAmsIe-methodology.RmdThis vignette demonstrates how to reproduce the AMS-I.E calculations
using cdmAmsIe. The methodology covers renewable thermal
technologies that displace non-renewable biomass used by end users. The
core steps include quantifying the non-renewable biomass fraction,
converting it to thermal energy, applying baseline emission factors, and
accounting for any residual project fossil energy.
library(cdmAmsIe)
check_applicability_capacity_limit(thermal_capacity_mw = 20)## [1] TRUE
check_applicability_non_renewable_fraction(c(0.82, 0.88))## [1] TRUE
check_applicability_project_renewable_fraction(renewable_fraction = 0.95)## [1] TRUE
set.seed(123)
example_data <- simulate_ams_ie_dataset(n_users = 4, n_periods = 6, start_year = 2024)
quiet_kable(
head(example_data),
format = "html",
digits = 3
)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| user_id | year | month | biomass_consumption_tonnes | non_renewable_fraction | net_calorific_value | emission_factor | project_energy_mj | project_emission_factor |
|---|---|---|---|---|---|---|---|---|
| user-1 | 2024 | 3 | 11.782 | 0.884 | 16.228 | 0 | 122.572 | 0 |
| user-2 | 2024 | 3 | 11.766 | 0.834 | 15.276 | 0 | 138.827 | 0 |
| user-3 | 2024 | 3 | 12.366 | 0.784 | 13.951 | 0 | 118.691 | 0 |
| user-4 | 2024 | 3 | 14.561 | 0.820 | 14.479 | 0 | 118.840 | 0 |
| user-1 | 2025 | 3 | 8.545 | 0.844 | 16.623 | 0 | 135.008 | 0 |
| user-2 | 2025 | 3 | 15.380 | 0.894 | 13.930 | 0 | 137.224 | 0 |
The simulation includes monitoring metadata (user_id,
year, and month) so that calculations can be
aggregated over reporting periods while preserving entity-level
identifiers.
non_renewable <- calculate_non_renewable_biomass(
example_data,
group_cols = "user_id"
)
baseline_energy <- calculate_baseline_energy_content(non_renewable, ncv = 15)
baseline_emissions <- calculate_baseline_emissions(
baseline_energy,
emission_factor = example_data$emission_factor[1]
)
project_energy <- tibble::tibble(project_energy_mj = rep(120, nrow(baseline_energy)))
project_emissions <- calculate_project_emissions(
project_energy,
project_emission_factor = 0.00009
)
emission_reductions <- calculate_emission_reductions(baseline_emissions, project_emissions)
quiet_kable(head(emission_reductions), format = "html", digits = 3)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| user_id | non_renewable_biomass_tonnes | baseline_energy_mj | baseline_emissions_tco2e | project_energy_mj | project_emissions_tco2e | emission_reductions_tco2e |
|---|---|---|---|---|---|---|
| user-1 | 58.927 | 883.898 | 0.088 | 120 | 0.011 | 0.078 |
| user-2 | 64.096 | 961.433 | 0.096 | 120 | 0.011 | 0.085 |
| user-3 | 54.560 | 818.407 | 0.082 | 120 | 0.011 | 0.071 |
| user-4 | 67.053 | 1005.792 | 0.101 | 120 | 0.011 | 0.090 |
period_summary <- aggregate_monitoring_periods(example_data)
quiet_kable(head(period_summary), format = "html", digits = 3)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| user_id | year | month | non_renewable_biomass_tonnes | baseline_energy_mj | baseline_emissions_tco2e | project_energy_mj | project_emissions_tco2e | emission_reductions_tco2e |
|---|---|---|---|---|---|---|---|---|
| user-1 | 2024 | 3 | 10.418 | 169.072 | 0.017 | 122.572 | 0.011 | 0.006 |
| user-1 | 2025 | 3 | 7.208 | 119.826 | 0.012 | 135.008 | 0.012 | 0.000 |
| user-1 | 2026 | 10 | 9.020 | 131.075 | 0.013 | 124.964 | 0.011 | 0.002 |
| user-1 | 2027 | 2 | 11.900 | 184.401 | 0.018 | 152.994 | 0.014 | 0.005 |
| user-1 | 2028 | 6 | 9.293 | 146.763 | 0.015 | 148.123 | 0.013 | 0.001 |
| user-1 | 2029 | 11 | 11.087 | 158.162 | 0.016 | 162.219 | 0.015 | 0.001 |
estimate_emission_reductions_ams_ie(
biomass_data = example_data,
group_cols = "user_id",
ncv = 15,
emission_factor = example_data$emission_factor[1],
project_energy_col = "project_energy_mj",
project_emission_factor = example_data$project_emission_factor[1]
)## # A tibble: 4 × 7
## user_id non_renewable_biomass_tonnes baseline_energy_mj baseline_emissions_t…¹
## <chr> <dbl> <dbl> <dbl>
## 1 user-1 58.9 884. 0.0884
## 2 user-2 64.1 961. 0.0961
## 3 user-3 54.6 818. 0.0818
## 4 user-4 67.1 1006. 0.101
## # ℹ abbreviated name: ¹baseline_emissions_tco2e
## # ℹ 3 more variables: project_energy_mj <dbl>, project_emissions_tco2e <dbl>,
## # emission_reductions_tco2e <dbl>
function_reference <- tibble::tibble(
Function = c(
"`calculate_non_renewable_biomass()`",
"`calculate_baseline_energy_content()`",
"`calculate_baseline_emissions()`",
"`calculate_project_emissions()`",
"`calculate_emission_reductions()`",
"`aggregate_monitoring_periods()`",
"`estimate_emission_reductions_ams_ie()`",
"`simulate_ams_ie_dataset()`"
),
Signature = c(
"`calculate_non_renewable_biomass(biomass_data, consumption_col = \"biomass_consumption_tonnes\", fraction = 1, fraction_col = \"non_renewable_fraction\", group_cols = NULL, output_col = \"non_renewable_biomass_tonnes\")`",
"`calculate_baseline_energy_content(non_renewable_biomass, biomass_col = \"non_renewable_biomass_tonnes\", ncv, output_col = \"baseline_energy_mj\")`",
"`calculate_baseline_emissions(baseline_energy, emission_factor, energy_col = \"baseline_energy_mj\", output_col = \"baseline_emissions_tco2e\")`",
"`calculate_project_emissions(project_energy, project_emission_factor, energy_col = \"project_energy_mj\", output_col = \"project_emissions_tco2e\")`",
"`calculate_emission_reductions(baseline_emissions, project_emissions, baseline_col = \"baseline_emissions_tco2e\", project_col = \"project_emissions_tco2e\", output_col = \"emission_reductions_tco2e\")`",
"`aggregate_monitoring_periods(biomass_data, monitoring_cols = c(\"year\", \"month\"), group_cols = \"user_id\", consumption_col = \"biomass_consumption_tonnes\", fraction_col = \"non_renewable_fraction\", ncv_col = \"net_calorific_value\", emission_factor_col = \"emission_factor\", project_energy_col = \"project_energy_mj\")`",
"`estimate_emission_reductions_ams_ie(biomass_data, group_cols = NULL, ncv = 15, emission_factor, project_energy_col = \"project_energy_mj\", project_emission_factor = 0, project_emission_factor_col = NULL)`",
"`simulate_ams_ie_dataset(n_users = 20, n_periods = 12, start_year = 2023, start_month = 1, mean_biomass_tonnes = 22, sd_biomass_tonnes = 4, emission_factor = 0.00009)`"
),
Purpose = c(
"Applies the non-renewable fraction to baseline biomass consumption.<br>\\(NRB_y = \\sum_i B_{i,y} \\times f^{NR}_{i,y}\\)",
"Converts non-renewable biomass into thermal energy using the NCV.<br>\\(E^{BL}_y = NRB_y \\times NCV_y\\)",
"Multiplies baseline energy by the baseline emission factor.<br>\\(BE_y = E^{BL}_y \\times EF^{BL}_y\\)",
"Converts residual fossil energy into project emissions.<br>\\(PE_y = \\sum_i E^{PR}_{i,y} \\times EF^{PR}_{i,y}\\)",
"Subtracts project emissions from baseline emissions to obtain reductions.<br>\\(ER_y = BE_y - PE_y\\)",
"Aggregates monitoring data by entity and reporting period.<br>\\(ER_{p,y} = BE_{p,y} - PE_{p,y}\\)",
"Chains the equation helpers into a tidyverse-friendly workflow.<br>\\(ER_y = BE_y - PE_y\\)",
"Generates synthetic monitoring data for examples and tests."
)
)
quiet_kable(function_reference, format = "html", escape = FALSE)## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
| Function | Signature | Purpose |
|---|---|---|
calculate_non_renewable_biomass()
|
calculate_non_renewable_biomass(biomass_data, consumption_col = "biomass_consumption_tonnes", fraction = 1, fraction_col = "non_renewable_fraction", group_cols = NULL, output_col = "non_renewable_biomass_tonnes")
|
Applies the non-renewable fraction to baseline biomass
consumption. |
calculate_baseline_energy_content()
|
calculate_baseline_energy_content(non_renewable_biomass, biomass_col = "non_renewable_biomass_tonnes", ncv, output_col = "baseline_energy_mj")
|
Converts non-renewable biomass into thermal energy using the
NCV. |
calculate_baseline_emissions()
|
calculate_baseline_emissions(baseline_energy, emission_factor, energy_col = "baseline_energy_mj", output_col = "baseline_emissions_tco2e")
|
Multiplies baseline energy by the baseline emission
factor. |
calculate_project_emissions()
|
calculate_project_emissions(project_energy, project_emission_factor, energy_col = "project_energy_mj", output_col = "project_emissions_tco2e")
|
Converts residual fossil energy into project
emissions. |
calculate_emission_reductions()
|
calculate_emission_reductions(baseline_emissions, project_emissions, baseline_col = "baseline_emissions_tco2e", project_col = "project_emissions_tco2e", output_col = "emission_reductions_tco2e")
|
Subtracts project emissions from baseline emissions to obtain
reductions. |
aggregate_monitoring_periods()
|
aggregate_monitoring_periods(biomass_data, monitoring_cols = c("year", "month"), group_cols = "user_id", consumption_col = "biomass_consumption_tonnes", fraction_col = "non_renewable_fraction", ncv_col = "net_calorific_value", emission_factor_col = "emission_factor", project_energy_col = "project_energy_mj")
|
Aggregates monitoring data by entity and reporting
period. |
estimate_emission_reductions_ams_ie()
|
estimate_emission_reductions_ams_ie(biomass_data, group_cols = NULL, ncv = 15, emission_factor, project_energy_col = "project_energy_mj", project_emission_factor = 0, project_emission_factor_col = NULL)
|
Chains the equation helpers into a tidyverse-friendly
workflow. |
simulate_ams_ie_dataset()
|
simulate_ams_ie_dataset(n_users = 20, n_periods = 12, start_year = 2023, start_month = 1, mean_biomass_tonnes = 22, sd_biomass_tonnes = 4, emission_factor = 0.00009)
|
Generates synthetic monitoring data for examples and tests. |