public void Refresh(Data_JD myJD, Graphics g)
            {
                Font font1 = new Font("Arial", 10, FontStyle.Italic);

                g.DrawRectangle(new Pen(Color.Black, 2), new Rectangle(loaction, new Size(width, heigh)));
                g.DrawString(myJD.JDaddress, font1, new SolidBrush(Color.Black), loaction.X + 5, loaction.Y + 5);
                if (myJD.Temperture.MyValue >= myJD.Temperture.AlarmMin && myJD.Temperture.MyValue <= myJD.Temperture.AlarmMax)
                {
                    g.DrawString("温度:" + myJD.Temperture.MyValue.ToString() + "℃", font1, sbrush_Green, loaction.X + 5, loaction.Y + 25);
                }
                else
                {
                    g.DrawString("温度:" + myJD.Temperture.MyValue.ToString() + "℃", font1, sbrush_red, loaction.X + 5, loaction.Y + 25);
                }
                if (myJD.Humidity.MyValue >= myJD.Humidity.AlarmMin && myJD.Humidity.MyValue <= myJD.Humidity.AlarmMax)
                {
                    g.DrawString("湿度:" + myJD.Humidity.MyValue.ToString() + "%RH", font1, sbrush_Green, loaction.X + 5, loaction.Y + 45);
                }
                else
                {
                    g.DrawString("湿度:" + myJD.Humidity.MyValue.ToString() + "%RH", font1, sbrush_red, loaction.X + 5, loaction.Y + 45);
                }
                if (myJD.PM.MyValue >= myJD.PM.AlarmMin && myJD.PM.MyValue <= myJD.PM.AlarmMax)
                {
                    g.DrawString("PM2.5:" + myJD.PM.MyValue.ToString() + "μg/m3", font1, sbrush_red, loaction.X + 5, loaction.Y + 65);
                }
                else
                {
                    g.DrawString("PM2.5:" + myJD.PM.MyValue.ToString() + "μg/m3", font1, sbrush_red, loaction.X + 5, loaction.Y + 65);
                }
            }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            zedGraphControl4.Hide();
            panel2.Width  = 1080;
            panel2.Height = (N_JD / 5 + 1) * 110 + 10;
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    myD_JD[i * 5 + j]     = new Data_JD(i * 5 + j + 1, 1);
                    myShowJD[i * 5 + j]   = new showJDn(5 + j * 205, 5 + i * 110, 200, 105);
                    myShushidu[i * 5 + j] = new Shushidu();
                    if (i * 5 + j < N_JD)
                    {
                        comboBox1.Items.Add((i * 5 + j + 1).ToString() + "#");
                    }
                }
            }
            myD_JD[0].JDIP = 0x1265;
            myD_JD[1].JDIP = 0x2fdd;
            showLinesINI();
            appStartT = DateTime.Now;
            _list_T   = myD_JD[0].list_T;
            _list_H   = myD_JD[0].list_H;
            _list_P   = myD_JD[0].list_P;
            myPane_T.CurveList.Clear();
            myCurve_T = myPane_T.AddCurve("温度曲线", _list_T, System.Drawing.Color.Red, SymbolType.None);
            myPane_H.CurveList.Clear();
            myCurve_H = myPane_H.AddCurve("湿度曲线", _list_H, System.Drawing.Color.Blue, SymbolType.None);
            myPane_P.CurveList.Clear();
            myCurve_P = myPane_P.AddCurve("PM2.5曲线", _list_P, System.Drawing.Color.GreenYellow, SymbolType.None);
            string [] ports = SerialPort.GetPortNames();
            if (ports.Length > 0)
            {
                for (int i = 0; i < ports.Length; i++)
                {
                    toolStripComboBox1.Items.Add(ports[i]);
                }
                toolStripComboBox1.Text = ports[0];
            }
            timer1.Interval = 500;
            timer1.Start();
            tabControl1.TabPages.Clear();
            tabControl1.TabPages.Add(tabPage3);
            this.MainMenuStrip.Hide();// = null;


            //  splitContainer1.Panel1Collapsed = true;
        }
Exemplo n.º 3
0
        void writeJDList(Data_JD MyDJD)
        {
            RunTime = (MyDJD.dateTime - appStartT).TotalHours;
            for (int i = 0; i < N_JD; i++)
            {
                if (MyDJD.JDIP == myD_JD[i].JDIP)
                {
                    myD_JD[i].dateTime = MyDJD.dateTime;
                    myD_JD[i].RunTime  = (float)RunTime;
                    myD_JD[i].nGot     = 60;

                    myD_JD[i].PM.MyValue         = MyDJD.PM.MyValue;
                    myD_JD[i].Temperture.MyValue = MyDJD.Temperture.MyValue;
                    myD_JD[i].Humidity.MyValue   = MyDJD.Humidity.MyValue;
                    myD_JD[i].list_T.Add(RunTime, MyDJD.Temperture.MyValue);
                    myD_JD[i].list_H.Add(RunTime, MyDJD.Humidity.MyValue);
                    myD_JD[i].list_P.Add(RunTime, MyDJD.PM.MyValue);
                    reJD_LastT[i] = (float)RunTime;
                    myD_JD[i].countEve();
                    if (myD_JD[i].Temperture.MyValue > myD_JD[i].Temperture.AlarmMin && myD_JD[i].Temperture.MyValue <myD_JD[i].Temperture.AlarmMax &&
                                                                                                                      myD_JD[i].Humidity.MyValue> myD_JD[i].Humidity.AlarmMin && myD_JD[i].Humidity.MyValue <myD_JD[i].Humidity.AlarmMax &&
                                                                                                                                                                                                             myD_JD[i].PM.MyValue> myD_JD[i].PM.AlarmMin && myD_JD[i].PM.MyValue < myD_JD[i].PM.AlarmMax
                        )
                    {
                        myShushidu[i].Shushi++;
                    }
                    else if (myD_JD[i].Temperture.MyValue > myD_JD[i].Temperture.AlarmMin && myD_JD[i].Temperture.MyValue <myD_JD[i].Temperture.AlarmMax ||
                                                                                                                           myD_JD[i].Humidity.MyValue> myD_JD[i].Humidity.AlarmMin && myD_JD[i].Humidity.MyValue <myD_JD[i].Humidity.AlarmMax ||
                                                                                                                                                                                                                  myD_JD[i].PM.MyValue> myD_JD[i].PM.AlarmMin && myD_JD[i].PM.MyValue < myD_JD[i].PM.AlarmMax
                             )
                    {
                        myShushidu[i].YiBan++;
                    }
                    else
                    //if (myD_JD[i].Temperture.MyValue > myD_JD[i].Temperture.AlarmMin && myD_JD[i].Temperture.MyValue < myD_JD[i].Temperture.AlarmMax
                    //   && myD_JD[i].Humidity.MyValue > myD_JD[i].Humidity.AlarmMin && myD_JD[i].Humidity.MyValue < myD_JD[i].Humidity.AlarmMax
                    //   && myD_JD[i].Light.MyValue > myD_JD[i].Light.AlarmMin && myD_JD[i].Light.MyValue < myD_JD[i].Light.AlarmMax
                    //   )
                    {
                        myShushidu[i].BuShushi++;
                    }
                    WriteLog(myD_JD[i]);
                    break;
                }
            }
        }
        void WriteLog(Data_JD MyDJD)
        {
            if (LogWritingM)
            {
                // lastTime += Dtsp;
                Rldats.NUM = NUM;
                NUM++;
                Rldats.Time                       = DateTime.Now;
                Rldats.RunTime                    = MyDJD.RunTime;
                Rldats.logData.JYW_ID             = MyDJD.JYW_ID;
                Rldats.logData.JD_ID              = MyDJD.JD_ID;
                Rldats.logData.Temperture.MyValue = MyDJD.Temperture.MyValue;
                Rldats.logData.Humidity.MyValue   = MyDJD.Humidity.MyValue;
                Rldats.logData.PM.MyValue         = MyDJD.PM.MyValue;

                //Rldats.Heading = UAVStatus.planeheading;
                //Rldats.Pitch = UAVStatus.pitch;
                //Rldats.Roll = UAVStatus.roll;
                //Rldats.Lat =  double.Parse(UAVStatus.planesPOS.Y.ToString("F6"));
                //Rldats.Lon = double.Parse(UAVStatus.planesPOS.X.ToString("F6"));
                //Rldats.Altitude = UAVStatus.gaodu;
                //Rldats.Ax = UAVStatus.Ax;
                //Rldats.Ay = UAVStatus.Ay;
                //Rldats.Az = UAVStatus.Az;
                //Rldats.Gx = UAVStatus.Wx;
                //Rldats.Gy = UAVStatus.Wy;
                //Rldats.Gz = UAVStatus.Wz;
                //Rldats.Vx = UAVStatus.Vx;
                //Rldats.Vy = UAVStatus.Vy;
                //Rldats.Vz = UAVStatus.Vz;
                //Rldats.Rev1 = (int)(UAVStatus.ZL_YM * 1000);
                //Rldats.Rev2 = (int)(UAVStatus.ZL_FY * 1000);
                //Rldats.Rev3 = (int)(UAVStatus.ZL_PH * 1000);
                //Rldats.Rev4 = (int)(UAVStatus.ZL_GZ * 1000);
                // Rldats.SENSERsBytes = RovStatus.getBytesLog();
                // Rldats.RControlanBytes = RovControler.ControlerRecord();
                myRovLog.Adddat2LogBD(Rldats);
            }
        }