PID Controller Design by Pole Assignment

3 visualizzazioni (ultimi 30 giorni)
Bahadir
Bahadir il 30 Nov 2024
Commentato: Bahadir il 4 Dic 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)

Risposta accettata

Paul
Paul il 2 Dic 2024
Modificato: Paul il 2 Dic 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.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by