def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''

        section_indent = indent_level

        # top level transmit section param values
        params = {"multiplexing": "narrowband"}
        logger.info(dict_to_xml(params, section_indent))

        # narrowband section start
        logger.info("%s<narrowband>", section_indent * '\t')
        section_indent += 1

        # narrowband section param values
        params = {
            "tx_amplitude": self._tx_amplitude,
            "modulation": self._modulation,
            "bitrate": self._bitrate,
            "samples_per_symbol": self.samples_per_symbol(),
            "differential": self.differential(),
            "access_code": self._access_code,
            "coding": self._use_coding,
            "constellation_points": self._constellation_points,
            "excess_bw": self._excess_bw
        }

        # add optional params if they exist

        # check for mod code (currently in psk and qam only)
        if "_mod_code" in vars(self.modulator):
            params["mod_code"] = self.modulator._mod_code

        # check for bt (currently in gmsk and cpm only)
        if "_bt" in vars(self.modulator):
            params["bt"] = self.modulator._bt

        logger.info(dict_to_xml(params, section_indent))

        if self._use_coding == True:
            # Forward error correction section start
            logger.info("%s<forward_error_correction>", section_indent * '\t')
            section_indent += 1

            # TODO: change the way coding is implemented so a coding module can be
            # checked for this information, instead of hard coding it
            # Forward error correction section param values
            params = {"scheme": "reed_solomon", "code_rate": (4.0 / 8.0)}
            logger.info(dict_to_xml(params, section_indent))

            # Forward error correction section end
            section_indent -= 1
            logger.info("%s</forward_error_correction>", section_indent * '\t')

        # narrowband section end
        section_indent -= 1
        logger.info("%s</narrowband>", section_indent * '\t')
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''
             
     section_indent = indent_level
     
     # top level transmit section param values
     params = {"multiplexing":"narrowband"}
     logger.info(dict_to_xml(params, section_indent))
 
     # narrowband section start
     logger.info("%s<narrowband>", section_indent*'\t')
     section_indent += 1
     
     # narrowband section param values
     params = {"tx_amplitude":self._tx_amplitude,
               "modulation":self._modulation,
               "bitrate":self._bitrate,
               "samples_per_symbol":self.samples_per_symbol(),
               "differential":self.differential(),
               "access_code":self._access_code,
               "coding":self._use_coding,
               "constellation_points":self._constellation_points,
               "excess_bw":self._excess_bw}
     
     # add optional params if they exist 
     
     # check for mod code (currently in psk and qam only)
     if "_mod_code" in vars(self.modulator):
         params["mod_code"] =  self.modulator._mod_code
     
     # check for bt (currently in gmsk and cpm only)
     if "_bt" in vars(self.modulator):
         params["bt"] =  self.modulator._bt
                 
     logger.info(dict_to_xml(params, section_indent))
     
     if self._use_coding == True:
         # Forward error correction section start
         logger.info("%s<forward_error_correction>", section_indent*'\t')
         section_indent += 1
         
         # TODO: change the way coding is implemented so a coding module can be
         # checked for this information, instead of hard coding it
         # Forward error correction section param values
         params = {"scheme":"reed_solomon",
             "code_rate":(4.0/8.0)}
         logger.info(dict_to_xml(params, section_indent))
         
         # Forward error correction section end
         section_indent -= 1
         logger.info("%s</forward_error_correction>", section_indent*'\t') 
            
     # narrowband section end
     section_indent -= 1
     logger.info("%s</narrowband>", section_indent*'\t')
예제 #3
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''

        section_indent = indent_level

        # rx front end section start
        logger.info("%s<rx_frontend>", section_indent * '\t')
        section_indent += 1

        # rx front end section param values
        params = {
            "args": self._args,
            "rf_frequency": self._freq,
            "rx_gain": self._gain,
            "sample_rate": self._rate,
            "antenna": self._ant,
            "spec": self._spec
        }
        logger.info(dict_to_xml(params, section_indent))

        # rx front end section end
        section_indent -= 1
        logger.info("%s</rx_frontend>", section_indent * '\t')
예제 #4
0
def frame_config_to_xml(frame_config_in, indent_level):
    fc = deepcopy(frame_config_in)
    
    fc["t0"] = str(fc["t0"])
    for k, slot in enumerate(fc["slots"]):
        fc["slots"][k] = tuple(slot)
        
    return dict_to_xml(fc, indent_level)
예제 #5
0
def frame_config_to_xml(frame_config_in, indent_level):
    fc = deepcopy(frame_config_in)

    fc["t0"] = str(fc["t0"])
    for k, slot in enumerate(fc["slots"]):
        fc["slots"][k] = tuple(slot)

    return dict_to_xml(fc, indent_level)
예제 #6
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''
     section_indent = indent_level
     
     # top level tdma controller params
     params = {
               "app_in_q_size":self.max_app_in_q_size,
               "incoming_q_size":self.max_incoming_q_size,
               "mux_name":self.mux_name,
               "rx_channelizer_name":self.rx_channelizer_name,
               "first_frame_time":self.start_time,
               "frame_file":self.frame_file,
              }
     
     #logger.info(dict_to_xml(params, section_indent))
     logger.info(dict_to_xml(params, section_indent))
 
     # tdma state machine section start
     #logger.info("%s<tdma_mac>", section_indent*'\t')
     logger.info("%s<tdma_controller>", (section_indent*'\t'))
     section_indent += 1
     
     # mac section param values
     params = {
               "node_source_address":self.mac_config["my_id"],
               "base_id":self.mac_config["base_id"],
               "node_sink_address_list":self.mac_config["peer_ids"],
               "fs":self.mac_config["fs"],
               "lead_limit":self.mac_config["lead_limit"],
               "pre_guard":self.mac_config["pre_guard"],
               "fhss_flag":self.mac_config["fhss_flag"],        
               }                                 
     #logger.info(dict_to_xml(params, section_indent))
     logger.info(dict_to_xml(params, section_indent))
     
     
     self.manage_slots.log_my_settings(section_indent,logger)
     
            
     # csma section end
     section_indent -= 1
     #logger.info("%s</tdma_mac>", section_indent*'\t')
     logger.info("%s</tdma_controller>", (section_indent*'\t'))
예제 #7
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''
             
     section_indent = indent_level
     
     # top level transmit section param values
     params = {"multiplexing":"ofdm"}
     logger.info(dict_to_xml(params, section_indent))
 
     # ofdm section start
     logger.info("%s<ofdm>", section_indent*'\t')
     section_indent += 1
     
     # ofdm section param values
     params = {"tx_amplitude":self._tx_amplitude,
               "modulation":self.packet_tx._modulation,
               "coding":self.packet_tx._use_coding,
               "number_of_subcarriers":self.packet_tx._fft_length,
               "number_of_active_subcarriers":self.packet_tx._occupied_tones,
               "cp_length":self.packet_tx._cp_length}
     logger.info(dict_to_xml(params, section_indent))
     
         
     if self.packet_tx._use_coding == True:
         # Forward error correction section start
         logger.info("%s<forward_error_correction>", section_indent*'\t')
         section_indent += 1
         
         # TODO: change the way coding is implemented so a coding module can be
         # checked for this information, instead of hard coding it
         # Forward error correction section param values
         params = {"scheme":"reed_solomon",
             "code_rate":(4.0/8.0)}
         logger.info(dict_to_xml(params, section_indent))
         
         # Forward error correction section end
         section_indent -= 1
         logger.info("%s</forward_error_correction>", section_indent*'\t') 
            
     # ofdm section end
     section_indent -= 1
     logger.info("%s</ofdm>", section_indent*'\t')
예제 #8
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''

        section_indent = indent_level

        # top level transmit section param values
        params = {"multiplexing": "ofdm"}
        logger.info(dict_to_xml(params, section_indent))

        # ofdm section start
        logger.info("%s<ofdm>", section_indent * '\t')
        section_indent += 1

        # ofdm section param values
        params = {
            "tx_amplitude": self._tx_amplitude,
            "modulation": self.packet_tx._modulation,
            "coding": self.packet_tx._use_coding,
            "number_of_subcarriers": self.packet_tx._fft_length,
            "number_of_active_subcarriers": self.packet_tx._occupied_tones,
            "cp_length": self.packet_tx._cp_length
        }
        logger.info(dict_to_xml(params, section_indent))

        if self.packet_tx._use_coding == True:
            # Forward error correction section start
            logger.info("%s<forward_error_correction>", section_indent * '\t')
            section_indent += 1

            # TODO: change the way coding is implemented so a coding module can be
            # checked for this information, instead of hard coding it
            # Forward error correction section param values
            params = {"scheme": "reed_solomon", "code_rate": (4.0 / 8.0)}
            logger.info(dict_to_xml(params, section_indent))

            # Forward error correction section end
            section_indent -= 1
            logger.info("%s</forward_error_correction>", section_indent * '\t')

        # ofdm section end
        section_indent -= 1
        logger.info("%s</ofdm>", section_indent * '\t')
예제 #9
0
 def log_results(self, indent_level, logger):
     
     section_indent = (indent_level)
     
     logger.info('%s<tx_channelizer>', section_indent*'\t')
     
     params = {  "number_digital_channels":self.num_chan,
                 "channelizer_transition_bandwidth":self.trans_bw,
                 "channelizer_attenuation_dB":self.att_dB,
                 "digital_channel_number":self.current_chan }
     logger.info(dict_to_xml(params, section_indent+1))   
     
     logger.info('%s</tx_channelizer>', section_indent*'\t')
예제 #10
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''
     section_indent = indent_level
     
     # top level mac section param values
     params = {"beacon_timeout":self._beacon_timeout,
               "min_beacons": self._min_beacons,
               "max_beacons": self._max_beacons,
               "base_id":self._base_id,
               "beacon_error_thresh":self._beacon_error_thresh,
               }
     logger.info(dict_to_xml(params, section_indent))
예제 #11
0
 def log_tune_command(self, cmd_time, freq, dropped):
     
     params = {
               "timestamp":str(cmd_time),
               "freq":freq,
               "dropped":dropped
               }
     
     param_xml = dict_to_xml(params, 1)
     
     tune_log_xml = ("<rf_tune>\n" + 
                     "%s\n" + 
                     "</rf_tune>") % param_xml
                     
     self.statelog.info(tune_log_xml)
예제 #12
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''
        section_indent = indent_level

        # top level mac section param values
        params = {
            "beacon_timeout": self._beacon_timeout,
            "min_beacons": self._min_beacons,
            "max_beacons": self._max_beacons,
            "base_id": self._base_id,
            "beacon_error_thresh": self._beacon_error_thresh,
        }
        logger.info(dict_to_xml(params, section_indent))
예제 #13
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''    
     section_indent = indent_level
     
     # infinite backlog section start
     logger.info("%s<infinite>", section_indent*'\t')
     section_indent += 1
     
     # infinite backlog section param values
     params = {
               "node_sink_address_list":self.destination_id_list,
               "max_queue_size":self.max_queue_size,
               "fill_threshold":self.fill_thresh,
               "payload_size":self.payload_size
               }
     logger.info(dict_to_xml(params, section_indent))
     
     # infinite backlog section end
     section_indent -= 1
     logger.info("%s</infinite>", section_indent*'\t')   
예제 #14
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''    
     section_indent = indent_level
     
     # infinite backlog section start
     logger.info("%s<tunnel>", section_indent*'\t')
     section_indent += 1
     
     # tunnel section param values
     params = {"tun_device_filename":self.tun_device_filename,
               "tun_ifname":self.tun_ifname}
     
             
     # TODO: Am I missing any interesting parameters?
     
     logger.info(dict_to_xml(params, section_indent))
     
     # infinite backlog section end
     section_indent -= 1
     logger.info("%s</tunnel>", section_indent*'\t')
예제 #15
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''
        section_indent = indent_level

        # infinite backlog section start
        logger.info("%s<infinite>", section_indent * '\t')
        section_indent += 1

        # infinite backlog section param values
        params = {
            "node_sink_address_list": self.destination_id_list,
            "max_queue_size": self.max_queue_size,
            "fill_threshold": self.fill_thresh,
            "payload_size": self.payload_size
        }
        logger.info(dict_to_xml(params, section_indent))

        # infinite backlog section end
        section_indent -= 1
        logger.info("%s</infinite>", section_indent * '\t')
예제 #16
0
 def log_my_settings(self, indent_level,logger):
     '''
     Write out all initial parameter values to XML formatted file
     '''
             
     section_indent = indent_level
     
     # rx front end section start
     logger.info("%s<rx_frontend>", section_indent*'\t')
     section_indent += 1
     
     # rx front end section param values
     params = {"args":self._args,
               "rf_frequency":self._freq,
               "rx_gain":self._gain,
               "sample_rate":self._rate,
               "antenna":self._ant,    
               "spec":self._spec}
     logger.info(dict_to_xml(params, section_indent))
     
     # rx front end section end
     section_indent -= 1
     logger.info("%s</rx_frontend>", section_indent*'\t')
예제 #17
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''
        section_indent = indent_level

        # infinite backlog section start
        logger.info("%s<tunnel>", section_indent * '\t')
        section_indent += 1

        # tunnel section param values
        params = {
            "tun_device_filename": self.tun_device_filename,
            "tun_ifname": self.tun_ifname
        }

        # TODO: Am I missing any interesting parameters?

        logger.info(dict_to_xml(params, section_indent))

        # infinite backlog section end
        section_indent -= 1
        logger.info("%s</tunnel>", section_indent * '\t')
예제 #18
0
def log_my_settings( options, tb, logger ):
    print 'logging'

    # get current timestamp
    epoch_time = time.time()
    indent_level = 0
    
    section_indent = (indent_level)
    
    # node state section start
    logger.info("%s<node_state>", section_indent*'\t')
    section_indent += 1
     
    # get current repo branch and version
    #(status, branch) = commands.getstatusoutput("git rev-parse --symbolic-full-name --abbrev-ref HEAD")
    #(status, commit) = commands.getstatusoutput("git describe --always --dirty")
    branch = commands.getstatusoutput("git rev-parse --symbolic-full-name --abbrev-ref HEAD")[1]
    commit = commands.getstatusoutput("git describe --always --dirty")[1]
    node_version = branch + '-' + commit
    
    # get machine name    
    #(status, hostname) =  commands.getstatusoutput("uname -n")
    hostname = commands.getstatusoutput("uname -n")[1]
    # node state section param values
    params = {"timestamp":epoch_time,
              "traffic_generation_type":options.traffic_generation,
              "node_version":node_version,
              "mac_ll_version":mac_ll.__version__,
              "digital_ll_version":digital_ll.__version__,
              "hostname":hostname,
              "pckt_log":options.pcktlog,
              "statelog":options.statelog,
              "node_config":options.config_file,
              "frame_file":options.frame_file,
              "mac_type":options.node_role,
              "calibration_time":tb.cal_time,
              }

    logger.info(dict_to_xml(params, section_indent))

    if tb.traffic is not None:

        # traffic_generatione section start
        logger.info("%s<traffic_generation>", section_indent*'\t')
        section_indent += 1
         
        tb.traffic.log_my_settings(section_indent, logger)
            
        # traffic_generation section end
        section_indent -= 1
        logger.info("%s</traffic_generation>", section_indent*'\t')
    
    
    # radio section start
    logger.info("%s<radio>", section_indent*'\t')
    section_indent += 1           
    
    params = {"usrp_serial":tb.usrp_serial,
              "usrp_ip":tb.usrp_ip}
    logger.info(dict_to_xml(params, section_indent)) 
    
    # call transmitter's logger
    tb.sink.log_my_settings(section_indent,logger)
    
    # call receiver's logger
    tb.source.log_my_settings(section_indent,logger)
   
    # radio section end
    section_indent -= 1
    logger.info("%s</radio>", section_indent*'\t')     

    
    
    # phy section start
    logger.info("%s<phy>", section_indent*'\t')
    section_indent += 1 
    
    # receive section start
    logger.info("%s<receive>", section_indent*'\t')
    section_indent += 1 
    
    # call receive path's logger
    tb.rx_path.log_my_settings(section_indent,logger)
   
    # receive section end
    section_indent -= 1
    logger.info("%s</receive>", section_indent*'\t')
    
    

    # digital hopper section start
    logger.info("%s<digital_hopper>", section_indent*'\t')
    section_indent += 1 
    
    tb.rx_channelizer.log_results(section_indent,logger)
    tb.tx_channelizer.log_results(section_indent,logger)
    
    # digital hopper section section end
    section_indent -= 1
    logger.info("%s</digital_hopper>", section_indent*'\t')
    
    
    
    # phy section end
    section_indent -= 1
    logger.info("%s</phy>", section_indent*'\t')
    
    # mac section start
    logger.info("%s<mac>", section_indent*'\t')
    section_indent += 1 
    
    tb.tdma_controller.log_my_settings(section_indent, logger)
    
    
    # mac section end
    section_indent -= 1
    logger.info("%s</mac>", section_indent*'\t')  

    

    # node state section end
    section_indent -= 1
    logger.info("%s</node_state>", section_indent*'\t')
    
    # catchall for options
    ops = vars(options)
    
    logger.info('%s<options>',section_indent*'\t')
    section_indent += 1 
    logger.info(dict_to_xml( ops, section_indent ))
    section_indent -= 1
    logger.info('%s</options>',section_indent*'\t')
예제 #19
0
    def log_results(self, indent_level, logger):

        section_indent = (indent_level)

        logger.info("%s<channel_sounding>", section_indent * "\t")

        # Log the test parameters
        logger.info("%s<sounding_parameters>", (section_indent + 1) * "\t")
        test_params = {
            "id": self.id,
            "tx_papr": self.papr,
            "tx_maximum_sample": self.maxv,
            "center_frequency_Hz": self.cf,
            "bandwidth_Hz": self.samp_rate,
            "tx_gain_dB": self.tx_gain,
            "rx_gain_dB": self.rx_gain,
            "digital_scaling": self.digital_scale,
            "K_bins_occupied": self.K,
            "nfft_bins": self.nfft,
            "number_fft_avg": self.n_avg,
            "wait_noise": self.wait_noise,
            "wait_tx": self.wait_tx,
            "wait_sig": self.wait_sig,
            "wait_quit": self.wait_quit
        }
        logger.info(dict_to_xml(test_params, section_indent + 2))

        logger.info("%s</sounding_parameters>", (section_indent + 1) * "\t")

        # Wait until we are done observing the channel
        done = False
        while not done:
            time.sleep(0.01)
            done = self.post_fft_analysis.SNR_calculation_ready()

        # Get the various measurements and write to file
        tx_dpwr = (self.digital_scale**2) * self.avgpwr
        tx_pwr_eq, rx_pwr_eq = get_pwr_equations(
            self.cf, self.tx_gain, self.rx_gain)  # returned in dB

        snr = [
            0,
        ] * self.nfft
        sinr = [
            0,
        ] * self.nfft
        pwr = [
            0,
        ] * self.nfft
        Np = [
            0,
        ] * self.nfft
        Ip = [
            0,
        ] * self.nfft
        for n in range(1, self.Lt + 1):
            # Get the results
            snr[n] = self.post_fft_analysis.return_SNR_2step(n)
            pwr[n] = self.post_fft_analysis.return_sig_power(n)
            Np[n] = self.post_fft_analysis.return_noise_power(n)
            Ip[n] = self.post_fft_analysis.return_odd_bin_power(n)
            sinr[n] = self.post_fft_analysis.return_SNR(n)

            logger.info("%s<results>", (section_indent + 1) * "\t")

            test_params = {
                "other_node_id":
                n,
                "tx_discrete_sig_pwr_dB": (10 * log10(tx_dpwr)),
                "rx_discrete_sig_pwr_dB": (10 * log10(pwr[n])),
                "rx_discrete_noise_pwr_dB": (10 * log10(Np[n])),
                "rx_discrete_txfloor_pwr_dB": (10 * log10(Ip[n])),
                "tx_analog_sig_pwr_dB": (tx_pwr_eq + 10 * log10(tx_dpwr)),
                "rx_analog_sig_pwr_dB": (rx_pwr_eq + 10 * log10(pwr[n])),
                "rx_analog_noise_pwr_dB": (rx_pwr_eq + 10 * log10(Np[n])),
                "rx_analog_txfloor_pwr_dB": (rx_pwr_eq + 10 * log10(Ip[n])),
                "pathloss_dB": (tx_pwr_eq + 10 * log10(tx_dpwr) -
                                (rx_pwr_eq + 10 * log10(pwr[n]))),
                "snr_dB": (10 * log10(snr[n])),
                "signal_to_txfloor_pwr_dB": (10 * log10(sinr[n]))
            }
            logger.info(dict_to_xml(test_params, section_indent + 2))

            logger.info("%s</results>", (section_indent + 1) * "\t")

        logger.info("%s</channel_sounding>", section_indent * "\t")
예제 #20
0
 def log_results(self, indent_level, logger):
 
     section_indent = (indent_level)
     
     logger.info("%s<channel_sounding>", section_indent*"\t")
     
     # Log the test parameters
     logger.info("%s<sounding_parameters>", (section_indent+1)*"\t")
     test_params = { "id":self.id,
                     "tx_papr":self.papr,
                     "tx_maximum_sample":self.maxv,
                     "center_frequency_Hz":self.cf,
                     "bandwidth_Hz":self.samp_rate,
                     "tx_gain_dB":self.tx_gain,
                     "rx_gain_dB":self.rx_gain,
                     "digital_scaling":self.digital_scale,
                     "K_bins_occupied":self.K,
                     "nfft_bins":self.nfft,
                     "number_fft_avg":self.n_avg,
                     "wait_noise":self.wait_noise,
                     "wait_tx":self.wait_tx,
                     "wait_sig":self.wait_sig,
                     "wait_quit":self.wait_quit }
     logger.info(dict_to_xml(test_params, section_indent+2))        
     
     logger.info("%s</sounding_parameters>", (section_indent+1)*"\t")
     
     # Wait until we are done observing the channel
     done = False
     while not done:
         time.sleep(0.01)
         done = self.post_fft_analysis.SNR_calculation_ready()
     
     # Get the various measurements and write to file
     tx_dpwr    = (self.digital_scale**2)*self.avgpwr
     tx_pwr_eq, rx_pwr_eq = get_pwr_equations( self.cf, self.tx_gain, self.rx_gain ) # returned in dB
     
     snr = [0,]*self.nfft
     sinr= [0,]*self.nfft
     pwr = [0,]*self.nfft
     Np  = [0,]*self.nfft
     Ip  = [0,]*self.nfft
     for n in range(1, self.Lt+1):
         # Get the results
         snr[n] = self.post_fft_analysis.return_SNR_2step(n)
         pwr[n] = self.post_fft_analysis.return_sig_power(n)
         Np[n]   = self.post_fft_analysis.return_noise_power(n)
         Ip[n]   = self.post_fft_analysis.return_odd_bin_power(n)
         sinr[n]= self.post_fft_analysis.return_SNR(n)
         
         logger.info("%s<results>", (section_indent+1)*"\t")
         
         test_params = { "other_node_id":n,
                         "tx_discrete_sig_pwr_dB":(10*log10(tx_dpwr)), 
                         "rx_discrete_sig_pwr_dB":(10*log10(pwr[n])),
                         "rx_discrete_noise_pwr_dB":(10*log10(Np[n])),
                         "rx_discrete_txfloor_pwr_dB":(10*log10(Ip[n])),
                         "tx_analog_sig_pwr_dB":(tx_pwr_eq + 10*log10(tx_dpwr)),
                         "rx_analog_sig_pwr_dB":(rx_pwr_eq + 10*log10(pwr[n])),
                         "rx_analog_noise_pwr_dB":(rx_pwr_eq + 10*log10(Np[n])),
                         "rx_analog_txfloor_pwr_dB":(rx_pwr_eq + 10*log10(Ip[n])),
                         "pathloss_dB":(tx_pwr_eq + 10*log10(tx_dpwr) - (rx_pwr_eq + 10*log10(pwr[n]))),
                         "snr_dB":(10*log10(snr[n])),
                         "signal_to_txfloor_pwr_dB":(10*log10(sinr[n])) }
         logger.info(dict_to_xml(test_params, section_indent+2)) 
         
         logger.info("%s</results>", (section_indent+1)*"\t")
         
     logger.info("%s</channel_sounding>", section_indent*"\t")
    def log_my_settings(self, indent_level,logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''
                
        section_indent = indent_level
        
        # top level transmit section param values
        params = {"multiplexing":"narrowband"}
        logger.info(dict_to_xml(params, section_indent))
    
        # narrowband section start
        logger.info("%s<narrowband>", section_indent*'\t')
        section_indent += 1
        
        # narrowband section param values
        params = {"modulation":self._modulation,
                  "bitrate":self._bitrate,
                  "samples_per_symbol":self.samples_per_symbol(),
                  "differential":self.differential(),
                  "access_code":self._access_code,
                  "coding":self._use_coding,
                  "constellation_points":self._constellation_points,
                  "excess_bw":self._excess_bw,
                  "chbw_factor":self._chbw_factor,
                  "freq_bw":self._freq_bw,
                  "phase_bw":self._phase_bw,
                  "timing_bw":self._timing_bw,
                  "channel_access":self._accesstype}
        
        # add optional params if they exist 
        
        # check for mod code (currently in psk and qam only)
        if "_mod_code" in vars(self.demodulator):
            params["mod_code"] = self.demodulator._mod_code
        
        # check for gain_mu (currently in gmsk only)
        if "_gain_mu" in vars(self.demodulator):
            params["gain_mu"] = self.demodulator._gain_mu
        
        # check for mu (currently in gmsk only)    
        if "_mu" in vars(self.demodulator):
            params["mu"] = self.demodulator._mu
        
        # check for omega_relative_limit (currently in gmsk only)    
        if "_omega_relative_limit" in vars(self.demodulator):
            params["omega_relative_limit"] = self.demodulator._omega_relative_limit
        
        # check for freq_error (currently in gmsk only)    
        if "_freq_error" in vars(self.demodulator):
            params["freq_error"] = self.demodulator._freq_error                                            
                          
        logger.info(dict_to_xml(params, section_indent))
        
        # channel_sensor section start
        logger.info("%s<channel_sensor>", section_indent*'\t')
        section_indent += 1
        
        # vcs section start
        logger.info("%s<vcs>", section_indent*'\t')
        section_indent += 1
        
        # vcs section param values
        params = {"threshold_bits":self.packet_receiver._threshold,
                  "backoff_bits":self.packet_receiver._backoff,
                  "expected_pkt_size":self.packet_receiver._expected_pkt_size}
        logger.info(dict_to_xml(params, section_indent))
                
        # vcs section end
        section_indent -= 1
        logger.info("%s</vcs>", section_indent*'\t')

        
        # pcs section start
        logger.info("%s<pcs>", section_indent*'\t')
        section_indent += 1
        
        # pcs section param values
        params = {"pcsthresh":self._pcsthresh,
                  "pcsalpha":self._pcsalpha,
                  "pcstrain_niter":self._n_iter,
                  "pcstrain_iterlen":self._iter_len,
                  "pcstrain_flag":self._pcstrain_flag,
                  "learned_pcs_threshold":self.probe.get_threshold(),}
        logger.info(dict_to_xml(params, section_indent))
                
        # pcs section end
        section_indent -= 1
        logger.info("%s</pcs>", section_indent*'\t')            
        
        # channel_sensor section end
        section_indent -= 1
        logger.info("%s</channel_sensor>", section_indent*'\t')
        
        
        if self._use_coding == True:
            # Forward error correction section start
            logger.info("%s<forward_error_correction>", section_indent*'\t')
            section_indent += 1
            
            # TODO: change the way coding is implemented so a coding module can be
            # checked for this information, instead of hard coding it
            # Forward error correction section param values
            params = {"scheme":"reed_solomon",
                "code_rate":(4.0/8.0)}
            logger.info(dict_to_xml(params, section_indent))
            
            # Forward error correction section end
            section_indent -= 1
            logger.info("%s</forward_error_correction>", section_indent*'\t') 
               
        # narrowband section end
        section_indent -= 1
        logger.info("%s</narrowband>", section_indent*'\t')
예제 #22
0
    def log_my_settings(self, indent_level, logger):
        '''
        Write out all initial parameter values to XML formatted file
        '''

        section_indent = indent_level

        # top level transmit section param values
        params = {"multiplexing": "narrowband"}
        logger.info(dict_to_xml(params, section_indent))

        # ofdm section start
        logger.info("%s<ofdm>", section_indent * '\t')
        section_indent += 1

        # narrowband section param values
        params = {
            "modulation": self.ofdm_rx._modulation,
            "coding": self.ofdm_rx._use_coding,
            "number_of_subcarriers": self.ofdm_rx._fft_length,
            "number_of_active_subcarriers": self.ofdm_rx._occupied_tones,
            "cp_length": self.ofdm_rx._cp_length,
            "channel_access": self._accesstype
        }
        logger.info(dict_to_xml(params, section_indent))

        # channel_sensor section start
        logger.info("%s<channel_sensor>", section_indent * '\t')
        section_indent += 1

        # vcs section start
        logger.info("%s<vcs>", section_indent * '\t')
        section_indent += 1

        # vcs section param values
        params = {
            "threshold_norm": self.ofdm_rx._vcsthresh,
            "backoff_samples": self.ofdm_rx._vcsbackoff,
            "expected_pkt_size": self.ofdm_rx._expected_pkt_size
        }
        logger.info(dict_to_xml(params, section_indent))

        # vcs section end
        section_indent -= 1
        logger.info("%s</vcs>", section_indent * '\t')

        # pcs section start
        logger.info("%s<pcs>", section_indent * '\t')
        section_indent += 1

        # pcs section param values
        params = {
            "pcsthresh": self._pcsthresh,
            "pcsalpha": self._pcsalpha,
            "pcstrain_niter": self._n_iter,
            "pcstrain_iterlen": self._iter_len,
            "pcstrain_flag": self._pcstrain_flag,
            "learned_pcs_threshold": self.probe.get_threshold(),
        }
        logger.info(dict_to_xml(params, section_indent))

        # pcs section end
        section_indent -= 1
        logger.info("%s</pcs>", section_indent * '\t')

        # channel_sensor section end
        section_indent -= 1
        logger.info("%s</channel_sensor>", section_indent * '\t')

        # ofdm section end
        section_indent -= 1
        logger.info("%s</ofdm>", section_indent * '\t')