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

Event-based load features #166

Merged
merged 36 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d6cf2d3
adding ScheduledLoad example
mnblonsky Dec 12, 2024
c2e347b
Merge branch '153-update-examples' into 162-event-data
mnblonsky Dec 12, 2024
5b83d60
updated scheduled load example
mnblonsky Dec 12, 2024
bffa309
moving some fields from ScheduledLoad to Equipment
mnblonsky Dec 13, 2024
d8ef4cf
adding event based equipment from schedule
mnblonsky Dec 16, 2024
a8d2afb
adding event based load example
mnblonsky Dec 16, 2024
175e4ad
adding `event_schedule` input
mnblonsky Dec 17, 2024
863c3e3
added EventDataLoad class for equipment with event-based time series …
mnblonsky Dec 18, 2024
b19769e
adding clothes dryer event schedule data
mnblonsky Dec 19, 2024
4f24ba7
revert default timing args for examples
mnblonsky Dec 19, 2024
f0a5c7a
add option to choose equipment class when running a Dwelling
mnblonsky Dec 19, 2024
bf5e4d4
bug fix if no events exist in simulation
mnblonsky Dec 19, 2024
d222592
file clean up
mnblonsky Dec 19, 2024
2f1c49e
bug fix for saving json files
mnblonsky Dec 19, 2024
d5f4f56
bug fix for eventDataLoad with no events
mnblonsky Dec 19, 2024
30aaede
bug fix if simulation ends during event
mnblonsky Dec 19, 2024
7f01243
Merge branch '153-update-examples' into 162-event-data
mnblonsky Jan 21, 2025
1736de9
event based load bug fixes
mnblonsky Jan 21, 2025
672975c
bug fix when specifying ev event schedule
mnblonsky Jan 21, 2025
423852c
ev bug fix
mnblonsky Jan 23, 2025
6de3bea
removed "power" from event data in EventDataLoad
mnblonsky Jan 23, 2025
7ff21ce
fixed EV external p setpoint controls
mnblonsky Jan 23, 2025
dde89f3
fixed EventDataLoad power setpoint during outage
mnblonsky Jan 23, 2025
95a8d44
fixed bug for setting eventbasedload setpoint
mnblonsky Jan 24, 2025
241ba70
fixed bug for eventDataLoad event type with longest duration
mnblonsky Jan 24, 2025
c7ae801
added cooking range event schedules
mnblonsky Jan 27, 2025
f059b15
updated event based examples
mnblonsky Jan 27, 2025
cc78950
revised EventDataLoad to extend duration and adjust power level
mnblonsky Jan 27, 2025
6ed4db4
remove print statement
mnblonsky Jan 27, 2025
328d049
add equipment_class to docs
mnblonsky Jan 27, 2025
32c8462
revising EV controls
mnblonsky Jan 28, 2025
99a130d
updated docs for EV and EventBased inputs/controls
mnblonsky Jan 28, 2025
356a367
updated changelog
mnblonsky Jan 28, 2025
2deda20
bug fix for dwelling outage
mnblonsky Feb 3, 2025
a5f35a9
fixing event start when outage occurs
mnblonsky Feb 3, 2025
7ec35bc
Merge branch 'dev' into 162-event-data
jmaguire1 Feb 5, 2025
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
3 changes: 3 additions & 0 deletions bin/run_dwelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@
# "soc_init": 0.5,
# "self_consumption_mode": True,
# },
# "Clothes Dryer": {
# "equipment_class": EventDataLoad,
# },
},
}

Expand Down
83 changes: 81 additions & 2 deletions bin/run_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
Battery,
ElectricResistanceWaterHeater,
AirConditioner,
ScheduledLoad,
EventBasedLoad,
EventDataLoad,
)
from ochre import CreateFigures
from ochre.Models.Envelope import Envelope
Expand Down Expand Up @@ -321,16 +324,92 @@ def run_hvac():
CreateFigures.plt.show()


def run_scheduled_load(name):
# create schedule
times = pd.date_range(
default_args["start_time"],
default_args["start_time"] + default_args["duration"],
freq=default_args["time_res"],
inclusive="left",
)
peak_load = 5 # kW
power = np.random.choice([0, peak_load], p=[0.98, 0.02], size=len(times))
schedule = pd.DataFrame({f"{name} (kW)": power}, index=times)

equipment_args = {
"name": name,
"schedule": schedule,
**default_args,
}

# Initialize equipment
device = ScheduledLoad(**equipment_args)

# Simulate equipment
df = device.simulate()

print(df.head())
df.plot()
CreateFigures.plt.show()


def run_event_based_load(name):
# create event schedule
s = default_args["start_time"]
d = dt.timedelta(days=1)
h = dt.timedelta(hours=1)
assert default_args["duration"] >= d * 3
event_schedule = pd.DataFrame(
{
"start_time": [s + h * 10, s + d + h * 14, s + d * 2 + h * 17],
"end_time": [s + h * 11, s + d + h * 15, s + d * 2 + h * 17.5],
# "power": [1, 2, 1], # average power per event, in kW, for EventBasedLoad
"energy": [1, 2, 0.3], # energy per event, in kWh, for EventDataLoad
}
)

equipment_args = default_args.copy()
equipment_args.update(
{
"name": name,
"time_res": dt.timedelta(minutes=1),
"duration": dt.timedelta(days=3),
"event_schedule": event_schedule,
# "equipment_class": EventDataLoad, # used when running within Dwelling
}
)

# Initialize equipment
# device = EventBasedLoad(**equipment_args)
# Note: event data only available for select equipment
# - Clothes Dryer, Cooking Range
device = EventDataLoad(**equipment_args)

# Simulate equipment
df = device.simulate()

print(df.head())
df.plot()
CreateFigures.plt.show()


if __name__ == "__main__":
# Extract equipment from a Dwelling model
# run_equipment_from_house_model("Water Heating")
# run_equipment_from_house_model("PV") # Must add PV in run_dwelling.py

# Run equipment without a Dwelling model
# run_ev()
run_ev()
# run_pv_with_sam()
# run_battery_from_schedule()
# run_battery_self_consumption()
# run_water_heater()
run_water_heater_from_file()
# run_water_heater_from_file()
# run_hvac()
# run_scheduled_load("Clothes Dryer")
# run_scheduled_load("Cooking Range")
# run_scheduled_load("Clothes Washer")
# run_event_based_load("Clothes Dryer")
# run_event_based_load("Cooking Range")
# run_event_based_load("Clothes Washer")
# run_equipment_from_house_model()
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,32 @@
- Renamed `schedule_input_file` input to `hpxml_schedule_file`
- Renamed `equipment_schedule_file` to `schedule_file` and enabled it for all
Simulator subclasses
- Created EventDataLoad class and added event schedules for Clothes Dryer and
Cooking Range [#162](https://github.com/NREL/OCHRE/issues/162)
- Added `equipment_class` input [#162](https://github.com/NREL/OCHRE/issues/162)
- Added HVAC parameters for deadband offset and ASHP backup controls
[#155](https://github.com/NREL/OCHRE/issues/155)
- Added multi-speed HVAC parameters for ResStock 2024 dataset
[#128](https://github.com/NREL/OCHRE/issues/128)
- Updated with OS-HPXML v1.7 naming conventions (e.g., spa equipment, indoor
zone) #76
- Updated EV model to accept new EV charging data
- Modified EV setpoint controls and removed `enable_part_load`
- Added EV `event_day_ratio` and `max_power` parameters and renamed `mileage`
to `range`
- Added EV average SOC and unmet load metrics
- Added EV equivalent battery model specifications
- Added new EV event-based charging data
- Updated PV model to use latitude/south for tilt/azimuth if no roof model
exists
- Updated power setpoint controls for EventBasedLoad
- Set default class to EventBasedLoad for Clothes Washer, Clothes Dryer,
Dishwasher, and Cooking Range
[#162](https://github.com/NREL/OCHRE/issues/162)
- Enabled .epw files with leap year data (we remove Feb 29, similar to
Cambium)
- Added Analysis function for downloading ResStock 2024 data
- Fixed issue with saving classes and DataFrames to json
- Fixed EV unmet load units [#144](https://github.com/NREL/OCHRE/issues/144)
- Fixed bug when no EV events in simulation
- Fixed bug when reading water heater deadband from schedule
Expand Down
53 changes: 29 additions & 24 deletions docs/source/ControllerIntegration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ Water Heating
Electric Vehicle (EV)
~~~~~~~~~~~~~~~~~~~~~

+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| Control Command | Units | Resets? | Description |
+=================+==========+=====================+=======================================================================================+
| Delay | N/A | True | Delays EV charge for a given time [#]_ |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| P Setpoint | kW | True | Sets the AC power setpoint |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| SOC | unitless | True | Sets the AC power to achieve desired SOC setpoint |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| SOC Rate | 1/hour | True | Sets the AC power setpoint based on SOC rate, EV capacity, and efficiency of charging |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| Max Power | kW | Only if in schedule | Maximum power limit |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
| Max SOC | unitless | Only if in schedule | Maximum SOC limit |
+-----------------+----------+---------------------+---------------------------------------------------------------------------------------+
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| Control Command | Units | Resets? | Description |
+=================+==========+===========================================+=======================================================================================+
| Load Fraction | unitless | N/A | 1 (no effect) or 0 (forces equipment off) |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| Delay | N/A | True | Delays EV charge for a given time [#]_ |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| P Setpoint | kW | Only if ``EV Max Power (kW)`` in schedule | Sets the AC power setpoint |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| SOC Rate | 1/hour | Only if ``EV Max Power (kW)`` in schedule | Sets the AC power setpoint based on SOC rate, EV capacity, and efficiency of charging |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| Max Power | kW | Only if ``EV Max Power (kW)`` in schedule | Equivalent to "P Setpoint" |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+
| Max SOC | unitless | Only if ``EV Max SOC (-)`` in schedule | Maximum SOC limit |
+-----------------+----------+-------------------------------------------+---------------------------------------------------------------------------------------+

.. [#] Value can be a ``datetime.timedelta`` or an integer to specify the
number of time steps to delay
Expand Down Expand Up @@ -182,15 +182,20 @@ Gas Generator
Lighting and Other Loads
~~~~~~~~~~~~~~~~~~~~~~~~

+-----------------+-------------+---------+------------------------------------------------------------------------------------------+
| Control Command | Units | Resets? | Description |
+=================+=============+=========+==========================================================================================+
| Load Fraction | unitless | True | Multiplier to adjusts the scheduled power consumption. Applied to electric and gas power |
+-----------------+-------------+---------+------------------------------------------------------------------------------------------+
| P Setpoint | kW | True | Sets electric power setpoint |
+-----------------+-------------+---------+------------------------------------------------------------------------------------------+
| Gas Setpoint | therms/hour | True | Sets gas power setpoint |
+-----------------+-------------+---------+------------------------------------------------------------------------------------------+
+-----------------+-------------+--------------------------------------------------+------------------------------------------------------------------------------------------+
| Control Command | Units | Resets? | Description |
+=================+=============+==================================================+==========================================================================================+
| Load Fraction | unitless | True | Multiplier to adjusts the scheduled power consumption. Applied to electric and gas power |
+-----------------+-------------+--------------------------------------------------+------------------------------------------------------------------------------------------+
| P Setpoint | kW | Only for ``ScheduledLoad`` and ``EventDataLoad`` | Sets electric power setpoint |
+-----------------+-------------+--------------------------------------------------+------------------------------------------------------------------------------------------+
| Gas Setpoint | therms/hour | Only for ``ScheduledLoad`` and ``EventDataLoad`` | Sets gas power setpoint |
+-----------------+-------------+--------------------------------------------------+------------------------------------------------------------------------------------------+
| Delay | N/A | N/A | Delays next event for a given time. Only for ``EventBasedLoad`` [#]_ |
+-----------------+-------------+--------------------------------------------------+------------------------------------------------------------------------------------------+

.. [#] Value can be a ``datetime.timedelta`` or an integer to specify the
number of time steps to delay


External Model Signals
Expand Down
Loading