Skip to content

Conversation

@jtlangevin
Copy link
Collaborator

This part of the code will generate an error when coefficients are tiered (as in most new AEO equipment mseg data). That error is caught and handled by assigning the mseg default coefficients (currently set to that of a typical refrigeration tech) which is not desirable for technologies with potentially unique choice considerations (e.g., HVAC tech.)

The fix includes:

  • Properly handled tiered choice coefficient values
  • Improve transparency of coefficient value retrieval such that only expected cases of missing coefficient data are assigned default coefficient values, which are now separated by end use and fuel type.

@jtlangevin jtlangevin linked an issue Sep 15, 2025 that may be closed by this pull request
@jtlangevin jtlangevin added this to the v1.2.0 milestone Sep 22, 2025
@jtlangevin jtlangevin removed the request for review from aspeake October 20, 2025 17:55
Comment on lines +6539 to +6636
if mskeys[4] not in consume_warn:
consume_warn.append(mskeys[4])
verboseprint(opts.verbose, "WARNING: ECM '" + self.name + "' missing "
"valid consumer choice data for segment '" + str(mskeys) +
"'; using default choice data for refrigeration end use", "warning")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice verbose warning message! Still wondering if error vs warning is better, which we can discuss later.


return choice_params

def fix_lgt_perf_vals(self, perf_in, mskeys):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a future PR, we could introduce type hints to arguments. That would also help CI/linters catch errors quickly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good idea more generally for Scout functions, let's leave this open.

Comment on lines 5487 to 5492
# Ensure dictionary has end point data to draw from; if not, set segment
# coefficients to a default and notify user in verbose mode
if (tiered_flag and (
any([x[1] in [0, "NA"] for x in choice_dict["typical"]["b1"].items()]))
or (not tiered_flag and
any([x[1] in [0, "NA"] for x in choice_dict["b1"].items()]))):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to check 0/NA for b2 as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I had assumed that if b1 was NA b2 would be too, but better to check both.

After considering further, I also made the check for a float, where non-floats would indicate a problem with the coefficient (zeros aren't necessarily a problem as the original implementation had assumed).

Copy link
Collaborator

@jmythms jmythms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look great. I have added a few suggestions like type hints and extra checks for the b2 coefficient, but that can go to another PR if needed. Also, @jtlangevin mentioned he has tested this locally, and changes make sense.

jtlangevin and others added 3 commits October 27, 2025 13:34
* Properly handled tiered choice coefficient values
* Improve transparency of coefficient value retrieval such that only expected cases of missing coefficient data are assigned default coefficient values, which are now separated by end use and fuel type.
The check now extends to both b1 and b2 coefficients and ensures the coefficient value is a float as expected, with anything other than a float resulting in the default set of coefficients being chosen.
@jtlangevin jtlangevin force-pushed the 526-faulty-handling-of-tiered-tech-coefficients-in-ecm_prep branch from d0243de to 0a66332 Compare October 27, 2025 17:57
jtlangevin and others added 3 commits October 27, 2025 14:43
These had been missing, and are set to map cooking. Fossil other includes gas grills among other miscellaneous stuff like pool heaters, and backup generators.
@jtlangevin jtlangevin merged commit abe2b8d into master Oct 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Faulty handling of tiered tech coefficients in ecm_prep

3 participants