## About Applied Control Theory for Embedded Systems

### How The Book Came About

People ask me how long it took me to write Applied Control Theory for Embedded Systems. It's a difficult question to answer, because while I know exactly when I submitted the final draft to my publisher, the day that I started the book is much less certain.

The chain of events that lead to this book started when I first started working with software engineers. I knew, more or less by luck, all of the necessary skills to implement control systems in software. I had concentrated in control systems while getting my engineering degrees, and I was a software hacker by avocation. In 1994 I was offered a software engineering job at FLIR Systems. Within a year of starting I learned two things: how to be a real embedded software engineer, and how little the average software engineer knew about control theory.

Because control is so central to embedded systems, I set about developing a series of talks aimed at educating the software engineers of my acquaintance in control systems issues. At the time the venues available limited me to talks of 1 hour or 90 minutes. While this is enough time to deliver some useful information, it is not enough time to present the whole story. So after every talk, at least one person would come to me with what became The Question: "Is there a book that covers this?"

I started doing a search. While there are plenty of books out there that are designed to fit into the university curriculum, and teach one control theory, with all its ramifications and in all its mathematical glory, there weren't any that really stood alone enough that I could feel comfortable handing one to a working engineer and be able to reasonably expect them to learn the material on their own in a reasonable amount of time. Worse, the necessary knowledge to get spun up and be useful was either distributed over several books, or wasn't in the university curriculum at all. I finally concluded that if I wanted to recommend a book I would either have to wait for a long time, or I would have to write it.

Around 1998 or so I generated the first table of contents for a book on control theory designed for the embedded software engineer. In between raising children, and my career as a software engineer and system architect, I worked on articles that pertained to the book and even wrote a few lines that pertained directly to the book.

Eventually I started attending the Embedded Systems Conference as a speaker, where I was approached by an editor from Elsevier about the possibility of writing a book. Since this is exactly what I had in mind for years, I said "yes", we signed a contract, and things were off and running. Several hard years of work later, the book was done.

### Who This Book is For

Applied Control Theory for Embedded Systems is primarily aimed at engineers who write software or design circuits for embedded systems, and who find themselves needing to make a closed-loop control system work. It presents the essential material necessary to doing structured design of closed loop systems clearly and concisely. The book doesn't stop at theory, either: several chapters are dedicated to solving practical problems that are encountered in real world control system design efforts.

The book is written without assuming any special mathematical knowledge beyond first term Calculus. Knowledge of differential equations can be helpful, but isn't required. Any further mathematical concepts needed to support the text are developed in the book.

### What's In the Book

Applied Control Theory for Embedded Systems is written in eleven chapters. The basic organization of the book is to introduce the concept of control theory, present the theoretical underpinnings of dynamic system analysis using the z transform, then show how to use the theory to solve practical problems.

Chapter 1, The Basics, orients the reader to basic control system concepts. It covers what a control system is; it discusses the difference between open and closed loop control; it defines the kind of controller that will be assumed throughout the rest of the book; and it distinguishes executive, high-level control from the low-level control discussed in the rest of the book.

Chapter 2, Z Transforms, presents the mathematical theory that lies at the core of nearly all sampled-time control solutions. It defines terms 'signal' and 'system'; it gives a short review of difference equations and their solution; presents the z Transform, the inverse z transform and z transform properties; it introduces and defines the notion of a transfer function; it shows how to determine system stability using z domain analysis; and it shows how z domain analysis relates to frequency response and frequency response analysis.

Chapter 3, Performance, defines various performance terms that are useful and commonly used in industry. It defines performance terms for both the frequency domain and time domain, in ways that can be traced from an original system specification to the actual system behavior.

Chapter 4, Block Diagrams, presents the block diagramming language used by control systems engineers to describe dynamic systems. Several different commonly used block diagramming dialects are presented, and the chapter shows how block diagramming language is used to start with a complex block diagram that describes a system's structure to a simple one that describes its behavior.

Chapter 5, Analysis, shows how to go from a general description of a systems behavior to a general description of its performance and stability characteristics. This is the information that one uses in real applications to decide if a system will be reliable in the field, and if it will meet performance specifications. This chapter presents root locus, Bode plot, and Nyquist analysis, and shows how these methods tie in with one another and with real world problem solutions.

Chapter 6, Design, shows how to use all of the tools presented so far to go from a system description and a performance requirement to a controller topology with tuning numbers. This chapter presents the notion of a controller as a filter; it shows various compensation topologies; it shows different types of compensators; and it presents a design flow for control systems.

Chapter 7, Sampling Theory, shows how to relate sampled-time analysis and design information with the continuous-time world. It describes the sampling process, aliasing and reconstruction of signals. It shows how to analyze the behavior of collections of unrelated signals with power-level analysis; it describes noise analysis; it describes various sorts of ways that the sampling process in the real world isn't perfect and how to model these imperfections; it presents the Laplace transform for continuous time signals and systems; and it shows how to go from a continuous time system model to a sampled time model that can be used for design.

Chapter 8, Nonlinear Systems, gives a synopsis of nonlinear systems design. While a full treatment of nonlinear system design would require several books, this chapter presents the most commonly used methods to deal with nonlinearities in a straightforward, sensible manner. The chapter covers the characteristics of nonlinear systems that make them difficult to deal with; it presents some common nonlinearities; and it shows how to deal with these nonlinearities either by pretending that they don't exist, by complementing them with nonlinearities in one's controller, or both.

Chapter 9, Measuring Frequency Response, presents one of the oldest, simplest, and most robust methods of system identification for controller design. It shows how to measure a plant's frequency response in isolation; how to measure a plant's frequency response when it is operating in closed loop; it discusses some real-world roadblocks and quirks involved in frequency response measurement; and it develops some software that one can use to perform frequency response measurements.

Chapter 10, Software Implications, presents the special issues that are raised when one uses a digital computer to implement controllers. It covers the various data types that can be used to represent signals; it covers the problems associated with quantization and overflow; it discusses resources issues such as memory usage and processor speed; and it gives a nice set of controller implementation examples in the three most popular data types.

Chapter 11, Afterward, lists the software tools and gives an annotated bibliography for the book.

### A Comment on Software

Applied Control Theory for Embedded Systems was written with extensive use of SciLab, a freely distributed open source mathematical analysis package. SciLab is a very good platform for designing control systems, rivaling MatLab for functionality yet having a very low installed cost. I use it for nearly all of my control system design efforts.