Add custom channel or path loss model
Download Required: To use
first download the Communications Toolbox Wireless Network Simulation Library add-on.
Simulate Bluetooth BR Network without Channel Effects
networkSimulator = wirelessNetworkSimulator.init();
Create two Bluetooth BR nodes, one with the
"central" role and other with the
"peripheral" role. Specify the position of the Peripheral node in meters.
centralNode = bluetoothNode("central"); peripheralNode = bluetoothNode("peripheral",Position=[1 0 0]);
Create a default Bluetooth BR connection configuration object to configure and share a connection between Bluetooth BR Central and Peripheral nodes.
cfgConnection = bluetoothConnectionConfig;
Configure connection between the Central and the Peripheral nodes.
connection = configureConnection(cfgConnection,centralNode,peripheralNode);
Create and configure a
networkTrafficOnOff object to generate an On-Off application traffic pattern.
traffic = networkTrafficOnOff(DataRate=200,PacketSize=27, ... GeneratePacket=true,OnTime=inf);
Add application traffic from the Central to the Peripheral node.
addTrafficSource(centralNode,traffic, ... DestinationNode=peripheralNode);
Add the Central and Peripheral nodes to the wireless network simulator.
By default, the
wirelessNetworkSimulator object applies free-space path loss model for the channel effects. You can add custom channel effects by using the
addChannelModel function. However, to model the channel without any channel effects, specify a custom MATLAB™ function, removeChannelEffect, in which the input transmitted packets are returned at the output without any changes.
Specify the simulation time in seconds.
simulationTime = 0.05;
Run the simulation for the specified simulation time.
Retrieve application, baseband, and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes.
centralStats = statistics(centralNode)
centralStats = struct with fields: Name: "Node1" ID: 1 App: [1x1 struct] Baseband: [1x1 struct] PHY: [1x1 struct]
peripheralStats = statistics(peripheralNode)
peripheralStats = struct with fields: Name: "Node2" ID: 2 App: [1x1 struct] Baseband: [1x1 struct] PHY: [1x1 struct]
function outputData = removeChannelEffect(~,txData) outputData = txData; end
networkSimulator — Wireless network simulator
Wireless network simulator, specified as a
customMdl — Function for computing custom channel or path loss model
MATLAB function handle
Function for computing the custom channel or path loss model, specified as a MATLAB® function handle. The syntax for the custom function must be of the format:
rxData = customFcnName(rxInfo,txData)
rxInfo input is the receiver node information, and the
txData input 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.
The receiver node information is a structure with these fields.
|Unique receiver node identifier.|
|Position of the receiver node in 3-D Cartesian coordinates
|Velocity of the receiver node
|Number of antennas at the receiver.|
The packets from the transmitter node is a structure with these fields.
Type of input signal packet, specified as one of these values: 0, 1, 2, 3, and 4.
|Unique transmitter node identifier, specified as a positive scalar integer.|
|Position of the transmitter node in 3-D Cartesian coordinates
|Velocity of the transmitter node
|Time at which the transmitter starts transmitting the packets, specified as a nonnegative scalar. Units are in seconds.|
|Duration of the transmitter packet, specified as a positive scalar. Units are in seconds.|
|Power of the waveform. Units are in dBm.|
|Center frequency of the carrier signal. Units are in Hz.|
|Carrier signal bandwidth. Units are in Hz.|
Type of abstraction, specified as a logical scalar.
The default value is 0.
|Sample rate of the packet, specified as a numeric scalar in samples per
second. This field is applicable only if the value of the
Information about the transmitted packet, specified as a numeric scalar integer.
Time-domain samples or frame information.
A structure representing the technology-specific and abstraction-specific information of the packet. The structure contains this field.
The custom channel model function applies channel effects to the packets transmitted by the simulator. The modified packets are then sent back to the simulator. The packets returned at the output must be a structure with same fields as those of the transmitted packets.
The custom channel model function must update these fields in the transmitted packet to include channel effects.
Power— Include large-scale effects.
Data— Include small and large-scale effects by scaling the data if the value of
Metadata.Channel— Update this field when you use a channel estimation algorithm that requires perfect channel information. If the value of
true, you must update this field.
Duration— Include the final transient in the calculation of the duration of the channel-impaired packet, which equals actual packet duration + final transient. The final transient equals delay spread + filter length – implementation delay. Updating this field is optional.
Version HistoryIntroduced in R2022b
- Working of Wireless Network Simulator
- Plug Custom Channel into Wireless Network Simulator
- Create, Configure, and Simulate Bluetooth BR/EDR Piconet (Bluetooth Toolbox)
- Bluetooth BR/EDR Data and Voice Communication with WLAN Signal Interference (Bluetooth Toolbox)
- Simulate Multiple Bluetooth BR/EDR Piconets with ACL Traffic (Bluetooth Toolbox)
- NR Cell Performance Evaluation with MIMO (5G Toolbox)
- Get Started with WLAN System-Level Simulation in MATLAB (WLAN Toolbox)
- 802.11ax Multinode System-Level Simulation of Residential Scenario (WLAN Toolbox)