Skip to content

Commit

Permalink
Add cooling synonym, fix import issues
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmaloney committed Aug 3, 2020
1 parent b6a2b5c commit 79bc0b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
6 changes: 4 additions & 2 deletions docs/data_files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ Name Data Format Units Descriptio
.. [#] Possible values for :code:`cool_stage` are:
- :code:`single_speed`: Single stage compressor
- :code:`two_speed`: Dual stage compressor
- :code:`single_stage`: Single stage compressor
- :code:`two_stage`: Dual stage compressor
- :code:`single_speed`: Single stage compressor (synonym for single_stage)
- :code:`two_speed`: Dual stage compressor (synonym for two_stage)
- :code:`modulating`: Modulating or variable capacity compressor
.. [#] Will be used for matching with a weather station that provides external
Expand Down
4 changes: 3 additions & 1 deletion thermostat/equipment_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
COOL_STAGE = [
'single_speed', # Single stage compressor
'two_speed', # Dual stage compressor
'single_stage', # Single stage compressor (synonym)
'two_stage', # Dual stage compressor (synonym)
'modulating', # Modulating or variable capacity compressor
]

Expand Down Expand Up @@ -167,7 +169,7 @@ def has_two_stage_cooling(cool_stage):
-------
boolean
"""
if cool_stage == 'two_speed':
if cool_stage == 'two_speed' or cool_stage == 'two_stage':
return True
return False

Expand Down
16 changes: 12 additions & 4 deletions thermostat/importers.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def _calculate_cool_runtime(df, thermostat_id, cool_type, cool_stage, hourly_ind
cool_runtime_stg2 = df.cool_runtime_stg2
cool_runtime_equiv = df.cool_runtime_equiv


if cool_runtime_stg1.gt(60).any() or \
cool_runtime_stg2.gt(60).any() or \
cool_runtime_equiv.gt(60).any():
Expand All @@ -375,12 +376,15 @@ def _calculate_cool_runtime(df, thermostat_id, cool_type, cool_stage, hourly_ind

if has_two_stage_cooling(cool_stage):
cool_runtime_both_stg = (first_stage_capacity_fraction(cool_type) * cool_runtime_stg1) + cool_runtime_stg2
cool_runtime_in_bounds = cool_runtime_both_stg.dropna() <= df.cool_runtime_equiv.dropna()
if len(cool_runtime_equiv.dropna()) == len(cool_runtime_both_stg.dropna()):
cool_runtime_in_bounds = cool_runtime_both_stg.dropna() <= df.cool_runtime_equiv.dropna()
else:
cool_runtime_in_bounds = cool_runtime_both_stg.dropna() < 103.20

if not(cool_runtime_in_bounds.all()):
warnings.warn(
'Skipping import of thermostat with staged cooling runtime '
'greater than cooling equivalent runtime. (id={})'.format(thermostat_id))
'greater than cooling runtime equivalent. (id={})'.format(thermostat_id))
return

cool_runtime = _create_series(cool_runtime_both_stg, hourly_index)
Expand All @@ -407,11 +411,15 @@ def _calculate_heat_runtime(df, thermostat_id, heat_type, heat_stage, hourly_ind

if has_two_stage_heating(heat_stage):
heat_runtime_both_stg = (first_stage_capacity_fraction(heat_type) * heat_runtime_stg1) + heat_runtime_stg2
heat_runtime_in_bounds = heat_runtime_both_stg.dropna() <= df.heat_runtime_equiv.dropna()
if len(heat_runtime_equiv.dropna()) == len(heat_runtime_both_stg.dropna()):
heat_runtime_in_bounds = heat_runtime_both_stg.dropna() <= df.heat_runtime_equiv.dropna()
else:
heat_runtime_in_bounds = heat_runtime_both_stg.dropna() <= 103.20

if not(heat_runtime_in_bounds.all()):
warnings.warn(
'Skipping import of thermostat with staged heating runtime '
'greater than heating equivalent runtime. (id={})'.format(thermostat_id))
'greater than heating runtime equivalent. (id={})'.format(thermostat_id))
return
heat_runtime = _create_series(heat_runtime_both_stg, hourly_index)
else:
Expand Down

0 comments on commit 79bc0b1

Please sign in to comment.