mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-19 08:55:15 +00:00
Heatpump
This commit is contained in:
parent
427570ccb2
commit
6c82692787
@ -68,7 +68,7 @@ class EnergieManagementSystem:
|
||||
self.akku.energie_laden(geladene_energie)
|
||||
netzeinspeisung_wh_pro_stunde.append(überschuss - geladene_energie)
|
||||
eigenverbrauch_wh_pro_stunde.append(verbrauch)
|
||||
stündliche_einnahmen_euro = (überschuss - geladene_energie) * self.einspeiseverguetung_cent_pro_wh[stunde] / 100
|
||||
stündliche_einnahmen_euro = (überschuss - geladene_energie) * self.einspeiseverguetung_cent_pro_wh[stunde]
|
||||
netzbezug_wh_pro_stunde.append(0.0)
|
||||
else:
|
||||
netzeinspeisung_wh_pro_stunde.append(0.0)
|
||||
@ -77,7 +77,7 @@ class EnergieManagementSystem:
|
||||
stündlicher_netzbezug_wh = benötigte_energie - aus_akku
|
||||
netzbezug_wh_pro_stunde.append(stündlicher_netzbezug_wh)
|
||||
eigenverbrauch_wh_pro_stunde.append(erzeugung)
|
||||
stündliche_kosten_euro = stündlicher_netzbezug_wh * strompreis / 100
|
||||
stündliche_kosten_euro = stündlicher_netzbezug_wh * strompreis
|
||||
akku_soc_pro_stunde.append(self.akku.ladezustand_in_prozent())
|
||||
kosten_euro_pro_stunde.append(stündliche_kosten_euro)
|
||||
einnahmen_euro_pro_stunde.append(stündliche_einnahmen_euro)
|
||||
|
55
modules/class_heatpump.py
Normal file
55
modules/class_heatpump.py
Normal file
@ -0,0 +1,55 @@
|
||||
import json
|
||||
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):
|
||||
self.max_heizleistung = max_heizleistung
|
||||
|
||||
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 = []
|
||||
for temp in temperaturen:
|
||||
elektrische_leistung = self.elektrische_leistung_berechnen(temp)
|
||||
leistungsdaten.append(elektrische_leistung)
|
||||
return leistungsdaten
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Beispiel für die Verwendung der Klasse
|
||||
if __name__ == '__main__':
|
||||
max_heizleistung = 5000 # 5 kW Heizleistung
|
||||
start_innentemperatur = 15
|
||||
isolationseffizienz = 0.8
|
||||
gewuenschte_innentemperatur = 20
|
||||
wp = Waermepumpe(max_heizleistung)
|
||||
|
||||
print(wp.cop_berechnen(-10)," ",wp.cop_berechnen(0), " ", wp.cop_berechnen(10))
|
||||
# 24 Stunden Außentemperaturen (Beispielwerte)
|
||||
temperaturen = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -5, -2, 5]
|
||||
|
||||
# Berechnung der 24-Stunden-Leistungsdaten
|
||||
leistungsdaten = wp.simulate_24h(temperaturen)
|
||||
|
||||
print(leistungsdaten)
|
@ -64,6 +64,14 @@ class PVForecast:
|
||||
|
||||
return np.array(daily_forecast)
|
||||
|
||||
def get_temperature_forecast_for_date(self, input_date_str):
|
||||
input_date = datetime.strptime(input_date_str, "%Y-%m-%d")
|
||||
daily_forecast_obj = [data for data in self.forecast_data if datetime.strptime(data.get_date_time(), "%Y-%m-%dT%H:%M:%S.%f%z").date() == input_date.date()]
|
||||
daily_forecast = []
|
||||
for d in daily_forecast_obj:
|
||||
daily_forecast.append(d.get_temperature())
|
||||
|
||||
return np.array(daily_forecast)
|
||||
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def visualisiere_ergebnisse(last, pv_forecast, strompreise, ergebnisse):
|
||||
def visualisiere_ergebnisse(last,leistung_haushalt,leistung_wp, pv_forecast, strompreise, ergebnisse):
|
||||
stunden = np.arange(1, 25) # 1 bis 24 Stunden
|
||||
|
||||
# Last und PV-Erzeugung
|
||||
@ -10,6 +10,8 @@ def visualisiere_ergebnisse(last, pv_forecast, strompreise, ergebnisse):
|
||||
|
||||
plt.subplot(3, 1, 1)
|
||||
plt.plot(stunden, last, label='Last (Wh)', marker='o')
|
||||
plt.plot(stunden, leistung_haushalt, label='leistung_haushalt (Wh)', marker='o')
|
||||
plt.plot(stunden, leistung_wp, label='leistung_wp (Wh)', marker='o')
|
||||
plt.plot(stunden, pv_forecast, label='PV-Erzeugung (Wh)', marker='x')
|
||||
plt.title('Last und PV-Erzeugung')
|
||||
plt.xlabel('Stunde des Tages')
|
||||
@ -19,10 +21,10 @@ def visualisiere_ergebnisse(last, pv_forecast, strompreise, ergebnisse):
|
||||
|
||||
# Strompreise
|
||||
plt.subplot(3, 1, 2)
|
||||
plt.plot(stunden, strompreise, label='Strompreis (Cent/Wh)', color='purple', marker='s')
|
||||
plt.plot(stunden, strompreise, label='Strompreis (€/Wh)', color='purple', marker='s')
|
||||
plt.title('Strompreise')
|
||||
plt.xlabel('Stunde des Tages')
|
||||
plt.ylabel('Preis (Cent/Wh)')
|
||||
plt.ylabel('Preis (€/Wh)')
|
||||
plt.legend()
|
||||
plt.grid(True)
|
||||
|
||||
|
27
test.py
27
test.py
@ -6,6 +6,7 @@ from modules.class_ems import *
|
||||
from modules.class_pv_forecast import *
|
||||
from modules.class_akku import *
|
||||
from modules.class_strompreis import *
|
||||
from modules.class_heatpump import *
|
||||
from pprint import pprint
|
||||
import matplotlib.pyplot as plt
|
||||
from modules.visualize import *
|
||||
@ -19,27 +20,21 @@ akku_size = 1000 # Wh
|
||||
year_energy = 2000*1000 #Wh
|
||||
einspeiseverguetung_cent_pro_wh = np.full(24, 7/1000.0)
|
||||
|
||||
max_heizleistung = 5000 # 5 kW Heizleistung
|
||||
wp = Waermepumpe(max_heizleistung)
|
||||
|
||||
akku = PVAkku(akku_size)
|
||||
discharge_array = np.full(24,1)
|
||||
# discharge_array[12] = 0
|
||||
# discharge_array[13] = 0
|
||||
# discharge_array[14] = 0
|
||||
# discharge_array[15] = 0
|
||||
# discharge_array[16] = 0
|
||||
# discharge_array[17] = 0
|
||||
# discharge_array[18] = 1
|
||||
# akku.set_discharge_per_hour(discharge_array)
|
||||
|
||||
# Load Forecast
|
||||
lf = LoadForecast(filepath=r'load_profiles.npz', year_energy=year_energy)
|
||||
specific_date_load = lf.get_daily_stats(date)[0,...] # Datum anpassen
|
||||
|
||||
pprint(specific_date_load.shape)
|
||||
leistung_haushalt = lf.get_daily_stats(date)[0,...] # Datum anpassen
|
||||
pprint(leistung_haushalt.shape)
|
||||
|
||||
# PV Forecast
|
||||
PVforecast = PVForecast(r'.\test_data\pvprognose.json')
|
||||
pv_forecast = PVforecast.get_forecast_for_date(date)
|
||||
temperature_forecast = PVforecast.get_temperature_forecast_for_date(date)
|
||||
pprint(pv_forecast.shape)
|
||||
|
||||
# Strompreise
|
||||
@ -47,9 +42,15 @@ filepath = r'.\test_data\strompreis.json' # Pfad zur JSON-Datei anpassen
|
||||
price_forecast = HourlyElectricityPriceForecast(filepath)
|
||||
specific_date_prices = price_forecast.get_prices_for_date(date)
|
||||
|
||||
# WP
|
||||
leistung_wp = wp.simulate_24h(temperature_forecast)
|
||||
# pprint(leistung_haushalt)
|
||||
# pprint(leistung_wp)
|
||||
# sys.exit()
|
||||
load = leistung_haushalt + leistung_wp
|
||||
|
||||
# EMS / Stromzähler Bilanz
|
||||
ems = EnergieManagementSystem(akku, specific_date_load, pv_forecast, specific_date_prices, einspeiseverguetung_cent_pro_wh)
|
||||
ems = EnergieManagementSystem(akku, load, pv_forecast, specific_date_prices, einspeiseverguetung_cent_pro_wh)
|
||||
o = ems.simuliere()
|
||||
pprint(o["Gesamtbilanz_Euro"])
|
||||
|
||||
@ -105,7 +106,7 @@ pprint(o["Gesamtbilanz_Euro"])
|
||||
|
||||
|
||||
|
||||
visualisiere_ergebnisse(specific_date_load, pv_forecast, specific_date_prices, o)
|
||||
visualisiere_ergebnisse(load,leistung_haushalt,leistung_wp, pv_forecast, specific_date_prices, o)
|
||||
|
||||
|
||||
# for data in forecast.get_forecast_data():
|
||||
|
Loading…
x
Reference in New Issue
Block a user