def __init__(self, sfe_ip): count_num = 0 while True: try: rm = pyvisa.ResourceManager() specan = rm.open_resource('TCPIP::{}::INSTR'.format(sfe_ip)) self.specan = specan del self.specan.timeout break except: count_num = count_num + 1 print("SFE connection error") logging.info('SFE connection error') time.sleep(10) print count_num if count_num >= 3: en = ekt_relay.EktRelay() en.relay_off_sfe() time.sleep(5) en.relay_on_sfe() time.sleep(180) del en sfe_ip = ekt_cfg.SFE_IP specan = Ektsfe(sfe_ip) specan.set_modulation_modulation_source("DTV") net = ekt_net.EktNetClient(ekt_cfg.FRONT_END_SERVER_IP, ekt_cfg.FRONT_END_SERVER_PORT) net.send_data(json.dumps({"cmd": "set_sfe_state", "sfe_state": "crash"})) time.sleep(0.5) del net
FREQUENCY_LEVEL_OFFSET = LOCK_PARAMETER[1] specan = Ektsfu(sfu_ip) specan.set_digitaltv_coding_symbolrate_dvbs2(SYMBOL_RATE[0]) specan = Ektsfu(sfu_ip) specan.set_noise_settings_receiver("{}e6".format( str(SYMBOL_RATE[2] * 1.2))) specan = Ektsfu(sfu_ip) specan.set_frequency_frequency_frequency( str(FREQUENCY_LEVEL_OFFSET[0]) + "MHz") time.sleep(1) specan = Ektsfu(sfu_ip) specan.set_level_level_offset(str(FREQUENCY_LEVEL_OFFSET[1])) specan = Ektsfu(sfu_ip) specan.set_level_level_level("dBm", "-50") net = ekt_net.EktNetClient(ekt_cfg.FRONT_END_SERVER_IP, ekt_cfg.FRONT_END_SERVER_PORT) net.send_data( json.dumps({ "cmd": "set_frequency_data", "frequency": str(FREQUENCY_LEVEL_OFFSET[0]) })) time.sleep(1) del net net = ekt_net.EktNetClient(ekt_cfg.FRONT_END_SERVER_IP, ekt_cfg.FRONT_END_SERVER_PORT) net.send_data( json.dumps({ "cmd": "set_symbol_rate_data", "symbol_rate": str(SYMBOL_RATE[1]) })) time.sleep(1)