Esempio n. 1
0
 private void btnRun_Click(object sender, EventArgs e)
 {
     TestData = new CTestData();
     if (!InterfaceChecked())
     {
         return;
     }
     try
     {
         ShowMsg("正在绘制眼图,请稍后...", true);
         TestData.Test_start_time = DateTime.Now.ToLongTimeString();
         IProgress <int> progHandle = new Progress <int>(prog =>
         {
             if (prog == 100)
             {
                 EnableControls();
                 this.btnNext.Enabled = true;
             }
         });
         var task = new Task(() =>
         {
             kesight_N1902D.Run();
             GetTestData();
             progHandle.Report(100);
         });
         task.Start();
         DisableContols();
     }
     catch (Exception ex)
     {
         ShowMsg(ex.Message, false);
     }
 }
Esempio n. 2
0
        public void SaveTestData(CTestDataCommon testData)
        {
            try
            {
                conn.Open();
            }
            catch (Exception ex)
            {
                throw new Exception($"Unable to open SQL Server connection, {ex.Message}");
            }
            try
            {
                cmd.Connection  = conn;
                cmd.Transaction = conn.BeginTransaction();
                var strSql = $"insert into dbo.tx_rftest_pam4_common(spec_id,sn,operator,test_station,test_date,vcc1,vcc2,ppg_data_rate,ppg_channel,ppg_pattern,pre_cursor, main_cusor, post_cusor, inner_1, inner_2, tx_tec, tx_vb, tx_vea, tx_vg, ld_bias,pf) values({testData.Spec_id}, '{testData.SN}','{testData.Operator}','{SystemInformation.ComputerName}','{testData.Test_Date}','{testData.Vcc1}','{testData.Vcc2}','{testData.Ppg_data_rate}','{testData.Ppg_channel}','{testData.Ppg_pattern}','{testData.Pre_cursor}','{testData.Main_cursor}','{testData.Post_cursor}','{testData.Inner_1}','{testData.Inner_2}' ,'{testData.TxTEC}','{testData.TxVB}','{testData.TxVEA}','{testData.TxVG}','{testData.LDBias}','{testData.Pf}')";
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = strSql;
                cmd.ExecuteNonQuery();

                strSql          = $"select max(id) as id from dbo.tx_rftest_pam4_common";
                cmd.CommandText = strSql;

                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    testData.ID = Convert.ToInt32(reader["id"]);
                }
                reader.Close();
                for (int i = 0; i < testData.lstTestData.Count; i++)
                {
                    CTestData data = testData.lstTestData[i];
                    data.Common_id = testData.ID;
                    strSql         = $"insert into dbo.tx_rftest_pam4_ret(common_id, temp_case, test_start_time, test_end_time,io,ea_voltage,temp_coc,cwl,smsr,tdecq, outer_er, outer_oma,aop,linearity,pf) values({data.Common_id}, '{data.Temp_case}','{data.Test_start_time}','{data.Test_end_time}','{data.Io}','{data.EA_Voltage}','{data.Temp_Coc}','{data.CWL}','{data.SMSR}','{data.TDECQ}','{data.OuterER}','{data.OuterOMA}','{data.Lanch_power}','{data.Linearity}','{testData.Pf}')";

                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = strSql;
                    cmd.ExecuteNonQuery();
                }
                cmd.Transaction.Commit();
            }
            catch (Exception ex)
            {
                cmd.Transaction.Rollback();
                throw new Exception($"Fail to save test data, {ex.Message}");
            }
            finally
            {
                conn.Close();
            }
        }
Esempio n. 3
0
        private void btnAutoScale_Click(object sender, EventArgs e)
        {
            TestData = new CTestData();
            if (!InterfaceChecked())
            {
                return;
            }
            ShowMsg("正在绘制眼图,请稍后...", true);
            TestData.Test_start_time = DateTime.Now.ToShortDateString();
            try
            {
                IProgress <int> progHandle = new Progress <int>(prog =>
                {
                    if (prog == 100)
                    {
                        EnableControls();
                        this.btnNext.Enabled = true;
                    }
                });

                var task = new Task(() =>
                {
                    //Inst_PAM4_Bert.setPPGPRBSpattern(BertChannel, "13Q");// for OER,AOP,OOMA,Linearity
                    //kesight_N1902D.AutoScale();

                    // Inst_PAM4_Bert.setPPGPRBSpattern(BertChannel, "15Q");// for OER,AOP,OOMA,Linearity
                    kesight_N1902D.AutoScale();
                    kesight_N1902D.QueryMeasurementResults();
                    kesight_N1902D.GetTEDCQ();
                    GetTestData();

                    progHandle.Report(100);
                });
                task.Start();
                DisableContols();
            }
            catch (Exception ex)
            {
                EnableControls();
                ShowMsg(ex.Message, false);
            }
        }