This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Multi-Node 802.11a Network Modeling with PHY and MAC

This example shows how to model communication between multiple WLAN nodes containing MAC and PHY using SimEvents®, Stateflow®, and WLAN Toolbox™.

Background

The IEEE® 802.11™ is a set of Medium Access Control (MAC) and Physical layer (PHY) specifications for WLAN implementation. A typical WLAN network will have multiple devices (nodes) sharing the same channel resources. Each node can have different types of applications transmitting or receiving packets from other nodes. As the nodes share the channel, their transmissions may collide or interfere with each other.

Modeling a WLAN network with multiple nodes typically involves modeling of the MAC layer, physical layer, shared communication channel, data traffic pattern, and interference. This example shows how to model a multi-node WLAN network with 802.11a PHY and MAC using discrete event simulation.

Overview

This example models a WLAN network with five nodes. The model outputs various statistics such as the number of transmitted, received, and dropped packets at PHY and MAC layers, and plots that help in analyzing/estimating the node-level and network-level performance.

The modeling includes:

  • Multiple nodes, where each node contains an application, a MAC layer, and a PHY.

  • Packets transmitted over the channel, which is shared across multiple nodes.

  • A Shared channel, which is simulated with following channel impairment options: free-space pathloss, range propagation loss and multi-path fading (using Rayleigh channel model).

  • A node position allocator, which is used to configure the position of nodes in the network.

In the example, nodes 1, 2, and 3 are active participants in the communication, while nodes 4 and 5 passively receive the packets over the channel.

Node

Each node is modeled as a subsystem with a network stack, which includes application, MAC, and physical layers.

  • The application layer generates packets using SimEvents Entity Generator block.

  • The Distributed Coordination Function (DCF) in MAC is modeled as a Discrete Event Chart using Stateflow.

  • The PHY is modeled using SimEvents Discrete Event System block.

  • The shared channel is modeled inside each node in the receive path.

Application Layer

The application layer is implemented to generate and receive application traffic. It is divided into two sub-blocks:

  • AppTrafficGenerator – Uses SimEvents Entity Generator block to generate data packets with configured packet size, inter-packet interval, and destination node. These data packets are passed to the MAC layer.

  • AppTrafficReceiver – Uses SimEvents Entity Terminator block to receive the data packets from MAC layer.

MAC Layer

The MAC layer implements the DCF algorithm specified in section 10.3 of [ 1]. Before transmitting a packet, the MAC layer senses the shared channel to determine the state of the channel. If the channel is idle, packet transmission is initiated. If the channel is busy, packet transmission is deferred. The packets waiting for transmission are queued.

In the model, the MAC layer has two components: Queue Management and Contention Algorithm.

Queue Management

Packets received from the application layer are queued until the channel is available. Packets are dequeued for transmission once the channel becomes available. The size of the queue is configurable. The default queue size is 10.

Contention Algorithm

The contention algorithm, implemented in the MAC layer, is the DCF functionality specified in section 10.3 of [ 1]. It is implemented as a finite state machine with six different states:

  • Idle: No active operations

  • Contend: Contends for the channel

  • Rx: Receives and processes the frame

  • WaitForRx: Waits for a response frame

  • SendingData: Transmits a frame

  • Eifs: Defers transmission for error recovery

State level processing in the MAC layer

  • Initially the MAC layer is in Idle state. On receiving a packet from the application layer, the MAC layer moves to the Contend state.

  • In the Contend state, if the channel is sensed as idle for a period of DCF Inter Frame Space (DIFS) time followed by a random back-off time, the MAC layer moves to the SendingData state.

  • In the SendingData state, a frame is transmitted, and the MAC layer moves to the WaitForRx state.

  • In the WaitForRx state, the MAC layer waits for a period of ACK/CTS timeout. On receiving a response frame, MAC initiates next frame transmission. If a response frame is not received within the timeout period, the frame is re-transmitted.

  • On receiving a Clear Channel Assessment (CCA) as busy from the PHY layer, the MAC layer moves to the Rx state. Frames are received and processed in the Rx state. If an errored frame is received in the Rx state, the MAC layer waits for Extended Inter Frame Space (EIFS) time in the Eifs state. If the frame is intended for other node, Network Allocation Vector (NAV) is updated and transmission is deferred until NAV becomes zero. If the frame is intended to this node, a response frame is sent if needed.

MAC parameters such as RTS threshold, retry limit and data rates are configurable for each node.

Physical Layer and Channel

Transmit Chain:

The MAC layer initiates the transmission by sending a transmission start request containing Tx vector information. On receiving the start request, the PhyTx80211aDES block configures the PHY transmission parameters with the given Tx vector, and sends the transmission start confirm to the MAC layer. The PHY parameters are configured in a non-HT format configuration object of type wlanNonHTConfig. On receiving the start confirm, the MAC layer sends the frame to the PhyTx80211aDES block.

The PhyTx80211aDES block generates a waveform for the MAC frame using wlanWaveformGenerator function. It also scales the samples of waveform with the configured Tx gain. The generated waveform is transmitted through the shared channel.

You can configure the mask properties of Tx power (dBm) and the Tx gain (dB) for the PhyTx80211aDES block.

Channel Impairments Modeling:

Channel impairments determined by free-space path-loss model and Rayleigh multipath fading are added to the transmitted PHY waveform. You can choose to enable or disable these impairment models. In addition to the impairment models, the signal reception range can also be limited by an optional range propagation loss model. To model any of these losses, the channel model must contain both the sender and receiver positions along with the transmitted signal strength. The channel is modeled inside each receiving node, before passing the waveform to the PhyRx80211aDES block.

Receiver Chain:

When the PhyRx80211aDES block receives a waveform, it scales the waveform with the configured Rx gain. The PhyRx80211aDES block then applies thermal noise and interference to the received waveform. This is done by calculating the expected Signal to Interference-plus-noise Ratio (SINR) at the end of preamble, header, and payload. The calculated SINR is added to the preamble, header, and payload of the received waveform as an Additive White Gaussian Noise (AWGN). The PhyRx80211aDES block then compares the waveform power with the Energy Detection (ED) threshold. If the waveform power is greater than the ED threshold, the PHY sends a CCA busy indication to the MAC layer and starts decoding the waveform. Otherwise, the PHY treats the waveform as noise and adds it as interference to the upcoming waveforms for the duration of the current waveform. If an error is found while decoding, the PHY stops further processing of the waveform and sends an error indication to the MAC layer. If the preamble and header are decoded successfully, the PhyRx80211aDES block sends a start indication to the MAC layer. If the payload is also decoded successfully, the payload is passed to the MAC layer along with a success indication.

The Rx gain (dB) and the noise figure (dB) can be configured for the PhyRx80211aDES block.

Node Position Allocator

Node position allocator is used to assign initial position of nodes. It supports linear and list position allocation strategies.

Linear Position Allocation Strategy – Places nodes uniformly in a straight line, on a 2D grid.

List Position Allocation Strategy – Assigns node positions from a list [[x1 y1 z1] [x2 y2 z2] ... [xn yn zn]] such that (xk, yk, zk) is the position of the kth node for all k in (1, 2, ..., n).

Simulation Results

The simulation of this model generates:

  1. A run-time plot depicting the time spent on channel contention, transmission, and reception for each node.

  2. A plot depicting metrics for each node such as – number of transmitted, received, and dropped packets at PHY and MAC layers.

  3. A mat file statistics.mat with detailed statistics obtained at each layer for each node.

Further Exploration

  1. Increase the number of nodes in the network either by copying the existing nodes or by creating a custom node using library blocks.

  2. Vary the application parameters: packet size and packet interval.

  3. Change the MAC parameters: RTS threshold, Tx queue size, data rate, and retry limit.

  4. Change the physical layer parameters: PHY Tx gain, PHY Rx gain, and Rx noise figure.

  5. Vary the channel modeling parameters.

  6. Change the node positions using node position allocator.

  7. Compare the throughput by changing different parameters.

  8. Enable sequence viewer and see the messages exchanged between the nodes and inside components of the node.

Limitations

  1. The MAC layer retransmissions are based on a common retry counter instead of Short Retry Count (SRC) and Long Retry Count (LRC) specified in section 10.3.4.4 of [ 1].

  2. No management frames are exchanged.

  3. The MAC layer in each node maintains a single sequence-number counter for all the frame transmissions, instead of a per-destination counter.

  4. Data rate adaptation at MAC layer is not supported.

  5. MAC Service Data Unit (MSDU) fragmentation is not supported.

  6. The interference is modeled as an AWGN with SINR derived from the signal strength of interfering packets and thermal noise. The interference can also be modeled by combining the IQ samples of interfering signals.

Appendix

This example uses following helper functions and objects:

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