2024-02-18 15:07:20 +01:00
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
|
|
|
2024-02-18 21:28:02 +01:00
|
|
|
def visualisiere_ergebnisse(last,leistung_haushalt,leistung_wp, pv_forecast, strompreise, ergebnisse):
|
2024-03-03 10:03:32 +01:00
|
|
|
|
|
|
|
#print(last)
|
2024-02-18 15:07:20 +01:00
|
|
|
|
2024-03-03 10:03:32 +01:00
|
|
|
|
|
|
|
stunden = np.arange(1, len(last)+1) # 1 bis 24 Stunden
|
2024-02-18 15:07:20 +01:00
|
|
|
# Last und PV-Erzeugung
|
|
|
|
plt.figure(figsize=(14, 10))
|
|
|
|
|
|
|
|
plt.subplot(3, 1, 1)
|
|
|
|
plt.plot(stunden, last, label='Last (Wh)', marker='o')
|
2024-02-18 21:28:02 +01:00
|
|
|
plt.plot(stunden, leistung_haushalt, label='leistung_haushalt (Wh)', marker='o')
|
|
|
|
plt.plot(stunden, leistung_wp, label='leistung_wp (Wh)', marker='o')
|
2024-02-18 15:07:20 +01:00
|
|
|
plt.plot(stunden, pv_forecast, label='PV-Erzeugung (Wh)', marker='x')
|
|
|
|
plt.title('Last und PV-Erzeugung')
|
|
|
|
plt.xlabel('Stunde des Tages')
|
|
|
|
plt.ylabel('Energie (Wh)')
|
|
|
|
plt.legend()
|
|
|
|
plt.grid(True)
|
|
|
|
|
|
|
|
# Strompreise
|
2024-02-25 16:47:28 +01:00
|
|
|
stundenp = np.arange(1, len(strompreise)+1)
|
2024-02-18 15:07:20 +01:00
|
|
|
plt.subplot(3, 1, 2)
|
2024-02-25 16:47:28 +01:00
|
|
|
plt.plot(stundenp, strompreise, label='Strompreis (€/Wh)', color='purple', marker='s')
|
2024-02-18 15:07:20 +01:00
|
|
|
plt.title('Strompreise')
|
|
|
|
plt.xlabel('Stunde des Tages')
|
2024-02-18 21:28:02 +01:00
|
|
|
plt.ylabel('Preis (€/Wh)')
|
2024-02-18 15:07:20 +01:00
|
|
|
plt.legend()
|
|
|
|
plt.grid(True)
|
|
|
|
|
|
|
|
|
|
|
|
plt.figure(figsize=(18, 12))
|
2024-02-25 16:47:28 +01:00
|
|
|
stunden = np.arange(1, len(ergebnisse['Eigenverbrauch_Wh_pro_Stunde'])+1)
|
2024-02-18 15:07:20 +01:00
|
|
|
# Eigenverbrauch, Netzeinspeisung und Netzbezug
|
|
|
|
plt.subplot(3, 2, 1)
|
|
|
|
plt.plot(stunden, ergebnisse['Eigenverbrauch_Wh_pro_Stunde'], label='Eigenverbrauch (Wh)', marker='o')
|
|
|
|
plt.plot(stunden, ergebnisse['Netzeinspeisung_Wh_pro_Stunde'], label='Netzeinspeisung (Wh)', marker='x')
|
|
|
|
plt.plot(stunden, ergebnisse['akku_soc_pro_stunde'], label='Akku (%)', marker='x')
|
|
|
|
plt.plot(stunden, ergebnisse['Netzbezug_Wh_pro_Stunde'], label='Netzbezug (Wh)', marker='^')
|
2024-02-25 16:47:28 +01:00
|
|
|
#plt.plot(stunden, pv_forecast, label='PV-Erzeugung (Wh)', marker='x')
|
|
|
|
#plt.plot(stunden, last, label='Last (Wh)', marker='o')
|
2024-02-18 15:07:20 +01:00
|
|
|
|
|
|
|
plt.title('Energiefluss pro Stunde')
|
|
|
|
plt.xlabel('Stunde')
|
|
|
|
plt.ylabel('Energie (Wh)')
|
|
|
|
plt.legend()
|
|
|
|
plt.grid(True)
|
|
|
|
|
|
|
|
# Kosten und Einnahmen pro Stunde
|
|
|
|
plt.subplot(3, 2, 2)
|
|
|
|
plt.plot(stunden, ergebnisse['Kosten_Euro_pro_Stunde'], label='Kosten (Euro)', marker='o', color='red')
|
|
|
|
plt.plot(stunden, ergebnisse['Einnahmen_Euro_pro_Stunde'], label='Einnahmen (Euro)', marker='x', color='green')
|
|
|
|
plt.title('Finanzielle Bilanz pro Stunde')
|
|
|
|
plt.xlabel('Stunde')
|
|
|
|
plt.ylabel('Euro')
|
|
|
|
plt.legend()
|
|
|
|
plt.grid(True)
|
|
|
|
|
|
|
|
# Zusammenfassende Finanzen
|
|
|
|
plt.subplot(3, 2, 3)
|
|
|
|
gesamtkosten = ergebnisse['Gesamtkosten_Euro']
|
2024-02-18 15:53:29 +01:00
|
|
|
gesamteinnahmen = ergebnisse['Gesamteinnahmen_Euro']
|
|
|
|
gesamtbilanz = ergebnisse['Gesamtbilanz_Euro']
|
|
|
|
plt.bar('GesamtKosten', gesamtkosten, color='red' if gesamtkosten > 0 else 'green')
|
|
|
|
plt.bar('GesamtEinnahmen', gesamteinnahmen, color='red' if gesamtkosten > 0 else 'green')
|
|
|
|
plt.bar('GesamtBilanz', gesamtbilanz, color='red' if gesamtkosten > 0 else 'green')
|
|
|
|
|
2024-02-18 15:07:20 +01:00
|
|
|
plt.title('Gesamtkosten')
|
|
|
|
plt.ylabel('Euro')
|
|
|
|
|
|
|
|
|
|
|
|
plt.legend()
|
|
|
|
plt.grid(True)
|
|
|
|
|
|
|
|
plt.tight_layout()
|
|
|
|
plt.show()
|
2024-02-18 15:53:29 +01:00
|
|
|
|