|
1 | 1 | //====================================================================================================================== |
2 | 2 | // SolarCalculator Library for Arduino |
3 | 3 | // |
4 | | -// SolarCalculator is based on the NOAA Solar Calculator: |
5 | | -// https://www.esrl.noaa.gov/gmd/grad/solcalc/ |
| 4 | +// SolarCalculator is based on the NOAA Solar Calculator: https://www.esrl.noaa.gov/gmd/grad/solcalc/ |
6 | 5 | // |
7 | 6 | // This library provides functions to calculate the Sun's position in the sky, the times of sunrise, sunset, twilight |
8 | 7 | // and solar noon for any location on earth, as well as the equation of time and more. |
@@ -302,10 +301,33 @@ double equationOfTimeMeeus(double T) |
302 | 301 | return wrapTo180(L0 - 0.0057183 - calcSunRtAscension(T) - calcNutationRtAscension(T)); // in degrees |
303 | 302 | } |
304 | 303 |
|
305 | | -// Polynomial Expressions for Delta T (ΔT) by Fred Espenak |
306 | | -// Valid from year -1999 to +3000 |
| 304 | +// Simple polynomial expressions for delta T (ΔT) |
| 305 | +// Long-term parabolas fitted to historical data, very approximate before 1900 |
307 | 306 | // |
308 | 307 | double calcDeltaT(double year, double month) |
| 308 | +{ |
| 309 | + double y = year + (month - 0.5) / 12; |
| 310 | + if (y > 1997) |
| 311 | + { |
| 312 | + double t = y - 2015; |
| 313 | + return 67.62 + t * (0.3645 + 0.0039755 * t); |
| 314 | + } |
| 315 | + else if (y > 948) |
| 316 | + { |
| 317 | + double u = (y - 2000) / 100; |
| 318 | + return 64.69 + u * (80.59 + 23.604 * u); |
| 319 | + } |
| 320 | + else // y < 948 |
| 321 | + { |
| 322 | + double u = (y - 2000) / 100; |
| 323 | + return 2177 + u * (497 + 44.1 * u); // in seconds of time |
| 324 | + } |
| 325 | +} |
| 326 | + |
| 327 | +// Polynomial expressions for delta T (ΔT) by Fred Espenak |
| 328 | +// Valid from year -1999 to +3000 |
| 329 | +// |
| 330 | +double calcDeltaTPoly(double year, double month) |
309 | 331 | { |
310 | 332 | double y = year + (month - 0.5) / 12; |
311 | 333 | if (y > 2015) |
|
0 commit comments