4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Routine not functioning properly
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Mon Oct 11, 2004 1:43 pm (19 years, 6 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by keplerSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Mon Oct 11, 2004 2:28 pm (19 years, 6 months ago) Reply with QuoteBack to Top

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...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
kepler
Junior WebHelper
Junior WebHelper


Joined: 08 Feb 2002
Posts: 37

PostPosted: Wed Oct 13, 2004 7:25 am (19 years, 6 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by keplerSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.247706 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme