addChannelModel
Download Required: To use addChannelModel
,
first download the Communications Toolbox Wireless Network Simulation Library add-on.
Description
addChannelModel(
adds a custom channel model or path loss model to the wireless network simulation. The
networkSimulator
,customMdl
)addChannelModel
function sets the ChannelFunction
property of the wirelessNetworkSimulator
object to the custom model that you specified by
customMdl
.
Examples
Simulate Bluetooth BR Network without Channel Effects
Create a wirelessNetworkSimulator
object.
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.
addNodes(networkSimulator,[centralNode peripheralNode]);
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.
addChannelModel(networkSimulator,@removeChannelEffect);
Specify the simulation time in seconds.
simulationTime = 0.05;
Run the simulation for the specified simulation time.
run(networkSimulator,simulationTime);
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
Input Arguments
networkSimulator
— Wireless network simulator
wirelessNetworkSimulator
object
Wireless network simulator, specified as a wirelessNetworkSimulator
object.
customMdl
— Function for computing custom channel or path loss model
function handle
Function for computing the custom channel or path loss model, specified as a function handle. The syntax for the custom function must be of the format:
rxData = customFcnName(rxInfo,txData)
The 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.
Field | Description |
ID | Unique receiver node identifier. |
Position | Position of the receiver node in 3-D Cartesian coordinates
(x , y , z ). Units are
in meters. |
Velocity | Velocity of the receiver node
(Vrx ,
Vry ,
Vrz ) in the x -,
y -, and z -directions. Units are in
meters per second. |
NumReceiveAntennas | Number of antennas at the receiver. |
The packets from the transmitter node is a structure with these fields.
Field | Description |
Type | Type of input signal packet, specified as one of these values: 0, 1, 2, 3, and 4.
|
TransmitterID | Unique transmitter node identifier, specified as a positive scalar integer. |
TransmitterPosition | Position of the transmitter node in 3-D Cartesian coordinates
(x , y , z ). Units
are in meters. |
TransmitterVelocity | Velocity of the transmitter node
(Vtx ,
Vty ,
Vtz ) in the
x -, y -, and
z -directions. Units are in meters per second. |
StartTime | Time at which the transmitter starts transmitting the packets, specified as a nonnegative scalar. Units are in seconds. |
Duration | Duration of the transmitter packet, specified as a positive scalar. Units are in seconds. |
Power | Power of the waveform. Units are in dBm. |
CenterFrequency | Center frequency of the carrier signal. Units are in Hz. |
Bandwidth | Carrier signal bandwidth. Units are in Hz. |
Abstraction | Type of abstraction, specified as a logical scalar.
The default value is 0. |
SampleRate | Sample rate of the packet, specified as a numeric scalar in samples per
second. This field is applicable only if the value of the
Abstraction field is set to 0. The default value is [
]. |
DirectToDestination | Information about the transmitted packet, specified as a numeric scalar integer.
|
Data | Time-domain samples or frame information.
|
Metadata | 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 ofAbstraction
isfalse
.Metadata.Channel
— Update this field when you use a channel estimation algorithm that requires perfect channel information. If the value ofAbstraction
istrue
, 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.
Data Types: function_handle
Version History
Introduced in R2022bR2023a: Moved to Communications Toolbox Wireless Network Simulation Library from Bluetooth Toolbox
Previously, this wirelessNetworkSimulator
object function required Bluetooth® Toolbox.
See Also
Objects
Functions
Topics
- 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)
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)