mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-25 06:52:23 +00:00
Wärmepumpen Klasse für meine WP erzeugt (Achtung Standard)
PV Prognose aufsummieren der Strings eingebaut
This commit is contained in:
@@ -3,7 +3,7 @@ from datetime import datetime, timedelta, timezone
|
||||
import numpy as np
|
||||
from pprint import pprint
|
||||
|
||||
# Lade die .npz-Datei beim Start der Anwendung
|
||||
|
||||
class Waermepumpe:
|
||||
def __init__(self, max_heizleistung, prediction_hours):
|
||||
self.max_heizleistung = max_heizleistung
|
||||
@@ -21,9 +21,11 @@ class Waermepumpe:
|
||||
return heizleistung
|
||||
|
||||
def elektrische_leistung_berechnen(self, aussentemperatur):
|
||||
heizleistung = self.heizleistung_berechnen(aussentemperatur)
|
||||
cop = self.cop_berechnen(aussentemperatur)
|
||||
return heizleistung / cop
|
||||
#heizleistung = self.heizleistung_berechnen(aussentemperatur)
|
||||
#cop = self.cop_berechnen(aussentemperatur)
|
||||
|
||||
return 1164 -77.8*aussentemperatur + 1.62*aussentemperatur**2.0
|
||||
#1253.0*np.math.pow(aussentemperatur,-0.0682)
|
||||
|
||||
def simulate_24h(self, temperaturen):
|
||||
leistungsdaten = []
|
||||
@@ -37,6 +39,40 @@ class Waermepumpe:
|
||||
leistungsdaten.append(elektrische_leistung)
|
||||
return leistungsdaten
|
||||
|
||||
# # Lade die .npz-Datei beim Start der Anwendung
|
||||
# class Waermepumpe:
|
||||
# def __init__(self, max_heizleistung, prediction_hours):
|
||||
# self.max_heizleistung = max_heizleistung
|
||||
# self.prediction_hours = prediction_hours
|
||||
|
||||
# def cop_berechnen(self, aussentemperatur):
|
||||
# cop = 3.0 + (aussentemperatur-0) * 0.1
|
||||
# return max(cop, 1)
|
||||
|
||||
|
||||
# def heizleistung_berechnen(self, aussentemperatur):
|
||||
# #235.092 kWh + Temperatur * -11.645
|
||||
# heizleistung = (((235.0) + aussentemperatur*(-11.645))*1000)/24.0
|
||||
# heizleistung = min(self.max_heizleistung,heizleistung)
|
||||
# return heizleistung
|
||||
|
||||
# def elektrische_leistung_berechnen(self, aussentemperatur):
|
||||
# heizleistung = self.heizleistung_berechnen(aussentemperatur)
|
||||
# cop = self.cop_berechnen(aussentemperatur)
|
||||
# return heizleistung / cop
|
||||
|
||||
# def simulate_24h(self, temperaturen):
|
||||
# leistungsdaten = []
|
||||
|
||||
# # Überprüfen, ob das Temperaturarray die richtige Größe hat
|
||||
# if len(temperaturen) != self.prediction_hours:
|
||||
# raise ValueError("Das Temperaturarray muss genau "+str(self.prediction_hours)+" Einträge enthalten, einen für jede Stunde des Tages.")
|
||||
|
||||
# for temp in temperaturen:
|
||||
# elektrische_leistung = self.elektrische_leistung_berechnen(temp)
|
||||
# leistungsdaten.append(elektrische_leistung)
|
||||
# return leistungsdaten
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -52,16 +52,35 @@ class PVForecast:
|
||||
|
||||
def process_data(self, data):
|
||||
self.meta = data.get('meta', {})
|
||||
values = data.get('values', [])[0]
|
||||
for value in values:
|
||||
all_values = data.get('values', [])
|
||||
|
||||
# Berechnung der Summe der DC- und AC-Leistungen für jeden Zeitstempel
|
||||
for i in range(len(all_values[0])): # Annahme, dass alle Listen gleich lang sind
|
||||
sum_dc_power = sum(values[i]['dcPower'] for values in all_values)
|
||||
sum_ac_power = sum(values[i]['power'] for values in all_values)
|
||||
|
||||
# Erstellen eines ForecastData-Objekts mit den summierten Werten
|
||||
forecast = ForecastData(
|
||||
date_time=value.get('datetime'),
|
||||
dc_power=value.get('dcPower'),
|
||||
ac_power=value.get('power'),
|
||||
windspeed_10m=value.get('windspeed_10m'),
|
||||
temperature=value.get('temperature')
|
||||
date_time=all_values[0][i].get('datetime'),
|
||||
dc_power=sum_dc_power,
|
||||
ac_power=sum_ac_power,
|
||||
# Optional: Weitere Werte wie Windspeed und Temperature, falls benötigt
|
||||
windspeed_10m=all_values[0][i].get('windspeed_10m'),
|
||||
temperature=all_values[0][i].get('temperature')
|
||||
)
|
||||
self.forecast_data.append(forecast)
|
||||
|
||||
self.forecast_data.append(forecast)
|
||||
|
||||
# values = data.get('values', [])[0]
|
||||
# for value in values:
|
||||
# forecast = ForecastData(
|
||||
# date_time=value.get('datetime'),
|
||||
# dc_power=value.get('dcPower'),
|
||||
# ac_power=value.get('power'),
|
||||
# windspeed_10m=value.get('windspeed_10m'),
|
||||
# temperature=value.get('temperature')
|
||||
# )
|
||||
# self.forecast_data.append(forecast)
|
||||
|
||||
def load_data_from_file(self, filepath):
|
||||
with open(filepath, 'r') as file:
|
||||
|
@@ -3,7 +3,7 @@ from modules.class_load_container import Gesamtlast # Stellen Sie sicher, dass
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def visualisiere_ergebnisse(gesamtlast,leistung_haushalt,leistung_wp, pv_forecast, strompreise, ergebnisse, soc_eauto, discharge_hours, laden_moeglich):
|
||||
def visualisiere_ergebnisse(gesamtlast,leistung_haushalt,leistung_wp, pv_forecast, strompreise, ergebnisse, soc_eauto, discharge_hours, laden_moeglich, temperature):
|
||||
# Last und PV-Erzeugung
|
||||
plt.figure(figsize=(14, 10))
|
||||
|
||||
@@ -70,7 +70,17 @@ def visualisiere_ergebnisse(gesamtlast,leistung_haushalt,leistung_wp, pv_forecas
|
||||
ax1.axvspan(hour, hour+1, color='green',ymax=value, alpha=0.3, label='Lademöglichkeit' if hour == 0 else "")
|
||||
ax1.legend(loc='upper left')
|
||||
|
||||
|
||||
ax1 = plt.subplot(3, 2, 6)
|
||||
ax1.plot(stunden, temperature, label='Temperatur °C', marker='x')
|
||||
|
||||
|
||||
ax2 = ax1.twinx()
|
||||
ax2.plot(stunden, leistung_wp, label='Wärmepumpe W', marker='x')
|
||||
plt.legend(loc='upper left')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
plt.grid(True)
|
||||
|
Reference in New Issue
Block a user