determination of pid controller parameters from step

9
Determination of PID controller parameters from step response specifications Nasser M. Abbasi June 30, 2015 Compiled on May 24, 2020 at 2:04am This note describes how to design a PID controller for a system defined by second order dierential equation based on requirements for a step response specified by the rise time and the settling time. The goal is to determine the three PID parameters ( , , ) from the plant transfer function and , (rise time and settling time). Consider the following mechanical system M b k ut Mechanical system to control yt Figure 1: mechanical system is the mass of the car, is the damping coecient and is the spring constant. To 1

Upload: others

Post on 11-Jan-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Determination of PID controller parameters from step

Determination of PID controller parameters fromstep response specifications

Nasser M. Abbasi

June 30, 2015 Compiled on May 24, 2020 at 2:04am

This note describes how to design a PID controller for a system defined by second orderdiοΏ½erential equation based on requirements for a step response specified by the rise timeand the settling time.

The goal is to determine the three PID parameters (𝐾𝑖, 𝐾𝑑, 𝐾𝑝) from the plant transfer functionand π‘‘π‘Ÿ, 𝑑𝑠 (rise time and settling time).

Consider the following mechanical system

M

b

k

ut

Mechanical system to control

yt

Figure 1: mechanical system

𝑀 is the mass of the car, 𝑏 is the damping coeοΏ½cient and π‘˜ is the spring constant. To

1

Page 2: Determination of PID controller parameters from step

2

illustrate, assuming standard SI units:

𝑀 = 1 π‘˜π‘”π‘ = 10 𝑁𝑠/π‘šπ‘˜ = 20 𝑁/π‘š

The first step is to derive the mathematical model for the system. This means finding adiοΏ½erential equation that relates the output (the displacment 𝑦(𝑑)) to the input, which is theapplied force 𝑒(𝑑).The fFriction force between the mass M and the ground is ignored in thisexample.

The first step is to make a free body diagram

M ut

Free body diagram

yt

k yt

b y t

Figure 2: Free body diagram

Applying Netwon laws gives

𝐹 = π‘šπ‘Žπ‘’(𝑑) βˆ’ 𝑏𝑦′(𝑑) βˆ’ π‘˜π‘¦(𝑑) = 𝑀𝑦′′(𝑑)

or𝑀𝑦′′(𝑑) + 𝑏𝑦′(𝑑) + π‘˜π‘¦(𝑑) = 𝑒(𝑑)

Taking Laplace transform and assuming zero initial conditions gives

𝑀𝑠2π‘Œ(𝑠) + π‘π‘ π‘Œ(𝑠) + π‘˜π‘Œ(𝑠) = π‘ˆ(𝑠)

The transfer function is defined as the ratio of the output to the input in the Laplacedomain. Here the input is 𝑒(𝑑), which is the external force, and the output is 𝑦(𝑑) which is

Page 3: Determination of PID controller parameters from step

3

the displacement. Taking the Laplace transform of the above diοΏ½erential equation gives thetransfer function

𝑠𝑦𝑠(𝑠) =π‘Œ(𝑠)π‘ˆ(𝑠)

=1

𝑀𝑠2 + 𝑏𝑠 + π‘˜Using block diagram the transfer function is illustrated as

YsUs1

Ms2bsk

System differential equation as a transfer function

Figure 3: Transfer function

The PID controller is now added. The transfer function of the PID controller itself is

𝐾𝑝 + 𝐾𝑑𝑠 +𝐾𝑖𝑠

The controller is added to the system and the loop is closed. The following diagram repre-sents the updated system with the controller in place

YsUs 1

Ms2bsk

System Block diagram with a PID controller

+

-

Es NsKp Kds

K i

s

Figure 4: With PID

Let 𝐿(𝑠) be the open loop transfer function

𝐿(𝑠) =𝐾𝑝 + 𝐾𝑑𝑠 +

𝐾𝑖𝑠

𝑀𝑠2 + 𝑏𝑠 + π‘˜=

𝐾𝑝𝑠 + 𝐾𝑑𝑠2 + 𝐾𝑖

𝑀𝑠3 + 𝑏𝑠2 + π‘˜π‘ 

Page 4: Determination of PID controller parameters from step

4

Hence the closed loop transfer function is

𝐺 (𝑠) =𝐿 (𝑠)

1 + 𝐿 (𝑠)=

𝐾𝑝𝑠 + 𝐾𝑑𝑠2 + 𝐾𝑖

𝑀𝑠3 + 𝑏𝑠2 + π‘˜π‘  + 𝐾𝑝𝑠 + 𝐾𝑑𝑠2 + 𝐾𝑖

Therefore

𝐺 (𝑠) =1𝑀�𝐾𝑑𝑠2 + 𝐾𝑝𝑠 + 𝐾𝑖�

𝑠3 + 𝑠2 οΏ½ 𝑏+𝐾𝑑𝑀� + 𝑠 οΏ½

π‘˜+𝐾𝑝𝑀

οΏ½ + 𝐾𝑖𝑀

(1)

YsUs +

-

Es

YsUs

Open loop transfer function using PID controller

a1Kds2KpsK i

s3a2s2a3s

a1Kds2KpsK i

s3s2a2a1Kdsa3a1Kpa1K i

Figure 5: Open loop

The closed loop transfer function (1) shows there are three poles.

Putting one pole at a distance of 5πœπœ”π‘› away from the imaginary axis, while the remainingtwo poles are the dominant poles results in the following diagram

Page 5: Determination of PID controller parameters from step

5

n

n 1 2

n

jd

pole placement

5n

Figure 6: Pole placement

The denominator of equation (1) can be rewritten as

𝑠3 + 𝑠2 �𝑏 + 𝐾𝑑𝑀 οΏ½ + 𝑠 οΏ½

π‘˜ + 𝐾𝑝

𝑀 οΏ½ +𝐾𝑖𝑀

≑ (𝑠 + 5πœπœ”π‘›) �𝑠2 + 2πœπœ”π‘›π‘  + πœ”2𝑛�

≑ 𝑠3 + 2πœπœ”π‘›π‘ 2 + π‘ πœ”2𝑛 + 5πœπœ”π‘›π‘ 2 + 10𝜁2πœ”2

𝑛𝑠 + 5πœπœ”3𝑛

≑ 𝑠3 + 𝑠2 (7πœπœ”π‘›) + 𝑠 οΏ½10𝜁2πœ”2𝑛 + πœ”2

𝑛� + 5πœπœ”3𝑛

Equating coeοΏ½cients gives

𝑏 + 𝐾𝑑𝑀

= 7πœπœ”π‘›

π‘˜ + 𝐾𝑝

𝑀= 10𝜁2πœ”2

𝑛 + πœ”2𝑛

𝐾𝑖𝑀

= 5πœπœ”3𝑛

Solving for PID parameters results in

𝐾𝑑 = 7π‘€πœπœ”π‘› βˆ’ 𝑏 (2)

𝐾𝑝 = 𝑀�10𝜁2πœ”2𝑛 + πœ”2

𝑛� βˆ’ π‘˜πΎπ‘– = 5π‘€πœπœ”3

𝑛

Page 6: Determination of PID controller parameters from step

6

These are the PID parameters as a function of πœ”π‘› and 𝜁.

πœ”π‘› and 𝜁 are determined in order to obtain the PID parameters.

The time response specifications are now introduced in order to determine these parameters.Assuming these are the time domain requirments

1. The settling time 𝑑𝑠 = 2 sec

2. The rise time π‘‘π‘Ÿ = 0.1 sec

Using the following for 2% criterion

𝑑𝑠 =4

πœπœ”π‘›(3)

And the rise time is given by

π‘‘π‘Ÿ =πœ‹ βˆ’ π›½πœ”π‘‘

Page 7: Determination of PID controller parameters from step

7

n

n 1 2

n

jd

s jd

sin

Dominant pole parameters

Figure 7: Dominant pole prameters

But 𝛽 = arctan οΏ½πœ”π‘›οΏ½1βˆ’πœ2

πœπœ”π‘›οΏ½, hence

π‘‘π‘Ÿ =πœ‹ βˆ’ arctan οΏ½οΏ½

1βˆ’πœ2

𝜁 �

πœ”π‘›βˆš1 βˆ’ 𝜁2(4)

From (3) and (4) πœ”π‘›, 𝜁 are solved for

2 =4

πœπœ”π‘›

0.1 =πœ‹ βˆ’ arctan οΏ½οΏ½

1βˆ’πœ2

𝜁 �

πœ”π‘›βˆš1 βˆ’ 𝜁2

Solving numerically gives

Page 8: Determination of PID controller parameters from step

8

restart;

> eq1:= 2 = 4 / (zeta*omega);

> k:= sqrt(1-zeta^2);

> eq2:= 0.1 = (Pi-arctan( k/zeta )) / (omega*k);

> fsolve({eq1,eq2});

:= eq1 24

:= k 1 2

:= eq2 0.1

arctan

1 2

1 2

{ }, 17.00484998 0.1176135045

Solution using Maple

Figure 8: Solution

Hence the solution is𝜁 = 0.1176

andπœ”π‘› = 17 rad/sec

Substituting the values for πœ”π‘› and 𝜁 in (2), and the values given for 𝑀, 𝑏 and π‘˜, gives thePID parameters

𝐾𝑑 = 7(1)(0.1176)(17) βˆ’ 10= 3.9944

𝐾𝑝 = 1(10(0.11762)(172) + (17)2) βˆ’ 20= 308.97

𝐾𝑖 = 5(1)(0.1176)(17)3

= 2888.8

Using Matlab, the step response is found

Page 9: Determination of PID controller parameters from step

9

clear all; close all;

s=tf('s');

M=1;

b=10;

k=20;

gama=17;

zeta=0.1176;

Kd=(M*7*zeta*gama)-b

Kp=M*(gama^2+10*zeta^2*gama^2)-k

Ki=5*zeta*gama^3*M

sys=(Kd*s^2+Kp*s+Ki)/(M*s^3+s^2*(b+Kd)+s*(k+Kp)+Ki);

t=[0:0.01:2];

step(sys,t);

hold on;

line([0 2],[1 1],'Color','r');

%Ylim([0 1.2]);

legend('y(t)','u(t)');

title('step response. PID controller')

Step response using PID controller

Figure 9: Step solution using Matlab