public static VectorSignalGenerator ConnectVecorSG(string currentAddress, SignalGenerator.ValidateSupportDelegate supportDelegate, bool interactive) { VectorSignalGenerator VectorSigGen = null; string str = (currentAddress != null ? currentAddress : "GPIB0::19::INSTR"); SignalGenerator.m_validateSupportDelegate = supportDelegate; if (interactive) { throw new Exception("不支持交互模式"); } try { string str1 = VectorSignalGenerator.DetermineSupport(str); if (str1 != null) { throw new Exception(str1); } VectorSigGen = VectorSignalGenerator.CreateDetectedVectorSignalGenerator(str); } catch { throw; } VectorSignalGenerator.m_validateSupportDelegate = null; if (VectorSigGen != null) { VectorSigGen.Connected = true; VectorSigGen.m_firmwareVersion = VectorSigGen.GetFirmwareVersion(VectorSigGen); } return(VectorSigGen); }
public static VectorSignalGenerator CreateDetectedVectorSignalGenerator(string address) { VectorSignalGenerator PsgEsg; try { string str = ScpiInstrument.DetermineModel(address); if (string.IsNullOrEmpty(str)) { } if (VectorSignalGenerator.IsEVSGC(str) || VectorSignalGenerator.IsPVSG(str) || VectorSignalGenerator.IsMxg(str)) { PsgEsg = new AgilentE8267D(address); } else { PsgEsg = null; } } catch (Exception exception) { throw new Exception(string.Concat("连接到矢量信号源出错: ", exception.Message)); } return(PsgEsg); }
private string GetFirmwareVersion(VectorSignalGenerator sg) { string str = sg.Query("*IDN?"); char[] chrArray = new char[] { ',' }; string str1 = str.Split(chrArray)[3]; if (str1.Length == 0) { str1 = null; } return(str1); }
private static string DetermineSupport(string address) { if (SignalGenerator.m_validateSupportDelegate == null) { return(null); } VectorSignalGenerator VectorSignalGenerator = null; try { VectorSignalGenerator = VectorSignalGenerator.CreateDetectedVectorSignalGenerator(address); } catch { throw; } if (VectorSignalGenerator == null) { return("无法识别信号源"); } return(SignalGenerator.m_validateSupportDelegate(VectorSignalGenerator)); }