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

Update charging fallback policy #270

Merged
merged 1 commit into from Dec 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions flexmeasures/data/models/planning/utils.py
Expand Up @@ -140,18 +140,6 @@ def fallback_charging_policy(
charge_schedule = initialize_series(charge_power, start, end, resolution)
discharge_schedule = initialize_series(discharge_power, start, end, resolution)
idle_schedule = initialize_series(0, start, end, resolution)
if (
device_constraints["max"].first_valid_index() is not None
and device_constraints["max"][device_constraints["max"].first_valid_index()] < 0
):
# start discharging to try and bring back the soc below the next max constraint
return discharge_schedule
if (
device_constraints["min"].first_valid_index() is not None
and device_constraints["min"][device_constraints["min"].first_valid_index()] > 0
):
# start charging to try and bring back the soc above the next min constraint
return charge_schedule
if (
device_constraints["equals"].first_valid_index() is not None
and device_constraints["equals"][
Expand All @@ -170,5 +158,17 @@ def fallback_charging_policy(
):
# start discharging to get as close as possible to the next target
return discharge_schedule
if (
device_constraints["max"].first_valid_index() is not None
and device_constraints["max"][device_constraints["max"].first_valid_index()] < 0
):
# start discharging to try and bring back the soc below the next max constraint
return discharge_schedule
if (
device_constraints["min"].first_valid_index() is not None
and device_constraints["min"][device_constraints["min"].first_valid_index()] > 0
):
# start charging to try and bring back the soc above the next min constraint
return charge_schedule
# stand idle
return idle_schedule