Exemplo n.º 1
0
        /*************************************/
        /*    sun functions                  */
        /*                                   */
        /*    sun longitude                  */
        /*    sunrise, sunset time           */
        /*                                   */
        /*************************************/

        //////////////////////////////////////////////////////////////////////////
        //
        // VCTIME vct [in] - valid must be each member of this structure
        //

        // from vct uses members: year, month, day
        // double is in range 0.0 - 1.0

        private void SunPosition(GregorianDateTime vct, GCEarthData ed, double dayHours)
        {
            double DG  = GCMath.PI / 180;
            double RAD = 180 / GCMath.PI;

            double dLatitude  = ed.latitudeDeg;
            double dLongitude = ed.longitudeDeg;

            // mean ecliptic longitude of the sun
            meanLongitudeOfSun = GCSunData.SunGetMeanLong(vct.year, vct.month, vct.day) + (360 / 365.25) * dayHours / 360.0;

            // ecliptic longitude of perigee
            double elp = GCSunData.SunGetPerigee(vct.year, vct.month, vct.day);

            // mean anomaly of the sun
            double mas = meanLongitudeOfSun - elp;

            // ecliptic longitude of the sun
            double els = 0.0;

            this.longitudeDeg = els = meanLongitudeOfSun + 1.915 * Math.Sin(mas * DG) + 0.02 * Math.Sin(2 * DG * mas);

            // declination of the sun
            this.declinationDeg = RAD * Math.Asin(0.39777 * Math.Sin(els * DG));

            // right ascension of the sun
            this.rightAscensionDeg = els - RAD * Math.Atan2(Math.Sin(2 * els * DG), 23.2377 + Math.Cos(2 * DG * els));

            // equation of time
            equationOfTime = this.rightAscensionDeg - meanLongitudeOfSun;
        }
Exemplo n.º 2
0
        //
        // takes values year, month, day, shour, TimeZone
        //
        public static double GetSunLongitude(GregorianDateTime vct)
        {
            //	double mel = 0.0;
            double DG  = GCMath.PI / 180;
            double RAD = 180 / GCMath.PI;

            // mean ecliptic longitude of the sun
            double mel = GCSunData.SunGetMeanLong(vct.year, vct.month, vct.day) + (360 / 365.25) * (vct.shour - 0.5 - vct.TimezoneHours / 24.0);

            // ecliptic longitude of perigee
            double elp = GCSunData.SunGetPerigee(vct.year, vct.month, vct.day);

            // mean anomaly of the sun
            double mas = mel - elp;

            // ecliptic longitude of the sun
            //double els = 0.0;
            return(mel + 1.915 * Math.Sin(mas * DG) + 0.02 * Math.Sin(2 * DG * mas));
        }