@@ -359,12 +359,9 @@ def split_clean_data(meas_prepped_objs, full_dat_out):
359359 if not isinstance(m, MeasurePackage):
360360 del m.markets[adopt_scheme]["mseg_adjust"][
361361 "paired heat/cool mseg adjustments"]
362- # Add remaining contributing microsegment data to
363- # competition data dict, if the adoption scenario will be competed
364- # in the run.py module, then delete from measure
362+ # Add fuel splits and sector shape data, if applicable and the adoption scenario
363+ # will be competed in the run.py module, then delete from measure
365364 if full_dat_out[adopt_scheme]:
366- comp_data_dict[adopt_scheme] = \
367- m.markets[adopt_scheme]["mseg_adjust"]
368365 # If applicable, add efficient fuel split data to fuel split
369366 # data dict
370367 if len(m.eff_fs_splt[adopt_scheme].keys()) != 0:
@@ -380,6 +377,9 @@ def split_clean_data(meas_prepped_objs, full_dat_out):
380377 # If adoption scenario will not be competed in the run.py
381378 # module, remove detailed mseg breakouts
382379 del m.markets[adopt_scheme]["mseg_out_break"]
380+ # Add remaining contributing microsegment data to competition data dict, then
381+ # delete from measure
382+ comp_data_dict[adopt_scheme] = m.markets[adopt_scheme]["mseg_adjust"]
383383 del m.markets[adopt_scheme]["mseg_adjust"]
384384 # Delete info. about efficient fuel splits for fuel switch measures
385385 del m.eff_fs_splt
@@ -405,6 +405,12 @@ def split_clean_data(meas_prepped_objs, full_dat_out):
405405 del m.linked_htcl_tover
406406 del m.linked_htcl_tover_anchor_eu
407407 del m.linked_htcl_tover_anchor_tech
408+ # Delete flag for reference case measure, which is used for incentives calculations
409+ del m.ref_case_flag
410+ # If backup fuel fraction data exist (will be dataframe), convert to simple flag
411+ # for JSON write-out and subsequent use in run
412+ if m.backup_fuel_fraction is not None:
413+ m.backup_fuel_fraction = True
408414 # For measure packages, replace 'contributing_ECMs'
409415 # objects list with a list of these measures' names and remove
410416 # unnecessary heating/cooling equip/env overlap data
@@ -4825,9 +4831,9 @@ def use_deflt_res_choice(self, mskeys, consume_warn, opts):
48254831 # technology, print warning message
48264832 if mskeys[4] not in consume_warn:
48274833 consume_warn.append(mskeys[4])
4828- verboseprint(opts.verbose, "WARNING: ECM '" + self.name + "' missing "
4829- "valid consumer choice data for segment '" + str(mskeys) +
4830- "'; using default choice data for refrigeration end use", "warning")
4834+ fmt. verboseprint(opts.verbose, "WARNING: ECM '" + self.name + "' missing "
4835+ "valid consumer choice data for segment '" + str(mskeys) +
4836+ "'; using default choice data for refrigeration end use", "warning")
48314837 choice_params = {
48324838 "b1": {yr: deflt_coefs[0] for yr in self.handyvars.aeo_years},
48334839 "b2": {yr: deflt_coefs[1] for yr in self.handyvars.aeo_years}}
@@ -5185,7 +5191,7 @@ def apply_incentives(
51855191 rpl_vals.append(incent_lev * appl_frac)
51865192 # If units don't match, append incentive value of zero and continue
51875193 elif not suppress_ira and perf_thres_units != units:
5188- verboseprint(
5194+ fmt. verboseprint(
51895195 opts.verbose,
51905196 "Incentive units of " + perf_thres_units +
51915197 " do not match required units of " + units +
@@ -9774,7 +9780,8 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
97749780 fuel->end use->technology type->structure type).
97759781 adopt_scheme (string): Assumed consumer adoption scenario.
97769782 opts (object): Stores user-specified execution options.
9777- input_data (list): Stores all segment-specific data that need to be assigned to breakouts.
9783+ input_data (list): Stores all segment-specific data that need to be assigned to
9784+ breakouts.
97789785 gap_adj_frac (float): Fraction to apply to breakout data to represent
97799786 portions of msegs that are not covered by ComStock load shapes (if applicable)
97809787 Returns:
@@ -9826,7 +9833,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
98269833 eu[0] in ["Heating (Env.)", "Cooling (Env.)"] and
98279834 mskeys[5] == "demand") or (
98289835 eu[0] not in ["Heating (Equip.)", "Cooling (Equip.)",
9829- "Heating (Env.)", "Cooling (Env.)"]):
9836+ "Heating (Env.)", "Cooling (Env.)"]):
98309837 out_eu = eu[0]
98319838 elif "lighting gain" in mskeys:
98329839 out_eu = "Lighting"
@@ -9925,7 +9932,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
99259932 # Create a shorthand for baseline and efficient stock/energy/carbon/
99269933 # cost data to add to the breakout dict
99279934 base_data = [brk_stock_total, brk_energy_total,
9928- brk_energy_cost, brk_carb_total]
9935+ brk_energy_cost, brk_carb_total]
99299936 eff_data = [brk_stock_total_meas, brk_energy_total_eff,
99309937 brk_energy_cost_eff, brk_carb_total_eff]
99319938
@@ -9949,8 +9956,8 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
99499956 brk_fs_energy_cost_eff_remain_base,
99509957 brk_fs_carb_eff_remain_base]
99519958 eff_data_fs_switch = [brk_fs_energy_eff_remain_switch,
9952- brk_fs_energy_cost_eff_remain_switch,
9953- brk_fs_carb_eff_remain_switch]
9959+ brk_fs_energy_cost_eff_remain_switch,
9960+ brk_fs_carb_eff_remain_switch]
99549961 # Record the efficient energy that has not yet fuel switched and
99559962 # total efficient energy for the current mseg for later use in
99569963 # packaging and/or competing measures
@@ -10006,7 +10013,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1000610013 "efficient"][out_cz][out_bldg][out_eu][
1000710014 out_fuel_save][yr] += \
1000810015 (eff_data_fs_base[ind][yr] +
10009- eff_data_fs_switch[(ind-1)][yr])
10016+ eff_data_fs_switch[(ind-1)][yr])
1001010017 # Note that no baseline fuel, baseline technology
1001110018 # consumption (e.g., not in backup service to
1001210019 # measure) remains for captured stock by
@@ -10023,14 +10030,14 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1002310030 out_fuel_save][yr] += (
1002410031 base_data[ind][yr] -
1002510032 (eff_data_fs_base[ind][yr] +
10026- eff_data_fs_switch[(ind-1)][yr]))
10033+ eff_data_fs_switch[(ind-1)][yr]))
1002710034 except KeyError:
1002810035 for ind, key in enumerate(breakout_vars):
1002910036 # Baseline; add in baseline data as-is
1003010037 self.markets[adopt_scheme]["mseg_out_break"][key][
1003110038 "baseline"][out_cz][out_bldg][out_eu][
10032- out_fuel_save] = {yr: base_data[ind][yr] for
10033- yr in self.handyvars.aeo_years}
10039+ out_fuel_save] = {yr: base_data[ind][yr] for
10040+ yr in self.handyvars.aeo_years}
1003410041 # Efficient and savings; if there is fuel switching, only
1003510042 # the portion of the efficient case results that have not
1003610043 # yet switched (due to stock turnover limitations) remain,
@@ -10059,7 +10066,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1005910066 "efficient"][out_cz][out_bldg][out_eu][
1006010067 out_fuel_save] = {
1006110068 yr: (eff_data_fs_base[ind][yr] +
10062- eff_data_fs_switch[(ind-1)][yr]) for
10069+ eff_data_fs_switch[(ind-1)][yr]) for
1006310070 yr in self.handyvars.aeo_years}
1006410071 # Note that no baseline fuel, baseline technology
1006510072 # consumption (e.g., not in backup service to
@@ -10101,8 +10108,8 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1010110108 key]["efficient"][out_cz][out_bldg][
1010210109 out_eu][out_fuel_gain][yr] += \
1010310110 (eff_data[ind][yr] -
10104- (eff_data_fs_base[ind][yr] +
10105- eff_data_fs_switch[(ind - 1)][yr]))
10111+ (eff_data_fs_base[ind][yr] +
10112+ eff_data_fs_switch[(ind - 1)][yr]))
1010610113 # All captured efficient energy goes to
1010710114 # switched to fuel, except in the case where
1010810115 # the switched to measure has dual fuel
@@ -10120,7 +10127,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1012010127 out_fuel_gain][yr] -= (
1012110128 eff_data[ind][yr] -
1012210129 (eff_data_fs_base[ind][yr] +
10123- eff_data_fs_switch[(ind - 1)][yr]))
10130+ eff_data_fs_switch[(ind - 1)][yr]))
1012410131 else:
1012510132 self.markets[adopt_scheme]["mseg_out_break"][
1012610133 key]["efficient"][out_cz][out_bldg][
@@ -10138,8 +10145,8 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1013810145 # initialized as zero
1013910146 self.markets[adopt_scheme]["mseg_out_break"][key][
1014010147 "baseline"][out_cz][out_bldg][out_eu][
10141- out_fuel_gain] = {yr: 0 for yr in
10142- self.handyvars.aeo_years}
10148+ out_fuel_gain] = {yr: 0 for yr in
10149+ self.handyvars.aeo_years}
1014310150 # Efficient and savings; efficient case energy/
1014410151 # emissions/cost that do not remain with the baseline
1014510152 # fuel are added to the switched to fuel and
@@ -10163,8 +10170,8 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1016310170 "efficient-captured"][
1016410171 out_cz][out_bldg][out_eu][
1016510172 out_fuel_gain] = {
10166- yr: (capt_e[yr] -
10167- eff_data_fs_switch[(ind-1)][yr])
10173+ yr: (capt_e[yr] -
10174+ eff_data_fs_switch[(ind-1)][yr])
1016810175 for yr in
1016910176 self.handyvars.aeo_years}
1017010177 self.markets[adopt_scheme][
@@ -10226,7 +10233,7 @@ def breakout_mseg(self, mskeys, contrib_mseg_key, adopt_scheme, opts, input_data
1022610233 self.markets[adopt_scheme]["mseg_out_break"][key][
1022710234 "savings"][out_cz][out_bldg][out_eu] = {
1022810235 yr: (base_data[ind][yr] -
10229- eff_data[ind][yr]) for
10236+ eff_data[ind][yr]) for
1023010237 yr in self.handyvars.aeo_years}
1023110238
1023210239 # Yield warning if current contributing microsegment cannot
0 commit comments