//Static methods
    //////////////////////////////// Implementation ///////////////////////////////
    public static CAAPhysicalSunDetails Calculate(double JD)
    {
        double theta = CAACoordinateTransformation.MapTo0To360Range((JD - 2398220) * 360 / 25.38);
        double I = 7.25;
        double K = 73.6667 + 1.3958333*(JD - 2396758)/36525;

        //Calculate the apparent longitude of the sun (excluding the effect of nutation)
        double L = CAAEarth.EclipticLongitude(JD);
        double R = CAAEarth.RadiusVector(JD);
        double SunLong = L + 180 - CAACoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R);
        double SunLongDash = SunLong + CAACoordinateTransformation.DMSToDegrees(0, 0, CAANutation.NutationInLongitude(JD));

        double epsilon = CAANutation.TrueObliquityOfEcliptic(JD);

        //Convert to radians
        epsilon = CAACoordinateTransformation.DegreesToRadians(epsilon);
        SunLong = CAACoordinateTransformation.DegreesToRadians(SunLong);
        SunLongDash = CAACoordinateTransformation.DegreesToRadians(SunLongDash);
        K = CAACoordinateTransformation.DegreesToRadians(K);
        I = CAACoordinateTransformation.DegreesToRadians(I);
        theta = CAACoordinateTransformation.DegreesToRadians(theta);

        double x = Math.Atan(-Math.Cos(SunLong)*Math.Tan(epsilon));
        double y = Math.Atan(-Math.Cos(SunLong - K)*Math.Tan(I));

        CAAPhysicalSunDetails details = new CAAPhysicalSunDetails();

        details.P = CAACoordinateTransformation.RadiansToDegrees(x + y);
        details.B0 = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(SunLong - K)*Math.Sin(I)));

        double eta = Math.Atan(Math.Tan(SunLong - K)*Math.Cos(I));
        details.L0 = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(eta - theta));

        return details;
    }
Example #2
0
//Static methods

    //////////////////////////////// Implementation ///////////////////////////////

    public static CAAPhysicalSunDetails Calculate(double JD)
    {
        double theta = CAACoordinateTransformation.MapTo0To360Range((JD - 2398220) * 360 / 25.38);
        double I     = 7.25;
        double K     = 73.6667 + 1.3958333 * (JD - 2396758) / 36525;

        //Calculate the apparent longitude of the sun (excluding the effect of nutation)
        double L           = CAAEarth.EclipticLongitude(JD);
        double R           = CAAEarth.RadiusVector(JD);
        double SunLong     = L + 180 - CAACoordinateTransformation.DMSToDegrees(0, 0, 20.4898 / R);
        double SunLongDash = SunLong + CAACoordinateTransformation.DMSToDegrees(0, 0, CAANutation.NutationInLongitude(JD));

        double epsilon = CAANutation.TrueObliquityOfEcliptic(JD);

        //Convert to radians
        epsilon     = CAACoordinateTransformation.DegreesToRadians(epsilon);
        SunLong     = CAACoordinateTransformation.DegreesToRadians(SunLong);
        SunLongDash = CAACoordinateTransformation.DegreesToRadians(SunLongDash);
        K           = CAACoordinateTransformation.DegreesToRadians(K);
        I           = CAACoordinateTransformation.DegreesToRadians(I);
        theta       = CAACoordinateTransformation.DegreesToRadians(theta);

        double x = Math.Atan(-Math.Cos(SunLong) * Math.Tan(epsilon));
        double y = Math.Atan(-Math.Cos(SunLong - K) * Math.Tan(I));

        CAAPhysicalSunDetails details = new CAAPhysicalSunDetails();

        details.P  = CAACoordinateTransformation.RadiansToDegrees(x + y);
        details.B0 = CAACoordinateTransformation.RadiansToDegrees(Math.Asin(Math.Sin(SunLong - K) * Math.Sin(I)));

        double eta = Math.Atan(Math.Tan(SunLong - K) * Math.Cos(I));

        details.L0 = CAACoordinateTransformation.MapTo0To360Range(CAACoordinateTransformation.RadiansToDegrees(eta - theta));

        return(details);
    }