Contenido principal

wirelessTrafficViewer

View state transitions and channel occupancy of wireless nodes

Since R2026a

    Description

    Use the wirelessTrafficViewer object to view the state transitions and channel occupancy of wireless nodes. This object visualizes packet communication across time for each node, and visualizes the frequency usage of all the packets communicated across time by all the nodes.

    Creation

    Description

    trafficViewer = wirelessTrafficViewer creates a default wireless traffic viewer object, which visualizes packet communications during the runtime of a wireless network simulation.

    trafficViewer = wirelessTrafficViewer(PropertyName=Value) sets properties using one or more optional name-value arguments. For example, RefreshRate=5 sets the refresh rate of the viewer to 5.

    Properties

    expand all

    View type, specified as one of these options:

    • "state-transition-plot"— Visualizes packet communication across time for each node.

    • "channel-occupancy-plot"— Visualizes the frequency usage of all the packets communicated over time by all the nodes.

    • "all"— Visualizes both packet communication over time for each node and the frequency usage of all the packets communicated over time by all the nodes.

      Note that after the simulation ends, you can activate the previously disabled plot by selecting the corresponding checkbox in the traffic viewer.

    Refresh rate, specified as an integer in the range [0, 1000]. This value indicates how often the object updates and plots the wireless state information on the screen. Units are in Hz.

    When you increase this value, the viewer updates the plots more often, which can slow down the simulation. When you decrease this value, the viewer updates the plots less often, resulting in slower visualization of the updates. Setting this value to 0 makes the visualization appear only at the end of the simulation; all the controls and plots will be visible after the simulation ends. Use this option if you want to view the visualization without significantly slowing down the simulation.

    Data Types: double

    Object Functions

    addNodesAdd wireless nodes to wireless traffic viewer

    Examples

    collapse all

    Initialize a wireless network simulator, then create and configure both an access point (AP) node and a station (STA) node. After associating the STA with the AP, you add both nodes to the simulation. Next, you set up a wireless traffic viewer for visualization and run the simulation to observe the state transitions and channel occupancy of the wireless nodes.

    Initialize the wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create and configure the AP node.

    deviceCfg = wlanDeviceConfig(Mode="AP");
    apNode = wlanNode(Name="AP",Position=[0 10 0],DeviceConfig=deviceCfg);

    Create the STA node with a default device configuration.

    staNode = wlanNode(Name="STA",Position=[5 0 0]);

    Associate the STA node with the AP node.

    associateStations(apNode,staNode,FullBufferTraffic="on")

    Add the nodes to the simulator.

    addNodes(networkSimulator,[apNode staNode])

    Create a wireless traffic viewer and add the nodes to it.

    wirelessTrafficVis = wirelessTrafficViewer;
    addNodes(wirelessTrafficVis,[apNode staNode])

    Set the simulation time, and run the simulation.

    simulationTime = 0.2;
    run(networkSimulator,simulationTime)

    Figure Wireless Traffic Viewer contains 2 axes objects and another object of type uigridlayout. Axes object 1 with title Channel Occupancy, xlabel Time (s), ylabel Frequency (MHz) contains 2 objects of type patch, constantline. Axes object 2 with title State Transitions Of Nodes, xlabel Time (s) contains 5 objects of type patch, constantline.

    Try exploring these additional features of the wireless traffic viewer:

    1. Disable and enable nodes from plots.

    2. Disable and enable operating states and node types.

    3. Visualize certain time and frequency durations.

    4. Export images.

    Simulate a Bluetooth® Low Energy (LE) network to observe the state transitions and channel occupancy of Bluetooth nodes. Initialize the wireless network simulator, create and connect a Central and a Peripheral node, and configure On-Off traffic. After adding the nodes to the simulator and the wireless traffic viewer, run the simulation and visualize node activity.

    Initialize the wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Set simulation time.

    simulationTime = 0.2;

    Create a Central and PeripheralBluetooth LE node.

    centralNode = bluetoothLENode("central",Position=[0 0 0]);
    peripheralNode = bluetoothLENode("peripheral",Position=[1 0 0]);

    Create and configure the connection between the nodes.

    cfg = bluetoothLEConnectionConfig;
    configureConnection(cfg,centralNode,peripheralNode);

    Configure On-Off traffic.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27,OnTime=Inf,OffTime=0);

    Add traffic sources.

    addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode)

    Add the nodes to the simulator.

    nodes = [centralNode peripheralNode];
    addNodes(networkSimulator,nodes)

    Create a wireless traffic viewer and add the nodes to it.

    wirelessTrafficVis = wirelessTrafficViewer;
    addNodes(wirelessTrafficVis,nodes)

    Run the simulation.

    run(networkSimulator,simulationTime)

    Figure Wireless Traffic Viewer contains 2 axes objects and another object of type uigridlayout. Axes object 1 with title Channel Occupancy, xlabel Time (s), ylabel Frequency (MHz) contains 2 objects of type patch, constantline. Axes object 2 with title State Transitions Of Nodes, xlabel Time (s) contains 4 objects of type patch, constantline.

    Try exploring these additional features of the wireless traffic viewer:

    1. Disable and enable nodes from plots.

    2. Disable and enable operating states and node types.

    3. Visualize certain time and frequency durations.

    4. Export images.

    More About

    expand all

    Version History

    Introduced in R2026a

    See Also

    Objects