0% found this document useful (0 votes)
22 views12 pages

Lab 04 Experiment

Uploaded by

emreakman1920
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views12 pages

Lab 04 Experiment

Uploaded by

emreakman1920
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

LAB-2 EXPERIMENT

Please follow the instructions in the document and upload your pdf-files to the “uzak system”

Please name your pdf files as in the given example file:

NameSurnameLab1PreliminaryELE301LGuz23.pdf

NameSurnameNameSurnameLab1ExperimentELE301LGuz23.pdf

THE DEADLINE: One week after the class, 16:30 pm.

Important rules
The report format must be as the one that shared to you. If not point deduction will be
applied.
Contents
Problem 1 .................................................................................................................................................... 3
Task-1 ....................................................................................................................................................... 3
SOLUTION: ............................................................................................................................................ 3
Task-2 ....................................................................................................................................................... 5
SOLUTION ............................................................................................................................................. 5
Task-3 ....................................................................................................................................................... 6
SOLUTION ............................................................................................................................................. 6
Task-4 ....................................................................................................................................................... 7
SOLUTION ............................................................................................................................................. 7
Task-5 ....................................................................................................................................................... 8
SOLUTION ............................................................................................................................................. 8
Problem 2 .................................................................................................................................................. 11
Task-1 ..................................................................................................................................................... 11
Task-2 ..................................................................................................................................................... 11
Task-3 ..................................................................................................................................................... 11
Task-4 ..................................................................................................................................................... 12
Task-5 ..................................................................................................................................................... 12
Important Rules ........................................................................................................................................ 13
Problem 1
This is a demo-problem. Try to understand this problem and then solve the other problems after
that.

Task-1
For a given Plant transfer-function 𝑃(𝑠),
(𝑠 − 𝑝3 )
𝑃(𝑠) = , 𝑝 = 1, 𝑝2 = 1, 𝑝3 = 1
𝑠2 + 𝑝1 𝑠 − 𝑝2 1

Closed-loop control system block diagram

General block diagram

𝑃𝑎𝑢𝑔 (𝑠) system block diagram


Find 𝑃𝑎𝑢𝑔 (𝑠) transfer-function.

SOLUTION:
To find 𝑃𝑎𝑢𝑔 (𝑠) system, the following matlab script is used.

Matlab code Code output


clear all,close all,clc;
%% define the parameters
p1=1; p2=1; p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% constructing the P-AUG(augmented)
Plant.u='u';
Plant.y='y';

Summer_1=sumblk('e=r-y');

P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'})
zpk(P_aug)
From this one can obtain that the 𝑃𝑎𝑢𝑔 (𝑠) system is
−(𝑠 − 1)
1
(𝑠 + 1.618)(𝑠 − 0.618)
𝑃𝑎𝑢𝑔 (𝑠) = 0 1
−(𝑠 − 1)
1
[ (𝑠 + 1.618)(𝑠 − 0.618)]
𝑒
𝑤=𝑟 𝑧=[ ]
Notice the relation between the [ ] and [ 𝑢 ]
𝑢=𝑢
𝑦= [𝑒]

And

−(𝑠 − 1)
1
𝑤=𝑟 (𝑠 + 1.618)(𝑠 − 0.618) 𝑧 = [ 𝑒 ]
[ ]= 0 1 [ 𝑢 ]
𝑢=𝑢
−(𝑠 − 1) 𝑦 = [𝑒]
1
[ (𝑠 + 1.618)(𝑠 − 0.618)]

Where,

Signal Signal name


𝑤 Exogenous input
𝑢 Control input
𝑧 Regulated output
𝑦 Measured output
The description of the signals

Signal Signal Description


name
𝑤 Exogenous The signals the disturb the operation. For example, reference signal can be
considered as a disturbance because it is an external signal that is not generated
input
by the CONTROLLER.
𝑢 Control The signal that is generated by the CONTROLLER.
input
𝑧 Regulated The output of the augmented system. These are the signals that are required to
be minimized. For example, error signal is required to be minimized. In
output
addition to that input signal to the PLANT is also desired to be minimized
because if we can achieve the same objective with less input-energy we should
choose the less-input-energy consuming design.
Let us say there are 2 control designs for a motor speed control application. The
1st controller requires +30V (as highest control signal) and the 2 nd controller
required +15V (as highest control signal), in this case the 2 nd controller is better.
𝑦 Measured These are the signals that CONTROLLER uses to generate the control-signal.
It can also be considered as the input signals to the CONTROLLER.
output
Task-2
Design an hinf controller. (hinf = h-infinity = ℋ∞ controller)

SOLUTION
The necessary matlab code to obtain the ℋ∞ controller is given as,

Matlab code Code output


clear all,close all,clc;
%% define the parameters
p1=1;
p2=1;
p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% constructing the P-AUG(augmented)
Plant.u='u';
Plant.y='y';

Summer_1=sumblk('e=r-y');

P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)
%%
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
tf(K)
zpk(K)
As a result of this code-output, the CONTROLLER is obtained as,

−787.86(𝑠 + 1.618)
𝐾(𝑠) =
(𝑠 + 13.98)(𝑠 + 77.79)
Task-3
Find the 𝑇𝑧𝑤 (𝑠) transfer-function for the 𝐾(𝑠) (controller transfer function) that you obtained in
the previous task.

𝑇𝑧𝑤 (𝑠) is the transfer-function of the system between disturbance-inputs (w) to regulated-
outputs (z). 𝑇𝑧𝑤 (𝑠) expression is dependent on 𝐾(𝑠) and 𝑃𝑎𝑢𝑔 (𝑠) transfer-functions.

SOLUTION
To find 𝑇𝑧𝑤 (𝑠) we can directly use MATLAB. The following matlab code is used to find 𝑇𝑧𝑤 (𝑠).

Matlab code Code output


clear all,close all,clc;
%% define the parameters
p1=1;
p2=1;
p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% Find P-AUG(augmented)
Plant.u='u';
Plant.y='y';

Summer_1=sumblk('e=r-y');

P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)

P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))

As a result of this code-output, 𝑇𝑧𝑤 (𝑠) is obtained as,

(𝑠 + 77.79)(𝑠 + 13.98)(𝑠 − 0.618)


(𝑠 + 88.42)(𝑠 + 2.116)(𝑠 + 0.618)
𝑇𝑧𝑤 (𝑠) =
−787.86(𝑠 − 0.618)(𝑠 + 1.618)
(𝑠
[ + 88.42)(𝑠 + 2.116)(𝑠 + 0.618) ]

Since there is 1 disturbance-input and 2 regulated-outputs, 𝑇𝑧𝑤 (𝑠) is a 2x1 transfer-function.


Task-4
Find the gamma. GAMMA is the GAIN from disturbance-signals (w) to the regulated-outputs
(z). We want this GAIN to be minimized. If we can minimize this GAIN, we can say that we
have a controller that is robust to the disturbance signals.

𝛾 = min‖𝑇𝑧𝑤 (𝑠)‖ℋ∞
𝐾(𝑠)

Where, 𝑇𝑧𝑤 (𝑠) is the transfer function from disturbance-signals (w) to regulated-output (z). 𝛾
value is the “norm” of this transfer-function. If we can minimize 𝛾, that means we minimize the
norm of the transfer-function between disturbance signals to regulated-outputs. In other words,
if we can minimize 𝛾, we can minimize the effect of disturbance-inputs to the regulated-outputs.

SOLUTION
To find GAMMA we can directly use MATLAB. The following matlab code is used to find
GAMMA.

Matlab code Code output


clear all,close all,clc;
%% define the parameters
p1=1;
p2=1;
p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% Find P-AUG(augmented)
Plant.u='u';
Plant.y='y';

Summer_1=sumblk('e=r-y');

P_aug =
connect(Plant,Summer_1,{'r','u'},{'e','u','e'})
;
zpk(P_aug)

P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))
%% Find GAMMA
% [ninf,fpeak] = hinfnorm(sys,tol)
[GAMMA,fpeak] = hinfnorm(Tzw,1e-3)
As a result of the code-output, the GAMMA value is obtained as

𝛾 = 8.9950
Task-5
Test this controller for the parameter uncertainty case where the parameters take values
between given lower and upper limits. Find the corresponding GAMMA value for each
parameter combination and determine the worst (greatest) GAMMA value.

𝑝1 𝑛𝑜𝑚 = 1 𝑝2 𝑛𝑜𝑚 = 1 𝑝3 𝑛𝑜𝑚 = 1


𝑝1 ∈ [𝑝1 𝑛𝑜𝑚 − 0.01, 𝑝1 𝑛𝑜𝑚 + 0.01] 𝑝2 ∈ [𝑝2 𝑛𝑜𝑚 − 0.01, 𝑝2 𝑛𝑜𝑚 + 0.01] 𝑝3 ∈ [𝑝3 𝑛𝑜𝑚 − 0.01, 𝑝3 𝑛𝑜𝑚 + 0.01]

SOLUTION
For this problem, let us discretize the parameter range for each parameter and find GAMMA
values for each parameter combinations. For this the given Algorithm is used.

Algorithm to solve task-5


𝑝1 𝑣𝑒𝑐 = 𝑙𝑖𝑛𝑠𝑝𝑎𝑐𝑒( 𝑝1 𝑛𝑜𝑚 − 0.01 , 𝑝1 𝑛𝑜𝑚 + 0.01 , 10)
𝑝2 𝑣𝑒𝑐 = 𝑙𝑖𝑛𝑠𝑝𝑎𝑐𝑒( 𝑝2 𝑛𝑜𝑚 − 0.01 , 𝑝2 𝑛𝑜𝑚 + 0.01 , 10)
𝑝3 𝑣𝑒𝑐 = 𝑙𝑖𝑛𝑠𝑝𝑎𝑐𝑒 ( 𝑝3 𝑛𝑜𝑚 − 0.01 , 𝑝3 𝑛𝑜𝑚 + 0.01 , 10)
𝛾𝑚𝑎𝑥 = −100
For 𝑝1 𝑡𝑒𝑚𝑝 ∈ 𝑝1 𝑣𝑒𝑐
For 𝑝2 𝑡𝑒𝑚𝑝 ∈ 𝑝2 𝑣𝑒𝑐
For 𝑝3 𝑡𝑒𝑚𝑝 ∈ 𝑝3 𝑣𝑒𝑐
(𝑠−𝑝3 𝑡𝑒𝑚𝑝 )
compute 𝑃𝑡𝑒𝑚𝑝 (𝑠) =
𝑠2 +𝑝1 𝑡𝑒𝑚𝑝 𝑠−𝑝2 𝑡𝑒𝑚𝑝

compute 𝑃𝑎𝑢𝑔 (𝑠)


𝑡𝑒𝑚𝑝

compute 𝑇𝑧𝑤 𝑡𝑒𝑚𝑝 (𝑠)

compute 𝛾𝑡𝑒𝑚𝑝 = ‖𝑇𝑧𝑤 𝑡𝑒𝑚𝑝 (𝑠)‖


ℋ∞

compute 𝛾𝑚𝑎𝑥 = max{𝛾𝑚𝑎𝑥 , 𝛾𝑡𝑒𝑚𝑝 }


End
End
End

Display 𝛾𝑚𝑎𝑥
The necessary matlab code to solve this problem is the following,

Matlab code
clear all,close all,clc;
%% define the parameters
p1=1;
p2=1;
p3=1;
%% define the PLANT
Plant=tf([1,-p3],[1,p1,-p2]);
%% Find P-AUG(augmented)
Plant.u='u';
Plant.y='y';

Summer_1=sumblk('e=r-y');

P_aug = connect(Plant,Summer_1,{'r','u'},{'e','u','e'});
zpk(P_aug)

P_aug.u={'w','u'}
P_aug.y={'z1','z2','y'}
%% Find K(s)
% P_aug=[1,-Plant;0,1;1,-Plant];
% [K,CL,gamma] = hinfsyn(P,nmeas,ncont)
[K,CL,gamma] = hinfsyn(P_aug,1,1);
K.u='y';
K.y='u';
% tf(K)
% zpk(K)
zpk(minreal(CL))
% sigma(CL)
%% Find Tzw(s)
Tzw=connect(P_aug,K,{'w'},{'z1','z2'})
zpk(Tzw)
zpk(minreal(Tzw))
%% Find GAMMA
% [ninf,fpeak] = hinfnorm(sys,tol)
[GAMMA,fpeak] = hinfnorm(Tzw,1e-3)
%%

% p_range=[p_min,p_max]
p1_range=[p1-0.01,p1+0.01]
p2_range=[p2-0.01,p2+0.01]
p3_range=[p3-0.01,p3+0.01]
p1_vec=linspace(p1_range(1),p1_range(2),10);
p2_vec=linspace(p2_range(1),p2_range(2),10);
p3_vec=linspace(p3_range(1),p3_range(2),10);

max_Tzw_norm=0;
for i_1=1:1:length(p1_vec)
for i_2=1:1:length(p2_vec)
for i_3=1:1:length(p3_vec)
p1_temp=p1_vec(i_1);
p2_temp=p2_vec(i_2);
p3_temp=p3_vec(i_3);
% construct PLANT_temp
Plant_temp=tf([1,-p3_temp],[1,p1_temp,-p2_temp]);
% construct PAUG_temp
Plant_temp.u='u';
Plant_temp.y='y';
Summer_1=sumblk('e=r-y');
P_aug_temp = connect(Plant_temp,Summer_1,{'r','u'},{'e','u','e'});

P_aug_temp.u={'w','u'};
P_aug_temp.y={'z1','z2','y'};
% P_aug_temp=[1,-Plant_temp;0,1;1,-Plant_temp];
% construct Tzw_temp
Tzw_temp=connect(P_aug_temp,K,{'w'},{'z1','z2'});
% Tzw_temp=lft(P_aug_temp,K,1,1);
% compute "norm of Tzw_temp"
Tzw_norm_temp=hinfnorm(Tzw_temp);
if Tzw_norm_temp>max_Tzw_norm
disp([p1_temp,p2_temp,p3_temp,Tzw_norm_temp]);
if max_Tzw_norm==Inf
return;
end
end
max_Tzw_norm=max([max_Tzw_norm,Tzw_norm_temp]);
end
end
end
max_Tzw_norm
And the result is,

And the code output is given in the right.


As a result of the matlab code-output,
𝛾𝑚𝑎𝑥 = 10.3514
Is obtained.

CONCLUSION:
For the “nominal plant”, we designed a
controller 𝐾(𝑠), and this controller resulted in
𝛾𝑛𝑜𝑚𝑖𝑛𝑎𝑙 = 8.9950 . however for the case
where the parameter take values from their
corresponding range meaning that have
upper and lower bounds, The same controller
𝐾(𝑠) resulted in 𝛾𝑚𝑎𝑥 = 10.3514 .
For each parameter combination we have
calculated the corresponding GAMMA value
and the worst-case is determined as
𝛾𝑚𝑎𝑥 = 10.3514
Problem 2
Task-1
For the given plant transfer-function 𝑃(𝑠),
(𝑠 + 𝑝3 )
𝑃(𝑠) = , 𝑝 = 1, 𝑝2 = 1, 𝑝3 = 1
𝑠2 + 𝑝1 𝑠 + 𝑝2 1

Closed-loop control system block diagram

General block diagram

𝑃𝑎𝑢𝑔 (𝑠) system block diagram


Find 𝑃𝑎𝑢𝑔 (𝑠).

Task-2
Design an hinf controller. (hinf = h-infinity = ℋ∞ controller). Find 𝐾(𝑠) transfer-function.

Task-3
Find the 𝑇𝑧𝑤 (𝑠) transfer-function for the 𝐾(𝑠) (controller transfer function) that you obtained in
the previous task.

𝑇𝑧𝑤 (𝑠) is the transfer-function of the system between disturbance-inputs (w) to regulated-
outputs (z). 𝑇𝑧𝑤 (𝑠) expression is dependent on 𝐾(𝑠) and 𝑃𝑎𝑢𝑔 (𝑠) transfer-functions.
Task-4
Find GAMMA 𝛾. GAMMA value is the hinf-norm of the transfer-function 𝑇𝑧𝑤 (𝑠).

In other words,

𝛾 = ‖𝑇𝑧𝑤 (𝑠)‖ℋ∞

Task-5
Test this controller for the parameter uncertainty case where the parameters take values
between given lower and upper limits. Find the corresponding GAMMA value for each
parameter combination and determine the worst (greatest) GAMMA value.

𝑝1 𝑛𝑜𝑚 = 1 𝑝2 𝑛𝑜𝑚 = 1 𝑝3 𝑛𝑜𝑚 = 1


𝑝1 ∈ [𝑝1 𝑛𝑜𝑚 − 0.01, 𝑝1 𝑛𝑜𝑚 + 0.01] 𝑝2 ∈ [𝑝2 𝑛𝑜𝑚 − 0.01, 𝑝2 𝑛𝑜𝑚 + 0.01] 𝑝3 ∈ [𝑝3 𝑛𝑜𝑚 − 0.01, 𝑝3 𝑛𝑜𝑚 + 0.01]

You might also like