Example #1
0
        // MNeptune.PositionEquatorial(double)
        /// <summary>
        /// Liefert die (scheinbare) geozentrisch-äquatoriale Position zur julianischen Tageszahl.
        /// </summary>
        /// <param name="jd">Julianische Tageszahl.</param>
        /// <returns>Geozentrisch-äquatoriale Position zur julianischen Tageszahl.</returns>
        public static CPolar PositionEquatorial(double jd)
        {
            // Lokale Felder einrichten
            double bG  = 0.0;             // Geozentrische Breite.
            double bH  = 0.0;             // Heliozentrische Breite.
            double jdn = jd;              // Julianische Tageszahl.
            double lG  = 0.0;             // Geozentrische Länge.
            double lH  = 0.0;             // Heliozentrische Länge.
            double rG  = 0.0;             // Geozentrischer Radius.
            double rH  = 0.0;             // Heliozentrischer Radius.
            double tau = 0.0;             // Lichtlaufzeit.
            double tmp = 0.0;             // Temporärwert.

            // ------------- //
            // Lichtlaufzeit //
            // ------------- //

            // Lichtlaufzeit iterieren
            while (true)
            {
                // Heliozentrische Position bestimmen
                bH = MNeptune.Latitude(EPrecision.High, jdn);
                lH = MNeptune.Longitude(EPrecision.High, jdn);
                rH = MNeptune.Radius(EPrecision.High, jdn);

                // Geozentrische Position berechnen und Abbruchbedinungen verarbeiten
                tmp = MEphemerides.ToGeocentric(lH, bH, rH, jdn, ref lG, ref bG, ref rG, EPrecision.High);
                if (MMath.Abs(tau - tmp) < 0.00005)
                {
                    break;                                                // Ausreichende Genauigkeit sicherstellen
                }
                if (tau != 0.0 && tmp >= tau)
                {
                    break;                                                // Abbruch bei Schwingung sicherstellen
                }
                // Wert anwenden und nächsten Iterationsschritt vorbereiten
                jdn += tmp;
                tau  = tmp;
            }

            // ----------------------- //
            // Aberration und Nutation //
            // ----------------------- //

            // Aberation und Nutation anwenden
            MEphemerides.AberrationEcliptical(ref lG, ref bG, jdn);
            lG += MEphemerides.NutationInLongitude(jdn);
            bG += MEphemerides.NutationInObliquity(jdn);

            // ------------------------- //
            // Koordinatentransformation //
            // ------------------------- //

            // Äquatoriale Position berechnen und anwenden
            double a = MEphemerides.ToAlpha(lG, bG, EObliquity.True, jdn);
            double d = MEphemerides.ToDelta(lG, bG, EObliquity.True, jdn);

            return(new CPolar(a, d, rG));
        }
Example #2
0
        // MNeptune.Transit(double, double, double, ref double)
        /// <summary>
        /// Setzt die Höhe und liefert die julianische Tageszahl des Meridiandurchgangs am geographischen Ort und zur julianischen Tageszahl.
        /// </summary>
        /// <param name="lambda">Geographische Länge.</param>
        /// <param name="phi">Geographische Breite.</param>
        /// <param name="jd">Julianische Tageszahl.</param>
        /// <param name="height">Höhe.</param>
        /// <returns>Julianische Tageszahl des Meridiandurchgangs am geographischen Ort und zur julianischen Tageszahl.</returns>
        public static double Transit(double lambda, double phi, double jd, ref double height)
        {
            // Lokale Felder einrichten
            double jdn = MMath.Floor(jd - 0.5) + 0.5;             // Tageszahl um Mitternacht
            double l   = 0.0;                                     // Geozentrische Länge
            double b   = 0.0;                                     // Geozentrische Breite
            double a   = 0.0;                                     // Rektaszension
            double d   = 0.0;                                     // Deklination
            double dm  = 1.0;                                     // Korrekturglied

            // Position für nachfolgenden Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn + 1.0);
            b = MNeptune.Latitude(EPrecision.Low, jdn + 1.0);
            double aP = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jdn + 1.0);
            double dP = MEphemerides.ToDelta(l, b, EObliquity.Mean, jdn + 1.0);

            // Position für gegebenen Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn);
            b = MNeptune.Latitude(EPrecision.Low, jdn);
            double a0 = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jdn);

            if (MMath.Abs(aP - a0) > 1.0)
            {
                a0 += MMath.Sgn(aP - a0) * MMath.Pi2;
            }
            double d0 = MEphemerides.ToDelta(l, b, EObliquity.Mean, jdn);

            // Position für vorhergehenden Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn - 1.0);
            b = MNeptune.Latitude(EPrecision.Low, jdn - 1.0);
            double aM = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jdn - 1.0);

            if (MMath.Abs(a0 - aM) > 1.0)
            {
                aM += MMath.Sgn(a0 - aM) * MMath.Pi2;
            }
            double dM = MEphemerides.ToDelta(l, b, EObliquity.Mean, jdn - 1.0);

            // ------------------- //
            // Ereigniszeit nähern //
            // ------------------- //

            // Sternzeit und Stundenwinkel zum gegebenen Zeitpunkt bestimmen
            double t0 = MEphemerides.Gmst(jdn);
            double m  = MMath.Div((aP + lambda - t0) / MMath.Pi2);

            if (m < 0.0)
            {
                m += 1.0;
            }

            // Ereigniszeit iterieren
            while (MMath.Abs(dm) >= 0.0001)
            {
                // Iteration durchführen und nächsten Iterationsschritt vorbereiten
                a  = MMath.Bessel(m, aM, a0, aP);
                dm = MMath.Div((a + lambda - t0 - 6.300388093 * m) / MMath.Pi2);
                if (MMath.Abs(dm) > 0.5)
                {
                    dm -= MMath.Sgn(dm);
                }
                m += dm;
            }

            // Iteration anwenden, Höhe berechnen und Rückgabewert setzen
            d      = MMath.Bessel(m, dM, d0, dP);
            height = MEphemerides.ToHeight(0.0, d, phi);
            return(jd + m);
        }
Example #3
0
        // MNeptune.Set(double, double, ref double, double, ref double)
        /// <summary>
        /// Setzt die julianische Tageszahl des Untergangs und die Abendweite am geographischen Ort und zur julianischen Tageszahl und liefert die Ereigniskennung.
        /// </summary>
        /// <param name="lambda">Geographische Länge.</param>
        /// <param name="phi">Geographische Breite.</param>
        /// <param name="jdEvent">Julianische Tageszahl des Untergangs.</param>
        /// <param name="jd">Julianische Tageszahl.</param>
        /// <param name="azimuth">Abendweite.</param>
        /// <returns>Ereigniskennung.</returns>
        public static EEventType Set(double lambda, double phi, ref double jdEvent, double jd, ref double azimuth)
        {
            // Lokale Felder einrichten
            double jdn  = MMath.Floor(jd - 0.5) + 0.5;                    // Tageszahl um Mitternacht
            double l    = 0.0;                                            // Geozentrische Länge
            double b    = 0.0;                                            // Geozentrische Breite
            double a    = 0.0;                                            // Rektaszension
            double d    = 0.0;                                            // Deklination
            double dm   = 1.0;                                            // Korrekturglied
            double h    = 0.0;                                            //
            double h0   = MEphemerides.GeocentricHeight_Star;             // Refraktionswinkel
            double H    = 0.0;                                            //
            double sinP = MMath.Sin(phi);                                 // Breitensinus
            double cosP = MMath.Cos(phi);                                 // Breitencosinus

            // Position für nachfolgenden Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn + 1.0);
            b = MNeptune.Latitude(EPrecision.Low, jdn + 1.0);
            double aP = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jd + 1.0);
            double dP = MEphemerides.ToDelta(l, b, EObliquity.Mean, jd + 1.0);

            // Position für gegebenen Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn);
            b = MNeptune.Latitude(EPrecision.Low, jdn);
            double a0 = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jdn);

            if (MMath.Abs(aP - a0) > 1.0)
            {
                a0 += MMath.Sgn(aP - a0) * MMath.Pi2;
            }
            double d0 = MEphemerides.ToDelta(l, b, EObliquity.Mean, jdn);

            // Position für vorhergehenden Tag berechnen
            l = MNeptune.Longitude(EPrecision.Low, jdn - 1.0);
            b = MNeptune.Latitude(EPrecision.Low, jdn - 1.0);
            double aM = MEphemerides.ToAlpha(l, b, EObliquity.Mean, jd - 1.0);

            if (MMath.Abs(a0 - aM) > 1.0)
            {
                aM += MMath.Sgn(a0 - aM) * MMath.Pi2;
            }
            double dM = MEphemerides.ToDelta(l, b, EObliquity.Mean, jd - 1.0);

            // Stundenwinkel berechnen und prüfen
            double cosH = (MMath.Sin(h0) - sinP * MMath.Sin(dP)) / (cosP * MMath.Cos(dP));

            if (MMath.Abs(cosH) > 1.0)
            {
                return(cosH < 1.0 ? EEventType.AlwaysAboveHorizon : EEventType.AlwaysBeneathHorizon);
            }
            H = MMath.ArcCos(cosH);

            // ------------------- //
            // Ereigniszeit nähern //
            // ------------------- //

            // Sternzeit und Stundenwinkel zum gegebenen Zeitpunkt bestimmen
            double t0 = MEphemerides.Gmst(jdn);
            double m  = MMath.Div((a0 + lambda - t0 + H) / MMath.Pi2);

            if (m < 0.0)
            {
                m += 1.0;
            }

            // Ereigniszeit iterieren
            while (MMath.Abs(dm) >= 0.0001)
            {
                // Iteration durchführen und nächsten Iterationsschritt vorbereiten
                a  = MMath.Bessel(m, aM, a0, aP);
                d  = MMath.Bessel(m, dM, d0, dP);
                H  = t0 + 6.300388093 * m - lambda - a;
                h  = MMath.ArcSin(sinP * MMath.Sin(d) + cosP * MMath.Cos(d) * MMath.Cos(H));
                dm = (h - h0) / (MMath.Pi2 * MMath.Cos(d) * cosP * MMath.Sin(H));
                m += dm;
            }

            // Iteration anwenden, Azimut berechnen und Rückgabewert setzen
            jdEvent = jd + m;
            azimuth = MEphemerides.ToAzimuth(H, d, phi);
            return(EEventType.Normal);
        }