Skip to content

Commit

Permalink
Revert "Fix #432"
Browse files Browse the repository at this point in the history
This reverts commit e1e5598.
  • Loading branch information
aspeake authored Jan 15, 2025
1 parent 38de07d commit 33f7cb4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 43 deletions.
2 changes: 1 addition & 1 deletion ecm_definitions/Best Com. Chillers, Ice (EE+DF).json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
},
"climate_zone": "all",
"bldg_type": "large office",
"bldg_type": "all commercial",
"structure_type": "all",
"end_use": ["cooling", "ventilation"],
"fuel_type": "electricity",
Expand Down
64 changes: 24 additions & 40 deletions scout/ecm_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2459,12 +2459,7 @@ def __init__(
css_dict[eu_key][bd_key][cz_key][v_key] = {
"CSV base frac. annual": base_l_frac,
"CSV relative change": rel_chg}
# Account for case where legacy CSV end use name "pool heaters and pumps"
# is still used (current Scout baseline separates the two)
if "pool" in eu_key:
css_dict["pool heaters"], css_dict["pool pumps"] = (
css_dict["pool heaters and pumps"] for n in range(2))
del css_dict["pool heaters and pumps"]

# Set custom savings shape information to populated dict
self.tsv_features["shape"]["custom_annual_savings"] = \
css_dict
Expand Down Expand Up @@ -2723,8 +2718,8 @@ def fill_mkts(self, msegs, msegs_cpl, convert_data, tsv_data_init, opts,
# of heat pump HVAC) and a list of the climate zones, building types,
# and structure type of removed primary microsegments (used to remove
# associated secondary microsegments)
stk_energy_warn, cpl_warn, consume_warn, hp_warn, removed_primary, save_shp_warn = (
[] for n in range(6))
stk_energy_warn, cpl_warn, consume_warn, hp_warn, removed_primary = (
[] for n in range(5))

# Initialize flags for invalid information about sub-market fraction
# source, URL, and derivation
Expand Down Expand Up @@ -3965,7 +3960,7 @@ def fill_mkts(self, msegs, msegs_cpl, convert_data, tsv_data_init, opts,
# alternate regions into the current mseg region,
# to arrive at a final market scaling value for
# that region
if all([not isinstance(x, dict) for
if all([type(x) != dict for
x in mkt_scale_frac[0].values()]):
mkt_scale_frac = sum([x * y for x, y in zip(
mkt_scale_frac[0].values(),
Expand Down Expand Up @@ -5905,7 +5900,7 @@ def fill_mkts(self, msegs, msegs_cpl, convert_data, tsv_data_init, opts,
# Pull TSV scaling fractions and shapes
tsv_scale_fracs, tsv_shapes = self.gen_tsv_facts(
tsv_data, mskeys, bldg_sect, convert_data, opts,
cost_energy_meas, save_shp_warn)
cost_energy_meas)
else:
tsv_scale_fracs = {
"energy": {"baseline": 1, "efficient": 1},
Expand Down Expand Up @@ -6324,7 +6319,7 @@ def fill_mkts(self, msegs, msegs_cpl, convert_data, tsv_data_init, opts,

def gen_tsv_facts(
self, tsv_data, mskeys, bldg_sect, cost_conv, opts,
cost_energy_meas, save_shp_warn):
cost_energy_meas):
"""Set annual re-weighting factors and hourly load fractions for TSV.

Args:
Expand All @@ -6335,7 +6330,6 @@ def gen_tsv_facts(
opts (object): Stores user-specified execution options.
cost_energy_meas (dict): Annual retail electricity rates for the
region the measure applies to.
save_shp_warn (list): Tracks previous warnings on missing savings shape data.

Returns:
Dict of microsegment-specific energy, cost, and emissions annual
Expand Down Expand Up @@ -6553,7 +6547,7 @@ def gen_tsv_facts(
updated_tsv_fracs, updated_tsv_shapes = self.apply_tsv(
load_fact, ash_czone_wts, eplus_bldg_wts, cost_fact_hourly,
carbon_fact_hourly, mskeys, bldg_sect, eu, opts, cost_yr_map,
carb_yr_map, save_shp_warn)
carb_yr_map)
# Set adjustment factors for current combination of
# region, building type, and end use such that they
# need not be calculated again for this combination in
Expand Down Expand Up @@ -6581,7 +6575,7 @@ def gen_tsv_facts(

def apply_tsv(self, load_fact, ash_cz_wts, eplus_bldg_wts,
cost_fact_hourly, carbon_fact_hourly, mskeys, bldg_sect,
eu, opts, cost_yr_map, carb_yr_map, save_shp_warn):
eu, opts, cost_yr_map, carb_yr_map):
"""Apply time varying efficiency levels to base load profile.

Args:
Expand All @@ -6596,7 +6590,6 @@ def apply_tsv(self, load_fact, ash_cz_wts, eplus_bldg_wts,
opts (object): Stores user-specified execution options.
cost_yr_map (dict): Mapping 8760 TSV price data years -> AEO years.
carb_yr_map (dict): Mapping 8760 TSV carbon data yrs. -> AEO years.
save_shp_warn (list): Tracks previous warnings on missing savings shape data.

Returns:
Dict of microsegment-specific energy, cost, and emissions re-
Expand Down Expand Up @@ -7097,31 +7090,22 @@ def apply_tsv(self, load_fact, ash_cz_wts, eplus_bldg_wts,
if len(custom_hr_save_shape) == 0 or sum(
custom_hr_save_shape[
"CSV base frac. annual"]) == 0:
# Register mseg info. that generated warning
mseg_warn = str((
load_fact_climate_key, mult_sysshp_key_save,
load_fact_bldg_key, eu))
# Warn user if hasn't been done already for this mseg info.
if mseg_warn not in save_shp_warn:
save_shp_warn.append(mseg_warn)
verboseprint(
opts.verbose,
"WARNING: Measure '" + self.name + "', requires "
"custom savings shape data, but none were "
"found or all values were zero for the "
"combination of climate "
"zone " + load_fact_climate_key +
" (system load " + mult_sysshp_key_save +
"), building type " +
load_fact_bldg_key + ", and end use " +
eu + ". Assuming savings are zero for "
"this combination. If this is "
"unexpected, check that 8760 hourly "
"savings fractions are available for "
"all baseline market segments the "
"measure applies to in "
f"{fp.ECM_DEF / 'energy_plus_data' / 'savings_shapes'}.")

warnings.warn(
"Measure '" + self.name + "', requires "
"custom savings shape data, but none were "
"found or all values were zero for the "
"combination of climate "
"zone " + load_fact_climate_key +
" (system load " + mult_sysshp_key_save +
"), building type " +
load_fact_bldg_key + ", and end use " +
eu + ". Assuming savings are zero for "
"this combination. If this is "
"unexpected, check that 8760 hourly "
"savings fractions are available for "
"all baseline market segments the "
"measure applies to in "
f"{fp.ECM_DEF / 'energy_plus_data' / 'savings_shapes'}.")
else:
# Develop an adjustment from the generic
# baseline load shape for the current climate,
Expand Down
4 changes: 2 additions & 2 deletions tests/ecm_prep_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61855,7 +61855,7 @@ def test_load_modification(self):
gen_tsv_facts_out_features = measure.gen_tsv_facts(
self.sample_tsv_data, self.sample_mskeys_features,
self.sample_bldg_sect, self.sample_cost_convert,
self.opts_tsv_features, self.sample_cost_energy_meas, save_shp_warn=[])
self.opts_tsv_features, self.sample_cost_energy_meas)
self.dict_check(gen_tsv_facts_out_features[0],
self.ok_tsv_facts_out_features[idx])
# Test for measure with time sensitive valuation metrics
Expand All @@ -61865,7 +61865,7 @@ def test_load_modification(self):
gen_tsv_facts_out_metrics = measure.gen_tsv_facts(
self.sample_tsv_data, self.sample_mskeys_metrics[idx],
self.sample_bldg_sect, self.sample_cost_convert,
self.opts_tsv_metrics[idx], self.sample_cost_energy_meas, save_shp_warn=[])
self.opts_tsv_metrics[idx], self.sample_cost_energy_meas)
self.dict_check(gen_tsv_facts_out_metrics[0],
self.ok_tsv_facts_out_metrics[idx])

Expand Down

0 comments on commit 33f7cb4

Please sign in to comment.