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
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
Source node, specified as a wlanNode object.
If the node's
DeviceConfigproperty is awlanDeviceConfigobject, you must set itsModeproperty to"mesh".If the node's
DeviceConfigproperty is a vector ofwlanDeviceConfigobjects, you must set theModeproperty to"mesh"in at least one of them.If the node's
DeviceConfigproperty is awlanMultilinkDeviceConfigobject, the function cannot use the node as a source node.
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.
Mesh path node, specified as a wlanNode object.
If the node's
DeviceConfigproperty is awlanDeviceConfigobject, you must set itsModeproperty to"mesh".If the node's
DeviceConfigproperty is a vector ofwlanDeviceConfigobjects, you must set theModeproperty to"mesh"in at least one of them.If the node's
DeviceConfigproperty is awlanMultilinkDeviceConfigobject, the function cannot use the node as a mesh path node.
The mesh path node has two possible roles.
If
destinationNodeis a mesh node, the mesh path node is the next hop node. That is, the mesh path node is an immediate mesh receiver to whichsourceNodeforwards the packets.If
destinationNodeis 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.
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
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
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
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)