[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-commit] [2341] Modified 'solar_declination' to conform more cl
From: |
Mike Rice |
Subject: |
[avr-libc-commit] [2341] Modified 'solar_declination' to conform more closely to the zeros of the 'full' equation. |
Date: |
Mon, 08 Apr 2013 20:24:59 +0000 |
Revision: 2341
http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2341
Author: swfltek
Date: 2013-04-08 20:24:58 +0000 (Mon, 08 Apr 2013)
Log Message:
-----------
Modified 'solar_declination' to conform more closely to the zeros of the 'full'
equation.
Modified Paths:
--------------
trunk/avr-libc/libc/time/solar_declination.c
Modified: trunk/avr-libc/libc/time/solar_declination.c
===================================================================
--- trunk/avr-libc/libc/time/solar_declination.c 2013-04-08 20:21:57 UTC
(rev 2340)
+++ trunk/avr-libc/libc/time/solar_declination.c 2013-04-08 20:24:58 UTC
(rev 2341)
@@ -28,49 +28,44 @@
/* $Id$ */
-/*
- Basic Solar Declination calculation.
-*/
-
#include <time.h>
#include <math.h>
+#include "ephemera_common.h"
-#define TROP_YEAR 31556925
-#define ANOM_YEAR 31558433
-#define INCLINATION 0.409105176667471 /* Earths axial tilt */
-#define PERIHELION 31218166 /* perihelion of 1999 */
-#define SOLSTICE 836160 /* winter solstice of 1999 */
-#define TWO_PI 6.283185307179586
-#define DELTA_V 0.0167
+#define DELTA_V 0.033
+#define LAG 37800
double
solar_declination(time_t * timer)
{
- uint32_t fT, oV;
+ uint32_t fT, oV;
double dV, dT;
- /* fractional anomalistic year */
+ /*
+ * Determine approximate orbital angle, relative to the winter
+ * solstice
+ */
+ fT = *timer % TROP_YEAR;
+ fT += SOLSTICE;
+ fT += LAG;
+ dT = fT;
+ dT /= TROP_YEAR;
+ dT *= TWO_PI;
+
+ /* Determine approximate orbital angle relative to perihelion */
oV = *timer % ANOM_YEAR;
oV += PERIHELION;
-
- /* convert to angle */
dV = oV;
dV /= ANOM_YEAR;
dV *= TWO_PI;
- /* orbital velocity correction */
+ /* Derive a velocity correction factor from the perihelion angle */
dV = sin(dV);
dV *= DELTA_V;
- /* fractional tropical year */
- fT = *timer % TROP_YEAR;
- fT += SOLSTICE;
- dT = fT;
- dT /= TROP_YEAR;
- dT *= TWO_PI;
+ /* compute declination */
+ dT = cos(dT + dV) * INCLINATION;
- dT = cos(dT+dV) * INCLINATION;
-
return -dT;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-libc-commit] [2341] Modified 'solar_declination' to conform more closely to the zeros of the 'full' equation.,
Mike Rice <=