Skip to content

Commit

Permalink
Fix to reading of incrementing load (#1205)
Browse files Browse the repository at this point in the history
* Fix to reading of incrementing load

#1204

* [pre-commit.ci lite] apply automatic fixes

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
springfall2008 and pre-commit-ci-lite[bot] authored Jun 11, 2024
1 parent be825bc commit fd1cd9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions apps/predbat/predbat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,12 +1226,12 @@ def minute_data(
else:
if smoothing:
# Reset to zero, sometimes not exactly zero
if clean_increment and state < last_state and (state <= (last_state / 10.0)):
if clean_increment and (state < last_state) and ((last_state - state) >= 1.0):
while minute < minutes_to:
mdata[minute] = state
minute += 1
else:
# Can't really go backwards as incrementing data
# Incrementing data can't go backwards
if clean_increment and state < last_state:
state = last_state

Expand Down Expand Up @@ -1408,7 +1408,10 @@ def clean_incrementing_reverse(self, data, max_increment=0):
pass
else:
increment += nxt - last
last = nxt
last = nxt
elif nxt < last:
if nxt <= 0 or ((last - nxt) >= (1.0)):
last = nxt
new_data[rindex] = increment

return new_data
Expand Down

0 comments on commit fd1cd9f

Please sign in to comment.