|
Author |
Message |
kepler
Junior WebHelper
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Mon Oct 11, 2004 1:43 pm (19 years, 6 months ago) |
|
Hi,
I have a routine with the following structure:
void GetGST(double jed, int s, double gst) {
(...code goes here to determine gst)
}
The problem is that, in a loop statement, I call the routine for the first time and it returns a valid value; in the following calls it gives results without sense! For instance, it gives first 6.5 ( it nevers supose to give values greater that two PI ), and in the second call it gives 1000!
I used also the code:
void GetGST(double jed, int s, double *gst) {
(...code goes here to determine *gst)
}
but the same thing happens.
What am I doing wrong?
Best regards,
Kepler |
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Oct 11, 2004 2:28 pm (19 years, 6 months ago) |
|
Without the actual code it's going to be impossible to debug this, is it possible for you to give us some more code? |
________________________________ It's turtles all the way down... |
|
|
|
kepler
Junior WebHelper
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Wed Oct 13, 2004 7:25 am (19 years, 6 months ago) |
|
Here it is:
void GetGST(double jed, int s, double gst) {
static double jedz, sz;
double T, dpsi, deps, dpsidot, depsdot;
double meaneps, trueeps, meanepsdot, trueepsdot, eqeqnx, eqeqnxdot;
if ((jed == jedz) && (s == sz)) return;
jedz = jed;
sz = s;
T = (jed - J2000) / JulCty;
/* compute GMST in seconds */
gst = 67310.54841 + T * ((876600.0 * 3600.0 + 8640184.812866)
+ T * (0.093104 + T * (-0.0000062)));
/* convert to radians */
gst = amodulo(gst / 3600.0, 24.0) * H2R;
if (s == 1) {
/* get nutation quantities */
GetDpsiDeps(jed, &dpsi, &deps, &dpsidot, &depsdot);
/* get mean obliquity */
Obliquity(J2000, jed, 0, &meaneps, &meanepsdot);
/* get true obliquity */
Obliquity (J2000, jed, 1, &trueeps, &trueepsdot);
/* get equation of the equinoxes */
eqeqnx = dpsi * cos(trueeps);
eqeqnxdot = dpsidot * cos(trueeps) - dpsi * trueepsdot * sin(trueeps);
gst += eqeqnx;
}
gst = amodulo(gst, TWOPI);
}
It works at the first call only.
Regards,
Kepler |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.115764 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
|