Example #1
0
        /// <summary>
        /// Convert local mean sidereal time to zone time.
        /// </summary>
        /// <param name="localSiderealTime">Local mean sidereal in degree.</param>
        /// <param name="date">Local date.</param>
        /// <param name="localZone">Local time zone.</param>
        /// <param name="longitude">Local longitude</param>
        /// <returns>Local time in degree.</returns>
        public static double SiderealTime2ZoneTime(double localSiderealTime, DateTime date, TimeZoneInfo localZone, double longitude)
        {
            double t0 = UtMeanSiderealTime(new DateTime(date.Year, date.Month, date.Day));

            double zoneTime = ((localSiderealTime - longitude - t0) / (1.0 + 1.0 / 365.2422)) + (localZone.BaseUtcOffset.Hours + ((localZone.BaseUtcOffset.Minutes + (localZone.BaseUtcOffset.Seconds / 60.0)) / 60.0)) * 15 + 0.06527778;

            zoneTime = BasicTools.AngleSimplification(zoneTime);

            return(zoneTime - 1.04166667);
        }
Example #2
0
        /// <summary>
        /// Calculate local mean sidereal time.
        /// </summary>
        /// <param name="localTime">Local time.</param>
        /// <param name="localZone">Local time zone.</param>
        /// <param name="longitude">Local longitude.</param>
        /// <returns>Local mean sidereal time in degree.</returns>
        public static double LocalMeanSiderealTime(DateTime localTime, TimeZoneInfo localZone, double longitude)
        {
            double t0 = UtMeanSiderealTime(new DateTime(localTime.Year, localTime.Month, localTime.Day));

            double t = t0 + ((localTime.Hour + ((localTime.Minute + (localTime.Second / 60.0)) / 60.0)) * 15 - (localZone.BaseUtcOffset.Hours + ((localZone.BaseUtcOffset.Minutes + (localZone.BaseUtcOffset.Seconds / 60.0)) / 60.0)) * 15) * (1 + 1 / 365.2422) + longitude;

            t = BasicTools.AngleSimplification(t);

            return(t);
        }
Example #3
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);
        }
Example #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)
            });
        }