Awattar Price changed to more precise value; if SoC=0 discharge =1 forced. Exp Avg for siple Price Forecast

This commit is contained in:
Andreas 2024-12-25 19:12:38 +01:00
parent a126d89362
commit f89889410d

View File

@ -98,6 +98,7 @@ class HourlyElectricityPriceForecast:
# Extract the price from 00:00 of the previous day
previous_day_prices = [
entry["marketprice"] # + self.charges
entry["marketprice"] # + self.charges
for entry in self.prices
if previous_day_str in entry["end"]
@ -106,6 +107,7 @@ class HourlyElectricityPriceForecast:
# Extract all prices for the specified date
date_prices = [
entry["marketprice"] # + self.charges
entry["marketprice"] # + self.charges
for entry in self.prices
if date_str in entry["end"]
@ -117,6 +119,8 @@ class HourlyElectricityPriceForecast:
return np.array(date_prices) / (1000.0 * 1000.0) + self.charges
return np.array(date_prices) / (1000.0 * 1000.0) + self.charges
def get_average_price_last_7_days(self, end_date_str: Optional[str] = None) -> np.ndarray:
"""Calculate the hourly average electricity price for the last 7 days.
@ -164,6 +168,12 @@ class HourlyElectricityPriceForecast:
axis=0,
weights=np.array([1, 2, 4, 8, 16, 32, 64]) / np.sum(np.array([1, 2, 4, 8, 16, 32, 64])),
)
return average_prices
average_prices = np.average(
price_matrix,
axis=0,
weights=np.array([1, 2, 4, 8, 16, 32, 64]) / np.sum(np.array([1, 2, 4, 8, 16, 32, 64])),
)
final_weights = np.linspace(1, 0, price_matrix.shape[1])
# Weight last known price linear falling