Skip to content

Commit

Permalink
Modify Delta T expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
jpb10 committed Feb 8, 2022
1 parent 0971067 commit 98988ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
30 changes: 26 additions & 4 deletions SolarCalculator.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//======================================================================================================================
// SolarCalculator Library for Arduino
//
// SolarCalculator is based on the NOAA Solar Calculator:
// https://www.esrl.noaa.gov/gmd/grad/solcalc/
// SolarCalculator is based on the NOAA Solar Calculator: https://www.esrl.noaa.gov/gmd/grad/solcalc/
//
// This library provides functions to calculate the Sun's position in the sky, the times of sunrise, sunset, twilight
// and solar noon for any location on earth, as well as the equation of time and more.
Expand Down Expand Up @@ -302,10 +301,33 @@ double equationOfTimeMeeus(double T)
return wrapTo180(L0 - 0.0057183 - calcSunRtAscension(T) - calcNutationRtAscension(T)); // in degrees
}

// Polynomial Expressions for Delta T (ΔT) by Fred Espenak
// Valid from year -1999 to +3000
// Simple polynomial expressions for delta T (ΔT)
// Long-term parabolas fitted to historical data, very approximate before 1900
//
double calcDeltaT(double year, double month)
{
double y = year + (month - 0.5) / 12;
if (y > 1997)
{
double t = y - 2015;
return 67.62 + t * (0.3645 + 0.0039755 * t);
}
else if (y > 948)
{
double u = (y - 2000) / 100;
return 64.69 + u * (80.59 + 23.604 * u);
}
else // y < 948
{
double u = (y - 2000) / 100;
return 2177 + u * (497 + 44.1 * u); // in seconds of time
}
}

// Polynomial expressions for delta T (ΔT) by Fred Espenak
// Valid from year -1999 to +3000
//
double calcDeltaTPoly(double year, double month)
{
double y = year + (month - 0.5) / 12;
if (y > 2015)
Expand Down
4 changes: 2 additions & 2 deletions SolarCalculator.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//======================================================================================================================
// SolarCalculator Library for Arduino
//
// SolarCalculator is based on the NOAA Solar Calculator:
// https://www.esrl.noaa.gov/gmd/grad/solcalc/
// SolarCalculator is based on the NOAA Solar Calculator: https://www.esrl.noaa.gov/gmd/grad/solcalc/
//
// This library provides functions to calculate the Sun's position in the sky, the times of sunrise, sunset, twilight
// and solar noon for any location on earth, as well as the equation of time and more.
Expand Down Expand Up @@ -60,6 +59,7 @@ double equationOfTimeSmart(double T);
double equationOfTimeHughes(double T);
double equationOfTimeMeeus(double T);
double calcDeltaT(double year, double month);
double calcDeltaTPoly(double year, double month);

//======================================================================================================================
// Solar calculator
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SolarCalculator
version=1.0.1
version=1.0.2
author=jpb10
maintainer=jpb10
sentence=A library based on the NOAA Solar Calculator.
Expand Down

0 comments on commit 98988ea

Please sign in to comment.