基于QT的PLC梯形图编辑系统设计与实现
2019-06-10李驰骎王庭有李应春杨安园
李驰骎 王庭有 李应春 杨安园



摘 要:为了探索PLC梯形图编辑系统的设计方法,从梯形图编程系统设计需求出发,分析传统梯形图网络的不足,采用一种高自由度的网络拓扑结构描述梯形图网络,并根据该网络拓扑结构提出一种分布式存储方案,实现梯形图图元之间的连接关系存储。基于QT图形框架采用面向对象的软件方法实现梯形图标准图元创建、连接关系建立、图元删除等功能。完成梯形图编辑系统设计后,对图元管理、各种指令调用进行编辑测试,结果表明该系统设计方法可行。
关键词:可编程控制器;梯形图;QT;存储结构;图元管理
DOI:10. 11907/rjdk. 181943
中图分类号:TP319文献标识码:A文章编号:1672-7800(2019)002-0072-04
Abstract: In order to explore the design method of PLC ladder diagram (LAD) editor system, we start with the overall requirements of LAD editor system, analyze the shortcomings of the traditional LAD network, and use a high-degree-of-freedom network topology to describe LAD network. According to the network topology, a distributed storage scheme is proposed to implement the storage of connection relationships between LAD primitives. The object-oriented software method based on the QT graphics framework is used to realize the functions of creating ladder diagram standard primitives, establishing connection relationships and deleting primitives. After completing the design of the ladder diagram editing system, we tested the management of graphic elements and various instructions. No problems were found during the process. The results shows that the method of designing the ladder diagram editing system proposed in this paper is feasible.
Key Words: programmable logic controller; ladder diagram; QT; storage scheme; primitive management
0 引言
可編程控制器(programmable logic controller,PLC)在工业控制领域应用广泛, PLC编程软件是推动PLC发展的重要动力[1-2],而编辑系统是编程软件中至关重要的组成部分,它负责梯形图的输入、编辑、显示,各个单元的位置、符号等信息保存,决定了软件的交互性[3]。
国外PLC发展相当成熟,PLC编程软件技术研究较多:Milik A[4]提出了一种多线程执行技术,利用数据流图识别程序的并行性,完成编程语言的编译;Prahofer等[5]采用程序上的模式匹配、控制流、数据流等分析方法,开发静态代码分析工具;Deveza等[6]将指令表作为Matlab/Simulink翻译软件包的输入,实现PLC在Matlab中的仿真;Kim H S等[7]采用二叉逻辑树方法实现梯形图程序的解释;Moonga等[8-10]通过将梯形图映射为AOV图的方法,把梯形图转换为AOV图,且使用双堆栈深度优先搜索算法(TSDFS)实现梯形图到指令表的转换;Asensio等[11]提出了基于IEC61131-3标准和PLCOpen TC6架构的完整工业自动化程序开发环境。……
