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

Issue 450 api option to customize which price and power sensors to take into account for scheduling #451

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Jun 24, 2022

This PR introduces three optional fields to the sensors/(id)/schedules/trigger endpoint to allow further customization of optimization context:

  • consumption-price-sensor: prices upward deviations from previous zero-consumption commitments
  • feed-in-price-sensor production-price-sensor: prices downward deviations from previous zero-consumption commitments
  • inflexible-device-sensors: their power forecasts are included in the aggregate load

I included an automated test for the battery solver within the optimization context of a building in which solar PV is present, which limits the battery's headroom to discharge.

Another automated test I envision is still missing, for a setting in which the feed-in price is significantly lower than the consumption price, which motivates maximizing self-consumption.

Closes #450 (which contains our initial discussion).

Next steps are:

…sumption and feed-in

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@coveralls
Copy link
Collaborator

coveralls commented Jun 24, 2022

Pull Request Test Coverage Report for Build 2920131604

  • 51 of 58 (87.93%) changed or added relevant lines in 9 files are covered.
  • 214 unchanged lines in 14 files lost coverage.
  • Overall coverage increased (+0.2%) to 67.717%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flexmeasures/data/models/planning/utils.py 10 11 90.91%
flexmeasures/cli/data_add.py 3 6 50.0%
flexmeasures/data/models/planning/charging_station.py 11 14 78.57%
Files with Coverage Reduction New Missed Lines %
flexmeasures/data/models/planning/utils.py 1 83.33%
flexmeasures/api/v3_0/assets.py 3 95.4%
flexmeasures/data/models/data_sources.py 3 52.56%
flexmeasures/ui/views/new_dashboard.py 3 90.0%
flexmeasures/ui/init.py 4 94.12%
flexmeasures/data/services/asset_grouping.py 11 77.0%
flexmeasures/data/queries/utils.py 16 62.5%
flexmeasures/utils/time_utils.py 16 76.55%
flexmeasures/api/dev/sensors.py 17 61.33%
flexmeasures/api/v1_2/implementations.py 19 75.16%
Totals Coverage Status
Change from base Build 2679559260: 0.2%
Covered Lines: 7247
Relevant Lines: 10133

💛 - Coveralls

Flix6x added 14 commits June 28, 2022 13:35
…include in the aggregate power flow

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
… headroom with respect to the PV system's nominal capacity

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…flexible devices

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x marked this pull request as ready for review July 19, 2022 21:43
…e_and_power_sensors_to_take_into_account_for_scheduling
…e_and_power_sensors_to_take_into_account_for_scheduling

# Conflicts:
#	flexmeasures/cli/data_add.py
#	flexmeasures/data/services/scheduling.py
@Flix6x Flix6x requested a review from nhoening July 19, 2022 21:53
flexmeasures/api/v3_0/sensors.py Outdated Show resolved Hide resolved
flexmeasures/api/v3_0/sensors.py Outdated Show resolved Hide resolved
flexmeasures/cli/data_add.py Outdated Show resolved Hide resolved
flexmeasures/data/models/planning/charging_station.py Outdated Show resolved Hide resolved
flexmeasures/data/models/planning/solver.py Show resolved Hide resolved
flexmeasures/data/models/planning/utils.py Show resolved Hide resolved
flexmeasures/data/models/planning/utils.py Outdated Show resolved Hide resolved
…uling

Signed-off-by: F.N. Claessen <felix@seita.nl>
…heduling

Signed-off-by: F.N. Claessen <felix@seita.nl>
…fined in the conftest) are measurements rather than forecasts

Signed-off-by: F.N. Claessen <felix@seita.nl>
…casts to be present

Signed-off-by: F.N. Claessen <felix@seita.nl>
…one instead of UTC

Signed-off-by: F.N. Claessen <felix@seita.nl>
…one instead of UTC

Signed-off-by: F.N. Claessen <felix@seita.nl>
…in the Europe/Amsterdam timezone instead of UTC

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
…consumption of the devices, instead of being applied to the consumption of the single flexible device under consideration. Likewise for production.

Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x requested a review from nhoening August 8, 2022 18:28
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.
I don't think I have big requests, should be possible to bring into 0.11. Well, you decide.

flexmeasures/api/v3_0/sensors.py Outdated Show resolved Hide resolved
flexmeasures/data/models/planning/battery.py Show resolved Hide resolved
flexmeasures/data/models/planning/utils.py Outdated Show resolved Hide resolved
flexmeasures/api/v3_0/sensors.py Outdated Show resolved Hide resolved
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x added this to the 0.11.0 milestone Aug 24, 2022
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x
Copy link
Contributor Author

Flix6x commented Aug 24, 2022

I still have to open up some new issues corresponding to open discussions in this PR, but would you now approve this PR code-wise?

@Flix6x Flix6x merged commit 7ff1480 into main Aug 24, 2022
@Flix6x Flix6x deleted the Issue-450_API_option_to_customize_which_price_and_power_sensors_to_take_into_account_for_scheduling branch August 24, 2022 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API option to customize which price and power sensors to take into account for scheduling
3 participants