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

merge for v0.8.5 #125

Merged
merged 104 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
5d3bd69
adding hvac capacity control
mnblonsky Oct 5, 2023
93bd13f
updating changelog heading
mnblonsky Oct 6, 2023
9130c69
removing parquet and csv files from old runs
mnblonsky Oct 17, 2023
e7f04b6
Direct import of numba, addresses #83
mnblonsky Oct 17, 2023
30d659d
tested external HVAC capacity control
mnblonsky Oct 17, 2023
2b42402
adding OCHREException
mnblonsky Oct 18, 2023
dd2a33c
doc and trademark updates
mnblonsky Oct 18, 2023
b524333
updating changelog
mnblonsky Oct 18, 2023
6436bd6
starting HVAC edits
mnblonsky Oct 24, 2023
688985c
User Improvements (#86)
jmaguire1 Nov 6, 2023
6238216
Unit conversion error on strip heat capacity.
jmaguire1 Nov 14, 2023
04d790a
Unit conversion error on strip heat capacity. (#92)
jmaguire1 Nov 14, 2023
794f1e0
beginning pysam bug fixes
mnblonsky Nov 14, 2023
aaa2b8c
updated changelog
mnblonsky Nov 14, 2023
bcd379e
Syntax issue from #91.
jmaguire1 Nov 14, 2023
5c1e871
removing old code from tutorial
mnblonsky Dec 19, 2023
e0e05f3
Merge branch 'dev' of https://github.com/NREL/OCHRE into dev
mnblonsky Dec 19, 2023
9fecd06
linting update
mnblonsky Dec 27, 2023
78869f3
use envelope tilt/az for PV
mnblonsky Dec 29, 2023
4544660
update to pysam v5.0
mnblonsky Dec 29, 2023
71fa910
remove include_inverter
mnblonsky Dec 29, 2023
a602c12
remove sam_weather_file
mnblonsky Dec 29, 2023
1461c9c
update pv docs
mnblonsky Dec 30, 2023
61094fd
fix bug in run_hvac
mnblonsky Jan 4, 2024
7092d8c
update changelog
mnblonsky Jan 4, 2024
f732e3d
Merge branch 'dev' into simple-env-bug
mnblonsky Jan 4, 2024
ed9c14f
Standalone HVAC bug fix (#98)
mnblonsky Feb 19, 2024
d8ce14a
add requirement for pysam v5.0
mnblonsky Feb 19, 2024
fdfa4dd
doc updates
mnblonsky Feb 19, 2024
ad1a5be
added error message if no tilt info for PV
mnblonsky Feb 19, 2024
45afe99
update changelog
mnblonsky Feb 19, 2024
28f5cfe
adding HVAC schedule control example
mnblonsky Feb 19, 2024
d2d4992
WH updates, not complete
mnblonsky Feb 20, 2024
7174a33
Merge branch 'dev' into new-controls
mnblonsky Feb 20, 2024
ccf6e5f
added optional WH setp and db to schedule
mnblonsky Feb 20, 2024
123a53a
add optional WH max power control
mnblonsky Feb 20, 2024
4ce865a
update max power for HPWH and tankless WH
mnblonsky Feb 20, 2024
07632b1
fixing WH example scripts
mnblonsky Feb 23, 2024
b053fa8
bug fix for HPWH
mnblonsky Feb 27, 2024
cd9f4b0
added HVAC comments
mnblonsky Feb 27, 2024
83bfb09
removed duty cycle for ideal capacity HVAC;
mnblonsky Feb 27, 2024
12434df
hvac docs updates
mnblonsky Feb 28, 2024
dae5fc5
update changelog
mnblonsky Feb 28, 2024
e2be94f
bug fix for named equipment args
mnblonsky Feb 28, 2024
095a160
bug fix for ASHP duty cyle control
mnblonsky Feb 28, 2024
e4b3f5d
script updates and bug fixes
mnblonsky Feb 28, 2024
78b790b
updated changelog
mnblonsky Feb 28, 2024
9df63c9
Merge branch 'new-controls' into hvac-capacity-ctrl
mnblonsky Feb 28, 2024
b144307
HVAC external capacity control (#84)
mnblonsky Feb 28, 2024
5ea767e
replacing heat gain/capacity outputs from kW to W units
mnblonsky Feb 28, 2024
60902ef
updating docs with new units, added some outputs
mnblonsky Feb 28, 2024
6f38f45
added HVAC controls to schedule, updated duty cycle control
mnblonsky Feb 28, 2024
ba506b7
fixing bug in StateSpaceModel.reduce_model
mnblonsky Feb 29, 2024
3ce7fdc
update changelog
mnblonsky Feb 29, 2024
a193a86
additional bug fixes for model reduction
mnblonsky Mar 6, 2024
4ebb84c
State space model reduction bug fix (#108)
jmaguire1 Mar 7, 2024
cfff8e9
added control schedules for generator
mnblonsky Mar 7, 2024
8f47d8d
added new battery controls
mnblonsky Mar 12, 2024
585c56b
fixing bug in net_power and pv_power for Battery controls
mnblonsky Mar 12, 2024
096ca7f
fix bug for battery import/export limits
mnblonsky Mar 12, 2024
7ee0175
script updates
mnblonsky Mar 12, 2024
0418179
Merge branch 'dev' into pysam-bugs
mnblonsky Mar 12, 2024
2e84abe
bug fix for flipping PV sign (to negative)
mnblonsky Mar 12, 2024
e19fa93
removing print statement
mnblonsky Mar 12, 2024
3fcef6a
Update to PySAM v5.0 (#104)
jmaguire1 Mar 20, 2024
de631f2
update .gitignore for venv
mnblonsky Mar 27, 2024
de8aa0c
generator import limit bug fix
mnblonsky Mar 27, 2024
ee084da
fix pandas future warning in Analysis
mnblonsky Mar 27, 2024
820dfb5
bug fix for battery islanding time
mnblonsky Mar 27, 2024
45bf797
fix for pandas warning
mnblonsky Mar 28, 2024
659b391
adding warning for ASHP with COP < 2
mnblonsky Mar 28, 2024
1ad40fa
bug fix for calculating WH metrics
mnblonsky Mar 28, 2024
c11e6d1
add low COP warning for all dynamic HVAC and for HPWH
mnblonsky Mar 28, 2024
28ef3b7
WH controls bug fix
mnblonsky Apr 2, 2024
01014ad
add new ev controls, not tested
mnblonsky Apr 2, 2024
ec4156e
fixed issue with schedule file import with pandas v2.2
mnblonsky Mar 12, 2024
74bbbb7
EV controls tested
mnblonsky Apr 2, 2024
040e932
Merge remote-tracking branch 'origin/dev' into new-controls
mnblonsky Apr 2, 2024
740962b
removing EV max power constraint for P Setpoint
mnblonsky Apr 2, 2024
661368e
update changelog with new controls
mnblonsky Apr 2, 2024
1b80cae
update changelog
mnblonsky Apr 2, 2024
6112f0e
update WH modeling approach
mnblonsky Apr 2, 2024
29d0a14
update EV and battery docs for new controls
mnblonsky Apr 2, 2024
daf1dbd
bug fix for voltage metrics
mnblonsky Apr 4, 2024
bc95152
updated controller integration docs
mnblonsky Apr 4, 2024
8735d5e
docs updates
mnblonsky Apr 5, 2024
fc24fc8
New controls (#106)
jmaguire1 Apr 5, 2024
6f00cd9
add pyproject.toml
mnblonsky Apr 29, 2024
0dcce0d
move defaults folder into ochre
mnblonsky Apr 29, 2024
79c1fca
updating default_input_path
mnblonsky Apr 29, 2024
79049e7
remove setup.py
mnblonsky Apr 29, 2024
2cdc7a1
require python <3.12
mnblonsky Apr 29, 2024
7ffbcff
update changelog
mnblonsky Apr 29, 2024
6d920d8
adding compatible versioning for dependencies
mnblonsky May 2, 2024
5cc3e94
added versions for all dependencies
mnblonsky May 15, 2024
0d8d2b2
fixing syntax warning for python 3.12
mnblonsky May 15, 2024
dc0345d
updated changelog
mnblonsky May 15, 2024
2a29228
fix EV random events bugs
mnblonsky May 16, 2024
6c5b7bc
Package Improvements (#120)
jmaguire1 May 16, 2024
c3c453e
update ev docs
mnblonsky May 22, 2024
57bc043
updated changelog
mnblonsky May 22, 2024
ffb740e
Fixing EV random event generator (#122)
jmaguire1 May 31, 2024
db3269e
quick fix for garage area outside of rectangular footprint
mnblonsky Jun 3, 2024
2d1072b
bug fix in docs
mnblonsky Jun 3, 2024
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: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

.idea/
.vscode/
.env
.venv
__pycache__/
src/
build/
dist/
docs/_build
*.egg-info/
*.code-workspace
environment.yml
requirements.txt

defaults/Input Files/OCHRE*
outputs/
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
![OCHRE](docs\source\images\OCHRE-Logo-Horiz-2Color.png)

# OCHRE: The Object-oriented Controllable High-resolution Residential Energy Model

A high-fidelity, high-resolution residential building model with behind-the-meter DERs and flexible load models
that integrates with controllers and distribution models in building-to-grid co-simulation platforms.
OCHRE&trade; is a Python-based building energy modeling (BEM) tool designed to model flexible loads in residential buildings. OCHRE includes detailed models and controls for flexible devices including HVAC equipment, water heaters, electric vehicles, solar PV, and batteries. It is designed to run in co-simulation with custom controllers, aggregators, and grid models.

The full documentation for OCHRE can be found at https://ochre-docs-final.readthedocs.io/en/latest/

Contact: jeff.maguire@nrel.gov, michael.blonsky@nrel.gov, killian.mckenna@nrel.gov

## Installation

Note that OCHRE requires Python version 3.9 or higher
Note that OCHRE requires Python version >=3.9 and <3.12

### Stand-alone Installation

Expand Down
2 changes: 1 addition & 1 deletion bin/run_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def run_water_heater():
water_draw_magnitude = 12 # L/min
withdraw_rate = np.random.choice([0, water_draw_magnitude], p=[0.99, 0.01], size=len(times))
schedule = pd.DataFrame({
'Fixtures (L/min)': withdraw_rate,
'Water Heating (L/min)': withdraw_rate,
'Zone Temperature (C)': 20,
'Mains Temperature (C)': 7,
}, index=times)
Expand Down
106 changes: 80 additions & 26 deletions bin/run_external_control.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,100 @@
import datetime as dt
import pandas as pd

from ochre import Dwelling
from ochre import Dwelling, CreateFigures
from bin.run_dwelling import dwelling_args

# Test script to run single Dwelling with constant external control signal

dwelling_args.update({
'ext_time_res': dt.timedelta(minutes=60),
})
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',
'charging_level': 'Level 2',
'mileage': 150,
},
},
}
)

example_control_signal = {
'HVAC Heating': {'Setpoint': 19}, # in C
'HVAC Cooling': {'Setpoint': 22}, # in C
'Water Heating': {'Setpoint': 50}, # in C
'PV': {'P Setpoint': -1.1, 'Q Setpoint': 0.5}, # in kW, kVAR
'Battery': {'P Setpoint': -1.0}, # in kW
"HVAC Heating": {
"Setpoint": 19,
# 'Max Capacity Fraction': 0.8,
"Max ER Capacity Fraction": 0.5,
}, # in C
"HVAC Cooling": {"Setpoint": 22}, # in C
"Water Heating": {"Setpoint": 50}, # in C
"PV": {"P Setpoint": -1.1, "Q Setpoint": 0.5}, # in kW, kVAR
"Battery": {
# 'P Setpoint': -1.0, # in kW
# "SOC": 0.8,
"Self Consumption Mode": True,
"Max Import Limit": 1, # in kW
"Max Export Limit": 1, # in kW
# 'Min SOC': 0.2,
# 'Max SOC': 0.8,
},
"EV": {
# "Delay": True,
"Max Power": 6,
"Max SOC": 0.7,
# "P Setpoint": 5,
# "SOC": 0.6,
# "SOC Rate": 0.02,
},
}


def run_constant_control_signal(control_signal):
def run_with_schedule_control():
# Create Dwelling model (same as above)
dwelling = Dwelling(name="Test House with Controller", **dwelling_args)

# Get HVAC heater setpoints
heater = dwelling.get_equipment_by_end_use('HVAC Heating')
setpoints = heater.schedule['HVAC Heating Setpoint (C)']

# Reduce heating setpoint by 1C from 5-9PM
peak_times = setpoints.between_time(dt.time(17, 0, 0), dt.time(21, 0, 0), inclusive='left').index
setpoints.loc[peak_times] -= 1
heater.reset_time() # resets the schedule

# Run simulation
dwelling.simulate()


def run_constant_control_signal(control_signal=None):
# Initialization
dwelling = Dwelling(name='Test House with Controller', **dwelling_args)
dwelling = Dwelling(name='OCHRE with Controller', **dwelling_args)

# Simulation
for t in dwelling.sim_times:
assert dwelling.current_time == t
# assert dwelling.current_time == t
house_status = dwelling.update(control_signal=control_signal)

return dwelling.finalize()
df, _, _ = dwelling.finalize()

df["EV Electric Power (kW)"].plot()
df["EV SOC (-)"].plot()
CreateFigures.plt.show()


def get_hvac_controls(hour_of_day, occupancy, heating_setpoint, **unused_inputs):
# Use some of the controller_inputs to determine setpoints (or other control signals)
if 14 <= hour_of_day < 20: # 2PM-8PM
if occupancy > 0:
heating_setpoint -= 1 # reduce setpoint by 1 degree C
else:
heating_setpoint -= 2 # reduce setpoint by 2 degrees C
heating_setpoint -= 1 # reduce setpoint by 1 degree C
# if occupancy > 0:
# heating_setpoint -= 1 # reduce setpoint by 1 degree C
# else:
# heating_setpoint -= 2 # reduce setpoint by 2 degrees C

return {
# 'HVAC Heating': {'Duty Cycle': 1 if heating_on else 0},
'HVAC Heating': {
'Setpoint': heating_setpoint,
'Capacity': 1000,
# '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
Expand All @@ -53,7 +105,7 @@ def get_hvac_controls(hour_of_day, occupancy, heating_setpoint, **unused_inputs)

def run_with_hvac_controller():
# Initialization
dwelling = Dwelling(name='Test House with Controller', **dwelling_args)
dwelling = Dwelling(name="OCHRE with Controller", **dwelling_args)
heater = dwelling.get_equipment_by_end_use('HVAC Heating')
cooler = dwelling.get_equipment_by_end_use('HVAC Cooling')

Expand All @@ -73,8 +125,9 @@ def run_with_hvac_controller():
'hour_of_day': t.hour,
'outdoor_temp': dwelling.envelope.schedule.loc[t, 'Ambient Dry Bulb (C)'],
'occupancy': dwelling.envelope.schedule.loc[t, 'Occupancy (Persons)'],
'heating_setpoint': heater.schedule.loc[t, 'HVAC Heating Setpoint (C)'], # Original setpoint for current time
'cooling_setpoint': cooler.schedule.loc[t, 'HVAC Cooling Setpoint (C)'], # Original setpoint for current time
# Original setpoints for current time
'heating_setpoint': heater.schedule.loc[t, 'HVAC Heating Setpoint (C)'],
'cooling_setpoint': cooler.schedule.loc[t, 'HVAC Cooling Setpoint (C)'],
})

control_signal = get_hvac_controls(**controller_inputs)
Expand All @@ -95,7 +148,7 @@ def run_controls_from_file(control_file):
df_ext = pd.read_csv(control_file, index_col='Time', parse_dates=True)

# Initialization
dwelling = Dwelling(name='Test House with Controller', **dwelling_args)
dwelling = Dwelling(name="OCHRE with Controller", **dwelling_args)

# Simulation
control_signal = None
Expand All @@ -110,6 +163,7 @@ def run_controls_from_file(control_file):


if __name__ == '__main__':
# run_constant_control_signal(example_control_signal)
# run_controls_from_file(external_control_file='path/to/control_file.csv')
run_with_hvac_controller()
# run_with_schedule_control()
run_constant_control_signal(example_control_signal)
# run_with_hvac_controller()
# run_controls_from_file(external_control_file='path/to/control_file.csv')
2 changes: 1 addition & 1 deletion bin/run_fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run_water_heater_fleet(num_water_heaters=5):
'Tank Height (m)': 1.22,
'UA (W/K)': 2.17,
'schedule': pd.DataFrame({
'Fixtures (L/min)': withdraw_rate[wh_name],
'Water Heating (L/min)': withdraw_rate[wh_name],
'Zone Temperature (C)': np.random.uniform(15, 18),
'Mains Temperature (C)': np.random.uniform(5.6, 8.3),
}, index=times),
Expand Down
1 change: 0 additions & 1 deletion bin/run_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ def run_single_building(input_path, simulation_name='ochre', output_path=None):
def compile_results(main_folder):
# Sample script to compile results from multiple OCHRE runs
# assumes each run is in a different folder, and all simulation names are 'ochre'
dirs_to_include = int(dirs_to_include)

# set up
main_folder = os.path.abspath(main_folder)
Expand Down
28 changes: 28 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
## OCHRE Changelog

### Changes from PRs

- Updated PV model to integrate with PVWatts using PySAM v5.0 (not backwards compatible)
- PV model accepts tilt and azimuth angles from roof boundary in envelope
- Removed and renamed PV input arguments related to PySAM
- Changed the units for some outputs related to heat gains/capacity
- Added controls and optional schedule columns for HVAC, WH, EV, Battery
- Added HVAC capacity and max capacity controls, ideal mode only
- Require HVAC duty cycle control for thermostatic mode only
- Added water heater max power control
- Added EV max power and max SOC controls
- Added `equipment_event_file` input for EVs
- Added OCHREException class to handle errors
- Added warnings for HVAC and WH heat pumps with low COP
- Moved default input file path for package installation
- Replaced setup.py with pyproject.toml
- Fixed bug with schedule file import using Pandas v2.2
- Fixed bug with accounting for HVAC delivered heat for standalone HVAC runs
- Fixed bug with ASHP backup heater units
- Fixed bug with named HVAC/Water Heating equipment arguments
- Fixed bug in ASHP duty cycle control
- Fixed bug with accounting for HVAC delivered heat for standalone HVAC runs
- Fixed bug with ASHP backup heater units
- Fixed bug with battery/generator self-consumption controls
- Fixed bug with WH and battery islanding time metrics
- Fixed bug with state space model reduction algorithm
- Fixed syntax warning for Python 3.12

### OCHRE v0.8.4-beta

- Fixed bug with air infiltration inputs (works with ResStock 3.0 and 3.1, and OS-HPXML 1.6.0)
Expand Down
2 changes: 0 additions & 2 deletions defaults/PV/sam_weather_header.csv

This file was deleted.

Loading