Example #1
0
        //DateTime t must be in UTC
        public static double GetSolarAltitudeInDegrees(double LatitudeInDegrees, double LongitudeInDegress, DateTime t)
        {
            double lonrad = LongitudeInDegress / 360 * 2 * Math.PI;
            double latrad = LatitudeInDegrees / 360 * 2 * Math.PI;

            int julian_date;

            SolarCalculator.make_julian_day(t.Day, t.Month, t.Year, out julian_date);

            double day_angle;//annual day angle

            SolarCalculator.Day_Angle(julian_date, out day_angle);

            double LAT; // sun local time

            SolarCalculator.UT_to_LAT(t.TimeOfDay.TotalHours, day_angle, lonrad, out LAT);

            double delta;//sun declination

            SolarCalculator.declination_sun(t.Year, julian_date, lonrad, out delta);

            double omega;//solar hour angle

            SolarCalculator.solar_hour_angle(LAT, out omega);

            double gamma, theta;//altitude angle and zenithal angle (complementary)

            SolarCalculator.elevation_zenith_sun(latrad, delta, omega, out gamma, out theta);

            return(gamma * 360 / 2 / Math.PI);
        }