示例#1
0
        public bool CheckError()
        {
            lbl_error.Text    = "";
            lbl_error.Visible = false;
            RxInfo rx = Program.lst_rxinfo[Program.mainwnd.selectedRx];
            RsInfo rs = Program.lst_rsinfo[Program.mainwnd.selectedRs];

            if ((rs.dValue / rx.dRxInput) > 1023.1)
            {
                lbl_error.Text    = StringResource.str("rs_2big") + "," + StringResource.str(String.Format("help_std{0}", rx.iRRange));
                lbl_error.Visible = true;
                return(true);
            }
            if ((rs.dValue / rx.dRxInput) < 0.000977) //=1/1023.1
            {
                lbl_error.Text    = StringResource.str("rs_2small") + "," + StringResource.str(String.Format("help_std{0}", rx.iRRange));
                lbl_error.Visible = true;
                return(true);
            }

            /*if ((rx.iRRange == ActionMgr.RNG_10K && rx.bSqrt) || (rx.iRRange == ActionMgr.RNG_100K && rx.bSqrt))
             * {
             *  lbl_error.Text = StringResource.str("nox2_4big");
             *  lbl_error.Visible = true;
             *  return true;
             * }*/
            return(false);
        }
示例#2
0
        public void SelectRange(int range)
        {
            RsInfo rs = Program.lst_rsinfo[selectedRs];

            rs.iRRange = range;
            InitDisplay(selectedRs);
        }
示例#3
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();
            }
        }
示例#4
0
 void statusBar1_StartStopClick(object sender, EventArgs e)
 {
     if (task.bRunning)
     {
         statusBar1.pause  = false;
         statusBar1.status = RUN_STATE.STOPPING;
         task.Stop();
     }
     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;
         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();
         Program.data.ClearAll();
         foreach (RxDisplay rxdisp in Enumerable.Range(1, 4).Select(x => findrx(x)))
         {
             rxdisp.ReDraw();
         }
     }
 }
示例#5
0
        public void InitDisplay(int iRs)
        {
            selectedRs = iRs;
            RsInfo rs = Program.lst_rsinfo[iRs];

            btn_chan.Text   = "CH " + (iRs + 1).ToString();
            btn_rvalue.Text = Util.FormatData(rs.dValue, 7);
            btn_ralpha.Text = rs.dAlpha.ToString("F2");
            btn_rbeta.Text  = rs.dBeta.ToString("F2");
            btn_temp.Text   = RunWnd.syscfg.dTemp.ToString("F3");
            btn_serial.Text = rs.sSerial;
        }
示例#6
0
        public void InitDisplay(int iRs)
        {
            selectedRs = iRs;
            RsInfo rs = Program.lst_rsinfo[iRs];

            btn_chan.Text   = "CH " + (iRs + 1).ToString();
            btn_rvalue.Text = Util.FormatData(rs.dValue, 8);
            btn_ralpha.Text = rs.dAlpha.ToString("F2");
            btn_rbeta.Text  = rs.dBeta.ToString("F2");
            btn_temp.Text   = RunWnd.syscfg.dTemp.ToString("F3");
            btn_serial.Text = rs.sSerial;

            btn_rs100k.bOn = (rs.iRRange == ActionMgr.RNG_100K);
            btn_rs10k.bOn  = (rs.iRRange == ActionMgr.RNG_10K);
            btn_rs1k.bOn   = (rs.iRRange == ActionMgr.RNG_1K);
            btn_rs100.bOn  = (rs.iRRange == ActionMgr.RNG_100);
            btn_rs10.bOn   = (rs.iRRange == ActionMgr.RNG_10);
            btn_rs1.bOn    = (rs.iRRange == ActionMgr.RNG_1);
            btn_rsp1.bOn   = (rs.iRRange == ActionMgr.RNG_P1);
            btn_rsp01.bOn  = (rs.iRRange == ActionMgr.RNG_P01);
            btn_rsp001.bOn = (rs.iRRange == ActionMgr.RNG_P001);
        }
示例#7
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);
        }
示例#8
0
        public void pc_cmd(string cmd)
        {
            DeviceMgr.SysLog(cmd);
            if (cmd == "ECHO")
            {
                DeviceMgr.Resend();
                return;
            }
            if (cmd == "S")
            {
                if (task.bRunning)
                {
                    statusBar1_StartStopClick(null, null); //click stop
                }
                return;
            }

            if (cmd == "H")
            {
                if ((!task.bRunning) && (!DeviceMgr.IsInAction()))
                {
                    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 if (m.Groups[1].Value == "3")
                {
                    syscfg.sFilterType = "filtertype4";
                }
                else
                {
                    syscfg.sFilterType = "filtertype1";
                }
                return;
            }
            m = reg_ix.Match(cmd);
            if (m.Success)
            {
                #region current convert
                double myIx = double.Parse(m.Groups[1].Value) / 1000;
                if (myIx >= 5.5)
                {
                    Program.lst_rxinfo[0].iIx   = 5; //5A x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 2.2)
                {
                    Program.lst_rxinfo[0].iIx   = 5; //5A
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                if (myIx >= 1.1)
                {
                    Program.lst_rxinfo[0].iIx   = 4; //1A x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 0.66)
                {
                    Program.lst_rxinfo[0].iIx   = 4; //1A x 2
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                if (myIx >= 0.33)
                {
                    Program.lst_rxinfo[0].iIx   = 3; //0.3A x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 0.22)
                {
                    Program.lst_rxinfo[0].iIx   = 3; //0.3A
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                if (myIx >= 0.11)
                {
                    Program.lst_rxinfo[0].iIx   = 2; //0.1A x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 0.022)
                {
                    Program.lst_rxinfo[0].iIx   = 2; //0.1A
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                if (myIx >= 0.011)
                {
                    Program.lst_rxinfo[0].iIx   = 1; //10mA x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 0.0022)
                {
                    Program.lst_rxinfo[0].iIx   = 1; //10mA
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }

                if (myIx >= 0.0011)
                {
                    Program.lst_rxinfo[0].iIx   = 0; //1mA x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                if (myIx >= 0.00022)
                {
                    Program.lst_rxinfo[0].iIx   = 0; //1mA
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                if (myIx >= 0.00011)
                {
                    Program.lst_rxinfo[0].iIx   = -1; //0.1mA x 2
                    Program.lst_rxinfo[0].bSqrt = true;
                    return;
                }
                {
                    Program.lst_rxinfo[0].iIx   = -1; //0.1mA
                    Program.lst_rxinfo[0].bSqrt = false;
                    return;
                }
                #endregion
            }
            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_switch.Match(cmd);
            if (m.Success)
            {
                syscfg.iKTT = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_measure.Match(cmd);
            if (m.Success)
            {
                syscfg.iMeasTimes = Convert.ToInt32(m.Groups[1].Value);
                RsInfo rs = Program.lst_rsinfo[Program.mainwnd.selectedRs];
                RxInfo rx = Program.lst_rxinfo[Program.mainwnd.selectedRx];
                if (!task.bRunning)
                {
                    statusBar1_StartStopClick(null, null); //click start
                }
                return;
            }
            m = reg_sampletimes.Match(cmd);
            if (m.Success)
            {
                syscfg.iSampleTimes = Convert.ToInt32(m.Groups[1].Value);
                return;
            }
            m = reg_alpha.Match(cmd);
            if (m.Success)
            {
                Program.lst_rsinfo[0].iRRange = ActionMgr.RNG_INVALID;
                Program.lst_rsinfo[0].dAlpha  = Convert.ToDouble(m.Groups[1].Value);
                return;
            }
            m = reg_beta.Match(cmd);
            if (m.Success)
            {
                Program.lst_rsinfo[0].iRRange = ActionMgr.RNG_INVALID;
                Program.lst_rsinfo[0].dBeta   = Convert.ToDouble(m.Groups[1].Value);

                return;
            }
            m = reg_temp.Match(cmd);
            if (m.Success)
            {
                syscfg.dTemp = Convert.ToDouble(m.Groups[1].Value);
                return;
            }
            m = reg_rsa.Match(cmd);
            if (m.Success)
            {
                Program.lst_rsinfo[0].iRRange  = ActionMgr.RNG_INVALID;
                Program.lst_rsinfo[0].dValue   = Convert.ToDouble(m.Groups[1].Value);
                Program.lst_rxinfo[0].cStdChan = 'A';
                return;
            }
            m = reg_rsid.Match(cmd);
            if (m.Success)
            {
                Program.lst_rsinfo[0].iRRange = ActionMgr.RNG_INVALID;
                Program.lst_rsinfo[0].sSerial = m.Groups[1].Value;
                return;
            }
            m = reg_rxid.Match(cmd);
            if (m.Success)
            {
                Program.lst_rxinfo[0].sSerial = m.Groups[1].Value;
                return;
            }

            m = reg_rsb.Match(cmd);
            if (m.Success)
            {
                Program.lst_rxinfo[0].dRxInput = Convert.ToDouble(m.Groups[1].Value);
                ActionMgr.SetIxRange(0, Program.lst_rxinfo[0].dRxInput, false);
                Program.lst_rxinfo[0].cStdChan = 'B';
                return;
            }
        }