From c5682840577316e50dff56e69563fda245cbf375 Mon Sep 17 00:00:00 2001 From: JieXiong9119 <69597597+JieXiong9119@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:13:11 -0700 Subject: [PATCH 1/2] quick fix calculation for egrid scenario --- .../resources/dispatch_schedule_generation.rb | 2 +- .../resources/dispatch_schedule_generation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb b/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb index 64e0d9e3..e00ec985 100644 --- a/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb +++ b/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb @@ -969,7 +969,7 @@ def emission_prediction(load, factor, num_timesteps_in_hr) hourly_emissions_kg = hourly_load_mwh.zip(factor).map { |n, f| n * f } elsif factor.is_a?(Numeric) # egrid factor - hourly_emissions_kg = (hourly_load_mwh.inject(:+)) * factor + hourly_emissions_kg = hourly_load_mwh.map {|n| n * factor} else raise "Bad emission factors" end diff --git a/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb b/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb index 379a796b..16ed1c27 100644 --- a/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb +++ b/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb @@ -970,7 +970,7 @@ def emission_prediction(load, factor, num_timesteps_in_hr) hourly_emissions_kg = hourly_load_mwh.zip(factor).map { |n, f| n * f } elsif factor.is_a?(Numeric) # egrid factor - hourly_emissions_kg = (hourly_load_mwh.inject(:+)) * factor + hourly_emissions_kg = hourly_load_mwh.map {|n| n * factor} else raise "Bad emission factors" end From 0fca4b9311c8930d03c7ebc92aa07fba918cf9cd Mon Sep 17 00:00:00 2001 From: JieXiong9119 <69597597+JieXiong9119@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:22:46 -0700 Subject: [PATCH 2/2] change default year for egrid data --- .../resources/dispatch_schedule_generation.rb | 2 +- .../resources/dispatch_schedule_generation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb b/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb index e00ec985..9d0df345 100644 --- a/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb +++ b/resources/measures/upgrade_df_lighting_control/resources/dispatch_schedule_generation.rb @@ -889,7 +889,7 @@ def load_prediction_from_full_run(model, num_timesteps_in_hr, epw_path=nil, run_ end ### read cambium/egrid emission factors -def read_emission_factors(model, scenario, year=2018) +def read_emission_factors(model, scenario, year=2021) lbm_to_kg = OpenStudio.convert(1.0, 'lb_m', 'kg').get # set cambium and egrid regions grid_region = model.getBuilding.additionalProperties.getFeatureAsString('grid_region') diff --git a/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb b/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb index 16ed1c27..d11ac3fd 100644 --- a/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb +++ b/resources/measures/upgrade_df_thermostat_control_load_shed/resources/dispatch_schedule_generation.rb @@ -890,7 +890,7 @@ def load_prediction_from_full_run(model, num_timesteps_in_hr, epw_path=nil, run_ end ### read cambium/egrid emission factors -def read_emission_factors(model, scenario, year=2018) +def read_emission_factors(model, scenario, year=2021) lbm_to_kg = OpenStudio.convert(1.0, 'lb_m', 'kg').get # set cambium and egrid regions grid_region = model.getBuilding.additionalProperties.getFeatureAsString('grid_region')