Changeset 2551 in Sophya for trunk/SophyaExt/XephemAstroLib/riset_cir.c
- Timestamp:
- Jun 15, 2004, 6:54:12 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XephemAstroLib/riset_cir.c
r1719 r2551 3 3 #include <stdio.h> 4 4 #include <math.h> 5 #if defined(__STDC__)6 5 #include <stdlib.h> 7 6 #include <string.h> 8 #endif 9 10 #include "P_.h" 7 11 8 #include "astro.h" 12 #include "circum.h"13 9 14 10 #define TMACC (10./3600./24.0) /* convergence accuracy, days */ 15 11 16 static void e_riset_cir P_((Now *np, Obj *op, double dis, RiseSet *rp));17 static int find_0alt P_((double dt, double dis, Now *np, Obj *op));18 static int find_transit P_((double dt, Now *np, Obj *op));19 static int find_max P_((Now *np, Obj *op, double tr, double ts, double *tp,20 double *alp) );12 static void e_riset_cir (Now *np, Obj *op, double dis, RiseSet *rp); 13 static int find_0alt (double dt, double dis, Now *np, Obj *op); 14 static int find_transit (double dt, Now *np, Obj *op); 15 static int find_max (Now *np, Obj *op, double tr, double ts, double *tp, 16 double *alp); 21 17 22 18 /* find where and when an object, op, will rise and set and … … 26 22 */ 27 23 void 28 riset_cir (np, op, dis, rp) 29 Now *np; 30 Obj *op; 31 double dis; 32 RiseSet *rp; 24 riset_cir (Now *np, Obj *op, double dis, RiseSet *rp) 33 25 { 34 26 double mjdn; /* mjd of local noon */ … … 64 56 /* first approximation is to find rise/set times of a fixed object 65 57 * at the current epoch in its position at local noon. 66 * N.B. add typical refraction for initial go/no-go test. if it67 * passes, real code does refraction rigorously.58 * N.B. add typical refraction if dis is above horizon for initial 59 * go/no-go test. if it passes, real code does refraction rigorously. 68 60 */ 69 61 n.n_mjd = mjdn; … … 73 65 } 74 66 ran = o.s_gaera; 75 riset (o.s_gaera, o.s_gaedec, lat, dis+.01, &lr, &ls, &ar, &as, &rss); 67 riset (o.s_gaera, o.s_gaedec, lat, dis+(dis>.01 ? 0 : .01), &lr, &ls, 68 &ar, &as, &rss); 76 69 switch (rss) { 77 70 case 0: break; … … 133 126 */ 134 127 void 135 twilight_cir (np, dis, dawn, dusk, status) 136 Now *np; 137 double dis; 138 double *dawn, *dusk; 139 int *status; 128 twilight_cir (Now *np, double dis, double *dawn, double *dusk, int *status) 140 129 { 141 130 RiseSet rs; 142 131 Obj o; 143 132 133 memset (&o, 0, sizeof(o)); 144 134 o.o_type = PLANET; 145 o.pl .pl_code = SUN;135 o.pl_code = SUN; 146 136 (void) strcpy (o.o_name, "Sun"); 147 137 riset_cir (np, &o, dis, &rs); … … 160 150 */ 161 151 static void 162 e_riset_cir (np, op, dis, rp) 163 Now *np; 164 Obj *op; 165 double dis; 166 RiseSet *rp; 152 e_riset_cir (Now *np, Obj *op, double dis, RiseSet *rp) 167 153 { 168 154 #define DEGSTEP 5 /* time step is about this many degrees */ … … 272 258 */ 273 259 static int 274 find_0alt ( dt, dis, np, op)275 double dt ;/* hours from noon to first guess at event */276 double dis ;/* horizon displacement, rads */277 Now *np ;/* working Now -- starts with mjd is noon, returns as answer */278 Obj *op ;/* working object -- returns as answer */260 find_0alt ( 261 double dt, /* hours from noon to first guess at event */ 262 double dis, /* horizon displacement, rads */ 263 Now *np, /* working Now -- starts with mjd is noon, returns as answer */ 264 Obj *op) /* working object -- returns as answer */ 279 265 { 280 266 #define MAXPASSES 20 /* max iterations to try */ … … 286 272 287 273 /* insure initial guess is today -- if not, move by 24 hours */ 288 if (dt < -12.0) 289 dt += 24.0; 290 if (dt > 12.0) 291 dt -= 24.0; 274 if (dt < -12.0 && !find_0alt (dt+24, dis, np, op)) 275 return (0); 276 mjd = mjdn; 277 if (dt > 12.0 && !find_0alt (dt-24, dis, np, op)) 278 return (0); 279 mjd = mjdn; 292 280 293 281 /* convert dt to days for remainder of algorithm */ … … 325 313 */ 326 314 static int 327 find_transit (dt, np, op) 328 double dt; 329 Now *np; 330 Obj *op; 315 find_transit (double dt, Now *np, Obj *op) 331 316 { 332 317 #define MAXLOOPS 10 … … 370 355 */ 371 356 static int 372 find_max ( np, op, tr, ts, tp, alp)373 Now *np ;374 Obj *op ;375 double tr, ts;/* times of rise and set */376 double *tp, *alp;/* time of max altitude, and that altitude */357 find_max ( 358 Now *np, 359 Obj *op, 360 double tr, double ts, /* times of rise and set */ 361 double *tp, double *alp) /* time of max altitude, and that altitude */ 377 362 { 378 363 mjd = (ts + tr)/2; … … 385 370 386 371 /* For RCS Only -- Do Not Edit */ 387 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset_cir.c,v $ $Date: 200 1-10-22 12:08:28 $ $Revision: 1.2$ $Name: not supported by cvs2svn $"};372 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: riset_cir.c,v $ $Date: 2004-06-15 16:52:40 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
Note:
See TracChangeset
for help on using the changeset viewer.