From 992e814dc3431a3e05c9fe31c83848fc8390a583 Mon Sep 17 00:00:00 2001 From: ChriKo97 Date: Sat, 25 Oct 2025 13:27:48 +0200 Subject: [PATCH 1/3] Add missing package to pyproject --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 701a01d..f996d59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ dependencies = [ "fine >=2.4.1", "pyomo >=6.8.0", "pgeocode >=0.5.0", + "statsmodels >=0.14.5", "highspy", "gurobipy", "argcomplete", From 3cd491e66d3e17d16e4396b562519aef8ed0bbed Mon Sep 17 00:00:00 2001 From: ChriKo97 Date: Sat, 25 Oct 2025 13:30:11 +0200 Subject: [PATCH 2/3] Function for plotting all analysis plots --- peakshaving_analyzer/input.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/peakshaving_analyzer/input.py b/peakshaving_analyzer/input.py index c437805..4d4db62 100644 --- a/peakshaving_analyzer/input.py +++ b/peakshaving_analyzer/input.py @@ -87,6 +87,12 @@ def timeseries_to_df(self): return df + def plot_analysis(self): + self.plot_load_box() + self.plot_load_histogram() + self.plot_load_duration_curve() + self.plot_seasonal_decompose() + def plot_load_duration_curve(self): ts_df = self.timeseries_to_df() From f0e6a957c9d24ec257e0283c0e114542f54dc894 Mon Sep 17 00:00:00 2001 From: ChriKo97 Date: Sat, 25 Oct 2025 13:44:50 +0200 Subject: [PATCH 3/3] Calculation of statistics --- peakshaving_analyzer/input.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/peakshaving_analyzer/input.py b/peakshaving_analyzer/input.py index 4d4db62..f1e5d12 100644 --- a/peakshaving_analyzer/input.py +++ b/peakshaving_analyzer/input.py @@ -87,6 +87,24 @@ def timeseries_to_df(self): return df + def calculate_statistics(self, print: bool = False) -> dict[str, float]: + ts_df = self.timeseries_to_df() + stats = {} + + stats["min_load_kw"] = ts_df["consumption_kw"].min() + stats["max_load_kw"] = ts_df["consumption_kw"].max() + stats["mean_load_kw"] = ts_df["consumption_kw"].mean() + stats["median_load_kw"] = ts_df["consumption_kw"].median() + stats["variance"] = ts_df["consumption_kw"].var() + stats["std"] = ts_df["consumption_kw"].std() + stats["total_consumption_kwh"] = ts_df["consumption_kw"].sum() * self.hours_per_timestep + + if print: + for key, value in stats.items(): + print(f"{key}: {value}") + + return stats + def plot_analysis(self): self.plot_load_box() self.plot_load_histogram()