IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 16, 2005, 5:59:05 PM (21 years ago)
Author:
drobbin
Message:

Implemented function NutationCorr and test. Has yet to be verified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psEarthOrientation.c

    r5531 r5533  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-11-17 00:07:25 $
     10 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-11-17 03:59:05 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    493493    S -= X*Y/2.0;
    494494
    495     psEarthPole* pole = psAlloc(sizeof(psEarthPole));
     495    //    psEarthPole* pole = psAlloc(sizeof(psEarthPole));
     496    psEarthPole* pole = psEarthPoleAlloc();
    496497    pole->x = X;
    497498    pole->y = Y;
     
    850851psEarthPole* psEOC_NutationCorr(psTime *time)
    851852{
    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;
    853965}
    854966
Note: See TracChangeset for help on using the changeset viewer.