Main Content

statistics

R2026b

Statistics of WLAN node

Since R2023a

Description

This function also requires the Wireless Network Toolbox™ product.

nodeStatistics = statistics(nodeObj) returns the node statistics of the input nodeObj as a structure. If you specify nodeObj as a vector of nodes, the function returns a row vector of structures containing the statistics of each node.

example

nodeStatistics = statistics(nodeObj,"all") returns additional statistics as well as the default ones that the previous syntax returns.

example

Examples

collapse all

This example enables you to:

  1. Create and configure a WLAN with an access point (AP) node and a station (STA) node.

  2. Add application traffic from the AP node to the STA node.

  3. Simulate the WLAN and retrieve the statistics of the AP node and the STA node.

Create a wireless network simulator.

networksimulator = wirelessNetworkSimulator.init();

Create a wlanDeviceConfig object, specifying the operating mode and beacon interval. Use this configuration to create a WLAN node and specify its name and position.

deviceCfg = wlanDeviceConfig(Mode="AP",BeaconInterval=5);
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]);

Add a random waypoint mobility model to the WLAN node with the default device configuration. Set the shape of the node's mobility area to "circle".

addMobility(staNode,BoundaryShape="circle",RefreshInterval=0.1)

Associate the STA node with the AP node using the associateStations function.

associateStations(apNode,staNode);

Create a networkTrafficOnOff (Wireless Network Toolbox) object to generate an On-Off application traffic pattern. Specify the data rate in kilobits per second and the packet size in bytes.

traffic = networkTrafficOnOff(DataRate=100,PacketSize=10);

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.5;
run(networksimulator,simulationTime);

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: 345
    TransmittedPayloadBytes: 29594
            ReceivedPackets: 248
       ReceivedPayloadBytes: 3472
             DroppedPackets: 0
disp(staStats.PHY)
         TransmittedPackets: 248
    TransmittedPayloadBytes: 3472
            ReceivedPackets: 345
       ReceivedPayloadBytes: 29594
             DroppedPackets: 0

Input Arguments

collapse all

WLAN node object, specified as a wlanNode object or vector of wlanNode objects. When you specify a vector of objects, the function returns a row vector of structures.

Output Arguments

collapse all

Statistics of the WLAN node, returned as a structure or a vector of structures. For more information about this output, see WLAN System-Level Simulation Statistics.

Data Types: struct

Version History

Introduced in R2023a

expand all

See Also

Objects