| Preface |
|
xvii | |
| About the Companion Website |
|
xix | |
|
|
|
1 | (4) |
|
|
|
1 | (1) |
|
1.2 What is a Control System? |
|
|
1 | (2) |
|
|
|
3 | (2) |
|
2 Hardware to be Used in the Book |
|
|
5 | (18) |
|
|
|
5 | (3) |
|
2.1.1 General Information |
|
|
6 | (1) |
|
|
|
6 | (2) |
|
2.1.3 Powering and Programming the Board |
|
|
8 | (1) |
|
2.2 The STM32 Microcontroller |
|
|
8 | (4) |
|
2.2.1 Central Processing Unit |
|
|
8 | (1) |
|
|
|
9 | (1) |
|
2.2.3 Input and Output Ports |
|
|
10 | (1) |
|
|
|
10 | (1) |
|
2.2.5 ADC and DAC Modules |
|
|
11 | (1) |
|
2.2.6 Digital Communication Modules |
|
|
11 | (1) |
|
2.3 System and Sensors to be Used Throughout the Book |
|
|
12 | (5) |
|
|
|
12 | (1) |
|
2.3.1.1 Properties of the DC Motor |
|
|
12 | (1) |
|
|
|
13 | (1) |
|
|
|
14 | (1) |
|
2.3.2 The DC Motor Drive Expansion Board |
|
|
14 | (1) |
|
|
|
15 | (2) |
|
|
|
17 | (1) |
|
2.4 Systems and Sensors to be Used in Advanced Applications |
|
|
17 | (2) |
|
|
|
17 | (2) |
|
|
|
19 | (1) |
|
|
|
19 | (4) |
|
|
|
20 | (3) |
|
3 Software to be Used in the Book |
|
|
23 | (40) |
|
|
|
24 | (5) |
|
|
|
24 | (1) |
|
3.1.2 Array and Matrix Operations |
|
|
25 | (1) |
|
|
|
26 | (1) |
|
3.1.4 Conditional Statements |
|
|
27 | (1) |
|
3.1.5 Function Definition and Usage |
|
|
27 | (1) |
|
|
|
28 | (1) |
|
3.1.7 Python Control Systems Library |
|
|
28 | (1) |
|
3.2 MicroPython on the STM32 Microcontroller |
|
|
29 | (14) |
|
3.2.1 Setting up MicroPython |
|
|
29 | (2) |
|
3.2.2 Running MicroPython |
|
|
31 | (3) |
|
3.2.3 Reaching Microcontroller Hardware |
|
|
34 | (1) |
|
3.2.3.1 Input and Output Ports |
|
|
34 | (1) |
|
|
|
35 | (2) |
|
|
|
37 | (2) |
|
|
|
39 | (2) |
|
|
|
41 | (1) |
|
3.2.4 MicroPython Control Systems Library |
|
|
42 | (1) |
|
3.3 C on the STM32 Microcontroller |
|
|
43 | (10) |
|
3.3.1 Creating a New Project in Mbed Studio |
|
|
44 | (1) |
|
3.3.2 Building and Executing the Code |
|
|
45 | (1) |
|
3.3.3 Reaching Microcontroller Hardware |
|
|
45 | (1) |
|
3.3.3.1 Input and Output Ports |
|
|
46 | (1) |
|
|
|
47 | (1) |
|
|
|
48 | (2) |
|
|
|
50 | (1) |
|
|
|
51 | (2) |
|
3.3.4 C Control Systems Library |
|
|
53 | (1) |
|
3.4 Application: Running the DC Motor |
|
|
53 | (6) |
|
|
|
54 | (1) |
|
|
|
54 | (1) |
|
3.4.3 C Code for the System |
|
|
54 | (3) |
|
3.4.4 Python Code for the System |
|
|
57 | (2) |
|
|
|
59 | (1) |
|
|
|
59 | (4) |
|
|
|
60 | (3) |
|
4 Fundamentals of Digital Control |
|
|
63 | (48) |
|
|
|
63 | (14) |
|
4.1.1 Mathematical Definition |
|
|
64 | (1) |
|
4.1.2 Representing Digital Signals in Code |
|
|
64 | (1) |
|
4.1.2.1 Representation in Python |
|
|
65 | (1) |
|
4.1.2.2 Representation in C |
|
|
65 | (1) |
|
4.1.3 Standard Digital Signals |
|
|
65 | (1) |
|
4.1.3.1 Unit Pulse Signal |
|
|
66 | (1) |
|
|
|
67 | (1) |
|
|
|
68 | (1) |
|
|
|
68 | (1) |
|
4.1.3.5 Exponential Signal |
|
|
69 | (2) |
|
4.1.3.6 Sinusoidal Signal |
|
|
71 | (1) |
|
4.1.3.7 Damped Sinusoidal Signal |
|
|
71 | (1) |
|
4.1.3.8 Rectangular Signal |
|
|
72 | (1) |
|
4.1.3.9 Sum of Sinusoids Signal |
|
|
73 | (2) |
|
|
|
75 | (1) |
|
|
|
76 | (1) |
|
|
|
77 | (4) |
|
4.2.1 Mathematical Definition |
|
|
77 | (1) |
|
4.2.2 Representing Digital Systems in Code |
|
|
78 | (1) |
|
4.2.2.1 Representation in Python |
|
|
78 | (1) |
|
4.2.2.2 Representation in C |
|
|
79 | (1) |
|
4.2.3 Digital System Properties |
|
|
79 | (1) |
|
|
|
79 | (1) |
|
|
|
80 | (1) |
|
|
|
81 | (1) |
|
4.3 Linear and Time-Invariant Systems |
|
|
81 | (9) |
|
4.3.1 Mathematical Definition |
|
|
81 | (1) |
|
4.3.2 LTI Systems and Constant-Coefficient Difference Equations |
|
|
82 | (1) |
|
4.3.3 Representing LTI Systems in Code |
|
|
82 | (1) |
|
4.3.3.1 MicroPython Control Systems Library Usage |
|
|
83 | (1) |
|
4.3.3.2 C Control Systems Library Usage |
|
|
84 | (1) |
|
4.3.3.3 Python Control Systems Library Usage |
|
|
85 | (2) |
|
4.3.4 Connecting LTI Systems |
|
|
87 | (1) |
|
4.3.4.1 Series Connection |
|
|
87 | (1) |
|
4.3.4.2 Parallel Connection |
|
|
88 | (1) |
|
4.3.4.3 Feedback Connection |
|
|
89 | (1) |
|
4.4 The z-Transform and Its Inverse |
|
|
90 | (3) |
|
4.4.1 Definition of the z-Transform |
|
|
90 | (2) |
|
4.4.2 Calculating the z-Transform in Python |
|
|
92 | (1) |
|
4.4.3 Definition of the Inverse z-Transform |
|
|
92 | (1) |
|
AAA Calculating the Inverse z-Transform in Python |
|
|
92 | (1) |
|
4.5 The z-Transform and LTI Systems |
|
|
93 | (3) |
|
4.5.1 Associating Difference Equation and Impulse Response of an LTI System |
|
|
93 | (2) |
|
4.5.2 Stability Analysis of an LTI System using z-Transform |
|
|
95 | (1) |
|
4.5.3 Stability Analysis of an LTI System in Code |
|
|
95 | (1) |
|
4.6 Application I: Acquiring Digital Signals from the Microcontroller, Processing Offline Data |
|
|
96 | (7) |
|
|
|
97 | (1) |
|
|
|
97 | (1) |
|
4.6.3 C Code for the System |
|
|
97 | (2) |
|
4.6.4 Python Code for the System |
|
|
99 | (2) |
|
|
|
101 | (2) |
|
4.7 Application II: Acquiring Digital Signals from the Microcontroller, Processing Real-Time Data |
|
|
103 | (3) |
|
|
|
103 | (1) |
|
|
|
103 | (1) |
|
4.7.3 C Code for the System |
|
|
104 | (2) |
|
4.7 A Python Code for the System |
|
|
106 | (3) |
|
|
|
109 | (1) |
|
|
|
109 | (2) |
|
|
|
109 | (2) |
|
5 Conversion Between Analog and Digital Forms |
|
|
111 | (20) |
|
5.1 Converting an Analog Signal to Digital Form |
|
|
112 | (5) |
|
5.1.1 Mathematical Derivation of ADC |
|
|
112 | (2) |
|
|
|
114 | (3) |
|
5.2 Converting a Digital Signal to Analog Form |
|
|
117 | (3) |
|
5.2.1 Mathematical Derivation of DAC |
|
|
117 | (1) |
|
|
|
118 | (2) |
|
5.3 Representing an Analog System in Digital Form |
|
|
120 | (4) |
|
5.3.1 Pole-Zero Matching Method |
|
|
121 | (1) |
|
5.3.2 Zero-Order Hold Equivalent |
|
|
122 | (1) |
|
5.3.3 Bilinear Transformation |
|
|
123 | (1) |
|
5.4 Application: Exciting and Simulating the RC Filter |
|
|
124 | (5) |
|
|
|
125 | (1) |
|
|
|
125 | (1) |
|
5.4.3 C Code for the System |
|
|
125 | (2) |
|
5.4.4 Python Code for the System |
|
|
127 | (2) |
|
|
|
129 | (1) |
|
|
|
129 | (2) |
|
|
|
129 | (2) |
|
6 Constructing Transfer Function of a System |
|
|
131 | (20) |
|
6.1 Transfer Function from Mathematical Modeling |
|
|
131 | (3) |
|
6.1.1 Fundamental Electrical and Mechanical Components |
|
|
132 | (1) |
|
6.1.2 Constructing the Differential Equation Representing the System |
|
|
133 | (1) |
|
6.1.3 From Differential Equation to Transfer Function |
|
|
133 | (1) |
|
6.2 Transfer Function from System Identification in Time Domain |
|
|
134 | (8) |
|
6.2.1 Theoretical Background |
|
|
135 | (1) |
|
|
|
135 | (1) |
|
6.2.3 Data Acquisition by the STM32 Microcontroller |
|
|
136 | (1) |
|
6.2.4 System Identification in Time Domain by MATLAB |
|
|
137 | (5) |
|
6.3 Transfer Function from System Identification in Frequency Domain |
|
|
142 | (1) |
|
6.3.1 Theoretical Background |
|
|
142 | (1) |
|
|
|
142 | (1) |
|
6.3.3 System Identification in Frequency Domain by MATLAB |
|
|
143 | (1) |
|
6.4 Application: Obtaining Transfer Function of the DC Motor |
|
|
143 | (5) |
|
6.4.1 Mathematical Modeling |
|
|
143 | (3) |
|
6.4.2 System Identification in Time Domain |
|
|
146 | (1) |
|
6.4.3 System Identification in Frequency Domain |
|
|
147 | (1) |
|
|
|
148 | (3) |
|
|
|
148 | (3) |
|
7 Transfer Function Based Control System Analysis |
|
|
151 | (32) |
|
7.1 Analyzing System Performance |
|
|
151 | (12) |
|
7.1.1 Time Domain Analysis |
|
|
151 | (1) |
|
7.1.1.1 Transient Response |
|
|
152 | (4) |
|
7.1.1.2 Steady-State Error |
|
|
156 | (1) |
|
7.1.2 Frequency Domain Analysis |
|
|
156 | (3) |
|
7.1.3 Complex Plane Analysis |
|
|
159 | (1) |
|
|
|
160 | (1) |
|
|
|
160 | (3) |
|
7.2 The Effect of Open-Loop Control on System Performance |
|
|
163 | (4) |
|
7.2.1 What is Open-Loop Control? |
|
|
163 | (1) |
|
7.2.2 Improving the System Performance by Open-Loop Control |
|
|
164 | (3) |
|
7.3 The Effect of Closed-Loop Control on System Performance |
|
|
167 | (7) |
|
7.3.1 What is Closed-Loop Control? |
|
|
167 | (3) |
|
7.3.2 Improving the System Performance by Closed-Loop Control |
|
|
170 | (4) |
|
7.4 Application: Adding Open-Loop Digital Controller to the DC Motor |
|
|
174 | (4) |
|
|
|
175 | (1) |
|
|
|
175 | (1) |
|
7.4.3 C Code for the System |
|
|
175 | (2) |
|
7.4.4 Python Code for the System |
|
|
177 | (1) |
|
|
|
178 | (1) |
|
|
|
178 | (5) |
|
|
|
180 | (3) |
|
8 Transfer Function Based Controller Design |
|
|
183 | (44) |
|
8.1 PID Controller Structure |
|
|
183 | (4) |
|
|
|
184 | (1) |
|
|
|
184 | (1) |
|
|
|
185 | (1) |
|
8.1.4 Parameter Tuning Methods |
|
|
185 | (1) |
|
8.1.4.1 The Ziegler-Nichols Method |
|
|
186 | (1) |
|
8.1.4.2 The Cohen-Coon Method |
|
|
186 | (1) |
|
8.1.4.3 The Chien-Hrones-Reswick Method |
|
|
186 | (1) |
|
8.2 PID Controller Design in Python |
|
|
187 | (12) |
|
|
|
188 | (1) |
|
|
|
188 | (1) |
|
|
|
188 | (3) |
|
|
|
191 | (3) |
|
|
|
194 | (3) |
|
8.2.3 Comparison of the Designed P, PI, and PID Controllers |
|
|
197 | (2) |
|
8.3 Lag-Lead Controller Structure |
|
|
199 | (2) |
|
|
|
199 | (1) |
|
|
|
200 | (1) |
|
8.3.3 Lag-Lead Controller |
|
|
200 | (1) |
|
8.4 Lag-Lead Controller Design in MATLAB |
|
|
201 | (16) |
|
8.4.1 Control System Designer Tool |
|
|
201 | (2) |
|
8.4.2 Controller Design in Complex Plane |
|
|
203 | (1) |
|
|
|
204 | (2) |
|
|
|
206 | (1) |
|
8.4.2.3 Lag-Lead Controller |
|
|
207 | (3) |
|
8.4.2.4 Comparison of the Designed Lag, Lead, and Lag-Lead Controllers |
|
|
210 | (1) |
|
8.4.3 Controller Design in Frequency Domain |
|
|
211 | (1) |
|
|
|
211 | (2) |
|
|
|
213 | (1) |
|
8.4.3.3 Lag-Lead Controller |
|
|
213 | (4) |
|
8.4.3.4 Comparison of the Designed Lag, Lead, and Lag-Lead Controllers |
|
|
217 | (1) |
|
8.5 Application: Adding Closed-Loop Digital Controller to the DC Motor |
|
|
217 | (6) |
|
|
|
217 | (1) |
|
|
|
217 | (1) |
|
8.5.3 C Code for the System |
|
|
218 | (1) |
|
8.5.4 Python Code for the System |
|
|
219 | (1) |
|
|
|
220 | (3) |
|
|
|
223 | (4) |
|
|
|
224 | (3) |
|
9 State-space Based Control System Analysis |
|
|
227 | (20) |
|
|
|
227 | (1) |
|
9.1.1 Definition of the State |
|
|
227 | (1) |
|
9.1.2 Why State-space Representation? |
|
|
228 | (1) |
|
9.2 State-space Equations Representing an LTI System |
|
|
228 | (5) |
|
9.2.1 Continuous-time State-space Equations |
|
|
229 | (2) |
|
9.2.2 Discrete-time State-space Equations |
|
|
231 | (1) |
|
9.2.3 Representing Discrete-time State-space Equations in Code Form |
|
|
231 | (2) |
|
9.3 Conversion Between State-space and Transfer Function Representations |
|
|
233 | (3) |
|
9.3.1 From Transfer Function to State-space Equations |
|
|
233 | (2) |
|
9.3.2 From State-space Equations to Transfer Function |
|
|
235 | (1) |
|
9.4 Properties of the System from its State-space Representation |
|
|
236 | (4) |
|
9.4.1 Time Domain Analysis |
|
|
236 | (1) |
|
|
|
237 | (1) |
|
|
|
238 | (1) |
|
|
|
239 | (1) |
|
9.5 Application: Observing States of the DC Motor in Time |
|
|
240 | (3) |
|
|
|
240 | (1) |
|
|
|
240 | (1) |
|
9.5.3 C Code for the System |
|
|
240 | (2) |
|
9.5.4 Python Code for the System |
|
|
242 | (1) |
|
|
|
243 | (1) |
|
|
|
243 | (4) |
|
|
|
244 | (3) |
|
10 State-space Based Controller Design |
|
|
247 | (32) |
|
|
|
247 | (3) |
|
10.1.1 Control Based on State Values |
|
|
248 | (1) |
|
10.1.2 Regulator Structure |
|
|
249 | (1) |
|
10.1.3 Controller Structure |
|
|
249 | (1) |
|
10.1.4 What if States Cannot be Measured Directly? |
|
|
250 | (1) |
|
10.2 Regulator and Controller Design via Pole Placement |
|
|
250 | (3) |
|
|
|
251 | (1) |
|
|
|
251 | (1) |
|
10.2.3 Ackermann's Formula for the Regulator Gain |
|
|
251 | (1) |
|
|
|
252 | (1) |
|
10.2.5 Ackermann's Formula for the Controller Gain |
|
|
253 | (1) |
|
10.3 Regulator and Controller Design in Python |
|
|
253 | (7) |
|
|
|
253 | (3) |
|
|
|
256 | (4) |
|
10.4 State Observer Design |
|
|
260 | (3) |
|
10.4.1 Mathematical Derivation |
|
|
261 | (1) |
|
10.4.2 Ackermann's Formula for the Observer Gain |
|
|
262 | (1) |
|
10.5 Regulator and Controller Design in Python using Observers |
|
|
263 | (7) |
|
|
|
263 | (1) |
|
10.5.2 Observer-Based Regulator Design |
|
|
264 | (2) |
|
10.5.3 Observer-Based Controller Design |
|
|
266 | (4) |
|
10.6 Application: State-space based Control of the DC Motor |
|
|
270 | (5) |
|
|
|
270 | (1) |
|
|
|
271 | (1) |
|
10.6.3 C Code for the System |
|
|
271 | (2) |
|
10.6.4 Python Code for the System |
|
|
273 | (1) |
|
|
|
274 | (1) |
|
|
|
275 | (4) |
|
|
|
275 | (4) |
|
|
|
279 | (20) |
|
11.1 What is Adaptive Control? |
|
|
279 | (1) |
|
11.2 Parameter Estimation |
|
|
280 | (3) |
|
11.3 Indirect Self-Tuning Regulator |
|
|
283 | (5) |
|
11.3.1 Feedback ISTR Design |
|
|
283 | (4) |
|
11.3.2 Feedback and Feedforward ISTR Design |
|
|
287 | (1) |
|
11.4 Model-Reference Adaptive Control |
|
|
288 | (2) |
|
11.5 Application: Real-Time Parameter Estimation of the DC Motor |
|
|
290 | (7) |
|
|
|
290 | (1) |
|
|
|
291 | (1) |
|
11.5.3 C Code for the System |
|
|
291 | (2) |
|
|
|
293 | (4) |
|
|
|
297 | (2) |
|
|
|
297 | (2) |
|
|
|
299 | (30) |
|
|
|
299 | (3) |
|
12.1.1 Nonlinear System Identification by MATLAB |
|
|
299 | (2) |
|
12.1.2 Nonlinear System Input-Output Example |
|
|
301 | (1) |
|
12.1.3 Gain Scheduling Example |
|
|
302 | (1) |
|
12.1.4 Flat Systems Example |
|
|
302 | (1) |
|
12.1.5 Phase Portraits Example |
|
|
302 | (1) |
|
|
|
302 | (3) |
|
12.2.1 The Linear Quadratic Regulator |
|
|
303 | (1) |
|
12.2.2 Continuous-Time LQR Example |
|
|
304 | (1) |
|
12.2.3 LQR for the DC Motor |
|
|
304 | (1) |
|
|
|
305 | (1) |
|
|
|
306 | (2) |
|
12.4.1 Hardware and Software Setup |
|
|
306 | (1) |
|
|
|
307 | (1) |
|
|
|
308 | (1) |
|
|
|
308 | (1) |
|
|
|
309 | (1) |
|
12.6 Constructing a Servo Motor from DC Motor |
|
|
309 | (2) |
|
|
|
309 | (1) |
|
|
|
310 | (1) |
|
|
|
311 | (2) |
|
|
|
312 | (1) |
|
|
|
312 | (1) |
|
12.8 Smart Balance Hoverboard |
|
|
313 | (1) |
|
|
|
313 | (1) |
|
|
|
314 | (1) |
|
12.9 Line Following Robot |
|
|
314 | (1) |
|
|
|
314 | (1) |
|
|
|
314 | (1) |
|
12.10 Active Noise Cancellation |
|
|
315 | (2) |
|
|
|
315 | (1) |
|
|
|
316 | (1) |
|
12.11 Sun Tracking Solar Panel |
|
|
317 | (1) |
|
|
|
317 | (1) |
|
|
|
317 | (1) |
|
12.12 System Identification of a Speaker |
|
|
318 | (3) |
|
|
|
319 | (1) |
|
|
|
319 | (2) |
|
12.13 Peltier Based Water Cooler |
|
|
321 | (1) |
|
|
|
321 | (1) |
|
|
|
322 | (1) |
|
12.14 Controlling a Permanent Magnet Synchronous Motor |
|
|
322 | (7) |
|
|
|
322 | (1) |
|
|
|
323 | (6) |
| Appendix A STM32 Board Pin Usage Tables |
|
329 | (6) |
| Bibliography |
|
335 | (4) |
| Index |
|
339 | |