コード例 #1
0
        // MMoon.PhaseAngle(double)
        /// <summary>
        /// Liefert den Phasenwinkel zur julianischen Tageszahl.
        /// </summary>
        /// <param name="jd">Julianische Tageszahl.</param>
        /// <returns>Phasenwinkel zur julianischen Tageszahl.</returns>
        public static double PhaseAngle(double jd)
        {
            // Lokale Felder einrichten
            double betM = MMoon.Latitude(EPrecision.Low, jd);
            double lamM = MMoon.Longitude(EPrecision.Low, jd);
            double lamS = MSun.Longitude(EPrecision.Low, jd);

            // Geozentrische Elongation berechnen
            double cosPsi = MMath.Cos(betM) * MMath.Cos(lamM - lamS);
            double sinPsi = MMath.Sin(MMath.ArcCos(cosPsi));

            // Radii berechnen
            double delM = MMoon.Radius(EPrecision.Low, jd);
            double delS = MSun.Radius(EPrecision.Low, jd);

            // Phasenwinkel berechnen
            double i = MMath.ToDeg(MMath.ArcTan((delS * sinPsi) / (delM - delS * cosPsi)));

            if (lamM - lamS < 0.0)
            {
                i *= 1.0;
            }
            return(i);
        }
コード例 #2
0
ファイル: MNeptune.cs プロジェクト: AcamatAcubens/LCalendar
        // 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);
        }