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);
        }
Exemple #2
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);
    }
        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 void HorizontalParallaxToRadiusVectorTest(double parallax, double expectedRadiusVector)
        {
            double radiusVector = AASMoon.HorizontalParallaxToRadiusVector(parallax);

            Assert.Equal(expectedRadiusVector, radiusVector);
        }
        public void MeanLongitudePerigeeTest(double JD, double expectedMeanLongitudePerigee)
        {
            double moonMeanPerigee = AASMoon.MeanLongitudePerigee(JD);

            Assert.Equal(expectedMeanLongitudePerigee, moonMeanPerigee);
        }
        public void ArgumentOfLatitudeTest(double JD, double expectedArgumentOfLatitude)
        {
            double argumentOfLatitude = AASMoon.ArgumentOfLatitude(JD);

            Assert.Equal(expectedArgumentOfLatitude, argumentOfLatitude);
        }
        public void EclipticLatitudeTest(double JD, double expectedEclipticLatitude)
        {
            double moonLat = AASMoon.EclipticLatitude(JD);

            Assert.Equal(expectedEclipticLatitude, moonLat);
        }
        public void MeanLongitudeAscendingNodeTest(double JD, double expectedMeanLongitudeAscendingNode)
        {
            double moonMeanAscendingNode = AASMoon.MeanLongitudeAscendingNode(JD);

            Assert.Equal(expectedMeanLongitudeAscendingNode, moonMeanAscendingNode);
        }
        public void MeanAnomalyTest(double JD, double expectedMeanAnomaly)
        {
            double meanAnomaly = AASMoon.MeanAnomaly(JD);

            Assert.Equal(expectedMeanAnomaly, meanAnomaly);
        }
        public void MeanElongationTest(double JD, double expectedMeanElongation)
        {
            double meanElongation = AASMoon.MeanElongation(JD);

            Assert.Equal(expectedMeanElongation, meanElongation);
        }
        public void MeanLongitudeTest(double JD, double expectedMeanLongitude)
        {
            double meanLongitude = AASMoon.MeanLongitude(JD);

            Assert.Equal(expectedMeanLongitude, meanLongitude);
        }
        public void TrueLongitudeAscendingNodeTest(double JD, double expectedTrueLongitudeAscendingNode)
        {
            double trueMeanAscendingNode = AASMoon.TrueLongitudeAscendingNode(JD);

            Assert.Equal(expectedTrueLongitudeAscendingNode, trueMeanAscendingNode);
        }
        public void RadiusVectorTest(double JD, double expectedRadiusVector, double expectedParallax)
        {
            double moonRadius = AASMoon.RadiusVector(JD);

            Assert.Equal(expectedRadiusVector, moonRadius);
        }
        public void RadiusVectorToHorizontalParallaxTest(double radiusVector, double expectedHorizontalParallax)
        {
            double horizontalParallax = AASMoon.RadiusVectorToHorizontalParallax(radiusVector);

            Assert.Equal(expectedHorizontalParallax, horizontalParallax);
        }
Exemple #15
0
 public override double GetDistance()
 {
     return(AASMoon.RadiusVector(jd));
 }
Exemple #16
0
 protected override double GetRadiusVector(double JD)
 {
     return(AASMoon.RadiusVector(JD));
 }