def test_setTransponder(self): for index in self.TEST_INDICES: logger.debug("index = %d" % index) txpdr = Transponder(mode=index) logger.debug("txpdr = %r" % txpdr) if index == 3: assert txpdr.getBroadcastStandard() == 'DVB-S2' yield self.check_setTransponder, txpdr
def test_setTransponder(self): self.getInstrument().setBandRange("950") for modNumber in self.TEST_MODNUMBERS: for index in self.TEST_INDICES: logger.debug("index = %d" % index) txpdr = Transponder(mode=index, freq=1200e6) logger.debug("txpdr = %r" % txpdr) if index == 3: assert txpdr.getBroadcastStandard() == 'DVB-S2' yield self.check_setTransponder, txpdr, modNumber
def configTestSignal(self): txpdr = Transponder(mode=12, freq=274e6, symb=30e6, roll=20, scramb=0, pilots=True) #self.aux_instrument.setTransponder(txpdr) #self.aux_instrument.setPower(-50) self.test_instrument.setTransponder(txpdr)
class BTC_Test(BaseTests.BaseModulatorTest): TEST_CLASS = BTC TEST_PROTOCOL = 'IP' TEST_IP = '192.168.10.11' TEST_NUMMODS = 2 TEST_MODNUMBERS = list(range(1, TEST_NUMMODS + 1)) # list(range(17,28)) TEST_BCSTDS = ["DVBS", "DVB-S2", "DIRECTV"] TEST_MODS = ["8PSK", "QPSK"] TEST_FECS_DVBS2 = ['1/2', '3/5', '2/3', '3/4', '4/5', '5/6', '8/9', '9/10'] TEST_FECS_DIRECTV = ['1/2', '2/3', '6/7'] TEST_FECS_DVBS = ['1/2', '2/3', '3/4', '5/6', '7/8'] TEST_FREQS = [250e6 + x * 100e6 for x in list(range(20)) ] # L-Band frequencies: 250 - 2150 Hz TEST_SYMBS = [20e6, 30e6] # Baud TEST_PILOTSS = [True, False] # ON/OFF TEST_ROLLS = [20.0, 35.0] #TEST_SCRAMBS = list(range(11)) # 0 - 10 TEST_INDICES = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23 ] # removed DIRECTV modes because SLG does not support TEST_TXPDRS = [Transponder(mode=index) for index in TEST_INDICES] TEST_PWRS = [-45.0 + x * 5 for x in list(range(9))] # -70 to -30 dBm TEST_CARRIERS = [True, False] TEST_MODSTATES = [True, False] TEST_BANDRANGES = ["250", "550", "950", "1250", "1550", "2050", "2500"] TEST_CONFIGFILES = ["/DSWM/SLG1_DSWM_US_23CH_1B_20MS.cfg"] TEST_DISTORTION = [ "aswm_saw4.distTXfr", "aswm_saw.distTXfr", "default.distTXfr", "aswm_SAW1.distTXfr" ] TEST_FADING = ["fadingprof4.fad", "MULTIPATH#2.fad"] TEST_NOISE = [8, 10, 20] TEST_SIGNALNOISE = [9, 11, 19] TEST_NOISESTATE = ["ADD", "OFF", "ONLY"] TEST_SIGNALSTATE = [True, False] #rm = pyvisa.ResourceManager() instrument = TEST_CLASS(type=TEST_PROTOCOL, port=TEST_IP, numMods=TEST_NUMMODS) def __del__(self): # Does not need to explicitly close because TelnetComm Manager handles closes all resources at exist # self.instrument.comm.instrument.close() pass def getInstrument(self): return self.instrument @unittest.skip("skipping fading") def test_loadFading(self): for modNumber in self.TEST_MODNUMBERS: for fading in self.TEST_FADING: self.getInstrument().loadFading(fading, modNumber) logger.debug("loading fading %s" % fading) response = input( "Was the Fading profile loaded correctly? [y/n]: ") if response == 'y': assert True else: assert False @unittest.skip("skipping distortion") def test_loadDistortion(self): for modNumber in self.TEST_MODNUMBERS: for distortion in self.TEST_DISTORTION: self.getInstrument().loadDistortion(distortion, modNumber) response = input("Was the Distorion loaded correctly? [y/n]: ") if response == 'y': assert True else: assert False #@unittest.skip("Skipping broadcast standard") def test_setBroadcastStandard(self): for modNumber in self.TEST_MODNUMBERS: for bcstd in self.TEST_BCSTDS: yield self.check_setBroadcastStandard, bcstd, modNumber #@unittest.skip("Skipping broadcast standard") def check_setBroadcastStandard(self, test_bcstd, modNumber): self.getInstrument().setBroadcastStandard(test_bcstd, modNumber) actual_bcstd = self.getInstrument().getBroadcastStandard(modNumber) assert (actual_bcstd == test_bcstd) def test_setConstellationCodeRate(self): for modNumber in self.TEST_MODNUMBERS: for bcstds in self.TEST_BCSTDS: logger.debug("Bcstds set is: %s" % bcstds) if bcstds == "DIRECTV": #self.getInstrument().setBroadcastStandard(bcstds, modNumber) self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DIRECTV: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber if bcstds == "DVBS": self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DVBS: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber if bcstds == "DVB-S2": self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DVBS2: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber def check_setConstellationCodeRate(self, bcstds, test_mod, test_fec, modNumber): bcstds = self.getInstrument().getBroadcastStandard(modNumber) logger.debug("the BCSTDS is: %s" % bcstds) self.getInstrument().setConstellationCodeRate(test_mod, test_fec, modNumber) modcod = self.getInstrument().getConstellationCodeRate(modNumber) actual_mod = modcod[0] actual_fec = modcod[1] logger.debug("the actual_mod is: %r" % actual_mod) logger.debug("the test mod is: %r" % test_mod) logger.debug("the actual_fec is: %s" % actual_fec) logger.debug("the test fec is: %s" % test_fec) assert (test_mod == actual_mod) assert (test_fec == actual_fec) @unittest.skip("Skipping code rate") def test_setCodeRate(self): for modNumber in self.TEST_MODNUMBERS: for fec in self.TEST_FECS: yield self.check_setCodeRate, fec, modNumber def check_setCodeRate(self, test_fec, modNumber): self.getInstrument().setCodeRate(test_fec, modNumber) actual_fec = self.getInstrument().getCodeRate(modNumber) assert (test_fec == actual_fec) def test_setFrequency(self): for modNumber in self.TEST_MODNUMBERS: for freq in self.TEST_FREQS: yield self.check_setFrequency, freq, modNumber def check_setFrequency(self, test_freq, modNumber): self.getInstrument().setFrequency(test_freq, modNumber) actual_freq = self.getInstrument().getFrequency(modNumber) assert (test_freq == actual_freq) def test_setSymbolRate(self): for modNumber in self.TEST_MODNUMBERS: for symb in self.TEST_SYMBS: yield self.check_setSymbolRate, symb, modNumber def check_setSymbolRate(self, test_symb, modNumber): self.getInstrument().setSymbolRate(test_symb, modNumber) actual_symb = self.getInstrument().getSymbolRate(modNumber) assert (test_symb == actual_symb) def test_setPilots(self): for modNumber in self.TEST_MODNUMBERS: for pilots in self.TEST_PILOTSS: yield self.check_setPilots, pilots, modNumber def check_setPilots(self, test_pilots, modNumber): self.getInstrument().setPilots(test_pilots, modNumber) actual_pilots = self.getInstrument().getPilots(modNumber) assert (test_pilots == actual_pilots) def test_setAlpha(self): for modNumber in self.TEST_MODNUMBERS: for roll in self.TEST_ROLLS: yield self.check_setAlpha, roll, modNumber def check_setAlpha(self, test_roll, modNumber): self.getInstrument().setAlpha(test_roll, modNumber) actual_roll = self.getInstrument().getAlpha(modNumber) assert (test_roll == actual_roll) def test_setMode(self): for modNumber in self.TEST_MODNUMBERS: for mode in self.TEST_INDICES: yield self.check_setMode, mode, modNumber def check_setMode(self, test_mode, modNumber): self.getInstrument().setMode(test_mode, modNumber) actual_mode = self.getInstrument().getMode(modNumber) assert (test_mode == actual_mode) def test_setTransponder(self): for modNumber in self.TEST_MODNUMBERS: for index in self.TEST_INDICES: logger.debug("index = %d" % index) txpdr = Transponder(mode=index, freq=1200e6) logger.debug("txpdr = %r" % txpdr) if index == 3: assert txpdr.getBroadcastStandard() == 'DVB-S2' yield self.check_setTransponder, txpdr, modNumber def check_setTransponder(self, test_txpdr, modNumber): self.getInstrument().setTransponder(test_txpdr, modNumber) actual_txpdr = self.getInstrument().getTransponder(modNumber) logger.debug("test_txpdr: %r" % test_txpdr) logger.debug("actual_txpdr: %r" % actual_txpdr) assert (test_txpdr == actual_txpdr) # def test_setAllTransponders(self): # for txpdr in self.TEST_TXPDRS: # yield self.check_setAllTransponders, txpdr # def check_setAllTransponders(self, test_txpdr): # self.getInstrument().setAllTransponders(test_txpdr) # for index in self.TEST_MODNUMBERS: # actual_txpdr = self.getInstrument().getTransponder(index) # logger.debug("test_txpdr: %r" % test_txpdr) # logger.debug("actual_txpdr: %r" % actual_txpdr) # assert (test_txpdr == actual_txpdr) def test_setPower(self): for modNumber in self.TEST_MODNUMBERS: for power in self.TEST_PWRS: yield self.check_setPower, power, modNumber def check_setPower(self, test_power, modNumber): self.getInstrument().setPower(test_power, modNumber) actual_power = self.getInstrument().getPower(modNumber) assert (test_power == actual_power) def test_setCW(self): for modNumber in self.TEST_MODNUMBERS: for carrier in self.TEST_CARRIERS: yield self.check_setCW, carrier, modNumber def check_setCW(self, test_carrier, modNumber): self.getInstrument().setCW(test_carrier, modNumber) actual_carrier = self.getInstrument().getCW(modNumber) assert (test_carrier == actual_carrier) # def test_setModulatorState(self): # for modNumber in self.TEST_MODNUMBERS: # for modState in self.TEST_MODSTATES: # yield self.check_setModulatorState, modState, modNumber def check_setModulatorState(self, test_modState, modNumber): self.getInstrument().setModulatorState(test_modState, modNumber) actual_modState = self.getInstrument().getModulatorState(modNumber) assert (test_modState == actual_modState) def test_setScramblingCode(self): for modNumber in self.TEST_MODNUMBERS: for scramb in self.TEST_SCRAMBS: yield self.check_setScramblingCode, scramb, modNumber def check_setScramblingCode(self, test_scramb, modNumber): self.getInstrument().setBroadcastStandard("DVB-S2", modNumber) self.getInstrument().setScramblingCode(test_scramb, modNumber) actual_scramb = self.getInstrument().getScramblingCode(modNumber) assert (test_scramb == actual_scramb) def test_setNoiseLevel(self): for modNumber in self.TEST_MODNUMBERS: for noise in self.TEST_NOISE: yield self.check_setNoiseLevel, noise, modNumber def check_setNoiseLevel(self, test_noise, modNumber): self.getInstrument().setNoiseLevel(test_noise, modNumber) actual_noise = self.getInstrument().getNoiseLevel(modNumber) assert (test_noise == actual_noise) def test_setSignalNoiseLevel(self): for modNumber in self.TEST_MODNUMBERS: for noise in self.TEST_SIGNALNOISE: yield self.check_setSignalNoiseLevel, noise, modNumber def check_setSignalNoiseLevel(self, test_noise, modNumber): self.getInstrument().setSignalNoiseLevel(test_noise, modNumber) actual_noise = self.getInstrument().getSignalNoiseLevel(modNumber) assert (test_noise == actual_noise) def test_setNoiseState(self): for modNumber in self.TEST_MODNUMBERS: for noise in self.TEST_NOISESTATE: yield self.check_setNoiseState, noise, modNumber def check_setNoiseState(self, test_state, modNumber): self.getInstrument().setNoiseState(test_state, modNumber) actual_state = self.getInstrument().getNoiseState(modNumber) assert (test_state == actual_state) def test_setSignalNoiseState(self): for modNumber in self.TEST_MODNUMBERS: for state in self.TEST_SIGNALSTATE: yield self.check_setSignalNoiseState, state, modNumber def check_setSignalNoiseState(self, test_state, modNumber): self.getInstrument().setSignalNoiseState(test_state, modNumber) actual_state = self.getInstrument().getSignalNoiseState(modNumber) assert (test_state == actual_state)
from SCTA.Instrumentation import SFU, FSW from SCTA.DataLogging import DataLogger # Create a CSV file to store insertion loss over frequency csvfile = DataLogger(filename='NetAnDemo', format='csv', csv_header=['Frequency (MHz)', 'Loss (dB)']) # Initialize test equipment: SFU and FSW sfu = SFU(type='IP', port='192.168.2.11') fsw = FSW(type='IP', port='192.168.10.76') # Choose what AMC mode and input power to generate amc_mode = 11 input_power = -50 txpdr = Transponder(mode=amc_mode) sfu.setTransponder(txpdr) sfu.setPower(input_power) fsw.setTransponder(txpdr) # Create a list of frequencies to loop over (in MHz) start = 250 stop = 2150 step = 100 Lband = list(range(start, stop, step)) print('Lband = ', Lband) # For each frequency, get a power measurement, calculate the insertion loss, and write results to the CSV file for freq in Lband: sfu.setFrequency(freq * 1e6) fsw.setFrequency(freq * 1e6)
slg = [slg1, slg2, slg3] # Create a CSV file to store power over frequency output_header = ['Desired Frequency (Hz)', 'Measured Power (dB)'] csvfile = DataLogger(filename=output_filename, format='csv', csv_header=output_header) csvfile1 = DataLogger(filename=output_filename + "updatedPower", format='csv', csv_header=output_header) # Initialize Transponders txp1 = Transponder(mode=4, freq=954e6, symb=5e6, roll=20, scramb=0, pilots=True) txp2 = Transponder(mode=12, freq=974e6, symb=20e6, roll=20, scramb=0, pilots=True) #initialize SLG Setup slg1.loadConfigFile("DSWM\SLG1_DSWM_US_23CH_2B_20MS.cfg") slg2.loadConfigFile("DSWM\SLG2_DSWM_US_23CH_2B_20MS.cfg") slg3.loadConfigFile("DSWM\SLG3_DSWM_US_23CH_2B_20MS.cfg") ##############
class VTM_Test(BaseTests.BaseModulatorTest): TEST_CLASS = VTM TEST_PROTOCOL = 'IP' TEST_IP = '10.23.120.151' TEST_NUMMODS = 5 TEST_MODNUMBERS = list(range(1, TEST_NUMMODS + 1)) # list(range(17,28)) TEST_BCSTDS = ["DVB-S2"] #, "DIRECTV", "DVBS" TEST_MODS = ["8PSK", "QPSK"] TEST_FECS_DVBS2 = ['1/2', '3/5', '2/3', '3/4', '4/5', '5/6', '8/9', '9/10'] TEST_FREQS = [950e6 + x * 100e6 for x in list(range(10)) ] # L-Band frequencies: 250 - 2150 Hz TEST_SYMBS = [20e6, 30e6] # Baud TEST_PILOTSS = [True, False] # ON/OFF TEST_ROLLS = [5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0] #TEST_SCRAMBS = list(range(11)) # 0 - 10 TEST_INDICES = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] # removed DIRECTV modes because SLG does not support TEST_TXPDRS = [Transponder(mode=index) for index in TEST_INDICES] TEST_PWRS = [-34.0 + x * 5 for x in list(range(6))] # -70 to -30 dBm TEST_CARRIERS = [True, False] TEST_MODSTATES = [True, False] TEST_SOURCES = [ "ETHERNET INPUT A", "PN23 INSERT", "PN23 INVERT", "RAMP GENERATOR", "PN15", "PN23 BONDED", "PN23 BONDED INVERT" ] TEST_DATAPID = [3134, 5238, 1334] TEST_MARKERPID = [1313, 3018, 2334] TEST_CHUNKSIZE = [10, 34, 24, 42] TEST_BONDEDRATE = [20000000, 30000000, 15000000, 55000000] TEST_SKEW = [10, 5000, 40000] TEST_PHASE = [-53.3, -55.8, -78.3, -88.1, -92.1, -95.3, -96.8, -115.8] TEST_PHASEFREQS = [10, 100, 1000, 10000, 100000, 1E6, 10E6, 17E6] TEST_VTMMODE = ["CCM", "LAB", "VTM"] #rm = pyvisa.ResourceManager() instrument = TEST_CLASS(ip=TEST_IP, numMods=TEST_NUMMODS) def __del__(self): # Does not need to explicitly close because TelnetComm Manager handles closes all resources at exist # self.instrument.comm.instrument.close() pass def getInstrument(self): return self.instrument def test_setVTMMode(self): for mode in self.TEST_VTMMODE: yield self.check_setVTMMode, mode def check_setVTMMode(self, test_mode): self.getInstrument().setVTMMode(test_mode) actual_mode = self.getInstrument().getVTMMode() logger.info("test mode is %r" % test_mode) logger.info("actual mode is %r" % actual_mode) assert (test_mode == actual_mode) #@unittest.skip("Skipping broadcast standard") def test_setBroadcastStandard(self): for modNumber in self.TEST_MODNUMBERS: for bcstd in self.TEST_BCSTDS: yield self.check_setBroadcastStandard, bcstd, modNumber #@unittest.skip("Skipping broadcast standard") def check_setBroadcastStandard(self, test_bcstd, modNumber): self.getInstrument().setBroadcastStandard(test_bcstd, modNumber) actual_bcstd = self.getInstrument().getBroadcastStandard(modNumber) assert (actual_bcstd == test_bcstd) @unittest.skip("Skipping setConstellationCodeRate") def test_setConstellationCodeRate(self): for modNumber in self.TEST_MODNUMBERS: for bcstds in self.TEST_BCSTDS: logger.debug("Bcstds set is: %s" % bcstds) if bcstds == "DIRECTV": #self.getInstrument().setBroadcastStandard(bcstds, modNumber) self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DIRECTV: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber if bcstds == "DVBS": self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DVBS: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber if bcstds == "DVB-S2": self.getInstrument().setBroadcastStandard( bcstds, modNumber) for mod in self.TEST_MODS: for fec in self.TEST_FECS_DVBS2: yield self.check_setConstellationCodeRate, bcstds, mod, fec, modNumber def check_setConstellationCodeRate(self, bcstds, test_mod, test_fec, modNumber): bcstds = self.getInstrument().getBroadcastStandard(modNumber) logger.debug("the BCSTDS is: %s" % bcstds) self.getInstrument().setConstellationCodeRate(test_mod, test_fec, modNumber) modcod = self.getInstrument().getConstellationCodeRate(modNumber) actual_mod = modcod[0] actual_fec = modcod[1] logger.debug("the actual_mod is: %r" % actual_mod) logger.debug("the test mod is: %r" % test_mod) logger.debug("the actual_fec is: %s" % actual_fec) logger.debug("the test fec is: %s" % test_fec) assert (test_mod == actual_mod) assert (test_fec == actual_fec) @unittest.skip("Skipping code rate") def test_setCodeRate(self): for modNumber in self.TEST_MODNUMBERS: for fec in self.TEST_FECS: yield self.check_setCodeRate, fec, modNumber def check_setCodeRate(self, test_fec, modNumber): self.getInstrument().setCodeRate(test_fec, modNumber) actual_fec = self.getInstrument().getCodeRate(modNumber) assert (test_fec == actual_fec) @unittest.skip("Skipping setFrequency") def test_setFrequency(self): for modNumber in self.TEST_MODNUMBERS: for freq in self.TEST_FREQS: yield self.check_setFrequency, freq, modNumber def check_setFrequency(self, test_freq, modNumber): self.getInstrument().setFrequency(test_freq, modNumber) actual_freq = self.getInstrument().getFrequency(modNumber) assert (test_freq == actual_freq) def test_setSymbolRate(self): for modNumber in self.TEST_MODNUMBERS: for symb in self.TEST_SYMBS: yield self.check_setSymbolRate, symb, modNumber def check_setSymbolRate(self, test_symb, modNumber): self.getInstrument().setSymbolRate(test_symb, modNumber) actual_symb = self.getInstrument().getSymbolRate(modNumber) assert (test_symb == actual_symb) def test_setPilots(self): for modNumber in self.TEST_MODNUMBERS: for pilots in self.TEST_PILOTSS: yield self.check_setPilots, pilots, modNumber def check_setPilots(self, test_pilots, modNumber): self.getInstrument().setPilots(test_pilots, modNumber) actual_pilots = self.getInstrument().getPilots(modNumber) assert (test_pilots == actual_pilots) def test_setAlpha(self): for modNumber in self.TEST_MODNUMBERS: for roll in self.TEST_ROLLS: yield self.check_setAlpha, roll, modNumber def check_setAlpha(self, test_roll, modNumber): self.getInstrument().setAlpha(test_roll, modNumber) actual_roll = self.getInstrument().getAlpha(modNumber) assert (test_roll == actual_roll) @unittest.skip("Skipping setMode") def test_setMode(self): for modNumber in self.TEST_MODNUMBERS: for mode in self.TEST_INDICES: yield self.check_setMode, mode, modNumber def check_setMode(self, test_mode, modNumber): self.getInstrument().setMode(test_mode, modNumber) actual_mode = self.getInstrument().getMode(modNumber) logger.info("the actual setMode is: %r" % actual_mode) logger.info("the test setMode is: %r" % test_mode) assert (test_mode == actual_mode) @unittest.skip("Skipping setTransponder") def test_setTransponder(self): for modNumber in self.TEST_MODNUMBERS: for index in self.TEST_INDICES: logger.debug("index = %d" % index) txpdr = Transponder(mode=index, freq=1200e6) logger.debug("txpdr = %r" % txpdr) if index == 3: assert txpdr.getBroadcastStandard() == 'DVB-S2' yield self.check_setTransponder, txpdr, modNumber def check_setTransponder(self, test_txpdr, modNumber): self.getInstrument().setTransponder(test_txpdr, modNumber) actual_txpdr = self.getInstrument().getTransponder(modNumber) logger.debug("test_txpdr: %r" % test_txpdr) logger.debug("actual_txpdr: %r" % actual_txpdr) assert (test_txpdr == actual_txpdr) # def test_setAllTransponders(self): # for txpdr in self.TEST_TXPDRS: # yield self.check_setAllTransponders, txpdr # def check_setAllTransponders(self, test_txpdr): # self.getInstrument().setAllTransponders(test_txpdr) # for index in self.TEST_MODNUMBERS: # actual_txpdr = self.getInstrument().getTransponder(index) # logger.debug("test_txpdr: %r" % test_txpdr) # logger.debug("actual_txpdr: %r" % actual_txpdr) # assert (test_txpdr == actual_txpdr) def test_setPower(self): for modNumber in self.TEST_MODNUMBERS: for power in self.TEST_PWRS: yield self.check_setPower, power, modNumber def check_setPower(self, test_power, modNumber): self.getInstrument().setPower(test_power, modNumber) actual_power = self.getInstrument().getPower(modNumber) assert (test_power == actual_power) def test_setCW(self): for modNumber in self.TEST_MODNUMBERS: for carrier in self.TEST_CARRIERS: yield self.check_setCW, carrier, modNumber def check_setCW(self, test_carrier, modNumber): self.getInstrument().setCW(test_carrier, modNumber) actual_carrier = self.getInstrument().getCW(modNumber) assert (test_carrier == actual_carrier) def test_rfEnable(self): for modState in self.TEST_MODSTATES: yield self.check_rfEnable, modState def check_rfEnable(self, test_modState): self.getInstrument().rfEnable(test_modState) actual_modState = self.getInstrument().getrfEnable() logger.info("actual state: %r" % actual_modState) logger.info("test state: %r" % test_modState) assert (test_modState == actual_modState) def test_setScramblingCode(self): for modNumber in self.TEST_MODNUMBERS: for scramb in self.TEST_SCRAMBS: yield self.check_setScramblingCode, scramb, modNumber def check_setScramblingCode(self, test_scramb, modNumber): self.getInstrument().setBroadcastStandard("DVB-S2", modNumber) self.getInstrument().setScramblingCode(test_scramb, modNumber) actual_scramb = self.getInstrument().getScramblingCode(modNumber) assert (test_scramb == actual_scramb) def test_setDataSource(self): for source in self.TEST_SOURCES: yield self.check_setDataSource, source def check_setDataSource(self, test_source): self.getInstrument().setDataSource(test_source) actual_source = self.getInstrument().getDataSource() logger.info("test source is %r" % test_source) logger.info("actual source is %r" % actual_source) assert (test_source == actual_source) def test_setDataPID(self): for PID in self.TEST_DATAPID: yield self.check_setDataPID, PID def check_setDataPID(self, test_PID): self.getInstrument().setDataPID(test_PID) actual_PID = self.getInstrument().getDataPID() logger.info("test pid is %r" % test_PID) logger.info("actual PID is %r" % actual_PID) assert (test_PID == actual_PID) def test_setMarkerPID(self): for PID in self.TEST_MARKERPID: yield self.check_setMarkerPID, PID def check_setMarkerPID(self, test_PID): self.getInstrument().setMarkerPID(test_PID) actual_PID = self.getInstrument().getMarkerPID() logger.info("test pid is %r" % test_PID) logger.info("actual PID is %r" % actual_PID) assert (test_PID == actual_PID) def test_setChunkSize(self): for size in self.TEST_CHUNKSIZE: yield self.check_setChunkSize, size def check_setChunkSize(self, test_size): self.getInstrument().setChunkSize(test_size) actual_size = self.getInstrument().getChunkSize() logger.info("test chunk size is %r" % test_size) logger.info("actual chunk size is %r " % actual_size) assert (test_size == actual_size) def test_setBondedRate(self): for rate in self.TEST_BONDEDRATE: yield self.check_setBondedRate, rate def check_setBondedRate(self, test_rate): self.getInstrument().setBondedRate(test_rate) actual_rate = self.getInstrument().getBondedRate() logger.info("test rate is %r" % test_rate) logger.info("actual rate is %r" % actual_rate) assert (test_rate == actual_rate) def test_setSkew(self): for modNumber in self.TEST_MODNUMBERS: for skew in self.TEST_SKEW: yield self.check_setSkew, skew, modNumber def check_setSkew(self, test_skew, modNumber): self.getInstrument().setSkew(test_skew, modNumber) actual_skew = self.getInstrument().getSkew(modNumber) logger.info("test skew is %r" % test_skew) logger.info("actual skew is %r" % actual_skew) assert (test_skew == actual_skew) def test_setPhaseNoise(self): for FREQS, phase in zip(self.TEST_PHASEFREQS, self.TEST_PHASE): yield self.check_setPhaseNoise, FREQS, phase def check_setPhaseNoise(self, test_freq, test_phase): self.getInstrument().setPhaseNoise(test_freq, test_phase) actual_phase = self.getInstrument().getPhaseNoise(test_freq) logger.info("test skew is %r" % test_phase) logger.info("actual skew is %r" % actual_phase) assert (test_phase == actual_phase)
def calibrateDDSS(scenario=1): # IP addresses and port numbers FSW_IP="192.168.88.243" SLG1_IP="192.168.88.2" SLG2_IP="192.168.88.3" SLG3_IP="192.168.88.4" SLG_port=5025 #BTC_IP="192.168.10.11" # Initialize Equipment fsw = FSW(type="IP", port=FSW_IP, window="Spectrum") slg1= SLG(ip=SLG1_IP, port=SLG_port, numMods=1) slg2= SLG(ip=SLG2_IP, port=SLG_port, numMods=1) slg3= SLG(ip=SLG3_IP, port=SLG_port, numMods=1) #btc = BTC(type="IP", port=BTC_IP) # Initialize Transponders sideband = Transponder(mode=4, freq=954e6, symb=5e6, roll=20, scramb=0, pilots=True) victim = Transponder(mode=12, freq=974e6, symb=20e6, roll=20, scramb=0, pilots=True) #initialize SLG Setup slg1.loadConfigFile("DSWM\SLG1_DSWM_US_23CH_2B_20MS.cfg") slg2.loadConfigFile("DSWM\SLG2_DSWM_US_23CH_2B_20MS.cfg") slg3.loadConfigFile("DSWM\SLG3_DSWM_US_23CH_2B_20MS.cfg") slg=[slg1, slg2, slg3] mod1=list(range(1,10)) mod2=list(range(1,7)) mod3=list(range(1,9)) mods=mod1+mod2+mod3 powers=[] #read spec DSWM23_Scenario 2 spec = pd.read_csv('C:\\Users\\labuser\\Documents\\SCTA_repo\\src\\SCTA\\Specs\\raw\\DSWM23_Scen2.csv') victimFreq = spec[" Primary Tr CF"] victim_power=spec["Primary Power"] upperFreq=spec[" Upper CF"] upperPower=spec[" Upper Power"] lowerFreq=spec[" Lower CF"] lowerPower=spec[" Lower Power"] currentVictimPower=[] currentVictimPower.append("dBm") currentUpperPower=[] currentUpperPower.append("dBm") currentLowerPower=[] currentLowerPower.append("dBm") #configure FSW for channel power mode fsw.setTransponder(victim) flag=False while flag==False: #measure channel power across all frequencies and SLG's for k in range(1, len(victimFreq)): logger.info("%r" % victimFreq) logger.info("victimFreq length is: %f" % len(victimFreq)) freq=int(victimFreq[k])*1e6 fsw.setFrequency(freq) logger.info("Frequency is: %r" % freq) fsw_power = fsw.getSpectrumChannelPower() currentVictimPower.append(round(fsw_power, 2)) spec['Current Victim Power']=currentVictimPower for k in range(1, len(upperFreq)): fsw.setTransponder(sideband) freq=int(upperFreq[k])*1e6 fsw.setFrequency(freq) fsw_power = fsw.getSpectrumChannelPower() currentUpperPower.append(round(fsw_power, 2)) spec['currentUpperPower']=currentUpperPower for k in range(1, len(lowerFreq)): fsw.setTransponder(sideband) freq=int(lowerFreq[k])*1e6 fsw.setFrequency(freq) fsw_power = fsw.getSpectrumChannelPower() currentLowerPower.append(round(fsw_power, 2)) spec['currentLowerPower']=currentLowerPower print ("table is: %r" % spec) #calculate deltas between wanted and measured compensation_victim=[] compensation_victim.append("dBm") for v in range(1, len(victim_power)): adjust=int(currentVictimPower[v])-int(victim_power[v]) compensation_victim.append(adjust) spec["compensation_victim"]=compensation_victim victim_check=[x <0.2 for x in compensation_victim] compensation_upper=[] compensation_upper.append("dBm") for u in range(1, len(upperPower)): adjust=int(currentUpperPower[u])-int(upperPower[u]) compensation_upper.append(adjust) spec["compensation_upper"]=compensation_upper upper_check=[x <0.2 for x in compensation_upper] compensation_lower=[] compensation_lower.append("dBm") for l in range(1, len(lowerPower)): adjust=int(currentLowerPower[l])-int(lowerPower[l]) compensation_lower.append(l) spec["compensation_lower"]=compensation_lower lower_check=[x <0.2 for x in compensation_lower] flag=all(lower_check+upper_check+victim_check) #current SLG power slgVictim=spec[" SLG Primary"] slgUpper=spec[" SLG Upper"] slgLower=spec[" SLG Lower"] modVictim=spec[" Output Primary"] current_SLGVictimPower=[] current_SLGVictimPower.append("dBm") for i in range(1, len(slgVictim)): port=modVictim[i] slgIndex=slgVictim[i] victim=slg[int(slgIndex)].getPower(int(port)) current_SLGVictimPower.append(victim) spec["current_SLGVictimPower"]=current_SLGVictimPower modUpper=spec[" Output Upper"] current_SLGUpperPower=[] current_SLGUpperPower.append("dBm") for i in range(len(slgUpper)): port=modUpper[int(mod)] upper=slg[int(slgIndex)].getPower(int(port)) current_SLGUpperPower.append(upper) spec["current_SLGUpperPower"]=current_SLGUpperPower modLower=spec[" Output Lower"] current_SLGLowerPower=[] current_SLGLowerPower.append("dBm") for slgIndex, mod in zip(slgLower, modUpper): port=modLower[int(mod)] lower=slg[int(slgIndex)].getPower(int(port)) current_SLGLowerPower.append(lower) spec["current_SLGLowerPower"]=current_SLGLowerPower #calculate new SLG Powers and set them newSLGVictimPower=[] newSLGVictimPower.append("dBm") for i in range(1, len(current_SLGVictimPower)): newVictimPower=int(current_SLGVictimPower[i])-int(compensation_victim[i]) slg[int(slgVictim[i])].setPower(newVictimPower, int(modVictim[i])) newSLGVictimPower.append(newVictimPower) spec["newSLGVictimPower"]=newSLGVictimPower newSLGUpperPower=[] newSLGUpperPower.append("dBm") for i in range(1, len(current_SLGUpperPower)): newUpperPower=int(current_SLGUpperPower[i])-int(compensation_upper[i]) slg[int(slgUpper[i])].setPower(newUpperPower, int(modUpper[i])) newSLGUpperPower.append(newUpperPower) spec["newSLGUpperPower"]=newSLGUpperPower newSLGLowerPower=[] newSLGLowerPower.append("dBm") for i in range(1, len(current_SLGLowerPower)): newLowerPower=int(current_SLGLowerPower[i])-int(compensation_lower[i]) slg[int(slgLower[i])].setPower(newLowerPower, int(modLower[i])) newSLGLowerPower.append(newLowerPower) spec["newSLGLowerPower"]=newSLGLowerPower spec.to_csv("..//src/SCTA/Specs//raw//DSWM23_Scen2_updated.csv", sep='\t') debug.info(print spec)
def check_constructor(self, test_index, test_bcstd, test_mod, test_fec, test_freq, test_symb, test_roll, test_scramb, test_pilots): txpdr = Transponder(mode=test_index, bcstd=test_bcstd, mod=test_mod, fec=test_fec, freq=test_freq, symb=test_symb, roll=test_roll, scramb=test_scramb, pilots=test_pilots) index = txpdr.getMode() if test_index is None: assert (txpdr.getBroadcastStandard() == self.BCSTD) assert (txpdr.getConstellation() == self.MOD) assert (txpdr.getCodeRate() == self.FEC) else: assert (index == test_index) assert (txpdr.getBroadcastStandard() == AMC_Spec.getBroadcastStandard(index)) assert ( txpdr.getConstellation() == AMC_Spec.getConstellation(index)) assert (txpdr.getCodeRate() == AMC_Spec.getCodeRate(index)) freq = txpdr.getFrequency() symb = txpdr.getSymbolRate() roll = txpdr.getAlpha() scramb = txpdr.getScramblingCode() pilots = txpdr.getPilots() assert (freq == test_freq) assert (symb == test_symb) assert (roll == test_roll) assert (scramb == test_scramb) assert (pilots == test_pilots)
def configTestSignal(self): txpdr = Transponder(mode=4, freq=974e6, symb=20e6) #self.aux_instrument.setTransponder(txpdr) #self.aux_instrument.setPower(-50) self.test_instrument.setTransponder(txpdr)
class SLG_Test(object): TEST_CLASS = SLG TEST_PROTOCOL = 'IP' TEST_IP='192.168.10.1' TEST_PORT = 5025 TEST_NUMMODS=32 TEST_MODNUMBERS = list(range(1,TEST_NUMMODS+1))# list(range(17,28)) TEST_BCSTDS = ["DVBS", "DVB-S2"] TEST_MODS = ["8PSK", "QPSK"] TEST_FECS = ['1/2', '3/5', '2/3', '3/4', '4/5', '5/6', '6/7', '7/8', '8/9', '9/10'] TEST_FREQS = [250e6 + x*100e6 for x in list(range(20))] # L-Band frequencies: 250 - 2150 Hz TEST_SYMBS = [20e6, 30e6] # Baud TEST_PILOTSS = [True, False] # ON/OFF TEST_ROLLS = [20.0, 35.0] #TEST_SCRAMBS = list(range(11)) # 0 - 10 TEST_INDICES = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23] # removed DIRECTV modes because SLG does not support TEST_TXPDRS = [Transponder(mode=index) for index in TEST_INDICES] TEST_PWRS = [-45.0 + x*5 for x in list(range(9))] # -70 to -30 dBm TEST_CARRIERS = ["SINGLE", "MULTIPLE", "CW"] TEST_MODSTATES = [True, False] TEST_INPUTSOURCES = ["ASIA", "ASIB", "ETHA", "ETHB", "AWG", "LOAD", "PN", "TSG"] TEST_BANDRANGES = ["250", "550", "950", "1250", "1550", "2050", "2500"] TEST_CONFIGFILES = ["/DSWM/SLG1_DSWM_US_23CH_1B_20MS.cfg"] rm = pyvisa.ResourceManager() instrument = TEST_CLASS(ip=TEST_IP, port=TEST_PORT, numMods=TEST_NUMMODS) def __del__(self): # Does not need to explicitly close because TelnetComm Manager handles closes all resources at exist # self.instrument.comm.instrument.close() pass def getInstrument(self): return self.instrument def test_setBroadcastStandard(self): for modNumber in self.TEST_MODNUMBERS: for bcstd in self.TEST_BCSTDS: yield self.check_setBroadcastStandard, bcstd, modNumber def check_setBroadcastStandard(self, test_bcstd, modNumber): self.getInstrument().setBroadcastStandard(test_bcstd, modNumber) actual_bcstd = self.getInstrument().getBroadcastStandard(modNumber) assert (actual_bcstd == test_bcstd) def test_setConstellation(self): for modNumber in self.TEST_MODNUMBERS: for mod in self.TEST_MODS: yield self.check_setConstellation, mod, modNumber def check_setConstellation(self, test_mod, modNumber): self.getInstrument().setConstellation(test_mod, modNumber) actual_mod = self.getInstrument().getConstellation(modNumber) assert (test_mod == actual_mod) def test_setCodeRate(self): for modNumber in self.TEST_MODNUMBERS: for fec in self.TEST_FECS: yield self.check_setCodeRate, fec, modNumber def check_setCodeRate(self, test_fec, modNumber): self.getInstrument().setCodeRate(test_fec, modNumber) actual_fec = self.getInstrument().getCodeRate(modNumber) assert (test_fec == actual_fec) def test_setFrequency(self): for modNumber in self.TEST_MODNUMBERS: for band in self.TEST_BANDRANGES: start = int(band) freq=int(start*1e6) logger.debug("band = %d" % start) self.getInstrument().setBandRange(band) for index in list(range(freq, freq+int(400e6), int(50e6))): yield self.check_setFrequency, freq, modNumber def check_setFrequency(self, test_freq, modNumber): self.getInstrument().setFrequency(test_freq, modNumber) actual_freq = self.getInstrument().getFrequency(modNumber) assert (test_freq == actual_freq) def test_setSymbolRate(self): for modNumber in self.TEST_MODNUMBERS: for symb in self.TEST_SYMBS: yield self.check_setSymbolRate, symb, modNumber def check_setSymbolRate(self, test_symb, modNumber): self.getInstrument().setSymbolRate(test_symb, modNumber) actual_symb = self.getInstrument().getSymbolRate(modNumber) assert (test_symb == actual_symb) def test_setPilots(self): for modNumber in self.TEST_MODNUMBERS: for pilots in self.TEST_PILOTSS: yield self.check_setPilots, pilots, modNumber def check_setPilots(self, test_pilots, modNumber): self.getInstrument().setPilots(test_pilots, modNumber) actual_pilots = self.getInstrument().getPilots(modNumber) assert (test_pilots == actual_pilots) def test_setAlpha(self): for modNumber in self.TEST_MODNUMBERS: for roll in self.TEST_ROLLS: yield self.check_setAlpha, roll, modNumber def check_setAlpha(self, test_roll, modNumber): self.getInstrument().setAlpha(test_roll, modNumber) actual_roll = self.getInstrument().getAlpha(modNumber) assert (test_roll == actual_roll) def test_setMode(self): for modNumber in self.TEST_MODNUMBERS: for mode in self.TEST_INDICES: yield self.check_setMode, mode, modNumber def check_setMode(self, test_mode, modNumber): self.getInstrument().setMode(test_mode, modNumber) actual_mode = self.getInstrument().getMode(modNumber) assert (test_mode == actual_mode) def test_setTransponder(self): self.getInstrument().setBandRange("950") for modNumber in self.TEST_MODNUMBERS: for index in self.TEST_INDICES: logger.debug("index = %d" % index) txpdr = Transponder(mode=index, freq=1200e6) logger.debug("txpdr = %r" % txpdr) if index == 3: assert txpdr.getBroadcastStandard() == 'DVB-S2' yield self.check_setTransponder, txpdr, modNumber def check_setTransponder(self, test_txpdr, modNumber): self.getInstrument().setTransponder(test_txpdr, modNumber) actual_txpdr = self.getInstrument().getTransponder(modNumber) logger.debug("test_txpdr: %r" % test_txpdr) logger.debug("actual_txpdr: %r" % actual_txpdr) assert (test_txpdr == actual_txpdr) for state in self.TEST_MODSTATES: self.check_setModulatorState(state, modNumber) # def test_setAllTransponders(self): # for txpdr in self.TEST_TXPDRS: # yield self.check_setAllTransponders, txpdr # def check_setAllTransponders(self, test_txpdr): # self.getInstrument().setAllTransponders(test_txpdr) # for index in self.TEST_MODNUMBERS: # actual_txpdr = self.getInstrument().getTransponder(index) # logger.debug("test_txpdr: %r" % test_txpdr) # logger.debug("actual_txpdr: %r" % actual_txpdr) # assert (test_txpdr == actual_txpdr) def test_setPower(self): for modNumber in self.TEST_MODNUMBERS: for power in self.TEST_PWRS: yield self.check_setPower, power, modNumber def check_setPower(self, test_power, modNumber): self.getInstrument().setPower(test_power, modNumber) actual_power = self.getInstrument().getPower(modNumber) assert (test_power == actual_power) def test_setCarrierType(self): for modNumber in self.TEST_MODNUMBERS: for carrier in self.TEST_CARRIERS: yield self.check_setCarrierType, carrier, modNumber def check_setCarrierType(self, test_carrier, modNumber): self.getInstrument().setCarrierType(test_carrier, modNumber) actual_carrier = self.getInstrument().getCarrierType(modNumber) assert (test_carrier == actual_carrier) # def test_setModulatorState(self): # for modNumber in self.TEST_MODNUMBERS: # for modState in self.TEST_MODSTATES: # yield self.check_setModulatorState, modState, modNumber def check_setModulatorState(self, test_modState, modNumber): self.getInstrument().setModulatorState(test_modState, modNumber) actual_modState = self.getInstrument().getModulatorState(modNumber) assert (test_modState == actual_modState) def test_setInputSource(self): for modNumber in self.TEST_MODNUMBERS: for inputSource in self.TEST_INPUTSOURCES: yield self.check_setInputSource, inputSource, modNumber def check_setInputSource(self, test_inputSource, modNumber): self.getInstrument().setInputSource(test_inputSource, modNumber) actual_inputSource = self.getInstrument().getInputSource(modNumber) assert (test_inputSource == actual_inputSource) def test_setBandRange(self): for modNumber in self.TEST_MODNUMBERS: for bandRange in self.TEST_BANDRANGES: yield self.check_setBandRange, bandRange def check_setBandRange(self, test_bandRange): self.getInstrument().setBandRange(test_bandRange) actual_bandRange = self.getInstrument().getBandRange() assert (test_bandRange == actual_bandRange) def test_loadConfigFile(self): for configFile in self.TEST_CONFIGFILES: yield self.check_loadConfigFile, configFile def check_loadConfigFile(self, test_configFile): self.getInstrument().loadConfigFile(test_configFile) response = input("Was the Scenario loaded correctly? [y/n]: ") if response == 'y': assert True else: assert False