簡易檢索 / 詳目顯示

研究生: 劉川榮
Liu, Chuan-Rong
論文名稱: 設計與實作支援Modbus指令優先排序功能的協定轉換物聯網閘道器
Design and Implementation of a Protocol Conversion IoT Gateway Supporting Modbus Command Priority
指導教授: 侯廷偉
Hou, Ting-Wei
學位類別: 碩士
Master
系所名稱: 工學院 - 工程科學系
Department of Engineering Science
論文出版年: 2021
畢業學年度: 109
語文別: 中文
論文頁數: 60
中文關鍵詞: 乙太網路ModbusRS485嵌入式閘道器優先級物聯網
外文關鍵詞: Ethernet, Modbus, RS485, Embedded, Gateway, Priority, IoT
相關次數: 點閱:246下載:8
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 隨著物聯網的普及,現今工業上有許多利用RS485介面並且使用Modbus協定進行通訊的裝置有連網需求,許多廠商會為這些設備加裝乙太網路與RS485通訊轉換的閘道器,讓使用者可以遠距離讀寫裝置資訊,或者對其進行控制。當有多個使用者對閘道器同一個RS485 port傳遞請求時,若其中有較為緊急的指令,閘道器要優先將該指令發送至RS485線路中,以減少反應時間。本論文的目的為利用現有的閘道器設計框架與軟體設計模式,在確保半雙工的RS485通訊不產生碰撞的前提下,研究各種閘道器在網路伺服器架構的使用場合中,適合用於嵌入式系統開發的應用程式設計方式。
    本論文使用NuMaker-IIoT-NUC980開發板為開發平台,以Queue-based load leveling pattern與Half sync/half async pattern兩種軟體設計模式撰寫閘道器程式,並以實驗證實了此兩款閘道器程式的穩定性和避免RS485通訊碰撞、利用優先級降低反應時間等基礎功能。兩種閘道器軟體設計模式在不同情境下的表現測試中,當使用情形為單一使用者透過乙太網路對閘道器RS485 port傳遞Modbus指令時,使用Queue-based load leveling pattern新增執行緒專門處理使用者請求的方式可以帶來較低的反應時間;而在會有複數使用者透過乙太網路對同一個RS485 port傳遞Modbus指令的情形下,受速度慢的 RS485 通訊影響,無法達成高即時性的需求,因此使用Half sync/half async pattern單一非同步程式處理所有使用者請求的方式,在記憶體消耗方面會有明顯的優勢。

    Due to the popularity of the Internet of Things, there are many industrial devices using RS485 interface and Modbus protocol for communication. They have the demand for connecting to the internet nowadays. Many manufacturers install the gateways that convert between Ethernet and RS485 communication for these devices, allowing users to read and write devices’ information, or control them remotely. When multiple users transfer requests to the same RS485 port of the gateway, the gateway should send the urgent command to RS485 network first if it exists. It will reduce the reaction time. This research uses the existing framework and software design patterns to develop gateway under the premise of preventing signal collision in the half-duplex RS485 communication. The purpose is to research which method of gateway application design for embedded systems is better under different network server utilization situations.
    This research uses ARM9-based development board as the development platform. The design patterns of the gateway application are Queue-based load leveling pattern and Half sync/half async pattern. Experiments are tested on the basic functions of two gateway applications, including the stability, prevention of the RS485 signal collision, and reduction of reaction time via priority. Then the performance tests of two software design patterns in different scenarios are carried out. In case of just one user transfers Modbus command to the gateway RS485 port by Ethernet, Queue-based load leveling pattern, the method of adding thread to deal with the request, consume less time. If multiple users use Ethernet to send requests to the same gateway RS485 port, the gateway cannot arrive the real-time demand because of the low speed of RS485 communication. Half sync/half async pattern, which uses just one asynchronous program to handle all users’ requests, has the obvious advantage of system memory consumption.

    摘要 II Extended Abstract III SUMMARY III INTRODUCTION IV MATERIALS AND METHODS IV RESULTS AND DISCUSSION VI CONCLUSION X 誌謝 XI 目錄 XII 圖目錄 XIV 表目錄 XV 第1章 緒論 1 1.1 研究背景與動機 1 1.2 研究目的 1 1.3 研究貢獻 2 第2章 文獻探討與現有產品 4 2.1 Modbus介紹 4 2.1.1 Modbus協定內容 4 2.1.2 Modbus RTU 6 2.1.3 Modbus TCP 6 2.2現有產品 6 2.3 閘道器相關研究與設計 8 2.3.1 Modbus閘道器與相關研究 8 2.3.2閘道器程式設計框架 8 2.3.3 生產者/消費者架構 9 2.3.4 Queue-based load leveling pattern 10 2.3.5 Half sync/half async pattern[14] 11 2.3.6避免RS485通訊碰撞 12 第3章 系統架構設計與實作 13 3.1 硬體開發環境介紹 14 3.2 系統架構 14 3.3閘道器程式軟體架構 15 3.3.1 Queue-based load leveling pattern程式流程──無執行緒池 16 3.3.2 Queue-based load leveling pattern程式流程──使用執行緒池 20 3.3.3 Half sync/half async pattern程式流程 22 3.4 Priority queue功能設計與排序機制 26 3.4.1 Multilevel queue 26 3.4.2 將multilevel queue結合為單一queue 29 3.5 網頁架設與介面 33 第4章 研究成果與討論 38 4.1 穩定性壓力測試 39 4.2 RS485通訊碰撞測試 40 4.3 調整Modbus function code優先級測試 42 4.4 兩種軟體設計模式與實作方式的表現比較 45 4.4.1 閘道器應用程式反應時間 45 4.4.2 閘道器應用程式記憶體使用量 48 4.5 與市售產品的比較 52 4.6 測試結果討論 54 第5章 結論與未來研究方向 56 5.1 結論 56 5.2 未來研究方向 57 參考文獻 58

    [1] Eclipse IoT Working Group, IEEE IoT, AGILE IoT, IoT Council, IoT Developer Survey 2017. [Online]. Available: https://iot.eclipse.org/community/resources/iot-surveys/assets/iot-developer-survey-2017.pdf (accessed Jul. 14, 2021)
    [2] Modbus Organization, Modbus Application Protocol Specification V1.1b3. [Online]. Available: https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf (accessed Jul. 14, 2021)
    [3] NETEON, “Moxa產品購買網站.” https://shopmoxa.neteon.net (accessed Jul. 21, 2021)
    [4] Advantech, “Advantech產品購買網站.” https://iotmart.advantech.com.tw (accessed Jul. 21, 2021)
    [5] Santi Nuratch, “Microcontroller-based Modbus Master Design and Implementation for Multiple Networks and Platforms Using Object-based Design Technique,” in 2017 14th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON), Jun. 2017, pp. 616-619
    [6] 林裕文, 基於Modbus協定之多重設備與單一網路協定轉換之嵌入式系統研製 國立臺北科技大學碩士論文, 中華民國一零四年一月
    [7] Shuangye Chen, Dongyue Zheng, Rujun Yang, “Design of Preverifying Serial-Ethernet Communication Gateway Based on LM3S8962” in 2013 IEEE International Conference on Mechatronics and Automation, Aug. 2013, pp. 1620-1624
    [8] Liang Zhao, Wenyan Wu, Shengming Li, “Design and Implementation of an IoT-Based Indoor Air Quality Detector with Multiple Communication Interfaces,” IEEE Internet of Things Journal, vol. 6, no. 6, pp. 9621-9632, Dec. 2019
    [9] Jiangmiao Xie, Qiang Gao, “Design and Implementation of Embedded Protocol Conversion Gateway for Intelligent Buildings,” in 2019 IEEE 10th International Conference on Software Engineering and Service Science (ICSESS), Oct. 2019, pp. 1-5
    [10] 吳承樺, 採用Modbus 通訊協定之工業物聯網閘道器設計與實作, 國立聯合大學碩士論文, 中華民國一零八年一月
    [11] Dumitru-Cristian Trancă, Alexandru Viorel Pălăcean, Andrei Cristian Mihu, Daniel Rosner, “ZigBee based wireless Modbus Aggregator for Intelligent Industrial Facilities,” in 2017 25th Telecommunication Forum (TELFOR), Nov. 2017, pp. 1-4
    [12] Qi Xiong, Qiusheng Rong, “The Design of Serial Server Based on Semaphore Under Linux,” in 2010 2nd IEEE International Conference on Information Management and Engineering, Apr. 2010, pp. 398-400.
    [13] MicrosoftDocs, “Queue-based load leveling pattern.” github.com. https://github.com/MicrosoftDocs/architecture-center/blob/master/docs/patterns/queue-based-load-leveling.md (accessed Jun. 26, 2021)
    [14] Ronald Strebelow, Christian Prehofer, “Analysis of Event Processing Design Patterns and Their Performance Dependency on I/O Notification Mechanisms,” in International Conference on Multicore Software Engineering, Performance, and Tools, Aug. 2013, pp. 54-65.
    [15] Steffen Späthe, Christoph Prater, “Realization of IPv6 Connectivity via RS485 Fieldbus by Adaption of 6LoWPAN,” in 2018 IEEE International Conference on Internet of Things and Intelligence System (IOTAIS), Nov. 2018, pp. 35-39.
    [16] Nuvoton, NuMaker NUC980 IIoT User Manual. [Online]. Available: https://www.nuvoton.com/export/resource-files/NuMaker_NUC980_IIoT_User_Manual.pdf (accessed Jul. 17, 2021)
    [17] Chris Simmonds, Gustavo Zacarias, “procrank_linux.” github.com. https://github.com/csimmonds/procrank_linux (accessed Jul. 19, 2021)

    下載圖示 校內:2023-10-01公開
    校外:2023-10-01公開
    QR CODE