Esempio n. 1
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);
        }
Esempio n. 2
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));
        }