1 /* zzspksb1.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 ZZSPKSB1 ( S/P Kernel, solar system barycenter ) */
zzspksb1_(integer * targ,doublereal * et,char * ref,doublereal * starg,ftnlen ref_len)9 /* Subroutine */ int zzspksb1_(integer *targ, doublereal *et, char *ref,
10 doublereal *starg, ftnlen ref_len)
11 {
12 integer bary;
13 extern /* Subroutine */ int zzspkgo1_(integer *, doublereal *, char *,
14 integer *, doublereal *, doublereal *, ftnlen), chkin_(char *,
15 ftnlen);
16 doublereal lt;
17 extern /* Subroutine */ int chkout_(char *, ftnlen);
18 extern logical return_(void);
19
20 /* $ Abstract */
21
22 /* SPICE Private routine intended solely for the support of SPICE */
23 /* routines. Users should not call this routine directly due */
24 /* to the volatile nature of this routine. */
25
26 /* Return the state (position and velocity) of a target body */
27 /* relative to the solar system barycenter. */
28
29 /* $ Disclaimer */
30
31 /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */
32 /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */
33 /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */
34 /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */
35 /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */
36 /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */
37 /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */
38 /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */
39 /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */
40 /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */
41
42 /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */
43 /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */
44 /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */
45 /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */
46 /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */
47 /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */
48
49 /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */
50 /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */
51 /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */
52 /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */
53
54 /* $ Required_Reading */
55
56 /* SPK */
57
58 /* $ Keywords */
59
60 /* EPHEMERIS */
61
62 /* $ Declarations */
63 /* $ Brief_I/O */
64
65 /* Variable I/O Description */
66 /* -------- --- -------------------------------------------------- */
67 /* TARG I Target body. */
68 /* ET I Target epoch. */
69 /* REF I Target reference frame. */
70 /* STARG O State of target. */
71
72 /* $ Detailed_Input */
73
74 /* TARG is the standard NAIF ID code for a target body. */
75
76 /* ET is the epoch (ephemeris time) at which the state */
77 /* of the target body is to be computed. */
78
79 /* REF is the name of the reference frame to which the */
80 /* vectors returned by the routine should be rotated. */
81 /* This may be any frame supported by the SPICELIB frame */
82 /* system, including dynamic and other non-inertial */
83 /* frames. */
84
85 /* $ Detailed_Output */
86
87 /* STARG contains the position and velocity of the target */
88 /* body, relative to the solar system barycenter, */
89 /* at epoch ET. These vectors are rotated into the */
90 /* specified reference frame. Units are always */
91 /* km and km/sec. */
92
93 /* $ Parameters */
94
95 /* None. */
96
97 /* $ Exceptions */
98
99 /* 1) If insufficient information has not bee "loaded" via the */
100 /* routine SPKLEF or the PCK kernel loaders, the problem will */
101 /* be diagnosed by a routine in the call tree of this routine. */
102
103 /* $ Files */
104
105 /* See: $Restrictions. */
106
107 /* $ Particulars */
108
109 /* In order to compute the state of one body relative to another, */
110 /* the states of the two bodies must be known relative to a third */
111 /* body. One simple solution is to use the solar system barycenter */
112 /* as the third body. */
113
114 /* Ephemeris data from more than one segment may be required */
115 /* to determine the state of a body relative to the barycenter. */
116 /* ZZSPKSB1 reads as many segments as necessary, from as many */
117 /* files as necessary, using files that have been loaded by */
118 /* previous calls to SPKLEF (load ephemeris file). */
119
120 /* $ Examples */
121
122 /* In the following code fragment, ZZSPKSB1 is used to display */
123 /* the distance from Earth (Body 399) to Mars (body 499) at */
124 /* a series of epochs. */
125
126 /* CALL SPKLEF ( 'DE125.SPK', HANDLE ) */
127 /* . */
128 /* . */
129
130 /* EARTH = 399 */
131 /* MARS = 499 */
132
133 /* DO WHILE ( EPOCH .LE. END ) */
134 /* CALL ZZSPKSB1 ( EARTH, EPOCH, 'J2000', SEARTH ) */
135 /* CALL ZZSPKSB1 ( MARS, EPOCH, 'J2000', SMARS ) */
136
137 /* CALL VSUB ( SMARS, SEARTH, SMARS ) */
138 /* WRITE (*,*) EPOCH, VNORM ( SMARS ) */
139
140 /* EPOCH = EPOCH + DELTA */
141 /* END DO */
142
143 /* $ Restrictions */
144
145 /* 1) SPICE Private routine. */
146
147 /* 2) The ephemeris files to be used by ZZSPKSB1 must be loaded */
148 /* by SPKLEF before ZZSPKSB1 is called. */
149
150 /* $ Literature_References */
151
152 /* NAIF Document 168.0, "S- and P- Kernel (SPK) Specification and */
153 /* User's Guide" */
154
155 /* $ Author_and_Institution */
156
157 /* W.L. Taber (JPL) */
158 /* I.M. Underwood (JPL) */
159
160 /* $ Version */
161
162 /* - SPICELIB Version 1.0.0, 12-DEC-2004 (NJB) */
163
164 /* Based on SPICELIB Version 2.0.2, 20-NOV-2004 (NJB) */
165
166 /* -& */
167 /* $ Index_Entries */
168
169 /* state relative to solar system barycenter */
170
171 /* -& */
172 /* $ Revisions */
173
174 /* - SPICELIB Version 2.0.0, 19-SEP-1995 (WLT) */
175
176 /* The routine was simplified by replacing all of the */
177 /* main body of code with a call to SPKGEO. By making */
178 /* this change the routine now supports non-inertial frames. */
179
180 /* -& */
181
182 /* SPICELIB functions */
183
184
185 /* Local variables */
186
187
188 /* Standard SPICE error handling. */
189
190 if (return_()) {
191 return 0;
192 } else {
193 chkin_("ZZSPKSB1", (ftnlen)8);
194 }
195 bary = 0;
196 zzspkgo1_(targ, et, ref, &bary, starg, <, ref_len);
197 chkout_("ZZSPKSB1", (ftnlen)8);
198 return 0;
199 } /* zzspksb1_ */
200
201