65 Commits

Author SHA1 Message Date
Andreas
2a526aa228 English translation EMS 2024-12-22 12:22:27 +01:00
Andreas
82b9216be5 Soc 1 hour shift fixed + some german -> english translations in ems 2024-12-22 12:22:27 +01:00
Andreas
75ee2408c4 Standard Optimization time 48h -> Tests updated 2024-12-22 10:36:36 +01:00
Andreas
d2a83f6ea4 Price Prediction as JSON simulation output, config fixed electricty fees configurable + MyPy & Ruff 2024-12-21 14:57:11 +01:00
Andreas
6aa8838e5b Price Forceast (use mean of last 7 days instead of repeat) 2024-12-21 14:57:11 +01:00
Andreas
155c116819 EV Charge Bug fixed 2024-12-21 14:57:11 +01:00
Andreas
b0cd910403 Start solution Bug 2024-12-21 14:57:11 +01:00
Andreas
85395076be Small penalty when EV 100% and charge >0 2024-12-21 14:57:11 +01:00
Andreas
83bfb1878b Time stop in verbose + LRU Cache / Vectoriz. 2024-12-21 14:57:11 +01:00
Andreas
9214d190e8 Bug 2024-12-21 14:57:11 +01:00
Andreas
4e8e9bd0c0 First self consumption predictor only PV > load 2024-12-21 14:57:11 +01:00
Andreas
c56d29f63d Interpolator Self Consumption 2024-12-21 14:57:11 +01:00
Andreas
1e6d11ba17 Penalty not neccessary anymore.
Self Consumption rate is FIXED!!! TODO!
2024-12-21 14:57:11 +01:00
Andreas
653f4f8d9f - 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
79ecf71353 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
a5e637ab4c Update optimize full-run (#238)
* Enable full-run in github workflow
2024-12-12 14:37:46 +01:00
Andreas
ac90abd621 mypy 2024-12-11 10:31:50 +01:00
Andreas
598221d6e3 Swagger Fix (Pydantic) Gesamtlast 2024-12-11 10:31:50 +01:00
Andreas
8f341ab6c6 pre commit 2024-12-11 10:14:30 +01:00
Andreas
1c485091e4 Gesamtlast does not work anymore. Wrong FastAPI Header. Swagger also wrong 2024-12-11 10:14:30 +01:00
celle1234
d482c4bb48 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
f74f895550 Bugfixes 2024-12-11 07:44:28 +01:00
Andreas
d63601d742 Price Prediction failed, used Normanns fixes for the new code 2024-12-11 07:44:28 +01:00
Dominique Lasserre
1163ddb4ac 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
2a163569bc 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
22f72e2f13 Structure code in logically separated submodules (#188) 2024-11-19 21:47:43 +01:00
Dominique Lasserre
777303a2b7 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
b3914ab16b 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
f61665669f 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
ed3226e522 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
82cbf0f649 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
b630625a4d 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
94467e1a69 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
Normann
1ed06fc270 set min_soc_prozent 0 by default (#184)
#183 the current default value of "Null" is not compatible with the class_akku. A default value of 0 is more reasonable.
2024-11-10 17:37:24 +01:00
Dominique Lasserre
219bff1d04 Cleanup: Fix violin chart labels, remove debug code (#167) 2024-10-31 11:17:45 +01:00
Andreas
2e54775efe Hopefully the last precommit fix 2024-10-22 10:39:10 +02:00
Andreas
c47f071f55 PreCommit Fixed 2024-10-22 10:39:10 +02:00
Andreas
45a3bcdb09 Tests fixed 2024-10-22 10:39:10 +02:00
Andreas
24c7593056 Time problems in EMS / Optimization 2024-10-22 10:39:10 +02:00
Andreas
ad550c874b AC Charge Bug, Price Cache On/Off 2024-10-22 10:39:10 +02:00
Andreas
7adf3d336a AC /DC / Discharge optimzation - First try (not finished yet) 2024-10-22 10:39:10 +02:00
Andreas
87ec02a90e class_ems: AC / DC Charging
class_optimize: Timing Bugs fixed
class_numpy_encoder: JSON Encoder with Numpy support
visualize: AC / DC / Discharge
test_class_ems_2: New Test for AC / DC charging decision
2024-10-22 10:39:10 +02:00
Andreas
cafed7eaca EV Bugs 2024-10-22 10:39:10 +02:00
Andreas
2b5f0ee53c EV Charge Parameters optional + AC Charge first try (Parameter Reduction) 2024-10-22 10:39:10 +02:00
Andreas
6881710295 EV possible currents -> Work now (new Mutate Function)
-> Some Penalties are removed (deprecated)
AC Charge -> Parameter in Optimization -1,0,1
-> Missing integration in class_ems
2024-10-22 10:39:10 +02:00
Chris
e65eb6b6dd Ruff format 2024-10-11 09:07:53 +02:00
Dominique Lasserre
a71eab3bd0 Streamline Dockerfile, remove unused deps
* Dockerfile: Use non-root user, buildx cache, setup for readonly
   container, remove unused apt deps.
   For now don't install pip package and keep development flask server
   as this will be replaced in the future (fastapi). Then a proper
   webserver (e.g. nginx) should be used and the pip package can be
   created and deployed just to the run-stage (with the webserver).
 * docker-compose: Set to readonly (anonymous volumes declared in
   Dockerfile should maintain all writable data).
   Mount config.py for easier development. Should be replaced by
   environment support for all config file variables.
 * Remove unused runtime dependencies: mariadb, joblib, pytest,
   pytest-cov.
 * Move pytest-cov to dev dependencies.
 * Add output_dir to config.py.
 * Fix visualization_results.pdf endpoint.
 * Update docs.
2024-10-11 08:39:14 +02:00
Dominique Lasserre
12c9e4428e Replace pytz with stdlib zoneinfo/timezone, Bump python to 3.10
* Timezone support comes with the standard lib since 3.9
 * Bump to 3.10 because typing.TypeGuard
2024-10-10 14:18:40 +02:00
Bobby Noelte
5bd8c532af Fix Adapt data to package directory structure
Due to .gitignore directive files in data/ were ignored. Thus data was not moved to correct location by pr #122.

Add load_profiles.npz and remove gitignore directive.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-09 18:18:35 +02:00
Michael Osthege
2f1f37577b Activate optimization test with 3 generations 2024-10-09 17:05:36 +02:00