"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()
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)