Skip to content

Commit

Permalink
mend
Browse files Browse the repository at this point in the history
  • Loading branch information
David00 committed Feb 16, 2023
1 parent 7ab42ca commit 3d7eaa1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpi_power_monitor/power_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ def run_main(self):
if results[chan_num]['power'] < 0:
results[chan_num]['current'] = results[chan_num]['current'] * -1

# Set the current for any production sources negative and find the total power and current from all production sources.
# Set the current for any production sources negative if the power is negative, and find the total power and current from all production sources.
for chan_num in self.production_channels:
if results[chan_num]['power'] < 0:
results[chan_num]['current'] = results[chan_num]['current'] * -1
Expand All @@ -776,7 +776,7 @@ def run_main(self):
home_consumption_current += results[chan_num]['current']
for chan_num in self.production_channels:
home_consumption_power += results[chan_num]['power']
home_consumption_current += results[chan_num]['current'] # Current from production sources is already "negative", so subtracting it here instead of adding it is correct.
home_consumption_current += results[chan_num]['current']


net_power = home_consumption_power - production_power
Expand Down

0 comments on commit 3d7eaa1

Please sign in to comment.