Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional...

31
Control Systems I Lecture 12: PID Control Readings: A&M, Ch. 10, Guzzella, Chapter 11.2, Jacopo Tani Institute for Dynamic Systems and Control D-MAVT ETH Z¨ urich December 7, 2018 J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 1 / 31

Transcript of Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional...

Page 1: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Control Systems ILecture 12: PID Control

Readings: A&M, Ch. 10, Guzzella, Chapter 11.2,

Jacopo Tani

Institute for Dynamic Systems and ControlD-MAVT

ETH Zurich

December 7, 2018

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 1 / 31

Page 2: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Tentative schedule

# Date Topic

1 Sept. 21 Introduction, Signals and Systems2 Sept. 28 Modeling, Linearization

3 Oct. 5 Analysis 1: Time response, Stability4 Oct. 12 Analysis 2: Diagonalization, Modal coordinates5 Oct. 19 Transfer functions 1: Definition and properties6 Oct. 26 Transfer functions 2: Poles and Zeros7 Nov. 2 Analysis of feedback systems: internal stability,

root locus8 Nov. 9 Frequency response9 Nov. 16 Analysis of feedback systems 2: the Nyquist

condition

10 Nov. 23 Frequency response II11 Nov. 30 Specifications for feedback systems12 Dec. 7 PID control13 Dec. 14 Loop Shaping14 Dec. 21 State feedback and Luenberger observers

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 2 / 31

Page 3: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Today’s learning objectives

Learn what a PID control is and how to design one:

Proportional control: what it is, pro’s and con’s

Derivative control: what it is, pro’s and con’s

Integral control: what it is, pro’s and con’t

Tuning strategies for PID controllers.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 3 / 31

Page 4: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

A nice intro to PID control

https://www.youtube.com/watch?v=4Y7zG48uHRo

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 4 / 31

Page 5: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Recall: Control Specifications

Type of the system (order of ramp to track with zero steady-state error):

Number of integrators in L(s)

Time domain specifications (max overshoot, settling time, rise time, ...):

Location of dominant closed-loop poles (damping ratio and real part)

Frequency domain specifications (command tracking, disturbance/noiserejection, closed-loop bandwidth):

Bode obstacle course (low/high frequency)

Crossover frequency

Control synthesis: how do we choose a feedback control system thatachieves these objectives?

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 5 / 31

Page 6: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Controller design methods

What other methods do exist to design controllers C (s) that meet designspecifications? Many approaches, among them:

PID, Loop Shaping, LQR, LQG-LTR, H∞, Discrete-time optimal control,continuous-time optimal control, model predictive control,...

Today we look at the most widely used approach for SISO systems: PIDcontrol.

PID - control (proportional-integral-derivative control) is the most widelyapplied controller design because it is able to cope well with the majority ofcases encountered in practice.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 6 / 31

Page 7: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional Control

1

s+1

Transfer Fcn

Step

Scope

Band-LimitedWhite Noise

Step1

5

Gain

output

noisemeasurement

reference error control

disturbance

The control input tries to move the system in a direction that is opposite tothe error, and is proportional to the error in magnitude.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 7 / 31

Page 8: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

0 1 2 3 4 5 6 7 8 9 10t

0

0.2

0.4

0.6

0.8

1

1.2

y

k=2k=5k=10k=50

As the proportional gain increases,The closed-loop system remains stable;The steady-state error decreases;The response becomes faster;The sensitivity to noise increases.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 8 / 31

Page 9: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

-60 -50 -40 -30 -20 -10 0 10-3

-2

-1

0

1

2

3

60 50 40 30 20

0.880.9750.9890.9950.9970.999

1

1

10

0.880.9750.9890.9950.9970.999

1

1

Root Locus

Real Axis (seconds-1)

Imag

inar

y Ax

is (s

econ

ds-1

)

Closed-loop transfer function

T (s) =kL(s)

1 + kL(s)=

1

s + 1 + k,

i.e., the closed-loop pole is at s = −1− k (see root locus above).

Steady-state error to a unit step: ess = lims→01

1+kL(s) = 11+k

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 9 / 31

Page 10: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

-40

-20

0

20

40

Mag

nitu

de (d

B)

10-2 10-1 100 101 102-90

-45

0

Phas

e (d

eg)

k=2k=5k=10k=50

Bode Diagram

Frequency (rad/s)

As the proportional gain increases,Phase margin remains > 90◦;The crossover frequency increases;The low-frequency gain increases;The high-frequency gain increases;

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 10 / 31

Page 11: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Introducing an integrator

1

s+1

Transfer Fcn

Step

Band-LimitedWhite Noise

Step1

2

P Gain

simout

To Workspace

1s

Integrator

5

I Gain

output

noisemeasurement

reference error

disturbance

control

control

Integrating the error allows one to detect potential ”biases” in the systembehavior.An integral control action tries to move the response in order to reduce thedetected biases.PI control:

u(t) = kPe(t) + kI

∫ t

0

e(τ)dτ,

C (s) = kP +kIs

=kPs + kI

s= kI

kP/kI · s + 1

s.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 11 / 31

Page 12: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Integral gain selection

0 1 2 3 4 5 6 7 8 9 10t

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

y

kP=2, k I = 2kP=2, k I = 2kP=2, k I = 5kP=10, k I = 50

As the integral gain increases,

The steady-state error is zero (as long as kI is not zero)

The response becomes more oscillatory (warning!)

The sensitivity to noise does not change!

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 12 / 31

Page 13: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Integral gain selection

-90 -80 -70 -60 -50 -40 -30 -20 -10 0 10-30

-20

-10

0

10

20

30Root Locus

Real Axis (seconds-1)

Imag

inar

y Ax

is (s

econ

ds-1

)

Steady-state error to a unit step: ess = lims→01

1+C(s)L(s) = 0

The root locus shows us that as the integral gain increases, the closed-looppoles go from being “slow” and overdamped to being “fast” but with lowdamping!

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 13 / 31

Page 14: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Integral gain selection

-60

-40

-20

0

20

40

60

80

Mag

nitu

de (d

B)

10-2 10-1 100 101 102 103-180

-150

-120

-90

Phas

e (d

eg)

Bode Diagram

Frequency (rad/s)

As the integral gain increases,Phase margin decreases;The crossover frequency increases;The low-frequency gain increases — but goes to infinity near 0 in all cases ;The high-frequency gain does not change.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 14 / 31

Page 15: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional Control — Higher order systems

2

s +2s+22

Transfer Fcn

Step

Band-LimitedWhite Noise

Step1

50

P Gain

simout

To Workspace

output

noisemeasurement

reference error

disturbance

control

control

How do the previous consideration extend to higher-order systems, e.g., 2ndorder?

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 15 / 31

Page 16: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

0 1 2 3 4 5 6 7 8 9 10t

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

y

As the proportional gain increases,The closed-loop system become more oscillatory (warning!);The steady-state error decreases;The response becomes faster;The sensitivity to noise increases.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 16 / 31

Page 17: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

-2.5 -2 -1.5 -1 -0.5 0 0.5-15

-10

-5

0

5

10

15

14

12

10

8

6

4

2

14

12

10

8

6

4

2

0.5

0.26

0.17 0.115 0.085 0.056 0.036 0.016

0.5

0.26

0.17 0.115 0.085 0.056 0.036 0.016

Root Locus

Real Axis (seconds-1)

Imag

inar

y Ax

is (s

econ

ds-1

)

The root locus shows that as the proportional gain increases, the closed-looppoles have decreasing damping ratio.

Steady-state error to a unit step: ess = lims→01

1+kL(s) = 11+k

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 17 / 31

Page 18: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional gain selection

-80

-60

-40

-20

0

20

40

Mag

nitu

de (d

B)

10-2 10-1 100 101 102-180

-135

-90

-45

0

Phas

e (d

eg)

Bode Diagram

Frequency (rad/s)

As the proportional gain increases,Phase margin gets smaller and smaller!The crossover frequency increases;The low-frequency gain increases;The high-frequency gain increases;

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 18 / 31

Page 19: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Introducing a differentiator

2

s +2s+22

Transfer Fcn

Step

Band-LimitedWhite Noise

Step1

50

P Gain

simout

To Workspace

Derivative

50

D Gain

output

noisemeasurement

reference error

disturbance

control

control

Differentiating the error allows one to “predict” what the error will do in thenear future.An derivative control action tries to avoid overshooting, hence damping thesystem.PD control:

u(t) = kPe(t) + kD e(t)

C (s) = kP + kDs.

Note that this is not a causal transfer function (not physically realizable ingeneral). This is typically fixed by approximating the derivative as s ≈ s

cs+1for some small c .)

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 19 / 31

Page 20: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Derivative gain selection

0 1 2 3 4 5 6 7 8 9 10t

0

0.2

0.4

0.6

0.8

1

1.2

1.4

y

kP=50, k D=2kP=50, k D=5kP=50, k D=10kP=50, k D=50

As the derivative gain increases,

The steady-state error not affected;

The response becomes less oscillatory, but potentially slower

The sensitivity to noise increases!

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 20 / 31

Page 21: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Derivative gain selection

-120 -100 -80 -60 -40 -20 0 20-30

-20

-10

0

10

20

30Root Locus

Real Axis (seconds-1)

Imag

inar

y Ax

is (s

econ

ds-1

)

Steady-state error to a unit step: ess = lims→01

1+C(s)L(s) = 11+kPL(0)

The root locus shows us that as the derivative gain increases, the closed-looppoles are “pulled” into the left half plane!

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 21 / 31

Page 22: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Derivative gain selection

-60

-40

-20

0

20

40

Mag

nitu

de (d

B)

k_P=50, k_D=2k_P=50, k_D=5k_P=50, k_D=10k_P=50, k_D=50

10-2 10-1 100 101 102 103-180

-135

-90

-45

0

Phas

e (d

eg)

Bode Diagram

Frequency (rad/s)

As the derivative gain increases,Phase margin increases;The crossover frequency increases;The low-frequency gain does not change;The high-frequency gain increases.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 22 / 31

Page 23: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Proportional-Integral-Derivative Control

2

s +2s+22

Transfer Fcn

Step

Band-LimitedWhite Noise

Step1

10

P Gain

simout

To Workspace

Derivative

5

D Gain

1s

Integrator

10

D Gain1

output

noisemeasurement

reference error

disturbance

control

control

One can also combine the effects of an integrator and of a differentiator withthe basic proportional controller.

PID control:

u(t) = kPe(t) + kI

∫ t

0

e(τ)dτ + kD e(t),

C (s) = kP +kIs

+ kDs =kDs

2 + kPs + kIs

.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 23 / 31

Page 24: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

PID Tuning

PID tuning corresponds to choosing the parameters kp, ki and kd to reach thefeedback control design specifications.

PID tuning can be done with tuning rules by hand or numerically usingMATLAB or other tools (the latter requires a system model).

There exist heuristic methods to tune a PID controller without a model ofthe plant P(s), e.g. the tuning rules proposed by Ziegler and Nichols.

My recommendation: think of a PID as

C (s) = kRL(s − z1)(s − z2)

s

i.e., as two zeros and one pole at the origin. Decide where you want thesezeros (in the complex plane, or in terms of natural frequency and dampingratio on the Bode plot), and what you want the (root-locus) gain to be.Finally, compute the corresponding kP , kI , kD .

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 24 / 31

Page 25: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Summary

Proportional control

Decrease the steady-state error;

Increase the closed-loop bandwidth;

Increase sensitivity to noise;

Can reduce stability margins for higher-order systems (2nd order or more).

Integral control

Eliminates the steady-state error to a step (if the closed-loop is stable);

Reduces stability margins, can make a higher-order system unstable.

Derivative control

Reduce overshooting, increase damping;

Improves stability margins;

Increase sensitivity to noise.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 25 / 31

Page 26: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Today’s learning objectives

Learn what a PID control is and how to design one:

Proportional control: what it is, what it does, pro’s and con’s

Derivative control: what it is, what it does, pro’s and con’s

Integral control: what it is, what it does, pro’s and con’s

Tuning strategies for PID controllers.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 26 / 31

Page 27: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Ziegler Nichols Tuning Rules

Assumption: Plant can be approximated by the transfer function

P(s) =k

τs + 1e−Ts

with T/(T + τ) small.

Apply the controller C (s) = kp to the system starting at kp = 0 and increasekp until the system is in a steady-state oscillation, then note the ”critical kp”called k∗p and the corresponding critical oscillation period T ∗.

Use k∗p and T ∗ to calculate the control gains:

type kp Ti Td

P 0.5 · k∗p ∞ · T ∗ 0 · T ∗PI 0.45 · k∗p 0.85 · T ∗ 0 · T ∗PD 0.55 · k∗p ∞ · T ∗ 0.15 · T ∗PID 0.6 · k∗p 0.5 · T ∗ 0.125 · T ∗

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 27 / 31

Page 28: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Ziegler Nichols Tuning Rules

Graphically:

1

1(Lino Guzzella ”Analysis and Synthesis of Single-Input Single-Output Control Systems)J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 28 / 31

Page 29: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Ziegler Nichols Tuning Example

Plant: P(s) =1

(s + 1) · (s2 + 2s + 2)

Approximation: Papprox =0.5

0.5 · s + 1· e−0.01s

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 29 / 31

Page 30: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Ziegler Nichols Tuning Example

Set Ti =∞,Td = 0, τ = 0 and increase gain kp.Critical gain k∗p = 10 with critical oscillation period T ∗ = 2π

ω∗ = 2π2 = π

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 30 / 31

Page 31: Control Systems I - ETH Z · Learn what a PID control is and how to design one: Proportional control: what it is, pro’s and con’s Derivative control: what it is, pro’s and con’s

Ziegler Nichols Tuning Example

P, PI, PD, PID controller according to Ziegler and Nichols tuning rules.PID controller derived with MATLAB sisotool.Ziegler Nichols tuning rules can be useful when no model of the plant isavailable but generally other tuning rules provide better results.

J. Tani, E. Frazzoli (ETH) Lecture 12: Control Systems I 7/12/2018 31 / 31