工業局生醫電子

2016年12月30日 星期五

Wi-Fi 與Zigbee 的MAC Algorithm



Zigbee 的MAC Algorithm:

(1) Binary Random Backoff
(2) Channel Idle > CCA (CW=2)  ==>  如果CW減到0 則傳送否則重新再來過

CW=2 是一個固定值 , 表示idle 至少有CW以上的時間,才認為channel idle 才可以傳

若Binary Random Backoff 完後, channel仍不是idle (包含CW沒有減到0) 則都是再一次進行Binary Random Backoff

BP=random(0, 2^BE-1)

BP: Backoff Period
BE: Binary Exponent , 每次發生collision .  BE都會增加 ,其初始值為3, 則第一次BP為random(0,7)
NB: backoff 次數限值


Wi-Fi 的MAC  Algorithm (DCF)

DCF (Distributed Coordination Function)= CSMA/CA+ACK

程序:

(1) Channel Idle > DIFS  ? ==>  channel idle是否大於DIFS的期間,若是,則直接傳送。若否則隨機選一個random backoff window, 並且每一個time slot減1, 當減到0時, 才能傳送。減1的動作只有在判斷channel 是Idle的狀態才會減1, 若channel是busy狀態, 則不減1 ("freeze Backoff window")

 若sender 還有下一筆資料要跟著傳送, 則等完成一個DIFS時間並進入backoff  time的狀能, 此狀態將再產生一個content window, 同樣[的, 當減到0的時候, 才能傳送。-->此機制也讓其他,
有機會可以取得medium來傳送。

(2) Binary Random Backoff ( 決定了CW的值 ) =>  當CW減到0時, 就直接傳送不用管channel idle與否。若傳了之後是發生碰撞(沒有收到ACK則視為碰撞),則此次傳輸沒有成功, 再重傳, 從(1)再來過。

CW=2 非固定值,  CW=random(CWmin, 2^BE-1) 介於CWmin~CWmax中間,

CWmin------------ CW-------------------CWmax
CW=min(CWmax, CW)
CW=max(CWmin, CW)

若idle 長度至少有DIFS的長度才視為channel idle






----------------------------------------------------------

Wi-Fi vs  Zigbee 


  • Zigbee 先Backoff , 不管channel 是否idle
  • Zigbee 的CW是固定值, 而Wi-Fi CW是一個變數, Wi-Fi CW 其實是Zigbee 的BP, 兩者名稱相同, 但意思不同
  • Zigbee 評估 Channel Idle , 看CW, 而Wi-Fi 評估 Channel Idle , 看DIFS
  • Zigbee Backoff 的 BP會一直減1不管channel 是否idel或有人傳 , 而Wi-Fi Backoff 的 CW會減1但必須channel 是 idel狀態才能減1








CCA: Clear  Channel Assessment

CW: Contention Window

DCF: Distributed Coordination Function

DIFS: DCF Inter Frame Space


 References:

  1. https://www.vocal.com/networking/802-11-distributed-coordination-function-dcf/
99.9% of the time Wireless is half duplex. There are experiments that can result in a "full duplex" wireless network but that's all lab-based and not real-world.
Full-duplex is what most wired connections use which means two devices can send and receive data at the same time and can also detect collisions straight away. via CSMA/CD
With Wireless the devices cannot send and receive simultaneously and they cannot sense collisions. Instead they use CSMA/CA to detect usage on the frequency to see if it is safe to transmit data. There are a large number of factors that can affect a wireless signal and interfere with it which results in lower throughput.


1 則留言 :

  1. Thanks for sharing, nice post!

    Mẹ nên mua may dua vong cho bé loại nào tốt hay những công việc làm thêm tại nhà lương cao hiệu quả, chương trình tuyển cộng tác viên bán quần áo trẻ emtuyển cộng tác viên bán hàng mỹ phẩm lương cao tại nhà hay dịch vụ mua hang xach tay tu my hay dịch vụ mua hàng trên aliexpressmua hàng trên taobao hay dịch vụ nhận đặt mua hàng trên trang web taobao tiếng việt hay taobao com tiếng việt uy tín, giá rẻ

    回覆刪除