mirror of
https://github.com/acamarata/nrel-spa-dart.git
synced 2026-07-01 11:24:25 +00:00
Add formatTime, calcSpa, SpaFormattedResult, SpaFormattedAnglesResult, functionCode parameter for getSpa (spaZa/spaZaInc/spaZaRts/spaAll), incidence field on SpaResult, and export all function code constants. All 48 tests pass including numerical cross-validation against the NREL SPA reference date (Golden CO, 2003-10-17) and surface incidence angle.
1.3 KiB
1.3 KiB
Changelog
[1.0.1] - 2026-05-25
Added
formatTime()formats fractional hours toHH:MM:SSstrings; returns"N/A"for non-finite or negative valuescalcSpa()wrapsgetSpa()and formats sunrise, solarNoon, and sunset asHH:MM:SSstringsSpaFormattedResult— typed result forcalcSpa()with string time fieldsSpaFormattedAnglesResult— formatted time strings for custom zenith angle results- Function code constants exported from the public API:
spaZa,spaZaInc,spaZaRts,spaAll functionCodeparameter ongetSpa()— controls calculation mode (ZA only, incidence, RTS, or all)incidencefield onSpaResult— surface incidence angle in degrees;NaNunlessspaZaIncorspaAllis used
Changed
getSpa()now defaultsfunctionCodetospaZaRts(unchanged behaviour for existing callers)SpaResult.sunrise,solarNoon,sunsetareNaNwhenfunctionCodeisspaZaorspaZaInc, matching the JS reference implementation
[1.0.0] - 2026-03-08
Added
getSpa()computes solar position for any date and location- Custom zenith angle support for twilight calculations
- Full NREL SPA algorithm (Reda & Andreas, 2004)
- Accuracy: ±0.0003° for solar zenith angle
- Valid range: years -2000 to 6000
- Zero external dependencies