Bug strompreise, ein Array Element zu wenig eingelesen (bspw. 23 statt 24)

This commit is contained in:
Bla Bla 2024-02-26 17:41:00 +01:00
parent 239ad276c9
commit e152bb0f48
2 changed files with 4 additions and 3 deletions

View File

@ -14,7 +14,7 @@ class EnergieManagementSystem:
# print("\n\nLastprognose:",self.lastkurve_wh.shape)
# print("PV Prognose:",self.pv_prognose_wh.shape)
# print("Preis Prognose:",self.strompreis_cent_pro_wh.shape)
# sys.exit()
def set_akku_discharge_hours(self, ds):
self.akku.set_discharge_per_hour(ds)

View File

@ -42,7 +42,7 @@ class HourlyElectricityPriceForecast:
def get_price_for_date(self, date_str):
"""Gibt alle Preise für das spezifizierte Datum zurück."""
date_prices = [entry["marketpriceEurocentPerKWh"] for entry in self.prices if date_str in entry['start']]
date_prices = [entry["marketpriceEurocentPerKWh"] for entry in self.prices if date_str in entry['end']]
return np.array(date_prices)/(1000.0*100.0)
def get_price_for_daterange(self, start_date_str, end_date_str):
@ -54,6 +54,7 @@ class HourlyElectricityPriceForecast:
while start_date <= end_date:
date_str = start_date.strftime("%Y-%m-%d")
daily_prices = self.get_price_for_date(date_str)
print(len(self.get_price_for_date(date_str)))
if daily_prices.size > 0:
price_list.extend(daily_prices)
start_date += timedelta(days=1)