PID Controller Design by Pole Assignment

3 vues (au cours des 30 derniers jours)
Bahadir
Bahadir le 30 Nov 2024
Commenté : Bahadir le 4 Déc 2024
Hello, im trying to design a PID controller by polynomial coefficient method by given code below but the code seems to find Ki and bres always zero. Can someone help me understand what the problem is?
clc
clear all
syms s x s h y z t K_d K_p K_i ares bres;
% symbolic variables are defined to see if function is working correctly
h=12;x=15;y=35;z=45;t=50;
pole = 1-1i;
p_ds = expand((s-pole) * (s-(conj(pole))))
coef2=coeffs(p_ds,s,'All');
p_es = (s^2+ares*s+bres);
coef = coeffs(p_es,s,'All');
Gs = h /(x*s^3+y*s^2+z*s+t);
[numGs,denGs] = numden(Gs)
denGs1 = coeffs(denGs)
denGs2 = double(denGs1)
p = (p_es * p_ds)
p1 =coeffs(p,s,'All')
Fs = (K_d*s^2+K_p*s+K_i )/ s
Tss = (Gs*Fs)/(1+Gs*Fs)
[numTss,pcs] = numden(Tss)
prob = coeffs(pcs/x,s,'all') == coeffs(p_ds*p_es,s,'all');
for i = 1:length(prob)
disp(vpa(prob(i),4));
end
sol = solve(prob)
disp(sol)
Kdval = double(sol.K_d)
Kpval = double(sol.K_p)
Kival = double(sol.K_i)
aresval = double(sol.ares)
bresval = double(sol.bres)

Réponse acceptée

Paul
Paul le 2 Déc 2024
Modifié(e) : Paul le 2 Déc 2024
Hi Bahadir,
I'm not sure if the code is implementing what it should, but the reason the result is coming back with Ki = bres = 0 is due to the form of the equations.
syms s x s h y z t K_d K_p K_i ares bres;
% symbolic variables are defined to see if function is working correctly
h=12;x=15;y=35;z=45;t=50;
pole = 1-1i;
p_ds = expand((s-pole) * (s-(conj(pole))));
coef2=coeffs(p_ds,s,'All');
p_es = (s^2+ares*s+bres);
coef = coeffs(p_es,s,'All');
Gs = h /(x*s^3+y*s^2+z*s+t);
[numGs,denGs] = numden(Gs);
denGs1 = coeffs(denGs);
denGs2 = double(denGs1);
p = (p_es * p_ds);
p1 =coeffs(p,s,'All');
Fs = (K_d*s^2+K_p*s+K_i )/ s;
Tss = (Gs*Fs)/(1+Gs*Fs);
[numTss,pcs] = numden(Tss);
prob = coeffs(pcs/x,s,'all') == coeffs(p_ds*p_es,s,'all');
%{
for i = 1:length(prob)
disp(vpa(prob(i),4));
end
%}
Here are the equations to be solved.
prob(:),split(string(char(prob(:))),";")
ans = 5x1 string array
"[1 == 1" " 7/3 == ares - 2" " (4*K_d)/5 + 3 == bres - 2*ares + 2" " (4*K_p)/5 + 10/3 == 2*ares - 2*bres" " (4*K_i)/5 == 2*bres]"
The first equation is extraneous. The last equation is a simple relationship between Ki and bres. Apparently solve can find a soluution to all of the equations with Ki = bres = 0
sol = solve(prob)
sol = struct with fields:
K_d: -145/12 K_i: 0 K_p: 20/3 ares: 13/3 bres: 0
If you want to get all solutions parametrically, then use the ReturnConditions flag.
sol = solve(prob,'ReturnConditions',true)
sol = struct with fields:
K_d: (5*z)/4 - 145/12 K_i: (5*z)/2 K_p: 20/3 - (5*z)/2 ares: 13/3 bres: z parameters: z conditions: symtrue
Apparently only ares is fixed and the rest of the unknowns are determined from a single parameter.
  1 commentaire
Bahadir
Bahadir le 4 Déc 2024
Thank you for the help :)

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by