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

Feature/planning/soft site power capacities #1118

Draft
wants to merge 142 commits into
base: feature/planning/relaxed-scheduler
Choose a base branch
from

Conversation

victorgarcia98
Copy link
Contributor

@victorgarcia98 victorgarcia98 commented Jul 4, 2024

Work in progress.

Distinguish interpretation of soc-max/min from soc-maxima/minima, and site-consumption/production-capacity from site-power-capacity, representing hard and soft constraints

Signed-off-by: Victor Garcia Reolid <[email protected]>
@victorgarcia98 victorgarcia98 requested a review from Flix6x July 4, 2024 11:46
@victorgarcia98 victorgarcia98 self-assigned this Jul 4, 2024
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'll think about naming.

@Flix6x Flix6x mentioned this pull request Jul 8, 2024
12 tasks
@Flix6x
Copy link
Contributor

Flix6x commented Jul 26, 2024

This PR only addresses site level power constraints at the moment and not any device level constraints. As it stands, I feel that soft constraints for site level power would be more cleanly modelled as site level commitments (to the DSO) based on the contracted capacities, with some (assumed, or even known) penalty. That should mostly happen outside of the device scheduler.

If we do address device-level soft constraints, we should think about them too in the context of introducing device-level commitments (two birds, one stone).

@victorgarcia98
Copy link
Contributor Author

I'm not sure we can model the mechanism that these PR introduces via commitments as they are defined at the moment.


Let's say we want to add two soft limits at 90 kW to a site of 100 kW.

We would add two commitments:

  • Commitment = 90 kW, $Price_{Up} = 100$, $Price_{Down} = 0$
  • Commitment = -90 kW, $Price_{Up} = 0$, $Price_{Down} = 100$

This would be equivalent to have a single commitment:

  • Commitment = 0 kW, $Price_{Up} = 100$, $Price_{Down} = 100$

This applies in general. For example, if we have two commitments, the EMS-commitment couples eq. is:

$$ \sum_{d\in Devices} Power(d, j) = Commitment(1) + Commitment(2) + Down(1, j) + Down(2, j) - Up(1, j) - Up(2, j) $$

which is, inf fact, equivalent of having an single equivalent commitment defined as:

$$ Commitment(3) = Commitment(1) + Commitment(2) $$

with the equivalent prices:

$$ Price_{Up}(3) = Price_{Up}(1) + Price_{Up}(2) $$

$$ Price_{Down}(3) = Price_{Down}(1) + Price_{Down}(2) $$


How is it modeled in this PR?

Parameters

  • ems_derivative_soft_{min,max}: upper/lower EMS soft limits
  • ems_flow_soft_relaxation_cost: cost of exceeding the soft limits.

Variables

  • ems_power_margin_{upper, lower}: how much the power is over/under the soft limit.

Constraints

  • ems_derivative_soft_margin_{upper, lower}: ensures that the variable ems_power_margin_{upper, lower} is not higher than the difference between the hard and soft limits.
  • ems_derivative_soft_lower_bound: makes the "margin" variables to track the difference between the soft limit and the EMS power.

Commitments model

The commitment appear in two equations:

    def ems_flow_commitment_equalities(m, j):
        """Couple EMS flows (sum over devices) to commitments."""
        return (
            0,
            sum(m.commitment_quantity[:, j])
            + sum(m.commitment_downwards_deviation[:, j])
            + sum(m.commitment_upwards_deviation[:, j])
            - sum(m.ems_power[:, j]),
            0,
        )

Which is equivalent to

$$ \sum_{d\in Devices} Power(d, j) = \sum_{c \in Commitments} [Commitment(c, j) + Down(c, j) - Up(c,j)] $$

and the objective functions:

        for j in m.j:
            for c in m.c:
                costs += m.commitment_downwards_deviation[c, j] * m.down_price[c, j]
                costs += m.commitment_upwards_deviation[c, j] * m.up_price[c, j]

@Flix6x
Copy link
Contributor

Flix6x commented Jul 27, 2024

We would add two commitments:

Commitment = 90 kW, $Price_{Up} = 100$, $Price_{Down} = 0$
Commitment = -90 kW, $Price_{Up} = 0$, $Price_{Down} = 100$

This would be equivalent to having a single commitment:

Commitment = 0 kW, $Price_{Up} = 100$, $Price_{Down} = 100$

This applies in general.

Counterexample: if the aggregate power flow is 50 kW, then in your first example the costs are 0, but in your second example the costs are 5$/h (assuming your prices are in $/MWh).

@victorgarcia98
Copy link
Contributor Author

We would add two commitments:
Commitment = 90 kW, PriceUp=100, PriceDown=0
Commitment = -90 kW, PriceUp=0, PriceDown=100
This would be equivalent to having a single commitment:
Commitment = 0 kW, PriceUp=100, PriceDown=100
This applies in general.

Counterexample: if the aggregate power flow is 50 kW, then in your first example the costs are 0, but in your second example the costs are 5$/h (assuming your prices are in $/MWh).

True, good point.

Case A)

  • Constraint: $50 = -90 + 90 + Down(1) + Down(2) + Up(1) + Up(2) = Down(1) + Down(2) + Up(1) + Up(2)$
  • Objective: $100 \cdot Up(1) + 0\cdot Up(2) + 0\cdot Down(1) + 100 \cdot Up(2) = 100 \cdot [Up(1) + Down(2)]$

Case B)

  • Constraint: $50 = 0 + Up(1) + Down(1) = Up(1) + Down(1) $
  • Objective: $100 \cdot [Up(1) + Down(1)]$

Wouldn't case A) be unbounded?

Let's assume $Down(2)$, which appears in the objective function, is any large value, e.g. 10 MW. This will make 100 EUR/MWh * 10 MW = 1000 EUR/h. We can compensate $Down(2)$ with $Up(2)$ which doesn't appear in the objective but appears on the constraint.

In general, we can set $Up(1)$ and $Down(2)$ to be any value which drive up/down the objective function and find values for $Up(2)$ and $Down(1)$ to fulfill the constraint.

victorgarcia98 and others added 18 commits July 29, 2024 14:17
* add types

* add changelog
* docs: add major caveat for ProcessScheduler

Signed-off-by: F.N. Claessen <[email protected]>

* fix: old class name

Signed-off-by: F.N. Claessen <[email protected]>

* style: linebreaks before headers

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add cross reference

Signed-off-by: F.N. Claessen <[email protected]>

* fix: space

Signed-off-by: F.N. Claessen <[email protected]>

* docs: clarify BREAKABLE process type

Signed-off-by: F.N. Claessen <[email protected]>

* docs: introduce section on flex models

Signed-off-by: F.N. Claessen <[email protected]>

* docs: extend explanation of inflexible-device-sensors

Signed-off-by: F.N. Claessen <[email protected]>

* fix: changelog entry for #1131

Signed-off-by: F.N. Claessen <[email protected]>

* fix: missing space

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Victor Garcia Reolid <[email protected]>
…nima and soc-maxima (introduced in #680) (#1135)

Signed-off-by: F.N. Claessen <[email protected]>
* support most_recent_only, including new index. Also stopping a previous, very old, deprecation of the same name.

Signed-off-by: Nicolas Höning <[email protected]>

* chore: upgrade timely-beliefs dep

Signed-off-by: F.N. Claessen <[email protected]>

* clearer documentation of (new) search parameters

Signed-off-by: Nicolas Höning <[email protected]>

* add changelog entry

Signed-off-by: Nicolas Höning <[email protected]>

* move 0.23 PRs to the new 0.23 section (were erronously in 0.22)

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: Nicolas Höning <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: F.N. Claessen <[email protected]>
* Basic sensor info to sensor page

Signed-off-by: Nikolai <[email protected]>

* Move styles to .css + make table vertical

Signed-off-by: Nikolai <[email protected]>

* remove unwanted css

* update bootstrap layout

* remove info from header

* change title and capitalize the headers

* add table in a column div

* add sensor name

* pass only sensor instead of sensor_id to show sensor page

---------

Signed-off-by: Nikolai <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Nikolai <[email protected]>
Co-authored-by: Ahmad Wahid <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
* fix: use official OS name

Signed-off-by: F.N. Claessen <[email protected]>

* style: use line block to add space between table of contents and note

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add port note for macOS users in another relevant place

Signed-off-by: F.N. Claessen <[email protected]>

* fix: link to URL

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add comment in main body about where the FlexMeasures UI would normally be accessible

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add port note for macOS users in the "On your PC" tab

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: reuse note in two places

Signed-off-by: F.N. Claessen <[email protected]>

* docs: reference the same port note for docker+macOS users in the section about hosting with docker

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move tip to first occurrence of the `docker` command

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: merge paragraphs

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
* style: remove non-breaking spaces from base template

Signed-off-by: F.N. Claessen <[email protected]>

* fix: update display property for Bootstrap >= 4

Signed-off-by: F.N. Claessen <[email protected]>

* docs: put back inline comment removed in #1058

Signed-off-by: F.N. Claessen <[email protected]>

* docs: expand on rationale in inline comment

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* fix: breakpoint for collapsing menu and moving tooltip to caption should coincide also for intermediate screen sizes

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
* feat: zoom-in

Signed-off-by: Victor Garcia Reolid <[email protected]>

* docs: add changelog entry

Signed-off-by: Victor Garcia Reolid <[email protected]>

---------

Signed-off-by: Victor Garcia Reolid <[email protected]>
…1129)

* fix: support saving instantaneous beliefs as a list of one element

Signed-off-by: Victor Garcia Reolid <[email protected]>

* assert -> NotImplementedError

Signed-off-by: Victor Garcia Reolid <[email protected]>

* fix typo

Signed-off-by: Victor Garcia Reolid <[email protected]>

* improve message and fix test

Signed-off-by: Victor Garcia Reolid <[email protected]>

* fix: typo

Signed-off-by: Victor Garcia Reolid <[email protected]>

* move check to a schema validator

Signed-off-by: Victor Garcia Reolid <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: API changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* style: consistent spacing

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: F.N. Claessen <[email protected]>
* feat: dynamic account colors

Added options to add a priamary and secondary color when creating an account

Also fixed typo comment

A line in the css wasnt commented properly

* chore: removed experimental code

* refactor: edgecase handling and more

- Handled edge case for fetching color setting when accoutn has no consultant
- wrote test for color computation utils
- type hints additons
- ignored some docker volume folders

* chore: clearing unwanted DB changes

* refactor: code improvements

- type hinting
- segregattion of fucntionalities

The color hex validation is now in a seperate fuciton in the coding_utils file

* chore: removed Alembic comments

* chore: linting code

* fix: removed unwanted classes

* fix: removed unwanted css clases

* chore: cleared duplicate default definations

* chore: relocate hex color validation fucntion

* chore: clean up

* fix: resolving migration issues

- issue is being caused because of the existence of TWO HEADS

Foxed by manually editing the down_revisions of the new migration file

* chore: linting

* chore: more linting :)

* chore: more linting :)

* chore: more linting :)

* chore: resolving test issues

* chore: few changes

- type hint resolution
- typo fixing
- misc

* docs: added changelog for new feature(dynamic colors)

* docs: just a missing space

Signed-off-by: Felix Claessen <[email protected]>

* docs: mention white-labeling in changelog entry

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: Felix Claessen <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Felix Claessen <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
* refactor: sync arg name

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: sync internal property name

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: flatten elif block

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: allow string deserialization and allow setting a default source unit for interpreting values without a unit

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: copy convert method

Signed-off-by: F.N. Claessen <[email protected]>

* fix: type annotation

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: copy _serialize method

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: adapt _serialize method

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: adapt docstring

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: update error message

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: update type annotation

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: merge schemas

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: reduce number of blank lines

Signed-off-by: F.N. Claessen <[email protected]>

* fix: deprecate old classes

Signed-off-by: F.N. Claessen <[email protected]>

* fix: duplicate import

Signed-off-by: F.N. Claessen <[email protected]>

* docs: document status quo

Signed-off-by: F.N. Claessen <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

* style: flake8

Signed-off-by: F.N. Claessen <[email protected]>

* feature: allow interpreting float values as quantities based on a unit defined elsewhere, and specifically, let the StorageScheduler get its default SoC unit from the soc-unit field, which lets us allow time series values to be specified as string quantities while preserving backwards compatibility

Signed-off-by: F.N. Claessen <[email protected]>

* fix: maintain backwards compatibility for transforming Float fields into Quantity fields, by returning the magnitude upon deserialization

Signed-off-by: F.N. Claessen <[email protected]>

* docs: grammar

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add todo

Signed-off-by: F.N. Claessen <[email protected]>

* fix: tests

Signed-off-by: F.N. Claessen <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update V2G flex-model

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update trigger endpoint examples

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update other tutorials

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update scheduling feature section

Signed-off-by: F.N. Claessen <[email protected]>

* feat: convert schedule results ffrom MW to sensor unit

Signed-off-by: Victor Garcia Reolid <[email protected]>

* feat: minimum list length for soc-gain and soc-usage

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: apply default SoC unit to all fields starting with "soc_"

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move warning

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "refactor: move warning"

This reverts commit 8cfe9fd.

* fix: update test

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move deserialization logic to dedicated class methods

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix comment about converting time series using to_unit

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: rename new schema

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: sync code order: 1) Sensor, 2) time series, 3) Quantity

Signed-off-by: F.N. Claessen <[email protected]>

* fix: add test and add missing logic for handling a list of dictionaries representing a time series

Signed-off-by: F.N. Claessen <[email protected]>

* fix: check for real numeric values

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entries

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix typo

Signed-off-by: F.N. Claessen <[email protected]>

* style: be more explicit about requiring the soc-unit field to be set

Signed-off-by: F.N. Claessen <[email protected]>

* docs: mention the new Marshmallow field

Signed-off-by: F.N. Claessen <[email protected]>

* docs: advise setting a unit per field explicitly

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: simplify if statement

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move soc-unit guesswork into schema

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: Felix Claessen <[email protected]>
Co-authored-by: Victor Garcia Reolid <[email protected]>
* refactor: sync arg name

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: sync internal property name

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: flatten elif block

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: allow string deserialization and allow setting a default source unit for interpreting values without a unit

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: copy convert method

Signed-off-by: F.N. Claessen <[email protected]>

* fix: type annotation

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: copy _serialize method

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: adapt _serialize method

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: adapt docstring

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: update error message

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: update type annotation

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: merge schemas

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: reduce number of blank lines

Signed-off-by: F.N. Claessen <[email protected]>

* fix: deprecate old classes

Signed-off-by: F.N. Claessen <[email protected]>

* fix: duplicate import

Signed-off-by: F.N. Claessen <[email protected]>

* docs: document status quo

Signed-off-by: F.N. Claessen <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

* style: flake8

Signed-off-by: F.N. Claessen <[email protected]>

* feature: allow interpreting float values as quantities based on a unit defined elsewhere, and specifically, let the StorageScheduler get its default SoC unit from the soc-unit field, which lets us allow time series values to be specified as string quantities while preserving backwards compatibility

Signed-off-by: F.N. Claessen <[email protected]>

* fix: maintain backwards compatibility for transforming Float fields into Quantity fields, by returning the magnitude upon deserialization

Signed-off-by: F.N. Claessen <[email protected]>

* docs: grammar

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add todo

Signed-off-by: F.N. Claessen <[email protected]>

* fix: tests

Signed-off-by: F.N. Claessen <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update V2G flex-model

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update trigger endpoint examples

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update other tutorials

Signed-off-by: F.N. Claessen <[email protected]>

* docs: update scheduling feature section

Signed-off-by: F.N. Claessen <[email protected]>

* feat: convert schedule results ffrom MW to sensor unit

Signed-off-by: Victor Garcia Reolid <[email protected]>

* feat: minimum list length for soc-gain and soc-usage

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: apply default SoC unit to all fields starting with "soc_"

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move warning

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "refactor: move warning"

This reverts commit 8cfe9fd.

* fix: update test

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move deserialization logic to dedicated class methods

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix comment about converting time series using to_unit

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: rename new schema

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: sync code order: 1) Sensor, 2) time series, 3) Quantity

Signed-off-by: F.N. Claessen <[email protected]>

* fix: add test and add missing logic for handling a list of dictionaries representing a time series

Signed-off-by: F.N. Claessen <[email protected]>

* fix: check for real numeric values

Signed-off-by: F.N. Claessen <[email protected]>

* fix: remove section on singular vs plural keys, which is no longer valid for crucial endpoints

Signed-off-by: F.N. Claessen <[email protected]>

* feature: add section on variable quantities

Signed-off-by: F.N. Claessen <[email protected]>

* fix: update section on scheduling; specifically, most flex-context and flex-model fields are now variable quantity fields, so I've updated the footnote to explain the few fields that aren't (yet) a variable quantity field.

Signed-off-by: F.N. Claessen <[email protected]>

* fix: footnote order

Signed-off-by: F.N. Claessen <[email protected]>

* fix: lolcats grammar

Signed-off-by: F.N. Claessen <[email protected]>

* feature: explain the possibilities of the `TimedEventSchema`

Signed-off-by: F.N. Claessen <[email protected]>

* style: string asset types

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entries

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix typo

Signed-off-by: F.N. Claessen <[email protected]>

* style: be more explicit about requiring the soc-unit field to be set

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add note about units living on the sensor

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add cross-reference

Signed-off-by: F.N. Claessen <[email protected]>

* docs: API changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: main changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: mention the new Marshmallow field

Signed-off-by: F.N. Claessen <[email protected]>

* docs: advise setting a unit per field explicitly

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: simplify if statement

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move soc-unit guesswork into schema

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: set reference caption explicitly

Signed-off-by: F.N. Claessen <[email protected]>

* chore: resolve hidden merge conflict in API documentation versioning

Signed-off-by: F.N. Claessen <[email protected]>

* fix: revision file comment

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: Felix Claessen <[email protected]>
Co-authored-by: Victor Garcia Reolid <[email protected]>
* feature: flex context prices as quantities

Signed-off-by: F.N. Claessen <[email protected]>

* style: black

Signed-off-by: F.N. Claessen <[email protected]>

* fix: get continuous time series of prices from quantity

Signed-off-by: F.N. Claessen <[email protected]>

* fix: another merge conflict and an outdated comment

Signed-off-by: F.N. Claessen <[email protected]>

* fix: catch programming error

Signed-off-by: F.N. Claessen <[email protected]>

* fix: self.to_unit is already a Quantity

Signed-off-by: F.N. Claessen <[email protected]>

* fix: add test case for converting sensor units to some denominator

Signed-off-by: F.N. Claessen <[email protected]>

* fix: add test cases for invalid input quantities

Signed-off-by: F.N. Claessen <[email protected]>

* fix: add test case for converting from %, and use to_preferred, which imo still shows better results than pint's .to_preferred (for our use cases), and is faster, because of not requiring a MILP to be solved

Signed-off-by: F.N. Claessen <[email protected]>

* fix: fix test for Python 3.8 with pint throwing a different exception at us

Signed-off-by: F.N. Claessen <[email protected]>

* docs: main changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* docs: API changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: simplify test parameterization

Signed-off-by: F.N. Claessen <[email protected]>

* feature: support variable price quantity as time series specification, incl. test

Signed-off-by: F.N. Claessen <[email protected]>

* fix: update argument defaults for backwards compatibility of old fields

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: one less import statement

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move conversion to util

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: get rid of self.any_unit

Signed-off-by: F.N. Claessen <[email protected]>

* docs: document new fields replacing the old fields

Signed-off-by: F.N. Claessen <[email protected]>

* fix: update argument name

Signed-off-by: F.N. Claessen <[email protected]>

* fix: get rid of deprecated argument warning

Signed-off-by: F.N. Claessen <[email protected]>

* fix: test

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
* add annotation types on upgrade

* update changelog

Signed-off-by: Ahmad Wahid <[email protected]>

* remove new types from model and add a check in upgrade command

Signed-off-by: Ahmad Wahid <[email protected]>

* add removed types

Signed-off-by: Ahmad Wahid <[email protected]>

---------

Signed-off-by: Ahmad Wahid <[email protected]>
Co-authored-by: Felix Claessen <[email protected]>
nhoening and others added 30 commits January 17, 2025 10:49
Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit c31a08a)
Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit 602a007)
* remove deprectaed CLI command

Signed-off-by: Nicolas Höning <[email protected]>

* Add missing documentation of two CLI monitoring commands

Signed-off-by: Nicolas Höning <[email protected]>

* introcuce new default behavior to not alert about users who should have been in earlier alerts

Signed-off-by: Nicolas Höning <[email protected]>

* add extra information if users are not included in the alert

Signed-off-by: Nicolas Höning <[email protected]>

* improve email layout

Signed-off-by: Nicolas Höning <[email protected]>

* improve docstring and variable naming

Signed-off-by: Nicolas Höning <[email protected]>

* add ability to use custom task name (to run multiple filters), better name for option, add to docstring / CLI Readme how to use this new feature

Signed-off-by: Nicolas Höning <[email protected]>

* fix docstring and add changelog entry

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit 91a02a6)
* feat: show certain buttons to only authorised users

Signed-off-by: joshuaunity <[email protected]>

* chore: added function import to init

Signed-off-by: joshuaunity <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
(cherry picked from commit edf9561)
* fix(ui): set default cursor for audit log rows

Added CSS rules to enforce a default cursor style for rows in audit log tables, ensuring they appear passive and non-clickable.

Modified file:
- flexmeasures/ui/templates/base.html

Refs: #1199

* fix(ui): remove misleading "View Data" tooltip from audit log tables

Removed the `title="View data"` attribute from audit log table templates to prevent the misleading tooltip that suggests clickability.

Modified files:

- flexmeasures/ui/templates/crud/account_audit_log.html
- flexmeasures/ui/templates/crud/asset_audit_log.html
- flexmeasures/ui/templates/crud/user_audit_log.html

Refs: #1199

---------

Co-authored-by: Nicolas Höning <[email protected]>
(cherry picked from commit 22e6a73)
* docs: fix typos

Signed-off-by: F.N. Claessen <[email protected]>

* fix: suppress echoing if statements

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: VladIftime <[email protected]>
(cherry picked from commit daeb1a1)
* feat: paginate user auditlog table and API

Signed-off-by: joshuaunity <[email protected]>

* chore: added to changelog

Signed-off-by: joshuaunity <[email protected]>

* refactor: optional pagination

Signed-off-by: joshuaunity <[email protected]>

* chore: remove wrong changelog

Signed-off-by: joshuaunity <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: JDev <[email protected]>
(cherry picked from commit 7eae6b4)
* feat: paginate assets auditlog table adn API

Signed-off-by: joshuaunity <[email protected]>

* chore: added to auditlog

Signed-off-by: joshuaunity <[email protected]>

* chore: removed unused code

Signed-off-by: joshuaunity <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: JDev <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
(cherry picked from commit a2e3610)
* chore:  work in progress

Signed-off-by: joshuaunity <[email protected]>

* feat: add and remove sensor to single graph

Signed-off-by: joshuaunity <[email protected]>

* feat: filter fetched sensors by available units on edit form for sensorstoshow

Signed-off-by: joshuaunity <[email protected]>

* feat: auto refresh graph and smart auto saving

Signed-off-by: joshuaunity <[email protected]>

* chore: removed quote

Signed-off-by: joshuaunity <[email protected]>

* chore: unused code and comments

Signed-off-by: joshuaunity <[email protected]>

* fix: removed sensors_to_show from assetForm

Signed-off-by: joshuaunity <[email protected]>

* chore: changed event title name

Signed-off-by: joshuaunity <[email protected]>

* chore: fetch sensors for asset and from publix sensors

Signed-off-by: joshuaunity <[email protected]>

* chore: work in progress

Signed-off-by: joshuaunity <[email protected]>

* feat: show sensor accoutn for fethed sensors

Signed-off-by: joshuaunity <[email protected]>

* chore: code organization and logic comments

Signed-off-by: joshuaunity <[email protected]>

* refactor: eidt form improvements

- improved UX
- imporved data fethc performance with caching

Signed-off-by: joshuaunity <[email protected]>

* feat: clickable sensor ID

Signed-off-by: joshuaunity <[email protected]>

* feat: added load spinner

Signed-off-by: joshuaunity <[email protected]>

* refactor: modified graph sensors styling

Signed-off-by: joshuaunity <[email protected]>

* chore: update documentation

Signed-off-by: joshuaunity <[email protected]>

* refactor: Edit Form UX improvement

Signed-off-by: joshuaunity <[email protected]>

* fix: remove card border if -add graph- button is clicked

Signed-off-by: joshuaunity <[email protected]>

* Update changelog.rst

Signed-off-by: JDev <[email protected]>

* refactor:improved form performance

- cache fetchedsensors to prevent multiple calls to sensors API
- display 'not sensors found' message when no sensors is found
- added help icon and message

Signed-off-by: joshuaunity <[email protected]>

* chore: removed unused code

Signed-off-by: joshuaunity <[email protected]>

* refactor: new feat and changes

- Add grap now adds a blank graph instead of fetch all sensors
- now edited title with save when enter is clicked

Signed-off-by: joshuaunity <[email protected]>

* refactor: couple changes

- rename functions with clearer names
- help text on blank graph
- persist graph card focus after editing a title

Signed-off-by: joshuaunity <[email protected]>

* chore: clearer function names and cleared unwanted code

Signed-off-by: joshuaunity <[email protected]>

* refactor: stabilized state management on graph card re-arrangement actions

Signed-off-by: joshuaunity <[email protected]>

* feat: show in UI when a single graph plot multiple sensors with multiple units

Signed-off-by: joshuaunity <[email protected]>

* chore: more fail safes

Signed-off-by: joshuaunity <[email protected]>

* refactor: handle for older format sensor to show data

Signed-off-by: joshuaunity <[email protected]>

* refactor: a more concise code

Signed-off-by: joshuaunity <[email protected]>

* refactor: more concise use of varibiable

Signed-off-by: joshuaunity <[email protected]>

* fix: fixed edit title feature which wasnt saving changes

Signed-off-by: joshuaunity <[email protected]>

* chore: updated documentation

Signed-off-by: joshuaunity <[email protected]>

* chore: remvoed unused attribute

Signed-off-by: joshuaunity <[email protected]>

* chore: added log statement

Signed-off-by: joshuaunity <[email protected]>

* chore: format code(html)

Signed-off-by: joshuaunity <[email protected]>

* chore: removed unused code

Signed-off-by: joshuaunity <[email protected]>

* chore: better variable naming and comments

Signed-off-by: joshuaunity <[email protected]>

* refactor: refactored part of the logic for selecting a graph

Signed-off-by: joshuaunity <[email protected]>

* fix: remove graph action doesnt update teh state of the rendered sensors

Signed-off-by: joshuaunity <[email protected]>

* chore: added comment to code block

Signed-off-by: joshuaunity <[email protected]>

* refactor: used jinja loop instead of JS

Signed-off-by: joshuaunity <[email protected]>

* chore: cleaned up JS logic

Signed-off-by: joshuaunity <[email protected]>

* chore: added comment

Signed-off-by: joshuaunity <[email protected]>

* chore: use warning alert when no sensors are present

Signed-off-by: joshuaunity <[email protected]>

* chore: remove unused element attributes

Signed-off-by: joshuaunity <[email protected]>

* fix: graphs not rendering due to use of wron quotes

Signed-off-by: joshuaunity <[email protected]>

* refactor: rearranged element layout for rendered graphs in editform

Signed-off-by: joshuaunity <[email protected]>

* refactor: refctored edit form to render sensors on right side on initial open of the modal dialogue

Signed-off-by: joshuaunity <[email protected]>

* chore: realign icon

Signed-off-by: joshuaunity <[email protected]>

* fix: updated graph name on sensor search when reordering graph positions

Signed-off-by: joshuaunity <[email protected]>

* initialize renders when form modal is intially opened

Signed-off-by: joshuaunity <[email protected]>

* chore: renamed function name

Signed-off-by: joshuaunity <[email protected]>

* refactor: highlight card when title is being edited or edit btn is clicked

Signed-off-by: joshuaunity <[email protected]>

* repaint Sensor cards when Ggraoh title is changed with hittinh enter Key

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: JDev <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
(cherry picked from commit 0a89f28)
Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit ea4b0e7)
* chore: clean up sensortoshow key for attribute field on genericasset table

Signed-off-by: joshuaunity <[email protected]>

* chore: add ot changelog

Signed-off-by: joshuaunity <[email protected]>

* merge changelog entries

Co-authored-by: Felix Claessen <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: joshuaunity <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>
Co-authored-by: Felix Claessen <[email protected]>

(cherry picked from commit fc44149)
Signed-off-by: F.N. Claessen <[email protected]>
* docs: move PRs from 'New features' to 'Support'

Signed-off-by: F.N. Claessen <[email protected]>

* fix: typo

Signed-off-by: F.N. Claessen <[email protected]>

* feat: add changelog item reminder to our PR template

Signed-off-by: F.N. Claessen <[email protected]>

* feat: add note to our PR template on where to file things in our changelog

Signed-off-by: F.N. Claessen <[email protected]>

* docs: fix typo

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
(cherry picked from commit af36626)
* fix: resolve FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.

Signed-off-by: F.N. Claessen <[email protected]>

* remove: obsolete time/view utils

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
(cherry picked from commit 1aa8060)
* remove unused UserForm

Signed-off-by: Nicolas Höning <[email protected]>

* fix user active-status shown on page after (de)activating user

Signed-off-by: Nicolas Höning <[email protected]>

* replace expensive API call for counting assets with faster SQL query (already implemented as property on the model)

Signed-off-by: Nicolas Höning <[email protected]>

* fix tests and throw out unused API mocks

Signed-off-by: Nicolas Höning <[email protected]>

* add changelog entry

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: Nicolas Höning <[email protected]>
Co-authored-by: JDev <[email protected]>
(cherry picked from commit 39af3f9)
* pop source_types and exclude_source_types

Signed-off-by: Victor Garcia Reolid <[email protected]>

* improve validation of methods. Now resample and groupby methods are valid

Signed-off-by: Victor Garcia Reolid <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* fix: capitalization

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add docstring

Signed-off-by: F.N. Claessen <[email protected]>

* docs: add inline comments

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: Victor Garcia Reolid <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: F.N. Claessen <[email protected]>
(cherry picked from commit 23bfefa)
… are not beautiful anyways. (#1294)

Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit cfe939a)
(cherry picked from commit c8311ca)
Partially revert to mention the original licensor.

Signed-off-by: Felix Claessen <[email protected]>
(cherry picked from commit d3bfe9c)
* fix: recursive error while rendering flexmeasures_template

Signed-off-by: F.N. Claessen <[email protected]>

* fix: arg in kwargs

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog entry

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "fix: arg in kwargs"

This reverts commit d3530c2.

* Revert "fix: recursive error while rendering flexmeasures_template"

This reverts commit ab8fe03.

* fix: catch any error while rendering the FlexMeasures template, and fall back to using the default Flask template

Signed-off-by: F.N. Claessen <[email protected]>

* feat: log error showing why the flexmeasures_template failed to load

Signed-off-by: F.N. Claessen <[email protected]>

* feat: log original error, too

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "feat: log original error, too" (already logged previously)

This reverts commit 49e8003.

* fix: warning instead of error, also more informative message

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>
Co-authored-by: Nicolas Höning <[email protected]>

(cherry picked from commit acd3f62)
Signed-off-by: F.N. Claessen <[email protected]>
After move to SQLAlchemy 2  the code
num_forecasts_deleted = db.session.execute(query)
Does not work as it use to.
Changed code to use .rowcount

There are more places that has same issues but I do not have test cases so I only fixed this one.

Co-authored-by: Nicolas Höning <[email protected]>
(cherry picked from commit 604b8d5)
* Fix issue #1092 for deleting measurements, as well (1095 handled prognoses/forecasts)

Signed-off-by: Nicolas Höning <[email protected]>

* add changelog entry

Signed-off-by: Nicolas Höning <[email protected]>

---------

Signed-off-by: Nicolas Höning <[email protected]>

(cherry picked from commit bf6ff0d)
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>

(cherry picked from commit 8f68075)
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: Nicolas Höning <[email protected]>
(cherry picked from commit d1cedbf)
* docs: fix styling

Signed-off-by: F.N. Claessen <[email protected]>

* docs: correct date

Signed-off-by: F.N. Claessen <[email protected]>

* docs: redundant linebreak

Signed-off-by: F.N. Claessen <[email protected]>

* docs: changelog scaffolding for 0.25

Signed-off-by: F.N. Claessen <[email protected]>

---------

Signed-off-by: F.N. Claessen <[email protected]>

(cherry picked from commit 297c5a1)
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
(cherry picked from commit bfb1004)
…sSeries is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().`

Signed-off-by: F.N. Claessen <[email protected]>
…ots, too, rather than exploiting any unavoidable capacity breaches

Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants