Exemple #1
0
        private TestStructParameters Get_testParam(Test_Paramter testParam)
        {
            TestStructParameters newtestParam = new TestStructParameters();

            newtestParam.m_AcquireTraceData      = false;
            newtestParam.m_AutoRBW               = false;
            newtestParam.m_AutoScale             = true;
            newtestParam.m_AutoSweepTime         = true;
            newtestParam.m_AutoVBW               = false;
            newtestParam.m_AverageFactor         = 1;
            newtestParam.m_CaptureScrSht         = false;
            newtestParam.m_ContinueMeasAfterTest = true;
            newtestParam.m_EditFreq              = true;
            newtestParam.m_EditPower             = false;
            newtestParam.m_EditSAFDOTable        = false;
            newtestParam.m_EditSAGOffset         = true;
            newtestParam.m_EditScale             = true;
            newtestParam.m_EditSGOffset          = true;
            newtestParam.m_IgnoreBWidth          = testParam.SGAndPxaParamter.IngroeFreq;
            newtestParam.m_InputPower            = testParam.SGAndPxaParamter.InPower;
            newtestParam.m_RBW        = testParam.SGAndPxaParamter.RBW;
            newtestParam.m_SAFDOTable = testParam.OutputFileoffst;
            newtestParam.m_Scale      = 10;

            newtestParam.m_StartFreq   = testParam.SGAndPxaParamter.AnaStartFreq;
            newtestParam.m_StopFreq    = testParam.SGAndPxaParamter.AnaStopFreq;
            newtestParam.m_SweepPoints = 401;
            newtestParam.m_SweepTime   = 0.1;
            //newtestParam.m_ChannelNumber = 1;
            newtestParam.m_UseExtAmplifier  = false;
            newtestParam.m_UseExtAttenuator = false;
            newtestParam.m_VBW = testParam.SGAndPxaParamter.VBW;

            return(newtestParam);
        }
Exemple #2
0
        /// <summary>
        /// 加载测试参数数据
        /// </summary>
        /// <param name="inXmlFileName">要加载的测试参数配置文件名,为空时从默认文件中加载</param>
        public Test_Paramter LoadParameterFromXMLFile(string inXmlFileName = null)
        {
            //缺省参数处理
            if ((inXmlFileName == null) || (inXmlFileName == ""))
            {
                inXmlFileName = AppDomain.CurrentDomain.BaseDirectory + "PWDCPowerInfo.config";
            }
            try
            {
                Test_Paramter tmpDUTs = (Test_Paramter)XmlHelper.LoadParameterFromXMLFile(typeof(Test_Paramter), inXmlFileName);
                if (tmpDUTs == null)
                {
                    Test_Paramter temp = new Test_Paramter();


                    return(temp);
                }

                return(tmpDUTs);
            }
            catch (Exception)
            {
                return(new Test_Paramter());
            }
        }
Exemple #3
0
 private NoiseFigureTest.NoiseFigureTestStructParameter Get_NoiseParam(Test_Paramter testParam)
 {
     NoiseFigureTest.NoiseFigureTestStructParameter Parameter = new NoiseFigureTest.NoiseFigureTestStructParameter();
     Parameter.m_AverageNum = 1;
     //Parameter.m_FreqList=
     Parameter.m_IsReadMaxNoiseFigure   = false;
     Parameter.m_NeedContinuousScanning = true;
     Parameter.m_RBW = testParam.SGAndPxaParamter.RBW;
     Parameter.m_RecallStateFileEnable = true;
     Parameter.m_RecallStateFileName   = NoiseFigureCal.noiseResFile;
     Parameter.m_StartFerq             = testParam.SGAndPxaParamter.StartFreq;
     Parameter.m_StopFerq    = testParam.SGAndPxaParamter.StopFreq;
     Parameter.m_SweepPoints = (int)((testParam.SGAndPxaParamter.StopFreq - testParam.SGAndPxaParamter.StartFreq) / testParam.SGAndPxaParamter.FreqSpac) + 1;
     Parameter.Yscale        = 1;
     return(Parameter);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="inSys"></param>
        /// <param name="para"></param>
        public static bool runExecute(SystemHardware inSys, Test_Paramter para)
        {
            bool res = false;
            //转化校准参数
            NoiseFigureCalStructParameter noiseFigureCalStructParameter = new NoiseFigureCalStructParameter();

            noiseFigureCalStructParameter.m_StartFerq   = para.NoiseAndPxaParamter.StartFreq;
            noiseFigureCalStructParameter.m_StopFerq    = para.NoiseAndPxaParamter.StopFreq;
            noiseFigureCalStructParameter.m_SweepPoints = (int)Math.Floor(1 + (para.NoiseAndPxaParamter.StopFreq - para.NoiseAndPxaParamter.StartFreq) / para.NoiseAndPxaParamter.FreqSpac);
            noiseFigureCalStructParameter.m_AverageNum  = 1;
            noiseFigureCalStructParameter.m_RBW         = 4000000;
            //noiseFigureCalStructParameter.m_StateSaveFileName = NoiseFigureCalKeyAndResultList.path+System.IO.Path.GetFileNameWithoutExtension(para.SpectrumStateFileName) + ".state";
            noiseFigureCalStructParameter.m_StateSaveFileName = noiseResFile;

            /* 执行校准*/
            ExecuteTest(inSys, noiseFigureCalStructParameter);

            return(res);
        }
        //public static string ActiveDownOUTPUTLossFile = @"C:\CalFiles\ActiveDownOUTPUTLossFile.txt";
        //public static string ActiveDownINPUTLossFile = @"C:\CalFiles\ActiveDownINPUTLossFile.txt";
        //public static string PassiveUpOUTPUTLossFile = @"C:\CalFiles\PassiveUpOUTPUTLossFile.txt";
        //public static string PassiveDownOUTPUTLossFile = @"C:\CalFiles\PassiveDownOUTPUTLossFile.txt";
        // public static string INPUTLossFile = @"C:\CalFiles\INPUTLossFile.txt";
        public static bool runExecute(SystemHardware inSys, Test_Paramter para, string fileName, bool isInput)
        {
            CalResult Result = new CalResult();
            bool      res    = false;
            //转化校准参数
            CalStructParameter Parameter     = new CalStructParameter();
            double             m_SGStartFerq = para.SGAndPxaParamter.StartFreq;
            double             m_SGStopFerq  = para.SGAndPxaParamter.StopFreq;
            double             m_SGFreqSpac  = para.SGAndPxaParamter.FreqSpac;
            double             m_IFFreq      = para.DUTOutFreq;
            //if (fileName.IndexOf("Active") >= 0)
            //{
            //     m_SGStartFerq = para.DUTAndPxaParamter.StartFreq;
            //     m_SGStopFerq = para.DUTAndPxaParamter.StopFreq;
            //     m_SGFreqSpac = para.DUTAndPxaParamter.FreqSpac;
            //}

            int m_SweepPoints = (int)Math.Floor(1 + (m_SGStopFerq - m_SGStartFerq) / m_SGFreqSpac);//扫描点数

            List <double> SGFreqList = new List <double>();

            SGFreqList.Add(m_IFFreq);
            for (int i = 0; i < m_SweepPoints; i++)
            {
                double freq = m_SGStartFerq + i * para.SGAndPxaParamter.FreqSpac;
                if (freq <= para.SGAndPxaParamter.StopFreq)
                {
                    SGFreqList.Add(freq);
                }
                else
                {
                    SGFreqList.Add(para.SGAndPxaParamter.StopFreq);
                }
            }
            Parameter.M_SGFreqList = SGFreqList;
            Parameter.M_SAFreqList = SGFreqList;
            //double m_SAStartFerq = para.SGAndPxaParamter.StartFreq;//todo 获取频谱仪前端校准频率
            //double m_SAStopFerq = para.SGAndPxaParamter.StopFreq;//todo 获取频谱仪前端校准频率
            //int m_TestPoints = (int)Math.Floor(1 + (m_SAStopFerq - m_SAStartFerq) / para.SGAndPxaParamter.FreqSpac);
            //List<double> testFreqList = new List<double>();
            //testFreqList.Add(m_IFFreq);
            //for (int i = 0; i < m_SweepPoints; i++)
            //{
            //    double freq = m_SGStartFerq + i * para.SGAndPxaParamter.FreqSpac;
            //    if (freq <= para.SGAndPxaParamter.StopFreq)
            //    {
            //        testFreqList.Add(freq);
            //    }
            //    else
            //    {
            //        testFreqList.Add(para.SGAndPxaParamter.StopFreq);
            //    }
            //}
            //Parameter.M_SAFreqList = testFreqList;

            Parameter.m_RBW      = para.SGAndPxaParamter.RBW;
            Parameter.m_RBW      = para.SGAndPxaParamter.VBW;
            Parameter.m_FreqSpan = para.SGAndPxaParamter.FreqSpac;
            //noiseFigureCalStructParameter.m_StateSaveFileName = NoiseFigureCalKeyAndResultList.path+System.IO.Path.GetFileNameWithoutExtension(para.SpectrumStateFileName) + ".state";
            Parameter.m_SaveFileName = fileName;
            Parameter.isInput        = isInput;
            //Parameter.m_OutputSaveFileName = OUTPUTLossFile;
            /* 执行校准*/
            ExecuteTest(inSys, Parameter, out Result);
            //DUTOutFreq. m_InPutoffst.
            SaveDataToFile(Result.RouteLoss, fileName);
            if (fileName == InputAndOutputCal.ActiveUpINPUTLossFile)
            {
                Test_Paramter.CurPWDCPowerInfo.InputFileoffst = Result.RouteLoss;
            }
            else
            {
                Test_Paramter.CurPWDCPowerInfo.OutputFileoffst = Result.RouteLoss;
            }

            return(res);
        }
Exemple #6
0
        public void AutoRun(SystemHardware inSys, Test_Paramter testParam, out TestExecutionResult outTestExecuteResultFlag)
        {
            try
            {
                outTestExecuteResultFlag = TestExecutionResult.Init;
                if (CurCtrlDut == null)
                {
                    MessageBox.Show("被测件没有连接!");
                    outTestExecuteResultFlag = TestExecutionResult.Error;
                    return;
                }
                else
                {
                    //需要获取测试项内容
                    //初始化结果
                    this.m_CurResult           = new Test_Result(testParam);
                    m_CurResult.TestParam      = testParam;
                    m_CurResult.TestResultList = new List <TestResultByFreq>();

                    //inSys.SpectrumAnalyzer.Preset();
                    int freqN = (int)Math.Floor(1 + (testParam.SGAndPxaParamter.StopFreq - testParam.SGAndPxaParamter.StartFreq) / testParam.SGAndPxaParamter.FreqSpac);
                    TestStructParameters inParam = new TestStructParameters();
                    inParam = Get_testParam(testParam);
                    List <TestResultByFreq> resultList = new List <TestResultByFreq>();
                    List <double>           freqList   = new List <double>();

                    CurCtrlDut.SETChannel(testParam.ChannelNumber);
                    //todo

                    //
                    for (int i = 0; i < freqN; i++)
                    {
                        freqList.Add(testParam.SGAndPxaParamter.StartFreq + i * testParam.SGAndPxaParamter.FreqSpac);
                    }

                    if (testParam.isTxWork)//是否是发射
                    {
                        CurCtrlDut.CtrlTWork();
                        Thread.Sleep((int)(testParam.sleepTime * 1000));
                    }
                    else
                    {
                        CurCtrlDut.CtrlRWork();
                        Thread.Sleep((int)(testParam.sleepTime * 1000));
                    }

                    if (testParam.IsPowerTest || testParam.IsClutterTest)
                    {
                        for (int i = 0; i < freqN; i++)
                        {
                            if (stopRun)
                            {
                                if (MessageBoxResult.Yes == MessageBox.Show("测试强行停止,是否停止?", "提 示", MessageBoxButton.YesNo))
                                {
                                    outTestExecuteResultFlag = TestExecutionResult.Error;
                                    return;
                                }
                            }
                            if (i == 0)
                            {
                                inParam.m_FirstTest = true;
                                inParam.m_LastTest  = false;
                            }
                            else
                            {
                                inParam.m_FirstTest = false;
                            }
                            if (i == freqN - 1)
                            {
                                inParam.m_LastTest = true;
                            }
                            if (testParam.isTxWork)//是否是发射
                            {
                                inParam.m_SGFreq = testParam.DUTOutFreq;
                                inParam.m_SAFreq = freqList[i];

                                Thread.Sleep((int)(testParam.sleepTime * 1000));
                            }
                            else
                            {
                                inParam.m_SAFreq = testParam.DUTOutFreq;
                                inParam.m_SGFreq = freqList[i];
                            }
                            //设置本振频率
                            CurCtrlDut.CtrlFreq(freqList[i]);
                            Thread.Sleep((int)(testParam.sleepTime * 1000));

                            TestStructResults rest      = new TestStructResults();
                            TestResultByFreq  oneResult = new TestResultByFreq();
                            inParam.m_SGOffsetValue = this.GetOFFset(inParam.m_SGFreq, testParam.InputFileoffst);
                            double outputloss = this.GetOFFset(inParam.m_SAFreq, testParam.OutputFileoffst);
                            double inputloss  = this.GetOFFset(inParam.m_SAFreq, testParam.InputFileoffst);
                            inParam.m_SAGlobalOffset = outputloss - inputloss;


                            this.ExecuteTestSpurious(inSys, inParam, out rest);
                            oneResult.TestFreq = freqList[i];

                            oneResult.MaxClutter       = rest.m_NOSourcePower;
                            oneResult.OutPower         = rest.m_CarrierPower;
                            oneResult.ClutterRejection = rest.m_SpuriousSuppression;
                            oneResult.Gain             = rest.m_CarrierPower - inParam.m_InputPower;
                            resultList.Add(oneResult);
                        }
                    }

                    CurResult.TestResultList = resultList;
                    outTestExecuteResultFlag = TestExecutionResult.Complete;
                }
                outTestExecuteResultFlag = TestExecutionResult.Complete;
            }
            catch (Exception ex)
            {
                outTestExecuteResultFlag = TestExecutionResult.Error;
                throw new Exception(ex.ToString());
            }
            finally
            {
                GC.Collect();
            }
        }
Exemple #7
0
 public Test_Result(Test_Paramter parm)
 {
     this.TestParam = parm;
     this.TestTime  = DateTime.Now;
 }