From 2d338d535b443225ad3996ff21aa095198215936 Mon Sep 17 00:00:00 2001 From: "g.marzolla" Date: Mon, 23 Jun 2025 11:42:58 +0200 Subject: [PATCH] Aggiunta risulati orari simulazione FV --- Fotovoltaico.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Fotovoltaico.py b/Fotovoltaico.py index d9d7064..db4e598 100644 --- a/Fotovoltaico.py +++ b/Fotovoltaico.py @@ -53,6 +53,24 @@ result_ac_energies_to_csv_df = suppress_printing(simulate_unstacked_productivity result_ac_energies_to_csv_df.to_csv(path_export, encoding='utf-8') os.startfile(path_export) +def export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly): + """ + Esporta la produttività fotovoltaica aggregata su base oraria. + """ + # Raggruppa per ora e somma la produzione dei 4 quarti d'ora + df_hourly = result_ac_energies_to_csv_df.resample('H').sum() + df_hourly.to_csv(path_export_hourly, encoding='utf-8') + print(f"File CSV orario salvato in: {path_export_hourly}") + +# --- USO DELLA FUNZIONE DOPO L'EXPORT ORIGINALE --- + +# Scegli il percorso per il nuovo file orario +path_export_hourly = path_export.replace('.csv', '_hourly.csv') + +# Esporta il file orario +export_hourly_pv_productivity(result_ac_energies_to_csv_df, path_export_hourly) + + if joePlaying: joe.terminate() joe.kill() \ No newline at end of file