コード例 #1
0
        /// <summary>
        /// 创建对应的噪声分析仪控制对象。
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public static NoiseFigureAnalyzer CreateDetectedNoiseFigureSupply(string address)
        {
            NoiseFigureAnalyzer NoiseFigureAnalyzerSupply = null;

            try
            {
                string ModelNo = ScpiInstrument.DetermineModel(address);
                if (!NoiseFigureAnalyzer.IsSupportedModel(ModelNo))
                {
                    throw new Exception(string.Concat(ModelNo, " 不是一个可以支持的噪声系统分析仪"));
                }


                if (ModelNo.IndexOf("N8975A") >= 0)
                {
                    NoiseFigureAnalyzerSupply = new AgilentN8975A(address);
                }
                else if (ModelNo.IndexOf("AV3985") >= 0)
                {
                    NoiseFigureAnalyzerSupply = new AV3985A(address);
                }
                else
                {
                    throw new Exception(string.Concat(ModelNo, " 不是一个可以支持的噪声系统分析仪"));
                }
            }
            catch (Exception exception)
            {
                throw new Exception(string.Concat("连接噪声分析仪错误: ", exception.Message));
            }
            return(NoiseFigureAnalyzerSupply);
        }
コード例 #2
0
        public static NoiseFigureAnalyzer Connect(string currentAddress, NoiseFigureAnalyzer.ValidateSupportDelegate supportDelegate, bool interactive)
        {
            NoiseFigureAnalyzer ANoiseFigureAnalyzer = null;
            string str = (currentAddress != null ? currentAddress : "GPIB0::18::INSTR");

            NoiseFigureAnalyzer.m_validateSupportDelegate = supportDelegate;
            if (interactive)
            {
                throw new Exception("不支持交互模式");
            }
            try
            {
                if (NoiseFigureAnalyzer.DetermineSupport(str) == null)
                {
                    ANoiseFigureAnalyzer = NoiseFigureAnalyzer.CreateDetectedNoiseFigureSupply(str);
                }
            }
            catch
            {
                //throw;
            }
            NoiseFigureAnalyzer.m_validateSupportDelegate = null;
            if (ANoiseFigureAnalyzer != null)
            {
                ANoiseFigureAnalyzer.Connected = true;
            }
            return(ANoiseFigureAnalyzer);
        }
コード例 #3
0
        /// <summary>
        /// 判断是否可以支持对应型号的直流电源
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        private static string DetermineSupport(string address)
        {
            if (NoiseFigureAnalyzer.m_validateSupportDelegate == null)
            {
                return(null);
            }
            NoiseFigureAnalyzer ANoiseFigureAnalyzer = null;

            try
            {
                ANoiseFigureAnalyzer = NoiseFigureAnalyzer.CreateDetectedNoiseFigureSupply(address);
            }
            catch
            {
                throw;
            }
            if (ANoiseFigureAnalyzer == null)
            {
                return("不是一个可以识别的噪声系数分析仪");
            }
            return(NoiseFigureAnalyzer.m_validateSupportDelegate(ANoiseFigureAnalyzer));
        }