/// <summary>
        /// 更新仪表控制对象
        /// </summary>
        /// <param name="tmpDCPowers"></param>
        /// <param name="tmpInstrumentInfo"></param>
        private void UpdateInstrumentCtrlObjIfNeeded(List <DCPowerBase> tmpDCPowers, InstrumentInfo tmpInstrumentInfo)
        {
            switch (tmpInstrumentInfo.InstrumentTypeID)
            {
            case InstrumentType.Pna:
                try
                {
                    bool bNeedUpdateCtrlObj = IfNeedUpdateCtrlObj(tmpInstrumentInfo.IpAddress, this.m_PNAScpiObj);
                    if (bNeedUpdateCtrlObj)
                    {
                        ///创建PNA对象
                        string tmpPnaIpAddr;
                        int    port = 5025;
                        VisaServices.GetLanConnectionInfo(tmpInstrumentInfo.IpAddress, out tmpPnaIpAddr, out port);
                        Type t = Type.GetTypeFromProgID("AgilentPNA835x.Application", tmpPnaIpAddr, true);
                        m_PNAApp        = (AgilentPNA835x.Application)Activator.CreateInstance(t);
                        m_PNASCPIParser = (AgilentPNA835x.ScpiStringParser)m_PNAApp.ScpiStringParser;

                        this.m_PNAScpiObj = NetworkAnalyzer.Connect(tmpInstrumentInfo.IpAddress, null
                                                                    , false);
                    }
                }
                catch (Exception ex)
                {
                    tmpInstrumentInfo.ConnectOK = devState.error;
                    tmpInstrumentInfo.ErrorMsgs = "型号不匹配";
                }
                break;

            case InstrumentType.InputMatrix:
                try
                {
                    bool bNeedUpdateCtrlObj = IfNeedUpdateCtrlObj(tmpInstrumentInfo.IpAddress, this.m_InputMatrix);
                    if (bNeedUpdateCtrlObj)
                    {
                        this.m_InputMatrix = Matrix.Connect(tmpInstrumentInfo.IpAddress, true, false);
                        //this.m_InputMatrixForHighPower = Matrix.Connect(tmpInstrumentInfo.IpAddress, true, true);
                        //this.m_InputMatrix = Matrix.Connect(tmpInstrumentInfo.IpAddress, true);
                    }
                }
                catch (Exception ex)
                {
                    tmpInstrumentInfo.ConnectOK = devState.error;
                    tmpInstrumentInfo.ErrorMsgs = "型号不匹配";
                }
                try
                {
                    bool bNeedUpdateCtrlObj = IfNeedUpdateCtrlObj(tmpInstrumentInfo.IpAddress, this.m_OutputMatrix);
                    if (bNeedUpdateCtrlObj)
                    {
                        this.m_OutputMatrix = Matrix.Connect(tmpInstrumentInfo.IpAddress, false, false);
                    }
                }
                catch (Exception ex)
                {
                    tmpInstrumentInfo.ConnectOK = devState.error;
                    tmpInstrumentInfo.ErrorMsgs = "型号不匹配";
                }
                break;
            }
        }
        /// <summary>
        /// 更新仪表控制对象
        /// </summary>
        /// <param name="tmpDCPowers"></param>
        /// <param name="tmpInstrumentInfo"></param>
        private void CreateInstrumentCtrlObj(List <DCPowerBase> tmpDCPowers, InstrumentInfo tmpInstrumentInfo)
        {
            GlobalStatusReport.Report(string.Format("UpdateInstrumentInfo 仪表名称:{0} 地址:{1},开始连接", tmpInstrumentInfo.InstrumentName, tmpInstrumentInfo.IpAddress));
            switch (tmpInstrumentInfo.InstrumentTypeID)
            {
            case InstrumentType.Pna:
                try
                {
                    //置为巡检状态
                    tmpInstrumentInfo.DevInfoState = devState.ischeck;

                    this.m_PNAScpiObj = NetworkAnalyzer.Connect(tmpInstrumentInfo.IpAddress, null
                                                                , false);

                    if (this.m_PNAScpiObj != null)
                    {
                        //判断对应的连接License选件是否有,如果有,则继续,没有,报告错误;
                        LicenseCheckingResult tmpResult = this.Check_Pna_Connectivity_Licenses(this.m_PNAScpiObj.Model, this.m_PNAScpiObj.SerialNumber);

                        ///
                        tmpResult = LicenseCheckingResult.PNAPassed;

                        ///
                        if (tmpResult != LicenseCheckingResult.PNAPassed)
                        {
                            ///设置异常信息
                            this.SetInstrumentErrorInfo(
                                tmpInstrumentInfo,
                                string.Format("没有找到矢网{0}-{1}连接选件RAC1200-001",
                                              new object[] { this.m_PNAScpiObj.Model, this.m_PNAScpiObj.SerialNumber }));

                            this.m_PNAScpiObj    = null;
                            this.m_PNAApp        = null;
                            this.m_PNASCPIParser = null;

                            throw new Exception(string.Format("没有找到矢网{0}-{1}的连接选件RAC1200-001",
                                                              new object[] { this.m_PNAScpiObj.Model, this.m_PNAScpiObj.SerialNumber }));
                        }
                        else
                        {
                            ///创建PNA对象
                            string tmpPnaIpAddr;
                            int    port = 5025;
                            VisaServices.GetLanConnectionInfo(tmpInstrumentInfo.IpAddress, out tmpPnaIpAddr, out port);
                            Type t = Type.GetTypeFromProgID("AgilentPNA835x.Application", tmpPnaIpAddr, true);
                            m_PNAApp        = (AgilentPNA835x.Application)Activator.CreateInstance(t);
                            m_PNASCPIParser = (AgilentPNA835x.ScpiStringParser)m_PNAApp.ScpiStringParser;


                            UpdateInstrumentIdentity(tmpInstrumentInfo, this.m_PNAScpiObj);
                        }

                        //设置PNASource mathmatical on/off
                        if (PowerMode.NormalPower == ProjectName.CurrentPowerMode)
                        {
                            this.m_PNAScpiObj.SendSCPI("system:preferences:item:offset:src ON");
                        }
                        else if (PowerMode.HighPower == ProjectName.CurrentPowerMode)
                        {
                            this.m_PNAScpiObj.SendSCPI("system:preferences:item:offset:src OFF");
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.SetInstrumentErrorInfo(tmpInstrumentInfo, /*"连接错误,异常信息:"+*/ ex.Message);
                    //置为错误状态
                    tmpInstrumentInfo.DevInfoState = devState.error;
                }
                break;

            case InstrumentType.InputMatrix:
                try
                {
                    //置为巡检状态
                    tmpInstrumentInfo.DevInfoState = devState.ischeck;

                    this.m_InputMatrix = Matrix.Connect(tmpInstrumentInfo.IpAddress, true, false);

                    UpdateInstrumentIdentity(tmpInstrumentInfo, m_InputMatrix);
                }
                catch (Exception ex)
                {
                    this.SetInstrumentErrorInfo(tmpInstrumentInfo, /*"连接错误,异常信息:"+*/ ex.Message);
                    //置为错误状态
                    tmpInstrumentInfo.DevInfoState = devState.error;
                }
                break;

            case InstrumentType.OutputMatrix:
                try
                {
                    //置为巡检状态
                    tmpInstrumentInfo.DevInfoState = devState.ischeck;
                    this.m_OutputMatrix            = Matrix.Connect(tmpInstrumentInfo.IpAddress, false, false);
                    //this.m_OutputMatrix = Matrix.Connect(tmpInstrumentInfo.IpAddress, false);
                    UpdateInstrumentIdentity(tmpInstrumentInfo, this.m_OutputMatrix);
                }
                catch (Exception ex)
                {
                    this.SetInstrumentErrorInfo(tmpInstrumentInfo, /*"连接错误,异常信息:"+*/ ex.Message);
                    //置为错误状态
                    tmpInstrumentInfo.DevInfoState = devState.error;
                }
                break;
            }
            GlobalStatusReport.Report(string.Format("UpdateInstrumentInfo 仪表名称:{0} 地址:{1},连接结束", tmpInstrumentInfo.InstrumentName, tmpInstrumentInfo.IpAddress));
        }