data A/D
Converter
data quantized
Figure 2.4: Analog to digital converter
2.4
Establishing Connections
In this section, we will discuss the issues in connecting up the feedback loop as given in Fig. 1.1 on page 1. As mentioned earlier, the connections are not straightforward, because the plant may be a continuous time system, while the controller is digital.2
Digital systems can understand only binary numbers. They can also produce only binary numbers, at discrete time intervals, synchronized by a clock. The real life systems, on the other hand, could be continuous with their properties specified by variables that are defined at all times. In this section, we explain how these two types of devices communicate with each other.
2.4.1
Continuous Time to Digital Systems – A/D Converter
We will first look at the transformation to be carried out on the signal from the plant, before it can be communicated to the digital device: it has to be quantized for the digital device to understand it.
For example, suppose that the variable y in Fig. 1.1 denotes a voltage in the range of 0 to 1 volt. This could be the conditioned signal that comes from a thermocouple, used in a room temperature control problem. Suppose also that we use a digital device with four bits to process this information. Because there are four bits, it can represent sixteen distinct numbers, 0000 to 1111, with each binary digit taking either zero or one. The resolution we can achieve is 1/15 volt, because, sixteen levels enclose fifteen intervals. The continuous variable y that lies in the range of 0 to 1 volt is known as the analog variable.
Representation of an analog value using binary numbers is known as analog to digital conversion. The circuit that is used for this purpose is known as an analog to digital converter, abbreviated as A/D converter. It reads the analog variable at a time instant, known as sampling, and calculates its binary equivalent, see Fig. 2.4.
This calculation cannot be done instantaneously; it requires a nonzero amount of time. This is the minimum time that should elapse before the converter attempts to quantize another number. Sampling is usually done at equal intervals, synchronized by a clock. In all digital devices, the clock is used also to synchronize the operations of different components. Because of this reason, the binary equivalents of an analog signal are evaluated at discrete time instants, known as the sampling instants, only. The binary signals produced by the A/D converter are known as the digital signals. These signals are quantized in value, because only specific quantization levels can be represented and discrete in time, and because these conversions take place only at sampling instants. This is the reason why the device used for this purpose is known as the A/D converter.
2If the reader does not have to deal with continuous time systems, they can now go straight to
18 2. Modelling of Sampled Data Systems
time
Actual and
Quantized
Data
Sampled
time
Data
Quantized
Figure 2.5: Sampling, quantization of analog signals
A/D Converter digital analog signal signal Figure 2.6: Quantization
The left diagram in Fig. 2.5 illustrates the fact that the A/D converter takes a continuous function of real values, known as an analog signal, and produces a sequence of quantized values. The data seen by the digital device for this example are given in the right diagram of the same figure. In view of the above discussion, Fig. 2.4 can be redrawn as in Fig. 2.6.
The error in quantization varies inversely with the number of bits used. The falling hardware prices have ensured that even low cost devices have large numbers of bits with small quantization errors. As a result, it is reasonable to assume that no major difficulties arise because of quantization.
It should be pointed out that the time required for A/D conversion usually depends on the value of the analog signal itself. Nevertheless, the A/D converters are designed so as to sample the analog signal at equal intervals, with the requirement that the interval is at least as large as the maximum conversion time required. Most A/D converters sample analog signals at equal time intervals only. This is referred to as uniform sampling. The digital processing devices that are connected to the output of A/D converters also read the digital signals at the same instants.
As it takes a finite but nonzero amount of time for A/D conversion, it can be assumed that the analog signal, sampled at a time instant, will be available for digital processing devices in quantized form, at the next time instant only.
The next question to ask is whether there is any loss in information because of sampling in the A/D converter. The answer is no, provided one is careful. Many variables of practical interest vary slowly with time – in any case, slower than the speeds at which the data acquisition systems work. As a result, the loss of information due to sampling is minimal. Moreover, it is possible to get high performance A/D converters with small sampling time at a low cost and, as a result, the sampling losses can be assumed to be minimal. Indeed it is possible to use a single A/D converter to digitize several analog signals simultaneously. That is, an A/D converter can sample several analog signals, one at a time, without affecting the performance.
2.4. Establishing Connections 19 Discrete Signals 00 11 0011 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 Discrete ZOH Signals
Figure 2.7: Zero order hold
We have talked about the procedure to follow to make the continuous time devices, such as the plant in Fig. 1.1 on page 1, communicate with digital devices. We will now present the issues in the reverse communication – now the digital devices want to communicate to continuous time devices.
2.4.2
Digital to Continuous Time Systems – D/A Converter
The outputs from the digital devices are also digital signals and they are available only at regular intervals. A typical signal is presented in the left hand diagram of Fig. 2.7.
The real world that has to deal with the digital device may be analog in nature. For example, suppose that the controller, through binary numbers, indicates the desired position of a valve position. The valve, being a continuous time device, can only understand analog values. This is where the digital to analog converter, abbreviated as D/A converter, comes in. It converts the binary vector into a decimal number.
There is one more issue to be resolved. The valve cannot work with the numbers arriving intermittently. It should know the value of the signal during the period that separates two samples. The most popular way to do this is to hold the value constant until the next sampling instant, which results in a staircase approximation, as shown in the right diagram of Fig. 2.7. Because a constant value is a polynomial of zero degree, this is known as the zero order hold (ZOH) scheme. Although more complicated types of hold operations are possible, the ZOH is most widely used and it is usually sufficient. The ZOH operation usually comes bundled as a part of the D/A converter. In the rest of this book, we will use only ZOH.
We have talked about the procedure to convert the signals so that they are suitable to the receiving systems. Now let us discuss some issues in connecting the plant to the loop.
2.4.3
Input–Output View of Plant Models
We have shown that it is possible to express several continuous time systems in the form of Eq. 2.1a on page 5, namely ˙x(t) = F x(t) + Gu(t). Here, x, known as the state vector, denotes the variables that characterize the state of the system. The variable u(t), which denotes the input to the system, can consist of disturbance and manipulated or control variables. As most systems are nonlinear, linearization is required to arrive at such state space models.
We will show in the next section that it is possible to discretize continuous time systems to arrive at an equation of the form of Eq. 2.2a on page 6, namely
20 2. Modelling of Sampled Data Systems
x(n + 1) = Ax(n) + Bu(n). Such equations also arise in naturally occurring discrete time systems, as we have seen in Sec. 2.3.
Although the states contain all the information about a system, it may not be possible to measure all of them, unfortunately. We give below two reasons:
1. It may be very expensive to provide the necessary instruments. For example, consider a distillation column with 50 trays. Suppose the temperature in each tray is the state variable. It may be expensive to provide 50 thermocouples. Moreover the column may not have the provision to insert 50 thermocouples. Usually, however, a limited number of openings, say in the top and the bottom tray, will be available for thermocouple insertions.
2. There may not be any sensors, to measure some of the states. Suppose for instance the rate of change of viscosity is a state vector. There is no sensor that can measure this state directly.
Because of these reasons, only a subset of the state vector is usually measured. Sometimes a function of states also may be measured. The following example illustrates this idea.
Example 2.1 Consider a system in which there are two immiscible liquids. Suppose the height of the two liquids forms the state vector. Construct the output equation for the following two cases:
1. Only the level of the second fluid is measured. 2. Only the sum of two levels is measured.
Let x1 and x2 denote the heights of liquids 1 and 2, respectively. We obtain
x =
x1
x2
Let y denote the measured variable. When the level of the second fluid is measured, we obtain
y =0 1 x1
x2
= x2
Note that the above expression can be written as y = Cx + Du, where C is given by0 1and D = 0. When the sum of levels is measured, we obtain
y =1 1 x1
x2
= x1+ x2
This can once again be written as y = Cx + Du, where C is given by1 1and D = 0.
In view of the reasons explained above, complete state space models are given by Eq. 2.1 on page 5 or Eq. 2.2 on page 6.
The control effort or the manipulated variable u(n) becomes the input to the plant, with y(n) being the output from it. These two variables connect to the external world.