新型DCS组态软件脚本系统的研究与开发
详细信息    本馆镜像全文|  推荐本文 |  |   获取CNKI官网全文
摘要
组态软件是用于工业自动化和过程监控的应用软件,它为自动化项目提供人机接口,实现现场总线控制系统与管理网络的互连。它的出现,为自动化工程技术人员提供了一种采用搭积木的方式制作现场控制过程和控制界面的工具。它能根据用户对被控对象和控制目的的要求在模块间进行任意组合,不仅满足了被控对象的个性需求,也缩短了软件开发时间,节省了开发费用。
     然而,随着工业自动化水平的不断提高,人们对组态软件的开放性、可维护性和可重用性提出了更高的要求。为组态软件提供二次开发功能成为满足上述要求的一个重要途径,许多成功的组态系统都采用脚本技术来支持现有系统的二次开发。采用这种模式进行开发的组态系统一般情况下都将自身的一些重要、安全的功能留给脚本,让脚本解释装置来控制并使用,实现组态软件自身功能的重利用。
     从目前情况看,国内工业监控组态软件仍停留在以C或Basic语言作为脚本的水平上,而国外虽然有采用面向对象的脚本语言,但平台间的可移植性并不完善。本文根据工业监控组态软件的常见结构,在研究了组态软件脚本功能现状和发展趋势的基础上,采用面向对象的JavaScript作为脚本语言并创造性地采用目前在浏览器Mozilla FireFox上用的底层引擎——基于C语言的跨平台开源内核SpiderMonkey作为脚本引擎,研究开发了新型组态软件的脚本模块,更灵活、更安全地解决了组态软件的二次开发问题。
     本课题来源是山东省科技厅重大科研攻关项目:基于工业以太网与现场总线技术的新型控制系统,项目编号为31400004010437。课题从设计需求到开发完成并通过测试,历经一年多时间。
     本文详细阐述了基于JavaScript语言、SpiderMonkey引擎的新型组态软件脚本模块的设计,分为脚本配置模块和脚本引擎模块,均采用动态链接库形式实现,并提供了诸多接口与组态软件的其它模块衔接,完成整体系统的实时通讯。根据软件开发模型,每个模块都进行了详细的需求分析、风险分析、设计实现和软件测试。其中脚本配置模块是为方便脚本编写而实现的配置界面,根据脚本动作的驱动事件不同,分为六种动作脚本加以实现。脚本引擎模块的作用是一个JavaScript脚本解释器,在实现了能够解释JavaScript内建对象、函数等的基础上,还实现了对自定义对象和函数的支持与解释。除了能够解释正常脚本之外,引擎模块还实现了脚本预编译排错功能,保证了脚本组态的安全。在系统的各个模块中,脚本与数据库模块之间的数据交换采用COM技术实现,与图形界面运行环境之间实现多线程调用。通过研究设计,最终实现了组态软件运行平台可以执行用户根据自身需要所开发的脚本代码的功能。
     本文最后根据《软件测试规范》对设计完成的脚本模块进行了周密的测试,包括单元测试和功能测试,并对整个组态软件系统进行了系统测试,使功能得到了完善,性能得到了优化。
Configuration software is one kind of application software used in industrial automation, process monitoring and control applications, which provides man-machine interface for the automation project and achieves interconnection between Fieldbus control system and management network. Its appearance provides a means for automation engineering personnel to implement field control process and interface by using a modular method. Arbitrary combination of the modules can be used according to the requirements of the control target and control purpose from customer, which can not only meet different needs of the control target, but also shorten the software development time, and save development costs.
     However, as industrial automation evolves, people are raising higher expectations of the open features, maintainability and reusability of the configuration software. Providing reusability for configuration software is an important way to address the problems mentioned above. Many successful configuration software supports reusability of existing systems by script technology. The important and security-related functionalities are implemented by script in the configuration software developed by this mode. The script interprets and controls the instrument and implements the reusability of the functionalities of the configuration software.
     Judging from the current situation, some domestic industrial monitoring and control configuration software still uses C or Basic language as script. Although object-oriented script language is available in foreign countries, the portability between different platforms still needs to be improved. Based on the common structure of the industrial monitoring, control configuration software, the study of script function and development trend of configuration software, this paper develops the script module of new generation configuration software and flexibly addresses the reusability of configuration software by using object-oriented JavaScript as script language and using C language based, cross-platform and open source SpiderMonkey which is the bottom of the engine used in the browser Mozilla FireFox currently as script engine.
     The topic is the major scientific research projects of Science and Technology Office in Shandong Province: New Control System based on Industrial Ethernet and Fieldbus. Item number is: 31400004010437.It took more than a year to design requirements, development and testing.
     This paper thoroughly describes script module design of new generation configuration software based on JavaScript language and SpiderMonkey engine, which is divided into script configuration module and script engine module. They are both implemented by dynamic link library, provide many interfaces to interface with other modules of the configuration software and achieve real time communication of the whole system. Each module has a detailed requirement analysis, design, implementation and testing. The script configuration module is designed to make the configuration easy, which is divided into six kinds of actions to implement according to the different driver incident of each action. The script engine module acts as a JavaScript interpreter, which can interprete not only the basis of JavaScript but also the self-defined functions.In order to guarantee the safety of script, the script engine module provides a function of precompiler. Of all the modules within the system, the script uses COM technology to implement the data exchange with library module and multithreading is also implemented between different running modules. Through research and design of the author, the functionality that the configuration software platform running the customized script from customer is eventually realized.
     Finally, in according with the software testing norms, this paper also conducts thorough tests, which includes unit test, functional test and performance test to improve the functionality and optimize the performance of the script modules.
引文
[1]刘翠玲,黄建兵.集散控制系统[M].中国林业出版社,2006.9.
    [2]常慧玲,杨云岗.集散控制系统的应用现状及发展方向[J].山西冶金,2006,(1):10-11.
    [3]Gang Li,Jing Ying,Minghui Wu.YSS2000:a configuration software system for industrial monitoring and controlling[J].Information Acquisition,2004:466-470.
    [4]WENG Yifang,DUAN Zhengang,LIAN Xiaoqin,ZHANG Xiaoli,YANG Wenying.Application of Configuration Software WinCC in Logistics Automatic Control System[J].International Symposium on Instrumentation and Control Technology,2006.10:13-15.
    [5]林威汉,高春光,张海涛.国内组态软件的现状与未来[J].电气时代,2000(7):9-12.
    [6]林伟.浅谈组态软件发展趋势[J].自动化博览,2003,3:45-47.
    [7]李正军.现场总线与工业以太网及其应用系统设计[M].人民邮电出版社,2006.2:1-25,236-265.
    [8]倪晏.工业控制组态软件的产品对比及发展趋势[J].测控技术,2000,19(9):38-40.
    [9]Li Jianwei,Xu Yubin.Design and Development of the Configuration Software for a Small Scale DCS in the Deep-Well Monitor and Control System[C],Sixth International Conference on Electronic Measurement & Instruments,2003.8:18-21.
    [10]袁楚明,周敬东,陈幼平,周祖德.实时多任务工业监控组态软件的研究与开发[J].机械与电子,2004,2:43-46.
    [11]王亚民,郝建领.DCS组态软件体系结构及其数据交换标准研究[J].计算机工程,2006.1,32(1):110-112.
    [12]李彬,孙继平,王瑛.组态软件中功能模块设计[J].煤矿设计,2000,10:17-19
    [13]Van der Hoek,A.Configureable software architecture in support of configuration management and software deployment[C],International Conference on Software Engineering,1999:732-733
    [14]Heck,B.S.,Wills,L.M.,Vachtsevanos,G.J.Software technology for implementing reusable,distributed control systems[J],IEEE Control Systems Magazine 2003,23,(1):21-35.
    [15]张友生,李雄.软件开发模型研究综述[J],计算机工程与应用,2006,3.
    [16]Li Na,Ma Zengliang.The Application of Script Language in Advanced Control Platform[C].Control Conference,2006.CCC 2006.Chinese,7-11 Aug.2006P:1996-2000.
    [17]于鹏.VBScript/ASP网页设计语言教程[M].电子工业出版社,2004.5.
    [18]苏俊,林红权,马增良.工业监控组态软件与VBA的集成设计[J].化工自动化及仪表,2002,29(4).
    [19]Innovators of the net:brend an eich and javascript[OL].http://wp.netscape.com/comprod/columns/techvision/innovators_be.html
    [20]http://wp.netscape.com/newsref/pr/newsrelease67.html
    [21]James Jaworski.Mastering JavaScript and Jscript[M].Sybex Inc.April 1999.
    [22]David Flanagan.JavaScript权威指南(5th)[M].机械工业出版社,2007.8.
    [23]周爱民.JAVASCRIPT语言精髓与编程实践[M].电子工业出版社博文视点,2008.3.
    [24]Edition3 Final ECMA Script Language Specification[S].http://www.mozilla.org/js/language/E262-3.pdf,European Computer manufacturer Association,2000.3.24.
    [25]WANG Ying,YU Manquan,LI Shengtao,WANG Bin,YU Zhihua.Extracting Dynamic URLs Using JavaScript Engine[J].JOURNAL OF COMPUTER APPLICATIONS,2004.24.02.
    [26]Spidermonkey[S].http://developer.mozilla.org/en/docs/SpiderMonkey.2008.3.
    [27]SpiderMonkey(JavaScript-C)Engine[S].http://www.mozilla.org/js/spider-monkey/.2007.10.
    [28]Using the JS API[EB/OL].http://lxr.mozilla.org/mozilla/source/js/src/ README.html
    [29]Embedding SpiderMonkey[EB/OL].http://developer.mozilla.org/en/docs/JavaScript C Engine_Embedder%27s_Guide.mozilla.org,march 10,2008.
    [30]How to embed the JavaScript engine[EB/OL],http://developer.mozilla.org/en/docs/How_to_embed_the_JavaScript_engine,mozilla.org,2000.2.
    [31]Mozilla Developer Center[EB/OL].http://developer.mozilla.org/en/docs/Main_Page.mozilla.org,2008.3.
    [32]JSAPI Reference[EB/OL].http://developer.mozilla.org/en/docs/JSAPI_Reference.2008.3.
    [33]崔艳芳.消息驱动机制在组态软件中的新应用[C].2005第六届工业仪表与自动化学术会议论文集.2005.6.26,上海.
    [34]力控用户手册[Z].北京三维力控科技有限公司,2005.
    [35]组态王6.5使用手册[Z].北京亚控科技发展有限公司,2004.
    [36]David J.Kruglinski.VISUAL C++6.0技术内幕(第五版)[M].清华大学出版社,2001.
    [37]Stanley B.Lippman Barbara E.Moo Josee LaJoie.C++Primer中文版(第4版)[M].人民邮电出版社,2006.3
    [38]Core JavaScript 1.5 Reference[S].http://developer.mozilla.org/cn/docs/Core_JavaScript_1.5_Reference.2007.5.11
    [39]Danny Goodman.JavaScript宝典(第四版)[M].电子工业出版社,2002.
    [40]R.Allen Wyke.JavaScript技术大全[M].机械工业出版社,2001
    [41]侯俊杰.深入浅出MFC(第2版)[M].华中科技大学出版社,2001.1.
    [42]Stanley B.Lippman.Essential C++[M].中国电力出版社,2003.8.
    [43]潘爱民.COM原理与应用[M].清华大学出版社,2000.3.
    [44]Sox,D.COM本质论[M].中国电力出版社,2001.7.
    [45]Lee,V.C.S.,Kwok-wa Lam,Sheung-Lun Hung.Concurrency control for mixed transactions in real-time databases[J].IEEE Transactions on Computers,2002.7,Vol.51,No.7:821-834
    [46]袁楚明,湛彦,周敬东等.实时多任务工业监控组态软件的研究与开发[J]. 机械与电子,2004,2:43-46.
    [47]李正军,宋晓庆,王松磊.COM组件技术在现场总线控制系统组态软件中的应用[J].自动化与仪器仪表,2003(10):37-39.
    [48]李涛,刘凯奎,王永皎.Visual C+++SQL Server数据库开发与实例[M].清华大学出版社,2006.7.
    [49]Liu Ming,Shi Ren.Design and implement of the database in the industrial control system based on COM[C].TENCON '02.Proceedings.2002 IEEE Region 10 Conference on Computers,Communications,Control and Power Engineering.2002,3:1443-1446.
    [50]刘志成.数据库系统原理与应用[M].机械工业出版社,2007.4.
    [51]段念.软件性能测试过程详解与案例剖析[M].清华大学出版社,2006.8.
    [52]Paaton,R.software testing[M].机械工业出版社,2006.1.
    [53]冯丽,张杰宏.如何设计软件测试用例[C].全国软件测试能力验证总结会暨中国宇航学会计算机应用专业委员会2006年学术年会,2006.12:30-33.

© 2004-2018 中国地质图书馆版权所有 京ICP备05064691号 京公网安备11010802017129号

地址:北京市海淀区学院路29号 邮编:100083

电话:办公室:(+86 10)66554848;文献借阅、咨询服务、科技查新:66554700