source: branches/FACT++_lidctrl_usb/pal/palPvobs.c@ 18716

Last change on this file since 18716 was 18347, checked in by tbretz, 9 years ago
File size: 2.6 KB
Line 
1/*
2*+
3* Name:
4* palPvobs
5
6* Purpose:
7* Position and velocity of an observing station.
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* palPvobs( double p, double h, double stl, double pv[6] )
17
18* Arguments:
19* p = double (Given)
20* Latitude (geodetic, radians).
21* h = double (Given)
22* Height above reference spheroid (geodetic, metres).
23* stl = double (Given)
24* Local apparent sidereal time (radians).
25* pv = double[ 6 ] (Returned)
26* position/velocity 6-vector (AU, AU/s, true equator
27* and equinox of date).
28
29* Description:
30* Returns the position and velocity of an observing station.
31
32* Notes:
33* - The WGS84 reference ellipsoid is used.
34
35* Authors:
36* PTW: Pat Wallace (STFC)
37* DSB: David Berry (JAC, Hawaii)
38* {enter_new_authors_here}
39
40* History:
41* 2012-02-16 (DSB):
42* Initial version.
43* Adapted with permission from the Fortran SLALIB library.
44* {enter_further_changes_here}
45
46* Copyright:
47* Copyright (C) 1995 Rutherford Appleton Laboratory
48* Copyright (C) 2012 Science and Technology Facilities Council.
49* All Rights Reserved.
50
51* Licence:
52* This program is free software: you can redistribute it and/or
53* modify it under the terms of the GNU Lesser General Public
54* License as published by the Free Software Foundation, either
55* version 3 of the License, or (at your option) any later
56* version.
57*
58* This program is distributed in the hope that it will be useful,
59* but WITHOUT ANY WARRANTY; without even the implied warranty of
60* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61* GNU Lesser General Public License for more details.
62*
63* You should have received a copy of the GNU Lesser General
64* License along with this program. If not, see
65* <http://www.gnu.org/licenses/>.
66
67* Bugs:
68* {note_any_bugs_here}
69*-
70*/
71
72#include "pal.h"
73#include "palmac.h"
74#include "palmac.h"
75#include "pal1sofa.h"
76
77void palPvobs( double p, double h, double stl, double pv[6] ){
78
79/* Local Variables: */
80 double xyz[3], z, r, s, c, v;
81
82/* Geodetic to geocentric conversion (WGS84 reference ellipsoid). */
83 eraGd2gc( ERFA_WGS84, 0.0, p, h, xyz );
84
85/* Convert from metres to AU */
86 r = xyz[ 0 ]/ERFA_DAU;
87 z = xyz[ 2 ]/ERFA_DAU;
88
89/* Functions of ST. */
90 s = sin( stl );
91 c = cos( stl );
92
93/* Speed. */
94 v = PAL__SR*r;
95
96/* Position. */
97 pv[ 0 ] = r*c;
98 pv[ 1 ] = r*s;
99 pv[ 2 ] = z;
100
101/* Velocity. */
102 pv[ 3 ] = -v*s;
103 pv[ 4 ] = v*c;
104 pv[ 5 ] = 0.0;
105
106}
107
108
Note: See TracBrowser for help on using the repository browser.