1、PDF外文:http:/ 外文原文和译文 15th IFAC World Congress on Automatic Control, Barcelona, Spain, July 2002 . TrueTime: Simulation of Control Loops Unde Shared Computer Resources Dan Henriksson, Anton Cervin, KarlErik rzn Department of Automatic Control Lund Institute of Technology Box 118, SE221 00
2、 Lund, Sweden dan,anton,karlerikcontrol.lth.se Abstract The paper presents TRUETIME, a MATLAB/Simulink-based simulator for real-time control systems. TRUETIME makes it possible to simulate the temporal behavior of multitasking real-time kernels containing controller tasks and to study the effects of
3、 CPU and network scheduling on control performance. The simulated Real-time kernel is event-driven and can handle external interrupts as well as fine-grained Details such as context switches. Arbitrary scheduling policies may be defined, and the control tasks may be implemented using C functions, M
4、functions, or Simulink block diagrams. A number of examples that illustrate the use of TRUETIME are presented. 1. Introduction Most computer control systems are embedded systems where the computer is a component within a larger engineering system. The controllers are often implemented as one or seve
5、ral tasks on a microprocessor using a real-time kernel or a real-time operating system DRTOSE. In most cases the microprocessor also contains other tasks for other functions, e.g., communication and user interfaces. The kernel or OS typically uses multiprogramming to multiplex the execution of the d
6、ifferent tasks on a single CPU. The CPU time and the communication bandwidth, hence, can be viewed as shared resources which the tasks compete for. Computer-based control theory normally assumes equidistant sampling intervals and negligible or constant control delays, i.e., the latency betwee
7、n the sampling of the inputs to the controller and the generation of the outputs. However, this can seldom be achieved in practice. Tasks interfere with each other through preemption and blocking due to communication. Execution times may be data-dependent or vary due to, e.g., the uses of caches. Th
8、e result of this is jitter in sampling periods and latencies. An additional cause of this temporal non-determinism is the increasing use of commercial off-the-shelf (COTS) components in control systems, e.g., general purpose operating systems such as Windows and Linux and general purpose network pro
9、tocols such as Ethernet. These are designed to optimize average -case performance rather than worst-case performance, and therefore increase the non-determinism. The effects of this type of temporal non-determinism on control performance are often very hard, if not impossible, to investigate analyti
10、cally. A natural approach is then to instead use simulation. However, todays simulation tools make it difficult to simulate the true temporal behavior of control loops. What is normally done is to introduce time delays in the control loop representing average -case or worst-case delays. In this pape
11、r the new simulation toolbox TRUETIME is presented. TRUETIME, which is based on MATLAB/ Simulink, makes it possible to simulate the temporal behavior of a multitasking Real-time kernel containing controller tasks. The controller tasks control processes modeled as ordinary Simulink blocks. Different
12、scheduling policies may be used, e.g.,priority-driven or deadline-driven scheduling. The execution times of the controller tasks can be modeled as being constant or time-varying, using some suitable probability distribution. The effects of context switching and interrupt handling are taken into acco
13、unt, as well as task synchronization using events and monitors. With TRUETIME it is also possible to simulate the timing behavior of communication networks used in, e.g., networked control loops. TRUETIME can be used for several purposes: to investigate the true effects of timing non-determinism on
14、control performance, to develop compensation schemes that adjust the controller dynamically based on measurements of actual timing variations, to experiment with new, more flexible approaches to dynamic scheduling, e.g., feedback scheduling Ekeret al., 2000 and Quality-of-Service (QoS) based
15、scheduling approaches, and to simulate event-based control systems, e.g., combustion engine control systems and distributed controllers. Figure 1 The interfaces to the Simulink blocks. The Schedule and Monitors ports provide plots of the allocation of common resources (CPU, monitors, net
16、work) during the simulation. 1.1 Related work While numerous tools exist that support either simulationof control systems (e.g. Simulink) or simulation of real-time scheduling (e.g. STRESS Audsleyet al., 1994G and DRTSS Storch and Liu, 1996) very few tools support co-simulation of control systems an
17、d real-time scheduling. An early, tick-based prototype of TRUETIME was presented in Eker and Cervin, 1999. Since it was not event-based this early version had very little support for interrupt handling and could not handle fine-grained simulation details. Also, there was no support for simulat
18、ion of networks. The RTSIM real-time scheduling simulator (a standalone C+ program) has recently been extended with a numerical module (based on the Octave library) that supports simulation of continuous dynamics, see Palopoli et al., 2000. However, it lacks a graphical plant modeling environment, and so far