예제 #1
0
        void statusBar1_StartStopClick(object sender, EventArgs e)
        {
            if (task.bRunning)
            {
                statusBar1.pause  = false;
                statusBar1.status = RUN_STATE.STOPPING;
                task.Stop();
                try
                {
                    rxDisplay1.LogComplete();
                }
                catch
                {
                }
            }
            else
            {
                RsInfo rs = Program.lst_rsinfo[Program.mainwnd.selectedRs];
                RxInfo rx = Program.lst_rxinfo[Program.mainwnd.selectedRx];
                statusBar1.total  = syscfg.iMeasTimes;
                statusBar1.count  = 1;
                statusBar1.status = RUN_STATE.INITIALIZING;

                task.Start();
                rxDisplay1.ClearAll();
                rxDisplay2.ClearAll();
                rxDisplay3.ClearAll();
                rxDisplay4.ClearAll();
            }
        }
예제 #2
0
        private void DoNextMeasure()
        {
            RsInfo rs = runstate.selectedRs.Dequeue();
            RxInfo rx = runstate.selectedRx.Dequeue();

            status = RUN_STATE.INITIALIZING;

            if (false)
            {
                SysConfig syscfg = Program.sysinfo;

                DeviceMgr.Log(String.Format(@"==== New Measurement Paramter========
                                            Measure times = {0}\r\nRs ID = {1}\r\nRs Value = {2}\r\nRs Temp. Alpha = {3}\r\nRs Temp. Beta = {4}\r\n
                                            Temperature = {5}\r\nRx ID = {6}\r\nSample times = {7}\r\nSwitch delay = {8}\r\n
                                            Filter = {9}\r\nFilter Length = {10}\r\nMeasure delay = {12}\r\n
                                            AutoFilter = {13}\r\nRx curr. = {14}\r\n
                                            New Measurement Started...", syscfg.iMeasTimes.ToString(), rs.sSerial, rs.dValue.ToString("F8"), rs.dAlpha.ToString("F3"), rs.dBeta.ToString("F3"),
                                            syscfg.dTemp.ToString("F3"), rx.sSerial, syscfg.iSampleTimes, syscfg.iKTT,
                                            syscfg.sFilterType, syscfg.iFilter, syscfg.iMeasDelay, syscfg.bThrow, rx.iIx
                                            ));
            }
            task.Start(rx, rs);
        }
예제 #3
0
        public void pc_cmd(string cmd)
        {
            if (cmd == "S")
            {
                task.Stop();//STOP; need reply //todo
                return;
            }
            if (cmd == "H")
            {
//                DeviceMgr.Reset();//reset
                return;
            }
            Match m;

            m = reg_mode.Match(cmd);
            if (m.Success)
            {
                oper_mode = m.Groups[1].Value;
                return;
            }
            m = reg_statistic.Match(cmd);
            if (m.Success)
            {
                syscfg.iFilter = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_filter.Match(cmd);
            if (m.Success)
            {
                if (m.Groups[1].Value == "2")
                {
                    syscfg.sFilterType = "filtertype3";
                }
                else if (m.Groups[1].Value == "1")
                {
                    syscfg.sFilterType = "filtertype2";
                }
                else
                {
                    syscfg.sFilterType = "filtertype1";
                }
                return;
            }
            m = reg_ix.Match(cmd);
            if (m.Success)
            {/*
              * //todo
              * if (currRx.iIx == 0) //1mA
              * if (currRx.iIx == 1) //10mA
              * if (currRx.iIx == 2) //0.1A
              * if (currRx.iIx == 3) //0.3A
              * if (currRx.iIx == 4) //1A
              * if (currRx.iIx == 5) //5A
              */
                double myIx = double.Parse(m.Groups[1].Value) / 1000;
                if (myIx >= 3)
                {
                    Program.lst_rxinfo[0].iIx = 5;
                }
                else if (myIx >= 0.65)
                {
                    Program.lst_rxinfo[0].iIx = 4;
                }
                else if (myIx >= 0.2)
                {
                    Program.lst_rxinfo[0].iIx = 3;
                }
                else if (myIx >= 0.05)
                {
                    Program.lst_rxinfo[0].iIx = 2;
                }
                else if (myIx >= 0.005)
                {
                    Program.lst_rxinfo[0].iIx = 1;
                }
                else if (myIx >= 0.0005)
                {
                    Program.lst_rxinfo[0].iIx = 0;
                }
                else
                {
                    Program.lst_rxinfo[0].iIx = -1;
                }
                return;
            }
            m = reg_delay.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasDelay = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_meastimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_sampletimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iSampleTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_measure.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                task.Start();
                return;
            }
            m = reg_rsa.Match(cmd);
            if (m.Success) //A mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'A';
                DeviceMgr.ReportHeader(syscfg.iMeasTimes);
                for (int i = 0; i < syscfg.iMeasTimes; i++)
                {
                    DeviceMgr.ReportData(i + 1, 10.01234566);
                    Thread.Sleep(1000);
                }
                return;
            }
            m = reg_rsb.Match(cmd);
            if (m.Success) //B mode
            {
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'B';
                return;
            }
        }