mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-09-16 00:41:15 +00:00
Tests for class_load_container v2 (#247)
* Tests for class_load_container v2 - file as same name as class - useless numpy conversations removed - switched to built-in type tests - human readable tests included * ruff * removed dupicate empty list * load_aggregator: collections.abc.Sequence --------- Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com>
This commit is contained in:
@@ -23,7 +23,7 @@ from akkudoktoreos.optimization.genetic import (
|
||||
)
|
||||
|
||||
# Still to be adapted
|
||||
from akkudoktoreos.prediction.load_container import Gesamtlast
|
||||
from akkudoktoreos.prediction.load_aggregator import LoadAggregator
|
||||
from akkudoktoreos.prediction.load_corrector import LoadPredictionAdjuster
|
||||
from akkudoktoreos.prediction.load_forecast import LoadForecast
|
||||
from akkudoktoreos.prediction.prediction import get_prediction
|
||||
@@ -160,14 +160,13 @@ def fastapi_gesamtlast(request: GesamtlastRequest) -> list[float]:
|
||||
future_predictions = adjuster.predict_next_hours(hours)
|
||||
|
||||
leistung_haushalt = future_predictions["Adjusted Pred"].to_numpy()
|
||||
gesamtlast = Gesamtlast(prediction_hours=hours)
|
||||
gesamtlast.hinzufuegen(
|
||||
gesamtlast = LoadAggregator(prediction_hours=hours)
|
||||
gesamtlast.add_load(
|
||||
"Haushalt",
|
||||
leistung_haushalt,
|
||||
tuple(leistung_haushalt),
|
||||
)
|
||||
|
||||
last = gesamtlast.gesamtlast_berechnen()
|
||||
return last.tolist()
|
||||
return gesamtlast.calculate_total_load()
|
||||
|
||||
|
||||
@app.get("/gesamtlast_simple")
|
||||
@@ -183,8 +182,10 @@ def fastapi_gesamtlast_simple(year_energy: float) -> list[float]:
|
||||
)[0] # Get expected household load for the date range
|
||||
|
||||
prediction_hours = config_eos.prediction_hours if config_eos.prediction_hours else 48
|
||||
gesamtlast = Gesamtlast(prediction_hours=prediction_hours) # Create Gesamtlast instance
|
||||
gesamtlast.hinzufuegen("Haushalt", leistung_haushalt) # Add household to total load calculation
|
||||
gesamtlast = LoadAggregator(prediction_hours=prediction_hours) # Create Gesamtlast instance
|
||||
gesamtlast.add_load(
|
||||
"Haushalt", tuple(leistung_haushalt)
|
||||
) # Add household to total load calculation
|
||||
|
||||
# ###############
|
||||
# # WP (Heat Pump)
|
||||
@@ -192,8 +193,7 @@ def fastapi_gesamtlast_simple(year_energy: float) -> list[float]:
|
||||
# leistung_wp = wp.simulate_24h(temperature_forecast) # Simulate heat pump load for 24 hours
|
||||
# gesamtlast.hinzufuegen("Heatpump", leistung_wp) # Add heat pump load to total load calculation
|
||||
|
||||
last = gesamtlast.gesamtlast_berechnen() # Calculate total load
|
||||
return last.tolist() # Return total load as JSON
|
||||
return gesamtlast.calculate_total_load()
|
||||
|
||||
|
||||
class ForecastResponse(PydanticBaseModel):
|
||||
|
Reference in New Issue
Block a user