class VST(object): def __init__(self): self.Freq = 19e9 def jav_Open(self, SMW_IP, FSW_IP, OFile=''): self.SMW = VSG().jav_Open(SMW_IP, OFile) #Create SMW Object self.FSW = VSA().jav_Open(FSW_IP, OFile) #Create FSW Object return self def jav_Close(self): self.SMW.jav_Close() self.FSW.jav_Close() def jav_ClrErr(self): self.SMW.jav_ClrErr() self.FSW.jav_ClrErr() def Set_Freq(self, freq): self.SMW.Set_Freq(freq) self.FSW.Set_Freq(freq)
class VST(object): """ Rohde & Schwarz Vector Signal Transceiver Object """ def __init__(self): self.Freq = 19e9 def jav_Open(self,SMW_IP,FSW_IP,OFile=''): self.SMW = VSG().jav_Open(SMW_IP,OFile) #Create SMW Object self.FSW = VSA().jav_Open(FSW_IP,OFile) #Create FSW Object return self def jav_Close(self): self.SMW.jav_Close() self.FSW.jav_Close() def jav_ClrErr(self): self.SMW.jav_ClrErr() self.FSW.jav_ClrErr() def Set_Freq(self,freq): self.SMW.Set_Freq(freq) self.FSW.Set_Freq(freq)
if ChPwr < -24: #FSVA:-17 FSW:-22 VSA.Set_Preamp('ON') else: VSA.Set_Preamp('OFF') def K18(): VSA.Set_Channel('AMPL') VSA.Set_Autolevel() # Auto-Tune ########################################################## ### Code Start ########################################################## # VSA.jav_Reset() VSA.Set_Freq(Freq) VSA.Init_ACLR() #VSA ACLR Channel VSA.Set_ACLR_CHBW(ChBW) VSA.Set_ACLR_AdjBW(ChBW) VSA.Set_ACLR_AdjSpace(ChSpace) VSA.Set_ACLR_NumAdj(2) VSA.Set_ResBW(RBW) #VSA.Set_DisplayUpdate("OFF") VSA.Set_SweepTime(MeasTim) VSA.Set_Trace_Avg('LIN') VSA.Set_Trace_AvgCount(Avg) VSA.Set_Trace_Detector('RMS') VSA.Set_SweepOpt(SweMode) VSA.Set_SweepType(SweType) VSA.Set_YIG('OFF')
OFileXML = FileIO().makeFile(__file__+'xml') SMW = VSG().jav_Open(SMW_IP,OFileCSV) #Create SMW Object FSW = VSA().jav_Open(FSW_IP,OFileCSV) #Create FSW Object ########################################################## ### Instrument Settings ########################################################## SMW.Set_RFPwr(SWM_Out) #Output Power SMW.Set_RFState('ON') #Turn RF Output on FSW.Set_SweepCont(0) #FSW.Set_SweepTime(200e-3) FSW.Set_Span(fSpan) if Mixer: #Mixer FSW.write('SENS:MIX:STAT ON') FSW.write('SENS:MIX:HARM:BAND V') for freq in range(FreqStart,FreqStop,FreqStep): SMW.Set_Freq(freq) time.sleep(0.01) FSW.Set_Freq(freq) FSW.Set_InitImm() FSW.Set_Mkr_Peak() Mkr = FSW.Get_Mkr_XY() OFileCSV.write(f'{freq},{Mkr[0]},{Mkr[1]}') OFileXML.write(f' <Point x="{Mkr[0]}" y="{Mkr[1]}"/>') SMW.jav_ClrErr() #Clear Errors FSW.jav_ClrErr() #Clear Errors
freq = 1.950 #GHz ############################################################################### ### Code Overhead: Import and create objects ############################################################################### from rssd.FSW_Common import VSA from rssd.FileIO import FileIO import timeit OFile = FileIO().makeFile(__file__) FSW = VSA().jav_Open(instru_ip,OFile) #Create Object ############################################################################### ### Code Start ############################################################################### OFile.write('Freq,ChPwr-dBm,2nd-dbc,3rd-dbc') FSW.Init_Harm() FSW.Set_Freq(freq * 1e9) FSW.Set_Harm_num(3) FSW.Set_Trace_Detector('RMS') FSW.Set_Harm_adjust() # FSW.Set_RefLevel(-100) # FSW.Set_ResBW(100) data = FSW.Get_Harm() OutStr = f'{freq},{data[0]},{data[1]},{data[2]}' OFile.write (OutStr) ############################################################################### ### Cleanup Automation ############################################################################### FSW.jav_Close()