Introduction

This vignette demonstrates how to reproduce the AMS-II.C calculations using cdmAmsIIc. The methodology covers demand-side energy efficiency projects that retrofit specific technologies (lighting, motors, HVAC, refrigeration) with more efficient alternatives. The core steps include aggregating baseline and project energy, computing energy savings, and converting the savings into emission reductions with the appropriate grid or fuel emission factor.

Applicability Checks

library(cdmAmsIIc)
check_applicability_energy_savings(annual_energy_savings_mwh = 42000)
## [1] TRUE
check_applicability_technology(c("efficient_lighting", "variable_speed_drives"))
## [1] TRUE
check_applicability_monitoring("continuous_metering")
## [1] TRUE

Simulated Dataset

set.seed(123)
example_data <- simulate_ams_iic_dataset(n_sites = 4, n_periods = 6, start_year = 2024, start_month = 7)
quiet_kable(
  head(example_data),
  format = "html",
  digits = 3
)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
site_id monitoring_period year month day monitoring_date monitoring_label baseline_energy_mwh project_energy_mwh emission_factor_tco2e_mwh technology
site_01 1 2024 7 15 2024-07-15 2024-07 325.285 223.988 0.68 compressed_air_improvement
site_01 2 2024 8 19 2024-08-19 2024-08 188.666 129.913 0.68 compressed_air_improvement
site_01 3 2024 9 14 2024-09-14 2024-09 437.432 301.211 0.68 compressed_air_improvement
site_01 4 2024 10 3 2024-10-03 2024-10 387.627 266.916 0.68 compressed_air_improvement
site_01 5 2024 11 10 2024-11-10 2024-11 294.089 202.507 0.68 compressed_air_improvement
site_01 6 2024 12 18 2024-12-18 2024-12 216.742 149.246 0.68 compressed_air_improvement

The simulation includes monitoring metadata (monitoring_period, year, month, day, and monitoring_label) so that calculations can be aggregated over reporting periods while preserving site-level identifiers and emission factors.

Equation Walkthrough

baseline_energy <- calculate_baseline_energy_consumption(example_data, group_cols = "site_id")
project_energy <- calculate_project_energy_consumption(example_data, group_cols = "site_id")
energy_savings <- calculate_energy_savings(baseline_energy, project_energy)
emission_reductions <- calculate_emission_reductions(
  energy_savings,
  emission_factor = example_data$emission_factor_tco2e_mwh[1]
)
quiet_kable(head(emission_reductions), format = "html", digits = 3)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
site_id baseline_energy_mwh project_energy_mwh energy_savings_mwh emission_reductions_tco2e
site_01 1849.841 1273.781 576.060 391.721
site_02 1653.012 1050.774 602.238 409.522
site_03 1473.489 1047.688 425.801 289.544
site_04 1535.686 964.830 570.857 388.183

Monitoring Period Aggregation

period_summary <- aggregate_monitoring_periods(
  efficiency_data = example_data,
  monitoring_cols = c("monitoring_label"),
  group_cols = "site_id",
  baseline_energy_col = "baseline_energy_mwh",
  project_energy_col = "project_energy_mwh",
  emission_factor_col = "emission_factor_tco2e_mwh"
)

quiet_kable(head(period_summary), format = "html", digits = 3)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
site_id monitoring_label baseline_energy_mwh project_energy_mwh energy_savings_mwh emission_factor_tco2e_mwh emission_reductions_tco2e
site_01 2024-07 325.285 223.988 101.297 0.68 68.882
site_01 2024-08 188.666 129.913 58.752 0.68 39.952
site_01 2024-09 437.432 301.211 136.221 0.68 92.630
site_01 2024-10 387.627 266.916 120.711 0.68 82.083
site_01 2024-11 294.089 202.507 91.582 0.68 62.276
site_01 2024-12 216.742 149.246 67.496 0.68 45.897

Meta-Function

wrapper_results <- estimate_emission_reductions_ams_iic(
  baseline_data = example_data,
  project_data = example_data,
  emission_factor = example_data$emission_factor_tco2e_mwh[1],
  group_cols = "site_id",
  baseline_energy_col = "baseline_energy_mwh",
  project_energy_col = "project_energy_mwh"
)

quiet_kable(wrapper_results, format = "html", digits = 3)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
site_id baseline_energy_mwh project_energy_mwh energy_savings_mwh emission_reductions_tco2e
site_01 1849.841 1273.781 576.060 391.721
site_02 1653.012 1050.774 602.238 409.522
site_03 1473.489 1047.688 425.801 289.544
site_04 1535.686 964.830 570.857 388.183

Function Reference

function_reference <- tibble::tibble(
  Function = c(
    "`calculate_baseline_energy_consumption()`",
    "`calculate_project_energy_consumption()`",
    "`calculate_energy_savings()`",
    "`calculate_emission_reductions()`",
    "`aggregate_monitoring_periods()`",
    "`estimate_emission_reductions_ams_iic()`",
    "`simulate_ams_iic_dataset()`"
  ),
  Signature = c(
    "`calculate_baseline_energy_consumption(baseline_data, energy_col = \"baseline_energy_mwh\", group_cols = NULL, output_col = \"baseline_energy_mwh\")`",
    "`calculate_project_energy_consumption(project_data, energy_col = \"project_energy_mwh\", group_cols = NULL, output_col = \"project_energy_mwh\")`",
    "`calculate_energy_savings(baseline_energy, project_energy, baseline_col = \"baseline_energy_mwh\", project_col = \"project_energy_mwh\", output_col = \"energy_savings_mwh\")`",
    "`calculate_emission_reductions(energy_savings, emission_factor, savings_col = \"energy_savings_mwh\", output_col = \"emission_reductions_tco2e\")`",
    "`aggregate_monitoring_periods(efficiency_data, monitoring_cols = c(\"year\", \"month\"), group_cols = \"site_id\", baseline_energy_col = \"baseline_energy_mwh\", project_energy_col = \"project_energy_mwh\", emission_factor_col = \"emission_factor_tco2e_mwh\")`",
    "`estimate_emission_reductions_ams_iic(baseline_data, project_data, emission_factor, group_cols = NULL, baseline_energy_col = \"baseline_energy_mwh\", project_energy_col = \"project_energy_mwh\")`",
    "`simulate_ams_iic_dataset(n_sites = 8, n_periods = 12, start_year = 2023, start_month = 1, baseline_energy_mean = 120, project_energy_mean = 75, emission_factor = 0.62)`"
  ),
  Purpose = c(
    "Aggregates baseline energy consumption prior to efficiency upgrades.<br>\\(E_{BL,y} = \\sum_i E_{BL,i,y}\\)",
    "Summarises monitored project energy use for efficient technologies.<br>\\(E_{PR,y} = \\sum_i E_{PR,i,y}\\)",
    "Computes energy savings as the difference between baseline and project energy.<br>\\(ES_y = E_{BL,y} - E_{PR,y}\\)",
    "Converts energy savings to emission reductions using emission factors.<br>\\(ER_y = ES_y \\times EF_y\\)",
    "Rolls monitoring data to reporting periods with energy and emission summaries.<br>\\(ER_{p,y} = (\\sum_i E_{BL,i,p,y} - \\sum_i E_{PR,i,p,y}) \\times EF_{p,y}\\)",
    "High-level wrapper composing baseline, project, and reduction helpers.<br>\\(ER_y = (E_{BL,y} - E_{PR,y}) \\times EF_y\\)",
    "Generates representative efficiency datasets for demonstrations 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_baseline_energy_consumption() calculate_baseline_energy_consumption(baseline_data, energy_col = "baseline_energy_mwh", group_cols = NULL, output_col = "baseline_energy_mwh") Aggregates baseline energy consumption prior to efficiency upgrades.
EBL,y=iEBL,i,yE_{BL,y} = \sum_i E_{BL,i,y}
calculate_project_energy_consumption() calculate_project_energy_consumption(project_data, energy_col = "project_energy_mwh", group_cols = NULL, output_col = "project_energy_mwh") Summarises monitored project energy use for efficient technologies.
EPR,y=iEPR,i,yE_{PR,y} = \sum_i E_{PR,i,y}
calculate_energy_savings() calculate_energy_savings(baseline_energy, project_energy, baseline_col = "baseline_energy_mwh", project_col = "project_energy_mwh", output_col = "energy_savings_mwh") Computes energy savings as the difference between baseline and project energy.
ESy=EBL,yEPR,yES_y = E_{BL,y} - E_{PR,y}
calculate_emission_reductions() calculate_emission_reductions(energy_savings, emission_factor, savings_col = "energy_savings_mwh", output_col = "emission_reductions_tco2e") Converts energy savings to emission reductions using emission factors.
ERy=ESy×EFyER_y = ES_y \times EF_y
aggregate_monitoring_periods() aggregate_monitoring_periods(efficiency_data, monitoring_cols = c("year", "month"), group_cols = "site_id", baseline_energy_col = "baseline_energy_mwh", project_energy_col = "project_energy_mwh", emission_factor_col = "emission_factor_tco2e_mwh") Rolls monitoring data to reporting periods with energy and emission summaries.
ERp,y=(iEBL,i,p,yiEPR,i,p,y)×EFp,yER_{p,y} = (\sum_i E_{BL,i,p,y} - \sum_i E_{PR,i,p,y}) \times EF_{p,y}
estimate_emission_reductions_ams_iic() estimate_emission_reductions_ams_iic(baseline_data, project_data, emission_factor, group_cols = NULL, baseline_energy_col = "baseline_energy_mwh", project_energy_col = "project_energy_mwh") High-level wrapper composing baseline, project, and reduction helpers.
ERy=(EBL,yEPR,y)×EFyER_y = (E_{BL,y} - E_{PR,y}) \times EF_y
simulate_ams_iic_dataset() simulate_ams_iic_dataset(n_sites = 8, n_periods = 12, start_year = 2023, start_month = 1, baseline_energy_mean = 120, project_energy_mean = 75, emission_factor = 0.62) Generates representative efficiency datasets for demonstrations and tests.

Workflow Overview

## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
Step Purpose
Input efficiency monitoring data Collect site-level baseline and project energy measurements.
calculate_baseline_energy_consumption Aggregate baseline energy consumption prior to retrofits.
calculate_project_energy_consumption Aggregate project energy consumption after retrofits.
calculate_energy_savings Compute savings that feed subsequent emission calculations.
calculate_emission_reductions Convert energy savings to emission reductions using emission factors.
estimate_emission_reductions_ams_iic Return a tidy tibble with reductions and supporting diagnostics.