pwr_circ_buff = np.zeros(num_samps_circ_buff) ######################################## # LOGGER # ######################################## # SOAPY_SDR_FATAL = 1, //!< A fatal error. The application will most likely terminate. This is the highest priority. # SOAPY_SDR_CRITICAL = 2, //!< A critical error. The application might not be able to continue running successfully. # SOAPY_SDR_ERROR = 3, //!< Error.An operation didn't complete successfully, but application as a whole not affected. # SOAPY_SDR_WARNING = 4, //!< A warning. An operation completed with an unexpected result. # SOAPY_SDR_NOTICE = 5, //!< A notice, which is an information with just a higher priority. # SOAPY_SDR_INFO = 6, //!< An informational message, usually denoting the successful completion of an operation. # SOAPY_SDR_DEBUG = 7, //!< A debugging message. # SOAPY_SDR_TRACE = 8, //!< A tracing message. This is the lowest priority. # SOAPY_SDR_SSI = 9, //!< Streaming status indicators such as "U" (underflow) and "O" (overflow). logLevel = 3 # 4:WARNING, 6:WARNING+INFO, 7:WARNING+INFO+DEBUG... SoapySDR.SoapySDR_setLogLevel(logLevel) logging.basicConfig(filename='./data_out/debug_SISO_RX.log', level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-10s) %(asctime)s %(message)s',) ######################################### # Create Plots # ######################################### matplotlib.rcParams.update({'font.size': 10}) fig = plt.figure(figsize=(20, 8), dpi=120) fig.subplots_adjust(hspace=.5, top=.85) ax1 = fig.add_subplot(6, 1, 1) ax1.grid(True) ax1.set_title('Waveform capture') title = ax1.text(0.5, 1, '|', ha="center")
def iris_health_monitor(en_logging, freq, uut_serials, golden_serial, gain_step, golden_tx_gain, golden_ant, golden_rx_gain, rx_pwr_limit, rm_from_uut_serials, detailed_logs, sdr_log_level, test_tx_only, test_rx_only): test_start = datetime.now() SoapySDR.SoapySDR_setLogLevel(sdr_log_level) # 1. Prepare the golden Iris and the UUT Iris serials. uut_sdrs, uut_serials, uut_frontends, golden_sdr, golden_serial = \ prepare_irises(uut_serials, golden_serial, rm_from_uut_serials) if en_logging: test_datetime = datetime.now() log_fieldnames = [ "PF", "UUT_Iris", "fftPwr_dB_A", "fftPwr_dB_B", "Noise_Floor_A", "Noise_Floor_B", "UUT_Ch", "UUT_Gain", "UUT_Gain_Lo", "UUT_Gain_Hi", "Golden: Iris", "Ant", "Gain", "PF_Thresh", "TX_LMS7_Temp", "TX_Zynq_Temp", "RX_Power_dBFS", "RX_Start", "RX_Stop" ] # 2. Receiver Test on all Irises: Transmit from the golden Iris # module. Receive on all Irises one by one on each channel A & B. if test_rx_only or (not test_tx_only and not test_rx_only): if en_logging: log_name_rx = "./data_out/rx_test_" + \ test_datetime.strftime("%Y-%m-%d_%H-%M-%S") + ".csv" log_ptr = open(log_name_rx, mode='w') log_writer = csv.writer(log_ptr, delimiter=',') log_writer.writerow(log_fieldnames) else: log_writer = "" pf_rx, rx_lo, rx_hi = test_receiver(gain_step=gain_step, freq=freq, uut_sdrs=uut_sdrs, uut_serials=uut_serials, uut_frontends=uut_frontends, golden_sdr=golden_sdr, golden_serial=golden_serial, golden_tx_gain=golden_tx_gain, golden_ant=golden_ant, rx_pwr_limit=rx_pwr_limit, detailed_logs=detailed_logs, en_logging=en_logging, log_writer=log_writer) print("\nReceiver test: ", "Passed" if pf_rx else "Failed") if en_logging: log_ptr.close() if detailed_logs and en_logging: rx_axis_x0, rx_axis_x1, rx_axis_y0, rx_axis_y1, rx_noise_floor0, \ rx_noise_floor1, rx_serials = \ process_rx_log(log_name_rx, rx_pwr_limit) rx_test_end = datetime.now() # 3. Transmitter test: Transmit from all Irises one by one on each # channel A & B. Receive on the golden Iris module. if test_tx_only or (not test_tx_only and not test_rx_only): if en_logging: log_name_tx = "./data_out/tx_test_" + \ test_datetime.strftime("%Y-%m-%d_%H-%M-%S") + ".csv" log_ptr = open(log_name_tx, mode='w') log_writer = csv.writer(log_ptr, delimiter=',') log_writer.writerow(log_fieldnames) else: log_writer = "" pf_tx, tx_lo, tx_hi = test_transmitter(gain_step=gain_step, freq=freq, uut_sdrs=uut_sdrs, uut_serials=uut_serials, uut_frontends=uut_frontends, golden_sdr=golden_sdr, golden_serial=golden_serial, golden_rx_gain=golden_rx_gain, golden_ant=golden_ant, rx_pwr_limit=rx_pwr_limit, detailed_logs=detailed_logs, en_logging=en_logging, log_writer=log_writer) if en_logging: log_ptr.close() if detailed_logs and en_logging: tx_axis_x0, tx_axis_x1, tx_axis_y0, tx_axis_y1, tx_noise_floor0,\ tx_noise_floor1, tx_serials = \ process_tx_log(log_name_tx) tx_test_end = datetime.now() # 4. Test Parameters: disp_params(freq=freq, rx_pwr_limit=rx_pwr_limit, golden_serial=golden_serial, golden_ant=golden_ant, golden_tx_gain=golden_tx_gain, golden_rx_gain=golden_rx_gain, gain_step=gain_step, uut_serials=uut_serials, pf_rx=pf_rx, pf_tx=pf_tx, en_logging=en_logging, detailed_logs=detailed_logs, log_name_rx=log_name_rx, log_name_tx=log_name_tx, test_tx_only=test_tx_only, test_rx_only=test_rx_only) test_end = datetime.now() print("==================== Test Times ====================") print("Receiver test time: {}".format(rx_test_end - test_start)) print("Transmitter test time: {}".format(tx_test_end - rx_test_end)) print("Total test time: {}".format(test_end - test_start)) print("\nSee the plots ...\n") if detailed_logs and en_logging: plotter(rx_axis_x0, rx_axis_x1, rx_axis_y0, rx_axis_y1, rx_noise_floor0, rx_noise_floor1, rx_serials, tx_axis_x0, tx_axis_x1, tx_axis_y0, tx_axis_y1, tx_noise_floor0, tx_noise_floor1, tx_serials, test_tx_only, test_rx_only, pf_rx, pf_tx, golden_serial, golden_ant, golden_tx_gain, golden_rx_gain, test_datetime, rx_pwr_limit, rx_lo, rx_hi, tx_lo, tx_hi)