Skip to content

Commit 98988ea

Browse files
committed
Modify Delta T expressions
1 parent 0971067 commit 98988ea

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

SolarCalculator.cpp

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//======================================================================================================================
22
// SolarCalculator Library for Arduino
33
//
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/
65
//
76
// This library provides functions to calculate the Sun's position in the sky, the times of sunrise, sunset, twilight
87
// 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)
302301
return wrapTo180(L0 - 0.0057183 - calcSunRtAscension(T) - calcNutationRtAscension(T)); // in degrees
303302
}
304303

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
307306
//
308307
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)
309331
{
310332
double y = year + (month - 0.5) / 12;
311333
if (y > 2015)

SolarCalculator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//======================================================================================================================
22
// SolarCalculator Library for Arduino
33
//
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/
65
//
76
// This library provides functions to calculate the Sun's position in the sky, the times of sunrise, sunset, twilight
87
// and solar noon for any location on earth, as well as the equation of time and more.
@@ -60,6 +59,7 @@ double equationOfTimeSmart(double T);
6059
double equationOfTimeHughes(double T);
6160
double equationOfTimeMeeus(double T);
6261
double calcDeltaT(double year, double month);
62+
double calcDeltaTPoly(double year, double month);
6363

6464
//======================================================================================================================
6565
// Solar calculator

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SolarCalculator
2-
version=1.0.1
2+
version=1.0.2
33
author=jpb10
44
maintainer=jpb10
55
sentence=A library based on the NOAA Solar Calculator.

0 commit comments

Comments
 (0)