Stanley Huang
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # G3-PLC Study Note ![](https://i.imgur.com/TzBrXVD.png) 此為G3聯盟所制定的規格,主要是用在窄帶的電力線通訊上。 制定的範疇只包含Physical和Data Link。 ![](https://i.imgur.com/96m4dHC.png) 資料鏈結層(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各有不同規範。 ![](https://i.imgur.com/yFPX4eT.png) * 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 ![](https://i.imgur.com/AprZl3M.png) * 不需要回ACK ![](https://i.imgur.com/d6cdpYV.png) * 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 * (N~FCH~ + MaxFrameSize + CIFS + RIFS) + ACK Time * MaxFrameSize:252 for CENELEC A, 511 for FCC ### Contention Window ![](https://i.imgur.com/F3IYTdP.png) **CFS**:Contention Free Slot **NPCW**:Normal Priority Contention Window **HPCW**:High Priority Contention Window **Specification規範的時間:** * **FCC Bandplan** ![](https://i.imgur.com/jXAL6DZ.png) * 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 = (**2^macMinBE^ - 1**) * aSlotTime = (**2^3^** - **1**) * **0.464** = **3.248** ms * **ARIB Bandplan** ![](https://i.imgur.com/uIcrGNf.png) * 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 = (**2^macMinBE^ - 1**) * aSlotTime = (**2^3^** - **1**) * **0.464** = **3.248** ms * **CENELEC A Bandplan** ![](https://i.imgur.com/JiV0kBn.png) * 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 = (**2^macMinBE^ - 1**) * aSlotTime = (**2^3^** - **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** ![](https://i.imgur.com/H98iAUD.png) **High Priority Contention Window** ![](https://i.imgur.com/zq2vXRY.png) ### ARQ **ARQ:Automatic Repeat reQuest Transmit ARQ** ![](https://i.imgur.com/ajz5fpB.png) **Receive ARQ** ![](https://i.imgur.com/Mm76pjU.png) ## Segmentation & Reassembly **MAC frame format** ![](https://i.imgur.com/J0naj8U.png) **Segment Control** ![](https://i.imgur.com/qtcSjPI.png) **Frame Control** ![](https://i.imgur.com/8cRnQz5.png) **Frame Type** ![](https://i.imgur.com/4sDeLYZ.png) **Command Frame** ![](https://i.imgur.com/FoI8HmM.png) **如何計算PHY PDU大小** 如果MAC層的Frame很大,以至於放不下PHY的PDU,這時候必須切割成適合的大小,而PHY層可以支援不同型態的modulation和Tonemap,因此PHY層最大可以乘載的資料也會隨著改變。 ![](https://i.imgur.com/qTbyBXM.png) 1. 計算出最大Symbol數 ![](https://i.imgur.com/s1xjK0I.png) * MaxRSBlockSize = **255** bytes * N~s~ is the number of symbols in the PHY packet * CC~Rate~ = **0.5** * CC~Zero~ ~Tail~ = **6** * FL~Band~ = **4** for CENELEC & FL~Band~ = **1** for FCC * FL~max~ = **63** for CENELEC & FL~max~ = **511** for FCC * Rep_Code denotes the repetition coding * Rep_Code = **4** for ROBO * Rep_Code = **1** for all other modes * mode~size~ * **1** for ROBO, DBPSK, BPSK * **2** for DQPSK, QPSK * **3** for D8PSK, 8PSK * **4** for 16QAM 2. 需要判斷是否超過最大Reed Solomon Block Size ![](https://i.imgur.com/oziIUZC.png) 3. 計算最大PHY PDU ![](https://i.imgur.com/nWRnB5m.png) 4. 範例 假設我們已經得到PHY訊框有40個symbol,用ROBO mode調變,CENELEC A band,可以求出實際上的byte數。ROBO Parity為8,其餘的Parity為16。 N~s~ * N~car~ * mod~size~ = (40 * 36 * 1) = 1440 bits CC~Rate~ / 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。 **隱藏節點問題** ![](https://i.imgur.com/MSwQyxk.png) 節點A和節點C傳輸距離剛好是互相接收不到的,節點B可以接收到節點A和節點C,如果節點A想傳送資料給節點B,當節點B送出資料後,節點C也想傳送資料給節點B且啟動載波偵測,也剛好沒偵測到節點A的,這時候節點C傳送資料到網路上就會和節點A的資料發生碰撞,此為隱藏節點問題。 **切割多個封包的碰撞避免** 為了減少碰撞的機率,當節點B收到節點A的資料以後,回傳ACK,其中ACK SSCA欄位設置1,接下來還有資料要傳輸,告知附近節點不要在這時候傳送資料。 ![](https://i.imgur.com/lS262Jr.png) ## 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 ![](https://i.imgur.com/o1mGJhR.png) ## Security mechanism ### AES - Wikipedia https://zh.wikipedia.org/wiki/%E9%AB%98%E7%BA%A7%E5%8A%A0%E5%AF%86%E6%A0%87%E5%87%86 ### Auxiliary Security Header ![](https://i.imgur.com/6HZhXUW.png) * 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~ ![](https://i.imgur.com/DYUNxvj.png) ### Security Control ![](https://i.imgur.com/oQKGu5t.png) ### CCM mode 可以參考RFC3610 https://tools.ietf.org/html/rfc3610 **CCM Nonce** 以下是CCM Nonce擺放的內容,總共有13個Bytes。 ![](https://i.imgur.com/45Zdzj2.png) **CCM Input Transformation** ![](https://i.imgur.com/ONuLzhT.png) * 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 ![](https://i.imgur.com/kpSe5mE.png) * Output is **c** data ![](https://i.imgur.com/WoNqOZT.png) **CCM Authentication Transformation** ![](https://i.imgur.com/QcXGU9K.png) 計算B_0, B_1, ..., B_n 其中B_0欄位如下: ![](https://i.imgur.com/uxvr9rT.png) B_0裡的Flags欄位如下: ![](https://i.imgur.com/vQHVQTv.png) * 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** ![](https://i.imgur.com/NrCmGMA.png) 先計算A_i ![](https://i.imgur.com/iP44W7H.png) 其中A_i裡的Flags欄位 ![](https://i.imgur.com/Z7xJSfl.png) * 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`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully