Instrument Neutral Distributed Interface INDI 2.2.5
point.c
Go to the documentation of this file.
1#include "s2e.c"
2
3#include "spk.h"
4#include "astr.c"
5#include "ctar.c"
6#include "vtel.c"
7
8#include <stdio.h>
9
10/*--------------------------------------------------------------------*/
11
12/*
13** - - - - - -
14** P O I N T
15** - - - - - -
16**
17** Simplest possible demonstration of SPK.
18**
19** The one-call star-to-encoders function spkS2h is called for a given
20** set of cirumstances and predicts the mount encoder demands that will
21** acquire the specified target.
22**
23** For diagnostic purposes the user may wish to adapt the present
24** program to generate test results for different circumstances.
25**
26** This revision: 2024 July 18
27**
28** Author P.T.Wallace - see license notice at end.
29*/
30
31int main ()
32{
33
34/* Arcseconds and degrees to radians */
35 const double AS2R = 4.848136811095359935899141e-6;
36 const double D2R = 1.745329251994329576923691e-2;
37
38/* 180 deg in radians */
39 const double D180 = 3.141592653589793238462643;
40
41/* Miscellaneous */
42 int mount, j, iy, im, id, ih, mi;
43 double xp, yp, dut1, slon, slat, sh, pnogo, p, tc, h, fl, wl, pia,
44 pib, pvd, pca, pnp, paw, pan, ga, gb, x, y, a, b, r, sec,
45 rc, dc, pr, pd, px, rv, adem, bdem, ademb, bdemb, rdem;
46
47
48/*
49** --------------------
50** The given conditions
51** --------------------
52*/
53/* Earth orientation parameters. */
54 xp = 50.995e-3 * AS2R; /* polar motion x */
55 yp = 376.723e-3 * AS2R; /* polar motion y */
56 dut1 = 155.0675e-3; /* UT1-UTC */
57
58/* Observatory. */
59 if ( iauAf2a ( '-', 5, 41, 54.2, &slon ) ) return -1; /* long */
60 if ( iauAf2a ( '-', 15, 57, 42.8, &slat ) ) return -1; /* lat */
61 sh = 625.0; /* altitude */
62 mount = EQUAT; /* mount type */
63// mount = ALTAZ;
64 pnogo = 0.5 * D2R; /* pole avoidance */
65
66/* Ambient air conditions. */
67 p = 952.0; /* pressure */
68 tc = 18.5; /* temperature */
69 h = 0.83; /* humidity */
70
71/* Optics. */
72 fl = 3000.0; /* focal length */
73 wl = 0.55; /* wavelength */
74
75/* Pointing model coefficients. */
76 pia = 25.000 * AS2R; /* -IH or +IA */
77 pib = 15.000 * AS2R; /* +ID or +IE */
78 pvd = 6.788 * AS2R; /* +FLOP */
79 pca = -110.000 * AS2R; /* -CH or +CA */
80 pnp = 8.000 * AS2R; /* -NP or +NPAE*/
81 paw = 999.900 * AS2R; /* -MA or +AN */
82 pan = -12.000 * AS2R; /* +ME or +AW */
83 ga = 0.0 * AS2R; /* guiding correction to pca */
84 gb = 0.0 * AS2R; /* guiding correction to pib */
85
86/* Hotspot. */
87 x = 10.0; /* x coordinate in rotating FP */
88 y = 20.0; /* y coordinate in rotating FP */
89
90/* Mount and rotator angles (achieved). */
91 a = 43.831205 * D2R; /* -HA or pi-Az (radians) */
92 b = -13.155550 * D2R; /* Dec or El */
93 r = -179.806735 * D2R; /* rotator angle*/
94
95/* UTC. */
96 iy = 2013; /* year (CE) */
97 im = 4; /* month */
98 id = 2; /* day */
99 ih = 23; /* hour */
100 mi = 15; /* minute */
101 sec = 43.45; /* seconds */
102
103/* Target. */
104 if ( iauTf2a ( ' ', 14, 34, 16.81183, &rc ) ) return -1; /* RA */
105 if ( iauAf2a ( '-', 12, 31, 10.3965, &dc ) ) return -1; /* Dec */
106 pr = atan2 ( -354.45e-3 * AS2R, cos(dc) ); /* pmRA */
107 pd = 595.35e-3 * AS2R; /* pmDec */
108 px = 164.99e-3; /* parx */
109 rv = 0.0; /* RV */
110
111/*
112** -----------------
113** Report the givens
114** -----------------
115*/
116
117 printf ( "\nCIRCUMSTANCES\n\n" );
118 printf ( " polar motion x = %+8.3f mas\n", xp*1e3/AS2R );
119 printf ( " y = %+8.3f\n\n", yp*1e3/AS2R );
120 printf ( " UT1-UTC = %+.3f ms\n\n", dut1*1e3 );
121 printf ( " site: longitude = %+.5f deg E\n", slon/D2R );
122 printf ( " latitude = %+.5f deg\n", slat/D2R );
123 printf ( " altitude = %.3f m\n\n", sh );
124 printf ( " %s mount\n", mount == EQUAT ? "equatorial" :
125 "altazimuth" );
126 printf ( " pole avoidance = %.3f deg\n\n", pnogo/D2R );
127 printf ( " ambient air pressure = %.2f hPa\n", p );
128 printf ( " temperature = %+.3f C\n", tc );
129 printf ( " relative humidity = %.1f %%\n\n", h*100.0 );
130 printf ( " focal length = %g user units\n", fl );
131 printf ( " wavelength = %.1f nm\n\n", wl*1e3 );
132 printf ( " pointing model: IA = %+.3f arcsec\n", pia/AS2R );
133 printf ( " IB = %+.3f\n", pib/AS2R );
134 printf ( " VD = %+.3f\n", pvd/AS2R );
135 printf ( " CA = %+.3f\n", pca/AS2R );
136 printf ( " NP = %+.3f\n", pnp/AS2R );
137 printf ( " AW = %+.3f\n", paw/AS2R );
138 printf ( " AN = %+.3f\n\n", pan/AS2R );
139 printf ( " guiding correction to CA = %+.3f arcsec\n", ga/AS2R );
140 printf ( " to IB = %+.3f arcsec\n\n", gb/AS2R );
141 printf ( " hotspot x = %g user units\n", x );
142 printf ( " y = %g\n\n", y );
143 printf ( " achieved roll = %+11.6f deg\n", a/D2R );
144 printf ( " pitch = %+11.6f deg\n", b/D2R );
145 printf ( " theta = %+11.6f deg\n\n", r/D2R );
146 printf ( " UTC = %d/%2.2d/%2.2d %d:%2.2d:%06.3f\n\n",
147 iy, im, id, ih, mi, sec );
148 printf ( " target RA = %10.6f deg\n", rc/D2R );
149 printf ( " Dec = %+10.6f\n\n", dc/D2R );
150 printf ( " proper motion in RA = %+11.7f s/y\n", pr/AS2R/15.0 );
151 printf ( " Dec = %+10.6f \"/y\n\n", pd/AS2R );
152 printf ( " parallax = %7.3f mas\n", px*1e3 );
153 printf ( " radial velocity = %+.3f km/s\n\n", rv );
154
155/*
156** ---------------------------
157** Compute the encoder demands
158** ---------------------------
159*/
160
161 j = spkS2e ( xp, yp, dut1, slon, slat, sh, mount, pnogo,
162 p, tc, h, fl, wl, pia, pib, pvd, pca, pnp, paw, pan,
163 ga, gb, x, y, a, b, r, iy, im, id, ih, mi, sec,
164 rc, dc, pr, pd, px, rv,
165 &adem, &bdem, &ademb, &bdemb, &rdem );
166
167/*
168** ------------------
169** Report the results
170** ------------------
171*/
172
173 if ( !j ) {
174 printf ( "\nRESULTS\n\n" );
175 if ( mount == EQUAT ) {
176 printf ( " HA,Dec,rotator demands in degrees:\n\n" );
177 printf ( " H = %+11.6f ", -iauAnpm(adem)/D2R );
178 printf ( "D = %11.6f (normal)\n\n", bdem/D2R );
179 printf ( " Hb = %+11.6f ", -iauAnpm(ademb)/D2R );
180 printf ( "Db = %11.6f (beyond the pole)\n\n", bdemb/D2R );
181 printf ( " R = %11.6f "
182 "(for H,D axis demands and +y north)\n",
183 iauAnp(rdem)/D2R );
184 } else {
185 printf ( " Az,El,rotator demands in degrees:\n\n" );
186 printf ( " A = %11.6f ", iauAnp(D180-adem)/D2R );
187 printf ( "E = %+11.6f (normal)\n\n", bdem/D2R );
188 printf ( " Ab = %11.6f ", iauAnp(D180-ademb)/D2R );
189 printf ( "Eb = %+11.6f (beyond the zenith)\n\n", bdemb/D2R );
190 printf ( " R = %11.6f "
191 "(for A,E axis demands and +y north)\n",
192 iauAnp(rdem)/D2R );
193 }
194
195 /* Success. */
196 return 0;
197
198 } else {
199 printf ( "Call to spkS2e has failed!\n" );
200 return 1;
201 }
202}
203
204/*----------------------------------------------------------------------
205**
206** Copyright (C) 2024 by P.T.Wallace
207**
208** Permission to use, copy, modify, and/or distribute this software for
209** any purpose with or without fee is hereby granted.
210**
211** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
212** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
213** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
214** AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
215** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
216** OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
217** NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
218** CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
219**
220**--------------------------------------------------------------------*/
int main()
Definition point.c:31
int spkS2e(double xp, double yp, double dut1, double slon, double slat, double sh, int mount, double pnogo, double p, double tc, double h, double fl, double wl, double pia, double pib, double pvd, double pca, double pnp, double paw, double pan, double ga, double gb, double x, double y, double a, double b, double r, int iy, int im, int id, int ih, int mi, double sec, double rc, double dc, double pr, double pd, double px, double rv, double *adem, double *bdem, double *ademb, double *bdemb, double *rdem)
Definition s2e.c:3
#define iauAnpm
Definition sofa.h:39
#define iauAnp
Definition sofa.h:38
@ EQUAT
Definition spk.h:41