Example #1
0
//Static methods

    /////////////////////////////// Implementation ////////////////////////////////

    public static double MeanGreenwichSiderealTime(double JD)
    {
        //Get the Julian day for the same day at midnight

        DT date = new DT();

        date.SetJD(JD, DT.AfterPapalReformJD(JD));
        double[] D = date.Get();

        int    Year   = (int)D[0];
        int    Month  = (int)D[1];
        int    Day    = (int)D[2];
        int    Hour   = (int)D[3];
        int    Minute = (int)D[4];
        double Second = D[5];

        date.Set(Year, Month, Day, 0, 0, 0, date.InGregorianCalendar());
        double JDMidnight = date.Julian();

        //Calculate the sidereal time at midnight
        double T        = (JDMidnight - 2451545) / 36525;
        double TSquared = T * T;
        double TCubed   = TSquared * T;
        double Value    = 100.46061837 + (36000.770053608 * T) + (0.000387933 * TSquared) - (TCubed / 38710000);

        //Adjust by the time of day
        Value += (((Hour * 15) + (Minute * 0.25) + (Second * 0.0041666666666666666666666666666667)) * 1.00273790935);

        Value = CT.D2H(Value);

        return(CT.M24(Value));
    }
Example #2
0
//Static methods

    ////////////////////////////////// Implementation /////////////////////////////

    public static double DeltaT(double JD)
    {
        //Construct a CAADate from the julian day
        DT date = DT.CreateJD(JD, DT.AfterPapalReformJD(JD));

        double y = date.FractionalYear();
        double T = (y - 2000) / 100;

        double Delta;

        if (y < 948)
        {
            Delta = 2177 + (497 * T) + (44.1 * T * T);
        }
        else if (y < 1620)
        {
            Delta = 102 + (102 * T) + (25.3 * T * T);
        }
        else if (y < 1998)
        {
            int Index = (int)((y - 1620) / 2);
            Debug.Assert(Index < GFX.DeltaTTable.Length);

            y     = y / 2 - Index - 810;
            Delta = (GFX.DeltaTTable[Index] + (GFX.DeltaTTable[Index + 1] - GFX.DeltaTTable[Index]) * y);
        }
        else if (y <= 2000)
        {
            int nLookupSize = GFX.DeltaTTable.Length;
            Delta = GFX.DeltaTTable[nLookupSize - 1];
        }
        else if (y < 2100)
        {
            Delta = 102 + (102 * T) + (25.3 * T * T) + 0.37 * (y - 2100);
        }
        else
        {
            Delta = 102 + (102 * T) + (25.3 * T * T);
        }

        return(Delta);
    }