G3-PLC Study Note

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

此為G3聯盟所制定的規格,主要是用在窄帶的電力線通訊上。
制定的範疇只包含Physical和Data Link。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

資料鏈結層(Data Link)主要又分為

  • 6LoWPAN
    • Bootstrap
    • IPv6 Header Compression
    • Fragmentation
    • Mesh
  • MAC
    • CSMA/CA
    • Segmentation & Reassembly
    • ToneMap
    • Security

分了四種Bandplan:

  1. FCC (美規)
  2. ARIB (日規)
  3. CENELEC A (歐規)
  4. CENELEC B (義大利)

CSMA/CA mechanism

Inter-Frame spacing

  • Response IFS (RIFS)
    回ACK的反應時間,每個Bandplan各有不同規範。

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • Specification規範的時間:
      FCC: 10 symbols * 0.232 symbol time(ms) = 2.32 ms
      ARIB: 10 symbols * 0.232 symbol time(ms) = 2.32 ms
      CENELEC A: 8 symbols * 0.695 symbol time(ms) = 5.56 ms
  • Contention IFS (CIFS)

    • 需要回ACK
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • 不需要回ACK
      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
    • Specification規範的時間:
      FCC: 10 symbols * 0.232 symbol time(ms) = 2.32 ms
      ARIB: 108 symbols * 0.232 symbol time(ms) = 25.056 ms
      CENELEC A: 8 symbols * 0.695 symbol time(ms) = 5.56 ms
  • Extended IFS (EIFS)
    EIFS = Symbol Time * (NFCH + MaxFrameSize + CIFS + RIFS) + ACK Time

    • MaxFrameSize:252 for CENELEC A, 511 for FCC

Contention Window

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

CFS:Contention Free Slot
NPCW:Normal Priority Contention Window
HPCW:High Priority Contention Window
Specification規範的時間:

  • FCC Bandplan

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • Symbol Duration = 0.232 ms
    • aSlotTime = 2 * Symbol Duration = 2 * 0.695 = 0.464 ms
    • CFS = aSlotTime = 0.464 ms
    • HPCW = macHighPrioityWindowSize * aSlotTime = 7 * 0.464 = 3.248 ms
    • NPCW = (2macMinBE - 1) * aSlotTime = (23 - 1) * 0.464 = 3.248 ms
  • ARIB Bandplan

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • Symbol Duration = 0.232 ms
    • aSlotTime = 2 * Symbol Duration = 2 * 0.695 = 0.464 ms
    • CFS = aSlotTime = 0.464 ms
    • HPCW = macHighPrioityWindowSize * aSlotTime = 7 * 0.464 = 3.248 ms
    • NPCW = (2macMinBE - 1) * aSlotTime = (23 - 1) * 0.464 = 3.248 ms
  • CENELEC A Bandplan

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • Symbol Duration = 0.695 ms
    • aSlotTime = 2 * Symbol Duration = 2 * 0.695 = 1.39 ms
    • CFS = aSlotTime = 1.39 ms
    • HPCW = macHighPrioityWindowSize * aSlotTime = 7 * 1.39 = 9.73 ms
    • NPCW = (2macMinBE - 1) * aSlotTime = (23 - 1) * 1.39 = 9.73 ms

Flow Chart

Specification規範建議值

  • macMinBE = 3
  • macMaxBE = 8
  • macMaxCSMABackoffs = 50
  • macCSMAFairnessLimit = 25
  • macA = 8
  • macK = 5
  • macMinCWAttempts = 10
  • macHighPriorityWindowSize = 7

Normal Priority Contention Window

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

High Priority Contention Window

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

ARQ

ARQ:Automatic Repeat reQuest
Transmit ARQ

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Receive ARQ

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Segmentation & Reassembly

MAC frame format

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Segment Control

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Frame Control

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Frame Type

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Command Frame

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

如何計算PHY PDU大小
如果MAC層的Frame很大,以至於放不下PHY的PDU,這時候必須切割成適合的大小,而PHY層可以支援不同型態的modulation和Tonemap,因此PHY層最大可以乘載的資料也會隨著改變。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 計算出最大Symbol數

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    • MaxRSBlockSize = 255 bytes
    • Ns is the number of symbols in the PHY packet
    • CCRate = 0.5
    • CCZero Tail = 6
    • FLBand = 4 for CENELEC & FLBand = 1 for FCC
    • FLmax = 63 for CENELEC & FLmax = 511 for FCC
    • Rep_Code denotes the repetition coding
      • Rep_Code = 4 for ROBO
      • Rep_Code = 1 for all other modes
    • modesize
      • 1 for ROBO, DBPSK, BPSK
      • 2 for DQPSK, QPSK
      • 3 for D8PSK, 8PSK
      • 4 for 16QAM
  2. 需要判斷是否超過最大Reed Solomon Block Size

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 計算最大PHY PDU

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  1. 範例
    假設我們已經得到PHY訊框有40個symbol,用ROBO mode調變,CENELEC A band,可以求出實際上的byte數。ROBO Parity為8,其餘的Parity為16。

    Ns * Ncar * modsize = (40 * 36 * 1) = 1440 bits
    CCRate / Rep_Code = 0.5 / 4 = 0.125
    floor((1440 * 0.125 - 6) / 8) = floor(21.75) = 21
    Data Byte = 21 - 8 = 13 bytes

切割封包的規則

  • 每筆Segment都必須包含MAC Header和FCS。
  • 同一個MAC frame切割出來多個Segments,每筆Segment都設定相同的Sequence number,只有Segment Count會從0開始一直遞增。
  • 如果需要加密的MAC frame,應該先做完加密流程再進行切割,當Receiver收到之後先進行重組,再做解密。
  • 除了第一筆Segment正常執行CSMA來競爭Channel以外,其餘的Segment使用Contention free slot。
  • 如果需要進行ToneMap機制,在最後一筆Segment的Segment Control TMR欄位設1。
  • 最後一筆Segment應該在Segment Control LSF欄位設1。
  • Segment Length(SL)指的是目前Segment的長度,排除MAC Header、補零和PCS。

隱藏節點問題

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

節點A和節點C傳輸距離剛好是互相接收不到的,節點B可以接收到節點A和節點C,如果節點A想傳送資料給節點B,當節點B送出資料後,節點C也想傳送資料給節點B且啟動載波偵測,也剛好沒偵測到節點A的,這時候節點C傳送資料到網路上就會和節點A的資料發生碰撞,此為隱藏節點問題。

切割多個封包的碰撞避免
為了減少碰撞的機率,當節點B收到節點A的資料以後,回傳ACK,其中ACK SSCA欄位設置1,接下來還有資料要傳輸,告知附近節點不要在這時候傳送資料。

ToneMap mechanism

Procedure

  • 每當Transmitter想要傳送資料時,首先,必須要檢查自己的Neighbor Table是否有Receiver的紀錄。
  • Neighbor Table主要是紀錄每個Receiver的Short Address、ToneMap、Modulation Type、每個Tone的Gain值和Neighbor Table生存時間。
  • 如果Neighbor Table不存在,MAC層就會在傳送出去的資料中Segment Control TMR欄位設定1,等待接收端偵測目前通道品質之後,回覆ToneMap Response,其中此筆MAC Frame先用ROBO傳送。
  • 當Transmitter接收到Receiver回傳的ToneMap Response後,必須更新自己的Neighbor Table,只要Neighbor Table的生存時間還沒超時,下次要傳資料給同一個Receiver,就可以用Neighbor Table裡的參數來傳送資料。

Neighbor Table

Security mechanism

AES - Wikipedia

https://zh.wikipedia.org/wiki/高级加密标准

Auxiliary Security Header

  • Security Level:
    • 0x00:"none"
    • 0x05:"ENC=MIC-32"
  • Key Indentifier Mode:
    • 0x01表示只使用1個Byte當作Key Index表示,有0x0和0x1。
  • Example:(0x0D)16 = (00001101)2
    • Security Level:(101)2
    • Key Indentifier Mode:(01)2

Security Control

CCM mode

可以參考RFC3610 https://tools.ietf.org/html/rfc3610

CCM Nonce
以下是CCM Nonce擺放的內容,總共有13個Bytes。

CCM Input Transformation

  • Inputs are
    • Key - Block Cipher Key
    • N - Nonce
    • a data - Additional authenticated data
    • m data - Message to authenticate and encrypt
    • l(a) - Length of a data
    • l(m) - Length of m data

  • Output is c data

CCM Authentication Transformation

計算B_0, B_1, , B_n
其中B_0欄位如下:

B_0裡的Flags欄位如下:

  • Adata bit
    • 0, if l(a)=0
    • 1, if l(a)>0
  • M'=(M-2)/2
  • L'=L-1

B_1, B_2, , B_n => l(a) a m

CBC-MAC計算流程如下:

  • X_1 := E(K, B_0)
  • X_i+1 := E(K, X_i XOR B_i) for i = 1, , n
  • T := first-M-bytes(X_n+1)
  • where E() is the block cipher encryption function, and T is the MAC value

CCM Encryption Transformation

先計算A_i

其中A_i裡的Flags欄位

  • L'=L-1

利用Counter Mode來加密密文

  • S_i := E(K, A_i) for i = 0, 1, 2,

計算Authentication value U

  • U := T XOR first-M-bytes(S_0)

最後產出的結果C是密文,然後緊接著4個Byte的U

tags: G3 PLC Power Line Communication