[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2345] Updated equation_of_time.c, solar_declination.c
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2345] Updated equation_of_time.c, solar_declination.c, and ephemera_common .h, for a better fit to USNO data. |
Date: |
Thu, 11 Apr 2013 23:58:49 +0000 |
Revision: 2345
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2345
Author: swfltek
Date: 2013-04-11 23:58:48 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
Updated equation_of_time.c, solar_declination.c, and ephemera_common.h, for a
better fit to USNO data.
I had been using data from both USNO and NOAA, before discovering that they do
not agree on some important data points.
This update resolves the issues I have been having with these to functions.
Modified Paths:
--------------
trunk/avr-libc/libc/time/ephemera_common.h
trunk/avr-libc/libc/time/equation_of_time.c
trunk/avr-libc/libc/time/solar_declination.c
Modified: trunk/avr-libc/libc/time/ephemera_common.h
===================================================================
--- trunk/avr-libc/libc/time/ephemera_common.h 2013-04-10 19:52:09 UTC (rev
2344)
+++ trunk/avr-libc/libc/time/ephemera_common.h 2013-04-11 23:58:48 UTC (rev
2345)
@@ -39,5 +39,6 @@
#define TWO_PI 6.283185307179586
#define TROP_CYCLE 5022440.6025
#define ANOM_CYCLE 5022680.6082
+#define DELTA_V 0.03342044 /* 2x orbital eccentricity */
#endif
Modified: trunk/avr-libc/libc/time/equation_of_time.c
===================================================================
--- trunk/avr-libc/libc/time/equation_of_time.c 2013-04-10 19:52:09 UTC (rev
2344)
+++ trunk/avr-libc/libc/time/equation_of_time.c 2013-04-11 23:58:48 UTC (rev
2345)
@@ -41,24 +41,30 @@
equation_of_time(time_t * timer)
{
int32_t s, p;
- double pf, sf;
+ double pf, sf, dV;
- /* compute orbital positions */
+ /* compute orbital position relative to perihelion */
p = *timer % ANOM_YEAR;
p += PERIHELION;
pf = p;
pf /= ANOM_CYCLE;
+ pf = sin(pf);
+ /* Derive a velocity correction factor from the perihelion angle */
+ dV = pf * DELTA_V;
+
+ /* compute approximate position relative to solstice */
s = *timer % TROP_YEAR;
s += SOLSTICE;
+ s *= 2;
sf = s;
+
sf /= TROP_CYCLE;
- sf *= 2.0; /* 2x tropical angle */
+ sf += dV;
- pf = sin(pf);
sf = sin(sf);
- pf *= 458.0;
- sf *= 592.0;
+ pf *= 459.6;
+ sf *= 592.2;
s = pf + sf;
return -s;
Modified: trunk/avr-libc/libc/time/solar_declination.c
===================================================================
--- trunk/avr-libc/libc/time/solar_declination.c 2013-04-10 19:52:09 UTC
(rev 2344)
+++ trunk/avr-libc/libc/time/solar_declination.c 2013-04-11 23:58:48 UTC
(rev 2345)
@@ -32,8 +32,7 @@
#include <math.h>
#include "ephemera_common.h"
-#define DELTA_V 0.033
-#define LAG 37800
+#define LAG 38520
double
solar_declination(time_t * timer)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2345] Updated equation_of_time.c, solar_declination.c, and ephemera_common .h, for a better fit to USNO data.,
Mike Rice <=