associateStations
Download Required: To use associateStations
,
first download the Communications Toolbox Wireless Network Simulation Library add-on.
Description
associateStations(
associates the list of stations (STAs) specified in nodeObj
,associatedSTAs
)associatedSTAs
to
the access point (AP) that you specify in nodeObj
.
associateStations(___,
specifies options using one or more name-value arguments, in addition to the previous
syntax.Name=Value
)
Examples
Create, Configure, and Simulate Wireless Local Area Network
This example shows how to simulate a wireless local area network (WLAN) by using WLAN Toolbox™ with the Communications Toolbox™ Wireless Network Simulation Library.
Using this example, you:
Create and configure a WLAN with an access point (AP) node and a station (STA) node.
Add application traffic from the AP node to the STA node.
Simulate the WLAN and retrieve the statistics of the AP node and the STA node.
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 "AP"
. Use this configuration to create a WLAN node, specifying its name and position.
deviceCfg = wlanDeviceConfig(Mode="AP"); apNode = wlanNode(Name="AP",Position=[0 10 0],DeviceConfig=deviceCfg);
Create a WLAN node with the default device configuration. Confirm that the default mode is STA
.
staNode = wlanNode(Name="STA",Position=[5 0 0]);
disp(staNode.DeviceConfig.Mode)
STA
Associate the STA node with the AP node.
associateStations(apNode,staNode);
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);
Add application traffic from the AP node to the STA node.
addTrafficSource(apNode,traffic,DestinationNode=staNode);
Add the AP node and STA node to the wireless network simulator.
addNodes(networksimulator,{apNode,staNode});
Set the simulation time in seconds and run the simulation.
simulationTime = 0.05; run(networksimulator,simulationTime);
Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.
Get and display the physical layer (PHY) statistics that correspond to the AP node and STA node.
apStats = statistics(apNode); staStats = statistics(staNode); disp(apStats.PHY)
TransmittedPackets: 126 TransmittedPayloadBytes: 4095 ReceivedPackets: 125 ReceivedPayloadBytes: 1750 DroppedPackets: 0
disp(staStats.PHY)
TransmittedPackets: 125 TransmittedPayloadBytes: 1750 ReceivedPackets: 126 ReceivedPayloadBytes: 4095 DroppedPackets: 0
Input Arguments
nodeObj
— Access point
wlanNode
object
Access point, specified as a wlanNode
object. You must set the
Mode
property
of the access point's DeviceConfig
property to "AP"
. If you configure the access point for multiple
devices, you must set the Mode
property of at least one of the
wlanDeviceConfig
objects to
"AP"
.
associatedSTAs
— Associated stations
wlanNode
object | vector of wlanNode
objects
Associated stations, specified as a wlanNode
object or a vector of
wlanNode
objects. You must set the Mode
property
of each object's DeviceConfig
property to "STA"
.
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: BandAndChannel=[2.4 13]
specifies that the AP uses the 2.4
GHz band and channel 13 to communicate with its stations.
BandAndChannel
— Operating frequency band and channel number
vector of length 2
Operating frequency band and channel number, specified as a vector of length 2.
Specify this argument to choose the frequency band and channel number that the AP uses
to communicate with the stations. This value must be the same as that of the BandAndChannel properties of each wlanNode
object in the
associatedSTAs
argument. If you do not specify this argument,
the function chooses a band and channel by finding a common value between the AP and
the stations.
Data Types: double
FullBufferTraffic
— Full buffer traffic options
"off"
(default) | "on"
| "DL"
| "UL"
Full buffer traffic options, specified as "off"
,
"on"
, "DL"
, or "UL"
. The
four options mean the following:
"off"
— Full buffer traffic is disabled."on"
— Two-way full buffer traffic is enabled."DL"
— Downlink full buffer traffic is enabled."UL"
— Uplink full buffer traffic is enabled.
Data Types: char
| string
Version History
Introduced in R2023a
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは 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)