Exemple #1
0
        /// <summary>
        /// delegate保存位置
        /// </summary>
        public static CtrlUnit Connect(string currentAddress, CtrlUnit.ValidateSupportDelegate supportDelegate, bool interactive)
        {
            CtrlUnit tempUnit = null;

            try
            {
                //CtrlUnit tempUnit = null;
                string str = (currentAddress != null ? currentAddress : "GPIB0::18::INSTR");
                if (CtrlUnit.DetermineSupport(str))
                {
                    tempUnit = CtrlUnit.CreateDetectedDCPowerSupply(str);
                }
                tempUnit.Connected = true;
                return(tempUnit);
            }
            catch (Exception exception)
            {
                return(null);
                //throw new Exception(exception.ToString());
            }
            //if (tempUnit != null)
            //{
            //tempUnit.Connected = true;
            //}
        }
Exemple #2
0
        /// <summary>
        /// 创建对应的频率测量对象。
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public static CtrlUnit CreateDetectedDCPowerSupply(string address)
        {
            CtrlUnit tempUnit = null;

            try
            {
                //Racksystem,RAC1110,RACXXXXXXXXXX,1.0
                string ModelNo = ScpiInstrument.DetermineModel(address);
                if (ModelNo.IndexOf("RAC1110") >= 0)
                {
                    tempUnit = new CtrlUnitTR29(address);
                }
                else if (ModelNo.IndexOf("RAC-4001B") >= 0)
                {
                    tempUnit = new CtrlUnitTR29(address);
                }

                else
                {
                    throw new Exception(string.Concat(ModelNo, " 不是一个可以支持的波控"));
                }
            }
            catch (Exception exception)
            {
                throw new Exception(string.Concat("连接波控模块错误: ", exception.Message));
            }
            return(tempUnit);
        }
Exemple #3
0
        /// <summary>
        /// 判断是否可以支持对应型号的频率测量模块
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        private static bool DetermineSupport(string address)
        {
            CtrlUnit tempUnit = null;

            try
            {
                tempUnit = CtrlUnit.CreateDetectedDCPowerSupply(address);
            }
            catch
            {
                throw;
            }

            return(tempUnit != null);
        }