Changeset 2551 in Sophya for trunk/SophyaExt/XephemAstroLib/earthsat.c
- Timestamp:
- Jun 15, 2004, 6:54:12 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XephemAstroLib/earthsat.c
r1719 r2551 23 23 #include <math.h> 24 24 #include <string.h> 25 26 #if defined(__STDC__)27 25 #include <stdlib.h> 28 #endif 29 30 #include "P_.h" 26 31 27 #include "astro.h" 32 #include "circum.h"33 28 #include "preferences.h" 34 29 … … 42 37 typedef double MAT3x3[3][3]; 43 38 44 static void esat_prop P_((Now *np, Obj *op, double *SatX, double *SatY, double 45 *SatZ, double *SatVX, double *SatVY, double *SatVZ)); 46 static void GetSatelliteParams P_((Obj *op)); 47 static void GetSiteParams P_((Now *np)); 48 static double Kepler P_((double MeanAnomaly, double Eccentricity)); 49 static void GetSubSatPoint P_((double SatX, double SatY, double SatZ, 50 double T, double *Latitude, double *Longitude, double *Height)); 51 static void GetSatPosition P_((double EpochTime, double EpochRAAN, 39 static int crazyOp (Now *np, Obj *op); 40 static void esat_prop (Now *np, Obj *op, double *SatX, double *SatY, double 41 *SatZ, double *SatVX, double *SatVY, double *SatVZ); 42 static void GetSatelliteParams (Obj *op); 43 static void GetSiteParams (Now *np); 44 static double Kepler (double MeanAnomaly, double Eccentricity); 45 static void GetSubSatPoint (double SatX, double SatY, double SatZ, 46 double T, double *Latitude, double *Longitude, double *Height); 47 static void GetSatPosition (double EpochTime, double EpochRAAN, 52 48 double EpochArgPerigee, double SemiMajorAxis, double Inclination, 53 49 double Eccentricity, double RAANPrecession, double PerigeePrecession, 54 50 double T, double TrueAnomaly, double *X, double *Y, double *Z, 55 double *Radius, double *VX, double *VY, double *VZ) );56 static void GetSitPosition P_((double SiteLat, double SiteLong,51 double *Radius, double *VX, double *VY, double *VZ); 52 static void GetSitPosition (double SiteLat, double SiteLong, 57 53 double SiteElevation, double CrntTime, double *SiteX, double *SiteY, 58 double *SiteZ, double *SiteVX, double *SiteVY, MAT3x3 SiteMatrix) );59 static void GetRange P_((double SiteX, double SiteY, double SiteZ,54 double *SiteZ, double *SiteVX, double *SiteVY, MAT3x3 SiteMatrix); 55 static void GetRange (double SiteX, double SiteY, double SiteZ, 60 56 double SiteVX, double SiteVY, double SatX, double SatY, double SatZ, 61 57 double SatVX, double SatVY, double SatVZ, double *Range, 62 double *RangeRate) );63 static void GetTopocentric P_((double SatX, double SatY, double SatZ,58 double *RangeRate); 59 static void GetTopocentric (double SatX, double SatY, double SatZ, 64 60 double SiteX, double SiteY, double SiteZ, MAT3x3 SiteMatrix, double *X, 65 double *Y, double *Z) );66 static void GetBearings P_((double SatX, double SatY, double SatZ,61 double *Y, double *Z); 62 static void GetBearings (double SatX, double SatY, double SatZ, 67 63 double SiteX, double SiteY, double SiteZ, MAT3x3 SiteMatrix, 68 double *Azimuth, double *Elevation) );69 static int Eclipsed P_((double SatX, double SatY, double SatZ,70 double SatRadius, double CrntTime) );71 static void InitOrbitRoutines P_((double EpochDay, int AtEod));64 double *Azimuth, double *Elevation); 65 static int Eclipsed (double SatX, double SatY, double SatZ, 66 double SatRadius, double CrntTime); 67 static void InitOrbitRoutines (double EpochDay, int AtEod); 72 68 73 69 #ifdef USE_ORBIT_PROPAGATOR 74 static void GetPrecession P_((double SemiMajorAxis, double Eccentricity,75 double Inclination, double *RAANPrecession, double *PerigeePrecession) );70 static void GetPrecession (double SemiMajorAxis, double Eccentricity, 71 double Inclination, double *RAANPrecession, double *PerigeePrecession); 76 72 #endif /* USE_ORBIT_PROPAGATOR */ 77 73 … … 135 131 */ 136 132 int 137 obj_earthsat (np, op) 138 Now *np; 139 Obj *op; 133 obj_earthsat (Now *np, Obj *op) 140 134 { 141 135 double Radius; /* From geocenter */ … … 267 261 */ 268 262 static void 269 esat_prop (np, op, SatX, SatY, SatZ, SatVX, SatVY, SatVZ) 270 Now *np; 271 Obj *op; 272 double *SatX,*SatY,*SatZ; 273 double *SatVX,*SatVY,*SatVZ; 263 esat_prop (Now *np, Obj *op, double *SatX, double *SatY, double *SatZ, 264 double *SatVX, double *SatVY, double *SatVZ) 274 265 { 275 266 #ifdef USE_ORBIT_PROPAGATOR … … 284 275 double Radius; 285 276 double CrntTime; 277 278 if (crazyOp (np, op)) { 279 *SatX = *SatY = *SatZ = *SatVX = *SatVY = *SatVZ = 0; 280 return; 281 } 286 282 287 283 SemiMajorAxis = 331.25 * exp(2*log(MinutesPerDay/epochMeanMotion)/3); … … 331 327 double dt; 332 328 int yr; 329 330 if (crazyOp (np, op)) { 331 *SatX = *SatY = *SatZ = *SatVX = *SatVY = *SatVZ = 0; 332 return; 333 } 333 334 334 335 /* init */ … … 392 393 } 393 394 395 /* return 1 if op is crazy @ np */ 396 static int 397 crazyOp (Now *np, Obj *op) 398 { 399 /* figure its daft if long enough to decay 1 rev/day */ 400 return (fabs(op->es_epoch - mjd) > 1/op->es_decay); 401 } 394 402 395 403 /* grab the xephem stuff from op and copy into orbit's globals. 396 404 */ 397 405 static void 398 GetSatelliteParams(op) 399 Obj *op; 406 GetSatelliteParams(Obj *op) 400 407 { 401 408 /* the following are for the orbit functions */ … … 429 436 430 437 static void 431 GetSiteParams(np) 432 Now *np; 438 GetSiteParams(Now *np) 433 439 { 434 440 SiteLat = lat; … … 465 471 466 472 static 467 double Kepler(MeanAnomaly,Eccentricity) 468 register double MeanAnomaly,Eccentricity; 469 473 double Kepler(double MeanAnomaly, double Eccentricity) 470 474 { 471 475 register double E; /* Eccentric Anomaly */ … … 494 498 495 499 static void 496 GetSubSatPoint(SatX,SatY,SatZ,T,Latitude,Longitude,Height) 497 double SatX,SatY,SatZ,T; 498 double *Latitude,*Longitude,*Height; 500 GetSubSatPoint(double SatX, double SatY, double SatZ, double T, 501 double *Latitude, double *Longitude, double *Height) 499 502 { 500 503 double r; … … 524 527 #ifdef USE_ORBIT_PROPAGATOR 525 528 static void 526 GetPrecession(SemiMajorAxis,Eccentricity,Inclination, 527 RAANPrecession,PerigeePrecession) 528 double SemiMajorAxis,Eccentricity,Inclination; 529 double *RAANPrecession,*PerigeePrecession; 529 GetPrecession(double SemiMajorAxis, double Eccentricity, double Inclination, 530 double *RAANPrecession, double *PerigeePrecession) 530 531 { 531 532 *RAANPrecession = 9.95*pow(EarthRadius/SemiMajorAxis,3.5) * cos(Inclination) … … 544 545 545 546 static void 546 GetSatPosition(EpochTime,EpochRAAN,EpochArgPerigee,SemiMajorAxis, 547 Inclination,Eccentricity,RAANPrecession,PerigeePrecession, 548 T,TrueAnomaly,X,Y,Z,Radius,VX,VY,VZ) 549 550 double EpochTime,EpochRAAN,EpochArgPerigee; 551 double SemiMajorAxis,Inclination,Eccentricity; 552 double RAANPrecession,PerigeePrecession,T, TrueAnomaly; 553 double *X,*Y,*Z,*Radius,*VX,*VY,*VZ; 547 GetSatPosition(double EpochTime, double EpochRAAN, double EpochArgPerigee, 548 double SemiMajorAxis, double Inclination, double Eccentricity, 549 double RAANPrecession, double PerigeePrecession, double T, 550 double TrueAnomaly, double *X, double *Y, double *Z, double *Radius, 551 double *VX, double *VY, double *VZ) 554 552 555 553 { … … 607 605 608 606 static void 609 GetSitPosition(SiteLat,SiteLong,SiteElevation,CrntTime, 610 SiteX,SiteY,SiteZ,SiteVX,SiteVY,SiteMatrix) 611 612 double SiteLat,SiteLong,SiteElevation,CrntTime; 613 double *SiteX,*SiteY,*SiteZ,*SiteVX,*SiteVY; 614 MAT3x3 SiteMatrix; 615 607 GetSitPosition(double SiteLat, double SiteLong, double SiteElevation, 608 double CrntTime, double *SiteX, double *SiteY, double *SiteZ, double *SiteVX, 609 double *SiteVY, MAT3x3 SiteMatrix) 616 610 { 617 611 static double G1,G2; /* Used to correct for flattening of the Earth */ … … 663 657 664 658 static void 665 GetRange(SiteX,SiteY,SiteZ,SiteVX,SiteVY, 666 SatX,SatY,SatZ,SatVX,SatVY,SatVZ,Range,RangeRate) 667 668 double SiteX,SiteY,SiteZ,SiteVX,SiteVY; 669 double SatX,SatY,SatZ,SatVX,SatVY,SatVZ; 670 double *Range,*RangeRate; 659 GetRange(double SiteX, double SiteY, double SiteZ, double SiteVX, 660 double SiteVY, double SatX, double SatY, double SatZ, double SatVX, 661 double SatVY, double SatVZ, double *Range, double *RangeRate) 671 662 { 672 663 double DX,DY,DZ; … … 684 675 685 676 static void 686 GetTopocentric(SatX,SatY,SatZ,SiteX,SiteY,SiteZ,SiteMatrix,X,Y,Z) 687 double SatX,SatY,SatZ,SiteX,SiteY,SiteZ; 688 double *X,*Y,*Z; 689 MAT3x3 SiteMatrix; 677 GetTopocentric(double SatX, double SatY, double SatZ, double SiteX, 678 double SiteY, double SiteZ, MAT3x3 SiteMatrix, double *X, double *Y, 679 double *Z) 690 680 { 691 681 SatX -= SiteX; … … 702 692 703 693 static void 704 GetBearings(SatX,SatY,SatZ,SiteX,SiteY,SiteZ,SiteMatrix,Azimuth,Elevation) 705 double SatX,SatY,SatZ,SiteX,SiteY,SiteZ; 706 MAT3x3 SiteMatrix; 707 double *Azimuth,*Elevation; 694 GetBearings(double SatX, double SatY, double SatZ, double SiteX, 695 double SiteY, double SiteZ, MAT3x3 SiteMatrix, double *Azimuth, 696 double *Elevation) 708 697 { 709 698 double x,y,z; … … 720 709 721 710 static int 722 Eclipsed( SatX,SatY,SatZ,SatRadius,CrntTime)723 double SatX,SatY,SatZ,SatRadius,CrntTime;711 Eclipsed(double SatX, double SatY, double SatZ, double SatRadius, 712 double CrntTime) 724 713 { 725 714 double MeanAnomaly,TrueAnomaly; … … 751 740 752 741 static void 753 InitOrbitRoutines(EpochDay, AtEod) 754 double EpochDay; 755 int AtEod; 742 InitOrbitRoutines(double EpochDay, int AtEod) 756 743 { 757 744 double T,T2,T3,Omega; … … 797 784 798 785 /* For RCS Only -- Do Not Edit */ 799 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: earthsat.c,v $ $Date: 200 1-10-22 12:08:27 $ $Revision: 1.2$ $Name: not supported by cvs2svn $"};786 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: earthsat.c,v $ $Date: 2004-06-15 16:52:38 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
Note:
See TracChangeset
for help on using the changeset viewer.