You are on page 1of 9

Lecture 10 – Feedforward Design

[IFAC PB Chapter 9; These slides]


Feedforward Design
Real-Time Systems, Lecture 10
• Reduction of measurable disturbances by feedforward
• Using feedforward to improve setpoint response
• The servo problem
Martina Maggio • Reference generation – input–output approach
18 February 2020 • Reference generation – state-space approach
Lund University, Department of Automatic Control • Nonlinear reference generation

Reduction of measurable disturbances by feedforward System Inverses

Typical scenario:
d Assume
B(z) A(z)
−Hff H(z) = ⇒ H −1 (z) =
A(z) B(z)
Potential problems:
uc u y • Inverse not causal if pole excess d = deg A − deg B ≥ 1
Σ Hfb Σ H p1 Σ H p2
• Inverse not stable if B(z) has zeros outside unit circle

One possible solution:


−1 • Factor B(z) as B + (z)B − (z)
• B + (z) has all its zeros inside unit circle
Pulse transfer function from measured disturbance d to output y: • B − (z) has all its zeros outside unit circle
Hp2 (z) (1 − Hp1 (z)Hff (z)) • Use the approximate inverse
Y (z) = D(z)
1 + Hp2 (z)Hp1 (z)Hf b (z)
A(z) −
H † (z) = , where B ∗− (z) = z degB B − (z −1 )
To completely eliminate the disturbance, select z d B + (z)B ∗− (z)

Hff (z) = Hp−1 (z) • B ∗− (z) - the mirror in the unit circle of the zeros outside the unit
1
2 circle 3

Approximate Inverse – Example Two Classes of Control Problems

Let
6(1 − s)
G(s) =
(s + 2)(s + 3) Regulation problems: compromise between rejection of load
ZOH sampling with h = 0.1 gives disturbances and injection of measurement noise

−0.4420(z − 1.106) B(z) • Feedback


H(z) = =
(z − 0.8187)(z − 0.7408) A(z) • Lecture 9 - Last lecture

H −1 (z) noncausal and unstable. Approximate inverse: • Feedforward


• Lecture 10 - Today
B + (z) = 1, B − (z) = −0.4420(z − 1.106), d = 1, degB − = 1
Servo problems: make the output respond to command signals in the
B ∗− (z) = −0.4420z(z −1 − 1.106) = −0.4420(1 − 1.106z) desired way

(z − 0.8187)(z − 0.7408) (z − 0.8187)(z − 0.7408) • Feedforward


H † (z) = =
−0.4420z(1 − 1.106z) 0.488z(z − 0.904) • Lecture 10 - Today
Stable and causal
4 5
Using feedforward to improve setpoint response Simplistic Setpoint Handling – Error Feedback

The servo problem: Make the output respond to setpoint changes in


the desired way y
uc e
Σ Hc (z) Hp (z)
Typical design criteria:
y
2p −1
• Rise time, Tr M
1.0 e0
• Overshoot, M
Potential problems:
• Settling time, Ts
• Steady-state error, e0 • Step changes in the setpoint can introduce very large control signals
• ... t • The same controller Hc (z) must be tuned to handle both
Tr
Ts disturbances and setpoint changes
• No separation between the regulator problem and the servo problem

6 7

Common Quick Fixes A More General Solution

Use a two-degree-of-freedom (2-DOF) controller, e.g.:


• Filter the setpoint signal uc
Hff

uc ũc
Hf (z) y
Hfb Σ Hp

• Rate-limit the setpoint signal −1

uc ũc Design procedure:


1. Design feedback controller Hfb to get good regulation properties
(attenuation of load disturbances and measurement noise)
• Introduce setpoint weighting in the controller
2. Design feedforward compensator Hff to obtain the desired servo
• E.g. PID controller with setpoint weightings β and γ
performance
Separation of concerns
8 9

2-DOF Control Structures Example: PID with Setpoint Weighting

 Z 
A 2-DOF controller can be represented in many different ways, e.g.: 1 d
u = K βysp − y + (ysp − y)dτ + TD (γysp − y)
TI dt
 Z 
1 de
=K e+ e dτ + TD
TI dt
dysp
+ K(β − 1) ysp + TD K(γ − 1)
| {z } | {z } dt
K1 K2

K1 ysp + K2 d ysp /dt


ysp y
+ PID + GP

For linear systems, all these structures are equivalent


Interpretation: Error feedback + feedforward from ysp

10 11
Reference Generation – Input–Output Approach Reference Generation – Input–Output Approach

2-DOF control structure with reference model and feedforward:


The pulse transfer function from uc to y is
uff Hp (Hff + Hc Hm )
Hff H=
1 + Hp H c
uc ym y Choose
Hm Σ Hc Σ Hp Hm
Hff =
Hp

−1 Then
Hp ( H
Hp + Hc Hm )
m

H= = Hm
1 + Hp Hc
• Hm – model that describes the desired setpoint response
• Hff – feedforward generator that makes y follow ym Perfect model following!
• Goal: perfect following if there are no disturbances or model errors

12 13

Restrictions on the Model Example: PID Control of the Double Tank

Hm
In order for Hff = to be implementable (causal and stable),
Hp
Process:
• Hm must have at least the same pole excess as Hp 3
Gp (s) =
• any zeros of Hp outside unit circle must also be included in Hm (1 + 60s)2
ZOH-sampled process (h = 3):
In practice, also poorly damped zeros of Hp (e.g., outside the
heart-shaped region below) should be included in Hm 0.003627(z + 0.9672)
Hp (z) =
(z − 0.9512)2
1
ζ=0
0.2 PID controller tuned for good regulation performance:
0.4
0.5
0.6  
0.8 1 sTd
Gc (s) = K 1 + +
0 1 sTi 1 + sTd /N

−0.5 with K = 7, Ti = 45, Td = 15, N = 10, discretized using FOH

−1

−1.5 −1 −0.5 0 0.5 1 1.5


14 15

Example: PID Control of the Double Tank Example: PID Control of the Double Tank

Simulation with simple error feedback:


1.5
Reference model (critically damped – should not generate any overshoot):
1
1
Output

Gm (s) =
0.5 (1 + 10s)2
0
0 20 40 60 80 100 120 140 160 180 200
Sampled reference model:
40 0.036936(z + 0.8187)
Hm (z) =
20 (z − 0.7408)2
Input

0
Feedforward filter:
−20
0 20 40 60 80 100 120 140 160 180 200 Hm (z) 10.1828(z + 0.8187)(z − 0.9512)2
Time Hff (z) = =
Hp (z) (z − 0.7408)2(z + 0.9672)
• Load disturbance at time 100 regulated as desired
• Too large control signal at time 0 and overshoot in the step response
16 17
Example: PID Control of the Double Tank Example: PID Control of the Double Tank

Simulation with reference model and feedforward:


1.5

1
Output

0.5 Modified reference model that includes the process zero:

0 0.034147(z + 0.9672)
0 20 40 60 80 100 120 140 160 180 200 Hm (z) =
(z − 0.7408)2
10

5 New feedforward filer:


Input

0 Hm (z) 9.414(z − 0.9512)2


Hff (z) = =
−5
Hp (z) (z − 0.7408)2
0 20 40 60 80 100 120 140 160 180 200
Time

• Perfect step response according to the model


• Unpleasant ringing in the control signal
• due to cancellation of poorly damped process zero
18 19

Example: PID Control of the Double Tank Remark

Simulation with modified reference model:


1.5 In the implementation, both uff and ym can be generated by a single
dynamical system:
1
Output

uff
0.5
uc Model and
0 feedforward ym
0 20 40 60 80 100 120 140 160 180 200
generator
10

5 Matlab:
Input

0
>> Hp = ... % define process
−5
0 20 40 60 80 100 120 140 160 180 200 >> Hm = ... % define reference model
Time
>> refgen = [Hm/Hp; Hm] % concatenate systems
>> minreal(ss(refgen)) % make minimal state-space realization
• Very similar step response
• Ringing in control signal eliminated
20 21

Simplistic Setpoint Handling in State Space Reference Generation – State Space Approach

Replace u(k) = −Lx(k) with uc Model and u ff


Feedforward
u(k) = Lc uc (k) − Lx(k) xm u fb y
Generator
∑ L ∑ Process

The pulse transfer function from uc (k) to y(k) is

B(z) Observer
Hyuc (z) = C(zI − Φ + ΓL)−1 ΓLc = Lc
Am (z)

In order to have unit static gain (Hyuc (1) = 1), Lc should be chosen as The model should generate a reference trajectory xm for the process
1 state x (one reference signal per state variable)
Lc =
C(I − Φ + ΓL)−1 Γ The feedforward signal uff should make x follow xm

– Goal: perfect following if there are no disturbances or model errors

22 23
Reference Generation – State Space Approach Design of the Reference Model

Linear reference model: Start by choosing the reference model identical to the process model, i.e.,

xm (k + 1) = Φm xm (k) + Γm uc (k) xm (k + 1) = Φxm (k) + Γuff (k)

Control law: Then modify the dynamics of the reference model as desired using state
  feedback (“within the model”)
u(k) = L xm (k) − x̂(k) + uff (k)
uff (k) = Lc uc (k) − Lm xm (k)

Gives the reference model dynamics


• How to generate model states xm that are compatible with the real
xm (k + 1) = (Φ − ΓLm )xm (k) + ΓLc uc (k)
states x? | {z } |{z}
Φm Γm
• How to generate the feedforward control uff ?

24 25

Design of the Reference Model Design of the Reference Model

Model and Feedforward Generator Design choices:


uff
• Lm is chosen to give the model the desired eigenvalues (poles)
• Lc is chosen to give the desired static gain (usually 1)
uc
Lc Σ Model

xm Remark: The reference model will have the same zeros as the process,
−Lm so there is no risk of cancelling poorly damped or unstable zeros
Additional zeros and poles can be added by extending the model

26 27

Complete State-Space Controller Pseudo-Code Structure

Observer with one sample delay


1 y = ReadInput();
2 u_c = getCommandSignal();
3 u_ff = -Lm*x_m + Lc*u_c;
The complete controller, including state feedback, observer, and 4 u = L*(x_m - x_hat) + u_ff;
reference generator is given by 5 WriteOutput(u);
6 x_m = Phi*x_m + Gamma*u_ff;
7 x_hat = Phi*x_hat + Gamma*u + K*(y - c*x_hat);

x̂(k + 1) = Φx̂(k) + Γu(k) + K(y(k) − C x̂(k)) (Observer) The computational delay can be further minimized
xm (k + 1) = Φxm (k) + Γuff (k) (Reference model) 1 y = ReadInput();
2 u_c = getCommandSignal();
u(k) = L(xm (k) − x̂(k)) + uff (k) (Control signal) 3 u_ff = u_ff_temp + Lc*u_c;
4 u = u_temp + u_ff;
uff (k) = −Lm xm (k) + Lc uc (k) (Feedforward)
5 WriteOutput(u);
6 x_m = Phi*x_m + Gamma*u_ff;
7 x_hat = Phi*x_hat + Gamma*u + K*(y - c*x_hat);
8 u_ff_temp = -Lm*x_m;
9 u_temp = L*(x_m - x_hat);
28 29
Design Example: Depth Control of Torpedo Torpedo: Continuous-Time Model

Simple model:
y dq
= aq + bδ
dt

θ =q
dt
δ dy
= −V θ (+ cδ)
State vector: dt
   
 q   pitch angular velocity  where a = −2, b = −1.3, and V = 5 (speed of torpedo)
 
   

   
x=

 θ
 =

 pitch angle 

    
 
   
  a 0 0  b
y depth 
 
 
 

   
ẋ = 

 1 0 0 

 x + 

 0 
u


 
  
 
Input signal: 0 −V 0 0
 
u = δ = rudder angle y = 0 0 1x

30 31

Torpedo: Sampled Model Torpedo: State Feedback Design

Sample with h = 0.2 • u(k) = −Lx(k)


• rejection of (impulse) load disturbances
   
 0.67 0 0  −0.214 

 
 
 
 Desired continuous-time dynamic behaviour:
   
x(k + 1) = 

 0.165 1 0 
 x(k) + 

 −0.023 

 u(k)

 
 
 

−0.088 −1 1 0.008 • two complex-conjugated poles with relative damping 0.5 and natural
frequency ωc
Matlab: • one pole in −ωc
• a single parameter decides the dynamics
>> A = [a 0 0; 1 0 0; 0 -V 0];
>> B = [b; 0; 0]; Desired characteristic polynomial
>> C = [0 0 1];
>> Gp = ss(A,B,C,0); (s2 + 2 · 0.5 · ωc s + ωc2 )(s + ωc ) = s3 + 2ωc s2 + 2ωc2 s + ωc3
>> h = 0.2;
>> Hp = c2d(Gp,h); Each pole translated into discrete time as zi = esi h
>> [Phi,Gamma] = ssdata(Hp);
32 33

Torpedo: State Feedback Design in Matlab Torpedo: Observer Design


• x̂(k + 1) = Φx̂(k) + Γu(k) + K y(k) − C x̂(k)
• state estimation + measurent noise rejection
Matlab:
Observer Dynamics:
>> wc = 1; % speed of state feedback • the same pole layout as in the state feedback design
>> pc = wc*roots([1 2 2 1]); % control poles in cont time
• parametrized by ωo instead of ωc
>> pcd = exp(pc*h); % control poles in disc time
>> L = place(Phi, Gam, pcd) • typically faster dynamics than the state feedback, e.g., ωo = 2ωc
L = Desired continuous-time characteristic polynomial:
-0.145 -1.605 0.153
(s2 + ωo s + ωo2 )(s + ωo ) = s3 + 2ωo s2 + 2ωo2 s + ωo3

34 35
Torpedo: Observer Design in Matlab Torpedo: Simplistic Setpoint Handling

Simulation assuming simplistic approach, u(k) = −Lx̂(k) + Lc uc (k),


−1
Lc = C(I − Φ + ΓL)−1 Γ
1.5

>> wo = 2; % speed of observer 1

Output
>> po = wo*roots([1 2 2 1]); % observer poles in cont time 0.5
>> pod = exp(po*h); % observer poles in disc time
0
>> K = place(Phi',C',pod)' 0 2 4 6 8 10 12 14 16 18 20

K = 1

0 0.5

Input
-0.130
0
0.460
−0.5
0 2 4 6 8 10 12 14 16 18 20
Time

• Step response slower than desired; overshoot in response

36 37

Torpedo: Reference Model and Feedforward Design Torpedo: Reference Model and Feedforward in Matlab

Reference model:

xm (k + 1) = Φxm (k) + Γuff (k)


>> wm = 2; % speed of model
Feedforward: >> pm = wm*roots([1 3 3 1]); % model poles in cont time
>> pmd = exp(pm*h); % model poles in disc time
uff = −Lm xm + Lcm uc >> Lm = place(Phi,Gam,pmd)
Lm =
Desired characteristic polynomial: -2.327 -6.744 0.886
>> Hm = ss(Phi-Gam*Lm,Gam,C,0,h);
(s + ωm )3 = s3 + 3ωm s2 + 3ωm
2 3
s + ωm >> Lcm = 1/dcgain(Hm)
Lcm =
(critically damped – important!)
0.836
• Parametrized using ωm
• Chosen as ωm = 2ωc

38 39

Torpedo: Final Controller Torpedo: Final Controller

Model states and feedforward signal:


1.5 1.5

1 1
Output

0.5 xm1 xm3


0.5
0
xm2
0 −0.5
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
1 1

0.5 0.5
Input

uff
0 0

−0.5 −0.5
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
Time Time

• Faster step response without overshoot • The model states and the feedforward signal are not affected by the
load disturbance
• Open loop
40 41
Torpedo: Final Controller without Feedforward Torpedo: Final Controller without Feedback

Simulation without the feedforward signal, u(k) = L(xm (k) − x̂(k)): Simulation without the feedback signal, u(k) = uff (k):

1.5 1.5

1 1
Output

Output
0.5 0.5

0 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
1 1

0.5 0.5
Input

Input
0 0

−0.5 −0.5
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
Time Time

• Does not work very well – the feedforward term is needed to get the • Does not work – the feedback term is needed to stabilize the process
desired setpoint response and handle the load disturbance
42 43

Nonlinear Reference Generation General Solution for Linear Processes

Recall the state-space approach to reference generation:

uc Model and u ff Assume linear process


Feedforward dx
Generator
xm u fb y = Ax + Bu
∑ L ∑ Process dt

• Derive the feedforward (open-loop) control signal uff that solves the
xˆ stated optimization problem
Observer
• Course in Nonlinear Control (FRTN05, Lp 2)
• Generate the model state trajectories by solving
uff and xm do not have to come from linear filters but could be the
dxm
result of solving an optimization problem, e.g.: = Axm + Buff
dt
• Move a satellite to a given altitude with minimum fuel
• Position a mechanical servo in as short time as possible under a Similar approach can be used for sampled systems
torque constraint
• Move the ball on the beam as fast as possible without losing it
44 45

Example: Time-Optimal Control of Ball on Beam Example: Time-Optimal Control of Ball on Beam

Optimization problem: Assume steady state. Move the ball from start
position z(0) = z0 to final position z(tf ) = zf in minimum time while
respecting the control signal constraints
−umax ≤ u(t) ≤ umax

Optimal control theory gives the optimal open-loop control law



State vector: 
 −u , 0≤t<T
     0

 z   ball position 
 
  
 
 uff (t) = −u0 , T ≤ t < 3T
    
x=

 v
 =

 ball velocity 

 

 
   
 −u , 3T ≤ t < 4T
0
φ beam angle
where
Continuous-time state-space model:
u0 = sgn(zf −z0 )umax
dz s
dt =v
dv |zf −z0 |
dt = −kv φ (kv ≈ 10) T = 3

2kφ kv umax
dt = kφ u (kφ ≈ 4.5)
46 tf = 4T 47
Example: Time-Optimal Control of Ball on Beam Example: Time-Optimal Control of Ball on Beam

Solving
dφm
dt = kφ uff
Assume umax = 1, z0 = 0, and zf = 5 ⇒ tf = 1.538
gives the optimal beam angle trajectory
Optimal control signal: 

 −kφ u0 t, 0≤t<T


2
φm (t) = −kφ u0 (t−2T ), T ≤ t < 3T


1 
−k u (t−4T ),
φ 0 3T ≤ t ≤ 4T
uff

0
2

−1
1

−2
0 0.5 1 1.5

φm
t 0

(“bang-bang” control) −1

−2
0 0.5 1 1.5
48 t 49

Example: Time-Optimal Control of Ball on Beam Example: Time-Optimal Control of Ball on Beam

Solving Finally, solving


dvm dzm
dt = −kv φm dt = vm
gives the optimal ball velocity trajectory gives the optimal ball position trajectory
 


 −kφ kv u0 t2 /2, 0≤t<T 

 z0 + kφ kv u0 t3 /6, 0≤t<T
 
vm (t) = −kφ kv u0 (t2 /2−2T t+T 2), T ≤ t < 3T zm (t) = z0 − kφ kv u0 (t3 /6−T t2 +T 2t−T 3 /3), T ≤ t < 3T

 


−k k u (t2 /2−4T t+8T 2), 
z + k k u (t3 /6−2T t2 +8T 2t−26T 3/3),
φ v 0 3T ≤ t ≤ 4T 0 φ v 0 3T ≤ t ≤ 4T

7 5
6
4
5
4 3
vm

zm

3 2
2
1
1
0 0

0 0.5 1 1.5 0 0.5 1 1.5


t t
50 51

Using the Time-Optimal Feedforward Generator in a Cascade Lectures 9 and 10: Summary
Control Structure

• Regulator problem – reduce impact of load disturbances and


measurement noise
• Feedforward from measurable disturbances
uff
• Input–output approach: design of feedback controller Hfb (z), e.g.
uc Model and φm PID controller
feedforward
• State space approach: design of state feedback and observer,
generator zm φ z
Σ PID Σ P Σ Gφ Gy including disturbance estimator
• Servo problem – make the output follow the setpoint in the desired
−1
way
• Input–output approach: design of reference model Hm (z) and
−1 feedforward filter Hff (z)
• State space approach: design of combined reference and feedforward
generator
• The PID controller should have derivative weighting γ = 1 • Linear or nonlinear reference generation

52 53

You might also like