
基于linux操作系统的分布式实时测控系统.pdf
71页英文摘要 III ABSTRACT At present,PC-based real-time measurement and control system is one of the important developing derections of real-time system. As universal operating systems on PC, DOS and Windows have much disadvantage in implementing the problem of real-time and multitask. Additionally,the commercial operating system are much expensive and keep secret their source codes from public although they have good performance,that causes many inconveniences to the development of real-time systems. The emergence of a free software Linux operating system gives us a chance to change this situation. this thesis expands my research: applying Linux to an industrial PC real-time measurement and control system,which is centered on improving real-time performance and solving the multitask problem. Paper firstly analyses the real-time performance of Linux kernel, the disadvantage of Linux used in real-time system is obtained; Tnternal modification and external modification are two methods for improving real-time performance of Linux,Paper analyses and compares these two methods and real-time Linux with the two methods . RTLinux is abtained through using the method of external modification to modify the Linux.In the chapter three,the implement principle of RTLinux is deeply analysed,and the key technology of RTLinux,software emulating the hardware interrupt control, scheduler of real-time tasks,real-time timer,the mechanism of inter-process communication,is in detail researched.next,the interrupt latency time and scheduling accuracy are tested,the result of test show that RTLinux can satify the requirement of hard real-time environment.At the same time,the principle of software design for RTLinux application is analysed. RTLinux is successfully applied to a pratical industrial real-time measurement and control system in the chapter four. the hardware buliding and software coding are implemented.RTLinux devides the system into real-time tasks and common tasks.Because of the high resolution of real-time timer,the real-time tasks are set as periodic,and using the RM schedule algorithm to schedule the real-time tasks.real-time tasks implements the data sample, handle and output.the common tasks is linux user application program,it implements the data save,display and management,and so on. deeply analysing the RM schedule algorithm and schedulability tests under RM algorithm,and using the RM algorithm to design a testing program,testing and 重庆大学硕士学位论文 IV analyising the schedulability and real-time performance of the system based on RTLinux through the testing program.The result of test is satified to the hard real-time requirement of application. Chapter five firstly analyses the serial communication under Linux OS in detail,next,building on a small distributed monitor system through the RS-485 bus on the basis of the IPC real-time system is discussed. the functions of user management,history reports,status display as well as reports printing are implemented in this monitor system. research result show that it is possible to apply linux to industrial measurement and control system,RTlinux can not only ensure the real-time quality of real-time task,but also these tasks can use Linux function so that real-time systems have good foundation to develope the functions. Keywords: Real-time System, Real-time Operating System, Linux, RTLinux, Industrial PC Measure and Control System, Distributed Control System. 1 绪 论 1 1 绪 论 1.1 课题研究的背景和意义 实时系统最早出现在二十世纪中叶。
当时,IBM 为美国海军和空军开发了飞行模拟系统 Whirlwind 和防空系统 SAGE 这些系统对时限性的要求导致了实时系统的诞生随后,在五十年代末期,实时系统开始进入工业过程控制领域到了六十年代,美国开始了雄心勃勃的航宇计划,其中太空船的控制系统和遥感系统都要求具有相当好的实时性能,这为实时系统的发展提供了一个良机在这个时期,实时系统应用的主体也开始从军用走向了民用随着大量适于进行实时处理的电子器件的出现,实时系统的应用范围也在不断扩大目前,它已经渗透到了社会生活的各个层面,无论是在各种国防应用,还是航天航空、核反应堆控制、电信行业、过程控制、制造业、医药行业、信息家电等各类民用应用上都发挥了巨大的作用,也为实时系统的发展提供了更加广阔的前景 “实时”正在成为一种无处不在的计算模式[1]而以工业 PC 为硬件平台、PC 操作系统为软件平台开发测控系统是当前工业实时测控系统的一个重要的研究方向 IEEE(美国电气电子工程师协会)定义实时系统为“系统的正确性不仅取决于计算逻辑结果的正确,而且也取决于产生结果的时间”实时系统通常必须与外界相互作用、从外界实时采集数据或进行事件处理等,系统在采集和响应这些外部事件时所做出的判断、推理和计算,不仅仅要保证计算结果输出的正确性,还要保证在确定的时间内产生这些结果即及时性[3],实时系统要集中全部的资源,保证实时任务的准时执行。
实时系统中往往要求多个任务并行执行,若顺序执行,则会导致系统实时性能不高,效率低下,甚至造成灾难性后果因此实时系统一般应解决实时性和多任务两大难题[2][3] 解决这两大难题的关键是实时系统中的实时操作系统实时操作系统在实时系统中起着核心的作用,它像是人的中枢系统,控制,管理着实时系统的正常工作一个实时系统能否达到预期的目的和效果往往取决于实时操作系统性能的优劣[4] 按照对外部事件响应时间不同, 实时系统也可分为软实时系统和硬实时系统硬实时系统是指如果计算结果输出的时间超过了时限(Deadline)将会引起灾难性后果的实时系统,如控制飞机发动机的实时系统软实时系统是指如果计算结果输出的时间超过了时限虽然不会引起灾难性后果,但是应尽可能满足时限的系统,如播放多媒体的系统[6]DOS 和 WINDOWS 是 PC 上的主流操作系统,但是 DOS和 WINDOWS 在解决实时多任务的实现问题上存在着许多缺点而开发者从零开始,自行设计一个完整的实时操作系统,工作量非常大,难度也相当大;采用商重庆大学硕士学位论文 2 业化的实时操作系统,目前国际上出现了很多商业实时操作系统如主流的有VxWorks,QNX 等[3]。
虽然它们可以满足实时控制系统的硬实时要求,但其昂贵的价格会增加工程的成本,其封闭的源代码会增加该软件对厂家的依赖性 自由软件 Linux 操作系统的出现给我们改变这种局面的契机Linux 操作系统从问世到现在短短 10 多年的时间内,Linux 已发展成为一个功能强大、设计完善的操作系统,目前 Linux 已广泛应用于桌面操作系统、网络服务器、嵌入式系统、实时测控系统中除了 Linux 功能及性能方面的优势,最重要的是:其开放源码的开发方式使得使用者可以以自己的方式定制及修改内核,适用于不同的目的于是建立在 Linux 之上, 对 Linux 进行实时化改造所形成的实时 LInux 操作系统也就应运而生在国外已经出现了对 Linux 实时化改造的优秀成果,但在我国对 Linux进行实时化改造还处于初级阶段, 因此进行基于 Linu。
