"front-end board identification. None was given. Exiting...\n\n") exit() elif (len(sys.argv) > 2): sys.stdout.write( "\nThis program requires one argument, which corresponds to the RF " + "front-end board identification. More than one were given. Exiting...\n\n" ) exit() # Initiates the communication to the three devices used in the test routine: the vector network # analyzer (Agilent E5061B), the RF front-end controller board and the RF SPDT switches board. If # establishing one of these connections is not successful, the program exits, indicating an error # message. try: controller_board = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.timeout): sys.stdout.write( "\nUnable to reach the RF front-end controller board through the network. " + "Exiting...\n\n") exit() try: vna = AgilentE5061B(VNA_IP) except (socket.timeout): sys.stdout.write( "\nUnable to reach the vector network analyzer (Agilent E5061B) through the " + "network. Exiting...\n\n") exit() try:
if not os.path.isfile(abspath+'/rffe_temp.txt'): with open(abspath+'/rffe_temp.txt', 'w') as f: f.write('Timestamp ') for rffe_numb in rffe_range: f.write('RFFE'+str(rffe_numb)+'CH1 RFFE'+str(rffe_numb)+'CH2 ') f.write('\n') last_read_time = time.time() while True: format_ts = "{0:.2f}".format(last_read_time) with open(abspath+'/rffe_temp.txt', 'a') as f: f.write('\n'+str(format_ts)) for rffe_numb in rffe_range: RFFE_CONTROLLER_BOARD_IP = '10.2.117.'+str(rffe_numb) try: rffe = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.error): sys.stdout.write("Unable to reach the RF front-end controller board with the IP: "+ RFFE_CONTROLLER_BOARD_IP +" through the network. " + "Skipping it...\n") continue tmp1 = "{0:.6f}".format(rffe.get_temp1()) tmp2 = "{0:.6f}".format(rffe.get_temp2()) f.write(' '+str(tmp1)+' '+str(tmp2)) print ('RFFE'+str(rffe_numb)+' temp -> CH1 ='+str(tmp1)+' CH2='+str(tmp2)) try: while time.time() - last_read_time < args.delay: sleep(1) except KeyboardInterrupt: f.close()
##get current date and time current_time=str(time.strftime("%c")) current_day=str(time.strftime("%d-%m-%Y")) try: os.makedirs(datapath_save + "sn_" + str(serial_number)+"/"+current_day) except: pass datapath_save=datapath_save + "sn_" + str(serial_number)+"/"+current_day+"/" metadata_param=read_metadata.read_vars(metadata_path) #test configuration vna=AgilentE5061B(metadata_param['ip_vna']) rffe=RFFEControllerBoard(metadata_param['ip_rffe']) rfsw=RF_switch_board(metadata_param['ip_rfsw']) sgen=Agilent33521A(metadata_param['ip_sgen']) ################################################ print("Network/LAN configuration - ok!\n...\n") ################################# #get frequency data from the VNA #setar frequencia central, span e qde de pontos #get values from metadata ################################## att_value=float(metadata_param['att_value']) pow_value=float(metadata_param['pow_value']) n_points=int(float(metadata_param['n_points'])) xtalk_ref=float(metadata_param['xtalk_ref'])
import socket import sys from time import sleep from rffe_test_lib import RFFEControllerBoard from binascii import hexlify from numpy import arange sw_sweep = [0, 1, 2, 3] attenuation_values = arange(0, 32, 0.5) for rffe_numb in range(33, 45, 1): RFFE_CONTROLLER_BOARD_IP = '10.2.117.' + str(rffe_numb) try: rffe = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.error): sys.stdout.write( "Unable to reach the RF front-end controller board with the IP: " + RFFE_CONTROLLER_BOARD_IP + " through the network. " + "Skipping it...\n") continue #Attenuators test for att in attenuation_values: rffe.set_attenuator_value(att) read_att = rffe.get_attenuator_value() if not read_att == att: print("Board " + RFFE_CONTROLLER_BOARD_IP + " failed in attenuator test! " + "It should return att = " + str(att) + " but got att = " + read_att) print("Board " + RFFE_CONTROLLER_BOARD_IP + " passed attenuator test! ")
import socket import sys from time import sleep from rffe_test_lib import RFFEControllerBoard from binascii import hexlify from numpy import arange import argparse parser = argparse.ArgumentParser() parser.add_argument('rffe', help='rffe ip (final part)') parser.add_argument('-a', '--att', type=float, help='rffe ip (final part)') args = parser.parse_args() RFFE_CONTROLLER_BOARD_IP = '10.2.117.'+str(args.rffe) try: rffe = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.error): sys.stdout.write("Unable to reach the RF front-end controller board with the IP: "+ RFFE_CONTROLLER_BOARD_IP +" through the network. ") if args.att: rffe.set_attenuator_value(args.att) read_att = rffe.get_attenuator_value() print (str(read_att)) #~ #~ while True: #~ for sw in sw_sweep: #~ rffe.set_switching_mode(sw) #~ read_sw = rffe.get_switching_mode() #~ if not int(hexlify(str(read_sw))) == sw: #~ print ("Board "+RFFE_CONTROLLER_BOARD_IP+" failed in switch test! "+
import socket import sys from time import sleep from rffe_test_lib import RFFEControllerBoard from binascii import hexlify from numpy import arange sw_sweep = [0,1,2,3] attenuation_values = arange(0,32,0.5) for rffe_numb in range(33,45,1): RFFE_CONTROLLER_BOARD_IP = '10.2.117.'+str(rffe_numb) try: rffe = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.error): sys.stdout.write("Unable to reach the RF front-end controller board with the IP: "+ RFFE_CONTROLLER_BOARD_IP +" through the network. " + "Skipping it...\n") continue #Attenuators test for att in attenuation_values: rffe.set_attenuator_value(att) read_att = rffe.get_attenuator_value() if not read_att == att: print ("Board "+RFFE_CONTROLLER_BOARD_IP+" failed in attenuator test! "+ "It should return att = "+str(att)+" but got att = "+read_att) print ("Board "+RFFE_CONTROLLER_BOARD_IP+" passed attenuator test! ") #Temperature reading test tmp1 = rffe.get_temp1() tmp2 = rffe.get_temp2()
def communication(ip_network_analyzer, ip_switch_1, ip_switch_2, ip_rffe, ip_gerador_sinais_dc, tela_leds): #Verificando a comunicação com o RFFE ping = Popen(['ping', str(ip_rffe), '-c', '1', "-W", "2"]) ping.wait() ping_result = ping.poll() if (ping_result == 0): rffe_str_result_msg = "RFFE - Communication: OK" rffe_str_IP = "RFFE - IP: " + str(ip_rffe) print(rffe_str_result_msg) tela_leds.ui.kled_RFFE.setState(1) tela_leds.repaint() QApplication.processEvents() print("Led rffe", tela_leds.repaint()) print("Led rffe", QApplication.processEvents()) else: rffe_str_result_msg = "RFFE - Communication: FAIL" rffe_str_IP = "RFFE - IP: " + str(ip_rffe) print(rffe_str_result_msg) print("Encerrando conexão") tela_leds.ui.kled_RFFE.setState(1) tela_leds.ui.kled_RFFE.setColor(QtGui.QColor(255, 0, 0)) tela_leds.repaint() QApplication.processEvents() print("Led rffe", tela_leds.repaint()) print("Led rffe", QApplication.processEvents()) time.sleep(SLEEP_TIME) sys.exit() rffe = RFFEControllerBoard(ip_rffe) rffe_str_msg_communication = [rffe_str_IP, rffe_str_result_msg] #Verificando a comunicação com o Network Analyzer ping = Popen(['ping', str(ip_network_analyzer), '-c', '1', "-W", "2"]) ping.wait() ping_result = ping.poll() if (ping_result == 0): network_str_result_msg = "Network Analyzer - Communication: OK" network_str_IP = "Network Analyzer - IP: " + str(ip_network_analyzer) print(network_str_result_msg) tela_leds.ui.kled_NETWORK.setState(1) tela_leds.repaint() QApplication.processEvents() print("Led network", tela_leds.repaint()) print("Led network", QApplication.processEvents()) else: network_str_result_msg = "Network Analyzer - Communication: FAIL" network_str_IP = "Network Analyzer - IP: " + str(ip_network_analyzer) print(network_str_result_msg) print("Encerrando conexão") tela_leds.ui.kled_NETWORK.setState(1) tela_leds.ui.kled_NETWORK.setColor(QtGui.QColor(255, 0, 0)) tela_leds.repaint() QApplication.processEvents() print("Led network", tela_leds.repaint()) print("Led network", QApplication.processEvents()) time.sleep(SLEEP_TIME) sys.exit() vna = AgilentE5061B(ip_network_analyzer) vna_str_msg_communication = [network_str_IP, network_str_result_msg] #Verificando a comunicação com o SWITCH 1 ping = Popen(['ping', str(ip_switch_1), '-c', '1', "-W", "2"]) ping.wait() ping_result = ping.poll() if (ping_result == 0): switch_1_str_result_msg = "RF Switch1 - Communication: OK" switch_1_str_IP = "RF Switch1 - IP: " + str(ip_switch_1) print(switch_1_str_result_msg) tela_leds.ui.kled_SWITCH1.setState(1) tela_leds.repaint() QApplication.processEvents() print("Led switch1", tela_leds.repaint()) print("Led switch1", QApplication.processEvents()) else: switch_1_str_result_msg = "RF Switch1 - Communication: FAIL" switch_1_str_IP = "RF Switch1 - IP: " + str(ip_switch_1) print(switch_1_str_result_msg) print("Encerrando conexão") tela_leds.ui.kled_SWITCH1.setState(1) tela_leds.ui.kled_SWITCH1.setColor(QtGui.QColor(255, 0, 0)) tela_leds.repaint() QApplication.processEvents() print("Led switch1", tela_leds.repaint()) print("Led switch1", QApplication.processEvents()) time.sleep(SLEEP_TIME) sys.exit() rfsw_1 = RF_switch_board_1(ip_switch_1) rfsw_1_str_msg_communication = [switch_1_str_IP, switch_1_str_result_msg] #Verificando a comunicação com o SWITCH 2 ping = Popen(['ping', str(ip_switch_2), '-c', '1', "-W", "2"]) ping.wait() ping_result = ping.poll() if (ping_result == 0): switch_2_str_result_msg = "RF Switch2 - Communication: OK" switch_2_str_IP = "RF Switch2 - IP: " + str(ip_switch_2) print(switch_2_str_result_msg) tela_leds.ui.kled_SWITCH2.setState(1) tela_leds.repaint() QApplication.processEvents() print("Led switch2", tela_leds.repaint()) print("Led switch2", QApplication.processEvents()) else: switch_2_str_result_msg = "RF Switch2 - Communication: FAIL" switch_2_str_IP = "RF Switch2 - IP: " + str(ip_switch_2) print(switch_2_str_result_msg) print("Encerrando conexão") tela_leds.ui.kled_SWITCH2.setState(1) tela_leds.ui.kled_SWITCH2.setColor(QtGui.QColor(255, 0, 0)) tela_leds.repaint() QApplication.processEvents() print("Led switch2", tela_leds.repaint()) print("Led switch2", QApplication.processEvents()) time.sleep(SLEEP_TIME) sys.exit() rfsw_2 = RF_switch_board_2(ip_switch_2) rfsw_2_str_msg_communication = [switch_2_str_IP, switch_2_str_result_msg] #Verificando a comunicação com o WAVEFORM GENERATOR ping = Popen(['ping', str(ip_gerador_sinais_dc), '-c', '1', "-W", "2"]) ping.wait() ping_result = ping.poll() if (ping_result == 0): waveform_generator_str_result_msg = "Waveform Generator - Communication: OK" waveform_generator_str_IP = "Waveform Generator - IP: " + str( ip_gerador_sinais_dc) print(waveform_generator_str_result_msg) tela_leds.ui.kled_WAVEFORM.setState(1) tela_leds.repaint() QApplication.processEvents() print("Led switch2", tela_leds.repaint()) print("Led switch2", QApplication.processEvents()) else: waveform_generator_str_result_msg = "Waveform Generator - Communication: FAIL" waveform_generator_str_IP = "Waveform Generator - IP: " + str( ip_gerador_sinais_dc) print(waveform_generator_str_result_msg) print("Encerrando conexão") tela_leds.ui.kled_WAVEFORM.setState(1) tela_leds.ui.kled_WAVEFORM.setColor(QtGui.QColor(255, 0, 0)) tela_leds.repaint() QApplication.processEvents() print("Led waveform", tela_leds.repaint()) print("Led waveform", QApplication.processEvents()) time.sleep(SLEEP_TIME) sys.exit() sgen = Agilent33521A(ip_gerador_sinais_dc) sgen_str_msg_communication = [ waveform_generator_str_IP, waveform_generator_str_result_msg ] print("Network/LAN configuration - ok!\n...\n") return (vna, rfsw_1, rfsw_2, rffe, sgen, rffe_str_msg_communication, vna_str_msg_communication, rfsw_1_str_msg_communication, rfsw_2_str_msg_communication, sgen_str_msg_communication)
sys.stdout.write("\nThis program requires one argument, which corresponds to the RF " + "front-end board identification. None was given. Exiting...\n\n") exit() elif (len(sys.argv) > 2): sys.stdout.write("\nThis program requires one argument, which corresponds to the RF " + "front-end board identification. More than one were given. Exiting...\n\n") exit() # Initiates the communication to the three devices used in the test routine: the vector network # analyzer (Agilent E5061B), the RF front-end controller board and the RF SPDT switches board. If # establishing one of these connections is not successful, the program exits, indicating an error # message. try: controller_board = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.timeout): sys.stdout.write("\nUnable to reach the RF front-end controller board through the network. " + "Exiting...\n\n") exit() try: vna = AgilentE5061B(VNA_IP) except (socket.timeout): sys.stdout.write("\nUnable to reach the vector network analyzer (Agilent E5061B) through the " + "network. Exiting...\n\n") exit() try: switches_board = RFSwitchesBoard(RF_SWITCHES_BOARD_PORT) except (serial.serialutil.SerialException):
import socket import sys from time import sleep from rffe_test_lib import RFFEControllerBoard from binascii import hexlify from numpy import arange import argparse parser = argparse.ArgumentParser() parser.add_argument("rffe", help="rffe ip (final part)") parser.add_argument("-a", "--att", type=float, help="rffe ip (final part)") args = parser.parse_args() RFFE_CONTROLLER_BOARD_IP = "10.2.117." + str(args.rffe) try: rffe = RFFEControllerBoard(RFFE_CONTROLLER_BOARD_IP) except (socket.error): sys.stdout.write( "Unable to reach the RF front-end controller board with the IP: " + RFFE_CONTROLLER_BOARD_IP + " through the network. " ) if args.att: rffe.set_attenuator_value(args.att) read_att = rffe.get_attenuator_value() print(str(read_att)) # ~ # ~ while True: # ~ for sw in sw_sweep: