예제 #1
0
파일: Common.py 프로젝트: wfwgghb/rssd
class VST(object):
    """ Rohde & Schwarz Vector Signal Transceiver Object """
    def __init__(self):
        self.Freq       = 19e9
        self.SMW        = ''
        self.FSW        = ''

    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_OpenTest(self,SMW_IP,FSW_IP):
        self.SMW = VSG().jav_OpenTest(SMW_IP)  #Create SMW Object
        self.FSW = VSA().jav_OpenTest(FSW_IP)  #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)
예제 #2
0
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)
예제 #3
0
    return degree

def deg2rad(degree):
    radian = degree * 3.14159 / 180
    return radian

###############################################################################
### Code Start
###############################################################################
OFile.write('DemodBW,Phase,Mkr1,Mkr2,Mkr3,Mkr4,Meas,MeasAvg\n')
FSW.write('SYST:DISP:UPD ON')

###############################################################################
### SMW-Setup  1 Radian = 180/Pi()
###############################################################################
SMW.Set_Freq(28e9)
SMW.Set_BBState(0)                          # Arb Off
SMW.Set_IQMod(0)                            # IQ Mod Off

SMW.Set_Ref_Source('EXT')                   # ExtReference
SMW.Set_Ref_Freq('10MHZ')
SMW.Set_Ref_SyncBW('WIDE')                  # Oscilator locking BW
SMW.Set_RFState('ON')

###############################################################################
### FSW-Analog Demodulation
###############################################################################
FSW.Set_Channel('ADEM')
FSW.write('LAY:REPL:WIND "1","XTIM:PM"')    # PM Demod window
FSW.Set_SweepCont('OFF')                    # Single sweep
FSW.Set_Ref_Source('INT')                   # Reference
예제 #4
0
SMW = VSG().jav_Open(SMW_IP, OFile)
FSWP = PNA().jav_Open(FSWP_IP, OFile)

##########################################################
### Measure Time
##########################################################
Header = 'Iter,SetFreq,SMFPwr,FSWPFreq,FSWPPwr,LockStatus,PN1,PN2,PN3,PN4'
OFile.write(Header)

FSWP.Set_SweepCont(0)
SMW.Set_RFPwr(-50)
SMW.Set_RFState(1)

for i in range(numMeas):                                        #Loop: Measurements
    for freq  in FreqArry:                                      #Loop: Frequency
        SMW.Set_Freq(freq)
        # FSWP.Set_Freq(freq)
        lockHist = []
        lockPerf = [2,0,0,0]
        for pwr in pwrArry:                                     #Loop: Power
            SMW.Set_RFPwr(pwr)
            FSWP.Set_InitImm()
            FSWP.Set_InitImm()
            # SMW.delay(2)
            lock = FSWP.Get_FreqLock()
            mkr = []
            for m in range(1,5):
                mkr.append(FSWP.Get_Mkr_Y(m))
                # mkr[m-1] = FSWP.Get_Mkr_Y(m)
            ffrq = FSWP.Get_Freq()
            fpwr = FSWP.Get_Power()
예제 #5
0
###############################################################################
### Rohde & Schwarz Automation for demonstration use.
###############################################################################
SMW_IP = '192.168.1.114'
SMW_IP = '10.0.0.10'
FreqArry = [24e9, 28e9, 39e9]
PwrArry = range(-50, 0, 2)

###############################################################################
from rssd.VSG.Common import VSG
from rssd.FileIO import FileIO

FIL = FileIO().makeFile(__file__)
SMW = VSG().jav_Open(SMW_IP, FIL)  #Create SMW Object

###############################################################################
### Code Start
###############################################################################
SMW.Set_IQMod('OFF')
for frq in FreqArry:
    SMW.Set_Freq(frq)
    # SMW.Set_NRP_Freq(frq)
    for pwr in PwrArry:
        SMW.Set_RFPwr(pwr)
        SMW.Set_RFState(1)
        rdStr = SMW.Get_NRPPower()
        FIL.write(f'{frq},{pwr},{rdStr}')
예제 #6
0
class TestGeneral(unittest.TestCase):
    def setUp(self):  #run before each test
        self.SMW = VSG().jav_OpenTest(host)

    def tearDown(self):  #Run after each test
        self.assertEqual(self.SMW.jav_Error()[0], '0')
        self.SMW.jav_Close()

###############################################################################
### <Test>
###############################################################################

    def test_SMW_ALC(self):
        setVal = 'ON'
        self.SMW.Set_ALC_RFDriveAmp(setVal)

    def test_SMW_Arb_Freq(self):
        setVal = 10e6
        self.SMW.Set_ArbClockFreq(setVal)
        getVal = self.SMW.Get_ArbClockFreq()
        if self.SMW.connected: self.assertEqual(setVal, getVal)

    def test_SMW_Arb_State(self):
        setVal = '/var/user/UCS2010/GSM.wv'
        self.SMW.Set_ArbWv(setVal)
        self.SMW.Set_ArbState(1)
        self.SMW.Set_ArbState(0)
        getVal = self.SMW.Get_ArbName()
        # nulVal = self.SMW.Get_ArbInfo()
        nulVal = self.SMW.Get_PowerInfo()
        if self.SMW.connected: self.assertTrue(getVal.find(setVal) > -1)

    def test_SMW_BB_State(self):
        self.SMW.Set_BBState(1)
        self.SMW.Set_BBState(0)

    def test_SMW_Connect(self):
        if self.SMW.connected: self.assertEqual(self.SMW.Make, "Rohde&Schwarz")

    def test_SMW_CrestFactor(self):
        getVal = self.SMW.Get_CrestFactor()

    def test_SMW_OS(self):
        self.SMW.Set_OS_Dir('UCS2010')
        getVal = self.SMW.Get_OS_Dir()
        getVal = self.SMW.Get_OS_FileList()

    def test_SMW_Init_Wideband(self):
        self.SMW.Init_Wideband()

    def test_SMW_IQMod(self):
        self.SMW.Set_IQMod(1)
        self.SMW.Set_IQMod(0)
        self.SMW.Set_IQMod('OFF')
        self.SMW.Set_IQMod('ON')

    def test_SMW_Freq(self):
        setVal = 2e6
        self.SMW.Set_Freq(setVal)
        getVal = self.SMW.Get_Freq()
        if self.SMW.connected: self.assertEqual(setVal, getVal)

    def test_SMW_ListMode(self):
        self.SMW.Set_RFState(1)
        self.SMW.Set_ListMode_File('testListMode.lsw')
        self.SMW.Set_ListMode_File('testListMode')
        self.SMW.Set_ListMode('LIST')
        self.SMW.Set_ListMode_TrigSource('SING')
        self.SMW.Set_ListMode_Dwell(0.01)
        self.SMW.Set_ListMode_RMode('LIVE')
        # self.SMW.Set_ListMode_TrigExecute()
        # self.SMW.Set_ListMode_TrigWait()
        getVal = self.SMW.Get_ListMode_IndexCurr()
        getVal = self.SMW.Get_ListMode_IndexStop()
        self.SMW.Set_ListMode('CW')

    def test_SMW_ListMode_TrigSource(self):
        self.SMW.Set_ListMode_TrigSource('SING')
        self.SMW.Set_ListMode_TrigSource('AUTO')
        self.SMW.Set_ListMode_TrigSource('STEP')
        self.SMW.Set_ListMode_TrigSource('ESTEP')
        self.SMW.Set_ListMode_TrigSource('ESING')

    def test_SMW_PhaseDelta(self):
        setVal = -10
        self.SMW.Set_PhaseDelta(setVal)

    def test_SMW_Pwr(self):
        setVal = -10
        self.SMW.Set_RFPwr(setVal)
        getVal = self.SMW.Get_PowerRMS()
        self.assertEqual(self.SMW.jav_Error()[0], '0')
        if self.SMW.connected: self.assertEqual(setVal, getVal)

    def test_SMW_SysConfigAll(self):
        getVal = self.SMW.Get_SysC_All()
예제 #7
0
##########################################################
### Rohde & Schwarz Automation for demonstration use.
###
### Purpose: Load arb file on SMW
### Author:  mclim
### Date:    2018.05.17
##########################################################
### User Entry
##########################################################
host = '192.168.1.114'  #Get local machine name

##########################################################
### Code Start
##########################################################
from rssd.VSG.Common import VSG

SMW = VSG().jav_Open(host)
#SMW.jav_logSCPI()                  #Log SCPI commands
SMW.Set_Freq(10e9)  #Set 10GHz
SMW.Set_RFPwr(-30)  #Output -30dBm
SMW.Set_RFState('ON')  #Turn RF Output on
SMW.Set_ArbWv('composer.wv')  #Load file
SMW.Set_ArbState('ON')  #Turn on Arb & IQ Mod
SMW.jav_ClrErr  #Clear Errors