|
Author |
Message |
kepler
Junior WebHelper
![Junior WebHelper Junior WebHelper](images/rank_1.gif)
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Mon Oct 11, 2004 1:43 pm (19 years, 8 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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 |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by kepler Find all posts by kepler](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
adam
Forum Moderator & Developer
![](images/rank_6.gif)
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Oct 11, 2004 2:28 pm (19 years, 8 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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... |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by adam Find all posts by adam](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
kepler
Junior WebHelper
![Junior WebHelper Junior WebHelper](images/rank_1.gif)
Joined: 08 Feb 2002
Posts: 37
|
Posted:
Wed Oct 13, 2004 7:25 am (19 years, 8 months ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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 |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by kepler Find all posts by kepler](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
|
|
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.140158 seconds :: 13 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
|