mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-10-13 09:31:56 +00:00
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>
This commit is contained in:
committed by
Andreas
co-authored by
Christin
Normann
parent
0a3ced689c
commit
4b332d4c8a
@@ -10,6 +10,7 @@ forecasts, and fallback defaults, preparing them for optimization runs.
|
||||
|
||||
from typing import Optional, Union
|
||||
|
||||
import numpy as np
|
||||
from loguru import logger
|
||||
from pydantic import (
|
||||
AliasChoices,
|
||||
@@ -516,8 +517,29 @@ class GeneticOptimizationParameters(
|
||||
interval=interval,
|
||||
fill_method="ffill",
|
||||
)
|
||||
# Prediction records already contain amount/Wh; only fixed-provider
|
||||
# configuration is expressed in amount/kWh. Preserve signs and units.
|
||||
if cls.config.feedintariff.provider == "FeedInTariffImport":
|
||||
if array.ndim != 1 or len(array) != len(pvforecast_ac_power):
|
||||
raise ValueError(
|
||||
"Imported feed-in tariff length does not match the forecast horizon"
|
||||
)
|
||||
if not np.isfinite(array).all():
|
||||
raise ValueError(
|
||||
"Imported feed-in tariff contains missing or non-finite values"
|
||||
)
|
||||
feed_in_tariff_wh = array.tolist()
|
||||
except Exception as e:
|
||||
if cls.config.feedintariff.provider == "FeedInTariffImport":
|
||||
# An external EMS supplies the resolved sale revenue. Replacing
|
||||
# missing imports with demo or purchase prices changes the economics.
|
||||
logger.error(
|
||||
"Cannot prepare GENETIC parameters: FeedInTariffImport revenue is "
|
||||
"unavailable or invalid; keeping the configured provider and "
|
||||
"canceling optimization: {}",
|
||||
e,
|
||||
)
|
||||
return None
|
||||
logger.info(
|
||||
"No feed in tariff forecast data available - defaulting to demo data. Parameter preparation attempt {}: {}",
|
||||
attempt,
|
||||
|
||||
Reference in New Issue
Block a user