An interactive Shiny for Python application for simulating photovoltaic plant performance under fault conditions, soiling, and measurement noise. Built on pvlib and the Sandia Array Performance Model (SAPM).
| Tab | Description |
|---|---|
| 1 · Config & Layout | Configure equipment, site location, and array layout; visualize the field layout colored by inverter, combiner, tracker, or fault status |
| 2 · Faults | Add, edit, and delete tracker stalls and inverter outages using a click-to-select table; apply an HSU soiling profile from air quality data |
| 3 · Weather | Inspect the weather input file (irradiance, temperature, wind) |
| 4 · Simulation | Run the SAPM string-level power simulation; explore time series and annual energy distributions |
| 5 · Noise | Generate spatiotemporal measurement noise (slow/medium/fast components) and overlay it on simulation results |
| 6 · SCADA | Aggregate string results to inverter / combiner / tracker SCADA signals; browse, plot, and download CSVs |
- Python 3.10+
- pvlib
- Shiny for Python
- numpy, pandas, matplotlib, scipy
Install dependencies:
pip install pvlib shiny numpy pandas matplotlib scipyshiny run app.pyThen open the URL printed in the terminal (typically http://127.0.0.1:8000).
pv_fault_simulator/
├── app.py # Main Shiny application
├── config.py # Plant configuration (equipment, layout, site, faults)
├── main.py # Equipment loading and array construction
├── plant_design_functions.py # SAPM simulation and SCADA signal generation
├── noise_generator.py # Spatiotemporal noise generation
├── hsu_soiling.py # HSU soiling model reference code
├── combined_air_quality_2021.csv # Hourly PM2.5, PM10, and rainfall data
├── weather_5m.csv # 5-minute weather data (GHI, DNI, DHI, temp, wind)
├── SNL_logo.jpeg # Navbar logo
└── Baseline_SAPM.ipynb # Original analysis notebook
Edit config.py to set default equipment, layout, site coordinates, and fault scenarios — or use the 1 · Config & Layout tab and click Save to config.py.
Key settings:
WEATHER_FILE = "weather_5m.csv"
MODULE_NAME = "Sandia module name"
INVERTER_NAME = "Sandia inverter name"
ARRAY_DICT = {
"number_inverters": 2,
"combiners_per_inverter": 4,
"trackers_per_combiner": 4,
"strings_per_tracker": 2,
...
}
SITE_DICT = {"latitude": 35.05, "longitude": -106.54, "altitude": 1500}
TRACKER_STALLS = [
{"inverter_number": 1, "combiner_number": 2, "tracker_number": 3,
"start_time": "2021-06-01 08:00:00 -07:00", "duration_hrs": 4},
]
INVERTER_OUTAGES = [
{"inverter_number": 1, "start_time": "2021-01-15 00:00:00 -07:00", "duration_hrs": 24},
]The app uses the pvlib HSU soiling model. Provide a combined air quality CSV with columns for datetime, PM2.5, PM10, and rainfall:
TmStamp,PM2_5,PM10,Rainfall_mm
2021-01-01 00:00:00-07:00,12.3,28.1,0.0
...
The Edit Air Quality Data panel lets you scale PM values or insert rain events over any date range to simulate soiling scenarios without modifying the source file.
Measurement noise is generated as a superposition of three spatiotemporal components:
- Slow — long spatial and temporal correlation (soiling gradients, degradation)
- Medium — moderate correlation (cloud shadows, temperature gradients)
- Fast — uncorrelated white noise (sensor measurement error)
Each component is generated on a spatial grid via FFT-based filtering and interpolated to string locations.
- Config & Layout — set up your plant and verify the field layout
- Faults — define tracker stalls, inverter outages, and/or a soiling profile
- Weather — confirm the weather file looks correct
- Simulation — run the SAPM; re-run whenever faults change (staleness warning shown)
- Noise — generate and overlay measurement noise on simulation results
- SCADA — generate aggregated signals and download CSVs for further analysis
