Skip to content

Commit

Permalink
Merge pull request #122 from fboundy/dev
Browse files Browse the repository at this point in the history
Round savings event times and check for value > 0
  • Loading branch information
fboundy authored Feb 14, 2024
2 parents cadf051 + 706fc02 commit 8dc2bc6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/pv_opt/pvpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ def to_df(self, start=None, end=None, **kwargs):
if (self.host is not None) and ("unit" in df.columns):
events = self.host.saving_events
for id in events:
event_start = pd.Timestamp(events[id]["start"])
event_end = pd.Timestamp(events[id]["end"])
event_start = pd.Timestamp(events[id]["start"]).floor("30min")
event_end = pd.Timestamp(events[id]["end"]).ceil("30min")
event_value = int(events[id]["octopoints_per_kwh"]) / 8

if event_start <= end or event_end > start:
if event_start <= end or event_end > start and event_value > 0:
event_start = max(event_start, start)
event_end = min(event_end - pd.Timedelta(30, "minutes"), end)
df["unit"].loc[event_start:event_end] += event_value
Expand Down

0 comments on commit 8dc2bc6

Please sign in to comment.