Main Content

addMeshPath

Add mesh path to WLAN node

Since R2023a

Download Required: To use addMeshPath, first download the Communications Toolbox Wireless Network Simulation Library add-on.

Description

example

addMeshPath(sourceNode,destinationNode) sets the destination node, destinationNode, as an immediate mesh receiver for the source node, sourceNode.

example

addMeshPath(sourceNode,destinationNode,meshPathNode) specifies the mesh node, meshPathNode, to which sourceNode sends packets as it attempts to communicate with destinationNode.

example

addMeshPath(___,Name=Value) specifies options using one or more name-value arguments, in addition to any input argument combination from the previous syntaxes.

Examples

collapse all

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:

  1. Create and configure a WLAN with three mesh nodes.

  2. Add application traffic from the source node to the destination node.

  3. 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.

for i=1:3
    addNodes(networksimulator,nodes(i));
end

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

collapse all

Source node, specified as a wlanNode object. You must set the Mode property of the source node's DeviceConfig property to "mesh".

Destination node, specified as a wlanNode object. If you do not specify meshPathNode, you must set the Mode property of the destination node's DeviceConfig property to "mesh".

Mesh path node, specified as a wlanNode object. You must set the Mode property of the mesh path node's DeviceConfig property to "mesh".

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 which sourceNode 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.

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 network 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 network 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 network has multiple mesh devices, you must specify this argument.

Data Types: double

Version History

Introduced in R2023a

See Also

Objects