Exemple #1
0
        public void TransitAndHourAngle()
        {
            // values from Astronomical Algorithms page 103
            double longitude = -71.0833;
            double Θ         = 177.74208;
            double α1        = 40.68021;
            double α2        = 41.73129;
            double α3        = 42.78204;
            double m0        = Astronomical.ApproximateTransit(longitude,
                                                               /* siderealTime */ Θ, /* rightAscension */ α2);

            Assert.IsTrue(m0.IsWithin(0.00001, 0.81965));

            double transit = Astronomical.CorrectedTransit(
                /* approximateTransit */ m0, longitude, /* siderealTime */ Θ,
                /* rightAscension */ α2, /* previousRightAscension */ α1,
                /* nextRightAscension */ α3) / 24;

            Assert.IsTrue(transit.IsWithin(0.00001, 0.81980));

            double δ1 = 18.04761;
            double δ2 = 18.44092;
            double δ3 = 18.82742;

            double rise = Astronomical.CorrectedHourAngle(/* approximateTransit */ m0,
                                                          /* angle */ -0.5667, new Coordinates(/* latitude */ 42.3333, longitude),
                                                          /* afterTransit */ false, /* siderealTime */ Θ,
                                                          /* rightAscension */ α2, /* previousRightAscension */ α1,
                                                          /* nextRightAscension */ α3, /* declination */ δ2,
                                                          /* previousDeclination */ δ1, /* nextDeclination */ δ3) / 24;

            Assert.IsTrue(rise.IsWithin(0.00001, 0.51766));
        }
Exemple #2
0
        public void AltitudeOfCelestialBody()
        {
            double φ = 38 + (55 / 60.0) + (17.0 / 3600);
            double δ = -6 - (43 / 60.0) - (11.61 / 3600);
            double H = 64.352133;
            double h = Astronomical.AltitudeOfCelestialBody(
                /* observerLatitude */ φ, /* declination */ δ, /* localHourAngle */ H);

            Assert.IsTrue(h.IsWithin(0.0001, 15.1249));
        }
Exemple #3
0
        public void AngleInterpolation()
        {
            double i1 = Astronomical.InterpolateAngles(/* value */ 1, /* previousValue */ -1,
                                                       /* nextValue */ 3, /* factor */ 0.6);

            Assert.IsTrue(i1.IsWithin(0.000001, 2.2));

            double i2 = Astronomical.InterpolateAngles(/* value */ 1, /* previousValue */ 359,
                                                       /* nextValue */ 3, /* factor */ 0.6);

            Assert.IsTrue(i2.IsWithin(0.000001, 2.2));
        }
Exemple #4
0
        public void Interpolation()
        {
            // values from Astronomical Algorithms page 25
            double interpolatedValue = Astronomical.Interpolate(/* value */ 0.877366,
                                                                /* previousValue */ 0.884226, /* nextValue */ 0.870531, /* factor */ 4.35 / 24);

            Assert.IsTrue(interpolatedValue.IsWithin(0.000001, 0.876125));

            double i1 = Astronomical.Interpolate(
                /* value */ 1, /* previousValue */ -1, /* nextValue */ 3, /* factor */ 0.6);

            Assert.IsTrue(i1.IsWithin(0.000001, 2.2));
        }
Exemple #5
0
        public void SolarCoordinates()
        {
            // values from Astronomical Algorithms page 165

            double           jd    = CalendricalHelper.JulianDay(/* year */ 1992, /* month */ 10, /* day */ 13);
            SolarCoordinates solar = new SolarCoordinates(/* JulianDay */ jd);

            double T    = CalendricalHelper.JulianCentury(/* JulianDay */ jd);
            double L0   = Astronomical.MeanSolarLongitude(/* julianCentury */ T);
            double ε0   = Astronomical.MeanObliquityOfTheEcliptic(/* julianCentury */ T);
            double εapp = Astronomical.ApparentObliquityOfTheEcliptic(
                /* julianCentury */ T, /* meanObliquityOfTheEcliptic */ ε0);
            double M = Astronomical.MeanSolarAnomaly(/* julianCentury */ T);
            double C = Astronomical.SolarEquationOfTheCenter(
                /* julianCentury */ T, /* meanAnomaly */ M);
            double λ = Astronomical.ApparentSolarLongitude(
                /* julianCentury */ T, /* meanLongitude */ L0);
            double δ = solar.Declination;
            double α = DoubleUtil.UnwindAngle(solar.RightAscension);

            Assert.IsTrue(T.IsWithin(0.00000000001, (-0.072183436)));
            Assert.IsTrue(L0.IsWithin(0.00001, (201.80720)));
            Assert.IsTrue(ε0.IsWithin(0.00001, (23.44023)));
            Assert.IsTrue(εapp.IsWithin(0.00001, (23.43999)));
            Assert.IsTrue(M.IsWithin(0.00001, (278.99397)));
            Assert.IsTrue(C.IsWithin(0.00001, (-1.89732)));

            // lower accuracy than desired
            Assert.IsTrue(λ.IsWithin(0.00002, (199.90895)));
            Assert.IsTrue(δ.IsWithin(0.00001, (-7.78507)));
            Assert.IsTrue(α.IsWithin(0.00001, (198.38083)));

            // values from Astronomical Algorithms page 88

            jd    = CalendricalHelper.JulianDay(/* year */ 1987, /* month */ 4, /* day */ 10);
            solar = new SolarCoordinates(/* JulianDay */ jd);
            T     = CalendricalHelper.JulianCentury(/* JulianDay */ jd);

            double θ0   = Astronomical.MeanSiderealTime(/* julianCentury */ T);
            double θapp = solar.ApparentSiderealTime;
            double Ω    = Astronomical.AscendingLunarNodeLongitude(/* julianCentury */ T);

            ε0 = Astronomical.MeanObliquityOfTheEcliptic(/* julianCentury */ T);
            L0 = Astronomical.MeanSolarLongitude(/* julianCentury */ T);
            double Lp = Astronomical.MeanLunarLongitude(/* julianCentury */ T);
            double ΔΨ = Astronomical.NutationInLongitude(/* julianCentury */ T,
                                                         /* solarLongitude */ L0, /* lunarLongitude */ Lp, /* ascendingNode */ Ω);
            double Δε = Astronomical.NutationInObliquity(/* julianCentury */ T,
                                                         /* solarLongitude */ L0, /* lunarLongitude */ Lp, /* ascendingNode */ Ω);
            double ε = ε0 + Δε;

            Assert.IsTrue(θ0.IsWithin(0.000001, (197.693195)));
            Assert.IsTrue(θapp.IsWithin(0.0001, (197.6922295833)));

            // values from Astronomical Algorithms page 148

            Assert.IsTrue(Ω.IsWithin(0.0001, (11.2531)));
            Assert.IsTrue(ΔΨ.IsWithin(0.0001, (-0.0010522)));
            Assert.IsTrue(Δε.IsWithin(0.00001, (0.0026230556)));
            Assert.IsTrue(ε0.IsWithin(0.000001, (23.4409463889)));
            Assert.IsTrue(ε.IsWithin(0.00001, (23.4435694444)));
        }