コード例 #1
0
        public void Slew_Minus_SetsSlewing()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);
            controller.Connect();

            var task = controller.Slew(Orientation.Minus, TimeSpan.FromSeconds(10));
            Assert.IsTrue(controller.Slewing);

            fakeTelescope.SiderealTime += TimeSpan.FromSeconds(10).TotalHours;

            task.Wait();
            Assert.IsFalse(controller.Slewing);
        }
コード例 #2
0
        public void Slew_Minus_ReturnsToNotMovingAfterSlew()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);
            controller.Connect();
            controller.Position = TimeSpan.FromSeconds(180).TotalHours;

            var task = controller.Slew(Orientation.Minus, TimeSpan.FromSeconds(10));
            Assert.AreEqual(-8, controller.SlewRate);
            fakeTelescope.SiderealTime += TimeSpan.FromSeconds(10).TotalHours;

            task.Wait();
            Assert.AreEqual(0, controller.SlewRate);
        }
コード例 #3
0
        public void Slew_Minus_PositionUpdatesAtSlewRatePositiveStart()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);
            controller.Connect();
            controller.Position = 50;

            var task = controller.Slew(Orientation.Minus, TimeSpan.FromSeconds(10));

            fakeTelescope.SiderealTime += TimeSpan.FromSeconds(10).TotalHours;

            task.Wait();
            Assert.AreEqual(Math.Round(50 - (Constants.DEGREES_PER_SECOND * 8) * 10, 4), Math.Round(controller.Position, 4));
        }
コード例 #4
0
        public void Slew_Minus_StopsWhenReachsMinus90()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);
            controller.Connect();
            controller.Position = -80;

            var slewTime = TimeSpan.FromSeconds(20 / (Constants.DEGREES_PER_SECOND * 8));
            var task = controller.Slew(Orientation.Minus, slewTime);

            //Simulate time ticking by
            slewTime = TimeSpan.FromSeconds(5 / (Constants.DEGREES_PER_SECOND * 8));
            fakeTelescope.SiderealTime += slewTime.TotalHours;
            Thread.Sleep(20);
            fakeTelescope.SiderealTime += slewTime.TotalHours;
            Thread.Sleep(20);
            fakeTelescope.SiderealTime += slewTime.TotalHours;
            Thread.Sleep(20);
            fakeTelescope.SiderealTime += slewTime.TotalHours;
            Thread.Sleep(20);

            task.Wait();
            Assert.AreEqual(-90, controller.Position);
        }
コード例 #5
0
        public void Slew_ThrowsIfNotStarted()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);

            controller.Slew(Orientation.Plus, TimeSpan.FromSeconds(10));
        }
コード例 #6
0
        public void Slew_Plus_StartsTrackingPosition()
        {
            var fakeTelescope = new FakeTelescope();
            fakeTelescope.SiderealTime = TimeSpan.FromHours(3).TotalHours;
            var controller = new DecAxisController(fakeTelescope);
            controller.Connect();

            var task = controller.Slew(Orientation.Plus, TimeSpan.FromSeconds(10));

            fakeTelescope.SiderealTime += TimeSpan.FromSeconds(10).TotalHours;

            task.Wait();
            Assert.AreEqual(Math.Round((Constants.DEGREES_PER_SECOND * 8) * 10, 4), Math.Round(controller.Position, 4));
        }