Einlesen .csv angepasst

This commit is contained in:
Patrick Hangl
2025-01-07 16:02:19 +01:00
parent ff88aacf4d
commit 210a2f9bc3

View File

@@ -1,7 +1,9 @@
# https://stackoverflow.com/questions/63511090/how-can-i-smooth-data-in-python
import numpy as np
import matplotlib.pyplot as plt
import pv_input as pv
import pandas as pd
from scipy.signal import savgol_filter
@@ -43,10 +45,10 @@ class Consumer:
self.consumption_profile = self.create_consumption_profile()
self.final_consumption = self.calculate_final_consumption()
# Vebrauchsprofil aus CSV-Datei in Dataframe einlesen und die Leistungs-Series extrahieren, Werte in Watt umrechnen und mit 4 multiplizieren, da Originalwerte 15-minütlich waren
# Vebrauchsprofil aus CSV-Datei in Dataframe einlesen und die Leistungs-Series extrahieren, Werte in Watt umrechnen
def create_consumption_profile(self):
consumption_profile = pd.read_csv('Lastprofil_final_H0.csv',delimiter=';')
return consumption_profile['Leistung']*1000*4
consumption_profile = pd.read_csv('Lastprofile_gesamt.csv',delimiter=';')
return consumption_profile['Leistung']*1000
# Verbrauchsprofil mit der Anzahl der Haushalte multiplizieren
def calculate_final_consumption(self):
@@ -63,11 +65,10 @@ class Neighborhood:
# Gesamterzeugung, Gesamtverbrauch und Nettoverbrauch plotten
def plot_consumption(self):
total_consumption = -1*(self.consumer.final_consumption + self.producer.final_consumption)
total_consumption_mean = total_consumption.rolling(168).mean()
total_production = self.producer.final_production
total_production_mean = total_production.rolling(168).mean()
net_value = total_consumption + total_production
net_value_mean = net_value.rolling(168).mean()
net_value_filtered = net_value.apply(savgol_filter, window_length=168, polyorder=2)
# X-Werte anlegen, einen Wert löschen da 8761 Werte vorhanden sind, aber nur 8760 benötigt werden
x = pd.date_range(start='2018-12-31', end ='2019-12-31', freq='1h')