Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

wirelessNetworkSimulator

ワイヤレス ネットワーク シミュレーター

R2022b 以降

    必要なダウンロード: wirelessNetworkSimulator を使用するには、最初に Communications Toolbox Wireless Network Simulation Library アドオンをダウンロードします。

    説明

    wirelessNetworkSimulator オブジェクトは、さまざまな種類の無線ノードを使用してさまざまなワイヤレス ネットワークのシナリオをシミュレートします。オブジェクト関数を使用してシミュレーターにノードを追加し、ノードを操作し、シミュレーション中に実行するアクションのスケジュールを設定し、カスタム チャネル モデルを挿入し、シミュレーションを実行します。

    作成

    説明

    networkSimulator = wirelessNetworkSimulator.init() は、既定のプロパティ値を使用して wirelessNetworkSimulator オブジェクトを作成します。wirelessNetworkSimulator オブジェクト networkSimulator が MATLAB® ワークスペースに既に存在する場合、この関数はこのオブジェクトを既定の状態にリセットします。

    プロパティ

    すべて展開する

    この プロパティ は読み取り専用です。

    現在のシミュレーション時間。非負のスカラーとして格納されます。単位は秒です。

    データ型: double

    この プロパティ は読み取り専用です。

    チャネル モデル。関数ハンドルとして格納されます。既定では、シミュレーターは関数 fspl を使用してチャネルをモデル化します。カスタムのチャネル モデルを指定するには、関数 addChannelModel を使用します。

    データ型: function_handle

    この プロパティ は読み取り専用です。

    シミュレーション終了時間。非負のスカラーとして格納されます。単位は秒です。

    データ型: double

    この プロパティ は読み取り専用です。

    シミュレーターに追加するノード。bluetoothLENode (Bluetooth Toolbox) オブジェクト、bluetoothNode (Bluetooth Toolbox) オブジェクト、wlanNode (WLAN Toolbox) オブジェクト、nrGNB (5G Toolbox) オブジェクト、または nrUE (5G Toolbox) オブジェクトを各セルに含む cell 配列として格納されます。

    オブジェクト関数

    wirelessNetworkSimulator.getInstanceGet instance of wirelessNetworkSimulator object
    addNodesAdd nodes to simulator
    addChannelModelAdd custom channel or path loss model
    scheduleActionSchedule action to perform during simulation
    cancelActionCancel scheduled action
    runRun simulation

    すべて折りたたむ

    関数 wirelessNetworkSimulator.init() を使用してwirelessNetworkSimulatorオブジェクトを作成します。既定では、wirelessNetworkSimulator オブジェクトは自由空間パス損失モデルをチャネルの影響として適用します。

    networkSimulator = wirelessNetworkSimulator.init();

    2 つの Bluetooth BR ノードを作成します。1 つには "central" の役割、もう 1 つには "peripheral" の役割をもたせます。Peripheral ノードの位置をメートル単位で指定します。

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

    Bluetooth BR の Central ノードと Peripheral ノードの間の接続を構成して共有するため、既定の Bluetooth BR 接続構成オブジェクトを作成します。

    cfgConnection = bluetoothConnectionConfig;

    Central ノードと Peripheral ノードの間の接続を構成します。

    connection = configureConnection( ...
        cfgConnection,centralNode,peripheralNode);

    オンオフ アプリケーションのトラフィック パターンを生成するため、networkTrafficOnOffオブジェクトを作成して構成します。

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

    Central ノードから Peripheral ノードへのアプリケーション トラフィックを追加します。

    addTrafficSource(centralNode,traffic, ...
        DestinationNode=peripheralNode);

    Central ノードと Peripheral ノードをワイヤレス ネットワーク シミュレーターに追加します。

    addNodes(networkSimulator,[centralNode peripheralNode]);

    シミュレーション時間を秒単位で指定します。

    simulationTime = 0.05;

    指定したシミュレーション時間だけシミュレーションを実行します。

    run(networkSimulator,simulationTime);

    Central ノードと Peripheral ノードに対応するアプリケーション統計、ベースバンド統計、物理レイヤー (PHY) 統計を取得します。

    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]
    
    

    wirelessNetworkSimulatorオブジェクトを作成します。

    networkSimulator = wirelessNetworkSimulator.init();

    2 つの Bluetooth BR ノードを作成します。1 つには "central" の役割、もう 1 つには "peripheral" の役割をもたせます。Peripheral ノードの位置をメートル単位で指定します。

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

    Bluetooth BR の Central ノードと Peripheral ノードの間の接続を構成して共有するため、既定の Bluetooth BR 接続構成オブジェクトを作成します。

    cfgConnection = bluetoothConnectionConfig;

    Central ノードと Peripheral ノードの間の接続を構成します。

    connection = configureConnection(cfgConnection,centralNode,peripheralNode);

    オンオフ アプリケーションのトラフィック パターンを生成するため、networkTrafficOnOffオブジェクトを作成して構成します。

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

    Central ノードから Peripheral ノードへのアプリケーション トラフィックを追加します。

    addTrafficSource(centralNode,traffic, ...
        DestinationNode=peripheralNode);

    Central ノードと Peripheral ノードをワイヤレス ネットワーク シミュレーターに追加します。

    addNodes(networkSimulator,[centralNode peripheralNode]);

    既定では、wirelessNetworkSimulator オブジェクトは自由空間パス損失モデルをチャネルの影響として適用します。関数 addChannelModel を使用することで、カスタムのチャネルの影響を追加できます。ただし、チャネルの影響なしでチャネルをモデル化するには、カスタム MATLAB™ 関数 removeChannelEffect を指定します。これにより、入力された送信パケットがそのまま変更されずに出力で返されるようになります。

    addChannelModel(networkSimulator,@removeChannelEffect);

    シミュレーション時間を秒単位で指定します。

    simulationTime = 0.05;

    指定したシミュレーション時間だけシミュレーションを実行します。

    run(networkSimulator,simulationTime);

    Central ノードと Peripheral ノードに対応するアプリケーション統計、ベースバンド統計、物理レイヤー (PHY) 統計を取得します。

    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]
    
    
    function outputData = removeChannelEffect(~,txData)
    outputData = txData;
    end

    バージョン履歴

    R2022b で導入

    すべて展開する