コード例 #1
0
        private void CalcAndOutputResults()
        {
            if (!init_)
            {
                return;
            }

            string s = "";

            double d = ClientCommonAPI.CalcTime();

            SkyObjectPosCalc.SkyPosition obj = GetObject();
            s += obj.Name + ":" + Environment.NewLine;

            double dec, ra;

            obj.CalcTopoRaDec(d, latitude_, longitude_, out dec, out ra);
            s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine;

            double azm, alt;

            obj.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
            s += "Azm.\t= " + ClientCommonAPI.PrintAngle(azm) + " (" + azm.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Alt.\t= " + ClientCommonAPI.PrintAngle(alt) + " (" + alt.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += Environment.NewLine;

            buttonAddObject.Enabled        = (alt > 0);
            buttonCorrectPolarAxis.Enabled = ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_);

            if (alignment_.IsAligned)
            {
                s += "Alignment valid";
            }
            else
            {
                s += "Alignment not valid";
            }
            s += Environment.NewLine;
            s += alignment_.ToString(true);

            if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_))
            {
                s += Environment.NewLine + ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_);
            }

            textBoxResults.Text = s;
        }
コード例 #2
0
        private void SetConnectionAndAlignmentText()
        {
            if (!connectionAndAlignTextChanged_)
            {
                return;
            }
            connectionAndAlignTextChanged_ = false;

            string s = "";

            if (connectionAltAzm_ == null)
            {
                s += "Alt-Azm not Connected";
            }
            else
            {
                s += "Alt-Azm Connected to " + connectionAltAzm_.connection_.PortName + " at " + connectionAltAzm_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (connectionEqu_ == null)
            {
                s += "Equ not Connected";
            }
            else
            {
                s += "Equ Connected to " + connectionEqu_.connection_.PortName + " at " + connectionEqu_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (connectionGPS_ == null)
            {
                s += "GPS not Connected";
            }
            else
            {
                s += "GPS Connected to " + connectionGPS_.connection_.PortName + " at " + connectionGPS_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (alignment_ == null)
            {
                s += "Not Aligned";
            }
            else
            {
                if (alignment_.IsAligned)
                {
                    s += "Alignment valid";
                }
                else
                {
                    s += "Alignment not valid";
                }
                s += Environment.NewLine;
                s += alignment_.ToString();
                if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_))
                {
                    s += Environment.NewLine;
                    s += ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_);
                }
            }

            textBoxAlignment.Text = s;
        }
コード例 #3
0
        private void CalcAndOutputResults()
        {
            if (!init_)
            {
                return;
            }

            // if true, make four start alignment (i.e. actually the same two alignment starts, but twice for two equatorial angles)
            bool fourStars = textBoxPlatformA2.Enabled = textBoxPlatformDA2.Enabled = checkBox4StarAlignment.Checked;

            string s = "";

            try
            {
                {
                    //rnd_ = new Random(0);

                    PairA stand1 = ToScope(Star1, equAngle_).Offset(RndAngleErr(), RndAngleErr());

                    s += "Eq angle = " + (equAngle_ * toDeg).ToString() + ", Star1 in scope coordinates = " + PrintV(stand1) + Environment.NewLine;
                    if (stand1.Below(minAlt_ + altOff_))
                    {
                        throw new ApplicationException("Star1 is below min altitude");
                    }

                    PairA stand2 = ToScope(Star2, equAngle_ + equAngleD_).Offset(RndAngleErr(), RndAngleErr());

                    s += "Eq angle = " + ((equAngle_ + equAngleD_) * toDeg).ToString() + ", Star2 in scope coordinates = " + PrintV(stand2) + Environment.NewLine;
                    if (stand2.Below(minAlt_ + altOff_))
                    {
                        throw new ApplicationException("Star2 is below min altitude");
                    }

                    s += Environment.NewLine;

                    PairA stand21 = new PairA(), stand22 = new PairA();
                    if (fourStars)
                    {
                        stand21 = ToScope(Star1, equAngle2_).Offset(RndAngleErr(), RndAngleErr());
                        stand22 = ToScope(Star2, equAngle2_ + equAngleD2_).Offset(RndAngleErr(), RndAngleErr());

                        s += "Eq angle = " + (equAngle2_ * toDeg).ToString() + ", Star1 in scope coordinates = " + PrintV(stand21) + Environment.NewLine;
                        s += "Eq angle = " + ((equAngle2_ + equAngleD2_) * toDeg).ToString() + ", Star2 in scope coordinates = " + PrintV(stand22) + Environment.NewLine;
                        s += Environment.NewLine;
                    }

                    Alignment calc;

                    /*
                     * if (fourStars && (equAngleD_ != 0 || equAngleD2_ != 0))
                     * {
                     *  Vect3 star1 = new Vect3(Star1);
                     *  Vect3 star2 = new Vect3(Star2);
                     *  int iterations = MakeDynamic4StarAlignment(star1, "Star1", stand1, equAngle_ * equAngleFactor_,
                     *                                   star2, "Star2", stand2, (equAngle_ + equAngleD_) * equAngleFactor_,
                     *                                   star1, "Star1", stand21, equAngle2_ * equAngleFactor_,
                     *                                   star2, "Star2", stand22, (equAngle2_ + equAngleD2_) * equAngleFactor_,
                     *                                   out calc);
                     *  s += "Iterations: " + iterations.ToString();
                     *  s += Environment.NewLine;
                     * }
                     * else
                     * */
                    {
                        calc = new DSCAlignment(new Vect3(0, latitude_), precesions_);
                        calc.AddStar(new AlignStar("Star1", new Vect3(Star1), stand1, equAngle_ * equAngleFactor_));
                        calc.AddStar(new AlignStar("Star2", new Vect3(Star2), stand2, (equAngle_ + equAngleD_) * equAngleFactor_));
                        if (fourStars)
                        {
                            calc.AddStar(new AlignStar("Star1", new Vect3(Star1), stand21, equAngle2_ * equAngleFactor_));
                            calc.AddStar(new AlignStar("Star2", new Vect3(Star2), stand22, (equAngle2_ + equAngleD2_) * equAngleFactor_));
                        }
                    }

                    s += calc.ToString(true);
                    if (IsEquAxisCorrectionNeeded(latitude_, calc))
                    {
                        s += Environment.NewLine + AddEquAxisCorrectionText(latitude_, calc);
                    }
                    s += Environment.NewLine;
                    s += Environment.NewLine;

                    s += "OBJECT POSITION" + Environment.NewLine;
                    PairA standObj = ToScope(Obj, objEquAngle_);
                    s += "Object in scope coordinates = " + PrintV(standObj);
                    s += Environment.NewLine;
                    if (standObj.Below(minAlt_ + altOff_))
                    {
                        throw new ApplicationException("Object is below min altitude");
                    }

                    PairA  calcObj  = calc.Scope2Horz(standObj, objEquAngle_ * equAngleFactor_);
                    double errorMin = Math.Asin(Vect3.VMul(new Vect3(Obj), new Vect3(calcObj)).Abs) * toDeg * 60;
                    s += "Calculated Horizontal Object: " + PrintV(calcObj) + ", error " + errorMin.ToString("F2") + " arc min";
                    s += Environment.NewLine;
                    s += Environment.NewLine;

                    alignment_ = calc; // (Alignment)calc.Clone();

                    if (IsEquAxisCorrectionNeeded(latitude_, calc))
                    {
                        calc.CorrectEquAxis(new Vect3(0, latitude_));
                        s += calc.ToString(true);
                    }
                }
            }
            catch (Exception e)
            {
                s += e.Message;
                s += Environment.NewLine;
            }

            textBoxResults.Text = s;
        }