Файл: Microcontroller based applied digital control (D. Ibrahim, 2006).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 14.06.2025

Просмотров: 3245

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

CONTENTS

ix

9.1.3 Pole-Placement Control – Analytical

219

9.1.4 Pole-Placement Control – Graphical

222

9.2

PID Controller

230

9.2.1 Saturation and Integral Wind-Up

233

9.2.2

Derivative Kick

233

9.2.3

PID Tuning

134

9.3

Exercises

137

Further Reading

240

10 Controller Realization

243

10.1

Direct Structure

243

10.1.1

Direct Canonical Structure

243

10.1.2

Direct Noncanonical Structure

245

10.2

Cascade Realization

246

10.3

Parallel Realization

249

10.4

PID Controller Implementations

250

10.5

Microcontroller Implementations

253

10.5.1

Implementing Second-Order Modules

254

10.5.2

Implementing First-Order Modules

260

10.5.3

Implementing Higher-Order Modules

263

10.6

Choice of Sampling Interval

263

10.7

Exercises

267

Further Reading

268

11 Liquid Level Digital Control System: a Case Study

269

11.1

The System Schematic

269

11.2

System Model

270

11.3

Identification of the System

273

11.4

Designing a Controller

274

11.5

Conclusions

278

Appendix A Table of z-Transforms

283

Appendix B MATLAB Tutorial

285

Index

307


Preface

Computers now form an integral part of most real-time control systems. With the advent of the microprocessors and microcontrollers in the last few decades the use of computers in control applications has been ever growing. Microcontrollers are single-chip computers which can be used to control real-time systems. Such controllers are also referred to as embedded real-time computers. These devices are low-cost, single-chip and easy to program. Microcontrollers have traditionally been programmed using the assembly language of the target processor. It is now possible to program these devices using high-level languages such as BASIC, PASCAL, or C. As a result of this, very complex control algorithms can be developed and implemented on the microcontrollers.

This book is about the theory and practice of microcontroller based automatic control systems engineering. A previous knowledge of microcontroller hardware or software is not required, but the reader will find it useful to have some knowledge of a computer programming language.

Chapter 1 of the book presents a brief introduction to the control systems and the elements of computer based control systems. Some previous knowledge of the theory of continuous-time control systems is helpful in understanding this material.

Chapter 2 is about system modelling. Modelling a dynamic system is the starting point in control engineering. Models of various mechanical, electrical, and fluid systems are introduced in this chapter.

Chapter 3 is devoted to the popular PIC microcontroller family which is described and used in this book. The PIC family is one of the most widely used microcontrollers in commercial and industrial applications. The chapter describes the features of this family, and basic application notes are also given.

The book is based on the C programming language known as PICC Lite. This is distributed free by Hi-Tech Software and is used to program the PIC family of microcontrollers. Chapter 4 gives a brief introduction to the features of this language.

The microcontroller project development cycle is described in some detail in Chapter 5. The knowledge of the microcontroller development cycle is important as the developed controller algorithm has to be implemented on the target microcontroller.

Chapters 6 and 7 are devoted to the analysis of discrete-time systems. The terms discretetime system, sampled-data system and digital control system are all used interchangeably in the book and refer to the same topic. The sampling process, z-transforms, and the time response of discrete-time systems are explained in detail in these two chapters.

xii PREFACE

The stability of a control system is one of the most important topics in control engineering. Chapter 8 analyses the stability of digital control systems with examples, using the various well-established analytical and graphical stability techniques.

The analysis and design of digital controllers are described in Chapter 9, where various digital controller algorithms are developed with examples.

After a digital controller is designed, it has to be implemented on the microcontroller; this is known as the realization of the controller. Chapter 10 describes various realization techniques, describing the advantages and disadvantages of each technique. Programming examples are given to show how a particular realization can be programmed and implemented on a microcontroller.

Finally, Chapter 11 presents a case study. A liquid level control system is modelled and then a suitable digital controller algorithm is developed. The algorithm is then implemented on a PIC microcontroller. The time response of the system is given, along with a full program listing of the algorithm .

Many people have assisted in the production and development of this book. In particular, I wish to acknowledge the contribution of the students and staff members of the Computer Engineering Department of the Near East University.

Dogan Ibrahim

Near East University


1

Introduction

1.1 THE IDEA OF SYSTEM CONTROL

Control engineering is concerned with controlling a dynamic system or plant. A dynamic system can be a mechanical system, an electrical system, a fluid system, a thermal system, or a combination of two or more types of system. The behaviour of a dynamic system is described by differential equations. Given the model (differential equation), the inputs and the initial conditions, we can easily calculate the system output.

A plant can have one or more inputs and one or more outputs. Generally a plant is a continuous-time system where the inputs and outputs are also continuous in time. For example, an electromagnetic motor is a continuous-time plant whose input (current or voltage) and output (rotation) are also continuous signals. A control engineer manipulates the input variables and shapes the response of a plant in an attempt to influence the output variables such that a required response can be obtained.

A plant is an open-loop system where inputs are applied to drive the outputs. For example, a voltage is applied to a motor to cause it to rotate. In an open-loop system there is no knowledge of the system output. The motor is expected to rotate when a voltage is applied across its terminals, but we do not know by how much it rotates since there is no knowledge about the output of the system. If the motor shaft is loaded and the motor slows down there is no knowledge about this. A plant may also have disturbances affecting its behaviour and in an open-loop system there is no way to know, or to minimize these disturbances.

Figure 1.1 shows an open-loop system where the system input is expected to drive the system output to a known point (e.g. to rotate the motor shaft at a specified rate). This is a single-input, single-output (SISO) system, since there is only one input and also only one output is available.

In general, systems can have multiple inputs and multiple outputs (MIMO). Because of the unknowns in the system model and the effects of external disturbances the open-loop control is not attractive. There is a better way to control the system, and this is by using a sensor to measure the output and then comparing this output with what we would like to see at the system output. The difference between the desired output value and the actual output value is called the error signal. The error signal is used to force the system output to a point such that the desired output value and the actual output value are equal. This is termed closedloop control, or feedback control. Figure 1.2 shows a typical closed-loop system. One of the advantages of closed-loop control is the ability to compensate for disturbances and yield the correct output even in the presence of disturbances. A controller (or a compensator) is usually employed to read the error signal and drive the plant in such a way that the error tends to zero.

Microcontroller Based Applied Digital Control D. Ibrahim

C 2006 John Wiley & Sons, Ltd. ISBN: 0-470-86335-8

2 INTRODUCTION

Disturbances

Plant

Input

To be

Output

Controlled

Figure 1.1 Open-loop system

Disturbances

Input +

Output

Error

Plant

Controller

To be

_

Controlled

sensor

Figure 1.2 Closed-loop system

Closed-loop systems have the advantage of greater accuracy than open-loop systems. They are also less sensitive to disturbances and changes in the environment. The time response and the steady-state error can be controlled in a closed-loop system.

Sensors are devices which measure the plant output. For example, a thermistor is a sensor used to measure the temperature. Similarly, a tachogenerator is a sensor used to measure the rotational speed of a motor, and an accelerometer is used to measure the acceleration of a moving body. Most sensors are analog devices and their outputs are analog signals (e.g. voltage or current). These sensors can be used directly in continuous-time systems. For example, the system shown in Figure 1.2 is a continuous-time system with analog sensors, analog inputs and analog outputs. Analog sensors cannot be connected directly to a digital computer. An analog-to-digital (A/D) converter is needed to convert the analog output into digital form so that the output can be connected to a digital computer. Some sensors (e.g. temperature sensors) provide digital outputs and can be directly connected to a digital computer.

With the advent of the digital computer and low-cost microcontroller processing elements, control engineers began to use these programmable devices in control systems. A digital computer can keep track of the various signals in a system and can make intelligent decisions about the implementation of a control strategy.

1.2 COMPUTER IN THE LOOP

Most control engineering applications nowadays are computer based, where a digital computer or a microcontroller is used as the controller. Figure 1.3 shows a typical computer controlled system. Here, it is assumed that the error signal is analog and an A/D converter is used to convert the signal into digital form so that it can be read by the computer. The A/D converter


COMPUTER IN THE LOOP

3

Input +

Output

A/D

Controller

D/A

Plant

sensor

Figure 1.3 Typical digital control system

samples the signal periodically and then converts these samples into a digital word suitable for processing by the digital computer. The computer runs a controller algorithm (a piece of software) to implement the required actions so that the output of the plant responds as desired. The output of a digital computer is a digital signal, and this is normally converted into analog form by using a digital-to-analog (D/A) converter. The operation of a D/A converter is usually approximated by a zero-order hold transfer function.

There are many microcontrollers that incorporate built-in A/D and D/A converter circuits. These microcontrollers can be connected directly to analog signals, and to the plant.

In Figure 1.3 the reference set-point, sensor output, and the plant input and output are all assumed to be analog. Figure 1.4 shows the block diagram of the system in Figure 1.3 where the A/D converter is shown as a sampler. Most modern microcontrollers include built-in A/D and D/A converters, and these have been incorporated into the microcontroller in Figure 1.4.

There are other variations of the basic digital control system. In Figure 1.5 another type of digital control system is shown where the reference set-point is read from the keyboard or is hard-coded into the control algorithm. Since the sensor output is analog, it is converted into digital form using an A/D converter and the resulting digital signal is fed to the computer where the error signal is calculated and is used to implement the control algorithm.

Microcontroller

Input +

D/A

Output

Controller

Plant

sensor

Figure 1.4 Block diagram of a digital control system

Set-point

Microcontroller

Output

Controller

D/A

Plant

A/D sensor

Figure 1.5 Another form of digital control