自动控制书籍

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Applied Control Theory

for Embedded Systems


Applied Control Theory
for Embedded Systems
by Tim Wescott

AMSTERDAM • BOSTON • HEIDELBERG • LONDON


NEW YORK • OXFORD • PARIS • SAN DIEGO
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Newnes is an imprint of Elsevier
Newnes is an imprint of Elsevier
30 Corporate Drive, Suite 400, Burlington, MA 01803, USA
Linacre House, Jordan Hill, Oxford OX2 8DP, UK

Copyright © 2006, Elsevier Inc. All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted


in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without the prior written permission of the publisher.

Permissions may be sought directly from Elsevier’s Science & Technology Rights ­
Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333,
e-mail: permissions@elsevier.com.uk. You may also complete your request on-line via the
Elsevier homepage (http://elsevier.com), by selecting “Support & Contact,” then
“Copyright and Permission” and then “Obtaining Permissions.”
Recognizing the importance of preserving what has been written,
Elsevier prints its books on acid-free paper whenever possible.
Library of Congress Cataloging-in-Publication Data
Wescott, Tim.
Applied control theory for embedded systems / by Tim Wescott.
p. cm. -- (Embedded technology series)
ISBN-13: 978-0-7506-7839-1 (pbk. : alk. paper)
ISBN-10: 0-7506-7839-9 (pbk. : alk. paper) 1. Embedded computer
systems--Design and construction. 2. Digital control systems--Design and
construction. I. Title. II. Series.
TK7895.E42W47 2006
629.8’9--dc22
2006002692
British Library Cataloguing-in-Publication Data
A catalogue record for this book is available from the British Library.

ISBN-13: 978-0-7506-7839-1
ISBN-10: 0-7506-7839-9

For information on all Newnes publications


visit our Web site at www.books.elsevier.com

06 07 08 09 10 10 9 8 7 6 5 4 3 2 1

Printed in the United States of America


For all my teachers
Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
What’s on the CD-ROM?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

Chapter 1: The Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


1.1 Control Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Anatomy of a Control System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Closed Loop Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Controllers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 About This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

Chapter 2: Z Transforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1 Signals and Systems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.2 Difference Equations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3 The Z Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4 The Inverse Z Transform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.5 Some Z Transform Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.6 Transfer Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.7 Stability in the Z Domain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.8 Frequency Response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
2.9 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

Chapter 3: Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.1 Tracking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2 Frequency Response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.3 Disturbance Rejection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.4 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Chapter 4: Block Diagrams. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65


4.1 The Language of Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.2 Analyzing Systems with Block Diagrams. . . . . . . . . . . . . . . . . . . . 74
4.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
viii Contents

Chapter 5: Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.1 Root Locus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.2 Bode Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.3 Nyquist Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.4 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

Chapter 6: Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125


6.1 Controllers, Filters and Compensators . . . . . . . . . . . . . . . . . . . . . 125
6.2 Compensation Topologies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
6.3 Types of Compensators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
6.4 Design Flow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
6.5 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

Chapter 7: Sampling Theory. . . . . . . . . . . . . . . . . . . . . . . . . . . 149


7.1 Sampling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.2 Aliasing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.3 Reconstruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
7.4 Orthogonal Signals and Power. . . . . . . . . . . . . . . . . . . . . . . . . . . 156
7.5 Random Noise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.6 Nonideal Sampling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
7.7 The Laplace Transform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
7.8 z Domain Models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
7.9 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

Chapter 8: Nonlinear Systems . . . . . . . . . . . . . . . . . . . . . . . . . 183


8.1 Characteristics of Nonlinear Systems. . . . . . . . . . . . . . . . . . . . . . 184
8.2 Some Nonlinearities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.3 Linear Approximation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.4 Nonlinear Compensators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
8.5 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Contents ix

Chapter 9: Measuring Frequency Response . . . . . . . . . . . . . . 225


9.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
9.2 Measuring in Isolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
9.3 In-Loop Measurement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
9.4 Real-World Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
9.5 Software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
9.6 Other Methods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

Chapter 10: Software Implications. . . . . . . . . . . . . . . . . . . . . . 247


10.1 Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
10.2 Quantization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
10.3 Overflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
10.4 Resource Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
10.5 Implementation Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
10.6 Conclusion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292

Chapter 11: Afterword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293


11.1 Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
11.2 Bibliography. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

About the Author. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297


Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Preface

Microprocessors are getting smaller, cheaper and faster. Every day, it is easier
to embed more functionality into a smaller space. Embedded processors have
become pervasive, and as time goes on, more and more functions that were once
implemented with analog circuitry or with electromechanical assemblies are being
realized with microcontrollers, ADCs and DACs. Many of these assemblies that
are being supplanted by the microprocessor are controlling dynamic processes,
which is a good thing, because the microprocessor coupled with the right software
is often the superior device.
The worm in the apple is that while many microprocessor based controllers
are replacing electromechanical or analog electronic controllers, or are being
built new for things that could never be practically controlled, most engineers
who are skilled at embedded system design are not acquainted with designing
control systems, or have fragmentary, ad-hoc knowledge that falls short of that
required to do the job at hand.
This is a book about analyzing and understanding embedded control systems.
It is written for the practicing embedded system engineer who is faced with a
need to design automatic control systems with embedded hardware, to do so
quickly and to produce robust, reliable products that perform well and generate
profit for the companies that build them.
What’s on the CD-ROM?

The CD-ROM for this book contains two sets of code, and some free analysis
software.
The analysis software is SciLab, from the Scilab Consortium (Scilab is a
trademark of INRIA). It was used to generate most of the graphs that you see
in this book.
The first set of code that you will find on the CD-ROM are the SciLab scripts
that were used to generate the graphs. These scripts will provide ready examples
should you choose to use SciLab for your analysis.
The second set of code that you will find on the CD-ROM is the C and
assembly code that is presented in Chapters 9 and 10. This code consists of
many building-blocks for embedded controllers, as well as a swept-sine frequency
response measurement package.

You might also like