MIMO Multiband OFDM 55

Một phần của tài liệu Khảo sát ảnh hưởng của dịch tần đến hệ thống MB-OFDM (Trang 64)

Để tăng tốc đô ̣ dữ liê ̣u và khoảng cách truyền dẫn của hê ̣ thống UWB , sử du ̣ng kỹ thuâ ̣t MIMO là mô ̣t hướng rất hấp dẫn . Hiê ̣n nay, MIMO là phương pháp hiê ̣u quả để cải thiê ̣n hiê ̣u suất hê ̣ thống trong các môi t rường fading. Hầu hết các ứng du ̣ng UWB đều có kênh trong nhà với đô ̣ phân tán ma ̣nh , do đó kỹ thuâ ̣t MIMO rất phù hợp . Thêm nữa, tần số trung tâm của các ứng du ̣ng UWB cỡ GHz (bước sóng nhỏ), do đó khoảng cách giữa các anten MIMO có thể giảm đi . Bởi vâ ̣y , sự kết hơ ̣p công nghê ̣ UWB và MIMO là mô ̣t phương pháp hiê ̣u quả khả thi và hiê ̣u quả về giá cả để thỏa mãn yêu cầu tốc độ dữ liệu rất cao của các ứng du ̣ng vô tuyến trong khoảng cách ngắn tron g tương lai.

TÀI LIỆU THAM KHẢO

[1] W. Pam Siriwongpairat, K. J. Ray Liu, Ultra-Wideband Communications Systems - Multiband OFDM Approach, John Wiley & Sons, Inc, 2008.

[2] Paul H. Moose, A Technique for Orthogonal Frequency Division Multiplexing Frequency Offset Correction, IEEE Transactions on Communications, Vol. 42, No. 10, October 1994, trang 2908 – 2914.

[3] Timothy M. Schmidl, Donald C. Cox, Robust Frequency and Timing Synchronization for OFDM, IEEE Transactions on Communications, Vol. 45, No. 12, December 1997, trang 1613 – 1621.

[4] Chin Wee Yak, Zhongding Lei, Tjeng Thiang Tjhung, Maximum likelihood frequency offset estimation and Cramer Rao bound for ultra-wideband (UWB) multi-band OFDM systems, IEEE Vehicular Technology Conference, VTC 2006 Spring, 7-10 May 2006, trang 1929 – 1934.

[5] B. D. Sahu, Debarati Sen, R. V. Raja Kumar and Saswat Chakrabarti, A Frequency Offset Estimation Scheme for OFDM Based UWB Systems, 2006 IEEE Region 10 Technical Conference (IEEE TECON), 14-17 Nov. 2006, HongKong, trang 1 - 4.

[6] Yinghui Li, Trent Jacobs, and Hlaing Minn, Frequency offset estimation for MB- OFDM-based UWB systems, IEEE International Conference on Communications, 2006, (IEEE ICC '06), vol. 10, Istanbul, June 2006, trang 4729 - 4734.

[7] Debarati Sen, Saswat Chakrabarti, R. V. Raja Kumar, A New Frequency Offset Estimation Scheme For Ultra-Wideband MB-OFDM Systems, IEEE ICACT-2008, Phoenix Park, Korea, Feb. 17-20, 2008, vol. 3, trang 1929 - 1934.

[8] Molisch A.F.; Foerster J.R.; Pendergrass M., Channel Models for Ultrawideband Personal Area Networks, IEEE Wireless Communications, Vol 10, December 2003, trang 14 – 21.

[9] Jian Zhang, Ying Chen, Single Local-Oscillator Solution for Multiband OFDM Systems, IEEE International Conference on Communications, 2007 (ICC '07), Glasgow, 24-28 June 2007, trang 4116 – 4121.

[10] ECMA International, Standard ECMA-368 - High Rate Ultra Wideband PHY and MAC Standard, 3rd Edition - December 2008.

[11] Richard van Nee, Ramjee Prasad, OFDM for Wireless Multimedia Communications, Artech House, 2000.

[12] Yong Soo Cho, et al, MIMO-OFDM Wireless Communications with MATLAB, John Wiley & Sons (Asia) Pte Ltd, 2010.

[13] M. Morelli, U. Mengali, An improved frequency offset estimator for OFDM applications, IEEE Mini-Conference on Communication Theory, Vancouver, BC, 6-10 June 1999, trang 106 - 109.

[14] Meng-Han Hsieh, Che-Ho Wei, A Low-Complexity Frame Synchronization and Frequency Offset Compensation Scheme for OFDM Systems over Fading Channels, IEEE Transactions on Vehicular Technology,Volume 48, Sep 1999, trang 1596 – 1609. [15] Ferdinand Classen, Heinrich Meyr, Frequency Synchronization Algorithms for OFDM Systems suitable for Communication over Frequency Selective Fading Channels, IEEE Vehicular Technology Conference (IEEE VTC), Stockholm, Sweden, 8-10 Jun 1994, vol.3, trang 1655 – 1659.

[16] Y. Li, H. Minn, M.Z. Win, Frequency Offset Estimation for MB-OFDM-Based UWB Systems in Time-Variant Channels, Wireless Communications and Networking Conference, 2007 (IEEE WCNC 2007), Kowloon, Hong Kong, 11 – 15 March 2007, trang 1019 - 1024.

[17] Debarati Sen, Saswat Chakrabarti, R. V. Raja Kumar, An efficient frequency offset estimation scheme for multiband OFDM ultra-wideband systems, IEEE VTC 2008- Spring, Singapore, 11 – 14 May 2008, trang 973 – 977.

[18] Hyun-Seok Ryu, Jun-Seok Lee and Chung G. Kang, BER Analysis of Dual-Carrier Modulation (DCM) over Rayleigh Fading Channel, 2010 International Congress on Ultra Modern Telecommunications and Control Systems and Workshops (ICUMT), October 18 – 20, 2010 Moscow, Russia, trang 717 – 721.

[19] David Tse, Pramod Viswanath, Fundamentals of Wireless Communication, Cambridge University Press, 2005.

[20] Ki-Hong Park, Hyung-Ki Sung, and Young-Chai Ko, BER Analysis of Dual Carrier Modulation Based on ML Decoding, IEEE Asia-Pacific Conference on Communications 2006 (IEEE APCC2006), Aug. 31 - Sept.1, 2006, Busan, Korea, trang 1 – 4.

[21] Sylvain Traverso, et al, Improved Equalization for UWB Multiband OFDM, 2006 International Conference on Information & Communication Technologies: from Theory to Applications (IEEE ICTTA‟06), 24-28 April 2006, Damascus, Syria, trang 2634 – 2638.

[22] Intel White Paper, Wireless USB - The First High-speed Personal Wireless Interconnect, On February 17, 2004, at the Intel Developer Forum. [Online]. Available: http://www.usb.org/wusb/docs/wirelessUSB.pdf

PHỤ LỤC

Các hàm Matlab mô phỏng hệ thống MB -OFDM theo chuẩn ECMA -368. Mô phỏng đươ ̣c thực hiê ̣n trên phiên bản Matlab R2009a hoă ̣c R2009b.

1. Hàm chính để chạy mô phỏng main .m

clear all clc

close all hidden global pSys

sim_type = 0; %0=Simulator; 1=Measurement if (sim_type == 1)

pSys = meas_gui; pause(0.1); close all hidden pause(0.3);

meas_mbo; %generate TX data else

pSys = sim_gui; %open simulator GUI pause(0.1);

close all hidden pause(0.3);

%Tao ra kenh UWB,luu cac he so cua dap ung xung cua kenh vao pSys.h load_chann; %load CIRs

tic sim_mbo; toc end

2. Hàm thực hiện thu phát các packet sim_mbo.m

global pSys stResult; %pSys:chua cac tham so cua he thong, mot so lay tu GUI

stResult = []; %Luu ket qua can quan tam

bin_sink = []; %Luu luong bit thu duoc khi truyen 1 file %Initialize

%Thiet lap cac tham so cua bo phat TX va bo thu RX %pTX:cac tham so cua Tx

%pRX:cac tham so cua Rx [pTX, pRX] = init_par(pSys); %Cap nhat preamble ben phat pTX = update_preamble(pTX);

%Dong bo toc do lay mau trong toan he thong pRX.fs = pSys.fs;

%========================================================================== %Doc du lieu tu file, neu du lieu la 1 file

if pSys.in_type

fid_in = fopen('MIMOTB.jpg');

%Doc file va chuyen thanh ma tran co 8 hang bin_src = de2bi(fread(fid_in),8).';

%pSys.tblen: dong thu 649 trong sim_gui.m

%pSys.k:so bit trong 1 khung du lieu. Dong 713 trong sim_gui.m bin_pad = rand_pad(bin_src(:).',pSys.k-pSys.tblen).';

pSys.Npckt = ceil(numel(bin_pad)/(pSys.k-pSys.tblen)); end

%========================================================================== %Generate WiMax interferer

if pSys.flag_wimax wimax_interf = (10^(- pSys.PL_wimax/20))*add_wimax(pSys.fs,pSys.f_g,pSys.Pt_wimax); else wimax_interf = []; end %========================================================================== %Loop over chann_real

CFO_est_real = zeros(pSys.chann_real,size(pSys.SNR_min:pSys.SNR_max,2)); MSE_real = zeros(pSys.chann_real,size(pSys.SNR_min:pSys.SNR_max,2)); for real_idx = 1:pSys.chann_real

disp(['Channel realisation: ' num2str(real_idx)]) stCalc = []; %

%Neu du lieu ban dau la chuoi so ngau nhien, thi Npckt lay tu giao dien %GUI va do nguoi dung nhap vao o Packets

%pSys.tx_seq = randint(1,1); pSys.tx_seq = ones(1,pSys.Npckt);

%Beaconing interval

%enbl_beac: cho phep beaconing, dong thu 539 trong sim_gui.m if pSys.enbl_beac

[pTX, pRX] = beaconing(pSys,pTX,pRX,wimax_interf,real_idx); end

%Update rate dependent parameters pRX = update_rate_par(pRX);

%Update frequency dependent parameters pTX = update_tx_freq_par(pTX); pRX = update_rx_freq_par(pRX); %Update preamble pTX = update_preamble(pTX); pRX = update_preamble(pRX);

%Loop over Npckt packets

CFO_est_frame = zeros(numel(pSys.tx_seq),size(pSys.SNR_dB,2)); for fr_idx = 1:numel(pSys.tx_seq),

disp(['Packet: ' num2str(fr_idx)])

%Cau truc packet(hay frame,hay PPDU): PLCP Preamble|PLCP header|PSDU %PSDU = Frame Payload|Frame Check Sequence|Tail Bits|Pad Bits

%Update preamble and frame parameters for TX pTX = update_pream_par(pTX, fr_idx);

pTX = update_frame_par(pTX);

%Generate PLCP header per PPDU frame

pTX.plcp_hdr = gen_plcp_hdr(pTX,fr_idx,pTX.rate_mode); %size(pTX.plcp_hdr) = 100 x 12

%================================================================= %Update number of symbols per frame (before TDS and FDS)

%TDS va FDS: ghep xen o mien tan so va mien thoi gian %NGUON DU LIEU

pSys.send = pSys.tx_seq(fr_idx); if pSys.in_type==1

%Du lieu ban dau la file

bin_input = rand_pad(bin_pad((fr_idx-1)*(pSys.k- pSys.tblen)+1:fr_idx*(pSys.k-pSys.tblen)).',pSys.k).';

else

%Du lieu ban dau la chuoi bit ngau nhien co phan bo deu %rand('state',fr_idx);

%pSys.k: dong 716 trong sim_gui.m bin_input = randint(pSys.k,1,2); end

%size(bin_input) = 8224 x 1, trong do 8224 = (p.pcktSize*8 + p.tblen) %p.pcktSize = 1024 (gia tri mac dinh tren GUI): so byte trong Frame Payload

%p.tblen = 32 bit cho Traceback length cua Viterbi Decoder

%================================================================= %Generate Npckt packets per channel realization

%Truyen du lieu toi anten phat

%Xao tron,ghep xen,dieu che bang co so(QPSK hay DCM),ma hoa MIMO,IFFT,chen CP,doi tan len

%BO PHAT TX [bin_scr,bin_enc,payld_mod,packet_tx_ser] = transmit(bin_input, pTX, fr_idx); %size(packet_tx_ser) = 53460 x 1 %================================================================= %Update preamble and frame parameters for RX

pRX = update_pream_par(pRX, fr_idx); pRX = update_frame_par(pRX);

%================================================================= %Pass through a multipath MIMO channel

%Truyen du lieu len kenh vo tuyen UWB %KENH VO TUYEN packet_rx_ser = mimo_channel(packet_tx_ser,pSys.h,pTX.Nt,pRX.Nr,real_idx); %size(packet_rx_ser) = 53460 x 1 %================================================================= %Add WiMax Interference

%Cong nhieu Wimax vao tin hieu %CAN NHIEU DONG KENH

if pSys.flag_wimax if numel(wimax_interf)>size(packet_rx_ser(pRX.pr_border+1:end,:),1) packet_rx_ser(pRX.pr_border+1:end,:) = packet_rx_ser(pRX.pr_border+1:end,:)... + repmat(wimax_interf(1:size(packet_rx_ser(pRX.pr_border+1:end,:),1)),1,pRX.Nr) ; else packet_rx_ser(pRX.pr_border+1:end,:) = packet_rx_ser(pRX.pr_border+1:end,:)... + repmat([wimax_interf; zeros(size(packet_rx_ser(pRX.pr_border+1:end,:),1)- numel(wimax_interf),1)],1,pRX.Nr); end end %=================================================================

%Add AWG noise to the signal %Cong nhieu AWG vao tin hieu

%Thuc hien thu tin hieu tai RX voi cac gia tri SNR khac nhau for snr_idx = 1:size(pSys.SNR_dB,2),

%============================================================= %Add white Gaussian noise

%Cong nhieu AWGN %CAN NHIEU AWGN packet_noisy_ser = add_awgn(packet_rx_ser,pSys.SNR_dB(snr_idx),pSys.perf_CE,pRX.pr_border,pSys.e nbl_awgn); %size(packet_noisy_ser) = 53460 x 1 %============================================================= %Perform down-conversion and baseband processing at RX

%Thu tin hieu tai RX

%Dong bit du lieu luu o bien bin_output %BO THU RX [bin_output,bin_deint,payld_eq,H_info,SNR_dB,H_pwr,E_ch,stSync] = receive(packet_noisy_ser,pRX,fr_idx,1); %size(bin_output) = 8192 x 1 CFO_est_frame(fr_idx,snr_idx) = stSync.CFO_est; %============================================================= %Ve gian do chom sao tin hieu thu tai snr_idx

figure(1) plot(real(payld_eq),imag(payld_eq),'.'); axis([-3 3 -3 3]); grid on %============================================================= %Compute BER per frame

%Tinh ti le loi bit tren moi packet %BER with coding: sau Descrambler

%BER without coding: sau Block Deinterleaving va truoc Viterbi Decoding

stBER =

compute_BER(bin_input,bin_enc,bin_deint,bin_output,pSys.tblen,pSys.dec_type);

%============================================================= %Accummulate results from Packet Detect (PD) and BER

%Gia tri dinh tuong quan cua chuoi PS Seq trong preamble stCalc.peak_max(fr_idx,snr_idx) = stSync.peak_max;

%Packet thu fr_idx da: tach thanh cong (=1) hay chua thanh cong (=0)

stCalc.detect(fr_idx,snr_idx) = stSync.detect; %TFC cua packet thu fr_idx

stCalc.tfc_det(fr_idx,snr_idx) = stSync.tfc_det; %Diem bat dau uoc luong cua packet thu fr_idx

stCalc.border_det(fr_idx,snr_idx) = min(stSync.border_det); %SNR(dB) cua packet thu frm_idx

stCalc.SNR_dB(fr_idx,snr_idx) = SNR_dB;

if pSys.tx_seq(fr_idx) == 1

%So luong bit chua ma hoa bi loi cua packet thu fr_idx stCalc.Err_mtx_uncoded(fr_idx,snr_idx) = stBER.Err_uncoded; %So luong bit da ma hoa bi loi cua packet thu fr_idx

stCalc.Err_mtx_coded(fr_idx,snr_idx) = stBER.Err_coded; end

end %end of snr-loop

%================================================================= if pSys.in_type

bin_sink = vertcat(bin_sink,bin_output); end

end %end of packet-loop

%Tinh BER va SNR voi channel realization thu real_idx %Trung binh tren tat ca cac packet

stResult =

accum_error(real_idx,stCalc,stResult,pSys.sim_type,pSys.k,pSys.tx_seq,numel(b in_enc));

%Tinh CFO uoc luong voi channel realization thu real_idx %Trung binh tren tat ca cac packet

CFO_est_real(real_idx,:) = mean(CFO_est_frame,1);

%Tinh Mean Square Error cua CFO uoc luong voi channel realization thu real_idx

sqr_err = zeros(numel(pSys.tx_seq),size(pSys.SNR_dB,2)); for fr_idx = 1:numel(pSys.tx_seq)

sqr_err(fr_idx,:) = ((pSys.CFO - CFO_est_frame(fr_idx,:))/pSys.CFO).^2; end MSE_real(real_idx,:) = sum(sqr_err,1)/numel(pSys.tx_seq); countReal = real_idx;

end %end of channel realization-loop

%========================================================================== %Neu phat di 1 file,thi ghi du lieu thu duoc ra file

if pSys.in_type

bits = pSys.k - pSys.tblen; dec_sink = bi2de(reshape(bin_sink(1:numel(bin_src)),8,numel(bin_src)/8).'); fid_out = fopen('RXImage.jpg','w+'); fwrite(fid_out,dec_sink); fclose(fid_out); figure ax(1) = subplot(1,2,1); img_in = imread('MIMOTB.jpg');

image(img_in); title('Transmitted Image','FontSize',12) ax(2) = subplot(122);

img_out = imread('RXImage.jpg');

image(img_out); title('Received Image','FontSize',12) %colormap(hot(256)) axis(ax,'off') axis(ax,'image') set(gcf,'Color','White') end %========================================================================== %Ve cac duong cong ket qua can quan tam

%Duong cong BER-SNR(dB) figure(2) mean_real.BER = mean(stResult.av_BER_coded,1); mean_real.SNR = mean(stResult.SNR_dB,1); semilogy(mean_real.SNR,mean_real.BER) xlabel('SNR (dB)'); ylabel('BER'); grid on

%set(gca,'Xtick',0:1:25) xlim([0 25]);

%Duong con MSE-SNR(dB) cua loi uoc luong figure(3) semilogy(stResult.SNR_dB(1,:),MSE_real(1,:)) xlabel('SNR (dB)'); ylabel('MSE'); grid on %set(gca,'Xtick',0:1:25) xlim([0 25]); 3. Bộ phát function [bin_scr,bin_enc,payld_mod,packet_tx_ser] = transmit(bin_input,p,fr_idx) %*********************************************************% %************** Transmit User Data Frame *****************% %*********************************************************% %p: structure of TX parameters

%fr_idx: frame index

init_state = p.seed_mtx(mod(p.init_seed + fr_idx -1,4) + 1,:); %Scramber:bo xao tron du lieu

%Generate 1 x Nx vector of random data points bin_scr = bin_scrambler(bin_input,init_state); %size(bin_scr) = 8224 x 1

%Convolution Coder: bo ma chap

%Encoding bits with a Convolutional Coder

bin_enc = chann_coder(bin_scr,p.base_coderate,p.trellis,p.punc_pat); %size(bin_enc) = 10968 x 1

%Chen them cac bit 0 vao du lieu goc

%Do ghep xen tren khoi 6 OFDM symbol,nen neu bin_enc khong chia het cho 6 %thi phai chen them cac bit 0 vao de du 1 khoi 6 OFDM symbol nua

%pad with random bits to fit interleaver block size

%p.m = log2(p.M): so bit tren moi song mang con sau dieu che QPSK/DCM %p.Ni: So luong song mang du lieu

bin_pad = rand_pad(bin_enc.',6*p.Nsb*p.Ni*p.m).'; %size(bin_pad) = 12000 x 1

%Interleaver: bo ghep xen %Symbol and tone interleaver bin_int =

block_intrlv(bin_pad,p.s_depth,p.s_width,p.t_depth,p.t_width,p.c_shift); %size(bin_int) = 12000 x 1

%Modulation:dieu che bang co so

%Perform Gray-coded QPSK/M-QAM/DCM modulation

payld_mod = constel_map(bin_int,p.mod_type,p.m,p.M,p.Ni); %size(payld_mod) = 6000 x 1

%Chuyen dong bit tu noi tiep sang song song %Serial-to-Parallel Conversion

%So song mang du lieu Nd = 100

payld_par = reshape(payld_mod,p.Ni*p.Nsb,numel(payld_mod)/(p.Ni*p.Nsb)); %size(payld_par) = 100 x 60

%Time- and/or frequency domain spreading payld_spr = spreading(payld_par,p.tds,p.fds,p.PNSeq,p.Ni*p.Nsb); %size(payld_spr) = 100 x 60 % %Spatial multiplexing/ STFC payld_cod = mimo_code(payld_spr,p.mimo_type,p.Nt,p.Ni,p.theta); %size(payld_cod) = 100 x 60 %

%Reshape back to single parallel blocks

payld_cod = reshape(payld_cod, p.Ni, numel(payld_cod)/p.Ni); %size(payld_cod) = 100 x 60 Frame Payload

%

%Generate pilots

%So song mang pilot Np = 12 pilots =

gen_pilots(p.tds,p.fds,p.PNSeq,p.Npil,p.pil_cs,p.pil_ncs,p.Nhdr+size(payld_co d,2));

%size(pilots) = 12 x 72

%Gan PLCP Header vao Frame Payload va anh xa song mang con %Tone mapping

%Data: 100, Pilot: 12, Guard: 10, Null: 6 payld_tones = tone_map([p.plcp_hdr payld_cod],pilots,p.mimo_type,p.Nt,p.Nhdr,p.N,p.Nsb); %size(p.plcp_hdr) = 100 x 12 PLCP Header %size(payld_tones) = 128 x 72 % %N-point IFFT payld_iq = sqrt(p.N*p.Nsb).*ifft([CE_map(p.CESeq,p.N,p.Nsb) payld_tones],p.N*p.Nsb);

%size(CE_map(p.CESeq,p.N,p.Nsb)) = 128 x 1 Channel Estimation Sequence %Channel Estimation Sequence: gia tri o bang 23 trang 44 trong ECMA-368 %size(payld_iq) = 128 x 73

%Chen CP hoac ZP = 60.6 ns

%Append CP or Zero Padding, p.pref_type: prefix/suffix type, 0=CP, 1=ZP payld_zp = add_pref([p.PSSeq_mtx(:,p.tfc)

payld_iq],p.pref_type,p.N,p.G,p.Nsb);

%size(p.PSSeq_mtx(:,p.tfc)) = 128 x 1 Extended Base Sequence (Packet Synchronization Seq)

%Extended Base Sequence: gia tri o bang 4 -> 13 trang 25 -> 34 trong ECMA-368 %size(payld_zp) = 165 x 74, trong do 165 = (Nfft=128)+(Nzps=37)

%PLCP Header: cot 3 -> 14, Frame Payload: cot 15 -> 74

%Nhan xet: Extended Base Sequence (Packet Synchronization Seq) duoc chen %vao sau buoc IFFT, dieu nay giup RX co the thuc hien dong bo truc tiep %ngay sau khi doi tan xuong (downconvert)

%Xu ly da van toc hay thay doi toc do lay mau %Muc dich: bu lai dich tan lay mau SFO

%interpolated by p.fs and then decimated by p.Nsb*p.B

%Thay doi toc do lay mau boi mot he so p.oversamp = p.fs/(p.Nsb*p.B) = 3 %Giua 2 mau cua payld_zp chen them 2 mau

%p.Nsb: number of parallel sub-bands, p.B: Bandwidth of sub-bands, here B=528 MHz

%Up-sampling

payld_res = resample(payld_zp,p.fs,p.Nsb*p.B); %size(payld_res) = 495 x 74 => Nframe = 74

%Chuan hoa cong suat cua moi ky hieu

%Normalize transmit power per MB-OFDM symbol

sigma_s = std(payld_res,0,1); %do lech chuan cua payld_res theo cot for s = 1:size(payld_res,2) %so cot cua payld_res

if sigma_s(s) ~= 0

payld_res(:,s) = payld_res(:,s)./sigma_s(s); end

end

%Chen preamble (Packet/Frame Synch, CE sequence), PLCP header vao truoc PSDU %Packetize

%p.Nce = 6, p.Nhdr = 12

packet_iq = packetize(payld_res,p.Nt,p.Nce,p.Nhdr,p.tfc,p.cov_seq); %size(packet_iq) = 495 x 102

%Packet/Frane Synchronization cot 01 -> 24 %Channel Estimation Sequence cot 25 -> 30 %PLCP Header cot 31 -> 42 %Frame Payload cot 43 -> 102 %

%Introduce TX I/Q Imbalance and PN(inverted phase imbalance for TX) packet_imp = add_iq_imbal(packet_iq,p.g_tx,-p.phi_tx);

packet_imp = add_pn(packet_imp,p.var_tx,p.alpha_tx);

%Phan khoi du lieu thanh Nt luong noi tiep truyen toi Nt anten %Xep chong cac cot cua packet_iq len nhau,cu the nhu sau

% 00001 packet_iq(:,01) |---

% ... |Packet/Frane Synchronization % 11880 packet_iq(:,24) |---

% 11881 packet_iq(:,25) |---

% ... |Channel Estimation Sequence % 14850 packet_iq(:,30) |--- % 14851 packet_iq(:,31) |--- % ... |PLCP Header % 20790 packet_iq(:,42) |--- % 20791 packet_iq(:,43) |--- % ... |Frame Payload % 50490 packet_iq(:,102)|---

%Resize transmit block to Nt serial streams packet_iq_ser = par2ser(packet_imp,p.Nt); %size(packet_iq_ser) = 50490 x 1

%Dieu che len dai tan cua Band Group #1 (cac dai con 1,2,3) %Up-conversion

samp = size(packet_imp,1); %So hang cua packet_imp

packet_tx_ser = zeros(size(packet_iq_ser)); %ma tran cot: X hang va 1 cot %p.Nt:so anten phat

for nt = 1:p.Nt

%Ma tran Band_ID cho Band Group 1 bandID_mtx = p.bandID_tx_mtx{nt}(:,:); packet_tx_ser(:,nt) = upconvert(packet_iq_ser(:,nt),p.Fc,bandID_mtx,p.tfc,p.fc_tx_vec(nt,:),samp,p. fs); %Bandpass filter

%bp_flt = dfilt.dffir(fir1(80, [p.f_tx_min, p.f_tx_max] .* (2/p.fs))); %packet_tx_ser = filter(bp_flt,packet_tx_ser);

%Dieu chinh cong suat phat cho phu hop voi PSD mask trong ECMA-368 %Match signal power to allowed PSD

packet_tx_ser(:,nt) = (1/sqrt(p.Nt)).* sqrt ( 10^(-

41.3/10)*((p.f_tx_max(nt)-p.f_tx_min(nt))/1e+9) * 50) .* packet_tx_ser(:,nt); end

%size(packet_tx_ser) = 50490 x 1 %

%Chain loss compensation

packet_tx_ser = 10^(p.losscomp_db/10).*packet_tx_ser; %

%Calculate PAPR (crest factor) per antenna in dB PAPR_dB =

20*log10(max(abs(packet_tx_ser),[],1)./sqrt(sum(packet_tx_ser.*conj(packet_tx _ser))/size(packet_tx_ser,1)));

%Chen fr_sep_sym = 6 symbol giua 2 packet %Insert fr_sep_sym between packets

%samp = 495: so bit/1 symbol packet_tx_ser = [packet_tx_ser;

zeros(p.fr_sep_sym*samp,size(packet_tx_ser,2))];

%size(packet_tx_ser) = 53460 x 1, trong do fr_sep_sym*samp = 6 x 495 = 2970 %53460 x 1 = 495 x (108 = 102 + 6) 4. Bộ thu function [bin_output,bin_deint,payld_eq,H_info,SNR_dB,H_pwr_av,E_ch,s]= receive(data_ser_in,p,fr_idx,offset) %*********************************************************% %******************* RX Synchronization ******************% %*********************************************************%

s.detect = 0; %da tach thanh cong packet hay chua? 1=thanh cong, 0=chua s.tfc_det = p.tfc;

s.border_det = 1;

s.CFO_est = 0; %Gia tri CFO duoc uoc luong

upsamp = ceil(p.samp*p.oversamp); %samples within an RF OFDM symbol syncSamp = p.sync_sym*upsamp; %number of synchronization samples payldSamp = p.payld_sym*upsamp; %number of payload samples

fr_len = syncSamp + payldSamp; %frame length in samples

fr_sep = p.fr_sep_sym*upsamp; %number of frame separation samples fr_start = offset; %diem bat dau cua frame (hay packet) fr_end = fr_start + fr_len - 1; %diem ket thuc cua frame

%size(data_ser_in) = 53460 x 1 rx_pad = upsamp;

data_ser_in = [ data_ser_in; zeros(rx_pad, p.Nr) ]; %Chen them upsamp bit 0 de lam gi???

%size(data_ser_in) = 53955 x 1 end_idx = size(data_ser_in,1); %flag RX hopping on/off

%Xac dinh tren GUI, muc TFH trong RX

%RX co biet truoc TFC o TX khong? known = 1, unknown = 0 enbl_hop = p.hop_rx;

if fr_end + fr_sep > end_idx

error('Insufficient amount of data for down-conversion. Simulation

Một phần của tài liệu Khảo sát ảnh hưởng của dịch tần đến hệ thống MB-OFDM (Trang 64)

Tải bản đầy đủ (PDF)

(81 trang)