How to design a robust PI controller based on the Sensitivity peak value
3 views (last 30 days)
Show older comments
% Parameters
f = 2000; %Hz
Tm = 1e-4;
Tr = 2.5e-5;
T1 = 0.0041;
T2 = 1.0024e-4;
Kr =1.56;
Kc = 16.3333;
Tc = 1.0024e-4;
K = T1/(2*Tr);
W = 2*pi*f;
Wn = sqrt((K+1)/(T1*Tr));
num_zeta = (T1+Tr)/(T1*Tr);
den_zeta = 2*(sqrt((K+1)/(T1*Tr)));
zeta = num_zeta/den_zeta;
% Gp
A = 9.6767e+08 -1i*5.0572e+08;
B = 1;
Adot = -2.5133e+04 + 4.024e+04i;
Bdot = 0;
D = A^2 + B^2;
E = A*(Adot) + B*(Bdot);
%sensitivity analysis equation:
% solving for M
syms M;
M_eqn = D*alpha^2*(beta^2+W^(-2)) + 2*alpha*A*beta + 2*alpha*beta*(W^(-1)) + 1 - M^(-2) >= 0;
M_val = solve(M_eqn, M);
num_alpha = -2*Adot*beta - 2*Bdot*W^(-1) + 2*B*W^(-2);
den_alpha = 2*E*beta^(2) + 2*E*W^(-2) - 2*D*W^(-3);
alpha = num_alpha/den_alpha;
x4 = 4*Adot*D - 8*A*Adot*E + 4*E^2 - 4*E^(2)*M^(-2);
x3 = -8*Adot*B*D*W^(-2) +8*A*B*E*W^(-2) + 8*Adot*Bdot*D*W^(-1) - 8*Adot*B*E*W^(-1) - 8*A*Bdot*E*W^(-1);
x2 = 4*B^(2)*D*W^(-4) + 8*A*Adot*D*W^(-3) - 8*B*Bdot*D*W^(-3) + 8*B^(2)*E*W^(-3) - 8*D*E*W^(-3) + 8*D*E*W^(-3)*M^(-2) + 4*Adot^(2)*D*W^(-2) + 4*Bdot^(2)*D*W^(-2) - 8*A*Adot*E*W^(-2) - 8*B*Bdot*E*W^(-2) + 8*E^(2)*W^(-2) - 8*E^(-2)*M^(-2);
x1 = -8*A*B*D*W^(-5) + 8*A*Bdot*D*W^(-4) + 8*A*B*E*W^(-4) + 8*Adot*Bdot*D*W^(-3) - 8*Adot*B*E*W^(-3) - 8*A*Bdot*E*W^(-3);
x0 = -4*B^(2)*D*W^(-6) + 4*D^(2)*W^(-6) - 4*D^(2)*W^(-6)*M^(-2) + 8*B^(2)*E*W^(-5) - 8*D*E*W^(-5) + 8*D*E*W^(-5)*M^(-2) * 4*B^(2)*D*W^(-4) - 8*B*Bdot*E*W^(-4) + 4*E^(2)*W^(-4) - 4*E^(2)*W^(-4)*M^(-2);
beta_val = vpasolve(x4*beta^(4)*x3*beta^(3) + x2*beta^(2) + x1*beta + x0 == 0, beta);
(The parameters have been given to me.)
I have been getting this error: "Error using alpha. Too many output arguments.
I am not as well-versed with MALTAB as I'd like to be..so please bear with me!
And if possible, could I also know if I'm on the right track and what I should be doing further from here?
4 Comments
Sam Chak
on 28 Jul 2023
I suggest to update / change the title of your Question to
"How to design a robust PI controller based on the Sensitivity peak value ?"
People who are good at the frequency response method and solving symbolic equations should be able to guide you.
Answers (3)
Steven Lord
on 27 Jul 2023
Nowhere have you defined a variable named alpha, so when MATLAB sees alpha in your code it calls the alpha function with one output argument. It will use that output argument in your equation. But the alpha function doesn't return any output arguments so the call to the function throws an error.
Define your alpha variable before you use it.
VBBV
on 27 Jul 2023
Define or write these lines of code before the symbolic equation M_eqn. This equation contains two undefined variables, alpha and beta
For variable alpha, It seems you have written after the equation M_eqn,
% place these lines before
num_alpha = -2*Adot*beta - 2*Bdot*W^(-1) + 2*B*W^(-2);
den_alpha = 2*E*beta^(2) + 2*E*W^(-2) - 2*D*W^(-3);
% this variable alpha
alpha = num_alpha/den_alpha;
for variable beta give some value say, 2; and then solve the equation M_eqn
% Parameters
f = 2000; %Hz
Tm = 1e-4;
Tr = 2.5e-5;
T1 = 0.0041;
T2 = 1.0024e-4;
Kr =1.56;
Kc = 16.3333;
Tc = 1.0024e-4;
K = T1/(2*Tr);
W = 2*pi*f;
Wn = sqrt((K+1)/(T1*Tr));
num_zeta = (T1+Tr)/(T1*Tr);
den_zeta = 2*(sqrt((K+1)/(T1*Tr)));
zeta = num_zeta/den_zeta;
% Gp
A = 9.6767e+08 -1i*5.0572e+08;
B = 1;
Adot = -2.5133e+04 + 4.024e+04i;
Bdot = 0;
D = A^2 + B^2;
E = A*(Adot) + B*(Bdot);
% define beta also
beta = 2;
% define them here
num_alpha = -2*Adot*beta - 2*Bdot*W^(-1) + 2*B*W^(-2);
den_alpha = 2*E*beta^(2) + 2*E*W^(-2) - 2*D*W^(-3);
alpha = num_alpha/den_alpha;
%sensitivity analysis equation:
% solving for M
syms M;
M_eqn = D*alpha^2*(beta^2+W^(-2)) + 2*alpha*A*beta + 2*alpha*beta*(W^(-1)) + 1 - M^(-2) >= 0;
M_val = solve(M_eqn, M);
x4 = 4*Adot*D - 8*A*Adot*E + 4*E^2 - 4*E^(2)*M^(-2);
x3 = -8*Adot*B*D*W^(-2) +8*A*B*E*W^(-2) + 8*Adot*Bdot*D*W^(-1) - 8*Adot*B*E*W^(-1) - 8*A*Bdot*E*W^(-1);
x2 = 4*B^(2)*D*W^(-4) + 8*A*Adot*D*W^(-3) - 8*B*Bdot*D*W^(-3) + 8*B^(2)*E*W^(-3) - 8*D*E*W^(-3) + 8*D*E*W^(-3)*M^(-2) + 4*Adot^(2)*D*W^(-2) + 4*Bdot^(2)*D*W^(-2) - 8*A*Adot*E*W^(-2) - 8*B*Bdot*E*W^(-2) + 8*E^(2)*W^(-2) - 8*E^(-2)*M^(-2);
x1 = -8*A*B*D*W^(-5) + 8*A*Bdot*D*W^(-4) + 8*A*B*E*W^(-4) + 8*Adot*Bdot*D*W^(-3) - 8*Adot*B*E*W^(-3) - 8*A*Bdot*E*W^(-3);
x0 = -4*B^(2)*D*W^(-6) + 4*D^(2)*W^(-6) - 4*D^(2)*W^(-6)*M^(-2) + 8*B^(2)*E*W^(-5) - 8*D*E*W^(-5) + 8*D*E*W^(-5)*M^(-2) * 4*B^(2)*D*W^(-4) - 8*B*Bdot*E*W^(-4) + 4*E^(2)*W^(-4) - 4*E^(2)*W^(-4)*M^(-2);
beta_val = vpasolve(x4*beta^(4)*x3*beta^(3) + x2*beta^(2) + x1*beta + x0 == 0, beta)
4 Comments
VBBV
on 27 Jul 2023
Ok, Then define beta as symbolic variable
% Parameters
f = 2000; %Hz
Tm = 1e-4;
Tr = 2.5e-5;
T1 = 0.0041;
T2 = 1.0024e-4;
Kr =1.56;
Kc = 16.3333;
Tc = 1.0024e-4;
K = T1/(2*Tr);
W = 2*pi*f;
Wn = sqrt((K+1)/(T1*Tr));
num_zeta = (T1+Tr)/(T1*Tr);
den_zeta = 2*(sqrt((K+1)/(T1*Tr)));
zeta = num_zeta/den_zeta;
% Gp
A = 9.6767e+08 -1i*5.0572e+08;
B = 1;
Adot = -2.5133e+04 + 4.024e+04i;
Bdot = 0;
D = A^2 + B^2;
E = A*(Adot) + B*(Bdot);
% define beta as symbolic variable
syms beta
% define them here
num_alpha = -2*Adot*beta - 2*Bdot*W^(-1) + 2*B*W^(-2);
den_alpha = 2*E*beta^(2) + 2*E*W^(-2) - 2*D*W^(-3);
alpha = num_alpha/den_alpha;
%sensitivity analysis equation:
% solving for M
syms M beta;
M_eqn = D*alpha^2*(beta^2+W^(-2)) + 2*alpha*A*beta + 2*alpha*beta*(W^(-1)) + 1 - M^(-2) >= 0;
M_val = vpasolve(M_eqn, M);
x4 = 4*Adot*D - 8*A*Adot*E + 4*E^2 - 4*E^(2)*M^(-2);
x3 = -8*Adot*B*D*W^(-2) +8*A*B*E*W^(-2) + 8*Adot*Bdot*D*W^(-1) - 8*Adot*B*E*W^(-1) - 8*A*Bdot*E*W^(-1);
x2 = 4*B^(2)*D*W^(-4) + 8*A*Adot*D*W^(-3) - 8*B*Bdot*D*W^(-3) + 8*B^(2)*E*W^(-3) - 8*D*E*W^(-3) + 8*D*E*W^(-3)*M^(-2) + 4*Adot^(2)*D*W^(-2) + 4*Bdot^(2)*D*W^(-2) - 8*A*Adot*E*W^(-2) - 8*B*Bdot*E*W^(-2) + 8*E^(2)*W^(-2) - 8*E^(-2)*M^(-2);
x1 = -8*A*B*D*W^(-5) + 8*A*Bdot*D*W^(-4) + 8*A*B*E*W^(-4) + 8*Adot*Bdot*D*W^(-3) - 8*Adot*B*E*W^(-3) - 8*A*Bdot*E*W^(-3);
x0 = -4*B^(2)*D*W^(-6) + 4*D^(2)*W^(-6) - 4*D^(2)*W^(-6)*M^(-2) + 8*B^(2)*E*W^(-5) - 8*D*E*W^(-5) + 8*D*E*W^(-5)*M^(-2) * 4*B^(2)*D*W^(-4) - 8*B*Bdot*E*W^(-4) + 4*E^(2)*W^(-4) - 4*E^(2)*W^(-4)*M^(-2);
beta_val = vpasolve(x4*beta^(4)*x3*beta^(3) + x2*beta^(2) + x1*beta + x0 == 0, beta)
Sam Chak
on 28 Jul 2023
From the excerpt below, the α and β are the parameters to be determined to make up for the Proportional–Integral controller that is given by
.
Thus,
and ,
and I don't think they are some kind of inbuilt functions.
Excerpt 1:
I think computing α and β is fairly straightforward as outlined in the paper (see Excerpt 2 below) so long as you properly define the real values for . The parameter α is calculated directly from the formula Eq. (7), but the parameter β is obtained by solving the 4th-degree polynomial equation (quartic equation) as shown in Eq. (8).
Excerpt 2:
If you can follow the framework outlined by the paper that involves mostly algebraic substitutions on the denominator of the Sensitivity function in Eq. (5), then you should be able to find α and β that satisfy the desired sensitivity inequality.
3 Comments
Sam Chak
on 28 Jul 2023
I didn't find M. In fact, I just randomly assigned a value for M, so that I can have a complete 4th-degree polynomial equation (see Eq. (8)) to be solved to get the real value of β.
Once β is determined, I use the formula in Eq. (7) to calculate the value of α.
According to the design procedure in Perng et al., 2016, it depends on the desired Sensitivity value you set for M. Thus, you don't need to symbolically solve for M.
Excerpt:
In the following example, the PI controller is directly tuned so that it gives a phase margin of 60°. Can you find the Sensitivity value M here?
% Parameters
Tm = 1e-4;
Tr = 2.5e-5;
T1 = 0.0041;
T2 = 1.0024e-4;
Kr = 1.56;
% Plant transfer function Gp and its step response
s = tf('s');
Gp = (Kr*(Tm*s + 1))/((Tr*s + 1)*(T1*s + 1)*(T2*s + 1));
Gp = minreal(Gp)
step(Gp)
% Tune PI controller for Gp
[Gc, info] = pidtune(Gp, 'PI')
Gcl = feedback(Gc*Gp, 1)
step(Gcl)
% Find Sensitivity function
X = AnalysisPoint('X');
T = feedback(Gp*X*Gc, 1);
S = getSensitivity(T, 'X')
Gs = tf(S) % Sensitivity transfer function
bode(Gs)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!