70 Commits

Author SHA1 Message Date
Dominique Lasserre
38968a941a
pvforecast: Some values optional. Closes #292 (#293)
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
* temperature, relativehumidity_2m, windspeed_10m can be null
 * prettify pv_forecast_input_1.json (and add null value)
2024-12-29 16:43:37 +01:00
Normann
09e54b9989
duplicate line removed (#290)
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
2024-12-27 21:42:50 +01:00
Normann
c6da05d57b
default filename changed back (#288)
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
2024-12-27 10:46:13 +01:00
Andreas
e22388b753 Merge
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
2024-12-26 08:12:56 +01:00
Andreas
08623ae61f Merge branch 'soc_zero_price_precision' of https://github.com/Akkudoktor-EOS/EOS into soc_zero_price_precision 2024-12-26 08:11:06 +01:00
Andreas
762d3105e5 Awattar Price changed to more precise value; if SoC=0 discharge =1 forced. Exp Avg for siple Price Forecast 2024-12-26 08:10:02 +01:00
Andreas
d724d287d0 Ruff 2024-12-26 08:00:52 +01:00
Andreas
e20c83e413
Merge branch 'main' into soc_zero_price_precision 2024-12-26 07:53:07 +01:00
Andreas
015a6a7a8d Discharge Mask Bug, Tests updated, simple Price Forecast with linear weighting 2024-12-26 07:50:25 +01:00
Andreas
4f8d5d3742 Awattar Price changed to more precise value; if SoC=0 discharge =1 forced. Exp Avg for siple Price Forecast
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Run Pytest on Pull Request / test (push) Waiting to run
2024-12-25 19:17:08 +01:00
Andreas
c8c8d86bcc Awattar Price changed to more precise value; if SoC=0 discharge =1 forced. Exp Avg for siple Price Forecast 2024-12-25 19:12:38 +01:00
Normann
04f6602659
backport visualize v3 (#279)
* backport visualize v3

* test backport

* compare file

* old test files removed
2024-12-24 13:11:15 +01:00
Andreas
35142fafbd English translation EMS 2024-12-22 12:22:27 +01:00
Andreas
9edc2d20d3 Soc 1 hour shift fixed + some german -> english translations in ems 2024-12-22 12:22:27 +01:00
Andreas
fc4067fe63 Standard Optimization time 48h -> Tests updated 2024-12-22 10:36:36 +01:00
Andreas
3f67da1326 Price Prediction as JSON simulation output, config fixed electricty fees configurable + MyPy & Ruff 2024-12-21 14:57:11 +01:00
Andreas
43da234a06 Price Forceast (use mean of last 7 days instead of repeat) 2024-12-21 14:57:11 +01:00
Andreas
6416b119cc EV Charge Bug fixed 2024-12-21 14:57:11 +01:00
Andreas
e1f4c75a5d Start solution Bug 2024-12-21 14:57:11 +01:00
Andreas
54f7989ec4 Small penalty when EV 100% and charge >0 2024-12-21 14:57:11 +01:00
Andreas
0d529d7533 Time stop in verbose + LRU Cache / Vectoriz. 2024-12-21 14:57:11 +01:00
Andreas
af031b1a93 Bug 2024-12-21 14:57:11 +01:00
Andreas
0e7350b1e9 First self consumption predictor only PV > load 2024-12-21 14:57:11 +01:00
Andreas
41747a02f8 Interpolator Self Consumption 2024-12-21 14:57:11 +01:00
Andreas
eaf39925ca Penalty not neccessary anymore.
Self Consumption rate is FIXED!!! TODO!
2024-12-21 14:57:11 +01:00
Andreas
2ec3f87732 - discharge hour penalty from start_hour
- Inverter: Frist try of small self consumption rate (fixed) for better discharge_hour results
2024-12-21 14:57:11 +01:00
Dominique Lasserre
3d8a97e128
Optimize states (#256)
* optimization states for AC, DC and IDLE now similar probab. Also AC states taken from config. Maybe a single config option for AC and E-Auto States is sensefull.
 * Ruff
 * test_class_optimize: Update testdata
 * Write pdf and json to test/testdata/new.... so it can be analyzed
   manually or just copied as new expected result.
 * workflow: Upload pytest optimization result artifacts (pdf, json)

---------

Co-authored-by: Andreas <drbacke@gmx.de>
2024-12-16 13:37:16 +01:00
Dominique Lasserre
da419dbf39
Update optimize full-run (#238)
* Enable full-run in github workflow
2024-12-12 14:37:46 +01:00
Andreas
143814fe18 mypy 2024-12-11 10:31:50 +01:00
Andreas
8264b94131 Swagger Fix (Pydantic) Gesamtlast 2024-12-11 10:31:50 +01:00
Andreas
b9c1ea3454 pre commit 2024-12-11 10:14:30 +01:00
Andreas
a00f9593ce Gesamtlast does not work anymore. Wrong FastAPI Header. Swagger also wrong 2024-12-11 10:14:30 +01:00
celle1234
1b1fec444b fix AC charge efficiency not used for price calculation
Fix bug https://github.com/Akkudoktor-EOS/EOS/issues/215
2024-12-11 08:55:54 +01:00
Andreas
5c2bbb4de2 Bugfixes 2024-12-11 07:44:28 +01:00
Andreas
c115435ab3 Price Prediction failed, used Normanns fixes for the new code 2024-12-11 07:44:28 +01:00
Dominique Lasserre
6e52c9bef2
Mypy (#217)
* Mypy: Initial support

 * Add to pre-commit (currently installs own deps, could maybe changed
   to poetry venv in the future to reuse environment and don't need
   duplicated types deps).
 * Add type hints.

* Mypy: Add missing annotations
2024-11-26 22:28:05 +01:00
Jürgen Eckel
595b73359c
renamed haushaltsgeräte to home appliance (#196)
* * rename Haushaltsgeraete to home appliance
* renamed strafe to penalty (optimization problem)

Signed-off-by: Jürgen Eckel <juergen.eckel@gmail.com>

* removed penalty renaming

Signed-off-by: Jürgen Eckel <juergen.eckel@gmail.com>

* renamed one variable

Signed-off-by: Jürgen Eckel <juergen.eckel@gmail.com>

* * renamed variable names and methods of the home appliance class

* renamed missed method names

* fixed renamed variable

* renamed object

* adjusted to latest repo changes

* renamed file to class_home_applianc.py

* renamed method

---------

Signed-off-by: Jürgen Eckel <juergen.eckel@gmail.com>
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2024-11-26 00:53:16 +01:00
Michael Osthege
5e2eae7331
Structure code in logically separated submodules (#188) 2024-11-19 21:47:43 +01:00
Dominique Lasserre
c7eb3ec63b
optimize: Enforce start solution with at least two elements Closes #205 (#207)
* mate -> cxTwoPoints needs at least two elements.
2024-11-18 20:54:39 +01:00
Dominique Lasserre
e936aaf134
visualize: Keep shape of plots the same on dst change Closes #185 (#203)
* Currently prediction hours are relative from current hour and don't
   adjust on daylight saving change.
 * ist_dst_wechsel now unused.
2024-11-16 21:52:51 +01:00
Dominique Lasserre
2f5f844018
Migrate from Flask to FastAPI (#163)
* Migrate from Flask to FastAPI

 * FastAPI migration:
    - Use pydantic model classes as input parameters to the
      data/calculation classes.
    - Interface field names changed to constructor parameter names (for
      simplicity only during transition, should be updated in a followup
      PR).
    - Add basic interface requirements (e.g. some values > 0, etc.).
 * Update tests for new data format.
 * Python requirement down to 3.9 (TypeGuard no longer needed)
 * Makefile: Add helpful targets (e.g. development server with reload)

* Move API doc from README to pydantic model classes (swagger)

 * Link to swagger.io with own openapi.yml.
 * Commit openapi.json and check with pytest for changes so the
   documentation is always up-to-date.

* Streamline docker

* FastAPI: Run startup action on dev server

 * Fix config for /strompreis, endpoint still broken however.

* test_openapi: Compare against docs/.../openapi.json

* Move fastapi to server/ submodule

 * See #187 for new repository structure.
2024-11-15 22:27:25 +01:00
Chris
057f86d580
Json configuration (#141)
* Add json config
* Adjust code to new config

---------

Co-authored-by: Chris <git@nootch.de>
2024-11-11 21:38:13 +01:00
Bobby Noelte
a4c2358fc7
Round pv forecast report data. (#194)
Report data are floats.

The report is used for unit testing which may be affected by the float precision of the test environment.
Round to make the test result more robust without loosing the general test case.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-11-11 21:27:08 +01:00
Bobby Noelte
d2ba0adb5f
Add test to PVForecast (#174)
* Add documentation to class_pv_forecast.py.

Added documentation. Beware mostly generated by ChatGPT.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Add CacheFileStore, datetime and logger utilities.

The `CacheFileStore` class is a singleton-based, thread-safe key-value store for managing
temporary file objects, allowing the creation, retrieval, and management of cache files.

The utility modules offer a flexible logging setup (`get_logger`) and utilities to handle
different date-time formats (`to_datetime`, `to_timestamp`) and timezone detection
(`to_timezone).

- Cache files are automatically valid for the the current date unless specified otherwise.
  This is to mimic the current behaviour used in several classes.
- The logger supports rotating log files to prevent excessive log file size.
- The `to_datetime` and `to_timestamp`functions support a wide variety of input types and formats.
  They provide the time conversion that is e.g. used in PVForecast.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Improve testability of PVForecast

Improvements for testing of PVForecast
- Use common utility functions to allow for general testing at one spot.
  - to_datetime
  - CacheFileStore
- Use logging instead of print to easily capture in testing.
- Add validation of the json schema for Akkudoktor PV forecast data.
- Allow to create an empty PVForecast instance as base instance for testing.
- Make process_data() complete for filling a PVForecast instance for testing.
- Normalize forecast datetime to timezone of system given in loaded data.
- Do not print report but provide report for test checks.
- Get rid of cache file path using the CachFileStore to automate cache file usage.
- Improved module documentation.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Add test for PVForecast and newly extracted utility modules.

- Add test for PVForecast
- Add test for CacheFileStore in the new cachefilestore module
- Add test for to_datetime, to_timestamp, to_timezone in the new
  datetimeutil module
- Add test for get_logger in the new logutil module

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

---------

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
Co-authored-by: Normann <github@koldrack.com>
2024-11-10 23:49:10 +01:00
Bobby Noelte
6561793e3b
Add API documentation generation and use Markdown (#160)
* Add package API documentation generation

Add generation of the API documentation for akkudoktoreos
and akkudoktoreosserver packages.

The API documentation is generated by the Sphinx autosummary extension.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Enable Google style source commenting and documentation generation.

Enable automatic documentation generation from Google style docstrings in the source.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Check Google style source commenting.

Check Google style commenting by the appropriate ruff rules.

Commenting is _NOT_ enforced. Missing docstrings are ignored.

Minor commenting quirks of the code base are adapted.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

* Improve Markdown handling and switch to Markdown documentation.

Switch to Markdown for the documentation files to improve the user and developer experience (see issue #181).

Keep files with special directives for automatic API documentation in RST format. The
directives expect RST.

Also add dummy handling for openai/ swagger server documentation. The openai interface definition is
for now taken from the fastapi PR as EOS will switch to fastAPI.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>

---------

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
Co-authored-by: Normann <github@koldrack.com>
2024-11-10 23:27:52 +01:00
Dominique Lasserre
a0872deede
Cleanup: Fix violin chart labels, remove debug code (#167) 2024-10-31 11:17:45 +01:00
Andreas
cdf4d074e2 Hopefully the last precommit fix 2024-10-22 10:39:10 +02:00
Andreas
55950a93eb PreCommit Fixed 2024-10-22 10:39:10 +02:00
Andreas
5d51d0a676 Tests fixed 2024-10-22 10:39:10 +02:00
Andreas
8d3eb96a0b Time problems in EMS / Optimization 2024-10-22 10:39:10 +02:00