FACT++  1.0
void palAopqk ( double  rap,
double  dap,
const double  aoprms[14],
double *  aob,
double *  zob,
double *  hob,
double *  dob,
double *  rob 
)

Definition at line 179 of file palAopqk.c.

References i, palDcc2s(), palDcs2c(), palDranrm(), palRefro(), and palRefz().

Referenced by PointingModel::CalcPointingPos(), and palAop().

181  {
182 
183  /* Breakpoint for fast/slow refraction algorithm:
184  * ZD greater than arctan(4), (see palRefco routine)
185  * or vector Z less than cosine(arctan(Z)) = 1/sqrt(17) */
186  const double zbreak = 0.242535625;
187  int i;
188 
189  double sphi,cphi,st,v[3],xhd,yhd,zhd,diurab,f,
190  xhdt,yhdt,zhdt,xaet,yaet,zaet,azobs,
191  zdt,refa,refb,zdobs,dzd,dref,ce,
192  xaeo,yaeo,zaeo,hmobs,dcobs,raobs;
193 
194  /* sin, cos of latitude */
195  sphi = aoprms[1];
196  cphi = aoprms[2];
197 
198  /* local apparent sidereal time */
199  st = aoprms[13];
200 
201  /* apparent ra,dec to cartesian -ha,dec */
202  palDcs2c( rap-st, dap, v );
203  xhd = v[0];
204  yhd = v[1];
205  zhd = v[2];
206 
207  /* diurnal aberration */
208  diurab = aoprms[3];
209  f = (1.0-diurab*yhd);
210  xhdt = f*xhd;
211  yhdt = f*(yhd+diurab);
212  zhdt = f*zhd;
213 
214  /* cartesian -ha,dec to cartesian az,el (s=0,e=90) */
215  xaet = sphi*xhdt-cphi*zhdt;
216  yaet = yhdt;
217  zaet = cphi*xhdt+sphi*zhdt;
218 
219  /* azimuth (n=0,e=90) */
220  if (xaet == 0.0 && yaet == 0.0) {
221  azobs = 0.0;
222  } else {
223  azobs = atan2(yaet,-xaet);
224  }
225 
226  /* topocentric zenith distance */
227  zdt = atan2(sqrt(xaet*xaet+yaet*yaet),zaet);
228 
229  /*
230  * refraction
231  * ---------- */
232 
233  /* fast algorithm using two constant model */
234  refa = aoprms[10];
235  refb = aoprms[11];
236  palRefz(zdt,refa,refb,&zdobs);
237 
238  /* large zenith distance? */
239  if (cos(zdobs) < zbreak) {
240 
241  /* yes: use rigorous algorithm */
242 
243  /* initialize loop (maximum of 10 iterations) */
244  i = 1;
245  dzd = 1.0e1;
246  while (fabs(dzd) > 1e-10 && i <= 10) {
247 
248  /* compute refraction using current estimate of observed zd */
249  palRefro(zdobs,aoprms[4],aoprms[5],aoprms[6],
250  aoprms[7],aoprms[8],aoprms[0],
251  aoprms[9],1e-8,&dref);
252 
253  /* remaining discrepancy */
254  dzd = zdobs+dref-zdt;
255 
256  /* update the estimate */
257  zdobs = zdobs-dzd;
258 
259  /* increment the iteration counter */
260  i++;
261  }
262  }
263 
264  /* to cartesian az/zd */
265  ce = sin(zdobs);
266  xaeo = -cos(azobs)*ce;
267  yaeo = sin(azobs)*ce;
268  zaeo = cos(zdobs);
269 
270  /* cartesian az/zd to cartesian -ha,dec */
271  v[0] = sphi*xaeo+cphi*zaeo;
272  v[1] = yaeo;
273  v[2] = -cphi*xaeo+sphi*zaeo;
274 
275  /* to spherical -ha,dec */
276  palDcc2s(v,&hmobs,&dcobs);
277 
278  /* right ascension */
279  raobs = palDranrm(st+hmobs);
280 
281  /* return the results */
282  *aob = azobs;
283  *zob = zdobs;
284  *hob = -hmobs;
285  *dob = dcobs;
286  *rob = raobs;
287 
288 }
void palRefro(double zobs, double hm, double tdk, double pmb, double rh, double wl, double phi, double tlr, double eps, double *ref)
Definition: palRefro.c:185
int i
Definition: db_dim_client.c:21
void palRefz(double zu, double refa, double refb, double *zr)
Definition: palRefz.c:136
void palDcc2s(double v[3], double *a, double *b)
Definition: palOne2One.c:327
double palDranrm(double angle)
Definition: palOne2One.c:766
void palDcs2c(double a, double b, double v[3])
Definition: palOne2One.c:368

+ Here is the call graph for this function:

+ Here is the caller graph for this function: