Changeset 5642 for trunk/psLib/test/astro/tst_psEarthOrientation.c
- Timestamp:
- Nov 30, 2005, 1:50:40 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tst_psEarthOrientation.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5626 r5642 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-11-30 02:17:17$7 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-11-30 23:50:40 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 13 13 #include "psTest.h" 14 14 #include "pslib_strict.h" 15 15 16 16 17 static psS32 testAberration(void); … … 54 55 } 55 56 57 #define timesec 1049160600 58 56 59 psS32 testAberration(void) 57 60 { 61 58 62 psSphere *apparent = NULL; 59 63 psSphere *actual = psSphereAlloc(); 60 psSphere *direction = psSphereAlloc();64 // psSphere *direction = psSphereAlloc(); 61 65 psSphere *empty = NULL; 62 66 63 67 // actual->r = 0.2; 64 68 // actual->d = 0.2; 65 actual->r = DEG_TO_RAD(45.0); 66 actual->d = DEG_TO_RAD(30.0); 69 // actual->r = DEG_TO_RAD(45.0); 70 // actual->d = DEG_TO_RAD(30.0); 71 actual->r = DEG_TO_RAD(122.9153182445501); 72 actual->d = DEG_TO_RAD(48.562968978679194); 67 73 // direction->r = 0.2035; 68 74 // direction->d = 0.2035; 69 75 // direction->r = DEG_TO_RAD(48.0); 70 direction->r = DEG_TO_RAD(-157.0); 71 direction->d = DEG_TO_RAD(20.7072); 72 73 empty = psAberration(empty, apparent, direction, 0.1); 76 // direction->r = DEG_TO_RAD(-157.0); 77 // direction->d = DEG_TO_RAD(20.7072); 78 psCube *cubeDir = psCubeAlloc(); 79 cubeDir->x = 5148.713262821658; 80 cubeDir->y = -26945.04752348012; 81 cubeDir->z = -11682.787302030947; 82 cubeDir->x += -357.6031690489248; 83 cubeDir->y += 248.46429758174693; 84 cubeDir->z += 0.09694774143797581; 85 psSphere *direction = psCubeToSphere(cubeDir); 86 double speed = sqrt(cubeDir->x*cubeDir->x + cubeDir->y*cubeDir->y + cubeDir->z*cubeDir->z); 87 // Speed of light in vacuum (src:NIST) 88 double c; 89 c = 299792458.0; /* m/s */ 90 speed = speed / c; 91 92 empty = psAberration(empty, apparent, direction, speed); 74 93 if (empty != NULL) { 75 94 psError(PS_ERR_BAD_PARAMETER_NULL, false, … … 77 96 return 1; 78 97 } 79 empty = psAberration(empty, actual, apparent, 0.1);98 empty = psAberration(empty, actual, apparent, speed); 80 99 if (empty != NULL) { 81 100 psError(PS_ERR_BAD_PARAMETER_NULL, false, … … 84 103 } 85 104 86 apparent = psAberration(apparent, actual, direction, 0.4);105 apparent = psAberration(apparent, actual, direction, speed); 87 106 if (apparent == NULL) 88 107 printf("\nApparent is NULL\n"); 89 else 108 else { 90 109 printf("\napparent = r,d = %.8g, %.8g\n", apparent->r, apparent->d); 91 110 psFree(cubeDir); 111 cubeDir = psSphereToCube(apparent); 112 printf(" ><><Apparent = x,y,z = %.13g, %.13g, %.13g \n", cubeDir->x, cubeDir->y, cubeDir->z); 113 } 114 psFree(cubeDir); 92 115 psFree(apparent); 93 116 psFree(actual); … … 159 182 { 160 183 psTime *empty = NULL; 161 psTime *time = psTimeAlloc(PS_TIME_ TAI);162 time->sec = 1131579114;163 time->nsec = 498489000;184 psTime *time = psTimeAlloc(PS_TIME_UTC); 185 time->sec = timesec; 186 time->nsec = 0; 164 187 time->leapsecond = false; 165 188 … … 189 212 return 3; 190 213 } else { 191 printf("Precession Model output = x,y,s = %.8g, %.8g, %.8g\n \n",214 printf("Precession Model output = x,y,s = %.8g, %.8g, %.8g\n", 192 215 pmodel->x, pmodel->y, pmodel->s); 216 double x, y, s; 217 x = 2.857175590089105e-4; 218 y = 2.3968739377734732e-5; 219 s = -1.3970066457904322e-8; 220 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", x, y, s); 193 221 } 194 222 psFree(pmodel); 195 223 196 224 //XXX: MAY Be an Error here... Time for Precession Correction has to be TAI or seg faults 225 psTime *time2 = psTimeAlloc(PS_TIME_UTC); 226 *time2 = *time; 227 time2 = psTimeConvert(time2, PS_TIME_TAI); 197 228 //Tests for Precession Correction function// 198 229 //Return NULL for NULL time input … … 206 237 207 238 //Return NULL for Invalid IERS table 208 pcorr = psEOC_PrecessionCorr(time , 3);239 pcorr = psEOC_PrecessionCorr(time2, 3); 209 240 if (pcorr != NULL) { 210 241 psError(PS_ERR_BAD_PARAMETER_VALUE, false, … … 215 246 216 247 //Check values from IERS table A 217 pcorr = psEOC_PrecessionCorr(time , PS_IERS_A);248 pcorr = psEOC_PrecessionCorr(time2, PS_IERS_A); 218 249 if ( pcorr == NULL ) { 219 250 psError(PS_ERR_BAD_PARAMETER_NULL, false, … … 227 258 228 259 //Check values from IERS table B 229 pcorr = psEOC_PrecessionCorr(time , PS_IERS_B);260 pcorr = psEOC_PrecessionCorr(time2, PS_IERS_B); 230 261 if ( pcorr == NULL ) { 231 262 psError(PS_ERR_BAD_PARAMETER_NULL, false, … … 235 266 printf("Precession Correction output (IERSB) = x,y,s = %.8g, %.8g, %.8g\n", 236 267 pcorr->x, pcorr->y, pcorr->s); 268 double xx, yy, ss; 269 xx = 0.06295703125; 270 yy = -0.0287618408203125; 271 ss = 0.0; 272 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", xx, yy, ss); 237 273 } 238 274 psFree(pcorr); 239 275 240 276 psFree(time); 277 psFree(time2); 241 278 if (!p_psEOCFinalize() ) { 242 279 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n"); … … 250 287 { 251 288 // psTime *in = psTimeGetNow(PS_TIME_TAI); 252 psTime *in = psTimeAlloc(PS_TIME_TAI); 253 in->sec = 1131579114; 254 in->nsec = 498489000; 289 // psTime *in = psTimeAlloc(PS_TIME_TAI); 290 // in->sec = 1131579114; 291 // in->nsec = 498489000; 292 psTime *in = psTimeAlloc(PS_TIME_UTC); 293 in->sec = timesec; 294 in->nsec = 0; 255 295 in->leapsecond = false; 256 296 psTime *empty = NULL; … … 284 324 return 4; 285 325 } 286 287 psSphere *interm = p_psTimeGetPoleCoords(in); 326 psTime *in2 = psTimeAlloc(PS_TIME_UTC); 327 in2->sec = timesec; 328 in2->nsec = 0; 329 in2->leapsecond = false; 330 in2 = psTimeConvert(in2, PS_TIME_TAI); 331 psSphere *interm = p_psTimeGetPoleCoords(in2); 288 332 printf(" -- sphere = r=%.8g, d=%.8g\n", interm->r, interm->d); 289 333 printf(" -- Eop = x=%.8g, y=%.8g, s=%.8g\n", eop->x, eop->y, eop->s); 290 printf(" -- PolarMotion = x=%.8g, y=%.8g, s=%.8g\n", polarMotion->x, 334 335 336 psEarthPole *nutationCorr = psEOC_NutationCorr(in2); 337 if (nutationCorr == NULL) { 338 psError(PS_ERR_BAD_PARAMETER_NULL, false, "Nutation Correction returned NULL.\n"); 339 return 5; 340 } 341 printf("\n -- PolarMotion = x=%.13g, y=%.13g, s=%.13g\n", polarMotion->x, 291 342 polarMotion->y, polarMotion->s); 343 printf(" -- NutationCorr = x,y,s = %.13g, %.13g, %.13g\n", nutationCorr->x, 344 nutationCorr->y, nutationCorr->s); 345 polarMotion->x += nutationCorr->x; 346 polarMotion->y += nutationCorr->y; 347 polarMotion->s += nutationCorr->s; 348 printf("\n -- Output Earthpole = x,y,s = %.13g, %.13g, %.13g\n", polarMotion->x, 349 polarMotion->y, polarMotion->s); 350 double x,y,s; 351 x = -0.13275353774074533; 352 y = 0.4359436319739848; 353 s = -4.2376965863576153e-10; 354 printf(" -- Expected Earthpole = x,y,s = %.13g, %.13g, %.13g\n", x, y, s); 355 356 if (!p_psEOCFinalize() ) { 357 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n"); 358 return 12; 359 } 360 361 psFree(nutationCorr); 292 362 psFree(in); 363 psFree(in2); 293 364 psFree(eop); 294 365 psFree(polarMotion); … … 345 416 psS32 testSphereRot_TEOtoCEO(void) 346 417 { 347 psTime *now = psTimeAlloc(PS_TIME_UT1); 348 now->sec = 1128530000; 349 now->nsec = 931154510; 350 psSphereRot *teoceo = psSphereRot_TEOtoCEO(now); 418 // psTime *now = psTimeAlloc(PS_TIME_UT1); 419 // now->sec = 1128530000; 420 // now->nsec = 931154510; 421 psTime *time = psTimeAlloc(PS_TIME_UTC); 422 time->sec = timesec; 423 time->nsec = 0; 424 time->leapsecond = false; 425 // psSphereRot *teoceo = psSphereRot_TEOtoCEO(now); 426 psSphereRot *teoceo = psSphereRot_TEOtoCEO(time); 351 427 printf("Output sphere rotation = %lf,%lf,%lf,%lf\n", 352 428 teoceo->q0, teoceo->q1, teoceo->q2, teoceo->q3); 353 429 354 psFree(now); 430 // psFree(now); 431 psFree(time); 355 432 psFree(teoceo); 356 433 return 0; … … 363 440 psSphereRot *rot = NULL; 364 441 365 in->x = M_PI / 4.0; 366 in->y = M_PI / 6.0; 367 in->s = M_PI / 8.0; 442 // in->x = M_PI / 4.0; 443 // in->y = M_PI / 6.0; 444 // in->s = M_PI / 8.0; 445 446 in->x = 2.857175590089105e-4; 447 in->y = 2.3968739377734732e-5; 448 in->s = -1.3970066457904322e-8; 449 // in->x += 0.06295703125; 450 // in->y += -0.0287618408203125; 451 // in->s += 0.0; 452 double q0,q1,q2,q3; 453 q0 = -1.1984522406756289e-5; 454 q1 = 1.4285893358610674e-4; 455 q2 = 1.2191193518914336e-10; 456 q3 = -0.9999999897238481; 368 457 369 458 rot = psSphereRot_CEOtoGCRS(empty); … … 380 469 return 2; 381 470 } 471 printf("Output sphere rotation = %.13g,%.13g,%.13g,%.13g\n", 472 rot->q0, rot->q1, rot->q2, rot->q3); 473 printf("Expected sphere rotation = %.13g,%.13g,%.13g,%.13g\n", q0,q1,q2,q3); 382 474 383 475 psSphere *test = psSphereAlloc(); … … 399 491 psSphereRot *rot = NULL; 400 492 401 in->x = M_PI / 4.0; 402 in->y = M_PI / 6.0; 403 in->s = M_PI / 8.0; 493 // in->x = M_PI / 4.0; 494 // in->y = M_PI / 6.0; 495 // in->s = M_PI / 8.0; 496 in->x = -0.13275353774074533; 497 in->y = 0.4359436319739848; 498 in->s = -4.2376965863576153e-10; 404 499 405 500 rot = psSphereRot_ITRStoTEO(empty); … … 416 511 return 2; 417 512 } 513 printf("Output sphere rotation = %.13g,%.13g,%.13g,%.13g\n", 514 rot->q0, rot->q1, rot->q2, rot->q3); 515 double q0,q1,q2,q3; 516 q0 = -1.0567571848664005e-6; 517 q1 = 3.218036562931509e-7; 518 q2 = -3.3580195807204483e-12; 519 q3 = -0.9999999999993899; 520 printf("Expected sphere rotation = %.13g,%.13g,%.13g,%.13g\n", q0,q1,q2,q3); 418 521 419 522 psSphere *test = psSphereAlloc();
Note:
See TracChangeset
for help on using the changeset viewer.
