Definition of run.py
This commit is contained in:
101
run.py
Normal file
101
run.py
Normal 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,
|
||||
)
|
||||
Reference in New Issue
Block a user