How can i tune a PID controller using PSO algorithm for an Automatic Generation Control system

5 ビュー (過去 30 日間)
Gurjit Singh
Gurjit Singh 2016 年 5 月 4 日
回答済み: denny 2017 年 2 月 17 日
I need to optimize a PID controller for a 2 area automatic generation control system using PSO algorithm. I am not able to understand the implementation of the algorithm.

回答 (1 件)

denny
denny 2017 年 2 月 17 日
You can read the matlab help, like the following matlab commands:
set_param('somesimulink/constant','Value',num2str(kp))
sim('somesimulink.slx')
and the simulink model:
to workspace
and the code as following : % options=gaoptimset('Generations',maxGenerations,'PopulationSize',maxPopulationSize,'Display','iter','TimeLimit',6000,'PlotFcn',@myplot_forga);%ga gaplotbestf
options=gaoptimset('Generations',maxGenerations,'PopulationSize',maxPopulationSize,'Display','iter','PlotFcn',@myplot_forga);%ga gaplotbestf
for ii=1:numofmean
every_gen_bestvalues=[];
disp(['--------------------------------------------ga ' num2str(ii) '/' num2str(numofmean)]);
tic
[thelast_x,thelast_f]=ga(@fitness_allothers,8,[],[],[],[],LB,UB,[],[],options);% fitness_test fitness_allothers
usetime=toc;
every_gen_bestvalues=every_gen_bestvalues(2:end-1);
end
disp(['--1-------------------------------------------------------------------------------------------------']);
function y =fitness_allothers(x)
%x vars: Ki_Te Kp_Te
%% set data
set_param('somesimulink/RSC1','Ki_Te',num2str(x(1)))
set_param('somesimulink/RSC1','Kp_Te',num2str(x(2)))
sim('somesimulink');
y=my_fitnessdata(end);% my_fitnessdata is a toworkspace model in the simulink model.
end

カテゴリ

Help Center および File ExchangePID Controller Tuning についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by