benchmark_rx.py

フロー

Source → LPF → dbpsk demodulator → descrambler → access code correlator → Sink

usrpソースの作成

self.u = usrp_options.create_usrp_source(options)
  • self.u.set_decim(self._decim)
options.bitrate, self._demod_class.bits_per_symbol(),
options.samples_per_symbol, options.decim, adc_rate,
から最適なdecimationを決定した後、この関数でそれをセットする。

LPFの作成

self.channel_filter = gr.fft_filter_ccc(sw_decim, chan_coeffs)
必要な帯域を取得する

搬送波をセンシングする

self.probe = gr.probe_avg_mag_sqrd_c(thresh,alpha)
  • thresh :in dB, will have to adjust
こいつはlpfの次に入っていて、フローグラフからははぶられている。

Demodulator

  • multiply_const_cc
#Automatic gain control
scale = (1.0/16384.0)
self.pre_scaler = gr.multiply_const_cc(scale)   # scale the signal from full-range to +-1
受信信号を+1から-1の範囲で正規化
  • gr.feedforward_agc_cc
#self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
self.agc = gr.feedforward_agc_cc(16, 2.0)
  • gr.interp_fir_filter_ccf
# RRC data filter
ntaps = 11 * samples_per_symbol
self.rrc_taps = gr.firdes.root_raised_cosine(
           1.0,                      # gain
           self._samples_per_symbol, # sampling rate
           1.0,                      # symbol rate
           self._excess_bw,          # excess bandwidth (roll-off factor)
           ntaps)
self.rrc_filter=gr.interp_fir_filter_ccf(1, self.rrc_taps)        
波形整フィルタ
  • gr.mpsk_receiver_cc
# symbol clock recovery
if not self._mm_gain_mu:
self._mm_gain_mu = 0.1
           
self._mm_omega = self._samples_per_symbol
self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu
self._costas_beta  = 0.25 * self._costas_alpha * self._costas_alpha
fmin = -0.1
fmax = 0.1
       
self.receiver=gr.mpsk_receiver_cc(arity, 0,
                                  self._costas_alpha, self._costas_beta,
                                  fmin, fmax,
                                  self._mm_mu, self._mm_gain_mu,
                                  self._mm_omega, self._mm_gain_omega,
                                  self._mm_omega_relative_limit)
# Do differential decoding based on phase change of symbols
self.diffdec = gr.diff_phasor_cc()
差分位相偏移変調
# find closest constellation point
rot = 1
rotated_const = map(lambda pt: pt * rot, psk.constellation[arity])
self.slicer = gr.constellation_decoder_cb(rotated_const, range(arity))
スライサー:ある入力信号において、ユークリッド距離が一番近いコンステレーションポイントが選ばれる。
bpskの場合は1or-1に近い方からそれぞれ1,0が選ばれる。
  • gr.map_bb
if self._gray_code:
    self.symbol_mapper = gr.map_bb(psk.gray_to_binary[arity])
else:
    self.symbol_mapper = gr.map_bb(psk.ungray_to_binary[arity])
  • gr.unpack_k_bits_bb
# unpack the k bit vector into a stream of bits
self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol())
送信されたビット列をバイト列にまとめる。

相関器

self.correlator = gr.correlate_access_code_bb(access_code, threshold)
@param access_code: AKA sync vector
@type access_code: string of 1's and 0's
@param threshold: detect access_code with up to threshold bits wrong (-1 -> use default) #間違っていいビット数
@type threshold: int
gr.correlate_access_code_bb.h
*!
* \brief Examine input for specified access code, one bit at a time.
* \ingroup sync_blk
*
* input:  stream of bits, 1 bit per input byte (data in LSB)
* output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit)
*
* Each output byte contains two valid bits, the data bit, and the
* flag bit.  The LSB (bit 0) is the data bit, and is the original
* input data, delayed 64 bits.  Bit 1 is the
* flag bit and is 1 if the corresponding data bit is the first data
* bit following the access code. Otherwise the flag bit is 0.
*/

シンクの作成

self.framer_sink = gr.framer_sink_1(self._rcvd_pktq)

最終更新:2011年12月15日 02:59