簡易檢索 / 詳目顯示

研究生: 洪偉哲
Hung, Wei-Je
論文名稱: 基於IEC61131-10格式的可程式邏輯控制器之梯形圖編譯成結構式文本語言
Compiling PLC Ladder Diagram to Structured Text Based on IEC61131-10 Standard
指導教授: 廖德祿
Liao, Teh-Lu
學位類別: 碩士
Master
系所名稱: 工學院 - 工程科學系
Department of Engineering Science
論文出版年: 2020
畢業學年度: 108
語文別: 中文
論文頁數: 51
中文關鍵詞: 頂點活動圖IEC61131-10規範梯形圖功能塊結構化文本
外文關鍵詞: AOV, IEC61131-10, Ladder Diagram, Function Block, Structured Text
相關次數: 點閱:55下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • IEC61131-10為IEC61131項目的導出和導入指定了一種基於XML的交換格式,可以在不同的開發環境之間轉移,由於IEC61131-10規範的問世,既有的編譯軟體無法編譯符合IEC61131-10的XML,換句話說即無法編譯PLC以圖形表示並儲存於XML檔之程式。本篇論文基於IEC61131-10所指定的XML格式,將PLC梯形圖(ladder diagram)經由一系列的步驟轉換為結構化文本(structured text),包括將梯形圖映射為頂點活動圖(Activity on Vertex, AOV),將AOV圖以鄰接矩陣儲存,並以連結串列依序將結構化文本程式輸出。本論文利用串聯-並聯化簡,直接將化簡得出的布林邏輯式儲存在AOV上的節點位置,再將最終的結果輸出為結構化文本。有別於以往論文只討論梯形圖的轉換,本論文將加入功能塊一同討論,並將功能塊(function block)接腳引進原始AOV圖,再以遞迴搜尋的方式找出每個對應接腳的AOV子圖,分部拆解AOV圖並逐一解析其中布林邏輯式,再將邏輯式重組為結構化文本的樣貌,進而完成含有功能塊梯形圖與結構化文本的轉換。

    The purpose of this thesis is to compile PLC ladder diagram into structured text. This thesis uses the methodology of converting ladder diagram into activity on vertex (AOV) digraph and series parallel merging method to realize an algorithm for compiling a ladder diagram into structured text. It is an algorithm specified for the XML based on IEC61131-10, which is released in April 2019. The research methodology of the thesis is to generate an AOV digraph by the output pin id provided by the XML to realize the topology of the ladder diagram including function blocks. As we have this AOV digraph, we use a double iterative method to divide this AOV digraph into several AOV subgraphs by the notation of coils and function blocks. In the end, we can get the structured text by using series parallel merging method to solve each AOV subgraph.

    目錄 中文摘要 i EXTENDED ABSTRACT ii 誌謝 vi 目錄 vii 表目錄 ix 圖目錄 x Chapter 1 緒論 1 1.1 前言 1 1.2 研究動機 1 1.3 研究方法 2 1.4 論文架構 3 Chapter 2 文獻回顧 4 2.1 有向圖與無向圖 4 2.1.1 有向無環圖 5 2.1.2 同構 (Isomorphism) 5 2.1.3 AOV有向圖 6 2.1.4 入支度與出支度 6 2.1.5 PLC梯形圖所對應的AOV有向圖 6 2.2 圖的資料結構 6 2.2.1 邊列 (Edge list) 6 2.2.2 鄰接矩陣表示法 (Adjacency Matrix) 7 2.2.3 鄰接向量表示 (Adjacency List) 8 2.3 梯形圖基本介紹 8 2.3.1 IEC61131 標準 8 2.3.2 梯形圖常用基本元件 9 2.3.3 梯級 (Rung) 10 2.3.4 梯形圖基本性質 10 2.3.5 程序組織單元(POU, Program Organization Units) 10 2.3.6 程序 (Program) 10 2.3.7 功能塊 (Function blocks) 10 2.3.8 PLC配置(Configuration) 11 2.3.9 一般變數 12 2.3.10 直接表示變數 13 2.4 PLC梯形圖的轉換 14 2.5 可延伸標示語言 14 2.5.1 可延伸標示語言技術及發展 14 2.5.2 IEC61131-10加註語言 15 Chapter 3 IEC61131-10規範之XML之LD轉換方法 17 3.1 梯形圖分析 17 3.1.1 梯形圖分析流程 18 3.1.2 梯形圖元件對應表 19 3.1.3 鄰接矩陣表示AOV圖 21 3.2 AOV圖化簡 22 3.2.1 AOV圖的前處理 22 3.2.2 OR的化簡 24 3.2.3 AND的化簡 25 3.2.4 “工”字接法之虛節點處理 27 Chapter 4 功能塊混和編程轉換 30 4.1 功能塊的使用 30 4.2 遞迴搜尋 31 4.3 功能塊輸出與階梯元件進行耦合 32 4.4 二次遞迴生成AOV圖 34 4.5 功能塊的排序與深度優先搜尋(DFS)應用 36 4.5.1 深度優先搜尋介紹(DFS) 36 4.5.2 功能塊轉換成樹狀圖 37 4.6 除錯標記 39 Chapter 5 案例分析 40 5.1 馬達運動功能塊案例分析 41 5.2 建立馬達運動功能塊案例 41 5.3 馬達運動功能塊轉換與驗證 43 Chapter 6 結論與未來方向 46 6.1 結論 46 6.2 未來發展 46 參考文獻 47 附錄 49   表目錄 表格 2.1 梯形圖基本元件介紹 9 表格 2.3 方向前綴表 13 表格 2.4 大小前綴表 13 表格 2.5 對應圖 2.14的XML 16 表格 3.1 梯形圖元件對應表 20 表格 3.2 圖 3.13 並聯梯形圖轉換為AOV圖的詳細內容 25 表格 3.3 圖 3.16 AOV圖的詳細內容 26 表格 3.4 編譯結果比較表 28   圖目錄 圖 1.1 編譯PLC語言流程圖 2 圖 2.1 無向圖 4 圖 2.2 有向圖 4 圖 2.3 G1和G2的同構映射關係 5 圖 2.4 邊列的資料結構示意圖 7 圖 2.5 鄰接矩陣表示法示意圖 7 圖 2.6 鄰接向量表示法示意圖 8 圖 2.7 配置、資源與任務的階層關係 11 圖 2.8 配置、資源與任務的階層關係以結構文本表示 11 圖 2.9在UI上宣告變數 12 圖 2.10 存在XML中的變數 12 圖 2.11 結構化文本上的變數 12 圖 2.12 XML上的直接表示變數 13 圖 2.13 ST上的直接表示變數 13 圖 2.14 基本梯形圖 15 圖 3.1 轉換流程圖 17 圖 3.2 梯形圖範例 18 圖 3.3 梯形圖儲存成XML 18 圖 3.4 儲存梯形圖的AOV圖 18 圖 3.5範例梯形圖 19 圖 3.6 梯形圖 21 圖 3.7 對應圖 3.5的AOV圖 21 圖 3.8 從梯形圖到最簡AOV圖 22 圖 3.9 加入虛節點的AOV圖 22 圖 3.10 鄰接矩陣四個區域 23 圖 3.11 前處理後的AOV圖 24 圖 3.12 並聯梯形圖 24 圖 3.13 並聯梯形圖轉換為AOV圖 24 圖 3.14 並聯梯形圖化簡後 24 圖 3.15 串聯梯形圖 25 圖 3.16 串聯梯形圖轉為AOV圖 25 圖 3.17 串並聯化簡AOV圖流程圖 26 圖 3.18 工字接法1 27 圖 3.19 工字接法2 27 圖 3.20 工字接法3 27 圖 3.21 工字接法4 27 圖 3.22 工字接法54 27 圖 3.23 工字接法比較範例 28 圖 3.24工字接法4的實例 29 圖 3.25工字接法5的實例 29 圖 3.26工字接法4的AOV圖 29 圖 3.27工字接法5的AOV圖 29 圖 3.28工字接法4化簡後AOV圖 29 圖 3.29工字接法5化簡後AOV圖 29 圖 4.1 功能塊圖的使用範例 30 圖 4.2 遞迴搜尋起點 31 圖 4.3 功能塊的並聯 32 圖 4.4 上半部的子圖 32 圖 4.5 上半部AOV子圖 33 圖 4.6 上半部的子圖 33 圖 4.7 下半部AOV子圖 33 圖 4.8 二次遞迴產生AOV圖的流程圖 34 圖 4.9 梯形圖混和編程範例 35 圖 4.10 第一次遞迴的路徑 35 圖 4.11 TON_2.Q逆向遞迴產生第二張AOV子圖 36 圖 4.12 TON_3.Q逆向遞迴產生第三張AOV子圖 36 圖 4.13 樹狀圖範例 37 圖 4.14 DFS的拓樸順序 37 圖 4.15 待進行功能塊圖排序的梯形圖 38 圖 4.16 功能塊所組成的樹狀圖 38 圖 4.17 加入除錯標籤的結構化文本 39 圖 5.1 程式驗證流程圖 40 圖 5.2 MC_POWER和MC_JOG功能塊 41 圖 5.3 直得科技PLC開發環境 42 圖 5.4 驗證梯形圖RUNG1及RUNG2 42 圖 5.5 驗證梯形圖RUNG3 42 圖 5.6 驗證梯形圖RUNG4 43 圖 5.7 驗證梯形圖RUNG5 43 圖 5.8 結構變數宣告 44 圖 5.9 區域變數宣告 44 圖 5.10 結構化文本主程式 45 圖 5.11 配置、資源以及任務的設定 45 圖 A1.1 梯形圖測試程式1 49 圖 A1.2 梯形圖測試程式2 49 圖 A1.3 梯形圖測試程式3 50 圖 A1.4 梯形圖測試程式4 50 圖 A1.5 梯形圖測試結果 51 圖 A1.6 工字型梯形圖測試 51

    參考文獻

    [1] International Electrotechnical Commision“Programmable controllers - Part 10: PLC open XML exchange format,” Technical Report, International Electro technical Commission, 2019.
    [2] G. Fen and W. Ning, “A Transformation Algorithm of Ladder Diagram into Instruction List Based on AOV Digraph and Binary Tree,” TENCON 2006 - 2006 IEEE Region 10 Conference, pp. 1-4, 2006.
    [3] F. Hu, L. Fu, L. Liu and G. Zhang, “ An Algorithm about Transforming PLC Ladder Diagram to Instruction List Based on Series-Parallel Merging Method,” 2008 IEEE Pacific-Asia Workshop on Computational Intelligence and Industrial Application, pp. 812-816, 2008.
    [4] J. Karl-Heinz, M. Tiegelkamp, IEC61131-3: programming industrial automation systems, Springer-Verlag Berlin Haidelberg, 2010.
    [5] Y. Bao, X. Ding and Y. Song, “Conversion from PLC Ladder Diagram to the Assembly Language Based on AOV Graph,”2012 Fifth International Conference on Intelligent Networks and Intelligent Systems, pp. 69-72, 2012.
    [6] Bollobas, Bela,“Modern Graph Theory,”Springer-Verlag, 1998.
    [7] Diestel, Reinhard,“Graph Theory,”Springer-Verlag, 2016.
    [8] R. Somkunwar and V. M. Vaze, R. Somkunwar and V. M. Vaze, “A novel approach for graph isomorphism: Handling large graphs,” 2017 2nd IEEE International Conference on Recent Trends in Electronics, Information & Communication Technology, 2017.
    [9] F. Harary and R. Z. Norman, Structural Models: An Introduction to the Theory of Directed Graphs, John Wiley & Sons Inc; 1st edition , 1965.
    [10] M. Schürenberg, “Transformation of GRAFCET-Based Control Specifications Into an IEC 61131-3 Implementation”Technische Universität Hamburg-Harburg Institute for Software Systems, 2015.
    [11] 魏良縈, “可加註語言樹轉換法的分析:從記號階梯圖到記號圖,”國立交通大學工業工程與管理研究所碩士論文, 2010.
    [12] K.H. Jhon, M. Tiegelkamp, “IEC61131-3 Programming Industrial Automation Systems,”Springer, 1995
    [13] Yan Yi and Chen Haidan, “An optimizing compiler method to avoid partial invalid PLC instruction,” 2010 IEEE International Symposium on Industrial Electronics, 2010.
    [14] D. Li, Q. Cai and F. Pei, “The new interconversion algorithm between ladder diagram and instruction list,” 2010 IEEE International Conference on Intelligent Computing and Intelligent Systems, pp. 820-823, 2010.
    [15] J. Zhang, B. Lang and Y. Duan, “An XML Data Placement Strategy for Distributed XML Storage and Parallel Query,” 2011 12th International Conference on Parallel and Distributed Computing, Applications and Technologies, pp. 433-439, 2011.
    [16] A. Dekhtyar and I. E. Iacob, “Processing XML documents with overlapping hierarchies,” Proceedings of the 5th ACM/IEEE-CS Joint Conference on Digital Libraries (JCDL '05), pp. 409-409, 2005.
    [17] PLCopen, “IEC 61131-10”.https://plcopen.org/iec-61131-10.
    [18] Q. Ye, “IFN Application in DFS of Artificial Intelligence,” 2008 International Conference on MultiMedia and Information Technology, 2008.
    [19] Beckhoff, “Beckhoff Information System”, https://infosys.beckhoff.com

    [20] R. Somkunwar and V. M. Vaze,“A novel approach for graph isomorphism: Handling large graphs,” IEEE International Conference on Recent Trends in Electronics, Information & Communication Technology, pp. 1242-1247, 2017.
    [21] L. Huang, W. Liu and Z. Liu, “Algorithm of transformation from PLC ladder diagram to structured text,” International Conference on Electronic Measurement & Instruments, pp. 4-778-4-782, 2009.

    無法下載圖示 校內:2025-08-05公開
    校外:不公開
    電子論文尚未授權公開,紙本請查館藏目錄
    QR CODE