class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.SMW = VSG() try: self.SMW.jav_Open(host, prnt=0) self.SMW.jav_Reset() self.SMW.jav_ClrErr() self.SMW.dLastErr = "" except: self.assertTrue(1) def tearDown(self): #Run after each test self.SMW.jav_Close() ############################################################################### ### <Test> ############################################################################### def test_SMW_Connect(self): self.SMW.jav_IDN(prnt=0) self.assertEqual(self.SMW.Make, "Rohde&Schwarz") def test_SMW_Freq(self): frq = 1e6 self.SMW.Set_Freq(frq) rdFrq = self.SMW.Get_Freq() self.assertEqual(self.SMW.jav_Error()[0], '0') self.assertEqual(frq, rdFrq) def test_SMW_Pwr(self): pwr = -10 self.SMW.Set_RFPwr(pwr) rdPwr = self.SMW.Get_PowerRMS() self.assertEqual(self.SMW.jav_Error()[0], '0') self.assertEqual(pwr, rdPwr)
class TestGeneral(unittest.TestCase): def setUp(self): #run before each test self.SMW = VSG() try: self.SMW.jav_Open(host) self.SMW.jav_Reset() self.SMW.jav_ClrErr() self.SMW.dLastErr = "" except: self.assertTrue(1) def test_SMW_Connect(self): self.assertEqual(self.SMW.jav_Error()[0],'0') def test_SMW_Common(self): self.SMW.Set_Freq(1e6) self.SMW.Set_Power(10) self.SMW.Get_Freq() self.SMW.Get_Level() self.assertEqual(self.SMW.jav_Error()[0],'0')
Fs = 115.2e6 #Sampling Rate MeasTim = 500e-6 ########################################################## ### Code Overhead ########################################################## from rssd.SMW_Common import VSG from rssd.FSW_Common import VSA from rssd.VSE.K96 import VSE import rssd.FileIO import time f = rssd.FileIO.FileIO() DataFile = f.Init(OutFile) SMW = VSG() #Create SMW Object SMW.jav_Open(SMW_IP, f.sFName) #Connect to SMW FSW = VSA() #Create FSW Object FSW.jav_Open(FSW_IP, f.sFName) #Connect to FSW VSE = VSE() #Create VSE Object VSE.jav_Open(VSE_IP, f.sFName) #Connect to VSE if 0: SMW.jav_logSCPI() FSW.jav_logSCPI() VSE.jav_logSCPI() ########################################################## ### Setup Instruments ########################################################## VSE.jav_Reset() #time.sleep(6) VSE.Init_K96() #Change Channel
def Set_WLAN_Standard(self, sStd): #WLAN-->Frame Blocks-->TxMode sStd.upper() if sStd == 'B': self.write(f':SOUR:BB:WLNN:FBL1:PMOD LEG') #Set Physical Mode self.write(f':SOUR:BB:WLNN:FBL1:TMOD CCK') elif sStd == 'G' or sStd == 'A': self.write(f':SOUR:BB:WLNN:FBL1:PMOD LEG') #Set Physical Mode self.write(f':SOUR:BB:WLNN:FBL1:TMOD L{self.WLAN_ChBW}') elif sStd == 'N': self.write(f':SOUR:BB:WLNN:FBL1:PMOD MIX') #Set Physical Mode self.write(f':SOUR:BB:WLNN:FBL1:TMOD HT{self.WLAN_ChBW}') elif sStd == 'AC': self.write(f':SOUR:BB:WLNN:FBL1:PMOD MIX') #Set Physical Mode self.write(f':SOUR:BB:WLNN:FBL1:TMOD V{self.WLAN_ChBW}') elif sStd == 'AX': self.write(f':SOUR:BB:WLNN:FBL1:PMOD MIX') #Set Physical Mode self.write(f':SOUR:BB:WLNN:FBL1:TMOD HE{self.WLAN_ChBW}') else: print(f'Set_WLAN_Standard: {sStd} not supported') ##################################################################### ### Run if Main ##################################################################### if __name__ == "__main__": ### this won't be run when imported WLAN = VSG() WLAN.jav_Open("192.168.1.114") print(WLAN.Get_WLAN_Standard()) WLAN.jav_Close()
FreqStep = int(1e9) fSpan = 100e6 SWM_Out = -20 Mixer = 1 ########################################################## ### Code Start ########################################################## from rssd.SMW_Common import VSG from rssd.FileIO import FileIO import time f = FileIO() DataFile = f.Init(OutFile) SMW = VSG() SMW.jav_Open(SMW_IP, f.sFName) ########################################################## ### Instrument Settings ########################################################## SMW.Set_RFPwr(SWM_Out) #Output Power SMW.Set_RFState('ON') #Turn RF Output on f.write(SMW.query('FREQ:MULT:EXT:TYPE?')) #SMZ # f.write(SMW.query('FREQ:MULT:EXT:SNUM?')) #Serial Num f.write(SMW.query('FREQ:MULT:EXT:LOAD:VERS?')) f.write(SMW.query('FREQ:MULT:EXT:FMAX?')) f.write(SMW.query('FREQ:MULT:EXT:FMIN?')) f.write(SMW.query('FREQ:MULT:EXT:REV?')) #Revision f.write("Power")
#self.write(':SOUR1:BB:NR5G:NODE:CELL0:OFFS POIN') self.write(':SOUR1:BB:NR5G:NODE:CELL0:NSSP 1') def Set_5GNR_TransPrecoding(self, sState): # SC-FDMA or DFT-S-OFDM # 5GNR--> User/BWP --> UL BWP Config --> PUSCH --> TP if sState == 'ON': # self.write(':SOUR1:BB:NR5G:SCH:CELL0:SUBF0:USER0:BWP0:ALL0:TPST ON') #4.30SP2? self.write( ':SOUR1:BB:NR5G:UBWP:USER0:CELL0:UL:BWP0:PUSC:TPST ON') #4.50 else: # self.write(':SOUR1:BB:NR5G:SCH:CELL0:SUBF0:USER0:BWP0:ALL0:TPST OFF') #4.30SP2? self.write( ':SOUR1:BB:NR5G:UBWP:USER0:CELL0:UL:BWP0:PUSC:TPST OFF') #4.50 def Set_5GNR_savesetting(self, sName): self.query(f':SOUR:BB:NR5G:SETT:STOR "/var/user/{sName}";*OPC?') self.query(f':SOUR:BB:NR5G:WAV:CRE "/var/user/{sName}";*OPC?') self.delay(10) ##################################################################### ### Run if Main ##################################################################### if __name__ == "__main__": # this won't be run when imported SMW = VSG() SMW.jav_Open("192.168.1.114") SMW.Set_5GNR_savesetting('asdfasdf') SMW.jav_Close()