メインコンテンツ

addNodes

Add wireless nodes to wireless traffic viewer

Since R2026a

    Description

    addNodes(wirelessTrafficVis,node) adds wireless nodes to the wireless traffic viewer object, wirelessTrafficVis.

    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.

    Input Arguments

    collapse all

    Wireless traffic viewer, specified as a wirelessTrafficViewer object.

    Wireless node, specified as an object of a subclass of wnet.Node, a vector of objects of subclass of wnet.Node, or a cell array of objects of subclass of wnet.Node.

    Version History

    Introduced in R2026a

    See Also

    Objects