Introduction

This vignette demonstrates how to reproduce the AMS-II.H calculations using cdmAmsIIh. The methodology covers projects that centralize the provision of utilities (steam, hot water, chilled water) previously generated by multiple stand-alone units. The workflow contrasts decentralized baseline emissions with the centralized project’s fuel and auxiliary electricity demand, applies leakage adjustments, and reports the resulting emission reductions.

Applicability Checks

library(cdmAmsIIh)

baseline_scope <- tibble::tibble(
  utility_service = c("steam", "hot_water"),
  baseline_unit_count = c(4, 3)
)
project_scope <- tibble::tibble(
  utility_service = c("steam", "hot_water"),
  project_unit_count = c(1, 1)
)
monitoring_snapshot <- tibble::tibble(
  baseline_fuel_use_gj = 4200,
  baseline_emission_factor_tco2_per_gj = 0.071,
  project_fuel_use_gj = 3000,
  project_emission_factor_tco2_per_gj = 0.068
)
baseline_specific <- tibble::tibble(
  facility = c("Line_A", "Line_B"),
  baseline_fuel_use_gj = c(4200, 3150),
  baseline_useful_output_gj = c(3600, 2700)
)
project_specific <- tibble::tibble(
  facility = c("Line_A", "Line_B"),
  project_fuel_use_gj = c(3000, 2250),
  project_useful_output_gj = c(2880, 2160)
)

check_applicability_centralization_scope_iih(baseline_scope, project_scope)
## [1] TRUE
## [1] TRUE
check_applicability_efficiency_improvement_iih(
  baseline_specific,
  project_specific,
  group_cols = "facility",
  minimum_improvement = 0.05
)
## [1] TRUE

Simulated Dataset

set.seed(123)
inputs <- simulate_ams_iih_inputs(n_facilities = 3, seed = 123)
quiet_kable(inputs$baseline_data, format = "html", digits = 2)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
facility service_growth baseline_fuel_use_gj baseline_emission_factor_tco2_per_gj baseline_useful_output_gj baseline_unit_count
facility_01 0.02 4235.54 0.07 3568.65 3
facility_02 0.03 4265.16 0.07 4066.72 5
facility_03 0.05 5064.39 0.07 4624.80 4

The simulation returns baseline, project, and leakage datasets for each facility, including fuel use, emission factors, useful output, auxiliary electricity, and leakage placeholders.

Equation Walkthrough

baseline_emissions <- calculate_baseline_decentralized_emissions_iih(
  inputs$baseline_data,
  group_cols = "facility"
)
project_central <- calculate_project_central_emissions_iih(
  inputs$project_data,
  group_cols = "facility"
)
project_auxiliary <- calculate_project_auxiliary_electricity_iih(
  inputs$project_data,
  group_cols = "facility"
)
project_totals <- project_central |>
  dplyr::left_join(project_auxiliary, by = "facility") |>
  dplyr::mutate(
    project_emissions_tco2e = dplyr::coalesce(project_central_emissions_tco2e, 0) +
      dplyr::coalesce(project_auxiliary_emissions_tco2e, 0)
  )
leakage_totals <- inputs$leakage_data

emission_reductions <- calculate_emission_reductions_iih(
  baseline_emissions = baseline_emissions,
  project_emissions = project_totals |>
    dplyr::select(facility, project_emissions_tco2e),
  leakage_emissions = leakage_totals,
  group_cols = "facility"
)

walkthrough_results <- baseline_emissions |>
  dplyr::left_join(project_totals, by = "facility") |>
  dplyr::left_join(leakage_totals, by = "facility") |>
  dplyr::left_join(emission_reductions, by = "facility")

quiet_kable(walkthrough_results, format = "html", digits = 3)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
facility baseline_emissions_tco2e.x baseline_specific_energy_gj_per_gj.x project_central_emissions_tco2e project_specific_energy_gj_per_gj project_auxiliary_emissions_tco2e project_emissions_tco2e.x service_growth.x leakage_emissions_tco2e.x baseline_emissions_tco2e.y baseline_specific_energy_gj_per_gj.y project_emissions_tco2e.y service_growth.y leakage_emissions_tco2e.y emission_reductions_tco2e
facility_01 290.657 1.187 193.245 0.771 82.115 275.360 0.024 5.813 290.657 1.187 275.360 0.024 5.813 9.484
facility_02 314.070 1.049 208.716 0.682 89.336 298.052 0.028 6.281 314.070 1.049 298.052 0.028 6.281 9.736
facility_03 370.290 1.095 256.593 0.712 133.546 390.139 0.046 7.406 370.290 1.095 390.139 0.046 7.406 -27.255

Monitoring Period Aggregation

monitoring_summary <- inputs$baseline_data |>
  dplyr::left_join(inputs$project_data, by = "facility", suffix = c("_baseline", "_project")) |>
  dplyr::left_join(inputs$leakage_data, by = "facility")

quiet_kable(monitoring_summary, format = "html", digits = 2)
## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
facility service_growth_baseline baseline_fuel_use_gj baseline_emission_factor_tco2_per_gj baseline_useful_output_gj baseline_unit_count service_growth_project project_fuel_use_gj project_emission_factor_tco2_per_gj project_useful_output_gj project_auxiliary_electricity_mwh project_electricity_emission_factor_tco2_per_mwh project_unit_count service_growth leakage_emissions_tco2e
facility_01 0.02 4235.54 0.07 3568.65 3 0.02 2820.26 0.07 3655.71 164.51 0.50 1 0.02 5.81
facility_02 0.03 4265.16 0.07 4066.72 5 0.03 2849.14 0.07 4179.37 188.07 0.48 1 0.03 6.28
facility_03 0.05 5064.39 0.07 4624.80 4 0.05 3441.92 0.07 4835.63 217.60 0.61 1 0.05 7.41

Meta-Function

estimate_emission_reductions_ams_iih(
  baseline_data = inputs$baseline_data,
  project_data = inputs$project_data,
  leakage_data = inputs$leakage_data,
  group_cols = "facility"
)
## # A tibble: 3 × 10
##   facility  baseline_emissions_t…¹ baseline_specific_en…² project_central_emis…³
##   <chr>                      <dbl>                  <dbl>                  <dbl>
## 1 facility…                   291.                   1.19                   193.
## 2 facility…                   314.                   1.05                   209.
## 3 facility…                   370.                   1.10                   257.
## # ℹ abbreviated names: ¹​baseline_emissions_tco2e,
## #   ²​baseline_specific_energy_gj_per_gj, ³​project_central_emissions_tco2e
## # ℹ 6 more variables: project_specific_energy_gj_per_gj <dbl>,
## #   project_auxiliary_emissions_tco2e <dbl>, project_emissions_tco2e <dbl>,
## #   service_growth <dbl>, leakage_emissions_tco2e <dbl>,
## #   emission_reductions_tco2e <dbl>

Function Reference

function_reference <- tibble::tibble(
  Function = c(
    "`calculate_baseline_decentralized_emissions_iih()`",
    "`calculate_project_central_emissions_iih()`",
    "`calculate_project_auxiliary_electricity_iih()`",
    "`calculate_emission_reductions_iih()`",
    "`estimate_emission_reductions_ams_iih()`",
    "`simulate_ams_iih_inputs()`"
  ),
  Signature = c(
    "`calculate_baseline_decentralized_emissions_iih(baseline_data, fuel_consumption_col = \"baseline_fuel_use_gj\", emission_factor_col = \"baseline_emission_factor_tco2_per_gj\", useful_output_col = \"baseline_useful_output_gj\", group_cols = NULL, output_col = \"baseline_emissions_tco2e\", specific_energy_col = \"baseline_specific_energy_gj_per_gj\")`",
    "`calculate_project_central_emissions_iih(project_data, fuel_consumption_col = \"project_fuel_use_gj\", emission_factor_col = \"project_emission_factor_tco2_per_gj\", useful_output_col = \"project_useful_output_gj\", group_cols = NULL, output_col = \"project_central_emissions_tco2e\", specific_energy_col = \"project_specific_energy_gj_per_gj\")`",
    "`calculate_project_auxiliary_electricity_iih(project_data, electricity_consumption_col = \"project_auxiliary_electricity_mwh\", emission_factor_col = \"project_electricity_emission_factor_tco2_per_mwh\", group_cols = NULL, output_col = \"project_auxiliary_emissions_tco2e\")`",
    "`calculate_emission_reductions_iih(baseline_emissions, project_emissions, leakage_emissions = NULL, group_cols = NULL, output_col = \"emission_reductions_tco2e\")`",
    "`estimate_emission_reductions_ams_iih(baseline_data, project_data, leakage_data = NULL, group_cols = NULL, baseline_fuel_consumption_col = \"baseline_fuel_use_gj\", baseline_emission_factor_col = \"baseline_emission_factor_tco2_per_gj\", baseline_useful_output_col = \"baseline_useful_output_gj\", project_fuel_consumption_col = \"project_fuel_use_gj\", project_emission_factor_col = \"project_emission_factor_tco2_per_gj\", project_useful_output_col = \"project_useful_output_gj\", project_aux_electricity_col = \"project_auxiliary_electricity_mwh\", project_electricity_emission_factor_col = \"project_electricity_emission_factor_tco2_per_mwh\", leakage_col = \"leakage_emissions_tco2e\")`",
    "`simulate_ams_iih_inputs(n_facilities = 4, seed = NULL, baseline_fuel_mean = 4200, central_efficiency_gain = 0.35, electricity_intensity = 0.045, leakage_fraction = 0.02)`"
  ),
  Purpose = c(
    "Summarises decentralized baseline fuel use and emissions, optionally reporting specific energy.<br>\\(BE_y = \\sum_i FC^{BL}_{i,y} \\times EF^{BL}_{i,y}\\)",
    "Quantifies emissions from the centralized utility system implemented by the project.<br>\\(PE^{central}_y = \\sum_i FC^{PR}_{i,y} \\times EF^{PR}_{i,y}\\)",
    "Converts auxiliary electricity consumption into project emissions using grid factors.<br>\\(PE^{aux}_y = \\sum_i EC^{aux}_{i,y} \\times EF^{grid}_{i,y}\\)",
    "Combines baseline, project, and leakage emissions to obtain net reductions.<br>\\(ER_y = BE_y - (PE^{central}_y + PE^{aux}_y + LE_y)\\)",
    "Meta-function chaining the AMS-II.H equation helpers into a tidy workflow.<br>\\(ER_y = BE_y - (PE^{central}_y + PE^{aux}_y + LE_y)\\)",
    "Generates representative baseline, project, and leakage 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_decentralized_emissions_iih() calculate_baseline_decentralized_emissions_iih(baseline_data, fuel_consumption_col = "baseline_fuel_use_gj", emission_factor_col = "baseline_emission_factor_tco2_per_gj", useful_output_col = "baseline_useful_output_gj", group_cols = NULL, output_col = "baseline_emissions_tco2e", specific_energy_col = "baseline_specific_energy_gj_per_gj") Summarises decentralized baseline fuel use and emissions, optionally reporting specific energy.
BEy=iFCi,yBL×EFi,yBLBE_y = \sum_i FC^{BL}_{i,y} \times EF^{BL}_{i,y}
calculate_project_central_emissions_iih() calculate_project_central_emissions_iih(project_data, fuel_consumption_col = "project_fuel_use_gj", emission_factor_col = "project_emission_factor_tco2_per_gj", useful_output_col = "project_useful_output_gj", group_cols = NULL, output_col = "project_central_emissions_tco2e", specific_energy_col = "project_specific_energy_gj_per_gj") Quantifies emissions from the centralized utility system implemented by the project.
PEycentral=iFCi,yPR×EFi,yPRPE^{central}_y = \sum_i FC^{PR}_{i,y} \times EF^{PR}_{i,y}
calculate_project_auxiliary_electricity_iih() calculate_project_auxiliary_electricity_iih(project_data, electricity_consumption_col = "project_auxiliary_electricity_mwh", emission_factor_col = "project_electricity_emission_factor_tco2_per_mwh", group_cols = NULL, output_col = "project_auxiliary_emissions_tco2e") Converts auxiliary electricity consumption into project emissions using grid factors.
PEyaux=iECi,yaux×EFi,ygridPE^{aux}_y = \sum_i EC^{aux}_{i,y} \times EF^{grid}_{i,y}
calculate_emission_reductions_iih() calculate_emission_reductions_iih(baseline_emissions, project_emissions, leakage_emissions = NULL, group_cols = NULL, output_col = "emission_reductions_tco2e") Combines baseline, project, and leakage emissions to obtain net reductions.
ERy=BEy(PEycentral+PEyaux+LEy)ER_y = BE_y - (PE^{central}_y + PE^{aux}_y + LE_y)
estimate_emission_reductions_ams_iih() estimate_emission_reductions_ams_iih(baseline_data, project_data, leakage_data = NULL, group_cols = NULL, baseline_fuel_consumption_col = "baseline_fuel_use_gj", baseline_emission_factor_col = "baseline_emission_factor_tco2_per_gj", baseline_useful_output_col = "baseline_useful_output_gj", project_fuel_consumption_col = "project_fuel_use_gj", project_emission_factor_col = "project_emission_factor_tco2_per_gj", project_useful_output_col = "project_useful_output_gj", project_aux_electricity_col = "project_auxiliary_electricity_mwh", project_electricity_emission_factor_col = "project_electricity_emission_factor_tco2_per_mwh", leakage_col = "leakage_emissions_tco2e") Meta-function chaining the AMS-II.H equation helpers into a tidy workflow.
ERy=BEy(PEycentral+PEyaux+LEy)ER_y = BE_y - (PE^{central}_y + PE^{aux}_y + LE_y)
simulate_ams_iih_inputs() simulate_ams_iih_inputs(n_facilities = 4, seed = NULL, baseline_fuel_mean = 4200, central_efficiency_gain = 0.35, electricity_intensity = 0.045, leakage_fraction = 0.02) Generates representative baseline, project, and leakage datasets for demonstrations and tests.

Workflow Overview

## Warning: 'xfun::attr()' is deprecated.
## Use 'xfun::attr2()' instead.
## See help("Deprecated")
Step Purpose
Input decentralized and centralized monitoring data Collect fuel, emission factor, useful output, and leakage metrics for each facility.
calculate_baseline_decentralized_emissions_iih Translate baseline decentralized operation into emissions and diagnostics.
calculate_project_central_emissions_iih Summarise centralized project fuel emissions and optional specific energy.
calculate_project_auxiliary_electricity_iih Quantify auxiliary electricity emissions associated with distribution equipment.
calculate_emission_reductions_iih Subtract project and leakage emissions from the baseline totals to obtain reductions.
estimate_emission_reductions_ams_iih Return a tidy tibble combining baseline, project, leakage, and reduction metrics.