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

Fix/scheduling/sign #1348

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions flexmeasures/api/v3_0/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,10 +707,10 @@ def get_schedule( # noqa: C901
)

sign = 1
if sensor.get_attribute("consumption_is_positive", True):
if not sensor.get_attribute("consumption_is_positive", False):
sign = -1

# For consumption schedules, positive values denote consumption. For the db, consumption is negative
# For consumption schedules, positive values denote consumption. For the db, consumption is negative unless specified explicitly
consumption_schedule = sign * simplify_index(power_values)["event_value"]
if consumption_schedule.empty:
return unknown_schedule(
Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/data/services/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def make_schedule(

sign = 1

if result["sensor"].measures_power and result["sensor"].get_attribute(
"consumption_is_positive", True
if result["sensor"].measures_power and not result["sensor"].get_attribute(
"consumption_is_positive", False
):
sign = -1

Expand Down
Loading