示例#1
0
        /// <summary>
        /// Calculate prayer time for isha.
        /// </summary>
        private static double ComputeIshaTime(double jd, double ishaParameterValue, double latitude)
        {
            var dayFraction = AstronomyMath.GetDayFraction(IshaDefaultTime);
            var ishaTime    = AstronomyMath.ComputeSolarTime(jd, dayFraction, ishaParameterValue, latitude, Direction.Clockwise);

            return(ishaTime);
        }
示例#2
0
        /// <summary>
        /// Calculate prayer time for maghrib.
        /// </summary>
        private static double ComputeMaghribTime(double jd, double maghribParameterValue, double latitude)
        {
            var dayFraction = AstronomyMath.GetDayFraction(MaghribDefaultTime);
            var maghribTime = AstronomyMath.ComputeSolarTime(jd, dayFraction, maghribParameterValue, latitude, Direction.Clockwise);

            return(maghribTime);
        }
示例#3
0
        // /// <summary>
        // /// Calculate prayer time for imsak.
        // /// </summary>
        // // NOTE: Do imsak time can be calculated using angle parameter?
        // private static double ComputeImsakTime(double jd, double imsakParameterValue, double latitude)
        // {
        //     var dayFraction = AstronomyMath.GetDayFraction(ImsakDefaultTime);
        //     var imsakTime = AstronomyMath.ComputeSolarTime(jd, dayFraction, imsakParameterValue, latitude, Direction.CounterClockwise);
        //
        //     return imsakTime;
        // }

        /// <summary>
        /// Calculate prayer time for fajr.
        /// </summary>
        private static double ComputeFajrTime(double jd, double fajrParameterValue, double latitude)
        {
            var dayFraction = AstronomyMath.GetDayFraction(FajrDefaultTime);
            var fajrTime    = AstronomyMath.ComputeSolarTime(jd, dayFraction, fajrParameterValue, latitude, Direction.CounterClockwise);

            return(fajrTime);
        }
示例#4
0
        /// <summary>
        /// Calculate prayer time for sunset.
        /// </summary>
        private static double ComputeSunsetTime(double jd, double latitude, double altitude)
        {
            var dayFraction  = AstronomyMath.GetDayFraction(SunsetDefaultTime);
            var sunriseAngle = AstronomyMath.ComputeSunriseAngle(altitude);
            var sunsetTime   = AstronomyMath.ComputeSolarTime(jd, dayFraction, sunriseAngle, latitude, Direction.Clockwise);

            return(sunsetTime);
        }
示例#5
0
        /// <summary>
        /// Calculate prayer time for asr.
        /// </summary>
        private static double ComputeAsrTime(double jd, int juristicTimeOfShadow, double latitude)
        {
            var dayFraction    = AstronomyMath.GetDayFraction(AsrDefaultTime);
            var sunDeclination = AstronomyMath.ComputeSunDeclination(jd + dayFraction);
            var angle          = -AngleMath.InverseCotangentInDegree(juristicTimeOfShadow + AngleMath.TangentOfDegree(Math.Abs(latitude - sunDeclination)));
            var asrTime        = AstronomyMath.ComputeSolarTime(jd, dayFraction, angle, latitude, Direction.Clockwise);

            return(asrTime);
        }
示例#6
0
        /// <summary>
        /// Calculate prayer time for zuhr.
        /// </summary>
        private static double ComputeZuhrTime(double jd)
        {
            var dayFraction = AstronomyMath.GetDayFraction(ZuhrDefaultTime);
            var midDay      = AstronomyMath.ComputeMidDay(jd, dayFraction);

            // The fiqh method which states that zuhr is when the sun's disk comes out
            // of its zenith line, which is a line between the observer and the center
            // of the sun when it is at the highest point is used here. Thus,
            // additional 65 seconds is added to the mid day time, which corresponds
            // to the formula t = arctan(r/d) / 2π × 24 × 60 × 60, where r is the
            // radius of the sun (r = 695,000km), d is the sun-earth distance
            // (d = 147,098,074km at minimum and d = 152,097,701km at maximum).
            // When, d is at maximum, t evaluates to ~62 seconds and ~65 seconds when
            // d is at minimum. Converting 65 seconds to hour yields a value of
            // 0.018055555555555554.
            var zuhrTime = midDay + 0.018055555555555554;

            return(zuhrTime);
        }
示例#7
0
 public void TestGetDayFractionForIshaDefaultTime()
 {
     Assert.Equal(0.75, AstronomyMath.GetDayFraction(18.0));
 }
示例#8
0
 public void TestGetDayFractionForAsrDefaultTime()
 {
     Assert.Equal(0.5416666666666666, AstronomyMath.GetDayFraction(13.0));
 }
示例#9
0
 public void TestGetDayFractionForZuhrDefaultTime()
 {
     Assert.Equal(0.5, AstronomyMath.GetDayFraction(12.0));
 }
示例#10
0
 public void TestGetDayFractionForSunriseDefaultTime()
 {
     Assert.Equal(0.25, AstronomyMath.GetDayFraction(6.0));
 }
示例#11
0
 public void TestGetDayFractionForFajrDefaultTime()
 {
     Assert.Equal(0.20833333333333334, AstronomyMath.GetDayFraction(5.0));
 }