Exemplo n.º 1
0
        public bool IsUp(double ra, double dec, double minAlt)
        {
            sky6Utils tsxu = new sky6Utils();

            tsxu.ConvertRADecToAzAlt(ra, dec);
            double alt = tsxu.dOut1;

            if (minAlt > alt)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 2
0
        private XElement UpdatePosition(XElement xGalList)
        //Updates the values of HA and Altitude, then derives Side in the galaxy list by performing a TSX ComputeHA on each entry
        //
        {
            string gname;
            string gRA;
            string gHA;
            string gDec;
            string gAlt;

            //Open a TSX utility object for computing the hour angle
            sky6Utils tsx_ut = new sky6Utils();

            var xgals = from grec in xGalList.Elements("Galaxy") select grec;

            foreach (var grec in xgals)
            {
                //Look up the target by galaxy name and get the hourangle
                gname = grec.Element("Name").Value.ToString();
                gRA   = grec.Element("RA").Value.ToString();
                gDec  = grec.Element("Dec").Value.ToString();

                tsx_ut.ComputeHourAngle(System.Convert.ToDouble(gRA));
                gHA = tsx_ut.dOut0.ToString();
                grec.Element("HA").Value = gHA;

                tsx_ut.ConvertRADecToAzAlt(System.Convert.ToDouble(gRA), System.Convert.ToDouble(gDec));
                gAlt = tsx_ut.dOut1.ToString();
                grec.Element("Altitude").Value = gAlt;

                if (System.Convert.ToDouble(gHA) < 0)
                {
                    grec.Element("Side").Value = "East";
                }
                else
                {
                    grec.Element("Side").Value = "West";
                };
            }
            return(xGalList);
        }
Exemplo n.º 3
0
        public static bool CLSToTarget(string tgtName, SpeedVector sv, bool IsPrecision = false)
        {
            //first, couple dome to telescope, if there is one
            sky6Dome tsxd = new sky6Dome();

            try
            {
                tsxd.Connect();
                tsxd.IsCoupled = 1;
            }
            catch (Exception ex)
            {
                //do nothing
            }

            int            clsStatus = 123;
            sky6RASCOMTele tsxmt     = new sky6RASCOMTele();
            ClosedLoopSlew tsx_cl    = new ClosedLoopSlew();
            sky6StarChart  tsxsc     = new sky6StarChart();
            sky6Utils      tsxu      = new sky6Utils();
            //Check to see if target is above horizon
            double tgtRAH  = Transform.DegreesToHours(sv.RA_Degrees);
            double tgtDecD = sv.Dec_Degrees;

            tsxu.ConvertRADecToAzAlt(tgtRAH, tgtDecD);
            double tgtAzmD = tsxu.dOut0;
            double tgtAltD = tsxu.dOut1;

            if (tgtAltD <= 0)
            {
                MessageBox.Show("Slew failure: Target is below the horizon");
                return(false);
            }
            //Clear any image reduction, otherwise full reduction might cause a problem
            ccdsoftCamera tsxcam = new ccdsoftCamera()
            {
                ImageReduction = ccdsoftImageReduction.cdNone,
                Asynchronous   = 1 //make sure nothing else happens while setting this up
            };

            //Abort any ongoing imaging
            tsxcam.Abort();

            bool returnStatus = true;
            // diagnostic
            string strRA  = Utils.HourString(tgtRAH, false);
            string strDec = Utils.DegreeString(tgtDecD, false);

            //
            tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString());
            tsxmt.Connect();
            tsxu.Precess2000ToNow(tgtRAH, tgtDecD);
            double jnRAH  = tsxu.dOut0;
            double jnDecD = tsxu.dOut1;

            //tsxmt.Asynchronous = 0;
            try
            {
                tsxmt.SlewToRaDec(jnRAH, jnDecD, tgtName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Slew Failure: " + ex.Message);
                returnStatus = false;
            }
            if (IsPrecision && returnStatus)
            {
                //***  precision slew
                try
                {
                    clsStatus = tsx_cl.exec();
                }
                catch (Exception ex)
                {
                    returnStatus = false;
                }
            }
            try
            {
                tsxsc.Find(tgtName);
            }
            catch (Exception ex)
            {
                returnStatus = true;
            }
            return(returnStatus);
        }