IEEE 802.15.4 - 非同期 CSMA MAC
この例では、Communications Toolbox™ Library for ZigBee® and UWB を使用して、IEEE® 802.15.4™ 非同期 CSMA MAC [1] をシミュレーションする方法を説明します。
背景
IEEE 802.15.4 規格は、低速無線パーソナル エリア ネットワーク (LR-WPAN) [1] の MAC レイヤーと PHY レイヤーを規定します。IEEE 802.15.4 の MAC レイヤーと PHY レイヤーは、ZigBee、WirelessHart®、6LoWPAN、および MiWi などの他の上位レイヤーの規格のベースを提供します。このような規格は、ホーム オートメーションやセンサー ネットワーキングに使用例があり、モノのインターネット (IoT) の流行にも密接に関連しています。
IEEE 802.15.4 MAC [1] は、2 つの基本的な MAC モード、(i) ビーコン非対応 MAC と (ii) ビーコン対応 MAC を規定します。ビーコン非対応 MAC は非同期 Carrier-Sense Multiple Access (CSMA) MAC であり、IEEE 802.11 MAC にとてもよく似ています。ビーコン対応 MAC では、2 つの異なる MAC 周期 (i) 同期型の CSMA MAC 周期と (ii) タイム スロット型の競合のない MAC 周期が許可されます。この例では、ビーコン非対応の非同期 CSMA ベースの IEEE 802.15.4 MAC について幅広いシミュレーションを提供します。
ネットワーク設定
IEEE 802.15.4 PAN (パーソナル エリア ネットワーク) は、エンド デバイスと PAN コーディネーターの間の標準的な処理によって設定されます。はじめに、ネットワークに参加しようとしているデバイスが、アクティブまたはパッシブのスキャンを実行します。アクティブ スキャンとは、デバイスがはじめに "ビーコン要求" を送信し、その後でパッシブ スキャンを実行することです。パッシブ スキャンとは、デバイスが PAN コーディネーターからのビーコン フレームを収集するために監視を行うことです。アクティブ スキャンの場合、PAN コーディネーターはビーコン要求を受信済みであることがあります。パッシブ スキャン中にビーコンを収集しているときに、エンド デバイスが関連付けをする PAN を選択します。その後、"アソシエーション要求" をこの PAN のコーディネーターに送信し、コーディネーターがその要求に肯定応答します。
IEEE 802.11 とは対照的に、コーディネーターは "アソシエーション応答" をすぐに送信することでアソシエーション要求の肯定応答をフォローしません。代わりに、IEEE 802.15.4 コーディネーターは初めにアソシエーション応答をローカルに保存し、エンド デバイスがデータ要求を送信しコーディネーターがそれに肯定応答するときにのみ、アソシエーション応答を送信します。IEEE 802.15.4 規格では、このフレーム送信メカニズムを指して "間接伝送" という用語を使用します。一般に、このメカニズムはトラフィックが少ないネットワーク (センサー ネットワークなど) のバッテリーにより電力を供給されるデバイスにとって非常に有用です。このようなデバイスは、フレームを即座に受信できるように絶え間なく無線を使用する代わりに、定期的に無線をアクティブにして自分宛てのフレームが保留されているかどうかをチェックします。
アソシエーション応答が受信され肯定応答されると、エンド デバイスが PAN に関連付けされます。そうすると、コーディネーターとエンド デバイスの間で双方向にデータ フレームをやり取りできるようになります。データ フレームは、"肯定応答要求" の指示に応じて、肯定応答されます。
非同期メディア アクセス制御 (MAC)
非同期 CSMA IEEE 802.15.4 MAC は、一般的な CSMA の処理と IEEE 802.11 MAC によく似ています。この MAC スキームでは、CSMA の手法を用いず、肯定応答フレームは即座に送信されます。他のすべてのフレームは CSMA を使用して送信されます。
具体的には、デバイスは、送信すべきフレームを持つと、[0 -1] の範囲でランダムに "バックオフ" 遅延 (バックオフ周期の数) を選択します。ここで BE はバックオフ指数です。各バックオフ周期の期間は 20 シンボルです。2.4 GHz の OQPSK PHY では、この期間は 640 チップと 0.32 ms に相当します。デバイスは、選択したバックオフ周期の数だけ待機すると、搬送波感知を実行します。メディアがアイドルである場合は、デバイスはそのフレームの送信を開始し、すべて送信するまで継続します。
搬送波感知中メディアがビジーであった場合は、バックオフ指数が 1 増やされ、新しい範囲 [0 -1] から新しいバックオフ周期数が選択されます。再度バックオフ カウンターがいっぱいになったら、搬送波検出が実行されます。すべての搬送波検出インスタンスの間、メディアがアイドルにならずに、バックオフ カウントダウンの最大数に達した場合は、デバイスはフレーム送信試行を終了します。
ネットワーク シミュレーション機能
この例では、lrwpan.MACFullFunctionDevice
クラスと lrwpan.MACReducedFunctionDevice
クラスを使用して、説明したネットワーク設定処理と CSMA 手法を実装します。具体的には、以下の機能が有効にされます。
アクティブおよびパッシブ スキャン
アソシエーション要求とアソシエーション応答の交換
データ要求を使用した間接伝送
肯定応答がタイムリーに受信されない場合のフレーム肯定応答とフレームの再送信
短いフレーム間隔および長いフレーム間隔 (SIFS および LIFS)
バイナリ指数バックオフ
搬送波検出
ネットワーク シミュレーション
この節では、3 ノード (1 つの PAN コーディネーターと 2 つのエンド デバイス) で構成される IEEE 802.15.4 ネットワークを作成します。ネットワーク シミュレーターは、単一のバックオフ持続時間 (20 シンボル、0.32 ms) を 1 つずつ増やしてすべてのデバイスを処理するように構成します。
はじめに、次のコードで、最初のデバイスとネットワークの関連付けを示します。
symbolsPerStep = 20; chipsPerSymbol = 32; samplesPerChip = 4; symbolRate = 65.5e3; % symbols/sec time = 0; stopTime = 5; % sec % Create PAN Coordinator panCoordinator = lrwpan.MACFullFunctionDevice( ... 'PANCoordinator', true, ... 'SamplesPerChip', 4, .... 'PANIdentifier', '7777', ... 'ExtendedAddress', [repmat('0', 1, 8) repmat('7', 1, 8)], ... 'ShortAddress', '1234'); % Create first end-device endDevice1 = lrwpan.MACReducedFunctionDevice( ... 'SamplesPerChip',4, ... 'ShortAddress','0001', ... 'ExtendedAddress',[repmat('0', 1, 8) repmat('3', 1, 8)]);
0001: ********* Adding Beacon Request frame to the queue 0001: Passive scanning for 1584 steps
% Initialize device inputs received1 = zeros(samplesPerChip * chipsPerSymbol * ... symbolsPerStep/2, 1); received2 = zeros(samplesPerChip * chipsPerSymbol * ... symbolsPerStep/2, 1); while time < stopTime % Pass the received signals to the nodes for processing. Also, % fetch what they have to transmit: transmitted1 = panCoordinator(received1); transmitted2 = endDevice1(received2); % Ideal wireless channel, where both nodes are within range: received1 = transmitted2; % half-duplex radios, none receiving % while transmitting received2 = transmitted1; time = time + symbolsPerStep/symbolRate; % update clock end
0001: Processing next frame from the queue 0001: Initializing transmission; backoff delay = 1 steps 0001: Backoff delay = 1 steps -> 0 steps 0001: Carrier sensing: Medium is idle. 0001: Clear to transmit 0001: Transmitting Beacon Request 0001: IFS offset = 0 samples 0001: Transmitting 1-1280 of 2050
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
0001: IFS offset = 0 samples 0001: Transmitting 1281-2050 of 2050 0001: Finished transmission 0001: Need to wait for SIFS (12) symbols. Offset = 12, next IFS = 4 0001: Entering passive scanning
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = MAC command 1234: *********** Received MAC Command type = Beacon request 1234: Need to wait for SIFS (12) symbols. Offset = 12, next IFS = 4 1234: ********* Adding Beacon frame to the queue 1234: next IFS = 4 1234: Processing next frame from the queue 1234: Initializing transmission; backoff delay = 7 steps 1234: Backoff delay = 7 steps -> 6 steps 1234: Backoff delay = 6 steps -> 5 steps 1234: Backoff delay = 5 steps -> 4 steps 1234: Backoff delay = 4 steps -> 3 steps 1234: Backoff delay = 3 steps -> 2 steps 1234: Backoff delay = 2 steps -> 1 steps 1234: Backoff delay = 1 steps -> 0 steps 1234: Carrier sensing: Medium is idle. 1234: Clear to transmit 1234: IFS offset = 256 samples 1234: Transmitting 1-1024 of 2562 1234: IFS offset = 0 samples 1234: Transmitting 1025-2304 of 2562
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
1234: IFS offset = 0 samples 1234: Transmitting 2305-2562 of 2562 1234: Finished transmission 1234: Need to wait for LIFS (40) symbols. Offset = 4, next IFS = 24 1234: Decreased wait time by 20 symbols to 4
0001: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 0001: *********** Received frame type = Beacon 0001: Need to wait for SIFS (12) symbols. Offset = 4, next IFS = -4 0001: next IFS = 0 0001: Scanning finished 0001: ********* Adding Association request frame to the queue 0001: Processing next frame from the queue 0001: Initializing transmission; backoff delay = 0 steps 0001: Carrier sensing: Medium is idle. 0001: Clear to transmit 0001: IFS offset = 0 samples 0001: Transmitting 1-1280 of 3458
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
0001: IFS offset = 0 samples 0001: Transmitting 1281-2560 of 3458 0001: IFS offset = 0 samples 0001: Transmitting 2561-3458 of 3458 0001: Finished transmission 0001: will wait for ack for 54 symbols additional to IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = MAC command 1234: *********** Received MAC Command type = Association request 1234: Need to wait for LIFS (40) symbols. Offset = 14, next IFS = 34 1234: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 1234: ********* Adding Data response frame to the PENDING queue 1234: next IFS = 34
0001: Decreasing ack wait durations by 20 symbols to 34
1234: IFS offset = 896 samples 1234: Transmitting 1-384 of 1410
0001: Decreasing ack wait durations by 20 symbols to 14
1234: IFS offset = 0 samples 1234: Transmitting 385-1410 of 1410 1234: Finished transmission 1234: Need to wait for SIFS (12) symbols. Offset = 16, next IFS = 8
0001: Decreasing ack wait durations by 20 symbols to -6 Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 0001: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 0001: *********** Received frame type = Acknowledgment 0001: Need to wait for SIFS (12) symbols. Offset = 16, next IFS = 8 0001: *********** Adding Data request frame to the queue 0001: next IFS = 1920 0001: Decreased wait time by 20 symbols to 1900 0001: Decreased wait time by 20 symbols to 1880 0001: Decreased wait time by 20 symbols to 1860 0001: Decreased wait time by 20 symbols to 1840 0001: Decreased wait time by 20 symbols to 1820 0001: Decreased wait time by 20 symbols to 1800 0001: Decreased wait time by 20 symbols to 1780 0001: Decreased wait time by 20 symbols to 1760 0001: Decreased wait time by 20 symbols to 1740 0001: Decreased wait time by 20 symbols to 1720 0001: Decreased wait time by 20 symbols to 1700 0001: Decreased wait time by 20 symbols to 1680 0001: Decreased wait time by 20 symbols to 1660 0001: Decreased wait time by 20 symbols to 1640 0001: Decreased wait time by 20 symbols to 1620 0001: Decreased wait time by 20 symbols to 1600 0001: Decreased wait time by 20 symbols to 1580 0001: Decreased wait time by 20 symbols to 1560 0001: Decreased wait time by 20 symbols to 1540 0001: Decreased wait time by 20 symbols to 1520 0001: Decreased wait time by 20 symbols to 1500 0001: Decreased wait time by 20 symbols to 1480 0001: Decreased wait time by 20 symbols to 1460 0001: Decreased wait time by 20 symbols to 1440 0001: Decreased wait time by 20 symbols to 1420 0001: Decreased wait time by 20 symbols to 1400 0001: Decreased wait time by 20 symbols to 1380 0001: Decreased wait time by 20 symbols to 1360 0001: Decreased wait time by 20 symbols to 1340 0001: Decreased wait time by 20 symbols to 1320 0001: Decreased wait time by 20 symbols to 1300 0001: Decreased wait time by 20 symbols to 1280 0001: Decreased wait time by 20 symbols to 1260 0001: Decreased wait time by 20 symbols to 1240 0001: Decreased wait time by 20 symbols to 1220 0001: Decreased wait time by 20 symbols to 1200 0001: Decreased wait time by 20 symbols to 1180 0001: Decreased wait time by 20 symbols to 1160 0001: Decreased wait time by 20 symbols to 1140 0001: Decreased wait time by 20 symbols to 1120 0001: Decreased wait time by 20 symbols to 1100 0001: Decreased wait time by 20 symbols to 1080 0001: Decreased wait time by 20 symbols to 1060 0001: Decreased wait time by 20 symbols to 1040 0001: Decreased wait time by 20 symbols to 1020 0001: Decreased wait time by 20 symbols to 1000 0001: Decreased wait time by 20 symbols to 980 0001: Decreased wait time by 20 symbols to 960 0001: Decreased wait time by 20 symbols to 940 0001: Decreased wait time by 20 symbols to 920 0001: Decreased wait time by 20 symbols to 900 0001: Decreased wait time by 20 symbols to 880 0001: Decreased wait time by 20 symbols to 860 0001: Decreased wait time by 20 symbols to 840 0001: Decreased wait time by 20 symbols to 820 0001: Decreased wait time by 20 symbols to 800 0001: Decreased wait time by 20 symbols to 780 0001: Decreased wait time by 20 symbols to 760 0001: Decreased wait time by 20 symbols to 740 0001: Decreased wait time by 20 symbols to 720 0001: Decreased wait time by 20 symbols to 700 0001: Decreased wait time by 20 symbols to 680 0001: Decreased wait time by 20 symbols to 660 0001: Decreased wait time by 20 symbols to 640 0001: Decreased wait time by 20 symbols to 620 0001: Decreased wait time by 20 symbols to 600 0001: Decreased wait time by 20 symbols to 580 0001: Decreased wait time by 20 symbols to 560 0001: Decreased wait time by 20 symbols to 540 0001: Decreased wait time by 20 symbols to 520 0001: Decreased wait time by 20 symbols to 500 0001: Decreased wait time by 20 symbols to 480 0001: Decreased wait time by 20 symbols to 460 0001: Decreased wait time by 20 symbols to 440 0001: Decreased wait time by 20 symbols to 420 0001: Decreased wait time by 20 symbols to 400 0001: Decreased wait time by 20 symbols to 380 0001: Decreased wait time by 20 symbols to 360 0001: Decreased wait time by 20 symbols to 340 0001: Decreased wait time by 20 symbols to 320 0001: Decreased wait time by 20 symbols to 300 0001: Decreased wait time by 20 symbols to 280 0001: Decreased wait time by 20 symbols to 260 0001: Decreased wait time by 20 symbols to 240 0001: Decreased wait time by 20 symbols to 220 0001: Decreased wait time by 20 symbols to 200 0001: Decreased wait time by 20 symbols to 180 0001: Decreased wait time by 20 symbols to 160 0001: Decreased wait time by 20 symbols to 140 0001: Decreased wait time by 20 symbols to 120 0001: Decreased wait time by 20 symbols to 100 0001: Decreased wait time by 20 symbols to 80 0001: Decreased wait time by 20 symbols to 60 0001: Decreased wait time by 20 symbols to 40 0001: Decreased wait time by 20 symbols to 20 0001: Decreased wait time by 20 symbols to 0 0001: Processing next frame from the queue 0001: Initializing transmission; backoff delay = 2 steps 0001: Backoff delay = 2 steps -> 1 steps 0001: Backoff delay = 1 steps -> 0 steps 0001: Carrier sensing: Medium is idle. 0001: Clear to transmit 0001: IFS offset = 0 samples 0001: Transmitting 1-1280 of 3074
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
0001: IFS offset = 0 samples 0001: Transmitting 1281-2560 of 3074 0001: IFS offset = 0 samples 0001: Transmitting 2561-3074 of 3074 0001: Finished transmission 0001: will wait for ack for 54 symbols additional to IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = MAC command 1234: *********** Received MAC Command type = Data request 1234: Need to wait for SIFS (12) symbols. Offset = 8, next IFS = 0 1234: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 1234: Moving frame for 0000000033333333 from pending queue to the transmission queue 1234: next IFS = 0 1234: IFS offset = 0 samples 1234: Transmitting 1-1280 of 1410
0001: Decreasing ack wait durations by 20 symbols to 34
1234: IFS offset = 0 samples 1234: Transmitting 1281-1410 of 1410 1234: Finished transmission 1234: Need to wait for SIFS (12) symbols. Offset = 2, next IFS = -6
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 0001: Decreasing ack wait durations by 20 symbols to 14
1234: Processing next frame from the queue 1234: Initializing transmission; backoff delay = 5 steps 1234: Backoff delay = 5 steps -> 4 steps
0001: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 0001: *********** Received frame type = Acknowledgment 0001: Need to wait for SIFS (12) symbols. Offset = 2, next IFS = -6 0001: next IFS = 0
1234: Backoff delay = 4 steps -> 3 steps 1234: Backoff delay = 3 steps -> 2 steps 1234: Backoff delay = 2 steps -> 1 steps 1234: Backoff delay = 1 steps -> 0 steps 1234: Carrier sensing: Medium is idle. 1234: Clear to transmit 1234: IFS offset = 0 samples 1234: Transmitting 1-1280 of 4226 1234: IFS offset = 0 samples 1234: Transmitting 1281-2560 of 4226
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
1234: IFS offset = 0 samples 1234: Transmitting 2561-3840 of 4226 1234: IFS offset = 0 samples 1234: Transmitting 3841-4226 of 4226 1234: Finished transmission 1234: will wait for ack for 54 symbols additional to IFS = 0 1234: Decreasing ack wait durations by 20 symbols to 34
0001: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 0001: *********** Received frame type = MAC command 0001: *********** Received MAC Command type = Association response 0001: Need to wait for LIFS (40) symbols. Offset = 6, next IFS = 26 0001: *********** Association successful, changing short address to = 8CEC 8CEC: *********** Association successful, associated to PAN = 7777 8CEC: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 8CEC: next IFS = 26
1234: Decreasing ack wait durations by 20 symbols to 14
8CEC: IFS offset = 384 samples 8CEC: Transmitting 1-896 of 1410
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 1234: Decreasing ack wait durations by 20 symbols to -6
8CEC: IFS offset = 0 samples 8CEC: Transmitting 897-1410 of 1410 8CEC: Finished transmission 8CEC: Need to wait for SIFS (12) symbols. Offset = 8, next IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = Acknowledgment 1234: Need to wait for SIFS (12) symbols. Offset = 8, next IFS = 0 1234: next IFS = 0
8CEC: ********* (t=4.079360) Injecting data frame to the queue. From: 8CEC -> To: 1234 8CEC: Processing next frame from the queue 8CEC: Initializing transmission; backoff delay = 6 steps 8CEC: Backoff delay = 6 steps -> 5 steps 8CEC: Backoff delay = 5 steps -> 4 steps 8CEC: Backoff delay = 4 steps -> 3 steps 8CEC: Backoff delay = 3 steps -> 2 steps 8CEC: Backoff delay = 2 steps -> 1 steps 8CEC: Backoff delay = 1 steps -> 0 steps 8CEC: Carrier sensing: Medium is idle. 8CEC: Clear to transmit 8CEC: IFS offset = 0 samples 8CEC: Transmitting 1-1280 of 8578
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
8CEC: IFS offset = 0 samples 8CEC: Transmitting 1281-2560 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 2561-3840 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 3841-5120 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 5121-6400 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 6401-7680 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 7681-8578 of 8578 8CEC: Finished transmission 8CEC: will wait for ack for 54 symbols additional to IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = Data 1234: Need to wait for SIFS (12) symbols. Offset = 14, next IFS = 6 1234: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 1234: next IFS = 6 1234: IFS offset = 384 samples 1234: Transmitting 1-896 of 1410
8CEC: Decreasing ack wait durations by 20 symbols to 34
1234: IFS offset = 0 samples 1234: Transmitting 897-1410 of 1410 1234: Finished transmission 1234: Need to wait for SIFS (12) symbols. Offset = 8, next IFS = 0
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 8CEC: Decreasing ack wait durations by 20 symbols to 14 8CEC: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 8CEC: *********** Received frame type = Acknowledgment 8CEC: Need to wait for LIFS (40) symbols. Offset = 8, next IFS = 28 8CEC: next IFS = 28 8CEC: Decreased wait time by 20 symbols to 8 8CEC: ********* (t=4.795200) Injecting data frame to the queue. From: 8CEC -> To: 1234 8CEC: Processing next frame from the queue 8CEC: Initializing transmission; backoff delay = 6 steps 8CEC: Backoff delay = 6 steps -> 5 steps 8CEC: Backoff delay = 5 steps -> 4 steps 8CEC: Backoff delay = 4 steps -> 3 steps 8CEC: Backoff delay = 3 steps -> 2 steps 8CEC: Backoff delay = 2 steps -> 1 steps 8CEC: Backoff delay = 1 steps -> 0 steps 8CEC: Carrier sensing: Medium is idle. 8CEC: Clear to transmit 8CEC: IFS offset = 512 samples 8CEC: Transmitting 1-768 of 8578
Found preamble of OQPSK PHY.
8CEC: IFS offset = 0 samples 8CEC: Transmitting 769-2048 of 8578
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
8CEC: IFS offset = 0 samples 8CEC: Transmitting 2049-3328 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 3329-4608 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 4609-5888 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 5889-7168 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 7169-8448 of 8578 8CEC: IFS offset = 0 samples 8CEC: Transmitting 8449-8578 of 8578 8CEC: Finished transmission 8CEC: will wait for ack for 54 symbols additional to IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = Data 1234: Need to wait for SIFS (12) symbols. Offset = 2, next IFS = -6 1234: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 1234: next IFS = 0 1234: IFS offset = 0 samples 1234: Transmitting 1-1280 of 1410
8CEC: Decreasing ack wait durations by 20 symbols to 34
1234: IFS offset = 0 samples 1234: Transmitting 1281-1410 of 1410 1234: Finished transmission 1234: Need to wait for SIFS (12) symbols. Offset = 2, next IFS = -6
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 8CEC: Decreasing ack wait durations by 20 symbols to 14 8CEC: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 8CEC: *********** Received frame type = Acknowledgment 8CEC: Need to wait for LIFS (40) symbols. Offset = 2, next IFS = 22 8CEC: next IFS = 22 8CEC: Decreased wait time by 20 symbols to 2
1234: ********* (t=5.001280) Injecting data frame to the queue. From: 1234 -> To: 8CEC 1234: Processing next frame from the queue 1234: Initializing transmission; backoff delay = 1 steps 1234: Backoff delay = 1 steps -> 0 steps 1234: Carrier sensing: Medium is idle. 1234: Clear to transmit 1234: IFS offset = 0 samples 1234: Transmitting 1-1280 of 8578 1234: IFS offset = 0 samples 1234: Transmitting 1281-2560 of 8578
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY.
1234: IFS offset = 0 samples 1234: Transmitting 2561-3840 of 8578 1234: IFS offset = 0 samples 1234: Transmitting 3841-5120 of 8578 1234: IFS offset = 0 samples 1234: Transmitting 5121-6400 of 8578 1234: IFS offset = 0 samples 1234: Transmitting 6401-7680 of 8578 1234: IFS offset = 0 samples 1234: Transmitting 7681-8578 of 8578 1234: Finished transmission 1234: will wait for ack for 54 symbols additional to IFS = 0 1234: Decreasing ack wait durations by 20 symbols to 34
8CEC: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 8CEC: *********** Received frame type = Data 8CEC: Need to wait for SIFS (12) symbols. Offset = 14, next IFS = 6 8CEC: ********** Directly transmitting acknowledgement frame (no CSMA/CA) 8CEC: next IFS = 6 8CEC: IFS offset = 384 samples 8CEC: Transmitting 1-896 of 1410
Found preamble of OQPSK PHY. Found start-of-frame delimiter (SFD) of OQPSK PHY. 1234: Decreasing ack wait durations by 20 symbols to 14
8CEC: IFS offset = 0 samples 8CEC: Transmitting 897-1410 of 1410 8CEC: Finished transmission 8CEC: Need to wait for SIFS (12) symbols. Offset = 8, next IFS = 0
1234: PHY decoded IEEE 802.15.4 frame CRC check passed for the MAC frame. 1234: *********** Received frame type = Acknowledgment 1234: Need to wait for LIFS (40) symbols. Offset = 8, next IFS = 28 1234: next IFS = 28 1234: Decreased wait time by 20 symbols to 8
1 つ目のエンド デバイスが関連付けられると、エンド デバイスと PAN コーディネーターの間のリンクにデータ フレームがランダムに投入されます。
次に、3 つ目のデバイスが PAN に参加すると、スター トポロジの形で、コーディネーターと両方のエンド デバイス間でデータ フレームが交換されます (エンド デバイスはコーディネーターへのフレーム送信のみを行う必要があります)。この場合出力は表示されません。
% Create second end-device endDevice2 = lrwpan.MACReducedFunctionDevice( ... 'SamplesPerChip', 4, ... 'ShortAddress', '0002', ... 'ExtendedAddress', [repmat('0', 1, 8) repmat('4', 1, 8)], ... 'Verbosity', false); % Suppress detailed output endDevice1.Verbosity = false; panCoordinator.Verbosity = false; % Initialize input received3 = zeros(samplesPerChip * chipsPerSymbol * ... symbolsPerStep/2, 1); stopTime = 10; % sec while time < stopTime % Pass the received signals to the nodes for processing. Also, % fetch what they have to transmit transmitted1 = panCoordinator(received1); transmitted2 = endDevice1(received2); transmitted3 = endDevice2(received3); % Ideal wireless channel, where all nodes are within range: received1 = transmitted2 + transmitted3; % half-duplex radios % none receiving while % transmitting received2 = transmitted1 + transmitted3; received3 = transmitted1 + transmitted2; time = time + symbolsPerStep/symbolRate; % update clock end
チャネルの関係が適切に確立されている (送信された信号に応じて信号が受信されるなど) 限り、ネットワークにはさらにノードを追加できます。
その他の調査
Communications Toolbox Library for ZigBee and UWB アドオンには、次のジェネレーター関数と復号化関数、および構成オブジェクトが含まれています。
lrwpan.MACFullFunctionDevice
lrwpan.MACReducedFunctionDevice
lrwpan.MACDevice
これらのユーティリティはドキュメンテーションになく、API または機能が将来変更される可能性があります。これらのユーティリティのいずれかについてソース コードを表示するには、関数edit
を使用します。たとえば、次のように入力します。
edit lrwpan.MACFullFunctionDevice
MATLAB® コマンド ラインで上のように入力すると、lrwpan.MACFullFunctionDevice
が開きます。
参考文献
1 - "IEEE Standard for Local and Metropolitan Area Networks – Part 15.4: Low-Rate Wireless Personal Area Networks (LR-WPANs)," in IEEE Std 802.15.4-2011 (Revision of IEEE Std 802.15.4-2006) , vol., no., pp.1-314, 5 Sept. 2011, doi: 10.1109/IEEESTD.2011.6012487.