Definition of run.py

This commit is contained in:
2026-07-19 20:34:48 +00:00
parent 81eb7fdabe
commit e2a01bb0e0

101
run.py Normal file
View File

@@ -0,0 +1,101 @@
from datetime import datetime
from pvsim.simulator import (
PVSimulator,
SimulationConfig,
)
from pvsim.exporter import (
SimulationExporter,
)
from pvsim.statistics import (
SimulationStatistics,
)
# ============================================================
# SIMULAZIONE
# ============================================================
config = SimulationConfig(
start=datetime(
2026,
6,
21,
0,
0,
),
end=datetime(
2026,
6,
22,
0,
0,
),
timestep_minutes=5,
generate_random_faults=True,
)
result = simulator.run(
config
)
# ============================================================
# STATISTICS
# ============================================================
statistics = SimulationStatistics(
result
)
kpi = statistics.plant_kpi()
print(
"Energia prodotta:",
kpi.energy_kWh,
"kWh"
)
print(
"Potenza massima:",
kpi.peak_power_W,
"W"
)
# ============================================================
# EXPORT
# ============================================================
exporter = SimulationExporter(
"output"
)
exporter.export_all(
result,
csv=True,
parquet=True,
json=True,
statistics=True,
)