Changeset 5533
- Timestamp:
- Nov 16, 2005, 5:59:05 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 5 edited
-
src/astro/psEarthOrientation.c (modified) (3 diffs)
-
src/astro/psEarthOrientation.h (modified) (2 diffs)
-
test/astro/tst_psEarthOrientation.c (modified) (6 diffs)
-
test/astro/verified/tst_psEarthOrientation.stderr (modified) (2 diffs)
-
test/astro/verified/tst_psEarthOrientation.stdout (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r5531 r5533 8 8 * @author Robert Daniel DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-11-17 0 0:07:25 $10 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-11-17 03:59:05 $ 12 12 * 13 13 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 493 493 S -= X*Y/2.0; 494 494 495 psEarthPole* pole = psAlloc(sizeof(psEarthPole)); 495 // psEarthPole* pole = psAlloc(sizeof(psEarthPole)); 496 psEarthPole* pole = psEarthPoleAlloc(); 496 497 pole->x = X; 497 498 pole->y = Y; … … 850 851 psEarthPole* psEOC_NutationCorr(psTime *time) 851 852 { 852 return NULL; 853 // Check for null parameter 854 PS_ASSERT_PTR_NON_NULL(time, NULL); 855 if (time->type == PS_TIME_UT1) { 856 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 857 "Invalid time input. Time cannot be of type UT1.\n"); 858 return NULL; 859 } 860 861 // Convert psTime to MJD 862 double MJD = psTimeToMJD(time); 863 864 // Calculate number of Julian centuries since 2000 865 double t = ( MJD - MJD_2000 ) / JULIAN_CENTURY; 866 double t2 = t*t; 867 double t3 = t*t*t; 868 double t4 = t*t*t*t; 869 870 //XXX: I think the t's should be inside of the SEC_TO_RAD conversion. 871 //Check this and for Precession Model as well! 872 double F[5]; 873 F[0] = DEG_TO_RAD(134.96340251) + 874 SEC_TO_RAD(1717915923.2178)*t + 875 SEC_TO_RAD(31.8792)*t2 + 876 SEC_TO_RAD(0.051635)*t3 - 877 SEC_TO_RAD(0.00024470)*t4; 878 879 // Mean Anomaly of the Sun 880 F[1] = DEG_TO_RAD(357.52910918) + 881 SEC_TO_RAD(129596581.0481)*t - 882 SEC_TO_RAD(0.5532)*t2 + 883 SEC_TO_RAD(0.000136)*t3 - 884 SEC_TO_RAD(0.00001149)*t4; 885 886 // L â Omega 887 F[2] = DEG_TO_RAD(93.27209062) + 888 SEC_TO_RAD(1739527262.8478)*t - 889 SEC_TO_RAD(12.7512)*t2 - 890 SEC_TO_RAD(0.001037)*t3 + 891 SEC_TO_RAD(0.00000417)*t4; 892 893 // Mean Elongation of the Moon from the Sun 894 F[3] = DEG_TO_RAD(297.85019547) + 895 SEC_TO_RAD(1602961601.2090)*t - 896 SEC_TO_RAD(6.3706)*t2 + 897 SEC_TO_RAD(0.006593)*t3 - 898 SEC_TO_RAD(0.00003169)*t4; 899 900 // Mean Longitude of the Ascending Node of the Moon 901 F[4] = DEG_TO_RAD(125.04455501) - 902 SEC_TO_RAD(6962890.5431)*t + 903 SEC_TO_RAD(7.4722)*t2 + 904 SEC_TO_RAD(0.007702)*t3 - 905 SEC_TO_RAD(0.0000593)*t4; 906 907 //argument values taken from table 5.1 in IERS techical note No.32 908 //http://maia.usno.navy.mil/conv2000/chapter5/tn32_c5.pdf, p38 909 //Units are in micro-arcseconds here and must be converted to radians before using 910 double w_l[10] = {SEC_TO_RAD(-1.0), SEC_TO_RAD(-1.0), SEC_TO_RAD(1.0), 0.0, 0.0, 911 SEC_TO_RAD(-1.0), 0.0, 0.0, 0.0, SEC_TO_RAD(1.0)}; 912 double w_l_p[10] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; 913 double w_F[10] = {SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 914 SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-2.0), 0.0,0.0,0.0}; 915 double w_D[10] = {0.0,0.0, SEC_TO_RAD(-2.0), 0.0,0.0,0.0, SEC_TO_RAD(2.0), 0.0,0.0,0.0}; 916 double w_Omega[10] = {SEC_TO_RAD(-1.0), SEC_TO_RAD(-2.0), SEC_TO_RAD(-2.0), 917 SEC_TO_RAD(-1.0), SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-2.0), 0.0, SEC_TO_RAD(-1.0), 0.0}; 918 double xp_sin[10] = {SEC_TO_RAD(-0.44), SEC_TO_RAD(-2.31), SEC_TO_RAD(-0.44), 919 SEC_TO_RAD(-2.14), SEC_TO_RAD(-11.36), SEC_TO_RAD(0.84), SEC_TO_RAD(-4.76), 920 SEC_TO_RAD(14.27), SEC_TO_RAD(1.93), SEC_TO_RAD(0.76)}; 921 double xp_cos[10] = {SEC_TO_RAD(0.25), SEC_TO_RAD(1.32), SEC_TO_RAD(0.25), SEC_TO_RAD(1.23), 922 SEC_TO_RAD(6.52), SEC_TO_RAD(-0.48), SEC_TO_RAD(2.73), SEC_TO_RAD(-8.19), 923 SEC_TO_RAD(-1.11), SEC_TO_RAD(-0.43)}; 924 double yp_sin[10] = {SEC_TO_RAD(-0.25), SEC_TO_RAD(-1.32), SEC_TO_RAD(-0.25), 925 SEC_TO_RAD(-1.23), SEC_TO_RAD(-6.52), SEC_TO_RAD(0.48), SEC_TO_RAD(-2.73), 926 SEC_TO_RAD(8.19), SEC_TO_RAD(1.11), SEC_TO_RAD(0.43)}; 927 double yp_cos[10] = {SEC_TO_RAD(-0.44), SEC_TO_RAD(-2.31), SEC_TO_RAD(-0.44), 928 SEC_TO_RAD(-2.14), SEC_TO_RAD(-11.36), SEC_TO_RAD(0.84), SEC_TO_RAD(-4.76), 929 SEC_TO_RAD(14.27), SEC_TO_RAD(1.93), SEC_TO_RAD(0.76)}; 930 931 double X = 0.0; 932 double Y = 0.0; 933 double arg = 0.0; 934 //This is from eqn 131 in the ADD - Note: pj_tj isn't included the first time. 935 //XXX: The xp_sin, yp_cos, etc. may need to be multiplied by pow(t,i) here? adding now... 936 double tj = 0.0; 937 938 // calculate the polynomial portion first - the pj * t^j (poly coeff's) 939 // Check if EOC data loaded 940 if(! eocInitialized) { 941 eocInitialized = p_psEOCInit(); 942 if(!eocInitialized) { 943 // XXX: Move error message. 944 psError(PS_ERR_UNKNOWN, false, 945 "Could not initialize EOC tables -- check data files."); 946 return NULL; 947 } 948 } 949 X = psPolynomial1DEval(xPoly,t); 950 Y = psPolynomial1DEval(yPoly,t); 951 for (int i = 0; i < 10; i++) { 952 // tj = SEC_TO_RAD(pow(t, i)); 953 tj = pow(t, i); 954 arg = w_l[i]*F[0] + w_l_p[i]*F[1] + w_F[i]*F[2] + w_D[i]*F[3] + w_Omega[i]*F[4]; 955 X += xp_sin[i] * tj * sin(arg) + xp_cos[i] * tj * cos(arg); 956 Y += yp_sin[i] * tj * sin(arg) + yp_cos[i] * tj * cos(arg); 957 } 958 959 psEarthPole *pole = psEarthPoleAlloc(); 960 pole->x = X; 961 pole->y = Y; 962 pole->s = SEC_TO_RAD(4.7e-5) * t; //XXX: This conv. should include t? 963 964 return pole; 853 965 } 854 966 -
trunk/psLib/src/astro/psEarthOrientation.h
r5522 r5533 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-11-1 6 02:40:13$11 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-11-17 03:59:05 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 45 45 psPrecessMethod; 46 46 47 /** Initialize EOC. 48 * 49 * Parses IERS table data and creates the polynomials used by certain EOC functions. 50 * 51 * @return bool: True if successful, otherwise false. 52 */ 47 53 bool p_psEOCInit(void); 48 54 -
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5524 r5533 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-11-1 6 20:52:23$7 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-11-17 03:59:05 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 14 14 #include "pslib_strict.h" 15 15 16 //static psS32 testEOCParallax(void);17 static psS32 testEOCInit_Final(void);18 16 static psS32 testAberration(void); 19 17 static psS32 testGravityDeflect(void); … … 26 24 27 25 testDescription tests[] = { 28 {testEOCInit_Final, 665, "psEOCInit_Final", 0, false},29 26 {testAberration, 666, "psAberration()", 0, false}, 30 27 {testGravityDeflect, 667, "psGravityDeflect()", 0, false}, 31 // {testEOCParallax, 668, "psEOCParallax()", 0, false},32 28 {testEOCPrecession, 669, "psEOCPrecession()", 0, false}, 33 29 {testEOCPolar, 670, "psEOCPolar()", 0, false}, … … 56 52 57 53 // return ( ! runTestSuite( stderr, "psEarthOrientation", tests, argc, argv ) ); 58 }59 60 psS32 testEOCInit_Final(void)61 {62 return 0;63 54 } 64 55 … … 171 162 psFree(UT1time); 172 163 //Check return values from valid precession input 173 174 164 pmodel = psEOC_PrecessionModel(time); 175 165 if ( pmodel == NULL ) { … … 288 278 psS32 testEOCNutation(void) 289 279 { 280 psTime *in = psTimeAlloc(PS_TIME_TAI); 281 in->sec = 1131579114; 282 in->nsec = 498489000; 283 in->leapsecond = false; 284 psTime *empty = NULL; 285 psEarthPole *nute = NULL; 286 287 //Return NULL for NULL input time. 288 nute = psEOC_NutationCorr(empty); 289 if (nute != NULL) { 290 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 291 "psEOC_NutationCorr failed to return NULL for NULL input time.\n"); 292 return 1; 293 } 294 //Return NULL for UT1 time input 295 psTime *UT1time = psTimeAlloc(PS_TIME_UT1); 296 nute = psEOC_NutationCorr(UT1time); 297 if (nute != NULL) { 298 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 299 "psEOC_NutationCorr failed to return NULL for UT1 input time.\n"); 300 return 2; 301 } 302 psFree(UT1time); 303 //Check return values from valid nutation time input 304 nute = psEOC_PrecessionModel(in); 305 if ( nute == NULL ) { 306 psError(PS_ERR_BAD_PARAMETER_NULL, false, 307 "psEOC_NutationCorr returned NULL for valid input.\n"); 308 return 3; 309 } else { 310 printf("Nutation Correction output = x,y,s = %.8g, %.8g, %.8g\n\n", 311 nute->x, nute->y, nute->s); 312 } 313 psFree(nute); 314 psFree(in); 315 316 if (!p_psEOCFinalize() ) { 317 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n"); 318 return 12; 319 } 290 320 291 321 return 0; -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr
r5522 r5533 1 /***************************** TESTPOINT ******************************************\2 * TestFile: tst_psEarthOrientation.c *3 * TestPoint: psEarthOrientation{psEOCInit_Final} *4 * TestType: Positive *5 \**********************************************************************************/6 7 8 ---> TESTPOINT PASSED (psEarthOrientation{psEOCInit_Final} | tst_psEarthOrientation.c)9 10 1 /***************************** TESTPOINT ******************************************\ 11 2 * TestFile: tst_psEarthOrientation.c * … … 70 61 \**********************************************************************************/ 71 62 63 <DATE><TIME>|<HOST>|E|psEOC_NutationCorr (FILE:LINENO) 64 Unallowable operation: time is NULL. 65 <DATE><TIME>|<HOST>|E|psEOC_NutationCorr (FILE:LINENO) 66 Invalid time input. Time cannot be of type UT1. 72 67 73 68 ---> TESTPOINT PASSED (psEarthOrientation{psEOCNutation()} | tst_psEarthOrientation.c) -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout
r5524 r5533 10 10 -- Eop = x=-0.00045805944, y=0.00013368871, s=-2.986086e-05 11 11 -- PolarMotion = x=0.25980922, y=0.26040097, s=-2.986086e-05 12 Nutation Correction output = x,y,s = 1.1557751e+08, 8865375.4, -5.1231901e+14 13 12 14 13 15 The Value of T is = 1128530000.931
Note:
See TracChangeset
for help on using the changeset viewer.
