1 /* spke17.f -- translated by f2c (version 19980913).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include "f2c.h"
7
8 /* $Procedure SPKE17 ( Evaluate a type 17 SPK data record) */
spke17_(doublereal * et,doublereal * recin,doublereal * state)9 /* Subroutine */ int spke17_(doublereal *et, doublereal *recin, doublereal *
10 state)
11 {
12 /* Builtin functions */
13 double sqrt(doublereal);
14
15 /* Local variables */
16 doublereal a, h__, k;
17 extern /* Subroutine */ int chkin_(char *, ftnlen);
18 doublereal epoch;
19 extern /* Subroutine */ int errdp_(char *, doublereal *, ftnlen);
20 doublereal decpol, rapole;
21 extern /* Subroutine */ int sigerr_(char *, ftnlen), eqncpv_(doublereal *,
22 doublereal *, doublereal *, doublereal *, doublereal *,
23 doublereal *), chkout_(char *, ftnlen), setmsg_(char *, ftnlen);
24 extern logical return_(void);
25 doublereal ecc;
26
27 /* $ Abstract */
28
29 /* Evaluates a single SPK data record from a segment of type 17 */
30 /* (Equinoctial Elements). */
31
32 /* $ Disclaimer */
33
34 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
35 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
36 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
37 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
38 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
39 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
40 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
41 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
42 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
43 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
44
45 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
46 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
47 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
48 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
49 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
50 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
51
52 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
53 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
54 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
55 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
56
57 /* $ Required_Reading */
58
59 /* SPK */
60
61 /* $ Keywords */
62
63 /* EPHEMERIS */
64
65 /* $ Declarations */
66 /* $ Brief_I/O */
67
68 /* Variable I/O Description */
69 /* -------- --- -------------------------------------------------- */
70 /* ET I Target epoch. */
71 /* RECIN I Data record. */
72 /* STATE O State (position and velocity). */
73
74 /* $ Detailed_Input */
75
76 /* ET is a target epoch, specified as ephemeris seconds past */
77 /* J2000, at which a state vector is to be computed. */
78
79 /* RECIN is a data record which, when evaluated at epoch ET, */
80 /* will give the state (position and velocity) of some */
81 /* body, relative to some center, in some inertial */
82 /* reference frame. */
83
84 /* The structure of RECIN is: */
85
86 /* RECIN (1) epoch of the elements in ephemeris seconds */
87 /* past J2000. */
88
89 /* RECIN (2)-RECIN (10) Equinoctial Elements: */
90
91
92 /* RECIN (2) is the semi-major axis (A) of the orbit. */
93
94 /* RECIN (3) is the value of H at the specified epoch. */
95 /* ( E*SIN(ARGP+NODE) ). */
96
97 /* RECIN (4) is the value of K at the specified epoch */
98 /* ( E*COS(ARGP+NODE) ). */
99
100 /* RECIN (5) is the mean longitude (MEAN0+ARGP+NODE)at */
101 /* the epoch of the elements. */
102
103 /* RECIN (6) is the value of P (TAN(INC/2)*SIN(NODE))at */
104 /* the specified epoch. */
105
106 /* RECIN (7) is the value of Q (TAN(INC/2)*COS(NODE))at */
107 /* the specified epoch. */
108
109 /* RECIN (8) is the rate of the longitude of periapse */
110 /* (dARGP/dt + dNODE/dt ) at the epoch of */
111 /* the elements. This rate is assumed to hold */
112 /* for all time. */
113
114 /* RECIN (9) is the derivative of the mean longitude */
115 /* ( dM/dt + dARGP/dt + dNODE/dt ). This */
116 /* rate is assumed to be constant. */
117
118 /* RECIN (10) is the rate of the longitude of the */
119 /* ascending node ( dNODE/dt). */
120
121 /* RECIN (11) Right Ascension of the pole of the */
122 /* orbital reference system relative to the */
123 /* reference frame of the associated SPK */
124 /* segment. */
125
126 /* RECIN (12) Declination of the pole of the */
127 /* orbital reference system relative to */
128 /* the reference frame of the associated */
129 /* SPK segment. */
130
131 /* $ Detailed_Output */
132
133 /* STATE is the state produced by evaluating RECIN at ET. */
134 /* Units are km and km/sec. */
135
136 /* $ Parameters */
137
138 /* None. */
139
140 /* $ Files */
141
142 /* None. */
143
144 /* $ Exceptions */
145
146 /* 1) If the eccentricity is greater than 0.9, the error */
147 /* 'SPICE(BADECCENTRICITY)' will be signalled. */
148
149 /* 2) If the semi-major axis is non-positive, the error */
150 /* 'SPICE(BADSEMIAXIS)' is signalled. */
151
152
153 /* $ Particulars */
154
155 /* This routine performs a cursory examination of the elements */
156 /* of a type 17 SPK data record and then passes the equinoctial */
157 /* elements contained in that record on to the SPICE routine */
158 /* EQNCPV for evaluation. */
159
160 /* $ Examples */
161
162 /* The SPKEnn routines are almost always used in conjunction with */
163 /* the corresponding SPKRnn routines, which read the records from */
164 /* SPK files. */
165
166 /* The data returned by the SPKRnn routine is in its rawest form, */
167 /* taken directly from the segment. As such, it will be meaningless */
168 /* to a user unless he/she understands the structure of the data type */
169 /* completely. Given that understanding, however, the SPKRnn */
170 /* routines might be used to examine raw segment data before */
171 /* evaluating it with the SPKEnn routines. */
172
173
174 /* C */
175 /* C Get a segment applicable to a specified body and epoch. */
176 /* C */
177 /* CALL SPKSFS ( BODY, ET, HANDLE, DESCR, IDENT, FOUND ) */
178
179 /* C */
180 /* C Look at parts of the descriptor. */
181 /* C */
182 /* CALL DAFUS ( DESCR, 2, 6, DCD, ICD ) */
183 /* CENTER = ICD( 2 ) */
184 /* REF = ICD( 3 ) */
185 /* TYPE = ICD( 4 ) */
186
187 /* IF ( TYPE .EQ. 17 ) THEN */
188
189 /* CALL SPKR17 ( HANDLE, DESCR, ET, RECORD ) */
190 /* . */
191 /* . Look at the RECORD data. */
192 /* . */
193 /* CALL SPKE17 ( ET, RECORD, STATE ) */
194 /* . */
195 /* . Check out the evaluated state. */
196 /* . */
197 /* END IF */
198
199 /* $ Restrictions */
200
201 /* None. */
202
203 /* $ Author_and_Institution */
204
205 /* W.L. Taber (JPL) */
206
207 /* $ Literature_References */
208
209 /* None. */
210
211 /* $ Version */
212
213 /* - SPICELIB Version 1.0.0, 8-JAN-1997 (WLT) */
214
215 /* -& */
216 /* $ Index_Entries */
217
218 /* evaluate type_17 spk segment */
219
220 /* -& */
221
222 /* SPICELIB Functions */
223
224
225 /* Local Variables */
226
227
228 /* Standard SPICE error handling. */
229
230 if (return_()) {
231 return 0;
232 }
233 chkin_("SPKE17", (ftnlen)6);
234
235 /* Fetch the various entities from the input record, first the epoch. */
236
237 epoch = recin[0];
238 a = recin[1];
239 h__ = recin[2];
240 k = recin[3];
241 ecc = sqrt(h__ * h__ + k * k);
242 rapole = recin[10];
243 decpol = recin[11];
244
245 /* Check all the inputs here for obvious failures. Yes, perhaps */
246 /* this is overkill. However, there is a lot more computation */
247 /* going on in this routine so that the small amount of overhead */
248 /* here should not be significant. */
249
250 if (a <= 0.) {
251 setmsg_("The semi-major axis supplied to the SPK type 17 evaluator w"
252 "as non-positive. This value must be positive. The value sup"
253 "plied was #.", (ftnlen)131);
254 errdp_("#", &a, (ftnlen)1);
255 sigerr_("SPICE(BADSEMIAXIS)", (ftnlen)18);
256 chkout_("SPKE17", (ftnlen)6);
257 return 0;
258 } else if (ecc > .9) {
259 setmsg_("The eccentricity supplied for a type 17 segment is greater "
260 "than 0.9. It must be less than 0.9.The value supplied to th"
261 "e type 17 evaluator was #. ", (ftnlen)146);
262 errdp_("#", &ecc, (ftnlen)1);
263 sigerr_("SPICE(BADECCENTRICITY)", (ftnlen)22);
264 chkout_("SPKE17", (ftnlen)6);
265 return 0;
266 }
267
268 /* That's all for here, just plug the elements into the routine */
269 /* knows how to evaluate the equinoctial elements. */
270
271 eqncpv_(et, &epoch, &recin[1], &rapole, &decpol, state);
272
273 /* That's all folks. Check out and return. */
274
275 chkout_("SPKE17", (ftnlen)6);
276 return 0;
277 } /* spke17_ */
278
279