-
Notifications
You must be signed in to change notification settings - Fork 32
Fix issues with electrical panel upgrade cost assignment and add unit test #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix issues with electrical panel upgrade cost assignment and add unit test #577
Conversation
jtlangevin
commented
Jan 15, 2026
- Correct issues identified in Issues with electrical panel upgrade cost assignment #575.
- Add a unit test that ensures panel upgrade costs are properly assessed in accordance with user settings (Unit test for panel upgrade cost adjustment #569).
- Ensure that shares of homes requiring a panel upgrade are actually assessed when that option is provided. - Remove any dependencies of cost data pre-incentives on subsequent incentive calculations. - Handle primary/secondary keys for fuel type when pulling in panel upgrade shares data. - Ensure that linked cooling equipment costs are properly assigned when processing a panel upgrade subsegment/technology name.
The unit test ensures that settings for panel upgrade share calculations are correctly read in and translated through the fill_mkts function to the measure's output data.
| and (self.technology_type == "demand" or ( | ||
| self.technology_type != "demand" and not all([( | ||
| (x in y) or ("all" in y)) for x, y in zip([ | ||
| "heating", "single family home", "existing"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are only heating upgrade technologies considered when allocating panel upgrade cost shares? Secondary heating, cooling, water heating, cooking, and drying may also trigger the need for a panel upgrade. In Line 4076 , secondary heating and cooling are already included in the panel upgrade determination. I suggest including secondary heating, cooling, water heating, cooking, and drying for there and Line 4076 at this stage. As future work, we can determine the relative contribution of each technology to the need for a panel upgrade. ResStock can now directly predict whether a home requires a panel upgrade, and this capability can be leveraged here.
| user_master_mseg | ||
| ) | ||
|
|
||
| def test_elec_upgrade_costs(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general comments for the test. Add clearer documentation of expected cost calculations at the beginning of the code funtion. For example,
Expected costs breakdown:
Base ASHP cost: $14,000
Panel replacement cost: $1,500
Panel management cost: $500
Scenario 1 (ignore): $14,000 (no panel cost)
Scenario 2 (all): $14,000 + $1,500 = $15,500
Scenario 3 (shares): $14,000 + (0.8 * $1,500 + 0.1 * $500) = $14,000 + $1,250
I think the unit tests should focus on verifying the core functionality of the code. For example, ensuring that panel upgrade costs are correctly added or excluded, base equipment costs remain unchanged. If we want to use specific data as test inputs, I suggest storing that data in a separate data file (e.g., a pickle file). We can discuss the overall testing structure further, as this is also related to the ongoing ecm_prep_test refactor work.