From e152bb0f4833b4908bfe4e058222da28984abba3 Mon Sep 17 00:00:00 2001 From: Bla Bla Date: Mon, 26 Feb 2024 17:41:00 +0100 Subject: [PATCH] Bug strompreise, ein Array Element zu wenig eingelesen (bspw. 23 statt 24) --- modules/class_ems.py | 2 +- modules/class_strompreis.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/class_ems.py b/modules/class_ems.py index b3a10de..9c77f64 100644 --- a/modules/class_ems.py +++ b/modules/class_ems.py @@ -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) diff --git a/modules/class_strompreis.py b/modules/class_strompreis.py index c7beba9..c6df994 100644 --- a/modules/class_strompreis.py +++ b/modules/class_strompreis.py @@ -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,10 +54,11 @@ 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) - + return np.array(price_list)