mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-09 16:06:40 +00:00
* feat: adapt configuration for multi optimization algorithms Decouple configuration from optimization algorithm parameters. Add to_[algorithm]_param() methods to the configuration that derive optimization algorithm specific parameters from the configuration. Add x-scope tags to the configuration options that describe for which specific algorithms the configuration option is for. The whole device settings are restructured. There are now general settings for the device classes with the afore mentioned to_[algorithm]_param() methods. The general device settings got their own directory `devices/settings`. By this the parameter class also does not have to be a pydantic model which can be used for future optimization/ simulations speed up. Also the parameter class for a device is now part of the device module. This better decouples and also is the natural place for parameters of a device. Besides this feature there are also fixes and improvements: * feat: extend home appliance time window settings and simulation Home appliance can now be configured for multiple runs with per-cycle allowed time windows. The number of remaining cycles to plan is determined at runtime by reading the ``cycles_completed_measurement_key`` from the measurement store. * feat: specialiced CycleTimeWindowSequence for time window sequences Sequence of time windows associated to cycles. This model specializes ``ValueTimeWindowSequence`` so that the ``value`` field of each ``ValueTimeWindow`` encodes the **cycle index** (0-based integer) the window belongs to. Typical use: an appliance that must run ``n`` times per day, each run constrained to a distinct time window. Assign ``value=0`` to windows for the first cycle, ``value=1`` for the second, and so on. Multiple windows may share the same cycle index (their allowed regions are unioned). Windows with ``value=None`` are silently ignored by all cycle-aware methods. * fix: Make test_configmigrate also regard the _ANY_SENTENIEL in key values * chore: Make devices configurations a map instead of a list This makes config paths stable regardless of declaration order and lets each device settings class build its own config path from ``self.device_id`` without needing an external index. Tests are adapted likewise. Devices configurations are automatically migrated from lists to maps. * chore: rename levelized_cost_of_storage_kwh to levelized_cost_of_storage_amt kwh This better fits in the naming scheme and also makes clear the costs are money. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> * fix: runtime config update ignored by config file Runtime settings were handed back to pydantic-settings as init settings, which rank below the config file and the environment. Any key already present in EOS.config.json or in the environment silently discarded the update, so a bulk PUT /v1/config returned 200 without applying anything, while the granular PUT /v1/config/{path} endpoint kept working. Add a dedicated runtime settings source ranked directly below the command line arguments and record granular updates there as well, so both endpoints share one store that survives re-evaluation of the settings sources. Environment variables keep precedence over the config file for all keys that were not set at runtime. Also repairs revert_settings() and update(), which passed their data through the same init settings. Closes #1303 * fix: env vars ignored on first config build ConfigEOS.__init__ passed self as first positional argument to _setup, which forwards it to pydantic_settings.BaseSettings.__init__. Its first positional parameter is _case_sensitive, so the environment source matched the upper case variable names against the lower case field names and returned nothing. Environment settings only took effect after the next configuration setup. * docs: changelog for config priority fixes * fix(config): preserve device identities and storage costs during migration * fix(measurement): restore JSON records into the existing singleton * fix(devices): preserve charge-rate typing and public import compatibility * feat(measurement): integrate typed energy quality and capacity APIs Port the locally backed-up measurement extensions to main async storage and PR #1256 device maps. Preserve runtime capacity estimates across #1305 bulk updates. Confirm JSON singleton restore defect on unchanged main and add regression. No production configuration or measurements included. Co-authored-by: Andreas <drbacke@gmx.de> * docs(measurement): describe household settings and consolidate regression coverage * docs(measurement): regenerate configuration and API contracts * test(measurement): isolate capacity database state between tests * ruff format fix * fix(measurement): restore JSON records into the existing singleton * test(measurement): assert restored timestamps before timezone conversion * test(measurement): assert restored timestamps before timezone conversion * fix: preserve imported feed-in revenue during parameter preparation Cancel GENETIC preparation when imported revenue cannot be read or contains invalid values, preserving the chosen provider instead of replacing it with demo tariffs. Keep valid positive, zero and negative amount/Wh series unchanged. Adapt the revenue-preservation regressions from PRs #1224 and #1304 to the async main API, including real timestamped imports and simulation repricing. The feature-only direct-marketing override remains outside this main fix. Co-authored-by: Christin <info@bikinibottom.capital> Co-authored-by: Normann <github@koldrack.com> * feat(devices): port slot-aware battery export and direct-use physics Port scoped device changes fromd2e2d58237. Keep PR #1256 parameter conversion structure and separate GENETIC0 devices. Validate physical flows and reprice changed simulation results. Co-authored-by: Andreas <drbacke@gmx.de> Co-authored-by: Christin <info@bikinibottom.capital> * docs(measurement): align API version with refreshed prerequisites * fix: return only completed optimization results per run * feat(pvforecast): add calibrated local Akkudoktor backend Port local PV modeling and outage calibration from feature commitsf976335,6dc58c3andfaed0fdby Andreas. Keep PVForecastAkkudoktor identity and remote default, adapt to async storage, and migrate legacy provider settings. * fix(cache): distinguish callables in the shared EMS cache Include the function object in cache keys so methods of one interpolator cannot reuse a probability as a power value. Cover both call orders, keyword arguments, cache hits and separate closures with identical qualified names. * fix(devices): constrain the physics port and validate export levels Defer inactive EV deadline fields to the optimizer port, reject nonfinite export rates, and document the hourly Optimize boundary. Verify converter IDs, rates and LCOS, separate GENETIC0 interpolation, physical boundary flows and independent GENETIC repricing. * docs(pvforecast): regenerate local backend configuration schema * docs(devices): regenerate slot-physics configuration and OpenAPI schemas * test: type dynamic Optimize regression arguments * style: wrap imported tariff test parameter import * style(pvforecast): apply CI import formatting * docs(pvforecast): refresh API version after CI formatting * fix(config): satisfy typed device conversion and migration contracts * docs(config): refresh validated configuration prerequisite schemas * fix(measurement): enforce typed capacity and sample validation * test(devices): align physics regressions with strict type checking * style(measurement): normalize imports for CI * docs(measurement): refresh typed measurement API schemas * docs(devices): refresh API version after prerequisite merge * test: make optimization dispatch timezones explicit * docs(interpolator): use portable reStructuredText markup * docs(devices): refresh API version after docstring compatibility fix * feat: complete configuration-driven GENETIC optimization and reports (#1329) * feat(devices): port slot-aware battery export and direct-use physics Port scoped device changes fromd2e2d58237. Keep PR #1256 parameter conversion structure and separate GENETIC0 devices. Validate physical flows and reprice changed simulation results. Co-authored-by: Andreas <drbacke@gmx.de> Co-authored-by: Christin <info@bikinibottom.capital> * feat(optimization): port tested terminal and tail value primitives Sourced2e2d58237. 22 primitive tests pass; integration with the optimizer, forecast horizon and API is still pending. Co-authored-by: Andreas <drbacke@gmx.de> Co-authored-by: Christin <info@bikinibottom.capital> * fix(devices): preserve charge-rate typing and public import compatibility * feat(measurement): integrate typed energy quality and capacity APIs Port the locally backed-up measurement extensions to main async storage and PR #1256 device maps. Preserve runtime capacity estimates across #1305 bulk updates. Confirm JSON singleton restore defect on unchanged main and add regression. No production configuration or measurements included. Co-authored-by: Andreas <drbacke@gmx.de> * test(integration): validate optimizer economics and document measurement settings * docs(integration): record tested checkpoint and remaining consolidation work * docs(development): define isolated PR packages and remaining porting gates * docs(integration): refresh API version after measurement reconciliation * docs(integration): record PR readiness verification results * docs(development): record publication and verification of PR 1322 * test(measurement): assert restored timestamps before timezone conversion * docs(development): record corrected PR head and CI progress * docs(integration): refresh API version after prerequisite alignment * docs(integration): define parallel packages and Optimize compatibility gates * fix: preserve imported feed-in revenue during parameter preparation Cancel GENETIC preparation when imported revenue cannot be read or contains invalid values, preserving the chosen provider instead of replacing it with demo tariffs. Keep valid positive, zero and negative amount/Wh series unchanged. Adapt the revenue-preservation regressions from PRs #1224 and #1304 to the async main API, including real timestamped imports and simulation repricing. The feature-only direct-marketing override remains outside this main fix. Co-authored-by: Christin <info@bikinibottom.capital> Co-authored-by: Normann <github@koldrack.com> * test(integration): verify tariff protection with mapped device physics * fix: return only completed optimization results per run * test(integration): verify algorithm aliases and mapped-device contracts * fix(cache): distinguish callables in the shared EMS cache Include the function object in cache keys so methods of one interpolator cannot reuse a probability as a power value. Cover both call orders, keyword arguments, cache hits and separate closures with identical qualified names. * fix(devices): constrain the physics port and validate export levels Defer inactive EV deadline fields to the optimizer port, reject nonfinite export rates, and document the hourly Optimize boundary. Verify converter IDs, rates and LCOS, separate GENETIC0 interpolation, physical boundary flows and independent GENETIC repricing. * feat(pvforecast): add calibrated local Akkudoktor backend Port local PV modeling and outage calibration from feature commitsf976335,6dc58c3andfaed0fdby Andreas. Keep PVForecastAkkudoktor identity and remote default, adapt to async storage, and migrate legacy provider settings. * docs(integration): record combined compatibility checks and green JSON PR CI * test: type dynamic Optimize regression arguments * docs(integration): record Optimize fix PR publication * docs(integration): record imported tariff protection PR * style(pvforecast): apply CI import formatting * style(integration): align combined regression imports * test: make optimization dispatch timezones explicit * docs(interpolator): use portable reStructuredText markup * chore: validate combined integration with locked mypy * docs: hand off six validated pull requests for manual review * feat: report genetic interval and terminal value diagnostics * feat(devices): reconcile flexible profiles and EV deadlines with cycle scheduling Adapt the flexible consumer primitives fromd2e2d582while retaining the keyed settings and per-cycle scheduling introduced by #1256. Preserve slot battery physics and GENETIC0 flat-load conversion. Cover energy conservation, deadlines, window intersections, DST, completed cycles and EV converters. * test: satisfy typed genetic PDF chart contracts * feat(optimization): resolve quarter-hour GENETIC requests from configuration * test(genetic): verify real device scheduling, measurement and export contracts Register appliance completed-cycle measurement keys so the real store accepts both default and custom counters. Exercise complete low-budget optimizer runs, persisted measurements, generic solution output and instructions, including zero-power phases, EV departure boundaries, per-cycle windows and LCOS. * fix: bound genetic report forecasts to executable horizon * feat: complete native genetic scheduling and retained result contracts * fix: retain missing raw samples when dropna is disabled * fix: align local optimization slots and measurement instants * docs: explain complete genetic rollout and PR dependencies * feat: expose retained GENETIC report through the versioned API * docs: regenerate complete genetic configuration and API schema * docs: format consolidation and review handoff markdown * test: align isolated EMS fixture with native genetic run options * test(genetic): clean up singleton measurements after device integration tests * test: freeze the clock without replacing timestamp conversion * fix: preserve explicit warmstart timezones in runtime requests * test(genetic): validate device schedules in UTC and Berlin Use explicit Berlin origins for Berlin wall-clock windows, compare absolute deadline instants correctly, and run all real device optimizer scenarios under both UTC and Europe/Berlin. Compare exported starts in the run timezone instead of assuming the output timezone matches the host. * fix: start automatic genetic runs in the site timezone * Preserve aware GENETIC snapshot times across host timezones * docs: specify site clock and rehearsed merge resolutions * test: isolate invalid measurement records and refresh API version * fix: render single-slot genetic tail diagnostics * docs: refresh schema version after report fix * fix: preserve configuration-only Optimize API contract * docs: refresh configuration request schema --------- Co-authored-by: Christin <info@bikinibottom.capital> Co-authored-by: Normann <github@koldrack.com> --------- Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> Co-authored-by: Bobby Noelte <b0661n0e17e@gmail.com> Co-authored-by: r0b2g1t <r0b2g1t@users.noreply.github.com> Co-authored-by: Normann <github@koldrack.com> Co-authored-by: Christin <info@bikinibottom.capital>
126 lines
9.2 KiB
Markdown
126 lines
9.2 KiB
Markdown
# Remaining EOS packages and Optimize compatibility
|
||
|
||
Historical planning snapshot. The remaining packages below are now implemented;
|
||
see [review handoff](review-handoff.md) for current dependencies and acceptance.
|
||
|
||
Snapshot: 2026-09-16. Official main: `4a37244`. Feature source: `d2e2d58`, plus
|
||
separately backed-up local work. This is a functional package estimate, not a claim
|
||
that every differing commit requires its own PR.
|
||
|
||
## What is still missing on main
|
||
|
||
<!-- pyml disable line-length -->
|
||
| Package | Missing behavior relative to feature/local work | Local state | Dependency |
|
||
| --- | --- | --- | --- |
|
||
| Device physics | Slot-duration-aware battery/inverter flows, export control, efficiency and limits | Published as #1327 against the configuration prerequisite branch; combined in integration | #1256 device settings/converters |
|
||
| Complete GENETIC | Quarter-hour orchestration, adaptive evolution, export states, warmstart alignment, forecast tail/terminal value, EV deadlines and flexible consumer profiles | Physics and primitives exist; orchestration/parameter/output integration remains open | Device physics, #1256, tariff contract |
|
||
| Imported tariff protection | Preserve supplied/imported revenue; avoid silent demo or market-price replacement | Published as #1324 and combined in integration; feature-specific override still required inside GENETIC port | Main patch independent; second part belongs with GENETIC |
|
||
| Local calibrated PV | Local Akkudoktor PV calculation, measurement calibration and outage handling under existing provider ID | Published as #1325 against main; combined in integration | Provider-specific settings; combined forecast/optimizer acceptance later |
|
||
| Measurement APIs | Typed channels, quality, energy integration, household balance and capacity estimate APIs | Published as #1326 against the configuration prerequisite branch | #1256, #1305, configuration corrections; JSON fix #1322 |
|
||
| Config-owned Optimize request | Local ConfigOptimizationRequest, /v1/optimize, runtime observations and common parameter resolver | Backed up; async/maps/converters adaptation pending | New GENETIC and #1305 |
|
||
| Result/PDF output | Quarter-hour, flexible-consumer, export, tail/rest-value diagnostics in main's on-demand algorithm-specific output | Pending | Final GENETIC result contract |
|
||
<!-- pyml enable line-length -->
|
||
|
||
Four of the seven feature packages are now published as #1324–#1327. Three broader
|
||
packages remain unported: complete GENETIC, the config-owned Optimize API, and result/PDF
|
||
output. Their final PR split depends on the resulting contracts. #1256 and #1305 are existing
|
||
foundation PRs, not two newly invented replacements. #1224/#1304 already address
|
||
parts of the tariff work against the old feature branch; preserve/reconcile those
|
||
contributions rather than count duplicate implementations as separate deliverables.
|
||
PR #1322 is already published and is additional to this feature table.
|
||
|
||
One additional standalone defect fix is published as PR #1323, fix/optimize-run-result:
|
||
an explicit Optimize request must return only its own completed result. Cache
|
||
method identity was also corrected as a prerequisite within the device package;
|
||
it does not currently add another planned feature PR.
|
||
|
||
Local helper scripts and private HA-core divergence are not silently included in this
|
||
count. They remain separately secured/to be audited. Changelog/release work follows
|
||
acceptance; it is not another optimizer implementation.
|
||
|
||
## Parallel lanes
|
||
|
||
- Local PV: `feat/local-pv-main-port`, sibling worktree `EOS-pr-local-pv`.
|
||
- Tariff preparation: `fix/imported-feedin-main`, sibling `EOS-pr-feedin-main`.
|
||
- Device physics: `feat/slot-device-physics`, sibling `EOS-pr-device-physics`.
|
||
- Optimize failure correction: `fix/optimize-run-result`, sibling
|
||
`EOS-reference-optimize-main` (now a named review branch).
|
||
- Optimize compatibility tests: `test/optimize-pr-contracts`, sibling
|
||
`EOS-pr-optimize-contracts`. These are shared acceptance coverage, not necessarily
|
||
an extra standalone public PR.
|
||
- Root/integration: configuration prerequisites, shared API/algorithm contracts and
|
||
eventual combination of the tested packages.
|
||
|
||
Do not have multiple lanes independently rewrite geneticparams.py, EMS.run or the
|
||
same configuration structure. A tested tariff patch will be carried into the core
|
||
port; the core port must keep its regression cases. PV keeps the public
|
||
PVForecastAkkudoktor ID and existing remote behavior unless explicitly selected.
|
||
Parallel preparation does not imply parallel unreviewed merges or publishing all
|
||
branches. The JSON fix #1322 and subsequently the Optimize fix #1323 have publication
|
||
approval. Tariff fix #1324 was subsequently authorized and published. The user then
|
||
authorized all prepared packages: PV #1325, measurement #1326 and device physics
|
||
`#1327` are also published. The latter two target the explicit configuration comparison
|
||
branch 9038b65 pending their prerequisites. No upstream merges were performed.
|
||
|
||
## Three different Optimize contracts
|
||
|
||
1. Legacy POST `/optimize` on main explicitly runs GENETIC0, hourly. Existing payload
|
||
and legacy response aliases must keep working regardless of configured default.
|
||
2. Automatic EMS with `ems.mode=OPTIMIZATION` selects `optimization.algorithm`:
|
||
GENETIC or GENETIC0. Preparation and solution conversion are asynchronous.
|
||
PREDICTION and DISABLED must not accidentally run optimization or dispatch controls.
|
||
3. The feature worktree's LOCAL POST `/v1/optimize` and ConfigOptimizationRequest are
|
||
not present on main/integration yet. They must be adapted to current maps,
|
||
converters and algorithm-specific settings. Old feature `/optimize` meant a
|
||
different optimizer; clients need explicit migration, not a silent route switch.
|
||
|
||
Current blockers: GENETIC.prepare still forces interval_sec to 3600 and EMS start
|
||
alignment floors to the hour. Fifteen-minute device tests do not prove quarter-hour
|
||
Optimize-mode support. The core package must change preparation, slot alignment,
|
||
optimization and response metadata together.
|
||
|
||
Confirmed on unchanged main 4a37244: after a failed explicit optimization, the HTTP
|
||
route returned the previous stored solution with HTTP 200. Conversion errors could
|
||
also publish a new native result alongside an old generic result/plan. The local
|
||
fix prepares all three before publishing and returns the successful current-run
|
||
result directly to the route. Errors retain the previous coherent trio, restore
|
||
IDLE and do not dispatch controls for that failed optimization. Strict passing
|
||
regression tests replace the initial expected-failure audit cases.
|
||
|
||
## Shared acceptance before dependent PRs can land
|
||
|
||
<!-- pyml disable line-length -->
|
||
| Area | Required combined check |
|
||
| --- | --- |
|
||
| Routing | Legacy /optimize remains GENETIC0; automatic mode selects the configured algorithm; the new explicit API selects GENETIC deliberately |
|
||
| Configuration | Stable device IDs/maps and converters, runtime changes retained, old aliases migrated without losing values |
|
||
| Time | 900/3600-second slots, non-hour-aligned start and advancing warmstart, timezone/DST boundaries, matching output timestamps |
|
||
| Units | PV/load predictions are W; integrate once to slot Wh. `feed_in_tariff_wh` and `elecprice_marketprice_wh` already yield amount/Wh; convert amount/kWh configuration exactly once |
|
||
| Tariffs | Positive/zero/negative/imported revenue remains distinct from purchase cost; missing or invalid imported data does not silently become demo data |
|
||
| Devices | SOC/energy balance, charge/discharge and inverter limits, allowed/blocked battery export |
|
||
| Consumers | Feature profiles/deadlines and #1256 per-cycle windows/gaps both preserved; impossible schedules fail explicitly |
|
||
| Results | Raw algorithm result, generic optimization solution, execution plan and on-demand PDF agree on slots and device IDs |
|
||
| Errors | Failed preparation/optimization produces no new control dispatch and no misleading fresh-success response using old results |
|
||
<!-- pyml enable line-length -->
|
||
|
||
A passing individual PR is insufficient: after combining dependent packages, run
|
||
these synthetic end-to-end API cases together with the GENETIC0 regression suite.
|
||
No device control, HA deployment or production configuration is part of this work.
|
||
|
||
## Completed combined check
|
||
|
||
Integration source checkpoint b684748 combines tariff b2a4e2f, Optimize fix 8ed65ec,
|
||
device/cache corrections be184a6 and 38eb4ad, and local PV 84abe05, on the refreshed
|
||
configuration base. The combined API failure/algorithm-selection, tariff, cache,
|
||
battery/inverter, PV, configuration/migration and both optimizer test selection
|
||
passed: **277 passed, 3 regular skips**. No expected-failure markers were used to
|
||
hide Optimize defects. XML: private backup integration-parallel-compatibility.xml.
|
||
The complete measurement/channel/energy/household/capacity selection additionally
|
||
passed **132 tests** on this combined source checkpoint, including JSON persistence.
|
||
|
||
This is local Windows/Python 3.11 verification, not full pinned CI or acceptance of
|
||
the pending new GENETIC. The wider standalone PV suite separately reproduced an
|
||
existing Windows file-timestamp test failure on unchanged main; that test was
|
||
explicitly excluded from its reported 164-passing selection. Forecast retention
|
||
does not establish complete horizon coverage; that remains a core-port gate.
|