Commit Graph
20 Commits
Author SHA1 Message Date
AndreasandAndreas 9edc2d20d3 Soc 1 hour shift fixed + some german -> english translations in ems 2024-12-22 12:22:27 +01:00
Dominique LasserreandAndreas afa5cc7c02 input data: Fix indentation
* Comment full_run (use pytest --full-run to activate)
2024-12-22 10:36:36 +01:00
AndreasandAndreas fc4067fe63 Standard Optimization time 48h -> Tests updated 2024-12-22 10:36:36 +01:00
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 LasserreandGitHub da419dbf39 Update optimize full-run (#238)
* Enable full-run in github workflow
2024-12-12 14:37:46 +01:00
Dominique LasserreandGitHub 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
Michael OsthegeandGitHub 5e2eae7331 Structure code in logically separated submodules (#188) 2024-11-19 21:47:43 +01:00
Dominique LasserreandGitHub 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
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
ef93574f87 Add more optimization tests (#171)
* Integrated single_test_optimization into pytest to run a basic optimization test with tolerance set to 1e-6, ensuring quick detection of deviations.
* Added a long-run test (400 generations, like single_test_optimization), which can be triggered using --full-run in pytest.
* Mocked PDF creation in optimization tests and added a new PDF generation test with image comparison validation.

Note: Current tolerance is set to 1e-6; feedback on whether this tolerance is tight enough is welcome.

---------

Co-authored-by: Normann <github@koldrack.com>
Co-authored-by: Michael Osthege <michael.osthege@outlook.com>
2024-11-10 23:22:30 +01:00
AndreasandAndreas 5d51d0a676 Tests fixed 2024-10-22 10:39:10 +02:00
ChrisandAndreas 141257f514 Ruff format 2024-10-11 09:07:53 +02:00
Dominique LasserreandAndreas b620250536 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
Michael OsthegeandAndreas 3c1482c2c0 Activate optimization test with 3 generations 2024-10-09 17:05:36 +02:00
Michael OsthegeandAndreas b6d0ef22f3 Remove and ignore visualization side-effect outputs 2024-10-09 17:05:36 +02:00
NormannandAndreas 929d7e0a75 JSON files for test_class_optimize.py
Update test_class_optimize.py

added Skipped per default

Fix optimization test

Fix optimization test
2024-10-09 17:05:36 +02:00
Bobby NoelteandAndreas ba31734bd8 Adapt tests to package directory structure.
Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2024-10-07 08:12:33 +02:00
AndreasandAndreas b7dbd7e475 min_soc (was killed by someone else, pls dont force push!) 2024-10-06 16:00:07 +02:00
NormannandAndreas d8a46eb5d3 fixed optimize test
fixed first our values for optimize test
2024-10-06 15:20:37 +02:00
NormannandDaniel Molkentin 75d87aa94a test for class_optimize in PR #88
Test meant for class_optimize.
Will only work with PR #88 since the old class has no way to use a fixed random seed.
2024-10-05 23:54:05 +02:00