How can I tune the PID controller using Genetic Algorithms?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
% intialising the population of Genetic Algorithms populationSize=80; variableBounds=[-100 100;-100 100;-100 100]; evalFN='Initial_PID_objfun_mse'; evalOps=[]; options=[1e-6 1]; initPop=initialize(populationSize,variableBounds,evalFN,evalOps,options); % Intilalising the parameters for the Genetic Algorithms bounds=[-100 100;-100 100;-100 100]; evalFN='Initial_PID_objfun_mse'; evalOps=[]; startPop=initPop; options=[1e-6 1 0]; termFN='maxGenTerm'; termOps=100; selectFN='normGeomSelect'; selectOps=0.08; xOverOps=4; mutFNs='multiNonUnifMutation'; mut1ops=[8 100 2]; %Performing the Genetic Algorithms [x,endPop,bPop,traceInfo]=ga(bounds,evalFN,evalOps,startPop,options,termFN,termmOps,selectFN,selectOps,xOverOps,mutFNs,mutOps); function [x_pp,fx_val]=PID_objfun_MSE(x_pop,options) %slitting the chromosome up into its 3 separate strings Kp=x_pop(2); Ki=x_pop(3); Kd=x_pop(1); %Creating the PID controller from current values pid_den=[1 0]; pid_num=[Kd Kp Ki]; pid_sys=tf(pid_num,pid_den); time=0:0.1:30; [y t]=step(sys_controlled,time); for i=1:301 error(i)=1-y(i); end %to make sure controlled system is stable poles=pole(sys_controlled); if poles(1)>0 error=100e300; elseif poles(2)>0 error=100e300; elseif poles(3)>0 error=100e300; elseif poles(4)>0 error=100e300; elseif poles(5)>0 error=100e300; end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu PID Controller Tuning finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!