Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ko11920/thesiscodeimplementation
1 result
Show changes
Showing
with 105168 additions and 1 deletion
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
default_page.png

187 KiB

......@@ -95,7 +95,7 @@ def plot_daily_mean_power(data):
# Main Program to run the clustering
if __name__ == "__main__":
# Load the dataset
data = pd.read_csv("/home/jvaldes/Desktop/krishna-thesis/thesiscodeimplementation/data/Autohaus 2.csv") # Replace with your dataset file
data = pd.read_csv("/home/jvaldes/Desktop/krishna-thesis/thesiscodeimplementation/data/eth_data/EFH (8).csv") # Replace with your dataset file
#df = exploratory_data_analysis(data)
plot_daily_mean_power(data)
explore_page.png

140 KiB

normalized_consumption_active_power_all_eth_dataset.jpg

728 KiB

normalized_consumption_active_power_all_fenecon_dataset.jpg

1000 KiB

normalized_ess_active_power_all_eth_dataset.jpg

1.02 MiB

normalized_ess_active_power_all_fenecon_dataset.jpg

406 KiB

normalized_grid_active_power_all_eth_dataset.jpg

777 KiB

normalized_grid_active_power_all_fenecon_dataset.jpg

628 KiB

normalized_production_active_power_all_eth_dataset.jpg

518 KiB

normalized_production_active_power_all_fenecon_dataset.jpg

1020 KiB

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import glob
import os
# Define a color palette for 12 months
months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
colors = sns.color_palette("tab10", 12)
month_color_map = dict(zip(range(1, 13), colors))
# Load all CSV files (assumed to be in the current directory)
file_paths = glob.glob("/home/jvaldes/Desktop/krishna-thesis/thesiscodeimplementation/data/fenecon_de/*.csv") # Adjust the path accordingly
plt.figure(figsize=(12, 6))
for file_idx, file_path in enumerate(file_paths):
# Load dataset
df = pd.read_csv(file_path, parse_dates=["Time"])
df["Month"] = df["Time"].dt.month
df["Hour"] = df["Time"].dt.hour
# Aggregate by hour
df_hourly = df.groupby(["Month", "Hour"])['grid active power'].mean().reset_index()
# Normalize consumption active power
df_hourly['normalized grid active power'] = df_hourly['grid active power'] / df_hourly['grid active power'].max()
# Plot each month
for month in df_hourly["Month"].unique():
subset = df_hourly[df_hourly["Month"] == month]
plt.plot(subset["Hour"], subset["normalized grid active power"], color=month_color_map[month], alpha=0.7, label=(months[month-1] if file_idx == 0 else ""))
# Formatting the plot
plt.xlabel("Hour of the Day")
plt.ylabel("normalized grid active power")
plt.title("Hourly normalized grid active power Grouped by Month")
plt.legend(title="Month", loc="upper right")
plt.grid(True)
plt.savefig("normalized_grid_active_power_all_fenecon_dataset.jpg", format="jpg", dpi=300)
plt.show()