heliostack 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. heliostack-0.3.0/.github/workflows/ci.yml +26 -0
  2. heliostack-0.3.0/.github/workflows/publish-pypi.yml +22 -0
  3. heliostack-0.3.0/.gitignore +14 -0
  4. heliostack-0.3.0/AI_DISCLOSURE.md +17 -0
  5. heliostack-0.3.0/CITATION.cff +19 -0
  6. heliostack-0.3.0/LICENSE +21 -0
  7. heliostack-0.3.0/PKG-INFO +154 -0
  8. heliostack-0.3.0/README.md +123 -0
  9. heliostack-0.3.0/benchmarks/run_europe_benchmark.py +203 -0
  10. heliostack-0.3.0/benchmarks/run_phase2_validation.py +279 -0
  11. heliostack-0.3.0/benchmarks/run_phase3_validation.py +76 -0
  12. heliostack-0.3.0/docs/.nojekyll +0 -0
  13. heliostack-0.3.0/docs/ROADMAP_TO_NLNET_20270103.md +36 -0
  14. heliostack-0.3.0/docs/index.html +459 -0
  15. heliostack-0.3.0/fixtures/equipment/abb_trio_27_6.ond +16 -0
  16. heliostack-0.3.0/fixtures/equipment/hyundai_his_m310ti.pan +27 -0
  17. heliostack-0.3.0/fixtures/equipment/invalid_inverter.ond +9 -0
  18. heliostack-0.3.0/fixtures/equipment/invalid_module.pan +11 -0
  19. heliostack-0.3.0/fixtures/equipment/ref_250kw_inverter.ond +16 -0
  20. heliostack-0.3.0/fixtures/equipment/ref_550w_bifacial.pan +27 -0
  21. heliostack-0.3.0/fixtures/telemetry/eu_cyprus_pcoe_2015_2016_hourly.csv +8785 -0
  22. heliostack-0.3.0/fixtures/telemetry/pvdaq_2107_2024_hourly.csv +7287 -0
  23. heliostack-0.3.0/fixtures/thermal/openfoam14_pv_thermal_surrogate.json +198 -0
  24. heliostack-0.3.0/fixtures/weather/amsterdam_pvgis_tmy_2023.csv +8761 -0
  25. heliostack-0.3.0/fixtures/weather/copernicus_horizon_46.0207_7.7491.json +490 -0
  26. heliostack-0.3.0/fixtures/weather/copernicus_horizon_46.4983_11.3548.json +490 -0
  27. heliostack-0.3.0/fixtures/weather/copernicus_horizon_47.2692_11.4041.json +490 -0
  28. heliostack-0.3.0/fixtures/weather/pvgis_horizon_46.0207_7.7491.json +1 -0
  29. heliostack-0.3.0/fixtures/weather/pvgis_horizon_46.4983_11.3548.json +1 -0
  30. heliostack-0.3.0/fixtures/weather/pvgis_horizon_47.2692_11.4041.json +1 -0
  31. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_35.1800_129.0800_32.0_0.0.json +1 -0
  32. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_37.3900_-5.9800_32.0_0.0.json +1 -0
  33. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_46.0207_7.7491_35.0_0.0.json +1 -0
  34. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_46.0207_7.7491_35.0_0.0_nohor.json +1 -0
  35. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_46.4983_11.3548_34.0_0.0.json +1 -0
  36. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_46.4983_11.3548_34.0_0.0_nohor.json +1 -0
  37. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_47.2692_11.4041_35.0_0.0.json +1 -0
  38. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_47.2692_11.4041_35.0_0.0_nohor.json +1 -0
  39. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_48.1400_11.5800_35.0_0.0.json +1 -0
  40. heliostack-0.3.0/fixtures/weather/pvgis_pvcalc_52.3700_4.9000_35.0_0.0.json +1 -0
  41. heliostack-0.3.0/fixtures/weather/pvgis_tmy_35.1800_129.0800.json +1 -0
  42. heliostack-0.3.0/fixtures/weather/pvgis_tmy_37.3900_-5.9800.json +1 -0
  43. heliostack-0.3.0/fixtures/weather/pvgis_tmy_46.0207_7.7491.json +1 -0
  44. heliostack-0.3.0/fixtures/weather/pvgis_tmy_46.0207_7.7491_nohor.json +1 -0
  45. heliostack-0.3.0/fixtures/weather/pvgis_tmy_46.4983_11.3548.json +1 -0
  46. heliostack-0.3.0/fixtures/weather/pvgis_tmy_46.4983_11.3548_nohor.json +1 -0
  47. heliostack-0.3.0/fixtures/weather/pvgis_tmy_47.2692_11.4041.json +1 -0
  48. heliostack-0.3.0/fixtures/weather/pvgis_tmy_47.2692_11.4041_nohor.json +1 -0
  49. heliostack-0.3.0/fixtures/weather/pvgis_tmy_48.1400_11.5800.json +1 -0
  50. heliostack-0.3.0/fixtures/weather/pvgis_tmy_52.3700_4.9000.json +1 -0
  51. heliostack-0.3.0/openfoam/README.md +14 -0
  52. heliostack-0.3.0/openfoam/run_openfoam_pv_sweep.py +693 -0
  53. heliostack-0.3.0/pyproject.toml +79 -0
  54. heliostack-0.3.0/results/europe_benchmark_v01.json +482 -0
  55. heliostack-0.3.0/results/phase2_validation_v02.json +598 -0
  56. heliostack-0.3.0/results/phase3_validation_v03.json +388 -0
  57. heliostack-0.3.0/src/heliostack/__init__.py +4 -0
  58. heliostack-0.3.0/src/heliostack/audit.py +221 -0
  59. heliostack-0.3.0/src/heliostack/cli.py +193 -0
  60. heliostack-0.3.0/src/heliostack/data/openfoam14_pv_thermal_surrogate.json +198 -0
  61. heliostack-0.3.0/src/heliostack/ess_optimizer.py +266 -0
  62. heliostack-0.3.0/src/heliostack/formats.py +336 -0
  63. heliostack-0.3.0/src/heliostack/models.py +243 -0
  64. heliostack-0.3.0/src/heliostack/pv_engine.py +375 -0
  65. heliostack-0.3.0/src/heliostack/shading.py +210 -0
  66. heliostack-0.3.0/src/heliostack/telemetry.py +303 -0
  67. heliostack-0.3.0/src/heliostack/terrain.py +278 -0
  68. heliostack-0.3.0/src/heliostack/thermal.py +131 -0
  69. heliostack-0.3.0/src/heliostack/weather.py +197 -0
  70. heliostack-0.3.0/tests/test_audit_determinism.py +59 -0
  71. heliostack-0.3.0/tests/test_formats.py +88 -0
  72. heliostack-0.3.0/tests/test_openfoam_and_eu_field.py +71 -0
  73. heliostack-0.3.0/tests/test_pv_and_ess.py +66 -0
  74. heliostack-0.3.0/tests/test_shading.py +62 -0
  75. heliostack-0.3.0/tests/test_telemetry.py +122 -0
  76. heliostack-0.3.0/tests/test_terrain.py +88 -0
  77. heliostack-0.3.0/tests/test_thermal.py +37 -0
  78. heliostack-0.3.0/tests/test_weather.py +70 -0
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ pull_request:
7
+ branches: ["main"]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v4
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ run: uv python install ${{ matrix.python-version }}
21
+ - name: Install dependencies
22
+ run: uv sync --python ${{ matrix.python-version }} --extra dev
23
+ - name: Lint with Ruff
24
+ run: uv run --python ${{ matrix.python-version }} ruff check src tests benchmarks openfoam
25
+ - name: Run unit & benchmark offline test suite
26
+ run: uv run --python ${{ matrix.python-version }} pytest --cov=heliostack --cov-report=term-missing
@@ -0,0 +1,22 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ pypi-publish:
9
+ runs-on: ubuntu-latest
10
+ environment:
11
+ name: pypi
12
+ url: https://pypi.org/p/heliostack
13
+ permissions:
14
+ id-token: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: astral-sh/setup-uv@v4
19
+ - name: Build wheel and sdist
20
+ run: uv build
21
+ - name: Publish via PyPI Trusted Publisher (OIDC)
22
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ .coverage
8
+ htmlcov/
9
+ dist/
10
+ build/
11
+ .DS_Store
12
+ Thumbs.db
13
+ outputs/
14
+ *.tmp
@@ -0,0 +1,17 @@
1
+ # AI Usage & Transparency Disclosure (`HelioStack` v0.3.0)
2
+
3
+ This disclosure follows the **NLnet Foundation Policy on the use of Generative Artificial Intelligence**.
4
+
5
+ ## 1. Runtime Guarantee (0% Generative AI)
6
+ - `heliostack` (`src/heliostack/` and `docs/index.html`) executes **100% deterministically on CPU** using analytical photovoltaic physics (`pvlib`), vectorized 3D ray-box geometry (`numpy`), Copernicus DEM terrain horizon ray-casting, OpenFOAM 14 CFD-calibrated thermal balances, sparse linear programming (`scipy.optimize.linprog` via HiGHS), and cryptographic checksums (`RO-Crate 1.1` + `SHA-256`).
7
+ - Zero generative AI, LLMs, closed neural inference endpoints, or external paid APIs are called during validation, simulation, optimization, or audit generation.
8
+
9
+ ## 2. Software Engineering Disclosure
10
+ - During scaffolding and verification sprints (v0.1.0 to v0.3.0), AI coding assistance was used under human architecture design, physical model formulation, and code audit.
11
+ - Every physical equation, equipment parser guard, LP conservation constraint, OpenFOAM 14 `foamRun` CFD case (`checkMesh` clean, `5,910` cells), `pvlib ModelChain` parity check, US DOE / NREL PVDAQ #2107 check, and European Cyprus PHAETHON testbed check was executed and verified deterministically via `ruff`, `pytest --cov`, and SHA-256 manifests.
12
+
13
+ ## 3. Open Data Provenance & Attribution
14
+ - **Solar & Horizon Weather:** European Commission **PVGIS v5.3** (`SARAH3`, `ERA5`, `printhorizon`, `PVcalc`) and **Copernicus GLO-30 DEM** via Open-Meteo Elevation API.
15
+ - **US Utility Telemetry:** Public **US DOE / NREL PVDAQ #2107** (`OEDI`) 2024 hourly data.
16
+ - **European Field Telemetry:** University of Cyprus **PHAETHON CoE** outdoor testbed 1-year dataset (`CC-BY-4.0`, DOI: `10.5281/zenodo.10816826`).
17
+ - Zero proprietary commercial vendor files or confidential institutional data are included.
@@ -0,0 +1,19 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use HelioStack in research or engineering workflows, please cite it using the metadata below."
3
+ title: "HelioStack: Open-Source Solar PV, 3D Shading, Thermal, and LiFePO4 ESS Optimization Engine"
4
+ version: "0.3.0"
5
+ date-released: "2026-11-23"
6
+ license: MIT
7
+ repository-code: "https://github.com/ttthkim-hue/heliostack"
8
+ authors:
9
+ - family-names: Kim
10
+ given-names: Tae-Hyung
11
+ orcid: "https://orcid.org/0009-0003-5047-7501"
12
+ keywords:
13
+ - photovoltaics
14
+ - solar-energy
15
+ - microgrid
16
+ - pvgis
17
+ - energy-storage
18
+ - open-science
19
+ - ro-crate
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tae-Hyung Kim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.5
2
+ Name: heliostack
3
+ Version: 0.3.0
4
+ Summary: Deterministic open-source solar PV, 3D ray-cast shading, CFD-informed thermal, and HiGHS LiFePO4 ESS optimization engine with RO-Crate 1.1 audit provenance.
5
+ Project-URL: Homepage, https://github.com/ttthkim-hue/heliostack
6
+ Project-URL: Issues, https://github.com/ttthkim-hue/heliostack/issues
7
+ Author-email: Tae-Hyung Kim <ttthkim@gmail.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: energy-storage,microgrid,open-energy,photovoltaics,pvgis,reproducibility,ro-crate,solar-pv
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: numpy>=1.26.0
22
+ Requires-Dist: pandas>=2.2.0
23
+ Requires-Dist: pvlib>=0.11.0
24
+ Requires-Dist: requests>=2.31.0
25
+ Requires-Dist: scipy>=1.12.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # HelioStack v0.3.0
33
+
34
+ **Deterministic open-source solar PV, 3D ray-cast & Copernicus DEM terrain shading, OpenFOAM 14 CFD land/Floating-PV thermal, and HiGHS `LiFePO4` ESS optimization workbench with `RO-Crate 1.1` & `SHA-256` audit provenance.**
35
+
36
+ - **License:** MIT (`100%` OSI-permissive open source; `0%` generative AI or closed vendor APIs at runtime)
37
+ - **Live Data, CFD & Dual-Continent Field Validation:**
38
+ 1. European Commission **PVGIS v5.3** (`SARAH3` & `ERA5`) hourly TMY & `PVcalc` cross-validation across 4 baseline climates
39
+ 2. **Copernicus DEM** 36-azimuth ray-cast terrain horizon vs EU PVGIS `printhorizon` across Innsbruck, Bolzano, and Zermatt (`MAE 1.25–1.57°`)
40
+ 3. **OpenFOAM 14 (`foamRun -solver fluid`, steady `kOmegaSST`)** `28°`-tilted PV convective sweep (`5,910` cells, 8 cases) calibrating land vs pontoon Floating-PV cooling
41
+ 4. **European Union 1-Year Outdoor Testbed** (**University of Cyprus PHAETHON CoE**, `8,784` full hours, `CC-BY-4.0`): `Tmod RMSE 2.18 °C` (`open_rack R² 0.9705`) / `4.19 °C` (`OpenFOAM 14 R² 0.8906`), full-year DC `R² 0.9887`
42
+ 5. Real **892.8 kWp** US utility meter telemetry (**US DOE / NREL PVDAQ #2107**, 2024 `3,255` daylight operating hours, `R² = 0.9101`, `MBE = +3.81%`, `nRMSE = 6.79%`)
43
+ 6. Canonical **`pvlib ModelChain`** parity check (`-0.67%` Amsterdam, `+0.31%` Seville) + 12-step PVsyst-style loss tree
44
+ - **AI Transparency:** [`AI_DISCLOSURE.md`](./AI_DISCLOSURE.md)
45
+ - **NLnet Scope & Roadmap (`2027-01-03`):** [`docs/ROADMAP_TO_NLNET_20270103.md`](./docs/ROADMAP_TO_NLNET_20270103.md)
46
+
47
+ ---
48
+
49
+ ## Why HelioStack?
50
+
51
+ Commercial Windows-only tools (`PVsyst`, `PV*SOL`, `HOMER Pro`) and closed cloud SaaS (`HelioScope`) lock solar engineering workflows behind proprietary `.PAN`/`.OND` binary/desktop silos, while open libraries (`pvlib`) lack unified Copernicus DEM terrain + 3D obstacle ray-casting, Floating-PV water thermal physics, sparse 8,760-hour ESS curtailment optimization, and cryptographic reproducibility bundles.
52
+
53
+ `HelioStack` bridges that gap in pure open Python:
54
+ 1. **Clean-Room Equipment Validation (`.PAN` / `.OND` / JSON):** Enforces physical single-diode & MPPT window invariants (`Vmp < Voc`, `Imp < Isc`, finite metrics, inverter efficiency bounds).
55
+ 2. **Vectorized 3D Ray-Box, Copernicus DEM & Diffuse SVF:** Evaluates 3D obstacle shading, Copernicus 30m satellite & ASCII ESRI `.asc` DEM 36-azimuth mountain horizon blocking, inter-row shed geometry, and cosine-weighted hemispherical sky-view factors.
56
+ 3. **Thermal Physics Beyond Single U-Values:** Compares open-rack Faiman baselines against wind-angle convective alleys and lagged water-coupled Floating-PV cooling (`-3.59 °C` to `-5.77 °C` daytime cooling).
57
+ 4. **8,760-Hour Sparse HiGHS `LiFePO4` Dispatch LP:** Quantifies curtailment recovery under grid export caps with ESS container HVAC auxiliary loads and strict `10^-6 kW` hourly conservation checks.
58
+ 5. **Reproducible Audit Packaging:** Outputs byte-deterministic `RO-Crate 1.1` (`ro-crate-metadata.json`), `repro-manifest.json` (`SHA-256`), and zero-CDN `bankable_report.html`.
59
+
60
+ ---
61
+
62
+ ## Observed 4-Site EU PVGIS v5.3 Benchmark (`100 kWp`, Verified Offline)
63
+
64
+ | Location (PVGIS DB) | POA Delta vs PVcalc | Mono Yield vs PVcalc | Land Bifacial (PR) | Floating PV Cooling (Pure Thermal / Net Bifacial) | 3D Obstacle Shade | 65% Cap + 200 kWh ESS Recovery (LP Time) |
65
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
66
+ | **Amsterdam, NL** (`SARAH3`) | `-0.59%` | `1083.5` vs `1071.6` (`+1.11%`) | `1100.7 kWh/kWp` (`87.3%`) | `-3.59 °C` (`+1.53%` / `-0.68%`) | `15.07%` | `100.0%` of `6,205 kWh` (`0.70 s`) |
67
+ | **Munich, DE** (`SARAH3`) | `-1.12%` | `1204.4` vs `1191.5` (`+1.08%`) | `1234.5 kWh/kWp` (`87.2%`) | `-4.30 °C` (`+1.96%` / `-0.22%`) | `13.88%` | `100.0%` of `8,297 kWh` (`0.73 s`) |
68
+ | **Seville, ES** (`SARAH3`) | `-1.12%` | `1814.9` vs `1747.8` (`+3.84%`) | `1876.6 kWh/kWp` (`86.3%`) | `-5.77 °C` (`+2.30%` / `+0.38%`) | `11.24%` | `100.0%` of `19,449 kWh` (`0.73 s`) |
69
+ | **Busan, KR** (`ERA5`) | `+2.74%` | `1640.1` vs `1550.0` (`+5.82%`) | `1693.2 kWh/kWp` (`89.5%`) | `-4.16 °C` (`+1.53%` / `-0.39%`) | `11.63%` | `100.0%` of `14,690 kWh` (`0.79 s`) |
70
+
71
+ ---
72
+
73
+ ## Phase 2 Validation Highlights (`v0.2.0`)
74
+
75
+ ### 1. Alpine Terrain Shading (Horizon-Free TMY + Sky-Dome SVF)
76
+ | Alpine Valley | Elevation | Copernicus vs PVGIS MAE | Flat -> Copernicus Loss | EU PVcalc Terrain Loss | Copernicus vs PVGIS-Hor Delta |
77
+ | :--- | :---: | :---: | :---: | :---: | :---: |
78
+ | **Innsbruck, AT** | `580 m` | `1.28°` | `1537.4 -> 1504.7` (`-2.13%`) | `-1.53%` | `+0.46%` |
79
+ | **Bolzano, IT** | `271 m` | `1.25°` | `1624.5 -> 1545.3` (`-4.88%`) | `-4.86%` | `+2.28%` |
80
+ | **Zermatt, CH** | `1,610 m` | `1.57°` | `1645.8 -> 1387.2` (`-15.72%`) | `-13.99%` | `+1.98%` |
81
+
82
+ ### 2. Real Utility Meter Telemetry (`US DOE / NREL PVDAQ #2107`, Arbuckle, CA — 2024 Jan–early Nov)
83
+ - Plant: `892.8 kWp DC` (`2,880 × 310 W`), `24 × 27.6 kW` (`662.4 kW AC`), 7-year aging factor `0.965`, `3,255` daylight operating hours.
84
+ - **Convective Land Model:** Measured `1,221.32 MWh` vs Modeled `1,267.82 MWh` | **`MBE = +3.81%`**, **`nRMSE = 6.79%`**, **`R² = 0.9101`**.
85
+ - **Open-Rack Faiman Baseline:** Measured `1,221.32 MWh` vs Modeled `1,268.83 MWh` | `MBE = +3.89%`, `nRMSE = 6.80%`, `R² = 0.9098`.
86
+
87
+ ### 3. Canonical `pvlib ModelChain` Parity (`99.0 kWp` Mono Plant)
88
+ - **Amsterdam, NL:** `pvlib = 1,113.34` vs `HelioStack = 1,105.87 kWh/kWp` (**`-0.67%`**)
89
+ - **Seville, ES:** `pvlib = 1,846.44` vs `HelioStack = 1,852.10 kWh/kWp` (**`+0.31%`**)
90
+
91
+ ---
92
+
93
+ ## Phase 3 Validation (`v0.3.0`): OpenFOAM 14 CFD & European Full-Year Field Testbed
94
+
95
+ ### 1. Reproducible OpenFOAM 14 `28°`-Tilted PV Thermal Sweep (`foamRun -solver fluid`, 5,910 cells)
96
+ | Mounting Surface | Clearance / Soil or Water Boundary | Wind Convective Fit (`h_conv(v)`) | Longwave `h_rad` | OpenFOAM Faiman Eq. (`u0`, `u1`) |
97
+ | :--- | :---: | :---: | :---: | :---: |
98
+ | **Land Rack** | `0.85 m` over `+35 °C` sunlit soil | `4.705 + 3.648·v W/m²K` | `11.738 W/m²K` | `u0 = 22.56`, `u1 = 5.00` |
99
+ | **Floating PV** | `0.25 m` over `+21 °C` reservoir water | `4.912 + 3.906·v W/m²K` | `14.688 W/m²K` | `u0 = 26.89`, `u1 = 5.36` |
100
+
101
+ ### 2. European Union 1-Year Field Validation (University of Cyprus PHAETHON CoE, `8,784` hrs, `CC-BY-4.0`)
102
+ - Dataset: June 2015 – May 2016 (`3,935` daylight operating hours, DOI `10.5281/zenodo.10816826`).
103
+ - **Thermal Accuracy (`Tmod` backsheet PT100):** `open_rack` `RMSE = 2.18 °C` (`R² = 0.9705`), `convective_land` `RMSE = 2.22 °C` (`R² = 0.9693`), pure **OpenFOAM 14 `cfd_land`** (zero Cyprus tuning) `RMSE = 4.19 °C` (`R² = 0.8906`).
104
+ - **Full-Year Yield Accuracy:** Measured `2,450 kWh` DC vs Modeled `2,410 kWh` (`MBE = -1.62%`, `nRMSE = 2.85%`, `R² = 0.9887`; AC `MBE = -1.01%`, `R² = 0.9876`).
105
+
106
+ ---
107
+
108
+ ## Live Interactive Workbench
109
+
110
+ - **Browser Simulator (Zero Server Required):** https://ttthkim-hue.github.io/heliostack/
111
+
112
+ ---
113
+
114
+ ## How HelioStack Complements Existing Open-Source Tools
115
+
116
+ | Existing Open Tool | Primary Focus | What Remains Unsolved End-to-End |
117
+ | :--- | :--- | :--- |
118
+ | **`pvlib-python`** (used inside HelioStack) | Low-level solar position, transposition & single-diode math | Unified `.PAN`/`.OND` validation + 3D shading + Copernicus horizon + CFD thermal + HiGHS ESS + `RO-Crate 1.1` audit |
119
+ | **`NREL / SAM`** | Desktop GUI simulator for US policies & buildings | Lightweight Python/CLI microservice, Copernicus EU horizon, OpenFOAM FPV cooling, reproducible cryptographic bundles |
120
+ | **`open-pv / simshady`** | Browser JavaScript 3D shadow casting | Bankable 8,760-hr energy loss tree, single-diode electrical yield & ESS optimization |
121
+ | **`PyPSA` / `oemof`** | Macro grid / national transmission LP optimization | Site-level PVsyst-grade `.PAN`/`.OND` single-diode modeling, 3D/DEM shade & micro-thermal physics |
122
+ | **`Bifacial_Radiance`** | Radiance backward ray-tracing optics | Fast CPU engineering workbench integrating thermal CFD, ESS curtailment LP & `RO-Crate 1.1` provenance |
123
+
124
+ ---
125
+
126
+ ## Quick Start
127
+
128
+ ```bash
129
+ # Option A: Install directly from GitHub Release or source
130
+ pip install "git+https://github.com/ttthkim-hue/heliostack.git@v0.3.0"
131
+
132
+ # Option B: Editable developer install
133
+ git clone https://github.com/ttthkim-hue/heliostack.git
134
+ cd heliostack
135
+ pip install -e ".[dev]"
136
+
137
+ # 1. Validate .PAN / .OND specifications (exit 0 on valid, exit 1 on physics failure)
138
+ heliostack validate fixtures/equipment/ref_550w_bifacial.pan
139
+ heliostack validate fixtures/equipment/invalid_module.pan
140
+
141
+ # 2. Extract 36-azimuth Copernicus DEM terrain horizon vs EU PVGIS printhorizon
142
+ heliostack horizon --lat 47.2692 --lon 11.4041 --cache-dir fixtures/weather
143
+
144
+ # 3. Run full Phase 1 + Phase 2 + Phase 3 reproducible benchmarks
145
+ python benchmarks/run_europe_benchmark.py
146
+ python benchmarks/run_phase2_validation.py
147
+ python benchmarks/run_phase3_validation.py
148
+
149
+ # (Optional in WSL2 / Linux with OpenFOAM 14 installed):
150
+ python openfoam/run_openfoam_pv_sweep.py
151
+
152
+ # 4. Preview offline interactive Web UI locally
153
+ heliostack serve --dir docs --port 8780
154
+ ```
@@ -0,0 +1,123 @@
1
+ # HelioStack v0.3.0
2
+
3
+ **Deterministic open-source solar PV, 3D ray-cast & Copernicus DEM terrain shading, OpenFOAM 14 CFD land/Floating-PV thermal, and HiGHS `LiFePO4` ESS optimization workbench with `RO-Crate 1.1` & `SHA-256` audit provenance.**
4
+
5
+ - **License:** MIT (`100%` OSI-permissive open source; `0%` generative AI or closed vendor APIs at runtime)
6
+ - **Live Data, CFD & Dual-Continent Field Validation:**
7
+ 1. European Commission **PVGIS v5.3** (`SARAH3` & `ERA5`) hourly TMY & `PVcalc` cross-validation across 4 baseline climates
8
+ 2. **Copernicus DEM** 36-azimuth ray-cast terrain horizon vs EU PVGIS `printhorizon` across Innsbruck, Bolzano, and Zermatt (`MAE 1.25–1.57°`)
9
+ 3. **OpenFOAM 14 (`foamRun -solver fluid`, steady `kOmegaSST`)** `28°`-tilted PV convective sweep (`5,910` cells, 8 cases) calibrating land vs pontoon Floating-PV cooling
10
+ 4. **European Union 1-Year Outdoor Testbed** (**University of Cyprus PHAETHON CoE**, `8,784` full hours, `CC-BY-4.0`): `Tmod RMSE 2.18 °C` (`open_rack R² 0.9705`) / `4.19 °C` (`OpenFOAM 14 R² 0.8906`), full-year DC `R² 0.9887`
11
+ 5. Real **892.8 kWp** US utility meter telemetry (**US DOE / NREL PVDAQ #2107**, 2024 `3,255` daylight operating hours, `R² = 0.9101`, `MBE = +3.81%`, `nRMSE = 6.79%`)
12
+ 6. Canonical **`pvlib ModelChain`** parity check (`-0.67%` Amsterdam, `+0.31%` Seville) + 12-step PVsyst-style loss tree
13
+ - **AI Transparency:** [`AI_DISCLOSURE.md`](./AI_DISCLOSURE.md)
14
+ - **NLnet Scope & Roadmap (`2027-01-03`):** [`docs/ROADMAP_TO_NLNET_20270103.md`](./docs/ROADMAP_TO_NLNET_20270103.md)
15
+
16
+ ---
17
+
18
+ ## Why HelioStack?
19
+
20
+ Commercial Windows-only tools (`PVsyst`, `PV*SOL`, `HOMER Pro`) and closed cloud SaaS (`HelioScope`) lock solar engineering workflows behind proprietary `.PAN`/`.OND` binary/desktop silos, while open libraries (`pvlib`) lack unified Copernicus DEM terrain + 3D obstacle ray-casting, Floating-PV water thermal physics, sparse 8,760-hour ESS curtailment optimization, and cryptographic reproducibility bundles.
21
+
22
+ `HelioStack` bridges that gap in pure open Python:
23
+ 1. **Clean-Room Equipment Validation (`.PAN` / `.OND` / JSON):** Enforces physical single-diode & MPPT window invariants (`Vmp < Voc`, `Imp < Isc`, finite metrics, inverter efficiency bounds).
24
+ 2. **Vectorized 3D Ray-Box, Copernicus DEM & Diffuse SVF:** Evaluates 3D obstacle shading, Copernicus 30m satellite & ASCII ESRI `.asc` DEM 36-azimuth mountain horizon blocking, inter-row shed geometry, and cosine-weighted hemispherical sky-view factors.
25
+ 3. **Thermal Physics Beyond Single U-Values:** Compares open-rack Faiman baselines against wind-angle convective alleys and lagged water-coupled Floating-PV cooling (`-3.59 °C` to `-5.77 °C` daytime cooling).
26
+ 4. **8,760-Hour Sparse HiGHS `LiFePO4` Dispatch LP:** Quantifies curtailment recovery under grid export caps with ESS container HVAC auxiliary loads and strict `10^-6 kW` hourly conservation checks.
27
+ 5. **Reproducible Audit Packaging:** Outputs byte-deterministic `RO-Crate 1.1` (`ro-crate-metadata.json`), `repro-manifest.json` (`SHA-256`), and zero-CDN `bankable_report.html`.
28
+
29
+ ---
30
+
31
+ ## Observed 4-Site EU PVGIS v5.3 Benchmark (`100 kWp`, Verified Offline)
32
+
33
+ | Location (PVGIS DB) | POA Delta vs PVcalc | Mono Yield vs PVcalc | Land Bifacial (PR) | Floating PV Cooling (Pure Thermal / Net Bifacial) | 3D Obstacle Shade | 65% Cap + 200 kWh ESS Recovery (LP Time) |
34
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
35
+ | **Amsterdam, NL** (`SARAH3`) | `-0.59%` | `1083.5` vs `1071.6` (`+1.11%`) | `1100.7 kWh/kWp` (`87.3%`) | `-3.59 °C` (`+1.53%` / `-0.68%`) | `15.07%` | `100.0%` of `6,205 kWh` (`0.70 s`) |
36
+ | **Munich, DE** (`SARAH3`) | `-1.12%` | `1204.4` vs `1191.5` (`+1.08%`) | `1234.5 kWh/kWp` (`87.2%`) | `-4.30 °C` (`+1.96%` / `-0.22%`) | `13.88%` | `100.0%` of `8,297 kWh` (`0.73 s`) |
37
+ | **Seville, ES** (`SARAH3`) | `-1.12%` | `1814.9` vs `1747.8` (`+3.84%`) | `1876.6 kWh/kWp` (`86.3%`) | `-5.77 °C` (`+2.30%` / `+0.38%`) | `11.24%` | `100.0%` of `19,449 kWh` (`0.73 s`) |
38
+ | **Busan, KR** (`ERA5`) | `+2.74%` | `1640.1` vs `1550.0` (`+5.82%`) | `1693.2 kWh/kWp` (`89.5%`) | `-4.16 °C` (`+1.53%` / `-0.39%`) | `11.63%` | `100.0%` of `14,690 kWh` (`0.79 s`) |
39
+
40
+ ---
41
+
42
+ ## Phase 2 Validation Highlights (`v0.2.0`)
43
+
44
+ ### 1. Alpine Terrain Shading (Horizon-Free TMY + Sky-Dome SVF)
45
+ | Alpine Valley | Elevation | Copernicus vs PVGIS MAE | Flat -> Copernicus Loss | EU PVcalc Terrain Loss | Copernicus vs PVGIS-Hor Delta |
46
+ | :--- | :---: | :---: | :---: | :---: | :---: |
47
+ | **Innsbruck, AT** | `580 m` | `1.28°` | `1537.4 -> 1504.7` (`-2.13%`) | `-1.53%` | `+0.46%` |
48
+ | **Bolzano, IT** | `271 m` | `1.25°` | `1624.5 -> 1545.3` (`-4.88%`) | `-4.86%` | `+2.28%` |
49
+ | **Zermatt, CH** | `1,610 m` | `1.57°` | `1645.8 -> 1387.2` (`-15.72%`) | `-13.99%` | `+1.98%` |
50
+
51
+ ### 2. Real Utility Meter Telemetry (`US DOE / NREL PVDAQ #2107`, Arbuckle, CA — 2024 Jan–early Nov)
52
+ - Plant: `892.8 kWp DC` (`2,880 × 310 W`), `24 × 27.6 kW` (`662.4 kW AC`), 7-year aging factor `0.965`, `3,255` daylight operating hours.
53
+ - **Convective Land Model:** Measured `1,221.32 MWh` vs Modeled `1,267.82 MWh` | **`MBE = +3.81%`**, **`nRMSE = 6.79%`**, **`R² = 0.9101`**.
54
+ - **Open-Rack Faiman Baseline:** Measured `1,221.32 MWh` vs Modeled `1,268.83 MWh` | `MBE = +3.89%`, `nRMSE = 6.80%`, `R² = 0.9098`.
55
+
56
+ ### 3. Canonical `pvlib ModelChain` Parity (`99.0 kWp` Mono Plant)
57
+ - **Amsterdam, NL:** `pvlib = 1,113.34` vs `HelioStack = 1,105.87 kWh/kWp` (**`-0.67%`**)
58
+ - **Seville, ES:** `pvlib = 1,846.44` vs `HelioStack = 1,852.10 kWh/kWp` (**`+0.31%`**)
59
+
60
+ ---
61
+
62
+ ## Phase 3 Validation (`v0.3.0`): OpenFOAM 14 CFD & European Full-Year Field Testbed
63
+
64
+ ### 1. Reproducible OpenFOAM 14 `28°`-Tilted PV Thermal Sweep (`foamRun -solver fluid`, 5,910 cells)
65
+ | Mounting Surface | Clearance / Soil or Water Boundary | Wind Convective Fit (`h_conv(v)`) | Longwave `h_rad` | OpenFOAM Faiman Eq. (`u0`, `u1`) |
66
+ | :--- | :---: | :---: | :---: | :---: |
67
+ | **Land Rack** | `0.85 m` over `+35 °C` sunlit soil | `4.705 + 3.648·v W/m²K` | `11.738 W/m²K` | `u0 = 22.56`, `u1 = 5.00` |
68
+ | **Floating PV** | `0.25 m` over `+21 °C` reservoir water | `4.912 + 3.906·v W/m²K` | `14.688 W/m²K` | `u0 = 26.89`, `u1 = 5.36` |
69
+
70
+ ### 2. European Union 1-Year Field Validation (University of Cyprus PHAETHON CoE, `8,784` hrs, `CC-BY-4.0`)
71
+ - Dataset: June 2015 – May 2016 (`3,935` daylight operating hours, DOI `10.5281/zenodo.10816826`).
72
+ - **Thermal Accuracy (`Tmod` backsheet PT100):** `open_rack` `RMSE = 2.18 °C` (`R² = 0.9705`), `convective_land` `RMSE = 2.22 °C` (`R² = 0.9693`), pure **OpenFOAM 14 `cfd_land`** (zero Cyprus tuning) `RMSE = 4.19 °C` (`R² = 0.8906`).
73
+ - **Full-Year Yield Accuracy:** Measured `2,450 kWh` DC vs Modeled `2,410 kWh` (`MBE = -1.62%`, `nRMSE = 2.85%`, `R² = 0.9887`; AC `MBE = -1.01%`, `R² = 0.9876`).
74
+
75
+ ---
76
+
77
+ ## Live Interactive Workbench
78
+
79
+ - **Browser Simulator (Zero Server Required):** https://ttthkim-hue.github.io/heliostack/
80
+
81
+ ---
82
+
83
+ ## How HelioStack Complements Existing Open-Source Tools
84
+
85
+ | Existing Open Tool | Primary Focus | What Remains Unsolved End-to-End |
86
+ | :--- | :--- | :--- |
87
+ | **`pvlib-python`** (used inside HelioStack) | Low-level solar position, transposition & single-diode math | Unified `.PAN`/`.OND` validation + 3D shading + Copernicus horizon + CFD thermal + HiGHS ESS + `RO-Crate 1.1` audit |
88
+ | **`NREL / SAM`** | Desktop GUI simulator for US policies & buildings | Lightweight Python/CLI microservice, Copernicus EU horizon, OpenFOAM FPV cooling, reproducible cryptographic bundles |
89
+ | **`open-pv / simshady`** | Browser JavaScript 3D shadow casting | Bankable 8,760-hr energy loss tree, single-diode electrical yield & ESS optimization |
90
+ | **`PyPSA` / `oemof`** | Macro grid / national transmission LP optimization | Site-level PVsyst-grade `.PAN`/`.OND` single-diode modeling, 3D/DEM shade & micro-thermal physics |
91
+ | **`Bifacial_Radiance`** | Radiance backward ray-tracing optics | Fast CPU engineering workbench integrating thermal CFD, ESS curtailment LP & `RO-Crate 1.1` provenance |
92
+
93
+ ---
94
+
95
+ ## Quick Start
96
+
97
+ ```bash
98
+ # Option A: Install directly from GitHub Release or source
99
+ pip install "git+https://github.com/ttthkim-hue/heliostack.git@v0.3.0"
100
+
101
+ # Option B: Editable developer install
102
+ git clone https://github.com/ttthkim-hue/heliostack.git
103
+ cd heliostack
104
+ pip install -e ".[dev]"
105
+
106
+ # 1. Validate .PAN / .OND specifications (exit 0 on valid, exit 1 on physics failure)
107
+ heliostack validate fixtures/equipment/ref_550w_bifacial.pan
108
+ heliostack validate fixtures/equipment/invalid_module.pan
109
+
110
+ # 2. Extract 36-azimuth Copernicus DEM terrain horizon vs EU PVGIS printhorizon
111
+ heliostack horizon --lat 47.2692 --lon 11.4041 --cache-dir fixtures/weather
112
+
113
+ # 3. Run full Phase 1 + Phase 2 + Phase 3 reproducible benchmarks
114
+ python benchmarks/run_europe_benchmark.py
115
+ python benchmarks/run_phase2_validation.py
116
+ python benchmarks/run_phase3_validation.py
117
+
118
+ # (Optional in WSL2 / Linux with OpenFOAM 14 installed):
119
+ python openfoam/run_openfoam_pv_sweep.py
120
+
121
+ # 4. Preview offline interactive Web UI locally
122
+ heliostack serve --dir docs --port 8780
123
+ ```
@@ -0,0 +1,203 @@
1
+ """Live 4-site European Commission PVGIS v5.3 cross-validation & scenario benchmark."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import time
7
+ from dataclasses import replace
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ from heliostack.ess_optimizer import run_full_simulation
12
+ from heliostack.formats import parse_ond, parse_pan
13
+ from heliostack.models import ObstacleBox3D, SiteConfig
14
+ from heliostack.weather import fetch_pvgis_pvcalc, fetch_pvgis_tmy, save_tmy_csv
15
+
16
+ ROOT = Path(__file__).resolve().parent.parent
17
+ WEATHER_DIR = ROOT / "fixtures" / "weather"
18
+ RESULTS_PATH = ROOT / "results" / "europe_benchmark_v01.json"
19
+
20
+ SITES: list[dict[str, Any]] = [
21
+ {"id": "amsterdam", "name": "Amsterdam, Netherlands", "lat": 52.37, "lon": 4.90, "tilt": 35.0, "az": 180.0},
22
+ {"id": "munich", "name": "Munich, Germany", "lat": 48.14, "lon": 11.58, "tilt": 35.0, "az": 180.0},
23
+ {"id": "seville", "name": "Seville, Spain", "lat": 37.39, "lon": -5.98, "tilt": 32.0, "az": 180.0},
24
+ {"id": "busan", "name": "Busan, South Korea", "lat": 35.18, "lon": 129.08, "tilt": 32.0, "az": 180.0},
25
+ ]
26
+
27
+
28
+ def main() -> None:
29
+ t_all = time.perf_counter()
30
+ WEATHER_DIR.mkdir(parents=True, exist_ok=True)
31
+ RESULTS_PATH.parent.mkdir(parents=True, exist_ok=True)
32
+
33
+ mod, mod_issues = parse_pan(ROOT / "fixtures" / "equipment" / "ref_550w_bifacial.pan")
34
+ inv, inv_issues = parse_ond(ROOT / "fixtures" / "equipment" / "ref_250kw_inverter.ond")
35
+ if mod is None or inv is None:
36
+ raise RuntimeError(f"Equipment parse failure: {mod_issues + inv_issues}")
37
+
38
+ mod_mono = replace(mod, bifaciality_factor=0.0)
39
+ site_results: list[dict[str, Any]] = []
40
+
41
+ for meta in SITES:
42
+ t_site = time.perf_counter()
43
+ weather, prov = fetch_pvgis_tmy(meta["lat"], meta["lon"], cache_dir=WEATHER_DIR)
44
+ if meta["id"] == "amsterdam":
45
+ save_tmy_csv(weather, WEATHER_DIR / "amsterdam_pvgis_tmy_2023.csv")
46
+
47
+ elev = float(prov.get("elevation_m") or 10.0)
48
+ pvcalc_ref = fetch_pvgis_pvcalc(
49
+ latitude=meta["lat"],
50
+ longitude=meta["lon"],
51
+ peakpower_kw=100.0,
52
+ loss_pct=10.0,
53
+ tilt_deg=meta["tilt"],
54
+ surface_azimuth_deg=meta["az"],
55
+ cache_dir=WEATHER_DIR,
56
+ )
57
+
58
+ # (a) Open-rack monofacial parity check against EU PVGIS PVcalc (loss=10%)
59
+ cfg_mono = SiteConfig(
60
+ site_name=meta["name"],
61
+ latitude=meta["lat"],
62
+ longitude=meta["lon"],
63
+ elevation_m=elev,
64
+ surface_tilt_deg=meta["tilt"],
65
+ surface_azimuth_deg=meta["az"],
66
+ dc_kwp=100.0,
67
+ gcr=0.40,
68
+ use_3d_shading=False,
69
+ soiling_loss_frac=0.025,
70
+ dc_wiring_loss_frac=0.02,
71
+ mismatch_loss_frac=0.02,
72
+ availability_frac=0.985,
73
+ mounting_mode="open_rack",
74
+ grid_export_limit_kw=100.0,
75
+ )
76
+ res_mono = run_full_simulation(weather, prov, cfg_mono, mod_mono, inv)
77
+
78
+ # (b) Standard bifacial land (open_rack) vs Floating PV thermal comparison
79
+ cfg_land = SiteConfig(
80
+ site_name=meta["name"],
81
+ latitude=meta["lat"],
82
+ longitude=meta["lon"],
83
+ elevation_m=elev,
84
+ surface_tilt_deg=meta["tilt"],
85
+ surface_azimuth_deg=meta["az"],
86
+ dc_kwp=100.0,
87
+ gcr=0.45,
88
+ use_3d_shading=True,
89
+ mounting_mode="open_rack",
90
+ grid_export_limit_kw=100.0,
91
+ )
92
+ res_land = run_full_simulation(weather, prov, cfg_land, mod, inv)
93
+
94
+ cfg_fpv = replace(cfg_land, mounting_mode="floating_pv", albedo=0.08)
95
+ res_fpv = run_full_simulation(weather, prov, cfg_fpv, mod, inv)
96
+
97
+ # Also isolate pure thermal cooling gain on monofacial (same optics, pure cooling effect)
98
+ cfg_land_mono = replace(cfg_land, mounting_mode="open_rack")
99
+ res_land_mono = run_full_simulation(weather, prov, cfg_land_mono, mod_mono, inv)
100
+ cfg_fpv_mono = replace(cfg_land, mounting_mode="floating_pv", albedo=0.20)
101
+ res_fpv_mono = run_full_simulation(weather, prov, cfg_fpv_mono, mod_mono, inv)
102
+
103
+ # (c) 3D Obstacle near-shading scenario (realistic nearby parapet/building)
104
+ obstacle = ObstacleBox3D(
105
+ name="South-West Building Block",
106
+ center_east_m=-7.5,
107
+ center_north_m=-10.0,
108
+ width_east_m=12.0,
109
+ depth_north_m=5.0,
110
+ height_m=7.5,
111
+ )
112
+ cfg_shaded = replace(cfg_land, obstacles=[obstacle])
113
+ res_shaded = run_full_simulation(weather, prov, cfg_shaded, mod, inv)
114
+
115
+ # (d) 65% Grid Export Cap + LiFePO4 ESS (200 kWh / 50 kW) HiGHS LP Optimization
116
+ cfg_ess = replace(
117
+ cfg_land,
118
+ grid_export_limit_kw=65.0,
119
+ ess_energy_kwh=200.0,
120
+ ess_power_kw=50.0,
121
+ )
122
+ res_ess = run_full_simulation(weather, prov, cfg_ess, mod, inv)
123
+
124
+ hs_yield_mono = res_mono.loss_waterfall.specific_yield_kwh_kwp
125
+ pvcalc_yield = pvcalc_ref["specific_yield_kwh_kwp"]
126
+ delta_pct = (hs_yield_mono - pvcalc_yield) / pvcalc_yield * 100.0
127
+ pvcalc_hiy = pvcalc_ref["h_i_y_kwh_m2"]
128
+ poa_delta_pct = (res_land.loss_waterfall.poa_global_kwh_m2 - pvcalc_hiy) / pvcalc_hiy * 100.0
129
+
130
+ delta_t_cell = res_fpv.loss_waterfall.mean_cell_temp_day_c - res_land.loss_waterfall.mean_cell_temp_day_c
131
+ fpv_gain_pct = (
132
+ (res_fpv.loss_waterfall.specific_yield_kwh_kwp - res_land.loss_waterfall.specific_yield_kwh_kwp)
133
+ / res_land.loss_waterfall.specific_yield_kwh_kwp
134
+ * 100.0
135
+ )
136
+ fpv_pure_thermal_pct = (
137
+ (res_fpv_mono.loss_waterfall.specific_yield_kwh_kwp - res_land_mono.loss_waterfall.specific_yield_kwh_kwp)
138
+ / res_land_mono.loss_waterfall.specific_yield_kwh_kwp
139
+ * 100.0
140
+ )
141
+
142
+ site_entry = {
143
+ "id": meta["id"],
144
+ "name": meta["name"],
145
+ "latitude": meta["lat"],
146
+ "longitude": meta["lon"],
147
+ "elevation_m": elev,
148
+ "tilt_deg": meta["tilt"],
149
+ "radiation_db": prov.get("radiation_db"),
150
+ "pvcalc_radiation_db": pvcalc_ref.get("radiation_db"),
151
+ "tmy_sha256": prov.get("payload_sha256"),
152
+ "ghi_kwh_m2": res_land.loss_waterfall.ghi_kwh_m2,
153
+ "pvgis_hiy_kwh_m2": round(pvcalc_hiy, 2),
154
+ "hs_poa_kwh_m2": res_land.loss_waterfall.poa_global_kwh_m2,
155
+ "poa_delta_pct": round(poa_delta_pct, 2),
156
+ "pvgis_pvcalc_yield_kwh_kwp": round(pvcalc_yield, 2),
157
+ "heliostack_mono_yield_kwh_kwp": round(hs_yield_mono, 2),
158
+ "pvcalc_delta_pct": round(delta_pct, 2),
159
+ "land_bifacial_yield_kwh_kwp": res_land.loss_waterfall.specific_yield_kwh_kwp,
160
+ "land_pr": res_land.loss_waterfall.performance_ratio,
161
+ "land_mean_cell_day_c": res_land.loss_waterfall.mean_cell_temp_day_c,
162
+ "fpv_yield_kwh_kwp": res_fpv.loss_waterfall.specific_yield_kwh_kwp,
163
+ "fpv_mean_cell_day_c": res_fpv.loss_waterfall.mean_cell_temp_day_c,
164
+ "fpv_delta_cell_c": round(delta_t_cell, 2),
165
+ "fpv_pure_thermal_gain_pct": round(fpv_pure_thermal_pct, 2),
166
+ "fpv_yield_delta_pct": round(fpv_gain_pct, 2),
167
+ "shaded_3d_loss_pct": res_shaded.loss_waterfall.shading_loss_pct,
168
+ "shaded_3d_svf": res_shaded.loss_waterfall.diffuse_svf,
169
+ "shaded_3d_yield_kwh_kwp": res_shaded.loss_waterfall.specific_yield_kwh_kwp,
170
+ "ess_curtailed_no_ess_kwh": res_ess.ess_metrics.curtailed_no_ess_kwh_yr,
171
+ "ess_curtailed_with_ess_kwh": res_ess.ess_metrics.curtailed_with_ess_kwh_yr,
172
+ "ess_recovery_pct": res_ess.ess_metrics.curtailment_recovery_pct,
173
+ "ess_cycles_yr": res_ess.ess_metrics.annual_cycles,
174
+ "ess_revenue_uplift_eur_yr": res_ess.ess_metrics.revenue_uplift_eur_yr,
175
+ "ess_lcoe_eur_kwh": res_ess.ess_metrics.lcoe_eur_kwh,
176
+ "ess_lp_solve_s": res_ess.ess_metrics.solve_time_s,
177
+ "ess_conservation_err_kw": res_ess.ess_metrics.max_hourly_conservation_err_kw,
178
+ "land_waterfall": res_land.loss_waterfall.to_dict(),
179
+ "monthly_land_ac_kwh": [round(v, 1) for v in res_land.monthly_ac_kwh],
180
+ "monthly_fpv_ac_kwh": [round(v, 1) for v in res_fpv.monthly_ac_kwh],
181
+ "monthly_curt_no_ess_kwh": [round(v, 1) for v in res_ess.monthly_curtailed_no_ess_kwh],
182
+ "monthly_curt_with_ess_kwh": [round(v, 1) for v in res_ess.monthly_curtailed_with_ess_kwh],
183
+ "site_elapsed_s": round(time.perf_counter() - t_site, 2),
184
+ }
185
+ site_results.append(site_entry)
186
+ print(
187
+ f"[{meta['id']}] PVGIS={pvcalc_yield:.1f} vs HS-mono={hs_yield_mono:.1f} ({delta_pct:+.2f}%) | "
188
+ f"FPV dT={delta_t_cell:+.2f}C ({fpv_gain_pct:+.2f}%) | "
189
+ f"3D-Shade={res_shaded.loss_waterfall.shading_loss_pct:.2f}% | "
190
+ f"ESS Rec={res_ess.ess_metrics.curtailment_recovery_pct:.1f}% ({res_ess.ess_metrics.solve_time_s:.3f}s)"
191
+ )
192
+
193
+ out_payload = {
194
+ "engine_version": "0.1.0",
195
+ "total_elapsed_s": round(time.perf_counter() - t_all, 2),
196
+ "sites": site_results,
197
+ }
198
+ RESULTS_PATH.write_text(json.dumps(out_payload, indent=2) + "\n", encoding="utf-8")
199
+ print(f"Saved benchmark results to {RESULTS_PATH} in {out_payload['total_elapsed_s']}s")
200
+
201
+
202
+ if __name__ == "__main__":
203
+ main()