101 lines
1.3 KiB
Python
101 lines
1.3 KiB
Python
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,
|
|
) |