Exemple #1
0
        public static void TestSunCoordinates()
        {
            GPObserver obs = new GPObserver();

            obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude);
            GPJulianTime dp = new GPJulianTime();

            dp.setLocalJulianDay(2456710.500000);
            for (int k = 0; k < 26; k++)
            {
                //dp = MA.GPMeeusEngine.GetNextMoonEvent(dp, obs, out kind);
                GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay());
                //srt = MA.GPMeeusEngine.GetSiderealTime(dp.GetJulianDay(), out deltaphi, out epsilon);
                //crd = MA.GPMeeusEngine.moon_coordinate(2448724.5);
                crd.makeTopocentric(obs);
                GPAstroEngine.calcHorizontal(crd, obs);
                //Log("time {0}   deltaphi {1}  epsilon {2} sidereal {3}", dp, deltaphi, epsilon, srt/15);
                //Log("time {0}   altitude {1}  azimuth {2}", dp, crd.elevation, crd.azimuth);
                //Log("time {0}   ra {1}  dec {2}", dp, crd.right_ascession, crd.declination);
                //Log("RA={0} DEC={1}", crd.right_ascession, crd.elevation);
                //Log("AZ={0} EL={1} RA", crd.azimuth, crd.elevation);
                Log("{0}", crd.elevation);
                //                Log("next event = {0}, {1}, {2}\n", dp, kind, crd.elevation);
                dp.AddHours(1);
            }
        }
        /// <summary>
        /// Based on Chapter 39, Meeus and Chapter 10
        /// </summary>
        /// <param name="obs"></param>
        public void makeTopocentric(GPObserver obs)
        {
            double       u, h, delta_alpha;
            double       rho_sin, rho_cos;
            const double b_a = 0.99664719;

            // geocentric position of observer on the earth surface
            // 10.1 - 10.3
            u       = GPMath.arctanDeg(b_a * b_a * GPMath.tanDeg(obs.GetLatitudeNorthPositive()));
            rho_sin = b_a * GPMath.sinDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.sinDeg(obs.GetLatitudeNorthPositive());
            rho_cos = GPMath.cosDeg(u) + obs.GetAltitude() / 6378140.0 * GPMath.cosDeg(obs.GetLatitudeNorthPositive());

            // equatorial horizontal paralax
            // 39.1
            this.parallax = GPMath.arcsinDeg(GPMath.sinDeg(8.794 / 3600) / (this.distanceFromEarth / GPAstroEngine.AU));

            // geocentric hour angle of the body
            h = apparent_sidereal_time - obs.GetLongitudeWestPositive() - right_ascession;


            // 39.2
            delta_alpha = GPMath.arctanDeg(
                (-rho_cos * GPMath.sinDeg(this.parallax) * GPMath.sinDeg(h)) /
                (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h)));

            this.right_ascession += delta_alpha;
            this.declination      = GPMath.arctanDeg(
                ((GPMath.sinDeg(this.declination) - rho_sin * GPMath.sinDeg(this.parallax)) * GPMath.cosDeg(delta_alpha)) /
                (GPMath.cosDeg(this.declination) - rho_cos * GPMath.sinDeg(this.parallax) * GPMath.cosDeg(h)));
        }
Exemple #3
0
        public static void TestSiderealTime()
        {
            GPObserver obs = new GPObserver();

            obs.setLatitudeNorthPositive(defLatitude).setLongitudeEastPositive(defLongitude);
            GPJulianTime dp = new GPJulianTime();

            dp.setLocalJulianDay(2456710.500000);
            for (int k = 0; k < 26; k++)
            {
                GPCelestialBodyCoordinates crd = GPAstroEngine.sun_coordinate(dp.getGreenwichJulianEphemerisDay());
                Log("{0}", crd.apparent_sidereal_time / 15);
                dp.AddHours(1);
            }
        }
Exemple #4
0
        public static void TestSunEclipse()
        {
            Log("=== start sun eclipse ====");
            GPObserver obs = new GPObserver();
            double     srt;

            obs.setLongitudeEastPositive(-25.858).setLatitudeNorthPositive(-23.983);
            srt = 2452081.000000;
            GPAstroEngine.FindNextEclipse(ref srt, true);
            Log("Next eclipse = {0}", srt);
            double[] times = null;
            GPAstroEngine.CalculateTimesSunEclipse(srt, obs, out times);
            for (int i = 0; i < times.Length; i++)
            {
                Log("times[{0}] = {1}", times[i]);
            }
            Log("=== end sun eclipse ====");
        }
Exemple #5
0
        public static void TestMoonEclipse()
        {
            Log("=== start moon eclipse ====");
            GPObserver obs = new GPObserver();
            double     srt;

            obs.setLongitudeEastPositive(-25.858).setLatitudeNorthPositive(-23.983);
            srt = 2451919.500000;
            //GPMeeusEngine.NextEclipse(ref srt, false);
            Log("Next eclipse = {0}", srt);
            double[] times = null;
            GPAstroEngine.CalculateTimesMoonEclipse(srt, obs, out times);

            for (int i = 0; i < times.Length; i++)
            {
                Log("times[{0}] = {1}", i, times[i]);
            }
            Log("=== end moon eclipse ====");
        }
Exemple #6
0
 public GPFunctorMoon(ValueType vt, GPObserver o)
 {
     valueType = vt;
     obs       = o;
 }