Which Algorithm "pidtune()" function used for finding PID gains?
    15 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
I am working on tunning the PID gains for a flyback converter. I am curious about what methods out of the popular lmethods ( Ziegler–Nichols, Aström's AMIGO, Skogestad's Internal Model Control, and Chien-Hrones-Reswick) the "pidtune()" function used to give the PID gains.
I also go throw the pidtune.m file using the "edit pidtune" command in the MATLAB script to have a look what is going on inside the pidtune function. After going through several iteration line by line I am still unable to figure out the answer. To me its look like a kind of heuristic algorithm. 
I am seeking assistance from all the community.
Regards 
0 Commenti
Risposte (1)
  Sam Chak
      
      
 il 1 Ago 2024
        Hi @Hafiz Hamza
The pidtune() command utilizes a proprietary algorithm for tuning the PID gains to achieve a balance between performance and robustness. If you do not specify the desired properties, namely the target phase margin and the closed-loop performance objective, for tuning a PID controller using the pidtuneOptions() command, then the algorithm will determine a crossover frequency based on the given plant dynamics, and then design for a target phase margin of 60 degrees.
3 Commenti
  Sam Chak
      
      
 il 1 Ago 2024
				Hi @Hafiz Hamza
The "proprietary algorithm" could be utilizing the in-house 'fmincon()' algorithm or a similar optimizer to tune the PID gains until the optimization objectives are met (e.g., the target phase margin and the closed-loop performance).
You may have misinterpreted my previous comment. However, you can definitely use any of the Ziegler–Nichols, Åström's AMIGO, Skogestad's Internal Model Control, or Chien-Hrones-Reswick methods to tune the PID gains, even when the Plant's transfer function is known. These autotuning methods are model-free, reactive approaches. In other words, you inject an input signal and measure the output response. From the data analysis, you can obtain the response characteristics such as time constant, dead-time, etc.
For example, if you select the Chien-Hrones-Reswick method, these characteristics serve as the parameters to estimate the PID gains using the specified formulas that guarantee 0% (conservative) and 20% (aggressive) overshoot. No complex control design and stability proof is required!!!
Unfortunately, I am unfamiliar with the flyback converter, so I cannot comment on how to construct the objective function. However, I can share my unpublished PID formulas for 0% overshoot, if that would be helpful.
Gp  = tf(20, [1 4.5 64])        % Plant's transfer function (stable)
Ts  = 0.561;                    % Desired Settling Time of the Closed-loop System
[Gc, Gh] = zeropid(Gp, Ts)      % Scroll down to the end of the script
Gcl = feedback(Gc*Gp, Gh)       % Closed-loop System
S   = stepinfo(Gcl)             % Performances
step(Gcl, round(4*Ts, 0)), hold on
step(Gp), grid on, ylim([-0.2, 1.2])
xline(S.SettlingTime, '--', sprintf('Settling Time: %.3f sec', S.SettlingTime), 'color', '#7F7F7F', 'LabelVerticalAlignment', 'bottom')
legend('Closed-loop', 'Open-loop Plant', 'location', 'east')
%% The 0% overshoot method
function [C, H] = zeropid(P, Ts)
    %  Gp is a stable 2nd-order Plant
    %  Ts is the desired settling time
    [numP, denP] = tfdata(minreal(P), 'v');
    a1  = denP(2);
    a2  = denP(3);
    b   = numP(3);
    Tc  = -log(0.02)/Ts;                % Desired time constant
    % Formulas
    k1  = (3*(b^2)*((Tc/b)^2) - a2)/b;      
    k2  = (b^2)*((Tc/b)^3);
    k3  = (3*b*(Tc/b) - a1)/b;       
    k4  = 2*b*((Tc/b)^2);               % P-gain of PID controller
    k5  = k2;                           % I-gain of PID controller
    k6  = Tc/b;                         % D-gain of PID controller
    % PID controller and the Compensator
    C   = pid(k4, k5, k6);              % PID control in the forward path
    H   = tf([k3 k1 k2], [k6 k4 k5]);   % Compensator in the feedback path
end
Vedere anche
Categorie
				Scopri di più su PID Controller Tuning in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
