Review/897/refactoring#908
Review/897/refactoring#908Flix6x merged 4 commits intofeature/planning/battery-power-capacity-as-sensorfrom
Conversation
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
|
Also, I feel we should be using dashed - rather than underscored - fields for serialized sensor/asset attributes in our database. This should results in a more consistent experience to API/UI users in the long run. We could of course make that a separate issue, but we are introducing two new fields in #897, so we might as well tackle those there. What do you think @victorgarcia98? If you agree, let's hold off on refactoring until merging this PR and also after considering my next post-review PR, to save us the merge conflicts. |
You're right, this is worth its own issue. In any case, we shouldn't mix dashed and underscored in the DB. Issue #911 |
* add (device) consumption capacity and production capacity as sensors Signed-off-by: Victor Garcia Reolid <[email protected]> * convert units of the power limits to the sensor units Signed-off-by: Victor Garcia Reolid <[email protected]> * add QuantityOrSensor field Signed-off-by: Victor Garcia Reolid <[email protected]> * add annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * introduce QuantityorSensor schema Signed-off-by: Victor Garcia Reolid <[email protected]> * add from __future__ import annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * remove discarded revision Signed-off-by: Victor Garcia Reolid <[email protected]> * add target unit Signed-off-by: Victor Garcia Reolid <[email protected]> * change exception type to FMValidationError Signed-off-by: Victor Garcia Reolid <[email protected]> * add explicity default value Signed-off-by: Victor Garcia Reolid <[email protected]> * split into two functions Signed-off-by: Victor Garcia Reolid <[email protected]> * Review/897/refactoring (#908) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * Review/897/distinguish fallback value and max value (#909) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> * fix: separate logic for falling back on a default attribute and applying a maximum capacity limit Signed-off-by: F.N. Claessen <[email protected]> * fix: fill gaps in capacity sensor data using the max_value rather than with the fallback Signed-off-by: F.N. Claessen <[email protected]> * fix: type annotation (see https://docs.python.org/3/library/typing.html#typing.Optional) Signed-off-by: F.N. Claessen <[email protected]> * refactor: clearly separate steps of falling back and performing a nanmin Signed-off-by: F.N. Claessen <[email protected]> * refactor: simplify and have get_quantity_from_attribute return a Quantity, as its name already suggested Signed-off-by: F.N. Claessen <[email protected]> * refactor: switch argument order Signed-off-by: F.N. Claessen <[email protected]> * refactor: update docstring Signed-off-by: F.N. Claessen <[email protected]> * style: flake8 Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * fix test Signed-off-by: Victor Garcia Reolid <[email protected]> * add changelog entry Signed-off-by: Victor Garcia Reolid <[email protected]> * update changelog Signed-off-by: Victor Garcia Reolid <[email protected]> --------- Signed-off-by: Victor Garcia Reolid <[email protected]> Signed-off-by: F.N. Claessen <[email protected]> Co-authored-by: Felix Claessen <[email protected]>
* add (device) consumption capacity and production capacity as sensors Signed-off-by: Victor Garcia Reolid <[email protected]> * convert units of the power limits to the sensor units Signed-off-by: Victor Garcia Reolid <[email protected]> * add QuantityOrSensor field Signed-off-by: Victor Garcia Reolid <[email protected]> * add annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * introduce QuantityorSensor schema Signed-off-by: Victor Garcia Reolid <[email protected]> * add from __future__ import annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * remove discarded revision Signed-off-by: Victor Garcia Reolid <[email protected]> * add target unit Signed-off-by: Victor Garcia Reolid <[email protected]> * change exception type to FMValidationError Signed-off-by: Victor Garcia Reolid <[email protected]> * add explicity default value Signed-off-by: Victor Garcia Reolid <[email protected]> * split into two functions Signed-off-by: Victor Garcia Reolid <[email protected]> * add usage forecast Signed-off-by: Victor Garcia Reolid <[email protected]> * add test Signed-off-by: Victor Garcia Reolid <[email protected]> * Review/897/refactoring (#908) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * use resolution to convert energy series to the target event resolution Signed-off-by: Victor Garcia Reolid <[email protected]> * simplify conftest Signed-off-by: Victor Garcia Reolid <[email protected]> * Review/897/distinguish fallback value and max value (#909) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> * fix: separate logic for falling back on a default attribute and applying a maximum capacity limit Signed-off-by: F.N. Claessen <[email protected]> * fix: fill gaps in capacity sensor data using the max_value rather than with the fallback Signed-off-by: F.N. Claessen <[email protected]> * fix: type annotation (see https://docs.python.org/3/library/typing.html#typing.Optional) Signed-off-by: F.N. Claessen <[email protected]> * refactor: clearly separate steps of falling back and performing a nanmin Signed-off-by: F.N. Claessen <[email protected]> * refactor: simplify and have get_quantity_from_attribute return a Quantity, as its name already suggested Signed-off-by: F.N. Claessen <[email protected]> * refactor: switch argument order Signed-off-by: F.N. Claessen <[email protected]> * refactor: update docstring Signed-off-by: F.N. Claessen <[email protected]> * style: flake8 Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * fix test Signed-off-by: Victor Garcia Reolid <[email protected]> * add changelog entry Signed-off-by: Victor Garcia Reolid <[email protected]> * improve tests and implement consumption_is_positive Signed-off-by: Victor Garcia Reolid <[email protected]> * add resolution factor to convert from energy units to power units Signed-off-by: Victor Garcia Reolid <[email protected]> * fix test + add new case Signed-off-by: Victor Garcia Reolid <[email protected]> * split stock delta into stock gain and stock usage Signed-off-by: Victor Garcia Reolid <[email protected]> * update changelog Signed-off-by: Victor Garcia Reolid <[email protected]> * switch to power units Signed-off-by: Victor Garcia Reolid <[email protected]> * improve comments Signed-off-by: Victor Garcia Reolid <[email protected]> * add changelog Signed-off-by: Victor Garcia Reolid <[email protected]> * Update changelog.rst Fix typo (*los componentes*) and swap out some changelog entries between Features and Infrastructure. Signed-off-by: Felix Claessen <[email protected]> * Apply black Signed-off-by: Victor Garcia Reolid <[email protected]> --------- Signed-off-by: Victor Garcia Reolid <[email protected]> Signed-off-by: F.N. Claessen <[email protected]> Signed-off-by: Victor <[email protected]> Signed-off-by: Felix Claessen <[email protected]> Co-authored-by: Felix Claessen <[email protected]>
* add (device) consumption capacity and production capacity as sensors Signed-off-by: Victor Garcia Reolid <[email protected]> * convert units of the power limits to the sensor units Signed-off-by: Victor Garcia Reolid <[email protected]> * add QuantityOrSensor field Signed-off-by: Victor Garcia Reolid <[email protected]> * add annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * introduce QuantityorSensor schema Signed-off-by: Victor Garcia Reolid <[email protected]> * add from __future__ import annotations Signed-off-by: Victor Garcia Reolid <[email protected]> * remove discarded revision Signed-off-by: Victor Garcia Reolid <[email protected]> * add target unit Signed-off-by: Victor Garcia Reolid <[email protected]> * change exception type to FMValidationError Signed-off-by: Victor Garcia Reolid <[email protected]> * add explicity default value Signed-off-by: Victor Garcia Reolid <[email protected]> * split into two functions Signed-off-by: Victor Garcia Reolid <[email protected]> * Review/897/refactoring (#908) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * Review/897/distinguish fallback value and max value (#909) * refactor: fix spelling Signed-off-by: F.N. Claessen <[email protected]> * style: missing type annotation Signed-off-by: F.N. Claessen <[email protected]> * refactor: method and variable renaming Signed-off-by: F.N. Claessen <[email protected]> * refactor: add test case explanations Signed-off-by: F.N. Claessen <[email protected]> * fix: separate logic for falling back on a default attribute and applying a maximum capacity limit Signed-off-by: F.N. Claessen <[email protected]> * fix: fill gaps in capacity sensor data using the max_value rather than with the fallback Signed-off-by: F.N. Claessen <[email protected]> * fix: type annotation (see https://docs.python.org/3/library/typing.html#typing.Optional) Signed-off-by: F.N. Claessen <[email protected]> * refactor: clearly separate steps of falling back and performing a nanmin Signed-off-by: F.N. Claessen <[email protected]> * refactor: simplify and have get_quantity_from_attribute return a Quantity, as its name already suggested Signed-off-by: F.N. Claessen <[email protected]> * refactor: switch argument order Signed-off-by: F.N. Claessen <[email protected]> * refactor: update docstring Signed-off-by: F.N. Claessen <[email protected]> * style: flake8 Signed-off-by: F.N. Claessen <[email protected]> --------- Signed-off-by: F.N. Claessen <[email protected]> * fix test Signed-off-by: Victor Garcia Reolid <[email protected]> * add changelog entry Signed-off-by: Victor Garcia Reolid <[email protected]> * update changelog Signed-off-by: Victor Garcia Reolid <[email protected]> * add charge and discharge efficiencies Signed-off-by: Victor Garcia Reolid <[email protected]> * fix test Signed-off-by: Victor Garcia Reolid <[email protected]> * add extra validation and use 100 for the missing values instead of the roundtrip Signed-off-by: Victor Garcia Reolid <[email protected]> * fix validation rules Signed-off-by: Victor Garcia Reolid <[email protected]> * check roundtrip efficiency Signed-off-by: Victor Garcia Reolid <[email protected]> * add documentation Signed-off-by: Victor Garcia Reolid <[email protected]> --------- Signed-off-by: Victor Garcia Reolid <[email protected]> Signed-off-by: F.N. Claessen <[email protected]> Co-authored-by: Felix Claessen <[email protected]>
I split my post-review work into two parts. This one deals with refactoring only.