test_cdma_tx

「test_cdma_tx」の編集履歴(バックアップ)一覧に戻る

test_cdma_tx - (2011/06/29 (水) 02:25:39) のソース

M系列のみを送信するプログラム。
-gr.glfsr_source_b(int degree, bool repeat, int mask, int seed)
M系列を発生させるブロック。出力はunsigned char(1 or 0)
以下、gr_glfsr_sourceブロックの定義
 int gr_glfsr_source_b::work 	( 	int  	noutput_items,
		gr_vector_const_void_star &  	input_items,
		gr_vector_void_star &  	output_items	 
	) 
ここでgr_vector_void_starはunsigned char型の配列になる。
これを直接mod_bpsk内のgr.packed_to_unpacked_bbに接続してはだめ!
このブロックは入出力をunsigned_charの配列としており、
例えば以下のようになってしまう。
入力:in[0]=1,in[1]=0,in[2]=1,in[3]=1,in[4]=0(計5bytes)
入力をビット列で表すと→00000001 00000000 00000001 00000001 00000000
となり、これが1ビットずつシンボルとなって送られてしまう。
欲しいのはLSBだけ。そこでgr.packded_to_unpacked_bbではなく、gr.unpacked_to_packed_bbを入れる!

-gr.packed_to_unpacked_bbは-1をreturnすることで終わる
 Returns:
    number of items actually written to each output stream, or -1 on EOF.

*送信ビットレートについて
-25Mbit/s以上(bpskの場合)
DA/ADCの性能:100Mサンプル/秒、32bit/サンプル(IQ各16bits)
故に100Mサンプル/秒×32bit=3.2Gbit/秒だが、Gigabit Etheでは送信できないため、
4で間引く(4の倍数で間引ける)と3.2/4=0.8Gbit/秒
その時の帯域は100M/4=25MHz
ということは1秒間に25Mサンプル送れるため、25Mbit/baud(シンボルレート)送れる。
dbpskの場合、最大12.5Mbit/秒(interpolation=4, samples/symbol=2の場合)
-pick_tx_bitrateで決めている。
 def pick_tx_bitrate(bitrate, bits_per_symbol, samples_per_symbol,
                    interp_rate, converter_rate, possible_interps):
    """
    Given the 4 input parameters, return at configuration that matches
    @param bitrate: desired bitrate or None
    @type bitrate: number or None
    @param bits_per_symbol: E.g., BPSK -> 1, QPSK -> 2, 8-PSK -> 3
    @type bits_per_symbol: integer >= 1
    @param samples_per_symbol: samples/baud (aka samples/symbol) #2とかに設定されている。
    @type samples_per_symbol: number or None
    @param interp_rate: USRP interpolation factor #この関数内で決定される。500に決定されている。
    @type interp_rate: integer or None
    @param converter_rate: converter sample rate in Hz #100M[Hz]
    @type converter_rate: number
    @param possible_interps: a list of possible rates #interpolationのとりうる値のリスト
    @type possible_interps: a list of integers
    @returns tuple (bitrate, samples_per_symbol, interp_rate)
    """
dbpskの場合、上の設定だと100kbit/secのビットレートがでる。
100M/500/2=100kbit/sec

*フローを流れるデータの可視化
-gr.glfsr_source_bの出力
gr.glfsr_source_b(4, 0, 9, 1)をgr.uchar_to_floatしてprint_ffした結果
※(int degree, bool repeat, int mask, int seed)
 >>> gr_fir_ccf: using SSE
 dac_rate= 100M
 samples/symbol= 2
 Requested TX Bitrate: 100k Actual Bitrate: 100k
 interp_rates= 500
 noutput_items = 15
 in[0]=1.000000, out[0]=1.000000
 in[1]=1.000000, out[1]=1.000000
 in[2]=1.000000, out[2]=1.000000
 in[3]=1.000000, out[3]=1.000000
 in[4]=0.000000, out[0]=0.000000
 in[5]=1.000000, out[1]=1.000000
 in[6]=0.000000, out[0]=0.000000
 in[7]=1.000000, out[1]=1.000000
 in[8]=1.000000, out[1]=1.000000
 in[9]=0.000000, out[0]=0.000000
 in[10]=0.000000, out[0]=0.000000
 in[11]=1.000000, out[1]=1.000000
 in[12]=0.000000, out[0]=0.000000
 in[13]=0.000000, out[0]=0.000000
 in[14]=0.000000, out[0]=0.000000
-gr.unpacked_to_packed_bb(bits_per_chunk = 1, gr.GR_LSB_FIRST)
 noutput_items = 1
 in[0]=175.000000, out[0]=175.000000
最初の8ビットだけバイトに変換されて175になっている。残りの7ビットは捨てられている。
-modulator(dpbsk)の出力
 noutput_items = 16
 in[0]=0+0j, out[0]=0+0j
 in[1]=-0.00274122+3.35692e-19j, out[1]=-0.00274122+3.35692e-19j
 in[2]=-0.00747827+9.15794e-19j, out[2]=-0.00747827+9.15794e-19j
 in[3]=0.00884763+-1.08349e-18j, out[3]=0.00884763+-1.08349e-18j
 in[4]=-0.00951464+1.16517e-18j, out[4]=-0.00951464+1.16517e-18j
 in[5]=0.00478879+-2.50747e-19j, out[5]=0.00478879+-2.50747e-19j
 in[6]=0.0308129+-2.85757e-18j, out[6]=0.0308129+-2.85757e-18j
 in[7]=-0.0439207+4.29507e-18j, out[7]=-0.0439207+4.29507e-18j
 in[8]=-0.0220481+3.8652e-18j, out[8]=-0.0220481+3.8652e-18j
 in[9]=0.104405+-1.30362e-17j, out[9]=0.104405+-1.30362e-17j
 in[10]=-0.00333149+-2.4496e-18j, out[10]=-0.00333149+-2.4496e-18j
 in[11]=-0.421671+5.62689e-17j, out[11]=-0.421671+5.62689e-17j
 in[12]=-0.970656+1.23648e-16j, out[12]=-0.970656+1.23648e-16j
 in[13]=-1.34466+1.49877e-16j, out[13]=-1.34466+1.49877e-16j
 in[14]=-1.01521+1.21208e-16j, out[14]=-1.01521+1.21208e-16j
 in[15]=-0.00166047+5.93956e-17j, out[15]=-0.00166047+5.93956e-17j
unsigned charである175がもう一度ビット列(10101111)に変換されてそれぞれ変調されている。
*課題
受信端末側でうまく受信できない。オシロスコープで波形を見てみてもごくたまにしかスローブが出てこない。(ほとんど信号がない)
USRPの設定が最適になっていない?→違う!modulatorブロックの中にrccフィルタが入っちゃってるからこの前で拡散しなきゃだめだ!
rrcフィルタの前に置いたけどだめだった。。→解決!フローの中にデータの中身を一々表示するブロックを入れてたのでそれで送信タイミングが送れて
しまっていた!
*ソースコード
-[[test_cdma_tx.py>http://www35.atwiki.jp/space_escalator/pages/66.html]]
-[[spreading_dbpsk.py>http://www35.atwiki.jp/space_escalator/pages/72.html]]

----