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

add charge and discharge efficiencies as sensors #933

Merged
merged 26 commits into from Dec 21, 2023

Conversation

victorgarcia98
Copy link
Contributor

@victorgarcia98 victorgarcia98 commented Dec 18, 2023

Description

This PR introduces two new fields to the flex-model:

  • charge-efficiency
  • discharge-efficiency

These fields allow to define changing down/up efficiencies using a Sensor.


  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

victorgarcia98 and others added 19 commits November 10, 2023 09:50
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
* refactor: fix spelling

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

* style: missing type annotation

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

* refactor: method and variable renaming

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

* refactor: add test case explanations

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

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
* refactor: fix spelling

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

* style: missing type annotation

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

* refactor: method and variable renaming

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

* refactor: add test case explanations

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

* fix: separate logic for falling back on a default attribute and applying a maximum capacity limit

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

* fix: fill gaps in capacity sensor data using the max_value rather than with the fallback

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

* fix: type annotation (see https://docs.python.org/3/library/typing.html#typing.Optional)

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

* refactor: clearly separate steps of falling back and performing a nanmin

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

* refactor: simplify and have get_quantity_from_attribute return a Quantity, as its name already suggested

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

* refactor: switch argument order

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

* refactor: update docstring

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

* style: flake8

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

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
…ery-power-capacity-as-sensor

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Base automatically changed from feature/planning/battery-power-capacity-as-sensor to main December 19, 2023 08:55
@Flix6x
Copy link
Contributor

Flix6x commented Dec 19, 2023

@victorgarcia98 this PR became too hard to review (due to mixed contents) after the base automatically changed from feature/planning/battery-power-capacity-as-sensor to main. Can you clean it up?

Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

I managed to review a few lines of code that probably actually belong in this PR. :)

flexmeasures/data/models/planning/storage.py Outdated Show resolved Hide resolved
flexmeasures/data/models/planning/tests/test_solver.py Outdated Show resolved Hide resolved
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
This was linked to issues Dec 19, 2023
…e roundtrip

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

Looks good. Let's add the changelog entry and the minimum required documentation (I believe in api/notation.rst and the trigger endpoint), and ship it.

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.

Found two smaller errors.

flexmeasures/data/schemas/scheduling/storage.py Outdated Show resolved Hide resolved
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Copy link
Contributor

@Flix6x Flix6x left a comment

Choose a reason for hiding this comment

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

Thanks for making the effort to get this in!

@Flix6x Flix6x added this to the 0.18.0 milestone Dec 21, 2023
@Flix6x Flix6x merged commit f5a14c8 into main Dec 21, 2023
8 of 9 checks passed
@Flix6x Flix6x deleted the feature/planning/use-efficiency-from-sensor branch December 21, 2023 10:56
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.

use roundtrip-efficiency from Sensor Support for buffer assets
3 participants