예제 #1
0
        public void Transform_CelestialToApparentTest(double ra, double dec)
        {
            //Arrange
            var coordinates = new Coordinates(ra, dec, Epoch.J2000, Coordinates.RAType.Hours);

            //Act
            coordinates = coordinates.Transform(Epoch.JNOW);

            var transform = new ASCOM.Astrometry.Transform.Transform();

            transform.SetJ2000(ra, dec);

            //Check with ascom transformation that the transformation logic matches
            Assert.AreEqual(transform.RAApparent, coordinates.RA, 0.0001);
            Assert.AreEqual(transform.DECApparent, coordinates.Dec, 0.0001);
        }
예제 #2
0
        static public Coordinates AltAzm2RaDec(AltAzm altAzm, LatLon location, DateTime time, double elevation)
        {
            var JDdate = JDtime(time);
            var tfm    = new ASCOM.Astrometry.Transform.Transform();
            var jdtt   = tfm.JulianDateTT;

            //tfm.JulianDateTT = JDdate;
            tfm.SiteElevation   = elevation * 1000;
            tfm.SiteLatitude    = location.Lat;
            tfm.SiteLongitude   = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetAzimuthElevation(altAzm.Azm, altAzm.Alt);
            tfm.Refresh();
//            var res = new Coordinates(tfm.RAJ2000, tfm.DecJ2000);
//            var res = new Coordinates(tfm.RAApparent, tfm.DECApparent);
            var res = new Coordinates(tfm.RATopocentric, tfm.DECTopocentric);

            return(res);
        }
예제 #3
0
        static public RaDec AltAz2RaDec(AltAz altAzm, LatLon location, DateTime time, double elevation)
        {
            var utils   = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);

            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();

            tfm.JulianDateTT    = MJDdate;
            tfm.SiteElevation   = elevation * 1000;
            tfm.SiteLatitude    = location.Lat;
            tfm.SiteLongitude   = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetAzimuthElevation(altAzm.Az, altAzm.Alt);
            tfm.Refresh();
            var res = new RaDec(tfm.RAJ2000, tfm.DecJ2000);

            return(res);
        }
예제 #4
0
        static public AltAz RaDec2AltAz(RaDec coord, LatLon location, DateTime time, double elevation)
        {
            var utils   = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);

            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();

            tfm.JulianDateTT    = MJDdate;
            tfm.SiteElevation   = elevation * 1000;
            tfm.SiteLatitude    = location.Lat;
            tfm.SiteLongitude   = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetJ2000(coord.Ra, coord.Dec);
            tfm.Refresh();

            var res = new AltAz(tfm.ElevationTopocentric, tfm.AzimuthTopocentric);

            return(res);
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FMounterV1"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public Telescope()
        {
            ReadProfile(); // Read device configuration from the ASCOM Profile store

            tl         = new TraceLogger("", "FMounterV1");
            tl.Enabled = traceState;
            tl.LogMessage("Telescope", "Starting initialisation");

            utilities      = new Util();       //Initialise util object
            astroUtilities = new AstroUtils(); // Initialise astro utilities object
            fNOVAS         = new NOVAS31();
            fTransform     = new Astrometry.Transform.Transform();

            //TODO: Implement your additional construction here

            tl.LogMessage("Telescope", "Completed initialisation");

            fMounter = new TFMounter(true);

            isCreated = true;
        }
예제 #6
0
        public MountVM()
        {
            Log.WriteLine("Mount: Initialization starting...");
            CommunicationHandlerFactory.DiscoverDevices();
            Log.WriteLine("Mount: Device discovery started...");

            _startTime            = DateTime.UtcNow;
            _timerStatus          = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, async(s, e) => await OnTimer(s, e), Application.Current.Dispatcher);
            _timerFineSlew        = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Normal, async(s, e) => await OnFineSlewTimer(s, e), Application.Current.Dispatcher);
            _arrowCommand         = new DelegateCommand(s => OnAdjustTarget(s.ToString()));
            _connectScopeCommand  = new DelegateCommand(() => OnConnectToTelescope());
            _slewToTargetCommand  = new DelegateCommand(async() => await OnSlewToTarget(), () => MountConnected);
            _syncToTargetCommand  = new DelegateCommand(async() => await OnSyncToTarget(), () => MountConnected);
            _syncToCurrentCommand = new DelegateCommand(() => OnSyncToCurrent(), () => MountConnected);
            _startSlewingCommand  = new DelegateCommand(async s => await OnStartSlewing(s.ToString()), () => MountConnected);
            _stopSlewingCommand   = new DelegateCommand(async() => await OnStopSlewing('a'), () => MountConnected);
            _homeCommand          = new DelegateCommand(async() => await OnHome(), () => MountConnected);
            _setHomeCommand       = new DelegateCommand(async() => await OnSetHome(), () => MountConnected);
            _parkCommand          = new DelegateCommand(async() => await OnPark(), () => MountConnected);
            _driftAlignCommand    = new DelegateCommand(async dur => await OnRunDriftAlignment(int.Parse(dur.ToString())), () => MountConnected);
            _polarAlignCommand    = new DelegateCommand(() => OnRunPolarAlignment(), () => MountConnected);

            _util      = new Util();
            _transform = new ASCOM.Astrometry.Transform.Transform();

            var poiFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "PointsOfInterest.xml");

            Log.WriteLine("Mount: Attempting to read Point of Interest from {0}...", poiFile);
            if (File.Exists(poiFile))
            {
                XDocument doc = XDocument.Load(poiFile);
                _pointsOfInterest = doc.Element("PointsOfInterest").Elements("Object").Select(e => new PointOfInterest(e)).ToList();
                _pointsOfInterest.Insert(0, new PointOfInterest("--- Select Target Object ---"));
                _selectedPointOfInterest = 0;
                Log.WriteLine("Mount: Successfully read {0} Points of Interest.", _pointsOfInterest.Count - 1);
            }

            this.Version = Assembly.GetExecutingAssembly().GetName().Version;
            Log.WriteLine("Mount: Initialization of OATControl {0} complete...", this.Version);
        }
        public static AltAzm RaDec2AltAzm(Coordinates coord, LatLon location, DateTime time, double elevation)
        {
            var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);
            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();
            tfm.JulianDateTT = MJDdate;
            tfm.SiteElevation = elevation * 1000;
            tfm.SiteLatitude = location.Lat;
            tfm.SiteLongitude = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetJ2000(coord.Ra, coord.Dec);
            tfm.Refresh();

            var res = new AltAzm(tfm.ElevationTopocentric, tfm.AzimuthTopocentric);
            return res;
        }
        public static Coordinates AltAzm2RaDec(AltAzm altAzm, LatLon location, DateTime time, double elevation)
        {
            var utils = new ASCOM.Astrometry.AstroUtils.AstroUtils();
            var MJDdate = utils.CalendarToMJD(time.Day, time.Month, time.Year);
            MJDdate += time.TimeOfDay.TotalDays;

            var tfm = new ASCOM.Astrometry.Transform.Transform();
            tfm.JulianDateTT = MJDdate;
            tfm.SiteElevation = elevation * 1000;
            tfm.SiteLatitude = location.Lat;
            tfm.SiteLongitude = location.Lon;
            tfm.SiteTemperature = 0;
            tfm.SetAzimuthElevation(altAzm.Azm, altAzm.Alt);
            tfm.Refresh();
            var res = new Coordinates(tfm.RAJ2000, tfm.DecJ2000);
            return res;
        }
예제 #9
0
 public static Coordinates AltAzm2RaDec(AltAzm altAzm, LatLon location, DateTime time, double elevation)
 {
     var JDdate = JDtime(time);
     var tfm = new ASCOM.Astrometry.Transform.Transform();
     var jdtt = tfm.JulianDateTT;
     //tfm.JulianDateTT = JDdate;
     tfm.SiteElevation = elevation * 1000;
     tfm.SiteLatitude = location.Lat;
     tfm.SiteLongitude = location.Lon;
     tfm.SiteTemperature = 0;
     tfm.SetAzimuthElevation(altAzm.Azm, altAzm.Alt);
     tfm.Refresh();
     //            var res = new Coordinates(tfm.RAJ2000, tfm.DecJ2000);
     //            var res = new Coordinates(tfm.RAApparent, tfm.DECApparent);
     var res = new Coordinates(tfm.RATopocentric, tfm.DECTopocentric);
     return res;
 }
 private void test()
 {
     var trf = new ASCOM.Astrometry.Transform.Transform();
     var jd = trf.JulianDateTT;
     console.Text += string.Format("JD value = {0}\n", jd);
 }