Skip to content
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

Tstat equipment #159

Draft
wants to merge 18 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/run_dwelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# HVAC equipment
# Note: dictionary key can be end use (e.g., HVAC Heating) or specific equipment name (e.g., Gas Furnace)
# 'HVAC Heating': {
# # 'use_ideal_capacity': True,
# # 'use_ideal_mode': True,
# # 'show_eir_shr': True,
# },
# 'Air Conditioner': {
Expand All @@ -90,7 +90,7 @@
# # 'hp_only_mode': True
# },
# 'Electric Resistance Water Heater': {
# 'use_ideal_capacity': True,
# 'use_ideal_mode': True,
# },

# Other equipment
Expand Down
25 changes: 13 additions & 12 deletions bin/run_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,18 @@ def run_water_heater():
equipment_args = {
# Equipment parameters
# 'water_nodes': 1,
'Initial Temperature (C)': 49,
'Setpoint Temperature (C)': 51,
'Deadband Temperature (C)': 5,
'Capacity (W)': 4800,
'Efficiency (-)': 1,
'Tank Volume (L)': 250,
'Tank Height (m)': 1.22,
'UA (W/K)': 2.17,
'schedule': schedule,
"Initial Temperature (C)": 49,
"Setpoint Temperature (C)": 51,
"Deadband Temperature (C)": 5,
"Capacity (W)": 4800,
"Efficiency (-)": 1,
"Tank Volume (L)": 250,
"Tank Height (m)": 1.22,
"UA (W/K)": 2.17,
"schedule": schedule,
**default_args,
'time_res': time_res,
"time_res": time_res,
"duration": dt.timedelta(days=1),
}

# Initialize equipment
Expand Down Expand Up @@ -230,7 +231,7 @@ def run_equipment_from_house_model():

# run_battery()
# run_battery_controlled()
# run_water_heater()
run_water_heater()
# run_hvac()
run_ev()
# run_ev()
# run_equipment_from_house_model()
2 changes: 0 additions & 2 deletions bin/run_external_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
dwelling_args.update(
{
"time_res": dt.timedelta(minutes=10),
"ext_time_res": dt.timedelta(minutes=60), # for duty cycle control only
"Equipment": {
"EV": {
'vehicle_type': 'BEV',
Expand Down Expand Up @@ -128,7 +127,6 @@ def get_hvac_controls(hour_of_day, occupancy, heating_setpoint, **unused_inputs)
# 'Setpoint': heating_setpoint,
# 'Deadband': 2,
# 'Load Fraction': 0, # Set to 0 for force heater off
# 'Duty Cycle': 0.5, # Sets fraction of on-time explicitly
},
# 'HVAC Cooling': {...},
}
Expand Down
10 changes: 0 additions & 10 deletions docs/source/ControllerIntegration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,12 @@ HVAC Heating or HVAC Cooling
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating or HVAC Cooling | Max Capacity Fraction | unitless | Only if in schedule | Limits HVAC max capacity, ideal capacity only |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating or HVAC Cooling | Duty Cycle | unitless | TRUE | Sets the equipment duty cycle for ext_time_res, non-ideal capacity only |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating or HVAC Cooling | Disable Speed X | N/A | FALSE | Flag to disable low (X=1) or high (X=2) speed, only for 2 speed equipment |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating (ASHP only) | ER Capacity | W | TRUE | Sets ER element capacity directly, ideal capacity only |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating (ASHP only) | Max ER Capacity Fraction | unitless | Only if in schedule | Limits ER element max capacity, ideal capacity only |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+
| HVAC Heating (ASHP only) | ER Duty Cycle | unitless | TRUE | Sets the ER element duty cycle for ext_time_res, non-ideal capacity only |
+-------------------------------+--------------------------+-----------+---------------------+---------------------------------------------------------------------------+

Water Heating
-----------------------------
Expand All @@ -70,12 +66,6 @@ Water Heating
+---------------------+-----------+---------------------+--------------------------------------------------------------------+
| Max Power | kW | Only if in schedule | Sets the maximum power. Does not work for HPWH in HP mode |
+---------------------+-----------+---------------------+--------------------------------------------------------------------+
| Duty Cycle | unitless | TRUE | Sets the equipment duty cycle for ext_time_res |
+---------------------+-----------+---------------------+--------------------------------------------------------------------+
| HP Duty Cycle | unitless | TRUE | Sets the HPWH heat pump duty cycle for ext_time_res |
+---------------------+-----------+---------------------+--------------------------------------------------------------------+
| ER Duty Cycle | unitless | TRUE | Sets the HPWH electric resistance duty cycle for ext_time_res [#]_ |
+---------------------+-----------+---------------------+--------------------------------------------------------------------+

.. [#] Sending {'Setpoint': None} will reset the setpoint to the default schedule. Note that a 10 F (5.56 C)
decrease in setpoint corresponds to a CTA-2045 'Load Shed' command. A 10 F increase corresponds to an
Expand Down
7 changes: 2 additions & 5 deletions docs/source/InputsAndArguments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ The table below lists the optional arguments for creating a ``Dwelling`` model.
``save_status`` boolean ``TRUE`` [#]_ Save status file for is simulation completed or failed
``save_schedule_columns`` list Empty list List of time series inputs to save to schedule outputs file
``schedule`` pandas.DataFrame None Schedule with equipment and weather data that overrides the ``schedule_input_file`` and the ``equipment_schedule_file``. Not required for ``Dwelling``
``ext_time_res`` datetime.timedelta None Time resolution for external controller. Required for Duty Cycle control.
``seed`` int or string HPXML or schedule file Random seed for initial temperatures and EV event data
``modify_hpxml_dict`` dict empty dict Dictionary that directly modifies values from HPXML file
``Occupancy`` dict empty dict Includes arguments for building occupancy
Expand Down Expand Up @@ -300,8 +299,6 @@ described in the sections below.
+-----------------------------+------------------------+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``schedule`` | ``pandas.DataFrame`` | None | Schedule with equipment or weather data that overrides the schedule_input_file and the equipment_schedule_file. Not required for Dwelling and some equipment |
+-----------------------------+------------------------+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``ext_time_res`` | ``datetime.timedelta`` | None | Time resolution for external controller. Required if using Duty Cycle control |
+-----------------------------+------------------------+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ``seed`` | int or string | HPXML or equipment schedule file | Random seed for setting initial temperatures and EV event data |
+-----------------------------+------------------------+--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------+

Expand Down Expand Up @@ -352,7 +349,7 @@ arguments for HVAC equipment.
+================================================+===========================+==============================+====================================================================+====================================================================================================================+
| ``envelope_model`` | ``ochre.Envelope`` | Yes | | Envelope model for measuring temperature impacts |
+------------------------------------------------+---------------------------+------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| ``use_ideal_capacity`` | boolean | No | True if time_res >= 5 minutes or for variable-speed equipment | If True, OCHRE sets HVAC capacity to meet the setpoint. If False, OCHRE uses thermostat deadband control |
| ``use_ideal_mode`` | boolean | No | True if time_res >= 5 minutes or for variable-speed equipment | If True, OCHRE sets HVAC capacity to meet the setpoint. If False, OCHRE uses thermostat deadband control |
+------------------------------------------------+---------------------------+------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| ``Capacity (W)`` | number or list of numbers | Yes | Taken from HPXML | Rated capacity of equipment. If a list, it is the rated capacity by speed |
+------------------------------------------------+---------------------------+------------------------------+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -422,7 +419,7 @@ arguments for Water Heating equipment.
+-----------------------------------------------------+---------------+------------------------------------+-----------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Argument Name | Argument Type | Required? | Default Value | Description |
+=====================================================+===============+====================================+=======================================================================+==================================================================================================================+
| ``use_ideal_capacity`` | boolean | No | True if time_res >= 5 minutes | If True, OCHRE sets water heater capacity to meet the setpoint. If False, OCHRE uses thermostat deadband control |
| ``use_ideal_mode`` | boolean | No | True if time_res >= 5 minutes | If True, OCHRE sets water heater capacity to meet the setpoint. If False, OCHRE uses thermostat deadband control |
+-----------------------------------------------------+---------------+------------------------------------+-----------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| ``water_nodes`` | int | No | 12 if Heat Pump Water Heater, 1 if Tankless Water Heater, otherwise 2 | Number of nodes in water tank model |
+-----------------------------------------------------+---------------+------------------------------------+-----------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------+
Expand Down
6 changes: 1 addition & 5 deletions docs/source/ModelingApproach.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ All HVAC equipment can be externally controlled by updating the thermostat
setpoints and deadband or by direct load control (i.e., shut-off). Specific
speeds can be disabled in multi-speed equipment. Equipment capacity can also
be set directly or controlled using a maximum capacity fraction in ideal mode.
In thermostatic mode, duty cycle controls can determine the equipment state.
The equipment will follow the duty cycle control exactly while minimizing
cycling and temperature deviation from setpoint.

Ducts
~~~~~
Expand Down Expand Up @@ -255,8 +252,7 @@ schedule.

Similar to HVAC equipment, water heater equipment has a thermostat control,
and can be externally controlled by updating the thermostat setpoints and
deadband, specifying a duty cycle, or direct shut-off. Tankless equipment can
only be controlled through thermostat control and direct-shut-off.
deadband or direct shut-off.

Electric Vehicles
-----------------
Expand Down
21 changes: 7 additions & 14 deletions ochre/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,21 +438,14 @@ def calculate_metrics(results=None, results_file=None, dwelling=None, metrics_ve

# Equipment cycling metrics
if metrics_verbosity >= 5:
mode_cols = [col for col in results if ' Mode' in col]
mode_cols = [col for col in results if " On-Time Fraction (-)" in col]
for mode_col in mode_cols:
name = re.fullmatch('(.*) Mode', mode_col).group(1)
modes = results[mode_col]
unique_modes = [mode for mode in modes.unique() if mode != 'Off']
for unique_mode in unique_modes:
on = modes == unique_mode
cycle_starts = on & (~on).shift()
cycles = cycle_starts.sum()
if cycles <= 1:
continue
elif len(unique_modes) == 1:
metrics[f'{name} Cycles'] = cycles
else:
metrics[f'{name} "{unique_mode}" Cycles'] = cycles
name = re.fullmatch("(.*) On-Time Fraction (-)", mode_col).group(1)
on_frac = results[mode_col].astype(bool)
cycle_starts = on_frac & (~on_frac).shift()
cycles = cycle_starts.sum()
if cycles > 0:
metrics[f"{name} Cycles"] = cycles

# FUTURE: add rates, emissions, other post processing
# print('Loading rate file...')
Expand Down
4 changes: 2 additions & 2 deletions ochre/Dwelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def __init__(self, metrics_verbosity=6, save_schedule_columns=None, save_args_to

for name, eq in self.equipment.items():
# if time step is large, check that ideal equipment is being used
ideal = eq.use_ideal_capacity if isinstance(eq, (HVAC, WaterHeater)) else True
ideal = eq.use_ideal_mode if isinstance(eq, (HVAC, WaterHeater)) else True
if not ideal:
if self.time_res >= dt.timedelta(minutes=15):
raise OCHREException(f'Cannot use non-ideal equipment {name} with large time step of'
Expand All @@ -158,7 +158,7 @@ def __init__(self, metrics_verbosity=6, save_schedule_columns=None, save_args_to

# force ideal HVAC equipment to go last - so all heat from other equipment is known during update
for eq in self.equipment.values():
if isinstance(eq, HVAC) and eq.use_ideal_capacity:
if isinstance(eq, HVAC) and eq.use_ideal_mode:
self.sub_simulators.pop(self.sub_simulators.index(eq))
self.sub_simulators.append(eq)
# force generator/battery to go last - so it can run self-consumption controller
Expand Down
Loading