Main Content

run

Run simulation

    Description

    example

    run(networkSimulator,simDuration) runs the wireless network simulation for the specified simulation time duration. If any action is scheduled at a particular simulation time, the run function performs the scheduled action. Use the scheduleAction function to schedule an action to be performed during the simulation process.

    You must call the run function only once after initializing the wirelessNetworkSimulator object.

    Examples

    collapse all

    Create a wirelessNetworkSimulator object. By default, the wirelessNetworkSimulator object applies free-space path loss model for the channel effects.

    networkSimulator = wirelessNetworkSimulator.init();

    Create two Bluetooth BR nodes, one with the "central" role and other with the "peripheral" role. Specify the position of the Peripheral node in meters.

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

    Create a default Bluetooth BR connection configuration object to configure and share a connection between Bluetooth BR Central and Peripheral nodes.

    cfgConnection = bluetoothConnectionConfig;

    Configure connection between the Central and the Peripheral nodes.

    connection = configureConnection(cfgConnection,centralNode,peripheralNode);

    Create and configure a networkTrafficOnOff object to generate an On-Off application traffic pattern.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27, ...
              GeneratePacket=true,OnTime=inf);

    Add application traffic from the Central to the Peripheral node.

    addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode);

    Add the Central and Peripheral nodes to the wireless network simulator.

    addNodes(networkSimulator,[centralNode peripheralNode]);

    Specify the simulation time in seconds.

    simulationTime = 0.05;

    Run the simulation for the specified simulation time.

    run(networkSimulator,simulationTime);
    Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.
    

    Retrieve application, baseband, and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes.

    centralStats = statistics(centralNode)
    centralStats = struct with fields:
            Name: "Node1"
              ID: 1
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]
    
    
    peripheralStats = statistics(peripheralNode)
    peripheralStats = struct with fields:
            Name: "Node2"
              ID: 2
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]
    
    

    Simulate Bluetooth BR Network

    Create a wirelessNetworkSimulator object. By default, the wirelessNetworkSimulator object applies free-space path loss model for the channel effects.

    networkSimulator = wirelessNetworkSimulator.init();

    Create two Bluetooth BR nodes, one with the "central" role and other with the "peripheral" role. Specify the position of the Peripheral node in meters.

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

    Create a default Bluetooth BR connection configuration object to configure and share a connection between Bluetooth BR Central and Peripheral nodes.

    cfgConnection = bluetoothConnectionConfig;

    Configure connection between the Central and the Peripheral nodes.

    connection = configureConnection(cfgConnection,centralNode,peripheralNode);

    Create and configure a networkTrafficOnOff object to generate an On-Off application traffic pattern.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27, ...
        GeneratePacket=true,OnTime=inf);

    Add application traffic from the Central to the Peripheral node.

    addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode);

    Add the Central and Peripheral nodes to the wireless network simulator.

    addNodes(networkSimulator,[centralNode peripheralNode]);

    Schedule Action

    Create a custom function displayInfo to define the actions for the simulator to perform during simulation. You can define an one time action, periodic action, and action when simulator advances in time. The input data for the custom function is stored as a structure and passed using the scheduleAction function.

    A) Schedule One Time Action

    For the one time action, the displayInfo function displays the details of the nodes in the network.

    Specify the ActionType input argument value of displayInfo function as "OneTime". Specify the names of the nodes in the network as input to displayInfo function.

    userdata = struct(ActionType="OneTime",Nodes=[centralNode peripheralNode]);

    Configure the simulator by using the scheduleAction function to display the node details when the simulation time is 0.001s.

    startTime = 0.001;
    scheduleAction(networkSimulator,@displayInfo,userdata,startTime);

    B) Schedule Periodic Action

    For the periodic action, the displayInfo function displays the physical layer statistics of the central node in the Bluetooth BR network.

    Specify the ActionType input argument value of displayInfo function as "Periodic". Specify the central node and the simulator as inputs to displayInfo function.

    userdata = struct(ActionType="Periodic",CentralNode=centralNode,Simulator=networkSimulator);

    Configure the simulator by using the scheduleAction function to display the physical layer statistics of the central node at a time interval of 0.02s starting from the beginning of the simulation.

    startTime = 0;
    periodicity = 0.02;
    scheduleAction(networkSimulator,@displayInfo,userdata,startTime,periodicity);

    C) Schedule Action When Simulator Advances in Time

    When the simulator advances in time, the displayInfo function displays the next event time of the simulator.

    Specify the ActionType input argument value of displayInfo function as "TimeAdvance". Specify the simulator as input to the displayInfo function.

    userdata = struct(ActionType="TimeAdvance",Simulator=networkSimulator);

    Set the periodicity value to 0. Configure the simulator by using the scheduleAction function to display the time of the next event.

    startTime = 0;
    periodicity = 0;
    scheduleAction(networkSimulator,@displayInfo,userdata,startTime,periodicity);

    Run Simulation

    Specify the simulation time in seconds.

    simulationTime = 0.05;

    Run the simulation for the specified simulation time.

    run(networkSimulator,simulationTime);
    Custom channel model is not added. Using free space path loss (fspl) model as the default channel model.
    -------Periodic Action -------
    Statistics of Node1 at time 0.000 seconds:
                       ReceivedPackets: 0
                        DecodeFailures: 0
                      PacketCollisions: 0
                   CoChannelCollisions: 0
                   CollisionsWithBREDR: 0
                CollisionsWithNonBREDR: 0
        CollisionsWithBREDRAndNonBREDR: 0
                    TransmittedPackets: 1
                       TransmittedBits: 366
    
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00037 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00063 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00075 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00100 seconds
    -------End-------
    -------One Time Action -------
    Node details:
    Name: Node1 ID: 1 Role: central
    Name: Node2 ID: 2 Role: peripheral
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00108 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00125 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00162 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00187 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00200 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00216 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00250 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00287 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00313 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00324 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00325 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00375 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00412 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00432 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00438 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00450 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00500 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00537 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00540 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00562 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00575 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00625 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00648 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00662 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00688 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00750 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00756 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00787 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00813 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00825 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00864 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00875 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00912 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00937 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00950 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.00972 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01000 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01037 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01063 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01075 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01080 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01125 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01162 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01188 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01188 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01200 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01250 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01287 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01296 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01312 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01325 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01375 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01404 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01412 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01438 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01450 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01500 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01512 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01537 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01562 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01575 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01620 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01625 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01662 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01688 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01728 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01750 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01787 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01812 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01825 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01836 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01875 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01912 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01937 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01944 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.01950 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02000 seconds
    -------End-------
    -------Periodic Action -------
    Statistics of Node1 at time 0.020 seconds:
                       ReceivedPackets: 16
                        DecodeFailures: 0
                      PacketCollisions: 0
                   CoChannelCollisions: 0
                   CollisionsWithBREDR: 0
                CollisionsWithNonBREDR: 0
        CollisionsWithBREDRAndNonBREDR: 0
                    TransmittedPackets: 17
                       TransmittedBits: 6222
    
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02037 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02052 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02063 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02075 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02125 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02160 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02162 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02187 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02200 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02250 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02268 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02287 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02312 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02325 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02375 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02376 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02412 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02438 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02450 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02484 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02500 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02537 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02562 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02575 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02592 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02625 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02662 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02687 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02750 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02787 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02808 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02813 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02825 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02875 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02912 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02916 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02937 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.02950 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03000 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03024 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03037 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03062 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03075 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03125 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03132 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03162 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03188 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03200 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03240 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03250 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03287 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03313 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03325 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03348 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03375 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03412 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03438 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03450 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03456 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03500 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03537 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03562 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03564 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03575 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03625 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03662 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03672 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03687 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03750 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03780 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03787 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03812 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03825 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03875 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03888 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03912 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03938 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03950 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.03996 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04000 seconds
    -------End-------
    -------Periodic Action -------
    Statistics of Node1 at time 0.040 seconds:
                       ReceivedPackets: 32
                        DecodeFailures: 0
                      PacketCollisions: 0
                   CoChannelCollisions: 0
                   CollisionsWithBREDR: 0
                CollisionsWithNonBREDR: 0
        CollisionsWithBREDRAndNonBREDR: 0
                    TransmittedPackets: 33
                       TransmittedBits: 12078
    
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04037 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04063 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04075 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04104 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04125 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04162 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04188 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04200 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04212 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04250 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04287 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04312 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04320 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04325 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04375 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04412 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04428 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04437 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04450 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04500 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04536 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04537 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04562 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04575 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04625 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04644 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04662 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04688 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04700 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04750 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04752 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04787 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04813 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04825 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04860 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04875 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04912 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04938 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04950 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.04968 seconds
    -------End-------
    -------Action When Simulator Advances in Time-------
    Simulator next event time is at 0.05000 seconds
    -------End-------
    
    function displayInfo(~,userdata)
    switch(userdata.ActionType)
        case "Periodic"
            fprintf("-------Periodic Action -------\n")
            fprintf("Statistics of %s at time %.3f seconds:\n",userdata.CentralNode.Name,userdata.Simulator.CurrentTime);
            stats = statistics(userdata.CentralNode);
            disp(stats.PHY)
            fprintf("-------End-------\n")
        case "OneTime"
            fprintf("-------One Time Action -------\n")
            fprintf("Node details:\n")
            for idx=1:numel(userdata.Nodes)
                fprintf("Name: %s ID: %d Role: %s\n",userdata.Nodes(idx).Name,userdata.Nodes(idx).ID,userdata.Nodes(idx).Role)
            end
            fprintf("-------End-------\n")
        case "TimeAdvance"
            fprintf("-------Action When Simulator Advances in Time-------\n")
            fprintf("Simulator next event time is at %.5f seconds\n",userdata.Simulator.CurrentTime)
            fprintf("-------End-------\n")
    end
    end

    Input Arguments

    collapse all

    Wireless network simulator, specified as a wirelessNetworkSimulator object.

    Duration of simulation, specified as a positive scalar. Units are in seconds.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Version History

    Introduced in R2022b