main content

802.11ac waveform generation with mac frames -凯发k8网页登录

this example shows how to generate an ieee® 802.11ac™ transmission containing mac frames suitable for performing radio packet error rate (per) receiver tests.

introduction

wlan toolbox™ can be used to generate standard compliant waveforms for performing receiver tests. a basic wlan receiver test scenario is shown in the diagram below.

the device under test (dut) is stimulated with rf test vectors, usually through a wired link. the packet error rate (per) is a metric used to test the performance of a receiver at a given receive signal power in the presence of noise, interference, or other impairments. the per is defined as the number of incorrectly decoded packets divided by the total number of transmitted packets.

the frame check sequence (fcs) within a mac frame is used to determine whether a mac frame has been decoded correctly by the receiver, and therefore whether the packet has been received in error. the general mac frame for ieee 802.11ac contains the following fields:

  • mac header

  • frame body

  • fcs

the data to transmit from a higher layer is contained within the frame body of the mac frame. the transmitter uses a cyclic redundancy check over the mac header and frame body field to generate the fcs value. the receiver calculates the crc and compares this to the received fcs field to determine if an error has occurred during transmission.

in this example an ieee 802.11ac waveform consisting of multiple vht format packets is generated. the function can be used to generate a waveform containing one or more packets. the wlanwaveformgenerator function consumes physical layer service data units (psdus) for each packet and performs the appropriate physical layer processing to create the waveform. a psdu containing a mac header and valid fcs can be generated using the function. in this example a multi-packet baseband waveform containing mac packets is synthesized. this waveform may be downloaded to a signal generator for rf transmission and used for receiver per testing. source code is provided to download and play the waveform using a keysight technologies™ n5172b signal generator. the example processing is illustrated in the following diagram:

802.11ac vht format configuration

the format-specific configuration of a vht waveform synthesized with the wlanwaveformgenerator function is described by the vht format configuration object, . the properties of the object contain the configuration. in this example an object is configured for a 160 mhz bandwidth, 1 transmit antenna, 1 space-time stream and qpsk rate 1/2 (mcs 1).

vhtcfg = wlanvhtconfig;             % create packet configuration
vhtcfg.channelbandwidth = 'cbw160'; % 160 mhz channel bandwidth
vhtcfg.numtransmitantennas = 1;     % 1 transmit antenna
vhtcfg.numspacetimestreams = 1;     % 1 space-time stream
vhtcfg.mcs = 1;                     % modulation: qpsk rate: 1/2

waveform generation configuration

the wlanwaveformgenerator function can be configured to generate one or more packets and add an idle time between each packet. the function can be configured to generate an oversampled or nominal rate waveform. in this example four oversampled packets with a 20 microsecond idle period will be created.

numpackets = 4;   % generate 4 packets
idletime = 20e-6; % 20 microseconds idle period after packet
oversamplingfactor = 1.5; % oversample waveform 1.5x nominal baseband rate

the psdu transmitted in each packet is scrambled using a random seed for each packet. this is accomplished by specifying a vector of scrambler initialization seeds. the valid range of the seed is between 1 and 127 inclusive.

% initialize the scrambler with a random integer for each packet
scramblerinitialization = randi([1 127],numpackets,1);

create a psdu for each packet

for an ieee 802.11ac data transmission the mac frame is termed a mac protocol data unit (mpdu), the mac header is termed the mpdu header, and the frame body is an aggregated mac service data unit (a-msdu). one or more mpdus are delimited, padded and aggregated to create an aggregated mpdu (a-mpdu). the a-mpdu is delimited and padded to form the physical layer service data unit (psdu) which is coded and modulated to create the transmitted packet. this process of encapsulation is shown in the following diagram:

in this example a psdu is created containing a single mpdu for each packet. the mpdu consists of an mpdu header, a-msdu frame containing concatenated a-msdu subframes with random data and valid fcs. the wlanmacframe function creates an a-mpdu with eof delimiters and padding, i.e. the psdu, as specified in [ 1 ]. it also returns the length of the a-mpdu, termed as the apep length, which is used to set the apeplength property of the vht configuration object. a psdu is generated for each packet and is concatenated into a vector data for transmission with the wlanwaveformgenerator function. the processing to create the concatenated psdu bits data is shown in the diagram below:

% create frame configuration
maccfg = wlanmacframeconfig('frametype', 'qos data');
maccfg.frameformat = 'vht';     % frame format
maccfg.msduaggregation = true;  % form a-msdus internally
bitsperbyte = 8;                % number of bits in 1 byte
data = [];
for i=1:numpackets
    % get msdu lengths to create a random payload for forming an a-mpdu of
    % 4048 octets (pre-eof padding)
    msdulengths = wlanmsdulengths(4048, maccfg, vhtcfg);
    msdu = cell(numel(msdulengths), 1);
    
    % create msdus with the obtained lengths
    for j = 1:numel(msdulengths)
        msdu{j} = randi([0 255], 1, msdulengths(j));
    end
    
    % generate psdu bits containing a-mpdu with eof delimiters and padding
    [psdu, apeplength] = wlanmacframe(msdu, maccfg, vhtcfg, 'outputformat', 'bits');
    
    % set the apep length in the vht configuration
    vhtcfg.apeplength = apeplength;
    
    % concatenate packet psdus for waveform generation
    data = [data; psdu]; %#ok
end

generate a baseband waveform

the concatenated psdu bits for all packets, data, are passed as an argument to the wlanwaveformgenerator function along with the vht packet configuration object vhtcfg. this configures the waveform generator to synthesize an 802.11ac vht waveform. to generate 802.11n™ ht or other format waveforms, use a different format configuration object, for example or . the waveform generator is additionally configured using name-value pairs to generate multiple oversampled packets with a specified idle time between packets, and initial scrambler states.

% generate baseband vht packets
txwaveform = wlanwaveformgenerator(data,vhtcfg, ...
    'numpackets',numpackets,'idletime',idletime, ...
    'scramblerinitialization',scramblerinitialization, ...
    'oversamplingfactor',oversamplingfactor);
fs = wlansamplerate(vhtcfg,'oversamplingfactor',oversamplingfactor);
disp(['baseband sampling rate: ' num2str(fs/1e6) ' msps']);
baseband sampling rate: 240 msps

the magnitude of the baseband waveform is displayed below. note the number of packets and idle time configured.

figure;
plot(abs(txwaveform));
xlabel('sample index');
ylabel('magnitude');
title('baseband ieee 802.11ac waveform');
legend('transmit antenna 1');

figure contains an axes object. the axes object with title baseband ieee 802.11ac waveform, xlabel sample index, ylabel magnitude contains an object of type line. this object represents transmit antenna 1.

view the frequency spectrum of the generated time domain waveform by using the dsp system toolbox . as expected, the 160 mhz signal bandwidth is clearly visible.

spectrumscope = spectrumanalyzer;
spectrumscope.samplerate = fs;
spectrumscope.spectrumtype = 'power-density';
spectrumscope.rbwsource = 'property';
spectrumscope.rbw = 100e3;
spectrumscope.averagingmethod = 'exponential';
spectrumanalyze.forgettingfactor = 0.99;
spectrumscope.ylabel = 'psd';
spectrumscope.title = 'baseband ieee 802.11ac waveform';
spectrumscope(txwaveform);
release(spectrumscope)

generate over-the-air signal using an rf signal generator

the baseband waveform created by wlan toolbox can now be downloaded to a signal generator to perform receiver tests. use instrument control toolbox to generate an rf signal with a center frequency of 5.25 ghz rf using the keysight technologies n5172b signal generator.

% control whether to download the waveform to the waveform generator
playovertheair = false;
% download the baseband iq waveform to the instrument. generate the rf
% signal at a center frequency of 5.25 ghz and output power of -10 dbm.
if playovertheair
    fc = 5.25e9; %#ok % center frequency
    power = -10;     % output power
    loopcount = inf; % number time to loop
    
    % configure the signal generator, download the waveform and loop
    rf = rfsiggen();
    rf.resource = 'tcpip0::192.168.0.1::inst0::instr';
    rf.driver = 'agrfsiggen';
    connect(rf);                  % connect to the instrument
    download(rf,txwaveform.',fs); % download the waveform to the instrument
    start(rf,fc,power,loopcount); % start transmitting waveform
    
    % when you have finished transmitting, stop the waveform output
    stop(rf);
    disconnect(rf);
end

selected bibliography

  1. ieee std 802.11™-2016 ieee standard for information technology - telecommunications and information exchange between systems - local and metropolitan area networks - specific requirements - part 11: wireless lan medium access control (mac) and physical layer (phy) specifications.

网站地图