c8e3016fd6
- Implement `sigen_daemon.py` to poll Sigenergy plant metrics and store snapshots. - Create `web_daemon.py` for serving a web interface with various endpoints. - Add debug scripts: - `debug_duplicates.py` to find duplicate target times in forecast data. - `debug_energy_forecast.py` to print baseline energy forecast curves. - `debug_oracle_evaluations.py` to run the oracle evaluator. - `debug_sigen.py` to inspect stored Sigenergy plant snapshots. - `debug_weather.py` to trace resolved truth data. - `modbus_test.py` for exploring Sigenergy plants or inverters over Modbus TCP. - Introduce `oracle_evaluator.py` for evaluating stored oracle predictions against actuals. - Add TCN training scripts in `tcn` directory for training usage sequence models.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from gibil.classes.models import PowerForecastRun
|
|
from gibil.classes.oracle.config import EnergyForecastConfig
|
|
from gibil.classes.predictors.usage_daily import DailyUsageOracle
|
|
from gibil.classes.sigen.store import SigenStore
|
|
|
|
|
|
class SequenceUsageOracle:
|
|
"""Forecasts load from recent sequence state when a trained model exists."""
|
|
|
|
model_version = "sequence_usage_tcn_v1"
|
|
|
|
def __init__(
|
|
self,
|
|
sigen_store: SigenStore,
|
|
config: EnergyForecastConfig,
|
|
) -> None:
|
|
self.sigen_store = sigen_store
|
|
self.config = config
|
|
self.fallback = DailyUsageOracle(sigen_store=sigen_store, config=config)
|
|
|
|
def forecast(
|
|
self,
|
|
target_times: list[datetime],
|
|
issued_at: datetime | None = None,
|
|
) -> PowerForecastRun:
|
|
# The sequence model scaffold is present, but production should remain
|
|
# deterministic until we have a trained artifact and evaluation history.
|
|
return self.fallback.forecast(target_times=target_times, issued_at=issued_at)
|