没有合适的资源?快使用搜索试试~ 我知道了~
首页Real-time Systems_Jane.W.S.Liu
Real-time Systems_Jane.W.S.Liu

非常经典的实时系统调度教程,用于操作系统,和嵌入式。基础知识,由浅入深。阐明了基本的概念,解决了只读论文带来的概念模糊。非常值得阅读
资源详情
资源评论
资源推荐

Integre Technical Publishing Co., Inc. Liu January 13, 2000 8:45 a.m. chap1 page 1
CHAPTER 1
Typical Real-Time Applications
From its title, you can see that this book is about real-time (computing, communication, and
information) systems. Rather than pausing here to define the term precisely, which we will
do in Chapter 2, let us just say for now that a real-time system is required to complete its
work and deliver its services on a timely basis. Examples of real-time systems include digital
control, command and control, signal processing, and telecommunication systems. Every day
these systems provide us with important services. When we drive, they control the engine
and brakes of our car and regulate traffic lights. When we fly, they schedule and monitor the
takeoff and landing of our plane, make it fly, maintain its flight path, and keep it out of harm’s
way. When we are sick, they may monitor and regulate our blood pressure and heart beats.
When we are well, they can entertain us with electronic games and joy rides. Unlike PCs and
workstations that run nonreal-time applications such as our editor and network browser, the
computers and networks that run real-time applications are often hidden from our view. When
real-time systems work correctly and well, they make us forget their existence.
For the most part, this book is devoted to real-time operating systems and communica-
tion protocols, in particular, how they should work so that applications running on them can
reliably deliver valuable services on time. From the examples above, you can see that mal-
functions of some real-time systems can have serious consequences. We not only want such
systems to work correctly and responsively but also want to be able to show that they indeed
do. For this reason, a major emphasis of the book is on techniques for validating real-time
systems. By validation, we mean a rigorous demonstration that the system has the intended
timing behavior.
As an introduction, this chapter describes several representative classes of real-time ap-
plications: digital control, optimal control, command and control, signal processing, tracking,
real-time databases, and multimedia. Their principles are out of the scope of this book. We
provide only a brief overview in order to explain the characteristics of the workloads gener-
ated by the applications and the relation between their timing and functional requirements. In
later chapters, we will work with abstract workload models that supposely capture the rele-
vant characteristics of these applications. This overview aims at making us better judges of
the accuracy of the models.
In this chapter, we start by describing simple digital controllers in Section 1.1. They are
the simplest and the most deterministic real-time applications. They also have the most strin-
gent timing requirements. Section 1.2 describes optimal control and command and control
applications. These high-level controllers either directly or indirectly guide and coordinate
1

Integre Technical Publishing Co., Inc. Liu January 13, 2000 8:45 a.m. chap1 page 2
2 Chapter 1 Typical Real-Time Applications
digital controllers and interact with human operators. High-level controllers may have signif-
icantly higher and widely fluctuating resource demands as well as larger and more relaxed
response time requirements. Section 1.3 describes signal processing applications in general
and radar signal processing and tracking in particular. Section 1.4 describes database and
multimedia applications. Section 1.5 summarizes the chapter.
1.1 DIGITAL CONTROL
Many real-time systems are embedded in sensors and actuators and function as digital con-
trollers. Figure 1–1 shows such a system. The term plant in the block diagram refers to a
controlled system, for example, an engine, a brake, an aircraft, a patient. The state of the plant
is monitored by sensors and can be changed by actuators. The real-time (computing) system
estimates from the sensor readings the current state of the plant and computes a control output
based on the difference between the current state and the desired state (called reference input
in the figure). We call this computation the control-law computation of the controller. The
output thus generated activates the actuators, which bring the plant closer to the desired state.
1.1.1 Sampled Data Systems
Long before digital computers became cost-effective and widely used, analog (i.e., continuous-
time and continuous-state) controllers were in use, and their principles were well established.
Consequently, a common approach to designing a digital controller is to start with an analog
controller that has the desired behavior. The analog version is then transformed into a digi-
tal (i.e., discrete-time and discrete-state) version. The resultant controller is a sampled data
system. It typically samples (i.e., reads) and digitizes the analog sensor readings periodically
and carries out its control-law computation every period. The sequence of digital outputs thus
produced is then converted back to an analog form needed to activate the actuators.
A Simple Example. As an example, we consider an analog single-input/single-output
PID (Proportional, Integral, and Derivative) controller. This simple kind of controller is com-
monly used in practice. The analog sensor reading y(t) gives the measured state of the plant
at time t.Lete(t) = r (t) − y(t) denote the difference between the desired state r(t) and the
measured state y(t) at time t. The output u(t) of the controller consists of three terms: a term
A/D
A/D
Sensor
Plant
Actuator
controller
control-law
computation
D/A
reference
input
r(t)
y(t) u(t)
r
k
y
k
u
k
FIGURE 1–1 A digital controller.

Integre Technical Publishing Co., Inc. Liu January 13, 2000 8:45 a.m. chap1 page 3
Section 1.1 Digital Control 3
that is proportional to e(t), a term that is proportional to the integral of e(t) and a term that is
proportional to the derivative of e(t ).
In the sampled data version, the inputs to the control-law computation are the sampled
values y
k
and r
k
,fork = 0, 1, 2,..., which analog-to-digital converters produce by sam-
pling and digitizing y(t) and r (t ) periodically every T units of time. e
k
= r
k
− y
k
is the kth
sample value of e(t). There are many ways to discretize the derivative and integral of e(t).For
example, we can approximate the derivative of e(t) for (k − 1)T ≤ t ≤ kT by (e
k
− e
k−1
)/T
and use the trapezoidal rule of numerical integration to transform a continuous integral into a
discrete form. The result is the following incremental expression of the kth output u
k
:
u
k
= u
k−2
+ αe
k
+ βe
k−1
+ γ e
k−2
(1.1)
α, β,andγ are proportional constants; they are chosen at design time.
1
During the kth sam-
pling period, the real-time system computes the output of the controller according to this
expression. You can see that this computation takes no more than 10–20 machine instruc-
tions. Different discretization methods may lead to different expressions of u
k
, but they all are
simple to compute.
From Eq. (1.1), we can see that during any sampling period (say the kth), the control
output u
k
depends on the current and past measured values y
i
for i ≤ k. The future measured
values y
i
’sfori > k in turn depend on u
k
. Such a system is called a (feedback) control loop
or simply a loop. We can implement it as an infinite timed loop:
set timer to interrupt periodically with period T ;
at each timer interrupt, do
do analog-to-digital conversion to get y;
compute control output u;
output u and do digital-to-analog conversion;
end do;
Here, we assume that the system provides a timer. Once set by the program, the timer gener-
ates an interrupt every T units of time until its setting is cancelled.
Selection of Sampling Period. The length T of time between any two consecutive
instants at which y(t) and r(t) are sampled is called the sampling period. T is a key design
choice. The behavior of the resultant digital controller critically depends on this parameter.
Ideally we want the sampled data version to behave like the analog version. This can be done
by making the sampling period small. However, a small sampling period means more frequent
control-law computation and higher processor-time demand. We want a sampling period T
that achieves a good compromise.
In making this selection, we need to consider two factors. The first is the perceived
responsiveness of the overall system (i.e., the plant and the controller). Oftentimes, the system
is operated by a person (e.g., a driver or a pilot). The operator may issue a command at any
time, say at t. The consequent change in the reference input is read and reacted to by the digital
1
The choice of the proportional constants for the three terms in the analog PID controller and the methods for
discretization are topics discussed in almost every elementary book on digital control (e.g., [Leig]).

Integre Technical Publishing Co., Inc. Liu January 13, 2000 8:45 a.m. chap1 page 4
4 Chapter 1 Typical Real-Time Applications
controller at the next sampling instant. This instant can be as late as t + T . Thus, sampling
introduces a delay in the system response. The operator will feel the system sluggish when the
delay exceeds a tenth of a second. Therefore, the sampling period of any manual input should
be under this limit.
The second factor is the dynamic behavior of the plant. We want to keep the oscillation
in its response small and the system under control. To illustrate, we consider the disk drive
controller described in [AsWi]. The plant in this example is the arm of a disk. The controller
is designed to move the arm to the selected track each time when the reference input changes.
At each change, the reference input r(t) is a step function from the initial position to the
final position. In Figure 1–2, these positions are represented by 0 and 1, respectively, and
the time origin is the instant when the step in r (t) occurs. The dashed lines in Figure 1–2(a)
y(t)
510
1
0
0
51015
u
max
u(t)
0
-u
max
510
1
0
0
51015
0
y(t)
u
max
u(t)
-u
max
510
1
0
0
51015
0
y(t)
u
max
u(t)
-u
max
(a)
(b) (c)
FIGURE 1–2 Effect of sampling period.

Integre Technical Publishing Co., Inc. Liu January 13, 2000 8:45 a.m. chap1 page 5
Section 1.1 Digital Control 5
give the output u(t) of the analog controller and the observed position y(t) of the arm as a
function of time. The solid lines in the lower and upper graphs give, respectively, the analog
control signal constructed from the digital outputs of the controller and the resultant observed
position y(t) of the arm. At the sampling rate shown here, the analog and digital versions are
essentially the same. The solid lines in Figure 1–2(b) give the behavior of the digital version
when the sampling period is increased by 2.5 times. The oscillatory motion of the arm is more
pronounced but remains small enough to be acceptable. However, when the sampling period
is increased by five times, as shown in Figure 1–2(c), the arm requires larger and larger control
to stay in the desired position; when this occurs, the system is said to have become unstable.
In general, the faster a plant can and must respond to changes in the reference input,
the faster the input to its actuator varies, and the shorter the sampling period should be. We
can measure the responsiveness of the overall system by its rise time R. This term refers to
the amount of time that the plant takes to reach some small neighborhood around the final
state in response to a step change in the reference input. In the example in Figure 1–2, a small
neighborhood of the final state means the values of y(t) that are within 5 percent of the final
value. Hence, the rise time of that system is approximately equal to 2.5.
A good rule of thumb is the ratio R/T of rise time to sampling period is from 10 to
20 [AsWi, FrPW].
2
In other words, there are 10 to 20 sampling periods within the rise time.
A sampling period of R/10 should give an acceptably smooth response. However, a shorter
sampling period (and hence a faster sampling rate) is likely to reduce the oscillation in the
system response even further. For example, the sampling period used to obtain Figure 1–2(b)
is around R/10, while the sampling period used to obtain Figure 1–2(a) is around R/20.
The above rule is also commonly stated in terms of the bandwidth, ω, of the system.
The bandwidth of the overall system is approximately equal to 1/2R Hz. So the sampling
rate (i.e., the inverse of sampling period) recommended above is 20 to 40 times the system
bandwidth ω. The theoretical lower limit of sampling rate is dictated by Nyquist sampling
theorem [Shan]. The theorem says that any time-continuous signal of bandwidth ω can be
reproduced faithfully from its sampled values if and only if the sampling rate is 2ω or higher.
We see that the recommended sampling rate for simple controllers is significantly higher than
this lower bound. The high sampling rate makes it possible to keep the control input small and
the control-law computation and digital-to-analog conversion of the controller simple.
Multirate Systems. A plant typically has more than one degree of freedom. Its state
is defined by multiple state variables (e.g., the rotation speed, temperature, etc. of an engine
or the tension and position of a video tape). Therefore, it is monitored by multiple sensors and
controlled by multiple actuators. We can think of a multivariate (i.e., multi-input/multi-output)
controller for such a plant as a system of single-output controllers.
Because different state variables may have different dynamics, the sampling periods
required to achieve smooth responses from the perspective of different state variables may
be different. [For example, because the rotation speed of a engine changes faster than its
2
Sampling periods smaller than this range may have an adverse effect. The reason is that quantization error
becomes dominant when the difference in analogy sample readings taken in consecutive sampling periods becomes
comparable or even smaller than the quantization granularity.
剩余408页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论26