Top Banner
Discrete Controller Design Thanh Vo-Duy Department of Industrial Automation [email protected]
33

Discrete Controller Design

Jul 14, 2016

Download

Documents

Nguyen Ngoc

Thiết kế DIP số
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Discrete Controller Design

Discrete Controller Design

Thanh Vo-Duy

Department of Industrial Automation

[email protected]

Page 2: Discrete Controller Design

Content

• Digital Controllers • Dead-Beat Controller

• Dahlin Controller

• Microcontroller Implementation

• PID Controller

• Exercises

Page 3: Discrete Controller Design

Prior to Lecture

Discrete-time System with analog reference input

Discrete-time System with digital reference input

Page 4: Discrete Controller Design

Digital Controllers

• Consider the Discrete-time System as

• 𝑅 𝑧 - Reference Input

• 𝐸 𝑧 - Error signal

• 𝑈 𝑧 - Output of the Controller

• 𝑌 𝑧 - Output of the System

• 𝐻𝐺 𝑧 - Digitized plant with Zero-order hold

Page 5: Discrete Controller Design

Digital Controllers

• The close-loop transfer function of the system 𝑌 𝑧

𝑅 𝑧=𝐷 𝑧 𝐻𝐺 𝑧

1 + 𝐷 𝑧 𝐻𝐺 𝑧

• Desired transfer function

𝑇 𝑧 =𝑌 𝑧

𝑅 𝑧

• So, required controller

𝐷 𝑧 =1

𝐻𝐺 𝑧

𝑇 𝑧

1 − 𝑇 𝑧

Page 6: Discrete Controller Design

Digital Controllers Dead-Beat Controller

• Dead-Beat Controller: brings system to steady state in the smallest number of time steps

𝑇 𝑧 = 𝑧−𝑘 where 𝑘 ≥ 1

• Digital Controller transfer function

→ 𝐷 𝑧 =1

𝐻𝐺 𝑧

𝑇 𝑧

1 − 𝑇 𝑧=1

𝐻𝐺 𝑧

𝑧−𝑘

1 − 𝑧−𝑘 (1)

Page 7: Discrete Controller Design

Digital Controllers Dead-Beat Controller

• Example:

Design the Dead-Beat Controller for the system given by

𝐺 𝑠 =𝑒−2𝑠

1 + 10𝑠

Assume that T = 1s

Page 8: Discrete Controller Design

Digital Controllers Dead-Beat Controller

• Solution:

The transfer function of the system with ZOH:

𝐻𝐺 𝑧 = 𝑍1 − 𝑒−𝑠𝑇

𝑠𝐺(𝑠) = 𝑍

1 − 𝑒−𝑠𝑇

𝑠.𝑒−𝑠𝑇

1 + 10𝑠

since T = 1s

→ 𝐻𝐺 𝑧 =0.095𝑧−3

1 − 0.904𝑧−1

From (1):

→ 𝐷 𝑧 =1

𝐻𝐺 𝑧

𝑧−𝑘

1 − 𝑧−𝑘=1 − 0.904𝑧−1

0.095𝑧−3𝑧−𝑘

1 − 𝑧−𝑘

Page 9: Discrete Controller Design

Digital Controllers Dead-Beat Controller

• Solution (cont.)

It can be chosen that 𝑘 ≥ 3. So, choose 𝑘 = 3

→ 𝐷 𝑧 =1 − 0.904𝑧−1

0.095𝑧−3𝑧−3

1 − 𝑧−3

The controller’s transfer function:

𝐷 𝑧 =𝑧3 − 0.904𝑧2

0.095 𝑧3 − 1

Page 10: Discrete Controller Design

Digital Controllers Dead-Beat Controller

• Solution (cont.)

Step response of the system Control signal

Page 11: Discrete Controller Design

Digital Controllers Dahlin Controller

• Dahlin Controller: produces an exponential response → smoother than Dead-Beat.

• Response of the system:

𝑌 𝑠 =1

𝑠

𝑒−𝑎𝑠

1 + 𝑠𝑞

If 𝑎 = 𝑘𝑇

→ 𝑌 𝑧 =𝑧−𝑘−1 1 − 𝑒

−𝑇𝑞

1 − 𝑧−1 1 − 𝑒−𝑇𝑞𝑧−1

Page 12: Discrete Controller Design

Digital Controllers Dahlin Controller

• Closed-loop transfer function (unit step input):

𝑇 𝑧 =𝑌 𝑧

𝑅 𝑧=𝑧−𝑘−1 1 − 𝑒

−𝑇𝑞

1 − 𝑧−1 1 − 𝑒−𝑇𝑞𝑧−1

1 − 𝑧−1

1

→ 𝑇 𝑧 =𝑧−𝑘−1 1 − 𝑒

−𝑇𝑞

1 − 𝑒−𝑇𝑞𝑧−1

• Transfer function of required controller

𝐷 𝑧 =1

𝐻𝐺 𝑧

𝑧−𝑘−1 1 − 𝑒−𝑇𝑞

1 − 𝑒−𝑇𝑞𝑧−1 − 1 − 𝑒

−𝑇𝑞 𝑧−𝑘−1

Page 13: Discrete Controller Design

Digital Controllers Dahlin Controller

• Example:

The open-loop transfer function of a plant:

𝐺 𝑠 =𝑒−2𝑠

1 + 10𝑠

assume that T = 1s

Design a Dahlin digital controller for the system

(let’s choose 𝑞 = 10

note: 𝑒−0.1 = 0.904)

Page 14: Discrete Controller Design

Digital Controllers Dahlin Controller

• Solution

𝐻𝐺 𝑧 =0.095𝑧−3

1 − 0.904𝑧−1

Choose 𝑞 = 10

→ 𝐷 𝑧 =1

𝐻𝐺 𝑧

𝑇 𝑧

1 − 𝑇 𝑧

𝐷 𝑧 =1 − 0.904𝑧−1

0.095𝑧−3.

𝑧−𝑘−1 1 − 𝑒−0.1

1 − 𝑒−0.1𝑧−1 − 1 − 𝑒−0.1 𝑧−𝑘−1

Page 15: Discrete Controller Design

Digital Controllers Dahlin Controller

• Solution (cont.)

𝐷 𝑧 =1 − 0.904𝑧−1

0.095𝑧−3.

0.095𝑧−𝑘−1

1 − 0.904𝑧−1 − 0.095𝑧−𝑘−1

Choose 𝑘 = 2, so

𝐷 𝑧 =0.095𝑧3 − 0.0858𝑧2

0.095𝑧3 − 0.0858𝑧2 − 0.009

Page 16: Discrete Controller Design

Digital Controllers Dahlin Controller

• Solution (cont.)

Page 17: Discrete Controller Design

Digital Controllers Microcontroller Implementation

• Implement Dead-Beat Controller in the Example

𝐷 𝑧 =𝑧3 − 0.904𝑧2

0.095 𝑧3 − 1

• Use Time Shifting property of z-Transform 𝑍 𝑓 𝑛𝑇 +𝑚𝑇 = 𝑧𝑚𝐹 𝑧 𝑍 𝑓 𝑛𝑇 −𝑚𝑇 = 𝑧−𝑚𝐹(𝑧)

• Build computer equation for Controller’s transfer function

• Implement the equation on specified MCU

Page 18: Discrete Controller Design

Digital Controllers Microcontroller Implementation

1. Build computer equation:

𝐷 𝑧 =𝑈 𝑧

𝐸 𝑧

→ 𝑢 𝑘 =𝑒 𝑘 − 0.904𝑒 𝑘 − 1 + 0.095𝑢 𝑘 − 3

0.095

Page 19: Discrete Controller Design

Digital Controllers Microcontroller Implementation

2. Implement on MCU

Start

Initialization uk=uk_1=uk_2=uk_3=0;

ek=ek_1=0; rk=yk=0;

Measure instant values rk,yk

Calculate error ek = rk – yk;

Calculate control value uk=(ek-0.904ek_1+0.095uk_3)/0.095;

Send uk to ZoH (PWM…)

Stop?

End

Update value uk_3=uk_2;uk_2=uk_1;uk_1=uk;

ek_1=ek;

1 2

1 2

Yes

No

Page 20: Discrete Controller Design

Digital Controllers Microcontroller Implementation

• Do the same work with Dahlin Controller

𝐷 𝑧 =0.095𝑧3 − 0.0858𝑧2

0.095𝑧3 − 0.0858𝑧2 − 0.009

Page 21: Discrete Controller Design

Digital Controllers PID Controller

• PID – Proportional – Integral – Derivative controller

• Proportional - 𝐾𝑝 (or 𝑃): error is multiplied by 𝐾𝑝 • High 𝐾𝑝 causes instability, Low gain causes drifting away

• Integral - 𝐾𝑖 (or 𝐼): integral of error and multiplied by 𝐾𝑖 • High 𝐾𝑖 causes oscillation, Low gain cause sluggish

response

• Derivative - 𝐾𝑑 (or 𝐷): derivative of error and multiplied by 𝐾𝑑 • High 𝐾𝑑 causes oscillation, Low gain cause sluggish

response

Page 22: Discrete Controller Design

Digital Controllers PID Controller

Page 23: Discrete Controller Design

Digital Controllers PID Controller

• Input – Output relationship of PID Controller

𝑢 𝑡 = 𝐾𝑝. [𝑒 𝑡 +1

𝑇𝑖 𝑒 𝑡 𝑑𝑡 + 𝑇𝑑 .

𝑑𝑒 𝑡

𝑑𝑡]

𝑡

0

where 𝑒 𝑡 = 𝑟 𝑡 − 𝑦(𝑡)

𝑇𝑖 and 𝑇𝑑: Integral and derivative action time

• Another form

𝑢 𝑡 = 𝐾𝑝𝑒 𝑡 + 𝐾𝑖 𝑒 𝑡 𝑑𝑡 + 𝐾𝑑 .𝑑𝑒 𝑡

𝑑𝑡

𝑡

0

+ 𝑢0 (2)

where 𝐾𝑖 =𝐾𝑝

𝑇𝑖 and 𝐾𝑑 = 𝐾𝑝𝑇𝑑

Page 24: Discrete Controller Design

Digital Controllers PID Controller

• Build computer equation – Positional PID Controller

Use approximation in (2) 𝑑𝑒 𝑡

𝑑𝑡≈𝑒[𝑘] − 𝑒[𝑘 − 1]

𝑇

𝑒 𝑡 𝑑𝑡 ≈ 𝑇𝑒[𝑘]

𝑛

𝑘=1

𝑡

0

→ 𝑢[𝑘] = 𝐾𝑝 𝑒 𝑘 + 𝑇𝑑𝑒 𝑘 − 𝑒 𝑘 − 1

𝑇+𝑇

𝑇𝑖 𝑒 𝑘

𝑛

𝑘=1

+ 𝑢0

Page 25: Discrete Controller Design

Digital Controllers PID Controller

• Build computer equation – Velocity PID Controller

Use z-Transform of (2) 𝑈 𝑧

𝐸 𝑧= 𝐾𝑝 1 +

𝑇

𝑇𝑖 1 − 𝑧−1+ 𝑇𝑑1 − 𝑧−1

𝑇

→ 𝑢 𝑘 = 𝑢 𝑘 − 1 + 𝐾𝑝 𝑒 𝑘 − 𝑒 𝑘 − 1 +𝐾𝑝𝑇

𝑇𝑖𝑒 𝑘

+𝐾𝑝𝑇𝑑𝑇𝑒 𝑘 − 2𝑒 𝑘 − 1 − 𝑒 𝑘 − 2

Page 26: Discrete Controller Design

Digital Controllers PID Controller

Note:

Positional PID and Velocity PID are similar

→ Prove yourself

Exercise: Build flow chart for 2 types of PID above

Page 27: Discrete Controller Design

Digital Controllers PID Controller

• Problems with PID controller • Saturation and Integral Wind-up

• Causes by physical constraints

• Results in long period overshoot

• Solution: fix the limits of integral, use velocity form of PID….

• Derivative kick • Causes by sharply change in setpoint

• Results in damage of system

Page 28: Discrete Controller Design

Digital Controllers PID Controller

• PID Tuning – Ziegler-Nichols tuning algorithm

A system can be approximated as:

𝐺 𝑠 =𝐾𝑒−𝑠𝑇𝐷

1 + 𝑠𝑇1

where

𝑇𝐷: System time delay

𝑇1: Time constant of system

Page 29: Discrete Controller Design

Digital Controllers PID Controller

• Open-loop Tuning

Controller 𝑲𝒑 𝑻𝒊 𝑻𝒅

Proportional 𝑇1𝐾𝑇𝐷

PI 0.9𝑇1𝐾𝑇𝐷

3.3𝑇𝐷

PID 1.2𝑇1𝐾𝑇𝐷

2𝑇𝐷 0.5𝑇𝐷

Page 30: Discrete Controller Design

Digital Controllers PID Controller

• Close-loop Tuning

1. Leave the controller only Proportional control

2. Carry out a step input of system

3. Increase/decrease controller gain until stable oscillation.

This gain is called 𝐾𝑢 (ultimate gain)

4. Read the period 𝑃𝑢

5. Calculate controller parameters:

PI: 𝐾𝑝 = 0.45𝐾𝑢 and 𝑇𝑖 = 𝑃𝑢/1.2

PID: 𝐾𝑝 = 0.6𝐾𝑢, 𝑇𝑖 = 𝑃𝑢/2, 𝑇𝑑 = 𝑃𝑢/8

Page 31: Discrete Controller Design

Exercises

1. Open-loop transfer function of a plant:

𝐺 𝑠 =𝑒−4𝑠

1 + 2𝑠

a. Design a dead-beat controller. Assume T=1s. Plot the system response in Matlab-Simulink

b. Design a Dahlin controller. Plot the system response in Matlab-Simulink.

c. Compare the results

Page 32: Discrete Controller Design

Exercises

2. Explain the difference between Positional and Velocity form of PID controller

3. The open-loop unit step response of a system is shown as figure below. Obtain the transfer function of the system and use Ziegler-Nicholes algorithm to design:

- A Proportional Controller

- A PI Controller

- A PID Controller

Page 33: Discrete Controller Design

Exercises

4. A mechanical process has the transfer function:

𝐺 𝑠 =𝐾𝑒−𝑠𝑇𝐷

𝑠

The system oscillates with a frequency of 0.05Hz when unity feedback is applied. Determine 𝑇𝐷.

5. The continuous-time PI Controller has transfer function:

𝑈 𝑠

𝐸 𝑠=𝐾𝑝𝑠 + 𝐾𝑖

𝑠

Derive the equivalent discrete-time controller transfer function and build computer equation.