Ejemplo n.º 1
0
        //=================== GET Info PW3 =========================//
        //private void GetPlanwaveInfo()
        //{
        //    double lst, altRadians, azRadians;
        //    String uRLString = "http://localhost:8220/status";
        //    XmlTextReader reader = new XmlTextReader(uRLString);
        //    textBox9.BeginInvoke((Action)(() =>
        //    {
        //        label20.ForeColor = System.Drawing.Color.Green;
        //        label20.Text = "Connected";
        //        String elementName = "";
        //        textBox9.Text = "";
        //        while (reader.Read())
        //        {
        //            switch (reader.NodeType)
        //            {
        //                case XmlNodeType.Element:
        //                    elementName = reader.Name;

        //                    if (elementName == "utc" ||
        //                        elementName == "jd" ||
        //                        elementName == "lst" ||
        //                        elementName == "azm_radian" ||
        //                        elementName == "alt_radian")
        //                    {
        //                        textBox9.Text += " " + reader.Name + " : ";
        //                    }
        //                    break;
        //                case XmlNodeType.Text:

        //                    if (elementName == "utc" ||
        //                        elementName == "jd" ||
        //                        elementName == "lst" ||
        //                        elementName == "azm_radian" ||
        //                        elementName == "alt_radian")
        //                    {
        //                        switch (elementName)
        //                        {
        //                            case "lst": string[] lst_split = reader.Value.Split(' '); lst = Convert.ToDouble(lst_split[0]); textBox9.Text += reader.Value; break;
        //                            case "azm_radian": textBox9.Text += Convert.ToString((Convert.ToDouble(reader.Value) * 57.2957795131)); string[] altSplit = reader.Value.Split(' '); altRadians = Convert.ToDouble(altSplit[0]) * 57.2957795131; break;
        //                            case "alt_radian": textBox9.Text += Convert.ToString((Convert.ToDouble(reader.Value) * 57.2957795131)); string[] azmSplit = reader.Value.Split(' '); azRadians = Convert.ToDouble(azmSplit[0]) * 57.2957795131; break;
        //                            default: textBox9.Text += reader.Value; break;
        //                        }
        //                        textBox9.Text += System.Environment.NewLine;
        //                    }
        //                    elementName = "";
        //                    break;
        //            }
        //        }
        //    }));
        //}

        //=============================================//

        //=============  Calculate Sun Position ==============//mmmmmm
        public void sunPosition(out double sunAlt, out double sunAzm)
        {
            try
            {
                RaDec    raDec             = Sun.GetRaDec(AstroTime.JulianDayUTC(DateTime.Now));
                AltAz    sunAltAzm         = AstroLib.RADecToAltAz(DateTime.Now, raDec);
                String   altSunBeforeSprit = Convert.ToString(sunAltAzm.Alt);
                String[] sunAltSprit       = altSunBeforeSprit.Split(' ');
                Double   sunAltSprited     = Convert.ToDouble(sunAltSprit[0]);
                String   azmSunBeforeSprit = Convert.ToString(sunAltAzm.Az);
                String[] sunAzmSprit       = azmSunBeforeSprit.Split(' ');
                Double   sunAzmSprited     = Convert.ToDouble(sunAzmSprit[0]);
                sunAlt = sunAltSprited;
                sunAzm = sunAzmSprited;
                double revertSunAzm = sunAzm - 180;
                if (revertSunAzm < 0)
                {
                    revertSunAzm = revertSunAzm + 360;
                }
                textBox10.Invoke((Action)(() =>
                {
                    textBox10.Text = "Local Date Time: " + DateTime.Now + Environment.NewLine +
                                     "Latitude Ref : " + LATITUDE + Environment.NewLine +
                                     "Longitude Ref : " + LONGITUDE + Environment.NewLine +
                                     "Sun Alt : " + Math.Round(Convert.ToDecimal(sunAltSprited), 5) + Environment.NewLine +
                                     "Sun Azm : " + Math.Round(Convert.ToDecimal(sunAzmSprited), 5) + Environment.NewLine +
                                     "Revert Azm : " + Math.Round(Convert.ToDecimal(revertSunAzm), 5);
                    textBox14.Text = Convert.ToString(Math.Round(Convert.ToDecimal(aDU), 2));
                    textBox13.Text = exposureTime;

                    textBox20.Text = Convert.ToString(Convert.ToDecimal(variableAdu)); //TEST
                }));
            }
            catch { sunAlt = 0; sunAzm = 0; }
        }
Ejemplo n.º 2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     addFilter();
     //=============== SET UP =============//
     AstroLib.Setup(true, LATITUDE, LONGITUDE, 7, false, 2400, "Port1.PXP");
     //===================================//
     SetTimer();
 }