Exemplo n.º 1
0
        public SolarTime(DateTime today, Coordinates coordinates)
        {
            DateTime calendar  = today.ToUniversalTime();
            DateTime tomorrow  = calendar.AddDays(1);
            DateTime yesterday = calendar.AddDays(-1);

            this.prevSolar = new SolarCoordinates(CalendricalHelper.JulianDay(yesterday));
            this.solar     = new SolarCoordinates(CalendricalHelper.JulianDay(today));
            this.nextSolar = new SolarCoordinates(CalendricalHelper.JulianDay(tomorrow));

            this.approximateTransit = Astronomical.ApproximateTransit(coordinates.Longitude,
                                                                      solar.ApparentSiderealTime, solar.RightAscension);
            double solarAltitude = -50.0 / 60.0;

            this.observer = coordinates;
            this.Transit  = Astronomical.CorrectedTransit(this.approximateTransit, coordinates.Longitude,
                                                          solar.ApparentSiderealTime, solar.RightAscension, prevSolar.RightAscension,
                                                          nextSolar.RightAscension);
            this.Sunrise = Astronomical.CorrectedHourAngle(this.approximateTransit, solarAltitude,
                                                           coordinates, false, solar.ApparentSiderealTime, solar.RightAscension,
                                                           prevSolar.RightAscension, nextSolar.RightAscension, solar.Declination,
                                                           prevSolar.Declination, nextSolar.Declination);
            this.Sunset = Astronomical.CorrectedHourAngle(this.approximateTransit, solarAltitude,
                                                          coordinates, true, solar.ApparentSiderealTime, solar.RightAscension,
                                                          prevSolar.RightAscension, nextSolar.RightAscension, solar.Declination,
                                                          prevSolar.Declination, nextSolar.Declination);
        }
Exemplo n.º 2
0
 public double HourAngle(double angle, bool afterTransit)
 {
     return(Astronomical.CorrectedHourAngle(this.approximateTransit, angle, this.observer,
                                            afterTransit, this.solar.ApparentSiderealTime, this.solar.RightAscension,
                                            this.prevSolar.RightAscension, this.nextSolar.RightAscension, this.solar.Declination,
                                            this.prevSolar.Declination, this.nextSolar.Declination));
 }
Exemplo n.º 3
0
        public SolarCoordinates(double julianDay)
        {
            double T  = CalendricalHelper.JulianCentury(julianDay);
            double L0 = Astronomical.MeanSolarLongitude(/* julianCentury */ T);
            double Lp = Astronomical.MeanLunarLongitude(/* julianCentury */ T);
            double Ω  = Astronomical.AscendingLunarNodeLongitude(/* julianCentury */ T);
            double λ  = MathHelper.ToRadians(
                Astronomical.ApparentSolarLongitude(/* julianCentury*/ T, /* meanLongitude */ L0));

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

            double ε0   = Astronomical.MeanObliquityOfTheEcliptic(/* julianCentury */ T);
            double εapp = MathHelper.ToRadians(Astronomical.ApparentObliquityOfTheEcliptic(
                                                   /* julianCentury */ T, /* meanObliquityOfTheEcliptic */ ε0));

            /* Equation from Astronomical Algorithms page 165 */
            this.Declination = MathHelper.ToDegrees(Math.Asin(Math.Sin(εapp) * Math.Sin(λ)));

            /* Equation from Astronomical Algorithms page 165 */
            this.RightAscension = DoubleUtil.UnwindAngle(
                MathHelper.ToDegrees(Math.Atan2(Math.Cos(εapp) * Math.Sin(λ), Math.Cos(λ))));

            /* Equation from Astronomical Algorithms page 88 */
            this.ApparentSiderealTime = θ0 + (((ΔΨ * 3600) * Math.Cos(MathHelper.ToRadians(ε0 + Δε))) / 3600);
        }