节点文献
基于Xenomai和工控机的实时测控系统的研究
Study of Real-time Measurement and Control System Based on Xenomai and IPC
【作者】 张鹏;
【导师】 陈曾汉;
【作者基本信息】 重庆大学 , 电气工程, 2008, 硕士
【摘要】 为了保证电力系统调度人员更好的把握安全控制、事故处理的主动性,减少和避免误操作、误判断,提高电网的运行管理水平,电力系统安全监控装置必须是零时限驱动的。同时,电力监控系统任务的复杂性使得简易的流程控制难以满足要求。因此,必须引入实时操作系统。传统实时操作系统昂贵的价格和应用程序句法语义的兼容性问题大大限制了自身应用的范围。一个解决方法是利用和改造免费的通用操作系统以提供实时环境。Linux操作系统的开放源代码、支持丰富的库函数和强大开发工具等优势给了人们深入研究系统内核机制的可能。目前,所有的Linux实时改进都是针对内核的改进。改进的目标是将任务响应时间减少到微秒范围以实现对外部事件的更快响应。改进的主要技术路线,一是提供可抢占的标准内核以优化Linux本身的实时性能,包括隐式抢占点、显示抢占点和完全抢占设计等。然而,这类方法通常只能达到软实时。二是提供内核的实时补丁以达到硬实时,包括微内核、资源内核扩展、POSIX实时扩展和纳内核等方法。本论文所研究的操作系统自适应域环境Adeos为硬件和标准内核之间提供了一个“硬件-内核”的纳内核接口,可以使多个操作系统并行运行于纳内核之上。同时,Adeos采用虚拟中断技术有效的减少了中断分派时间和中断服务时间,从而减少了任务响应时间。本论文深入研究了基于Linux环境的实时开发框架Xenomai及其底层运行机制Adeos的基本原理。分析了带有中断屏蔽功能的Adeos中断管道机制并讨论了用户空间混合执行模式下中断屏蔽功能所存在的“优先级倒置”问题。基于Xenomai实时内核构建了Xenomai/Linux双内核实时系统。采用实时进程和非实时进程分级调度的策略优化进程调度。实时任务通过建立在Xenomai实时内核之上的可插式RTAI应用程序编程接口实现,并以内核态下可直接加载的内核模块方式运行。基于Svgalib库实现了方便的人机交互显示界面。通过实时命名管道机制实现实时任务与非实时任务的通信。最后,结合本实验室已开发出的基于DOS的IPC测控系统的硬件资源实现了一套基于Xenomai系统的小型变电站安全监控装置以模拟对变电站主要监测量的采集、处理和控制。测试结果显示系统达到了微秒级的任务响应延迟,满足电力系统硬实时的时限要求且运行稳定。同时,也证明了Xenomai可以为传统实时操作系统的应用程序(本设计中为RTAI)提供一个基于Linux环境的通用的实时开发框架,为实时应用开发带来方便。
【Abstract】 Electric power automation equipment is of zero deadline-driven feature,which greatly helps the dispatchors to guarantee the security control, insure the initiative to dealing with the trouble, reduce or avoid the mis-manipulation or misjudgment, and improve the running management level for the electric grid in the final. Meanwhile, complex tasks of the electric power system have always made the simple flow control fail to meet the needs. So in order to fill the gap, a real-time operation system has to be introduced.Due to some features like higher prizes or a lack of syntactic and semantic compatiblity, applications of traditional RTOS have been greatly limited. A solution to the problem is to use and modify the existing GPOSs to obtain the real-time performance. GPOS like Linux which provides with the open source codes, versatile function libraries and powerful developing tools has given application designers an access to the system kernel. At present, all modifications are mainly based on the kernel. The target is to keep the task response time in microseconds and get a shorter task response time. Two approachs including Standard Kernel Preemption and Real-time Patches to the Standard are available. The Standard Kernel Preemption approach, like explicit preemption points, implicit preemption points and fully preemption can only offer soft real-time performance, while the Real-time Patches approach such as Micro Kernel, Resource Kernel Extension, POSIX Real-time Extension, and Nano Kernel can provide with the hard real-time performance. In this thesis, the Adaptive Domain Environment for Operating System (usually called Adeos for short) is introduced between the hardware platform and the standard kernel to obtain a“hareware-kernel”interface. Different operating systems can run above the same hareware platform based on Adeos. The Virtual Interrupt mechanism can also be used to diminish the interrupt dispatch time and the interrupt service time, and finally achieve the least task response time.The principle of a common RTOS emulation framework-Xenomai and Adeos are briefly introduced in the thesis. The Adeos Interrupt Pipeline which has Interrupt Shield mechanism is studied and so are the problems of a real-time task being preempted and a priority inversion, which occurs in mixable execution modes for tasks embodied in User-Space. The Xenomai/Linux dual-kernel real-time operating system is established, and by using Xenomai’s RTAI emulator which offers the API, user applications’real-time tasks of the built system are realized. Non-real-time display tasks are accomplished through Svgalib function library. At the same time, real-time and non-real-time tasks can communicate with each other through Fifos. In the end, a real-time measurement and control system based on Xenomai which mimics the environment of a small electric substation has also been made on a former DOS based IPC with some necessary hardware modules in the laboratory. Tests show that microseconds task response time is achieved from the new real-time kernel, and the system meets hard real-time performance of electric power systems, which also indicate that Xenomai can be used to build a generic and versatile framework for emulating traditionl RTOS, like RTAI in the thesis and ease the development of the real-time applications.