Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ chrono = { version = "0.4", features = ["serde"] }
chrono-tz = "0.10"
quick-xml = "0.42"
sun = "0.3"
solar-positioning = "0.6"
solar-positioning = "0.7"
hmac = "0.13.0"
sha1 = "0.11.0"
md5 = "0.8.0"
Expand Down
23 changes: 13 additions & 10 deletions backend/src/pv/forecast/solar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! zenith is degrees from vertical.

use chrono::{DateTime, Datelike, Utc};
use solar_positioning::{spa, RefractionCorrection};
use solar_positioning::{Location, RefractionCorrection, SolarPositions};

/// Observer elevation, atmosphere and ΔT used for the sun position. Refraction
/// depends on the first three, but only near the horizon, so standard sea-level
Expand Down Expand Up @@ -38,15 +38,18 @@ pub fn sun_state(time: DateTime<Utc>, latitude: f64, longitude: f64) -> SunState
let refraction = RefractionCorrection::new(PRESSURE_MBAR, TEMPERATURE_C)
.expect("standard pressure and temperature are in range");

let position = spa::solar_position(
time,
latitude,
longitude,
OBSERVER_ELEVATION_M,
DELTA_T_SECONDS,
Some(refraction),
)
.expect("site coordinates are validated at settings load");
let position = SolarPositions::new()
.at(
&time,
Location {
latitude,
longitude,
},
OBSERVER_ELEVATION_M,
DELTA_T_SECONDS,
Some(refraction),
)
.expect("site coordinates are validated at settings load");

let apparent_zenith = position.zenith_angle();

Expand Down
Loading