Beispiel #1
0
        public static double Calc(JulianDayNumber julianDay, double tidalAcceleration)
        {
            var    gregorianYear = julianDay.GetGregorianYear();
            double dt            = 0.0;

            if (julianDay >= J2016 || julianDay < JMinus720)
            {
                var t = (gregorianYear - 1825) / 100.0;
                dt = -320 + 32.5 * t * t;
                if (julianDay >= J2016)
                {
                    dt += 269.4790417;                     // to make curve continous on 1 Jan 2016 (D. Koch)
                }
                else
                {
                    dt -= 179.7337208;                     // to make curve continous on 1 Jan -720 (D. Koch)
                }
            }
            else
            {
                for (int i = 0; i < _coefficients.Length; i++)
                {
                    ref var data = ref _coefficients[i];
                    if (julianDay < data.End)
                    {
                        var t = (double)(julianDay - data.Begin) / (double)(data.End - data.Begin);
                        dt = data.Coef1 + data.Coef2 * t + data.Coef3 * t * t + data.Coef4 * t * t * t;
                    }
                }
            }
        /// <see cref="deltat_longterm_morrison_stephenson"/>
        public static double Calc(JulianDayNumber tjd)
        {
            var    gregorianYear = tjd.GetGregorianYear();
            double u             = (gregorianYear - 1820) / 100.0;

            return(-20 + 32 * u * u);
        }
        /// <summary>
        /// Stephenson & Morrison (2004)
        /// </summary>
        public static double Calc(JulianDayNumber tjd, double tid_acc)
        {
            double ans = 0, ans2, ans3;
            double p, B, dd;
            double tjd0;
            int    iy;
            double Y = tjd.GetGregorianYear();

            /* before -1000:
             * formula by Stephenson & Morrison (2004; p. 335) but adjusted to fit the
             * starting point of table dt2. */
            if (Y < DeltaTTabulated.Tab2Start)
            {
                // before -1000
                ans = DeltaTLongtermMorrisonStephenson.Calc(tjd);
                ans = TidalAcceleration.AdjustForTidalAcceleration(ans, Y, tid_acc, TidalAccelerationMode.Const26, false);
                /* transition from formula to table over 100 years */
                if (Y >= DeltaTTabulated.Tab2Start - 100)
                {
                    /* starting value of table dt2: */
                    ans2 = TidalAcceleration.AdjustForTidalAcceleration(DeltaTTabulated.dt2[0], DeltaTTabulated.Tab2Start, tid_acc, TidalAccelerationMode.Const26, false);
                    /* value of formula at epoch TAB2_START */

                    /* B = (TAB2_START - LTERM_EQUATION_YSTART) * 0.01;
                     * ans3 = -20 + LTERM_EQUATION_COEFF * B * B;*/
                    tjd0 = (DeltaTTabulated.Tab2Start - 2000) * 365.2425 + (double)JulianDayNumber.J2000;
                    ans3 = DeltaTLongtermMorrisonStephenson.Calc(JulianDayNumber.FromRaw(tjd0));
                    ans3 = TidalAcceleration.AdjustForTidalAcceleration(ans3, Y, tid_acc, TidalAccelerationMode.Const26, false);
                    dd   = ans3 - ans2;
                    B    = (Y - (DeltaTTabulated.Tab2Start - 100)) * 0.01;
                    /* fit to starting point of table dt2. */
                    ans -= dd * B;
                }
            }

            /* between -1000 and 1600:
             * linear interpolation between values of table dt2 (Stephenson & Morrison 2004) */
            if (Y >= DeltaTTabulated.Tab2Start && Y < DeltaTTabulated.Tab2End)
            {
                double Yjul = tjd.GetJulianYear();
                p   = Math.Floor(Yjul);
                iy  = (int)((p - DeltaTTabulated.Tab2Start) / DeltaTTabulated.Tab2Step);
                dd  = (Yjul - (DeltaTTabulated.Tab2Start + DeltaTTabulated.Tab2Step * iy)) / DeltaTTabulated.Tab2Step;
                ans = DeltaTTabulated.dt2[iy] + (DeltaTTabulated.dt2[iy + 1] - DeltaTTabulated.dt2[iy]) * dd;
                /* correction for tidal acceleration used by our ephemeris */
                ans = TidalAcceleration.AdjustForTidalAcceleration(ans, Y, tid_acc, TidalAccelerationMode.Const26, false);
            }
            ans /= 86400.0;
            return(ans);
        }
Beispiel #4
0
        /// <summary>
        /// Model used SE 1.77 - 2.05.01, for epochs before 1633:
        /// Polynomials by Espenak & Meeus 2006, derived from Stephenson & Morrison 2004.
        /// deltat_model == SEMOD_DELTAT_ESPENAK_MEEUS_2006:
        /// This method is used only for epochs before 1633.
        /// (For more recent epochs, we use the data provided by Astronomical Almanac K8-K9.)
        /// </summary>
        /// <see cref="deltat_espenak_meeus_1620"/>
        public static double Calc(JulianDayNumber tjd, double tidalAcceleration)
        {
            double ans = 0;
            double u;
            double Ygreg = tjd.GetGregorianYear();

            if (Ygreg < -500)
            {
                ans = DeltaTLongtermMorrisonStephenson.Calc(tjd);
            }
            else if (Ygreg < 500)
            {
                u   = Ygreg / 100.0;
                ans = (((((0.0090316521 * u + 0.022174192) * u - 0.1798452) * u - 5.952053) * u + 33.78311) * u - 1014.41) * u + 10583.6;
            }
            else if (Ygreg < 1600)
            {
                u   = (Ygreg - 1000) / 100.0;
                ans = (((((0.0083572073 * u - 0.005050998) * u - 0.8503463) * u + 0.319781) * u + 71.23472) * u - 556.01) * u + 1574.2;
            }
            else if (Ygreg < 1700)
            {
                u   = Ygreg - 1600;
                ans = 120 - 0.9808 * u - 0.01532 * u * u + u * u * u / 7129.0;
            }
            else if (Ygreg < 1800)
            {
                u   = Ygreg - 1700;
                ans = (((-u / 1174000.0 + 0.00013336) * u - 0.0059285) * u + 0.1603) * u + 8.83;
            }
            else if (Ygreg < 1860)
            {
                u   = Ygreg - 1800;
                ans = ((((((0.000000000875 * u - 0.0000001699) * u + 0.0000121272) * u - 0.00037436) * u + 0.0041116) * u + 0.0068612) * u - 0.332447) * u + 13.72;
            }
            else if (Ygreg < 1900)
            {
                u   = Ygreg - 1860;
                ans = ((((u / 233174.0 - 0.0004473624) * u + 0.01680668) * u - 0.251754) * u + 0.5737) * u + 7.62;
            }
            else if (Ygreg < 1920)
            {
                u   = Ygreg - 1900;
                ans = (((-0.000197 * u + 0.0061966) * u - 0.0598939) * u + 1.494119) * u - 2.79;
            }
            else if (Ygreg < 1941)
            {
                u   = Ygreg - 1920;
                ans = 21.20 + 0.84493 * u - 0.076100 * u * u + 0.0020936 * u * u * u;
            }
            else if (Ygreg < 1961)
            {
                u   = Ygreg - 1950;
                ans = 29.07 + 0.407 * u - u * u / 233.0 + u * u * u / 2547.0;
            }
            else if (Ygreg < 1986)
            {
                u   = Ygreg - 1975;
                ans = 45.45 + 1.067 * u - u * u / 260.0 - u * u * u / 718.0;
            }
            else if (Ygreg < 2005)
            {
                u   = Ygreg - 2000;
                ans = ((((0.00002373599 * u + 0.000651814) * u + 0.0017275) * u - 0.060374) * u + 0.3345) * u + 63.86;
            }
            ans  = TidalAcceleration.AdjustForTidalAcceleration(ans, Ygreg, tidalAcceleration, TidalAccelerationMode.Const26, false);
            ans /= 86400.0;
            return(ans);
        }
Beispiel #5
0
        /// <summary>
        /// Calculate DeltaT
        /// </summary>
        /// <remarks>
        /// delta t is adjusted to the tidal acceleration that is compatible
        /// with the ephemeris mode contained in ephemerisMode and with the ephemeris
        /// files made accessible through swe_set_ephe_path() or swe_set_jplfile().
        /// If ephemerisMode is null, then the default tidal acceleration is ussed(i.e. that of DE431).
        /// </remarks>
        /// <see cref="calc_deltat"/>
        /// <returns>DeltaT (ET - UT) in days</returns>
        public static double Calc(JulianDayNumber julianDay, DeltaTMode deltaTMode, EphemerisMode?ephemerisMode)
        {
            var tidalAcceleration = ephemerisMode is null
                                ? TidalAcceleration.Get(JPLDENumber.Default)
                                : TidalAcceleration.Calculate(ephemerisMode.Value, julianDay, JPLDENumber.Auto);

            if (deltaTMode == DeltaTMode.Stephenson_Etc_2016 && julianDay < JulianDayNumber.J1955)
            {
                double deltaT = DeltaTStephensonEtc2016.Calc(julianDay, tidalAcceleration);
                if (julianDay >= JulianDayNumber.J1952_05_04)
                {
                    deltaT += (1.0 - (double)(JulianDayNumber.J1955 - julianDay) / 1000.0) * 0.6610218 / 86400.0;
                }
                return(deltaT);
            }

            if (deltaTMode == DeltaTMode.Espenak_Meeus_2006 && julianDay < J1633)
            {
                return(DeltaTEspenakMeeus1620.Calc(julianDay, tidalAcceleration));
            }

            var year = julianDay.GetYear();

            // delta t model used in SE 1.72 - 1.76: Stephenson & Morrison 2004; before 1620
            if (deltaTMode == DeltaTMode.Stephenson_Morrison_2004 && year < DeltaTTabulated.TabStart)
            {
                // before 1600:
                if (year < DeltaTTabulated.Tab2End)
                {
                    return(DeltaTStephensonMorrison2004_1600.Calc(julianDay, tidalAcceleration));
                }
                else
                {
                    // between 1600 and 1620:
                    // linear interpolation between end of table dt2 and start of table dt
                    return(DeltaTTabulated.CalcInterpolated(year, julianDay.GetGregorianYear(), tidalAcceleration));
                }
            }

            /* delta t model used before SE 1.64:
             * Stephenson/Morrison 1984 with Borkowski 1988;
             * before 1620 */
            if (deltaTMode == DeltaTMode.Stephenson_Morrison_1984 && year < DeltaTTabulated.TabStart)
            {
                double B;
                double ans;
                if (year >= 948.0)
                {
                    /* Stephenson and Morrison, stated domain is 948 to 1600:
                     * 25.5(centuries from 1800)^2 - 1.9159(centuries from 1955)^2 */
                    B   = 0.01 * (year - 2000.0);
                    ans = (23.58 * B + 100.3) * B + 101.6;
                }
                else
                {
                    /* Borkowski, before 948 and between 1600 and 1620 */
                    B   = 0.01 * (year - 2000.0) + 3.75;
                    ans = 35.0 * B * B + 40.0;
                }
                return(ans / 86400.0);
            }

            /* 1620 - today + a few years (tabend):
             * Tabulated values of deltaT from Astronomical Almanac
             * (AA 1997etc., pp. K8-K9) and from IERS
             * (http://maia.usno.navy.mil/ser7/deltat.data).
             */
            if (year >= DeltaTTabulated.TabStart)
            {
                return(DeltaTTabulated.Calc(julianDay, tidalAcceleration, deltaTMode));
            }

            return(0);
        }