public ShortWaveRadiation(double lat, double lng)
 {
     SkyAttenuation             = 0.7;
     Latitude                   = lat;
     Longitude                  = lng;
     WaterSurfaceAbsorptionRate = 0.98;
     mSunEarth                  = new SunEarth(Latitude, Longitude);
 }
        public double[] HourlyIncomingRadiationIntensity(DateTime start, DateTime end, double cloudcover)
        {
            SunEarth se    = new SunEarth(Latitude, Longitude);
            TimeSpan ts    = end - start;
            int      hours = (int)ts.TotalHours;

            double[] radis = new double[hours];

            for (int i = 0; i < hours; i++)
            {
                DateTime       dt = start.AddHours(i);
                SunCoordinates sc = se.SunPostion(dt);
                if (sc.Azimuth > 0)
                {
                    radis[i] = 1366.2 * Math.Sin(sc.Azimuth * SunEarth.D2R) * (1 - 0.71 * cloudcover) * SkyAttenuation;
                }
            }
            return(radis);
        }
        public double[] HourlyIncomingRadiationIntensity(DateTime start, DateTime end, double[] cloudcovers)
        {
            SunEarth se    = new SunEarth(Latitude, Longitude);
            TimeSpan ts    = end - start;
            int      hours = (int)ts.TotalHours;

            double[] radis = new double[hours];

            if (cloudcovers.Length != hours)
            {
                throw new Exception("The number of cloud-cover values does not match with the hours");
            }

            for (int i = 0; i < hours; i++)
            {
                DateTime       dt = start.AddHours(i);
                SunCoordinates sc = se.SunPostion(dt);
                if (sc.Azimuth > 0)
                {
                    radis[i] = 1366.2 * Math.Sin(sc.Azimuth * SunEarth.D2R) * (1 - 0.71 * cloudcovers[i]) * SkyAttenuation;
                }
            }
            return(radis);
        }