Exemple #1
0
 public void RawTransformTest()
 {
     using (AscomTools _AscomTools = new AscomTools())
     {
         double siteLongitude = -1.333333;
         double siteLatitude  = 52.666667;
         _AscomTools.Transform.SiteLatitude  = siteLatitude;
         _AscomTools.Transform.SiteLongitude = siteLongitude;
         _AscomTools.Transform.SiteElevation = 192;
         DateTime testTime = new DateTime(2019, 1, 18, 21, 11, 00);
         double   lst      = AstroConvert.LocalApparentSiderealTime(siteLongitude, testTime);
         _AscomTools.Transform.SetAzimuthElevation(0.0, siteLatitude);
         _AscomTools.Transform.JulianDateTT = _AscomTools.Util.DateLocalToJulian(testTime);
         double ra          = _AscomTools.Transform.RATopocentric;
         double dec         = _AscomTools.Transform.DECTopocentric;
         double alt         = _AscomTools.Transform.ElevationTopocentric;
         double az          = _AscomTools.Transform.AzimuthTopocentric;
         double lstExpected = 4.95996448153762;
         double raExpected  = 10.9439120745406;
         double decExpected = 89.9999999983757;
         double azExpected  = 8.03515690758855E-09;
         double altExpected = 52.6666669999972;
         Assert.AreEqual(lstExpected, lst, 0.001, "LST test failed");
         Assert.AreEqual(raExpected, ra, 0.0001, "RA test failed");
         Assert.AreEqual(decExpected, dec, 0.0001, "Dec test failed");
         Assert.AreEqual(azExpected, az, 0.0001, "Az test failed");
         Assert.AreEqual(altExpected, alt, 0.0001, "Alt test failed");
     }
 }
Exemple #2
0
 public void MountCoordinateTest()
 {
     using (AscomTools _AscomTools = new AscomTools())
     {
         double siteLongitude = -1.333333;
         double siteLatitude  = 52.666667;
         _AscomTools.Transform.SiteLatitude  = siteLatitude;
         _AscomTools.Transform.SiteLongitude = siteLongitude;
         _AscomTools.Transform.SiteElevation = 192;
         DateTime        testTime        = new DateTime(2019, 1, 18, 21, 11, 00);
         AltAzCoordinate altAzPosition   = new AltAzCoordinate(_AscomTools.Transform.SiteLatitude, 0.0);
         MountCoordinate currentPosition = new MountCoordinate(altAzPosition, new AxisPosition(0.0, 0.0), _AscomTools, testTime);
         double          lst             = currentPosition.LocalApparentSiderialTime;
         double          ra          = currentPosition.Equatorial.RightAscension.Value;
         double          dec         = currentPosition.Equatorial.Declination.Value;
         double          alt         = currentPosition.AltAzimuth.Altitude.Value;
         double          az          = currentPosition.AltAzimuth.Azimuth.Value;
         double          lstExpected = 4.95996448153762;
         double          raExpected  = 10.9439120745406;
         double          decExpected = 89.9999999983757;
         double          azExpected  = 8.03515690758855E-09;
         double          altExpected = 52.6666669999972;
         Assert.AreEqual(lstExpected, lst, 0.001, "LST test failed");
         Assert.AreEqual(raExpected, ra, 0.0001, "RA test failed");
         Assert.AreEqual(decExpected, dec, 0.0001, "Dec test failed");
         Assert.AreEqual(azExpected, az, 0.0001, "Az test failed");
         Assert.AreEqual(altExpected, alt, 0.0001, "Alt test failed");
     }
 }
 public void Refresh(AscomTools tools, DateTime syncTime)
 {
     SyncTime = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     Equatorial = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes));
     UpdateAltAzimuth(tools, syncTime);
 }
Exemple #4
0
        public void TakiExample5_4_4()
        {
            using (AscomTools tools = new AscomTools())
            {
                Angle longitude = new Angle("-1°20'20.54\"");
                tools.Transform.SiteLatitude  = new Angle("52°40'6.38\"");
                tools.Transform.SiteLongitude = longitude;
                tools.Transform.SiteElevation = 175.5;
                DateTime        initialTime     = new DateTime(2017, 03, 28, 21, 0, 0);
                DateTime        observationTime = new DateTime(2017, 03, 28, 21, 27, 56);
                MountCoordinate star1           = new MountCoordinate(new EquatorialCoordinate("0h7m54.0s", "29.038°"), new AxisPosition(1.732239, 1.463808, true), tools, observationTime);
                observationTime = new DateTime(2017, 03, 28, 21, 37, 02);
                MountCoordinate   star2 = new MountCoordinate(new EquatorialCoordinate("2h21m45.0s", "89.222°"), new AxisPosition(5.427625, 0.611563, true), tools, observationTime);
                TakiEQMountMapper taki  = new TakiEQMountMapper(star1, star2, initialTime);

                EquatorialCoordinate bCet           = new EquatorialCoordinate("0h43m07s", "-18.038°");
                DateTime             targetTime     = new DateTime(2017, 03, 28, 21, 52, 12);
                AxisPosition         bCetExpected   = new AxisPosition(2.27695654215, 0.657465529226, true); // 130.46°, 37.67°
                AxisPosition         bCetCalculated = taki.GetAxisPosition(bCet, targetTime);

                System.Diagnostics.Debug.WriteLine("Expected: {0}, calculated: {1}", bCetExpected, bCetCalculated);

                double tolerance  = 0.5; // degrees.
                bool   testResult = ((Math.Abs(bCetExpected.DecAxis - bCetCalculated.DecAxis) < tolerance) &&
                                     (Math.Abs(bCetExpected.RAAxis - bCetCalculated.RAAxis) < tolerance));
                Assert.IsTrue(testResult);
            }
        }
Exemple #5
0
 public void Initialize()
 {
     _Now   = new DateTime(2019, 1, 25, 11, 47, 40); // Gives HA of approx 20.
     _Tools = new AscomTools();
     _Tools.Transform.SiteElevation   = 192;
     _Tools.Transform.SiteLatitude    = 52.667;
     _Tools.Transform.SiteLongitude   = -1.333;
     _Tools.Transform.SiteTemperature = 15.0;
 }
 public void MoveRADec(AxisPosition newAxisPosition, AscomTools tools, DateTime syncTime)
 {
     // double[] delta = ObservedAxes.GetDeltaTo(newAxisPosition);
     SyncTime = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     // Apply the axis rotation to the new position.
     ObservedAxes = newAxisPosition;
     Equatorial   = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes));
     UpdateAltAzimuth(tools, syncTime);
 }
 public MountCoordinate(AxisPosition axisPosition, AscomTools tools, DateTime syncTime)
 {
     ObservedAxes = axisPosition;
     SyncTime     = syncTime;
     LocalApparentSiderialTime = new HourAngle(AstroConvert.LocalApparentSiderealTime(tools.Transform.SiteLongitude, syncTime));
     if (tools.Transform.SiteLatitude < 0.0)
     {
         Hemisphere = HemisphereOption.Southern;
     }
     Equatorial = new EquatorialCoordinate(GetRA(ObservedAxes), GetDec(ObservedAxes));
     this.UpdateAltAzimuth(tools, syncTime);
 }
Exemple #8
0
        public void GetTheoreticalFromEquatorial()
        {
            using (AscomTools tools = new AscomTools())
            {
                Angle longitude = new Angle("-1°20'20.54\"");
                tools.Transform.SiteLatitude  = new Angle("52°40'6.38\"");
                tools.Transform.SiteLongitude = longitude;
                tools.Transform.SiteElevation = 175.5;
                MountCoordinate      mirphac        = new MountCoordinate(new EquatorialCoordinate("3h25m34.77s", "49°55'12.0\""), new AxisPosition(1.04551212078025, 0.882804566344625, true), tools, _localTime);
                MountCoordinate      almaak         = new MountCoordinate(new EquatorialCoordinate("2h04m58.83s", "42°24'41.1\""), new AxisPosition(0.597795712351665, 0.817146830684098, true), tools, _localTime);
                MountCoordinate      ruchbah        = new MountCoordinate(new EquatorialCoordinate("1h26m58.39s", "60°19'33.3\""), new AxisPosition(0.506260233480349, 1.09753088667021, true), tools, _localTime);
                TakiEQMountMapper    taki           = new TakiEQMountMapper(mirphac, almaak, ruchbah, _localTime);
                EquatorialCoordinate gPer           = new EquatorialCoordinate("2h03m28.89s", "54°34'10.9\"");
                AxisPosition         gPerExpected   = new AxisPosition(0.649384407012042, 0.998796900509728, true);
                AxisPosition         gPerCalculated = taki.GetAxisPosition(gPer, _localTime);
                System.Diagnostics.Debug.WriteLine("Calculated: {0}, expected: {1}", gPerExpected, gPerCalculated);
                double tolerance  = 0.25; // degrees.
                bool   testResult = ((Math.Abs(gPerExpected.DecAxis - gPerCalculated.DecAxis) < tolerance) &&
                                     (Math.Abs(gPerExpected.RAAxis - gPerCalculated.RAAxis) < tolerance));

                Assert.IsTrue(testResult);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="targetRA"></param>
        /// <param name="targetDec"></param>
        /// <param name="tools"></param>
        /// <param name="futureOffset">Offset in future in seconds (if any)</param>
        /// <returns></returns>
        public AxisPosition GetAxisPositionForRADec(double targetRA, double targetDec, AscomTools tools, double futureOffset = 0.0)
        {
            bool   flipDEC;
            double adjustedRA = targetRA;
            double targetHA   = AstroConvert.RangeHA(targetRA - LocalApparentSiderialTime + (futureOffset / 3600.0));

            if (targetHA < 0) // Target is to the west.
            {
                if (ForceMeridianFlip)
                {
                    if (Hemisphere == HemisphereOption.Northern)
                    {
                        flipDEC = false;
                    }
                    else
                    {
                        flipDEC = true;
                    }
                    adjustedRA = targetRA;
                }
                else
                {
                    if (Hemisphere == HemisphereOption.Northern)
                    {
                        flipDEC = true;
                    }
                    else
                    {
                        flipDEC = false;
                    }
                    adjustedRA = AstroConvert.RangeRA(targetRA - 12);
                }
            }
            else
            {
                if (ForceMeridianFlip)
                {
                    if (Hemisphere == HemisphereOption.Northern)
                    {
                        flipDEC = true;
                    }
                    else
                    {
                        flipDEC = false;
                    }
                    adjustedRA = AstroConvert.RangeRA(targetRA - 12);
                }
                else
                {
                    if (Hemisphere == HemisphereOption.Northern)
                    {
                        flipDEC = false;
                    }
                    else
                    {
                        flipDEC = true;
                    }
                    adjustedRA = targetRA;
                }
            }


            // Compute for Target RA/DEC angles
            Angle RAAxis  = GetAxisPositionForRA(adjustedRA, 0.0, futureOffset);
            Angle DecAxis = GetAxisPositionForDec(targetDec, flipDEC);

            // System.Diagnostics.Debug.WriteLine($"RA/Dec:{targetHA}/{targetDec} Axes:{ RAAxis.Value}/{ DecAxis.Value} FlipDec: {flipDEC}");
            return(new AxisPosition(RAAxis.Value, DecAxis.Value, flipDEC));
        }
 /// <summary>
 /// Returns the RADec coordinate for the observed AltAzimuth using the values
 /// currently set in the passed AscomTools instance. Also sets the stored Equatorial
 /// </summary>
 /// <param name="transform"></param>
 /// <returns></returns>
 public void UpdateEquatorial(AscomTools tools, DateTime syncTime)
 {
     tools.Transform.JulianDateTT = tools.Util.DateLocalToJulian(syncTime);
     tools.Transform.SetAzimuthElevation(AltAzimuth.Azimuth, AltAzimuth.Altitude);
     Equatorial = new EquatorialCoordinate(tools.Transform.RATopocentric, tools.Transform.DECTopocentric);
 }
 /// <summary>
 /// Returns the AltAzimuth coordinate for the equatorial using the values
 /// currently set in the passed AscomTools instance.
 /// </summary>
 /// <param name="transform"></param>
 /// <returns></returns>
 public void UpdateAltAzimuth(AscomTools tools, DateTime syncTime)
 {
     tools.Transform.JulianDateTT = tools.Util.DateLocalToJulian(syncTime);
     tools.Transform.SetTopocentric(Equatorial.RightAscension, Equatorial.Declination);
     AltAzimuth = new AltAzCoordinate(tools.Transform.ElevationTopocentric, AstroConvert.RangeAzimuth(tools.Transform.AzimuthTopocentric));
 }