Ejemplo n.º 1
0
        /// <summary>
        /// Get the sun's right ascension and declination IN RADIANS
        /// See the chapter on Solar Coordinates (Chapter 24)</summary>
        /// Page 151 onwards
        /// This function uses the more accurate method of page 154 onwards.
        /// <param name="alpha"></param>
        /// <param name="delta"></param>
        /// <param name="date">The date for which to get the sun's position</param>
        /// <param name="time">The time for which to get the sun's position (zero = midnight, 1.0 = midnight the next day)</param>
        public static void GetSunPos(out double alpha, out double delta, DateTime date, double time = 0)
        {
            double jde = Utils.GetJulianDate(date) + time;

            double tau = (jde - 2451545.0) / 365250;

            double l, b, r;

            // get heliocentric coordinates for earth from VSOP series:
            l = VSop87d.SumSeries(VSOPEarth.Along, tau); // radians
            b = VSop87d.SumSeries(VSOPEarth.Alat, tau);  // radians
            r = VSop87d.SumSeries(VSOPEarth.ARad, tau);  // astronomical units

            // adjust to get geocentric coordinates of the sun:
            double sun  = l + PI;
            double beta = -b;

            // get in 0-360 degrees:
            sun = Fix2Pi(sun);

            // Do the FK5 corrections - page 154 equations 24.9
            double T         = 10 * tau;
            double lamdadash = sun - (1.397 * T + 0.00031 * T * T) * PI / 180.0;
            double deltasun  = -0.09033 / 3600.0 * PI / 180.0;
            double deltabeta = 0.03916 * (Cos(lamdadash) - Sin(lamdadash)) / 3600.0 * PI / 180.0;

            sun += deltasun;

            beta += deltabeta;

            // Get nutations in longitude and obliquity - these are returned
            // in RADIANS:
            Nutation.GetNutation(out var dpsi, out var depsilon, jde);

            sun += dpsi;

            // Caculate the correction in the sun's longitude due to abberation:
            // Equations 24.11 on page 155 and the long equation on page 156
            double deltalambda = GetDeltaLamda(jde); // in RADIANS
            double abberation  = 0.005775518 * r * deltalambda;

            sun -= abberation;

            double epsilon0 = GetEpsilon0(jde);

            epsilon0 += depsilon;

            // get alpha and delta in RADIANS:
            alpha = Atan2((Cos(epsilon0) * Sin(sun)),
                          Cos(sun));

            delta = Asin(Sin(epsilon0) * Sin(sun));
        }
Ejemplo n.º 2
0
        private static void SumSeries2()
        {
            var    date = new DateTime(2019, 9, 16);
            double jde  = Utils.GetJulianDate(date);

            double tau = (jde - 2451545.0) / 365250;

            double l, b, r;

            // get heliocentric coordinates for earth from VSOP series:
            l = VSop87d.SumSeries(VSOPEarth.Along, tau); // radians
            b = VSop87d.SumSeries(VSOPEarth.Alat, tau);  // radians
            r = VSop87d.SumSeries(VSOPEarth.ARad, tau);  // astronomical units
        }