Skip to content

feature: add usage forecast#906

Merged
victorgarcia98 merged 34 commits intomainfrom
feature/planning/usage-forecast
Dec 19, 2023
Merged

feature: add usage forecast#906
victorgarcia98 merged 34 commits intomainfrom
feature/planning/usage-forecast

Conversation

@victorgarcia98
Copy link
Copy Markdown
Contributor

@victorgarcia98 victorgarcia98 commented Nov 22, 2023

Description

The usage forecast is passed as a new column of the device constraints and later incorporated as a Pyomo parameter. This parameter is used in the device_bounds constraint as an extra component. Multiple components can be defined in the flex-model using the QuantityOrSensor syntax:

  1. Sensor
{
    "usage-forecast" : [
        {"sensor" : 1},
        {"sensor" : 2}
    ]
}
  1. Constant value
{
    "usage-forecast" : [
        "10 kWh",
        "40 kWh",
    ]
}

Further Improvements

  • Revise/Test definition of capacity_in_mw. For example, using a capacity of 2MW, allowed me to charge 2MWh every 15min block while it should be 500kWh.

TODOs

  • Add field to API docstring
  • Add field to documentation
  • Use field consumption_is_positive. By default, the usage forecast sign interpretation is (+) increase stock level (-) decrease stock level.

Related Items


  • 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

Victor Garcia Reolid added 14 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>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Comment thread flexmeasures/data/models/planning/linear_optimization.py Outdated
Comment thread flexmeasures/data/models/planning/linear_optimization.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/conftest.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
Flix6x and others added 3 commits November 24, 2023 09:54
* 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>
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>

* 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>
Copy link
Copy Markdown
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.

Please remind me: do we still have an unresolved issue in terms of having a test pass that we expected to fail (because of an unsustainable usage forecast)?

Comment thread flexmeasures/data/models/planning/linear_optimization.py Outdated
Comment thread flexmeasures/data/models/planning/linear_optimization.py Outdated
Comment thread flexmeasures/data/models/planning/storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/test_solver.py Outdated
@Flix6x
Copy link
Copy Markdown
Contributor

Flix6x commented Dec 4, 2023

Will you tackle the todos in this PR or as a follow-up?

@victorgarcia98
Copy link
Copy Markdown
Contributor Author

Please remind me: do we still have an unresolved issue in terms of having a test pass that we expected to fail (because of an unsustainable usage forecast)?

Yes, other than adding a resampling factor for the sensor, the current test should fail as we are providing the value power_capacity as the energy value to each 15min interval..

Victor Garcia Reolid added 3 commits December 12, 2023 11:07
…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>
Victor Garcia Reolid added 4 commits December 12, 2023 12:43
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>
Comment thread flexmeasures/data/models/planning/linear_optimization.py Outdated
Comment thread flexmeasures/data/schemas/scheduling/storage.py Outdated
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Victor Garcia Reolid added 2 commits December 13, 2023 15:09
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Copy link
Copy Markdown
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.

Awesome. Now it clicks. I only request documentation edits, including the changelog entry of course.

Comment thread flexmeasures/data/models/planning/storage.py Outdated
Comment thread flexmeasures/data/models/planning/tests/conftest.py
Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
Copy link
Copy Markdown
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.

Still missing the changelog entry.

Comment thread flexmeasures/data/models/planning/tests/conftest.py Outdated
@Flix6x Flix6x added this to the 0.18.0 milestone Dec 18, 2023
Victor Garcia Reolid added 2 commits December 18, 2023 16:41
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
Victor and others added 2 commits December 19, 2023 09:57
Signed-off-by: Victor <victor@seita.nl>
Fix typo (*los componentes*) and swap out some changelog entries between Features and Infrastructure.

Signed-off-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com>
@Flix6x
Copy link
Copy Markdown
Contributor

Flix6x commented Dec 19, 2023

Black is failing after your last merge. Feel free to merge after resolving.

Signed-off-by: Victor Garcia Reolid <victor@seita.nl>
@victorgarcia98 victorgarcia98 merged commit 5576b56 into main Dec 19, 2023
@victorgarcia98 victorgarcia98 deleted the feature/planning/usage-forecast branch December 19, 2023 10:23
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.

2 participants