addMeshPath
Download Required: To use addMeshPath
,
first download the Communications Toolbox Wireless Network Simulation Library add-on.
Syntax
Description
addMeshPath(
sets the destination node, sourceNode
,destinationNode
)destinationNode
, as an immediate mesh
receiver for the source node, sourceNode
.
addMeshPath(
specifies the mesh node, sourceNode
,destinationNode
,meshPathNode
)meshPathNode
, to which
sourceNode
sends packets as it attempts to communicate with
destinationNode
.
addMeshPath(___,
specifies options using one or more name-value arguments, in addition to any input argument
combination from the previous syntaxes.Name=Value
)
Examples
Create, Configure, and Simulate Wireless Mesh Network
This example shows how to simulate a wireless mesh network by using WLAN Toolbox™ with the Communications Toolbox™ Wireless Network Simulation Library.
Using this example, you:
Create and configure a WLAN with three mesh nodes.
Add application traffic from the source node to the destination node.
Simulate the WLAN and retrieve the statistics of the three mesh nodes.
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, setting the mode to "mesh"
. Use this configuration to create three WLAN nodes.
deviceCfg = wlanDeviceConfig(Mode="mesh");
nodes = wlanNode(Position=[0 0 0; 40 0 0; 20 0 0],DeviceConfig=deviceCfg);
Create a networkTrafficOnOff
object to generate an On-Off application traffic pattern. Specify the data rate in kilobits per second and the packet size in bytes. Enable packet generation to generate an application packet with a payload.
traffic = networkTrafficOnOff(DataRate=100,PacketSize=10,GeneratePacket=true);
Create a mesh path, using the first node as the source, the second node as the destination, and the third node as the mesh path node.
addMeshPath(nodes(1),nodes(2),nodes(3));
Add application traffic from the destination node to the source node. Set the AccessCategory
to 2
. This value corresponds to the Video access category.
addTrafficSource(nodes(1),traffic,DestinationNode=nodes(2),AccessCategory=2);
Add the three nodes to the wireless network simulator.
addNodes(networksimulator,nodes(1)); addNodes(networksimulator,nodes(2)); addNodes(networksimulator,nodes(3));
Set the simulation time in seconds and run the simulation.
simulationTime = 0.05; run(networksimulator,simulationTime);
Get and display the physical layer (PHY) statistics of the three nodes.
stats1 = statistics(nodes(1)); stats2 = statistics(nodes(2)); stats3 = statistics(nodes(3)); disp(stats1.PHY)
TransmittedPackets: 126 TransmittedPayloadBytes: 4788 ReceivedPackets: 126 ReceivedPayloadBytes: 1764 DroppedPackets: 0
disp(stats2.PHY)
TransmittedPackets: 0 TransmittedPayloadBytes: 0 ReceivedPackets: 252 ReceivedPayloadBytes: 6552 DroppedPackets: 0
disp(stats3.PHY)
TransmittedPackets: 126 TransmittedPayloadBytes: 1764 ReceivedPackets: 126 ReceivedPayloadBytes: 4788 DroppedPackets: 0
Input Arguments
sourceNode
— Source node
wlanNode
object
Source node, specified as a wlanNode
object.
If the node's
DeviceConfig
property is awlanDeviceConfig
object, you must set itsMode
property to"mesh"
.If the node's
DeviceConfig
property is a vector ofwlanDeviceConfig
objects, you must set theMode
property to"mesh"
in at least one of them.If the node's
DeviceConfig
property is awlanMultilinkDeviceConfig
object, the function cannot use the node as a source node.
destinationNode
— Destination node
wlanNode
object
Destination node, specified as a wlanNode
object. If you do not
specify meshPathNode
,
the restrictions on the DeviceConfig
property
described in sourceNode
also apply to this input.
meshPathNode
— Mesh path node
wlanNode
object
Mesh path node, specified as a wlanNode
object.
If the node's
DeviceConfig
property is awlanDeviceConfig
object, you must set itsMode
property to"mesh"
.If the node's
DeviceConfig
property is a vector ofwlanDeviceConfig
objects, you must set theMode
property to"mesh"
in at least one of them.If the node's
DeviceConfig
property is awlanMultilinkDeviceConfig
object, the function cannot use the node as a mesh path node.
The mesh path node has two possible roles.
If
destinationNode
is a mesh node, the mesh path node is the next hop node. That is, the mesh path node is an immediate mesh receiver to whichsourceNode
forwards the packets.If
destinationNode
is not a mesh node, the mesh path node is the proxy mesh gate. That is, it can forward packets to a nonmesh node.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example:
SourceBandAndChannel=[6 56]
specifies that the source node uses the 6 GHz
band and channel 56 to transmit packets.
SourceBandAndChannel
— Source band and channel
vector of length 2
Source band and channel, specified as a vector of length 2. This argument
specifies the band and channel that the source node uses to transmit to the next hop
node. This argument has the same restrictions as the BandAndChannel
property of a wlanDeviceConfig
object.
If you do not specify this argument, the function chooses a source band and channel as follows:
If the mesh path node is the next hop node, the function finds a common band and channel between the source node and the next hop node.
If the mesh path node is the proxy mesh gate, the function chooses the band and channel of a mesh device. If the proxy mesh gate has multiple mesh devices, you must specify this argument.
Data Types: double
DestinationBandAndChannel
— Destination band and channel
vector of length 2
Destination band and channel, specified as a vector of length 2. This argument
specifies the band and channel that the destination node uses to receive packets. This
argument has the same restrictions as the BandAndChannel
property of a wlanDeviceConfig
object.
If you do not specify this argument, the function chooses a destination band and channel as follows:
If the destination node is a mesh node, the function chooses the band and channel of a mesh device. If the destination node has multiple mesh devices, you must specify this argument.
If the destination node is not a mesh node and only one device is present, the function chooses the band and channel of that device. If the network has multiple devices, you must specify this argument.
Data Types: double
MeshPathBandAndChannel
— Mesh path band and channel
vector of length 2
Mesh path band and channel, specified as a vector of length 2. This argument
specifies the band and channel that the mesh path node uses to receive packets. This
argument has the same restrictions as the BandAndChannel
property of a wlanDeviceConfig
object.
If you do not specify this argument, the function chooses a mesh path band and channel as follows:
If the mesh path node is the next hop node, the function finds a common band and channel between the source node and the next hop node.
If the mesh path node is the proxy mesh gate, the function chooses the band and channel of a mesh device. If the mesh path node has multiple mesh devices, you must specify this argument.
Data Types: double
Version History
Introduced in R2023a
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
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)