Ejemplo n.º 1
0
        /// <summary>
        /// Calculate the obliquity of the ecliptic.
        /// </summary>
        /// <param name="time">Local time.</param>
        /// <param name="isTrue">Is it true the obliquity of the ecliptic.</param>
        /// <returns>The obliquity.</returns>
        /// <remarks>
        /// Millennium error 0′′.01.
        /// </remarks>
        public static double GetEclipticObliquity(DateTime time, bool isTrue = true)
        {
            double JDE = Julian.ToJulianDay(time);
            double T   = (JDE - 2451545) / 36525.0;
            double U   = T / 100.0;

            double epsilon = ((((21.448 / 60.0) + 26) / 60.0) + 23) -
                             (4680.93 / 60.0 / 60.0) * U -
                             1.55 * U * U +
                             1999.24 * U * U * U -
                             51.38 * U * U * U * U -
                             249.67 * U * U * U * U * U -
                             39.05 * U * U * U * U * U * U +
                             7.12 * U * U * U * U * U * U * U +
                             27.87 * U * U * U * U * U * U * U * U +
                             5.79 * U * U * U * U * U * U * U * U * U +
                             2.45 * U * U * U * U * U * U * U * U * U * U;

            if (!isTrue)
            {
                return(epsilon);
            }
            else
            {
                var    n         = GetNutation(time);
                double obliquity = n.Obliquity;

                return(epsilon + obliquity);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Calculate Greenwich mean sidereal time.
        /// </summary>
        /// <param name="date">Universal(Greenwich) time.</param>
        /// <returns>Greenwich mean sidereal time in degree.</returns>
        public static double UtMeanSiderealTime(DateTime date)
        {
            double julianDay = Julian.ToJulianDay(date);

            double T     = (julianDay - 2451545.0) / 36525.0;
            double theta = 280.46061837 + 360.98564736629 * (julianDay - 2451545.0) + 0.000387933 * T * T - T * T * T / 38710000.0;

            theta = BasicTools.AngleSimplification(theta);

            return(theta);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Calculate the difference between dynamical time and universal time.
 /// </summary>
 /// <param name="time"><see cref="DateTime"/></param>
 /// <returns>The difference.</returns>
 public static double DifferenceDtUt(DateTime time)
 {
     return(-15 + Math.Pow(Julian.ToJulianDay(time) - 2382148, 2) / 41048480.0);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Calculate the nutation in longitude and the nutation in obliquity.
        /// </summary>
        /// <param name="time">Local time.</param>
        /// <returns><see cref="Nutation"/></returns>
        public static Nutation GetNutation(DateTime time)
        {
            double T = (Julian.ToJulianDay(time) - 2451545) / 36525.0;
            // angular distance between the sun and the moon to the earth's center
            double D = 297.8502042 + 445267.1115168 * T - 0.0016300 * T * T + T * T * T / 545868.0 - T * T * T * T / 113065000.0;
            //double D = 297.85036 + 455267.111480 * T - 0.0019142 * T * T + T * T * T / 189474.0;
            // sun mean anomaly
            double M = 357.52772 + 35999.050340 * T - 0.0001603 * T * T - T * T * T / 300000.0;
            // moon mean anomaly
            double M1 = 134.96298 + 477198.867398 * T + 0.0086972 * T * T + T * T * T / 56250.0;
            // moon latitude parameters
            double F = 93.27191 + 483202.017538 * T - 0.0036825 * T * T + T * T * T / 327270.0;
            // the latitude of ecliptic at the ascending intersection of the ecliptic and the moon's flat orbit.
            double omega = 125.04452 - 1934.136261 * T + 0.0020708 * T * T + T * T * T / 450000.0;

            D     = BasicTools.SimplifyAngle(D);
            M     = BasicTools.SimplifyAngle(M);
            M1    = BasicTools.SimplifyAngle(M1);
            F     = BasicTools.SimplifyAngle(F);
            omega = BasicTools.SimplifyAngle(omega);

            D     = D * (Math.PI / 180.0);
            M     = M * (Math.PI / 180.0);
            M1    = M1 * (Math.PI / 180.0);
            F     = F * (Math.PI / 180.0);
            omega = omega * (Math.PI / 180.0);

            #region longitude of the ecliptic

            double psi = (-171996 - 174.2 * T) * Math.Sin(omega)
                         + (-13187 - 1.6 * T) * Math.Sin(-2 * D + 2 * F + 2 * omega)
                         + (-2274 - 0.2 * T) * Math.Sin(2 * F + 2 * omega)
                         + (2062 + 0.2 * T) * Math.Sin(2 * omega)
                         + (1426 - 3.4 * T) * Math.Sin(M)
                         + (712 + 0.1 * T) * Math.Sin(M1)
                         + (-517 + 1.2 * T) * Math.Sin(-2 * D + M + 2 * F + 2 * omega)
                         + (-386 - 0.4 * T) * Math.Sin(2 * F + omega)
                         + (-301) * Math.Sin(M1 + 2 * F + 2 * omega)
                         + (217 - 0.5 * T) * Math.Sin(-2 * D - M + 2 * F + 2 * omega)
                         + (-158) * Math.Sin(-2 * D + M1)
                         + (129 + 0.1 * T) * Math.Sin(-2 * D + 2 * F + omega)
                         + 123 * Math.Sin(-M1 + 2 * F + 2 * omega)
                         + 63 * Math.Sin(2 * D)
                         + (63 + 0.1 * T) * Math.Sin(M1 + omega)
                         + (-59) * Math.Sin(2 * D - M1 + 2 * F + 2 * omega)
                         + (-58 - 0.1 * T) * Math.Sin(-M1 + omega)
                         + (-51) * Math.Sin(M1 + 2 * F + omega)
                         + 48 * Math.Sin(-2 * D + 2 * M1)
                         + 46 * Math.Sin(-2 * M1 + 2 * F + omega)
                         + (-38) * Math.Sin(2 * D + 2 * F + 2 * omega)
                         + (-31) * Math.Sin(2 * M1 + 2 * F + 2 * omega)
                         + 29 * Math.Sin(2 * M1)
                         + 29 * Math.Sin(-2 * D + M1 + 2 * F + 2 * omega)
                         + 26 * Math.Sin(2 * F)
                         + (-22) * Math.Sin(-2 * D + 2 * F)
                         + 21 * Math.Sin(-M1 + 2 * F + omega)
                         + (17 - 0.1 * T) * Math.Sin(2 * M)
                         + 16 * Math.Sin(2 * D - M1 + omega)
                         + (-16 + 0.1 * T) * Math.Sin(-2 * D + 2 * M + 2 * F + 2 * omega)
                         + (-15) * Math.Sin(M + omega)
                         + (-13) * Math.Sin(-2 * D + M1 + omega)
                         + (-12) * Math.Sin(-M + omega)
                         + 11 * Math.Sin(2 * M1 - 2 * F)
                         + (-10) * Math.Sin(2 * D - M1 + 2 * F + omega)
                         + (-8) * Math.Sin(2 * D + M1 + 2 * F + 2 * omega)
                         + 7 * Math.Sin(M + 2 * F + 2 * omega)
                         + (-7) * Math.Sin(-2 * D + M + M1)
                         + (-7) * Math.Sin(-M + 2 * F + 2 * omega)
                         + (-7) * Math.Sin(2 * D + 2 * F + omega)
                         + 6 * Math.Sin(2 * D + M1)
                         + 6 * Math.Sin(-2 * D + 2 * M1 + 2 * F + 2 * omega)
                         + 6 * Math.Sin(-2 * D + M1 + 2 * F + omega)
                         + (-6) * Math.Sin(2 * D - 2 * M1 + omega)
                         + (-6) * Math.Sin(2 * D + omega)
                         + 5 * Math.Sin(-M + M1)
                         + (-5) * Math.Sin(-2 * D - M + 2 * F + omega)
                         + (-5) * Math.Sin(-2 * D + omega)
                         + (-5) * Math.Sin(2 * M1 + 2 * F + omega)
                         + 4 * Math.Sin(-2 * D + 2 * M1 + omega)
                         + 4 * Math.Sin(-2 * D + M + 2 * F + omega)
                         + 4 * Math.Sin(M1 - 2 * F)
                         + (-4) * Math.Sin(-D + M1)
                         + (-4) * Math.Sin(-2 * D + M)
                         + (-4) * Math.Sin(D)
                         + 3 * Math.Sin(M1 + 2 * F)
                         + (-3) * Math.Sin(-2 * M1 + 2 * F + 2 * omega)
                         + (-3) * Math.Sin(-D - M + M1)
                         + (-3) * Math.Sin(M + M1)
                         + (-3) * Math.Sin(-M + M1 + 2 * F + 2 * omega)
                         + (-3) * Math.Sin(2 * D - M - M1 + 2 * F + 2 * omega)
                         + (-3) * Math.Sin(3 * M1 + 2 * F + 2 * omega)
                         + (-3) * Math.Sin(2 * D - M + 2 * F + 2 * omega);

            #endregion

            #region nutation in obliquity

            double epsilon = (92025 + 8.9 * T) * Math.Cos(omega)
                             + (5736 - 3.1 * T) * Math.Cos(-2 * D + 2 * F + 2 * omega)
                             + (977 - 0.5 * T) * Math.Cos(2 * F + 2 * omega)
                             + (-895 + 0.5 * T) * Math.Cos(2 * omega)
                             + (54 - 0.1 * T) * Math.Cos(M)
                             + (-7) * Math.Cos(M1)
                             + (224 - 0.6 * T) * Math.Cos(-2 * D + M + 2 * F + 2 * omega)
                             + 200 * Math.Cos(2 * F + omega)
                             + (129 - 0.1 * T) * Math.Cos(M1 + 2 * F + 2 * omega)
                             + (-95 + 0.3 * T) * Math.Cos(-2 * D - M + 2 * F + 2 * omega)
                             + Math.Cos(-2 * D + M1)
                             + (-70) * Math.Cos(-2 * D + 2 * F + omega)
                             + (-53) * Math.Cos(-M1 + 2 * F + 2 * omega)
                             + Math.Cos(2 * D)
                             + (-33) * Math.Cos(M1 + omega)
                             + 26 * Math.Cos(2 * D - M1 + 2 * F + 2 * omega)
                             + 32 * Math.Cos(-M1 + omega)
                             + 27 * Math.Cos(M1 + 2 * F + omega)
                             + Math.Cos(-2 * D + 2 * M1)
                             + (-24) * Math.Cos(-2 * M1 + 2 * F + omega)
                             + 16 * Math.Cos(2 * D + 2 * F + 2 * omega)
                             + 13 * Math.Cos(2 * M1 + 2 * F + 2 * omega)
                             + Math.Cos(2 * M1)
                             + (-12) * Math.Cos(-2 * D + M1 + 2 * F + 2 * omega)
                             + Math.Cos(2 * F)
                             + Math.Cos(-2 * D + 2 * F)
                             + (-10) * Math.Cos(-M1 + 2 * F + omega)
                             + Math.Cos(2 * M)
                             + (-8) * Math.Cos(2 * D - M1 + omega)
                             + 7 * Math.Cos(-2 * D + 2 * M + 2 * F + 2 * omega)
                             + 9 * Math.Cos(M + omega)
                             + 7 * Math.Cos(-2 * D + M1 + omega)
                             + 6 * Math.Cos(-M + omega)
                             + Math.Cos(2 * M1 - 2 * F)
                             + 5 * Math.Cos(2 * D - M1 + 2 * F + omega)
                             + 3 * Math.Cos(2 * D + M1 + 2 * F + 2 * omega)
                             + (-3) * Math.Cos(M + 2 * F + 2 * omega)
                             + Math.Cos(-2 * D + M + M1)
                             + 3 * Math.Cos(-M + 2 * F + 2 * omega)
                             + 3 * Math.Cos(2 * D + 2 * F + omega)
                             + Math.Cos(2 * D + M1)
                             + (-3) * Math.Cos(-2 * D + 2 * M1 + 2 * F + 2 * omega)
                             + (-3) * Math.Cos(-2 * D + M1 + 2 * F + omega)
                             + 3 * Math.Cos(2 * D - 2 * M1 + omega)
                             + 3 * Math.Cos(2 * D + omega)
                             + Math.Cos(-M + M1)
                             + 3 * Math.Cos(-2 * D - M + 2 * F + omega)
                             + 3 * Math.Cos(-2 * D + omega)
                             + 3 * Math.Cos(2 * M1 + 2 * F + omega)
                             + Math.Cos(-2 * D + 2 * M1 + omega)
                             + Math.Cos(-2 * D + M + 2 * F + omega)
                             + Math.Cos(M1 - 2 * F)
                             + Math.Cos(-D + M1)
                             + Math.Cos(-2 * D + M)
                             + Math.Cos(D)
                             + Math.Cos(M1 + 2 * F)
                             + Math.Cos(-2 * M1 + 2 * F + 2 * omega)
                             + Math.Cos(-D - M + M1)
                             + Math.Cos(M + M1)
                             + Math.Cos(-M + M1 + 2 * F + 2 * omega)
                             + Math.Cos(2 * D - M - M1 + 2 * F + 2 * omega)
                             + Math.Cos(3 * M1 + 2 * F + 2 * omega)
                             + Math.Cos(2 * D - M + 2 * F + 2 * omega);

            #endregion

            return(new Nutation()
            {
                Longitude = psi * (0.0001 / 3600.0),
                Obliquity = epsilon * (0.0001 / 3600.0)
            });
        }