Файл: Microcontroller based applied digital control (D. Ibrahim, 2006).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 14.06.2025
Просмотров: 3286
Скачиваний: 1
CHOICE OF SAMPLING INTERVAL |
263 |
|||||
ek |
+ |
rk |
+ |
uk |
||
a0 |
||||||
z−1 |
||||||
−b1 |
a1 |
|||||
rk−1 |
||||||
Figure 10.21 First-order module
Example 10.7
The circuit diagram of a digital control system is shown in Figure 10.18. A PIC16F877 microcontroller is to be used as the digital controller in this system. Assume that the set-point input s is to be hard-coded to the program, and the output y is analog and connected to A/D channel AN0 (bit 0 of port A) of the microcontroller. The microcontroller is assumed to operate with a crystal frequency of 4 MHz as shown in the figure. The output (port B) of the microcontroller is interfaced to a D/A converter which acts as a zero-order-hold and generates an analog output to drive the plant.
Assume that the digital controller to be implemented is in the form of a first-order module, and write a program in C to implement this controller. The controller parameters are assumed to be:
a0 = 1, a1 = 0.8, b1 = 1.85,
i.e. the required controller transfer function is
1 + 0.8z−1 D(z) = 1 + 1.85z−1 .
Also assume that the required sampling interval is T = 0.01 s.
Solution
The implementation of a first-order module is very similar to a second-order module. The program to implement a first-order controller is shown in Figure 10.22. The operation of the program is very similar to the second-order program and is not described here.
10.5.3 Implementing Higher-Order Modules
Higher-order controllers can be implemented by cascading first-order and second-order modules. For example, a fourth-order controller can be implemented by cascading two second-order modules, as shown in Figure 10.23.
10.6 CHOICE OF SAMPLING INTERVAL
Whenever a digital control system is designed, a suitable sampling interval must be chosen. Choosing a large sampling time has destabilizing effects on the system. In addition, information loss occurs when large sampling times are selected. Also, the errors that occur when a continuous system is discretized increase as the sampling interval increases.
266 CONTROLLER REALIZATION
ek |
+ |
a0 |
+ |
z−1 |
|||
−b1 |
a1 |
||
z−1 |
|||
−b2 |
a2 |
+ |
a3 |
+ |
uk |
z−1 |
|||
−b3 |
a4 |
||
z−1 |
|||
−b4 |
a5 |
Figure 10.23 Implementing a fourth-order module
It may be thought that decreasing the sampling interval towards zero will make a discrete system converge towards an equivalent continuous system. However, in practice this is not the case since as the sampling interval is reduced, the change between the successive data values becomes less than the resolution of the system, leading to loss of information. In general, if a shorter sampling interval is to be used then the word length of the system should be increased so that the difference between adjacent samples can be resolved.
It has been found from practical applications in the process industry that a sampling interval of 1 s is generally short enough for most applications such as pressure control, temperature control and flow control. Systems with fast responses such as electromechanical systems (e.g. motors) require much shorter sampling intervals, usually of the order of milliseconds.
Various empirical rules have been suggested by many researchers for the selection of the sampling interval. These rules are based on practical experience and simulation results. Among them are the following
If the plant has the dominant time constant Tp , then the sampling interval T for the closedloop system should be selected such that T < Tp /10.
Assuming that the process has a Ziegler–Nichols open-loop model
e−s T1
G(s) = , 1 + s T2
then the sampling interval should be selected such that T < T1/4.
EXERCISES 267
If the closed-loop system is required to have a settling time Tss or a natural frequency of ωn then choose the sampling interval T such that T < Tss /10 and ωs > 10ωn , where ωs is the sampling frequency, i.e. ωs = 2π/ T .
10.7 EXERCISES
1.The transfer function of a digital controller is given by
1+ 2z−1 + 3z−2
D(z) = 1 + 4z−1 + 5z−2 .
Draw the block diagram of the direct canonical realization of this controller. 2. Repeat Exercise 1 for a direct noncanocical controller realization.
3. Compare the realizations obtained in Exercises 1 and 2. 4. The transfer function of a digital controller is found to be
1 + 2z−1 + 5z−2 D(z) = 1 + 3z−1 + 7z−2 .
Draw the block diagram of the direct noncanonical realization of this controller. 5. The transfer function of a digital controller is given by
2(z + 2)(z + 3)
.
z2 + 0.4z + 0.03
Use two first-order cascaded transfer functions to implement this controller. 6. The transfer function of a digital controller is given by
(1 + 0.2z−1)(1 + 2z−1 + 4z−2) (1 + 0.3z−1)(1 + 0.2z−1 + 0.4z−2) .
Use a first-order and a second-order cascaded transfer function to implement this controller. 7. The transfer function of a digital controller is given by
D(z) = (1 + 2z−1)(1 + 3z−1) . (1 + z−1)(1 + 5z−1)
Realize this transfer function using first-order parallel transfer functions.
8.Draw the block diagram of the PID implementation using a parallel realization.
9.Draw the block diagram of the PID implementation using a direct canonical realization.
10.Describe how a given realization can be implemented on a microcontroller.
11.Draw a flow diagram to show how the PID algorithm can be implemented on a microcontroller. Write a program in C to implement this algorithm on a PIC microcontroller.