feat: rename genetic optimization API fields to English (#675)
Some checks failed
Bump Version / Bump Version Workflow (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled

Rename the German field names of the genetic optimization API to
English with full backward compatibility:

- English names are canonical and documented in the OpenAPI schema;
  the German names are still accepted on input via validation aliases
  and re-emitted in responses as deprecated computed fields
- fix visualization receiving the raw German-keyed simulation dict
  (KeyError: load_wh_per_hour)
- rename internal German identifiers (optimize_ems, total_balance,
  battery_residual_value, self_consumption, extra_data keys)
- use amount instead of currency/euro in chart labels and schema
  descriptions; document currency handling (whole currency units,
  never cents) in the API description
- regenerate openapi.json and generated docs

Co-authored-by: Tobias Welz <tobias.wizneteu@gmail.com>
This commit is contained in:
7tobias
2026-07-18 02:08:25 -04:00
committed by GitHub
parent a0febef6a7
commit 6933b33542
25 changed files with 690 additions and 264 deletions

View File

@@ -148,22 +148,22 @@ async def prepare_optimization_real_parameters() -> GeneticOptimizationParameter
)
print(f"temperature_forecast: {temperature_forecast}")
# Electricity Price (in Euro per Wh)
strompreis_euro_pro_wh = await prediction_eos.key_to_array(
# Electricity price (per Wh)
electricity_price_per_wh = await prediction_eos.key_to_array(
key="elecprice_marketprice_wh",
start_datetime=prediction_eos.ems_start_datetime,
end_datetime=prediction_eos.end_datetime,
fill_method="ffill",
)
print(f"strompreis_euro_pro_wh: {strompreis_euro_pro_wh}")
print(f"electricity_price_per_wh: {electricity_price_per_wh}")
# Overall System Load (in W)
gesamtlast = await prediction_eos.key_to_array(
total_load = await prediction_eos.key_to_array(
key="load_mean",
start_datetime=prediction_eos.ems_start_datetime,
end_datetime=prediction_eos.end_datetime,
)
print(f"gesamtlast: {gesamtlast}")
print(f"total_load: {total_load}")
# Start Solution (binary)
start_solution = None
@@ -173,11 +173,11 @@ async def prepare_optimization_real_parameters() -> GeneticOptimizationParameter
return GeneticOptimizationParameters(
**{
"ems": {
"preis_euro_pro_wh_akku": 0e-05,
"einspeiseverguetung_euro_pro_wh": 7e-05,
"gesamtlast": gesamtlast,
"pv_prognose_wh": pv_forecast,
"strompreis_euro_pro_wh": strompreis_euro_pro_wh,
"price_per_wh_battery": 0e-05,
"feed_in_tariff_per_wh": 7e-05,
"total_load": total_load,
"pv_forecast_wh": pv_forecast,
"electricity_price_per_wh": electricity_price_per_wh,
},
"pv_akku": {
"device_id": "battery 1",
@@ -304,14 +304,14 @@ def prepare_optimization_parameters() -> GeneticOptimizationParameters:
17.4,
]
# Electricity Price (in Euro per Wh)
strompreis_euro_pro_wh = np.full(48, 0.001)
strompreis_euro_pro_wh[0:10] = 0.00001
strompreis_euro_pro_wh[11:15] = 0.00005
strompreis_euro_pro_wh[20] = 0.00001
# Electricity price (per Wh)
electricity_price_per_wh = np.full(48, 0.001)
electricity_price_per_wh[0:10] = 0.00001
electricity_price_per_wh[11:15] = 0.00005
electricity_price_per_wh[20] = 0.00001
# Overall System Load (in W)
gesamtlast = [
total_load = [
676.71,
876.19,
527.13,
@@ -369,11 +369,11 @@ def prepare_optimization_parameters() -> GeneticOptimizationParameters:
return GeneticOptimizationParameters(
**{
"ems": {
"preis_euro_pro_wh_akku": 0e-05,
"einspeiseverguetung_euro_pro_wh": 7e-05,
"gesamtlast": gesamtlast,
"pv_prognose_wh": pv_forecast,
"strompreis_euro_pro_wh": strompreis_euro_pro_wh,
"price_per_wh_battery": 0e-05,
"feed_in_tariff_per_wh": 7e-05,
"total_load": total_load,
"pv_forecast_wh": pv_forecast,
"electricity_price_per_wh": electricity_price_per_wh,
},
"pv_akku": {
"device_id": "battery 1",