wlan hdl time and frequency synchronization -凯发k8网页登录
this example shows how to implement a wlan time and frequency synchronization model that is optimized for hdl code generation and hardware implementation. time and frequency synchronization are the key steps to recover wireless local area network (wlan) packet information.
the model estimates and corrects the time and frequency offsets in the received wlan signal that are introduced by wireless channel and radio frequency (rf) front-end impairments. initially, the model performs coarse time and frequency estimation and corrections on the received signal. then, the model fine tunes the time and frequency estimation and corrections on the received signal to remove any residual offsets. the model supports 20, 40, and 80 mhz bandwidth options for non-high throughput (non-ht), high throughput (ht), very high throughput (vht), and high efficiency (he) frame formats. the example compares the simulink® model output with the matlab® functions by using wlan toolbox™ features.
wlan packet decoding includes these stages: time and frequency synchronization, ofdm demodulation, channel estimation & equalization, format detection, signal decoding, and data decoding.
in this decoding procedure, only the time and frequency synchronization stage can be optimized for hdl code generation. the hdl support is extended for other stages in a future release.
in matlab, run this command to open the example model.
model_name = 'wlanhdltimeandfrequencysynchronization';
open_system(model_name);
the wlantimeandfrequencysynchronization
model contains these subsystems: coarse time sync, coarse cfo estimation and correction, fine time sync, and fine cfo estimation and correction.
in matlab, run this command to open the wlantimeandfrequencysynchronization subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization'],'force');
coarse time synchronization
the coarse time synchronization algorithm implements a double sliding window for correlation as described in the matlab function wlanpacketdetect.m
. the coarse time sync subsystem uses the autocorrelation of legacy short training field (l-stf) symbols to return an estimated packet-start offset. the peak detector subsystem compares the correlation metrics with the energy of the signals and determines the start of the packet. in the next stage, the fine symbol timing detection refines this packet start estimate using the legacy long training field (l-ltf).
in matlab, run this command to open the coarse time sync subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/coarse time sync']);
coarse cfo estimation and correction
considering the start of the packet from the coarse time sync subsystem, coarse cfo estimation and correction subsystem performs autocorrelation on the input using a l-stf and averages the calculated correlation metrics over a window of the l-stf duration. then, the subsystem estimates the carrier frequency offset (cfo) by considering the angle of the resulted metric.
in matlab, run this command to open the coarse cfo estimation subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/coarse cfo estimation and correction/coarse cfo estimation']);
this subsystem uses the cfo estimate to correct the frequency offset.
in matlab, run this command to open the coarse cfo correction subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/coarse cfo estimation and correction/coarse cfo correction']);
fine time synchronization
the fine time sync subsystem takes the coarsely corrected time and frequency offset waveform for fine time offset synchronization. the correlator subsystem cross correlates the received signal with the locally generated l-ltf. the peak searcher subsystem searches the maximum correlation peak and then synchronizes the signal.
in matlab, run this command to open the fine time sync subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/fine time sync']);
fine cfo estimation and correction
the fine cfo estimation and correction subsystem takes a fine time synced waveform as an input for fine tuning the frequency offset. this subsystem estimates and corrects cfo to remove any residue left after coarse frequency correction, performs fine cfo estimation similar to coarse estimation by using the l-ltf instead of the l-stf, and estimates the frequency offset by considering the angle of the averaged correlations.
in matlab, run this command to open the fine cfo estimation subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/fine cfo estimation and correction/fine cfo estimation']);
the fine cfo correction subsystem uses the estimated fine cfo for correcting the residual frequency offset and then outputs the corrected wlan received signal.
in matlab, run this command to open the fine cfo correction subsystem.
open_system([model_name '/wlantimeandfrequencysynchronization/fine cfo estimation and correction/fine cfo correction']);
model interface and verification
the example model accepts the received waveform as an input along with valid and start signals. the model returns a synchronized waveform as an output along with a valid signal. the other outputs in the example include a packet detected flag, a cfo estimate along with its valid and the number of packets detected as an output. cfo estimate is the sum of coarse cfo and fine cfo estimates. the wlanfrontendinit
script provides the input to the model. the wlanwaveformgenerator.m
function in the script generates the vht 20 mhz frame, which is passed through the tgac channel with a delay profile of model a. the additive white gaussian noise (awgn) at 30 db signal-to-noise ratio (snr) is added with other channel impairments of a 10 khz cfo and a timing offset of '25'.
fprintf('\n simulating hdl time and frequency synchronization \n'); out = sim('wlanhdltimeandfrequencysynchronization.slx'); fprintf('\n hdl simulation complete. %d packet detected.',out.numpacketsdetected(end));
simulating hdl time and frequency synchronization hdl simulation complete. 1 packet detected.
the outputs of example are verified by using wlan toolbox functions. specify the same input waveform for the simulink model and its matlab equivalent function and then compare outputs.
fprintf('\n comparing wlan matlab time and frequency synchronization \n') inputwaveformref = inputwaveform(1:end-length(hd.numerator) 1); inputwaveformref = filter(hd.numerator,1,inputwaveformref); % wlan packet detection [startoffset,mn]=wlanpacketdetect(inputwaveformref,cbw); rxwave1 = inputwaveformref(startoffset 1:end); % coarse cfo estimation and correction coarsefreqoff = wlancoarsecfoestimate(rxwave1,cbw); rxwave2 = hwlanfrequencyoffsetcorrect(rxwave1,fs,coarsefreqoff); % fine time synchronization searchbufferlltf = rxwave2(1:wlanconfig.lstflen*10 wlanconfig.lltflen*3); [offset,mn] = wlansymboltimingestimate(searchbufferlltf,cbw); rxwave3 = rxwave2(offset 1:end); % fine cfo estimation and correction ltfs = rxwave3(10*wlanconfig.lstflen (1:wlanconfig.lltflen*2)); finefreqoff = wlanfinecfoestimate(ltfs,cbw); matout = hwlanfrequencyoffsetcorrect(rxwave3,fs,finefreqoff); fprintf('\n matlab simulation complete. \n'); simdata = out.synceddata; simvalid = out.validout; simout = double(simdata(simvalid));
comparing wlan matlab time and frequency synchronization matlab simulation complete.
simulation results
the example synchronizes the time and frequency of the input waveform generated using the wlanfrontendinit.m
script and outputs the time and frequency corrected waveform as shown in this timing diagram.
the timing diagram shows that the output rxout
is synchronized at the start of the l-stf and that the estimated frequency offset is 9.695 khz, which is close to the introduced frequency offset of 10 khz.
comparison of simulink output and matlab reference output
plot(real(matout)); hold on; simout = simout(1:length(matout)); plot(real(simout)); title('comparison of real part of wlan hdl simulink and matlab reference output','fontsize', 10); xlabel('sample number'); ylabel('amplitude'); legend('real part of matlab reference output','real part of simulink output'); figure; plot(imag(matout)); hold on; simout = simout(1:length(matout)); plot(imag(simout)); title('comparison of imaginary part of wlan hdl simulink and matlab reference output','fontsize', 10); xlabel('sample number'); ylabel('amplitude'); legend('imaginary part of matlab reference output','imaginary part of simulink output');
see also
functions
- (wlan toolbox) | (wlan toolbox) | (wlan toolbox) | (wlan toolbox)