Example #1
0
        public void NutationInObliquityTest()
        {
            var    date = new AASDate(1987, 4, 10, 0, 0, 0, true);
            double nutationInEcliptic = AASNutation.NutationInObliquity(date.Julian);

            Assert.Equal(9.4425206987573933, nutationInEcliptic);
        }
Example #2
0
        public void MeanObliquityOfEclipticTest()
        {
            var    date      = new AASDate(1987, 4, 10, 0, 0, 0, true);
            double obliquity = AASNutation.MeanObliquityOfEcliptic(date.Julian);

            Assert.Equal(23.440946290957317, obliquity);
        }
Example #3
0
        public void NutationInLongitudeTest()
        {
            var    date = new AASDate(1987, 4, 10, 0, 0, 0, true);
            double nutationInLongitude = AASNutation.NutationInLongitude(date.Julian);

            Assert.Equal(-3.7879310766037446, nutationInLongitude);
        }
Example #4
0
    protected void CorrectForFK5SystemReduction()
    {
        double appGeoLon = GetGeocentricLongitude(vectorToEarthCorrected.x, vectorToEarthCorrected.y);
        double appGeoLat = GetGeocentricLatitude(vectorToEarthCorrected.x, vectorToEarthCorrected.y, vectorToEarthCorrected.z);

        double deltaLambdaFK5 = AASFK5.CorrectionInLongitude(appGeoLon, appGeoLat, jdeCorrected);
        double deltaBetaFK5   = AASFK5.CorrectionInLatitude(appGeoLon, jdeCorrected);

        lambdaFK5 = lambdaAberration + deltaLambdaFK5;
        betaFK5   = betaAberration + deltaBetaFK5;

        //correct for nutation
        double deltaPhi     = AASNutation.NutationInLongitude(jdeCorrected) / 3600;
        double deltaEpsilon = AASNutation.NutationInObliquity(jdeCorrected) / 3600;

        epsilon = AASNutation.TrueObliquityOfEcliptic(jdeCorrected);
        double lambdaNutation = lambdaFK5 + deltaPhi;
        double betaNutation   = betaFK5 + deltaEpsilon;

        //x=RA in decimal hours, y=dec in degrees
        AAS2DCoordinate equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(lambdaNutation, betaNutation, epsilon);

        equatorialCoords.RA          = new HourAngle(equatorial.X);
        equatorialCoords.Declination = new DegreesAngle(equatorial.Y);
    }
Example #5
0
    //obliquity of the ecliptic with correction
    private double GetEpsilonCorrected()
    {
        double T            = (jd - 2451545.0) / 36525;
        double epsilon0     = AASNutation.MeanObliquityOfEcliptic(jd);
        double omega        = 125.04 - 1934.136 * T;
        double deltaEpsilon = .00256 * Math.Cos(omega * M.DEG2RAD);

        return(epsilon0 + deltaEpsilon);
    }
Example #6
0
    private void CalculateEquatorialPosition()
    {
        DegreesAngle ecLon = new DegreesAngle(AASMoon.EclipticLongitude(jd));
        DegreesAngle ecLat = new DegreesAngle(AASMoon.EclipticLatitude(jd));

        double epsilon = AASNutation.TrueObliquityOfEcliptic(jd);

        AAS2DCoordinate eq = AASCoordinateTransformation.Ecliptic2Equatorial(ecLon.Get(), ecLat.Get(), epsilon);

        equatorialCoords.RA          = new HourAngle(eq.X);
        equatorialCoords.Declination = new DegreesAngle(eq.Y);
    }
Example #7
0
 //obliquity of the ecliptic
 protected double GetDeltaEpsilon()
 {
     return(AASNutation.MeanObliquityOfEcliptic(jd));
 }
        public void Ecliptic2EquatorialTest(double JD, double apparentEclipticLongitude, double apparentEclipticLatitude, double expectedX, double expectedY)
        {
            var equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(apparentEclipticLongitude, apparentEclipticLatitude, AASNutation.TrueObliquityOfEcliptic(JD));

            Assert.Equal(expectedX, equatorial.X);
            Assert.Equal(expectedY, equatorial.Y);
        }
        public static AAS2DCoordinate MoonPosition(DateTime dateTime)
        {
            dateTime = dateTime.ToUniversalTime(); // NOTE: time must be converted to Universal Time

            //Calculate the topocentric horizontal position of the Moon
            AASDate         dateMoonCalc = new AASDate(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, true);
            double          JDMoon       = dateMoonCalc.Julian + AASDynamicalTime.DeltaT(dateMoonCalc.Julian) / 86400.0;
            double          MoonLong     = AASMoon.EclipticLongitude(JDMoon);
            double          MoonLat      = AASMoon.EclipticLatitude(JDMoon);
            AAS2DCoordinate Equatorial   = AASCoordinateTransformation.Ecliptic2Equatorial(MoonLong, MoonLat, AASNutation.TrueObliquityOfEcliptic(JDMoon));
            double          MoonRad      = AASMoon.RadiusVector(JDMoon);

            MoonRad /= 149597870.691; //Convert KM to AU
            AAS2DCoordinate MoonTopo = AASParallax.Equatorial2Topocentric(Equatorial.X, Equatorial.Y, MoonRad, RT_LONG, RT_LAT, RT_HEIGHT, JDMoon);
            double          AST      = AASSidereal.ApparentGreenwichSiderealTime(dateMoonCalc.Julian);
            double          LongtitudeAsHourAngle = AASCoordinateTransformation.DegreesToHours(RT_LONG);
            double          LocalHourAngle        = AST - LongtitudeAsHourAngle - MoonTopo.X;
            AAS2DCoordinate MoonHorizontal        = AASCoordinateTransformation.Equatorial2Horizontal(LocalHourAngle, MoonTopo.Y, RT_LAT);

            MoonHorizontal.Y += AASRefraction.RefractionFromTrue(MoonHorizontal.Y, 1013, 10);

            //The result above should be that we have a rising Moon at Y degrees above the horizon at azimuth X degrees east of the southern horizon
            //NOTE: for azimuth west is considered positive, to get east as positive subtract the result from 360
            return(MoonHorizontal);
        }
        public static AAS2DCoordinate SunPosition(DateTime dateTime)
        {
            var bHighPrecision = false;

            dateTime = dateTime.ToUniversalTime(); // NOTE: time must be converted to Universal Time

            //Calculate the topocentric horizontal position of the Sun
            AASDate         dateSunCalc           = new AASDate(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, true);
            double          JDSun                 = dateSunCalc.Julian + AASDynamicalTime.DeltaT(dateSunCalc.Julian) / 86400.0;
            double          SunLong               = AASSun.ApparentEclipticLongitude(JDSun, bHighPrecision);
            double          SunLat                = AASSun.ApparentEclipticLatitude(JDSun, bHighPrecision);
            AAS2DCoordinate Equatorial            = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, AASNutation.TrueObliquityOfEcliptic(JDSun));
            double          SunRad                = AASEarth.RadiusVector(JDSun, bHighPrecision);
            AAS2DCoordinate SunTopo               = AASParallax.Equatorial2Topocentric(Equatorial.X, Equatorial.Y, SunRad, RT_LONG, RT_LAT, RT_HEIGHT, JDSun);
            double          AST                   = AASSidereal.ApparentGreenwichSiderealTime(dateSunCalc.Julian);
            double          LongtitudeAsHourAngle = AASCoordinateTransformation.DegreesToHours(RT_LONG);
            double          LocalHourAngle        = AST - LongtitudeAsHourAngle - SunTopo.X;
            AAS2DCoordinate SunHorizontal         = AASCoordinateTransformation.Equatorial2Horizontal(LocalHourAngle, SunTopo.Y, RT_LAT);

            SunHorizontal.Y += AASRefraction.RefractionFromTrue(SunHorizontal.Y, 1013, 10);

            //The result above should be that we have a setting Sun at Y degrees above the horizon at azimuth X degrees south of the westerly horizon
            //NOTE: for azimuth west is considered positive, to get east as positive subtract the result from 360
            return(SunHorizontal);
        }
Example #11
0
 //obliquity of the ecliptic
 private double GetEpsilon()
 {
     return(AASNutation.MeanObliquityOfEcliptic(jd));
 }
Example #12
0
        public void TrueObliquityOfEclipticTest(double jd, double expectedTrueObliquity)
        {
            double trueObliquity = AASNutation.TrueObliquityOfEcliptic(jd);

            Assert.Equal(expectedTrueObliquity, trueObliquity);
        }
Example #13
0
        public void NutationInDeclinationTest(double x, double obliquity, double nutationInLongitude, double nutationInEcliptic, double expectedDeltaNutation)
        {
            double deltaNutation = AASNutation.NutationInDeclination(x, obliquity, nutationInLongitude, nutationInEcliptic);

            Assert.Equal(expectedDeltaNutation, deltaNutation);
        }
Example #14
0
        public void NutationInRightAscensionTest(double x, double y, double obliquity, double nutationInLongitude, double nutationInEcliptic, double expectedAlphaNutation)
        {
            double alphaNutation = AASNutation.NutationInRightAscension(x, y, obliquity, nutationInLongitude, nutationInEcliptic);

            Assert.Equal(expectedAlphaNutation, alphaNutation);
        }
        public Coordinate GetMoonCoordinate(DateTime datetime)
        {
            AASDate date     = new AASDate(datetime.Year, datetime.Month, datetime.Day, datetime.Hour, datetime.Minute, datetime.Second, true);
            double  JD       = date.Julian + AASDynamicalTime.DeltaT(date.Julian) / 86400.0;
            double  MoonLong = AASMoon.EclipticLongitude(JD);
            double  MoonLat  = AASMoon.EclipticLatitude(JD);

            AAS2DCoordinate Equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(MoonLong, MoonLat, AASNutation.TrueObliquityOfEcliptic(JD));
            double          MoonRad    = AASMoon.RadiusVector(JD);

            MoonRad /= 149597870.691; //Convert KM to AU

            AAS2DCoordinate MoonTopo = AASParallax.Equatorial2Topocentric(Equatorial.X, Equatorial.Y, MoonRad, Location.Longitude, Location.Latitude, Location.Altitude, JD);

            return(new Coordinate(MoonTopo.X, MoonTopo.Y));
        }
        public Coordinate GetSunCoordinate(DateTime datetime)
        {
            AASDate date    = new AASDate(datetime.Year, datetime.Month, datetime.Day, datetime.Hour, datetime.Minute, datetime.Second, true);
            double  JD      = date.Julian + AASDynamicalTime.DeltaT(date.Julian) / 86400.0;
            double  SunLong = AASSun.ApparentEclipticLongitude(JD, false);
            double  SunLat  = AASSun.ApparentEclipticLatitude(JD, false);

            AAS2DCoordinate equatorial = AASCoordinateTransformation.Ecliptic2Equatorial(SunLong, SunLat, AASNutation.TrueObliquityOfEcliptic(JD));
            double          SunRad     = AASEarth.RadiusVector(JD, false);

            // This line gives us RA & Declination.
            AAS2DCoordinate SunTopo = AASParallax.Equatorial2Topocentric(equatorial.X, equatorial.Y, SunRad, Location.Longitude, Location.Latitude, Location.Altitude, JD);

            return(new Coordinate(SunTopo.X, SunTopo.Y));
        }