基于开放式数控系统的软PLC开发与应用
- 格式:docx
- 大小:2.34 MB
- 文档页数:79
I
摘要
开放式数控系统是数控系统领域发展的重点方向,而传统的 PLC 已经无法满足开放式数控系统的要求,在 PC 机平台上以软件实现传统 PLC 功能的软 PLC 技术已经成为了开放式数控系统实际应用中的一项关键技术。为了实现用户特定的控制工艺,全软件型数控系统(EMC2)在实际应用过程中经常使用 shell 脚本来进行辅助开发,并通过硬件抽象层(HAL)管脚来操作数控系统完成控制任务。这种开发方式不但不易被用户掌握,而且控制工艺在试用期间是需要不断调整的,这样就造成了数控系统应用开发任务重、周期长、维护难等问题,不利于数控系统在市场的应用与推广。
为解决上述问题,本文在基于 PC 的全软件型数控系统(EMC2)上开发出了一套软PLC 应用软件,用户可以根据自身的工艺要求使用梯形图自行设计操作流程。其主要内容如下:
首先,根据符合 IEC61131-3 标准的梯形图编程规则,使用 Qt 设计并实现了软PLC
的编辑器,用户可以使用该编辑器完成梯形图程序的编辑、保存、打开等操作。
其次,根据在编辑过程中保存梯形图程序所使用的数据结构的特点,研究了基于二维数组的梯形图转换为指令表的策略,并根据梯形图的运行规则,设计并实现了直接对梯形图程序进行解释执行的算法。
再次,根据 EMC2 的HAL 机制设计并实现了运行系统的解释执行模块,使得软 PLC
可以周期性的读取输入、解释执行梯形图程序、刷新输出。基于该运行机制,还设计实现了软PLC 轴控制功能。
最后对软 PLC 各个功能模块进行了测试,并以 LED 点胶机为实验平台,将所开发的软PLC 应用程序搭载到EMC2 数控系统上,使用 PLC 编辑开发 LED 点胶机的梯形图程序。经实际运行测试,LED 点胶机能够完成预定的工艺流程,PLC 以及数控系统亦能够稳定地工作。
关键词:开放式数控系统;EMC2;软PLC;硬件抽象层;QT II
Abstract
Open CNC system is the key development direction in the field of numerical control
system, but the traditional PLC has been unable to meet the requirements of open CNC
system. Soft-PLC which was implemented in software based on PC has been an important
technology in the practical application of open CNC system. In order to realize the specific
control process for users, the shell script usual was used to assistant development, and through
the HAL pins to operate the numerical control system to implement the control task during the
application of full software CNC (EMC2). The development mode have some limitations,
most of users do not have the ability to develop by this manner, and the control technology
requires frequent adjustment during the trial period, which caused the application tasks of
CNC system become heavy, development cycle become longer, and more difficult to maintain.
These defects have hindered the application and promotion of CNC system in the market.
In order to solve the above problems, the soft-PLC has been developed based on full
software CNC, it lets users design their own operating procedures according to their demands
by themselves. Its main contents are listed as follows.
Firstly, according to the programming rules of ladder diagram which has been defined in
the standard IEC61131-3, the editor of ladder diagram was designed and realized by Qt.
Users of soft-PLC can edit or save, open programs of ladder diagram.
Secondly, the strategy of transforming the ladder diagram based on two-dimensional
array to instruct list was studied according to characteristics of the data structure which was
used to save ladder diagram during the editing progress. The algorithm to directly explain
and execute ladder diagram programs has also been designed and implemented.
Thirdly, the modules of the running system to explain and execute ladder diagram
programs was realized based on HAL of EMC2, which enable soft-PLC to read inputs,
explain and execute ladder diagram programs, and renew output periodically. In a result, the
axis control function of soft- PLC has also been realized. III
Finally, each of function modules of the soft-PLC has been tested, and also it has
successfully used in a LED dispenser, the result of testing indicate that the LED dispenser can
correctly accomplish the technological process.
Key words: open CNC system; EMC2; soft-PLC; HAL; QT IV
目录
摘要 ..................................................................................................................................... I
Abstract ............................................................................................................................. II
第一章 绪论 ...................................................................................................................... 1
• 课题研究的背景与意义 .......................................... 1
• 开放式数控系统简介 ....................................... 1
• 软PLC 产生的背景 ........................................ 2
• 软PLC 的国内外发展现状 .................................. 3
• 软PLC 的发展趋势 ........................................ 3
• 课题的提出和研究内容 .......................................... 4
• 课题的提出 ............................................... 4
• 课题的研究内容 ........................................... 4
• 本论文的组织结构 .............................................. 5
第二章 软 PLC 应用软件的总体设计 ............................................................................ 6
• 传统PLC 的体系结构和工作原理 .................................. 6
• 传统PLC 的硬件体系结构 .................................. 6
• 传统PLC 的工作原理 ...................................... 7
• 全软件型数控系统的体系结构 .................................... 8
• 实时操作系统平台 ......................................... 8
• 开源数控软件EMC2 .............................................................................. 9