AWHP cooling logic #111#116
Conversation
t-kramer
left a comment
There was a problem hiding this comment.
Thanks for working on this, @urwahah!
I had a quick look and found no major issues. I added some comments/questions. Please go through them if you have time. Below some more points from an AI reviewer. Might be worth checking them.
1. Potential NameError for sizing_priority == "larger" + sizing_mode == "fixed_num_units" (src/energy.py)
The "larger" branch only executes for integer_sizing_peak_load / fractional_sizing_peak_load. If a scenario somehow reaches the "Determine number of units" block with sizing_priority == "larger" and sizing_mode == "fixed_num_units", neither sizing_load nor cap_ref will have been set, crashing with a NameError. The UI disables the dropdown in this case, but there is no guard in the calculation code itself.
2. Division-by-zero in compressor allocation (src/energy.py ~Phase 5)
num_compressors_h = np.ceil(
(df[Col.AWHP_HHW_W.value] / df[Col.AWHP_CAP_H_W.value]) * num_compressors
)AWHP_CAP_H_W can be zero in hours where the unit has no capacity (e.g. extreme outdoor temperatures), producing NaN / Inf that propagates into num_compressors_c and awhp_num_c. The old code used an explicit mask for zero-heating hours.
3. num_compressors_c can go negative
If the heating load in an hour exceeds the unit's rated capacity (AWHP_HHW_W > AWHP_CAP_H_W), num_compressors_h > num_compressors, so num_compressors_c becomes negative. This silently produces negative cooling capacity and served cooling load.
4. _awhp_reference_capacity ignores its performance parameter for the actual lookup (src/energy.py)
The function accepts performance: PerformanceCurves, uses it only for the isinstance check, then re-fetches the same data via e.performance[load_type]. The parameter is redundant and the inconsistency is confusing — either use the passed-in object for the lookup too, or remove the parameter.
|
|
||
| cap_total_c_W = awhp_cap_c * awhp_num_c | ||
| # assuming that AWHPs all have 50% turndown (2 compressors) | ||
| num_compressors = awhp_num * 2 |
There was a problem hiding this comment.
It looks like this assumption is central to the new simultaneous H+C logic and should be at minimum a named constant? Maybe even a configurable field on Equipment?
There was a problem hiding this comment.
good point.. i think 2 compressors is pretty standard for modular units, so will just add a named constant for now, and we can add to the class if needed?
|
per #111: