В этом примере показано, как симулировать IEEE ® 802.15.4™ асинхронный MAC CSMA [1] с помощью библиотеки Communications Toolbox™ для протокола ZigBee ®.
Стандарт IEEE 802.15.4 задает слои MAC и PHY низкоскоростных беспроводных персональных вычислительных сетей (LR-WPAN) [1]. Слои MAC и PHY IEEE 802.15.4 обеспечивают базис других стандартов более высокого уровня, таких как ZigBee, WirelessHart ®, 6LoWPAN и MiWi. Такие стандарты находят применение в домашней автоматизации и сенсорных сетях и имеют большое значение для тренда Интернета вещей (IoT).
IEEE 802.15.4 MAC [1] задает два основных режима MAC: (i) без использования маяка и (ii) MAC с поддержкой маяка. Не поддерживающий маяк MAC является асинхронным CSMA (множественный доступ с чувством несущей) MAC, который очень похож на MAC IEEE 802.11. MAC с поддержкой маяка позволяет два различных MAC-периода: (i) синхронизированный MAC-период CSMA и (ii) размеченный по времени, свободный от конкуренции MAC-период. Этот пример предоставляет обширную симуляцию IEEE 802.15.4 MAC с поддержкой неинхронных маяков, основанных на CSMA.
IEEE 802.15.4 ПАНОРАМИРОВАНИЙ (персональная сеть) настраивается стандартным процессом между конечными устройствами и координаторами ПАНОРАМИРОВАНИЯ. Во-первых, устройства, которые хотели бы присоединиться к сети, выполняют либо активное, либо пассивное сканирование. Активное сканирование означает, что устройство сначала передает маяк Запроса а затем выполняет пассивное сканирование. Пассивное сканирование означает, что устройство нюхает, чтобы собрать кадры-маяк от координаторов PAN (которые, возможно, получили свой запрос-маяк в случае активного сканирования). После набора маяков во время пассивного сканирования оконечное устройство выбирает ПАНОРАМИРОВАНИЕ, с которой оно хотело бы связываться. Затем он передает Запрос Ассоциации координатору этого ПАНОРАМИРОВАНИЕ, и координатор подтверждает его.
В отличие от IEEE 802.11, координатор не следит за подтверждением Запроса Ассоциации с немедленной передачей Ответа Ассоциации. Вместо этого координатор IEEE 802.15.4 сначала хранит ответ Ассоциации локально; он передается только тогда, когда оконечное устройство отправляет запрос данных, и координатор подтверждает это. Стандарт IEEE 802.15.4 использует термин косвенная передача для ссылки на этот механизм передачи систем координат. В целом этот механизм очень полезен для устройств с питанием от батарей сетей с низким трафиком (например, сенсорных сетей). Такие устройства могут периодически активировать свои радиостанции, чтобы проверить, ожидают ли они каких-либо систем координат, вместо того, чтобы постоянно использовать их радиостанции для немедленного приема системы координат.
После получения и подтверждения ответа Association конечное устройство сопоставляется с ПАНОРАМИРОВАНИЕ. В то время системы координат данных могут обмениваться между координатором и оконечным устройством в любом направлении. Системы координат данных могут быть подтверждены, в зависимости от их индикации 'Запрос подтверждения'.
Асинхронный CSMA IEEE 802.15.4 MAC аналогичен типовой операции CSMA и IEEE 802.11 MAC. В этой схеме MAC системы координат подтверждения передаются немедленно, без использования метода CSMA. Все другие системы координат передаются с использованием CSMA.
В частности, если устройство имеет систему координат для передачи, оно случайным образом выбирает задержку обратного вызова (количество периодов обратного вызова) из области значений [0 2 ^ BE-1], где BE является экспонентом обратного вызова. Длительность каждого периода отставания составляет 20 символов. Для OQPSK PHY в 2,4 ГГц эта длительность соответствует 128 чипам и 0,32 мс. Как только устройство дождалось выбранного количества периодов отката, оно выполняет измерение несущей. Если среда находится в простое, устройство начинает передачу своей системы координат, пока он не будет полностью передан.
Если среда занята во время определения несущей, экспонента обратной связи увеличивается на 1, и из новой области значений [0 2 ^ BE-1] выбирается новое количество периодов обратной связи. Когда обратный счетчик истекает снова, измерение несущей выполняется. Если максимальное количество обратных отсчётов достигается без свободного носителя во время любого образца измерения несущей, то устройство прекращает попытки передачи системы координат.
Этот пример предлагает реализацию для описанного процесса настройки сети и способа CSMA посредством lrwpan. MACFullFunctionDevice и lrwpan. Классы MACReducedFunctionDevice. В частности, включены следующие возможности:
Активное и пассивное сканирование
Обмен запросом на ассоциацию и ответом ассоциации
Косвенные передачи с использованием запросов данных
Подтверждения системы координат и повторные передачи системы координат, если подтверждения не получены своевременно
Короткий и длинный межкадровый интервалы (SIFS и LIFS)
Двоичный экспоненциальный обратный вызов
Измерение несущей
В этом разделе мы создадим сеть IEEE 802.15.4 из 3 узлов: один координатор ПАНОРАМИРОВАНИЕ и два конечных устройства. Сетевой симулятор сконфигурирован для обработки всех устройств с шагами в одну длительность резервного копирования (20 символов, 0,32 мс).
Во-первых, следующий код иллюстрирует ассоциацию первого устройства с сетью.
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)]); % 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: ********* Adding Beacon Request frame to the queue 0001: Passive scanning for 1584 steps 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-е оконечное устройство связано, системы координат данных случайным образом вводятся в ссылку связи между оконечным устройством и координатором ПАНОРАМИРОВАНИЕ.
Затем третье устройство присоединяется к ПАНОРАМИРОВАНИЕ, и системы координат данных впоследствии обмениваются между координатором и обоими конечными устройствами в звездной топологии (конечные устройства должны передавать системы координат только координаторам). В этом случае выход подавляется.
% 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
Больше узлов может быть добавлено в сеть, пока отношение канала установлено соответственно (то есть, принятые сигналы как функция от переданных сигналов).
Можно дополнительно исследовать следующие функции генератора и декодирования, а также объект строения:
IEEE 802.15.4-2011 - Стандарт IEEE для местных и столичных сетей - Часть 15.4: Низкоскоростные беспроводные персональные сети (LR-WPAN)