介绍了软PLC开发系统的构成和功能,并针对梯形图编辑到目标代码生成的过程,论述了编辑模块、编译模块和仿真模块的设计方案。首先,利用Visual Studio 2005建立梯形图编辑界面和梯形图组件库,实现组件调用和梯形图编辑功能;其次,根据梯形图的构成特点,通过一定的扫描规则来构成二叉树,并通过后序历遍算法来获得指令表;然后,为了实现编辑环境和运行环境的高效通信,通过查表的方式将指令表转换为较为简单的目标代码;最后,建立仿真环境来验证编程的正确性。
In order to optimize the embedded system implementation for Ethernet-based computer numerical control (CNC) system, it is very necessary to establish the performance analysis model and further adopt the codesign method from the control, communication and computing perspectives. On the basis of analyzing real-time Ethemet, system architecture, time characteristic parameters of control-loop ere, a performance analysis model for real-time Ethemet-based CNC system was proposed, which is able to include the timing effects caused by the implementation platform in the simulation. The key for establishing the model is accomplished by designing the error analysis module and the controller nodes. Under the restraint of CPU resource and communication bandwidth, the experiment with a case study was conducted, and the results show that if the deadline miss ratio of data packets is 0.2%, then the percentage error is 1.105%. The proposed model can be used at several stages of CNC system development.