Simulate 802.11ax Network With Custom TGax Channel
This example shows you how to simulate an IEEE® 802.11ax™ network with a custom channel by using WLAN Toolbox™ and the Communications Toolbox™ Wireless Network Simulation Library.
Using this example, you can:
Create and configure an 802.11ax network consisting of an access point (AP) and a station (STA).
Create a custom channel, and plug it into the wireless network simulator.
Simulate the 802.11ax network, and retrieve the statistics of the AP node and the STA node.
Check if the Communications Toolbox Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.
wirelessnetworkSupportPackageCheck
Create a wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create a wlanDeviceConfig
object, specifying these parameters.
Operating mode —
"AP"
Operating frequency band and channel number — [5, 36]
Number of transmit antennas — 1
Channel bandwidth — 20 MHz
apDeviceCfg = wlanDeviceConfig(Mode="AP",BandAndChannel=[5 36], ... NumTransmitAntennas=1,ChannelBandwidth=20e6);
Use this configuration to create an access point and specify its name, position, and physical (PHY) layer abstraction method.
apNode = wlanNode(Name="AP",DeviceConfig=apDeviceCfg,Position=[0 0 0], ... PHYAbstractionMethod="tgax-evaluation-methodology",MACFrameAbstraction=true);
Create a wlanDeviceConfig
object, specifying these parameters.
Operating mode —
"STA"
Operating frequency band and channel number — [5, 36]
Number of transmit antennas — 1
Channel bandwidth — 20 MHz
staDeviceCfg = wlanDeviceConfig(Mode="STA",BandAndChannel=[5 36], ... NumTransmitAntennas=1,ChannelBandwidth=20e6);
Use this configuration to create a station node, and specify its name, position, and PHY abstraction method.
staNode = wlanNode(Name="STA",DeviceConfig=staDeviceCfg,Position=[25 0 0], ... PHYAbstractionMethod="tgax-evaluation-methodology",MACFrameAbstraction=true);
Associate the STA node with the AP node, and configure the downlink full buffer traffic using the associateStations
function.
associateStations(apNode,staNode,FullBufferTraffic="DL");
Add the AP node and STA node to the wireless network simulator.
nodes = [apNode,staNode]; addNodes(networkSimulator,nodes);
Model a static fading 802.11ax™ (TGax) channel by using a residential path loss model to simulate communication between stationary nodes. Ensure these specifications.
Use an abstracted physical layer
The channel remains constant, reflecting the fixed positions of the nodes.
Implement channel reciprocity.
Equip each node with a single antenna and set the bandwidth to 20 MHz.
Use a custom function with this syntax: rxData = customFcnName(rxInfo,txData)
. The rxInfo
input (a structure) is the receiver node information, and the txData
input (a structure) specifies the transmitted packets. The simulator automatically passes information about the receiver node and the packets transmitted by a transmitter node as inputs to the custom function. For more information about this, see the addChannelModel
object function.
% Configure channel chan = wlanTGaxChannel; chan.ChannelBandwidth = "CBW20"; chan.SampleRate = 20e6; chan.DelayProfile = "Model-B"; chan.LargeScaleFadingEffect = "none"; % Model pathloss externally chan.TransmitReceiveDistance = 20; % Distance in meters for non-line-of-sight operation chan.EnvironmentalSpeed = 0; % Stationary channel chan.ChannelFiltering = false; chan.NumSamples = 1; chan.NumTransmitAntennas = 1; chan.NumReceiveAntennas = 1; function rxSig = fadingChannel(rxInfo,txSig,chan) % Apply residential distance-based path loss, as defined in IEEE 802.11-14/0980r16 dist = norm(txSig.TransmitterPosition-rxInfo.Position); % Distance between the nodes dist = max(dist,1); numFloor = 0; % Number of floors penetrated numWall = 0; % Number of walls penetrated dBP = 5; % Breakpoint distance pathLoss = 40.052 + 20*log10((txSig.CenterFrequency/1e9)/2.4) + 20*log10(min(dist,dBP)) + (dist>dBP) * 35*log10(dist/dBP) + 18.3*numFloor^((numFloor+2)/(numFloor+1)-0.46) + 5*numWall; % Obtain path gains pathGains = chan(); % Initialize the received signal structure (rxSig) with the transmitted signal (txSig) rxSig = txSig; % Adjust the power of the received signal to account for path loss rxSig.Power = rxSig.Power-pathLoss; % Retrieve channel information chanInfo = info(chan); % Create a structure to hold relevant channel characteristics channelCharacteristics = struct; channelCharacteristics.PathGains = pathGains; channelCharacteristics.PathFilters = chanInfo.ChannelFilterCoefficients; channelCharacteristics.PathDelays = chanInfo.PathDelays; channelCharacteristics.SampleTimes = txSig.StartTime+chanInfo.PathDelays; rxSig.Metadata.Channel = channelCharacteristics; end addChannelModel(networkSimulator,@(rxInfo,rxSig)fadingChannel(rxInfo,rxSig,chan));
Specify the simulation time in seconds and run the simulation.
simulationTime = 0.5; run(networkSimulator,simulationTime);
Obtain the statistics for the AP node and the STA node.
stats = statistics(nodes);
Determine the AP node throughput in Mbps.
apThroughput = (sum([stats(1).MAC.TransmittedPayloadBytes])*8*1e-6)/simulationTime
apThroughput = 6.6240