0% found this document useful (0 votes)
146 views94 pages

Pid Controller Tuning Using Genetic Algorithm": A Major Project Report On

This document discusses tuning a PID controller for a plant model using genetic algorithms. It aims to design a plant model using genetic algorithm and compare the results against a classically tuned controller. The objective is to show that genetic algorithm tuning can optimize the controller by evaluating the best parameters for the system each time.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views94 pages

Pid Controller Tuning Using Genetic Algorithm": A Major Project Report On

This document discusses tuning a PID controller for a plant model using genetic algorithms. It aims to design a plant model using genetic algorithm and compare the results against a classically tuned controller. The objective is to show that genetic algorithm tuning can optimize the controller by evaluating the best parameters for the system each time.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 94

PID CONTROLLER TUNING USING GENETIC ALGORITHM

A Major Project Report On

PID CONTROLLER TUNING USING GENETIC ALGORITHM


Submitte In Partia! "u!#i!!ment o# Re$uirement% "or T&e A'ar o# t&e De(ree o# MASTER OF ENGINEERING (CONTROL & INSTRUMENTATION) )* HARSH GUPTA Ro!! No+ ,-./ Un er t&e Super0i%ion o# MR. RAM BHAGAT

Department o# E!ectrica! En(ineerin( De!&i Co!!e(e o# En(ineerin( De!&i12233-4 4323

PID CONTROLLER TUNING USING GENETIC ALGORITHM

CERTIFICATE T&i% i% to certi#* t&at t&e 'or5 pre%ente in t&i% project entit!e PID CONTROLLER TUNING USING GENETIC ALGORITHM 6 %ubmitte in partia! #u!#i!!ment o# t&e re$uirement #or t&e a'ar o# t&e e(ree o# Ma%ter o# En(ineerin( in Contro! 7 In%trumentation b* HARSH GUPTA 83/9C7I93,: to t&e E!ectrica! En(ineerin( Department6 De!&i Co!!e(e o# En(ineerin( i% a recor o# t&e %tu ent;% o'n 'or5 carrie out un er m* %uper0i%ion an (ui ance< T&i% 'or5 &a% not been %ubmitte #or t&e a'ar o# an* ot&er e(ree or ip!oma<

RAM BHAGAT Lecturer E!ectrica! En(ineerin( Department De!&i Co!!e(e o# En(ineerin( De!&i12233-4

PID CONTROLLER TUNING USING GENETIC ALGORITHM

ACKNOWLEDGMENT

I am t&an5#u! to t&e A!mi(&t* Go becau%e 'it&out Hi% count!e%% b!e%%in(% t&i% 'or5 'ou! not &a0e been po%%ib!e< I 'ou! !i5e to e=pre%% m* eepe%t (ratitu e to Shri RAM BHAGAT6 m* project %uper0i%or #or &i% con%tant moti0ation6 in0a!uab!e (ui ance an encoura(ement urin( t&e entire uration o# t&i% project< It i% m* pri0i!e(e an &onour to &a0e 'or5e un er &i% %uper0i%ion< I 'ou! a!%o !i5e to t&an5% Dr. Par !" K# ar$ Pr!%&''!r E(&)*ri)a(

E+,i+&&ri+, D&-ar* &+*6 #or &i% %upport an encoura(ement< I 'ou! a!%o !i5e to t&an5% pro#e%%or Nar&+"ra .# ar6 HOD &(&)*ri)a( &+,i+&&ri+, "&-ar* &+*6 #or &i% %upport an encoura(ement< La%t but not !ea%t6 I am t&an5#u! to m* parent%6 teac&er%6 m* %ib!in(% an m* #rien % #or t&eir mora! %upport t&rou(&out<

HARSH GUPTA R!(( N!/ 0123 M.E (C&I)


3

PID CONTROLLER TUNING USING GENETIC ALGORITHM

C!+*&+*'
Certi#ication O# Di%%ertation Ac5no'!e (ement% Li%t% o# "i(ure% Li%t% o# Tab!e% Ab%tract 2 Intro uction 2<2 2<4 2</ 4 Project Aim% an Objecti0e%< )ac5(roun < Literature% Re0ie'%< 24 24 24 2> 43 43 42 44 4/
4

4 / > ? 23

Genetic A!(orit&m 4<2 Intro uction< 4<4 C&aracteri%tic% o# GA%< 4</ Popu!ation Si@e< 4<- Repro uction<

PID CONTROLLER TUNING USING GENETIC ALGORITHM

4<. Cro%%o0er< 4<A Mutation< 4<> Summar* o# Genetic A!(orit&m Proce%%< 4<, E!iti%m< 4<? Objecti0e "unction or "itne%% "unction< 4<23 App!ication o# GA% in Contro! En(ineerin(< / PID Contro!!er /<2 Intro uction< /<4 PID Contro!!er< /</ Continuou% PID Contro!< Optimi@in( o# PID Contro!!er -<2 Intro uction< -<4 De%i(nin( PID Parameter%< -</ Ana!*%i% o# t&e C!a%%ica!!* De%i(ne Contro!!er< -<- Optimi@in( O# t&e De%i(ne PID Contro!!er< . De%i(nin( o# PID u%in( Genetic A!(orit&m .<2 Intro uction<

44> 4, /3 /3 /2 /4 /4 // //A /A /> -.2 .> .>


5

PID CONTROLLER TUNING USING GENETIC ALGORITHM

.<4 Initia!i@in( t&e Popu!ation o# t&e Genetic A!(orit&m< ., .</ Settin( T&e GA Parameter%< .<- Per#ormin( T&e Genetic A!(orit&m< .<. T&e Objecti0e "unction o# t&e Genetic A!(orit&m< .<A Re%u!t% o# t&e Imp!emente GA PID Contro!!er< A "urt&er Bor5% an Conc!u%ion A<2 "urt&er Bor5%< A<4 Conc!u%ion%< Re#erence% Appen i= < A3 A/ AA> >> >> >> ,3 ,4

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Li'* O% Fi,#r&'
"i(ure 2 < T*pica! Turbine Spee Contro!< "i(ure 4 < Depiction o# Rou!ette B&ee! Se!ection< "i(ure / < I!!u%tration O# Cro%%o0er< "i(ure - < I!!u%tration O# Mu!ti1Point Cro%%o0er< "i(ure . < I!!u%tration O# A Uni#orm Cro%%o0er< "i(ure A < I!!u%tration O# Mutation Operation< "i(ure > < Genetic A!(orit&m Proce%% "!o'c&art< "i(ure , < Sc&ematic O# T&e PID Contro!!er < Non1Inter#acin( "orm< "i(ure ? < )!oc5 Dia(ram O# Continuou% PID Contro!!er< "i(ure 23 < I!!u%tration O# Su%taine O%ci!!ation Bit& Perio Per< "i(ure 22 < )!oc5 Dia(ram O# Contro!!er An P!ant< "i(ure 24 < I!!u%tration O# C!o%e Loop Tran%#er "unction< "i(ure 2/ < Simp!i#ie S*%tem< "i(ure 2- < Unit Step Re%pon%e O# T&e De%i(ne S*%tem "i(ure 2. < Impro0e S*%tem Re%pon%e<

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 2A < <Optimi@e < S*%tem Re%pon%e< "i(ure 2> < Optimi@ation Bit& Steepe%t De%cent Gra ient Met&o < "i(ure 2, < Error Si(na! O# T&e Optimi@e S*%tem< "i(ure 2? < Initia!i@e T&e GA< "i(ure 43 < Parameter% Settin( O# GA< "i(ure 42 < Per#ormin( T&e GA< "i(ure 44 < I!!u%tration O# Genetic A!(orit&m Con0er(in( T&rou(& Generation%< "i(ure 4/ < Objecti0e "unction< "i(ure 4- < Ca!cu!atin( T&e Error O# T&e S*%tem U%in( MSE Citeria< "i(ure 4. << Stabi!it* O# T&e Contro!!e S*%tem< "i(ure 4A < PID Re%pon%e Bit& Popu!ation Si@e O# 43< "i(ure 4> < Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# 43< "i(ure 4, < PID Re%pon%e Bit& Popu!ation Si@e O# -3< "i(ure 4? < Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# -3< "i(ure /3 < Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# A3< "i(ure /2 < PID Re%pon%e Bit& Popu!ation Si@e O# ,3< "i(ure /4 < Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# ,3<
8

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Li'* O% Ta4(&'
Tab!e 2 < Rout& Arra*< Tab!e 4 < Recommen e PID Ca!ue Settin(< Tab!e /< Re%u!t% O# SDGM De%i(ne Contro!!er< Contro!!er An GA De%i(ne

A4'*ra)*
9

PID CONTROLLER TUNING USING GENETIC ALGORITHM

It i% 5no'n t&at PID contro!!er i% emp!o*e in e0er* #acet o# in u%tria! automation< T&e app!ication o# PID contro!!er %pan #rom %ma!! in u%tr* to &i(& tec&no!o(* in u%tr*< "or t&o%e '&o are in &ea0* in u%trie% %uc& a% re#inerie% an %&ip1bui! in(%6 'or5in( 'it& PID contro!!er i% !i5e a routine 'or5< Hence &o' o 'e optimi@e t&e PID contro!!erD Do 'e %ti!! tune t&e PID a% '&at 'e u%e to #or e=amp!e u%in( t&e c!a%%ica! tec&ni$ue t&at &a0e been tau(&t to u% !i5e Eie(!er1Nic&o!% met&o D Or o 'e ma5e u%e o# t&e po'er o# computin( 'or! b* tunin( t&e PID in a %toc&a%tic mannerD In t&i% i%%ertation6 it i% propo%e t&at t&e contro!!er be tune u%in( t&e Genetic A!(orit&m tec&ni$ue< Genetic A!(orit&m% 8GA%: are a %toc&a%tic (!oba! %earc& met&o t&at emu!ate% t&e proce%% o# natura! e0o!ution< Genetic A!(orit&m% &a0e been %&o'n to be capab!e o# !ocatin( &i(& per#ormance area% in comp!e= omain% 'it&out e=periencin( t&e i##icu!tie% a%%ociate 'it& &i(& imen%iona!it* or #a!%e optima a% ma* occur 'it& (ra ient ecent tec&ni$ue%< U%in( (enetic a!(orit&m% to per#orm t&e tunin( o# t&e contro!!er 'i!! re%u!t in t&e optimum contro!!er bein( e0a!uate #or t&e %*%tem e0er* time< "or t&i% %tu *6 t&e mo e! %e!ecte i% o# turbine %pee contro! %*%tem< T&e rea%on #or t&i% i% t&at t&i% mo e! i% o#ten encountere in re#inerie% in a #orm o# %team turbine t&at u%e% &* rau!ic (o0ernor to contro! t&e %pee o# t&e turbine< T&e PID contro!!er o# t&e mo e! 'i!! be e%i(ne u%in( t&e c!a%%ica! met&o an t&e re%u!t% ana!*@e < T&e %ame mo e! 'i!! be re e%i(ne u%in( t&e GA met&o < T&e re%u!t% o# bot& conc!u%ion 'i!! be ra'n out<
10

e%i(n% 'i!! be compare 6 ana!*@e

an

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Cha-*&r 5
INTRODUCTION
11

PID CONTROLLER TUNING USING GENETIC ALGORITHM

5.5 Pr!6&)* Ai ' a+" O46&)*i7&'


T&e aim o# t&i% project i% to e%i(n a p!ant u%in( Genetic A!(orit&m< B&at i% Genetic A!(orit&mD Genetic A!(orit&m or in %&ort GA i% a %toc&a%tic a!(orit&m ba%e on princip!e% o# natura! %e!ection an (enetic%< Genetic A!(orit&m% 8GA%: are a %toc&a%tic (!oba! %earc& met&o t&at mimic% t&e proce%% o# natura! e0o!ution< Genetic A!(orit&m% &a0e been %&o'n to be capab!e o# !ocatin( &i(& per#ormance area% in comp!e= omain% 'it&out e=periencin( t&e i##icu!tie% a%%ociate 'it& &i(& imen%iona!it* or #a!%e optima a% ma* occur 'it& (ra ient ecent tec&ni$ue%< U%in( (enetic a!(orit&m% to per#orm t&e tunin( o# t&e contro!!er 'i!! re%u!t in t&e optimum contro!!er bein( e0a!uate #or t&e %*%tem e0er* time< T&e objecti0e o# t&i% project i% to %&o' t&at b* emp!o*in( t&e GA met&o o# tunin( a p!ant6 an optimi@ation can be ac&ie0e < T&i% can be %een b* comparin( t&e re%u!t o# t&e GA optimi@e p!ant a(ain%t t&e c!a%%ica!!* tune p!ant<

5.8

Ba).,r!#+"

In re#inerie%6 in c&emica! p!ant% an ot&er in u%trie% t&e (a% turbine i% a 'e!! 5no'n too! to ri0e compre%%or%< T&e%e compre%%or% are norma!!* o# centri#u(a! t*pe< T&e* con%ume muc& po'er ue to t&e #act t&at 0er* !ar(e 0o!ume #!o'% are &an !e < T&e combination (a% turbine1compre%%or i% &i(&!* re!iab!e< Hence t&e turbine1compre%%or p!a* %i(ni#icant ro!e in t&e operation o# t&e p!ant%<
12

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Spee SP HPS

E!ectronic Go0ernor Contro! S*%tem

Spee Si(na! 8PC: (MV) Contro! Ca!0e Openin(

GT Turbine F

Co mpr e%% or "i(2< T*pica! Turbine Spee Contro!<

In t&e abo0e %et up6 t&e &i(& pre%%ure %team 8HPS: i% u%ua!!* u%e to ri0e t&e turbine< T&e turbine '&ic& i% coup!e to t&e compre%%or 'i!! t&en ri0e t&e compre%%or< T&e &* rau!ic (o0ernor '&ic&6 act% a% a contro! 0a!0e 'i!! be u%e to t&rott!e t&e amount o# %team t&at i% (oin( to t&e turbine %ection< T&e (o0ernor openin( i% bein( contro!!e b* a PID '&ic& i% in t&e e!ectronic (o0ernor contro! pane!<

It i% a 5no'n #act t&at t&e PID contro!!er i% emp!o*e in e0er* #acet o# in u%tria! automation< T&e app!ication o# PID contro!!er %pan #rom %ma!!
13

PID CONTROLLER TUNING USING GENETIC ALGORITHM

in u%tr* to &i(& tec&no!o(* in u%tr*< "or t&o%e '&o are in &ea0* in u%trie% %uc& a% re#inerie% an %&ip bui! in(%6 'or5in( 'it& PID contro!!er i% !i5e a routine 'or5< Hence &o' o 'e optimi@e t&e PID contro!!erD Do 'e %ti!! tune t&e PID a% '&at 'e u%e to #or e=amp!e u%in( t&e c!a%%ica! tec&ni$ue t&at &a0e been tau(&t to u% !i5e Eie(!er1Nic&o!% met&o D Or o 'e ma5e u%e o# t&e po'er o# computin( 'or! b* tunin( t&e PID in a %toc&a%tic mannerD In t&i% project6 it i% propo%e t&at t&e contro!!er be tune u%in( t&e Genetic A!(orit&m tec&ni$ue< U%in( (enetic a!(orit&m% to per#orm t&e tunin( o# t&e contro!!er 'i!! re%u!t in t&e optimum contro!!er bein( e0a!uate %*%tem e0er* time< "or t&i% %tu *6 t&e mo e! %e!ecte i% o# turbine %pee contro! %*%tem< T&e rea%on #or t&i% i% t&at t&i% mo e! i% o#ten encountere in re#inerie% in a #orm o# %team turbine t&at u%e% &* rau!ic (o0ernor to contro! t&e %pee o# t&e turbine a% i!!u%trate abo0e in #i(ure 2< T&e comp!e=itie% o# t&e e!ectronic (o0ernor contro!!er 'i!! not be ta5en into con%i eration in t&i% i%%ertation< T&e e!ectronic (o0ernor contro!!er i% a bi( %ubject b* it%e!# an it i% be*on t&e %cope o# t&i% %tu *< Ne0ert&e!e%% t&i% %tu * 'i!! #ocu% on t&e mo e! t&at ma5e% up t&e %team turbine an t&e &* rau!ic (o0ernor to contro! t&e %pee o# t&e turbine< In t&e conte=t o# re#inerie%6 *ou can con%i er t&e %team turbine a% t&e &eart o# t&e p!ant< T&i% i% ue to t&e #act t&at in t&e re#inerie%6 t&ere are !ot% o# &i(& capacitie% compre%%or% runnin( on %team turbine< Hence t&i% ma5e% t&e contro! an t&e tunin( optimi@ation o# t&e %team turbine %i(ni#icant< #or t&e

14

PID CONTROLLER TUNING USING GENETIC ALGORITHM

In t&i% project6 it 'i!! be %&o'n t&at t&e GA tune PID 'i!! re%u!t in a better optimi@ation o# t&e proce%%< Here i% a brie# e%cription o# &o' GA 'or5%< AGA i% t*pica!!* initia!i@e 'it& a ran om popu!ation con%i%tin( o# bet'een 431233 in i0i ua!%< T&i% popu!ation or matin( poo! i% u%ua!!* repre%ente b* area!10a!ue number or a binar* %trin( ca!!e a c&romo%ome< Ho' 'e!! an in i0i ua! per#orm% a ta%5 i% mea%ure an a%%e%%e b* t&e objecti0e #unction< T&e objecti0e #unction a%%i(n% eac& in i0i ua! a corre%pon in( number ca!! e it% #itne%%< T&e #itne%% o# eac& c&romo%ome i% a%%e%%e an a %ur0i0a! o# t&e #itte%t %trate(* i% app!ie < T&ere are t&ree main %ta(e% o# a (enetic a!(orit&m6t&e%e are 5no'n a% reproduction, crossover an mutation< Durin( t&e reproduction p&a%e t&e #itne%% 0a!ue o# eac& c&romo%ome i% a%%e%%e < T&i% 0a!ue i% u%e in t&e %e!ection proce%% to pro0i e bia% to'ar % #itter in i0i ua!%< Gu%t !i5e in natura! e0o!ution6 a #it c&romo%ome &a% a &i(&er probabi!it* o# bein( %e!ecte #or repro uction< T&i% continue% unti! t&e %e!ection criterion &a% been met< T&e probabi!it* o# an in i0i ua! bein( %e!ecte i% t&u% re!ate to it% #itne%%6 en%urin( t&at #itter in i0i ua!% are more !i5e!* to !ea0e o##%prin(< Mu!tip!e copie% o# t&e %ame %trin( ma* be %e!ecte #or repro uction an t&e #itter %trin(% %&ou! be(in to ominate< Once t&e %e!ection proce%% i% comp!ete6 t&e crossover a!(orit&m i% initiate < T&e cro%%o0er operation% %'ap% certain part% o# t&e t'o %e!ecte %trin(% in a bi to capture t&e (oo part% o# o! c&romo%ome% an create better ne' one%< Genetic operator% manipu!ate t&e c&aracter% o# a c&romo%ome irect!*6 u%in( t&e a%%umption t&at certain in i0i ua!;% (ene co e%6 on a0era(e6 pro uce #itter in i0i ua!%< T&e cro%%o0er probabi!it* in icate% &o' o#ten cro%%o0er i% per#orme < A probabi!it* o# 3H mean% t&at t&e <o##%prin(< 'i!!

15

PID CONTROLLER TUNING USING GENETIC ALGORITHM

be e=act rep!ica% o# t&eir <parent%< A probabi!it* o# 233H mean% t&at eac& (eneration 'i!! be compo%e o# entire!* ne' o##%prin(< U%in( %e!ection an cro%%o0er on t&eir o'n 'i!! (enerate a !ar(e amount o# i##erent %trin(%< Ho'e0er t&ere are t'o main prob!em% 'it& t&i%+ 2< Depen in( on t&e initia! popu!ation c&o%en6 t&ere ma* not be enou(& i0er%it* in t&e initia! %trin(% to en%ure t&e GA %earc&e% t&e entire prob!em %pace< 4< T&e GA ma* con0er(e on %ub1optimum %trin(% ue to a ba c&oice o# initia! popu!ation< T&e%e prob!em% ma* be o0ercome b* t&e intro uction o# a mutation operator into t&e GA< Mutation i% t&e occa%iona! ran om a!teration o# a 0a!ue o# a %trin( po%ition< It i% con%i ere mutation rate 'ou! a bac5(roun operator in t&e (enetic a!(orit&m< T&e probabi!it* o# mutation i% norma!!* !o' becau%e a &i(& e%tro* #it %trin(% an e(enerate t&e (enetic a!(orit&m into a ran om %earc&< Mutation probabi!it* 0a!ue% o# aroun 3<2H or 3<32H are common6 t&e%e 0a!ue% repre%ent t&e probabi!it* t&at a certain %trin( 'i!! be %e!ecte #or mutation #or an e=amp!e #or a probabi!it* o# 3<2HI one %trin( in one t&ou%an 'i!! be %e!ecte #or mutation< Once a %trin( i% %e!ecte #or mutation6 a ran om!* c&o%en e!ement o# t&e %trin( i% c&an(e or mutate <

5.3 Li*&ra*#r&' R&7i&9'


T&e #o!!o'in(% are t&e #e' boo5% an paper% t&at 'ere re#erre to6 in t&e proce%% o# un erta5in( t&i% project< "or t&e un erta5in( o# &i% project6 t&orou(& rea in( o# Genetic A!(orit&m i% re$uire be#ore t&e project can
16

PID CONTROLLER TUNING USING GENETIC ALGORITHM

commence%< Hence a compre&en%i0e re%earc& #or re%ource% are re$uire an t&e #o!!o'in( are %ome o# t&e !iterature% t&at &a% %ome&o' contribute to m* un er%tan in( o# t&e contro! %*%tem an t&e (enetic a!(orit&m in %peci#ic<

B!!.'
Da0i E< Go! ber(6 Genetic Algorithms in Search, Optimization and

Machine Learning< T&e Uni0er%it* o# A!abama6 A i%on1Be%!e* Pub!i%&in( Compan* Inc6 2?,?< Go&n Lei%6 Digital Signal Processing . A MATLAB-Based Tutorial Approach6 Uni0er%it* o# Sout&ern Jueen%!an 6 Re%earc& Stu ie% Pre%% Limite 6 4334< F< A%trom an T Ha((!un 6 P D !ontrollers" Theor#, Design and Tuning6 Prentice Ha!!6 2?,>< F O(ata6 Discrete-Time !ontrol S#stems6 Uni0er%it* o# Minne%ota6 Prentice Ha!!6 2?,-<

:!#r+a('
T O< Ma&on*6 C G Do'nin( an F "at!a6 Genetic Algorithm $or P D Parameter Optimization" Minimizing %rror !riteria 6 Proce%% Contro! an In%trumentation 4333 4A14, Gu!* 43336 Uni0er%it* o# Stract&c!* e6 p( 2-,1 2./<

17

PID CONTROLLER TUNING USING GENETIC ALGORITHM

C&ipper #ie! 6 A< G<6 "!emin(6 P< G< Po&!&eim6 H< an "on%eca6 C< M<6 A Genetic Algorithm Tool&o' $or MATLAB6 Proc< Internationa! Con#erence on S*%tem% En(ineerin(6 Co0entr*6 UF6 A1, September6 2??-< J Ban(6 P Spronc5 an R Trac&t6 An O(er(ie) O$ Genetic Algorithms Applied To !ontrol %ngineering Pro&lems6 Procee in(% o# t&e Secon Internationa! Con#erence on Mac&ine Learnin( An C*bernetic%6 433/< F< Fri%&na 5umar an D< E< Go! ber(6 !ontrol S#stem Optimization *sing Genetic Algorithms6 Gourna! o# Gui ance6 Contro! an D*namic%6 Co!< 2.6No< /6 pp< >/.1>-36 2??/< A< Car%e56 T< Urbacic an )< "i!ipic6 Genetic Algorithms in !ontroller Design and Tuning6 IEEE Tran%< S*%< Man an C*ber6 Co!< 4/6 No< .6 pp2//312//?6 2??-< "rom t&e rea in( o# t&e abo0e an not inc!u%i0e6 it i% #oun t&at GA% are not (uarantee to #in t&e (!oba! optimum %o!ution to a prob!em6 but t&e* are (enera!!* (oo at #in in( acceptab!* (oo %o!ution% to prob!em% in acceptab!* $uic5!* B&ere %pecia!i@e tec&ni$ue% e=i%t #or %o!0in( particu!ar prob!em%6 t&e* are !i5e!* to out1per#orm GA% in bot& %pee an accurac* o# t&e #ina! re%u!t6 %o t&ere i% no b!ac5 ma(ic in e0o!utionar* computation< T&ere#ore GA% %&ou! be u%e '&en t&ere i% no ot&er 5no'n e##icient prob!em %o!0in( %trate(*< Ho'e0er in t&i% project6 GA i% %ti!! u%e a% t&e pre#erre optimi@e met&o in optimi@in( t&e turbine %pee contro! %*%tem< Kou 'i!! %ee t&at %ome ot&er optimi@ation met&o can be better in certain area% o# app!ication an GA can be better in anot&er app!ication< Hence t&ere i% no #a%t an $uic5 ru!e to

18

PID CONTROLLER TUNING USING GENETIC ALGORITHM

'&ic& optimi@ation met&o % to u%e< It a!! epen % on app!ication an t&e comp!ication in t&e imp!ementation o# t&e optimi@e a!(orit&m<

Cha-*&r 8
G&+&*i) A(,!ri*h
8.5 I+*r!"#)*i!+

19

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Genetic A!(orit&m% 8GA<%: are a %toc&a%tic (!oba! %earc& met&o

t&at

mimic% t&e proce%% o# natura! e0o!ution< It i% one o# t&e met&o % u%e #or optimi@ation< Go&n Ho!!an #orma!!* intro uce t&i% met&o in t&e Unite State% in t&e 2?>3at t&e Uni0er%it* o# Mic&i(an< T&e continuin( per#ormance impro0ement% o# computationa! %*%tem% &a% ma e t&em attracti0e #or %ome t*pe% o# optimi@ation< T&e (enetic a!(orit&m %tart% 'it& no 5no'!e (e o# t&e correct %o!ution an epen % entire!* on re%pon%e% #rom it% en0ironment an e0o!ution operator% %uc& a% repro uction6 cro%%o0er an mutation to arri0e at t&e be%t %o!ution< )* %tartin( at %e0era! in epen ent point% an %earc&in( in para!!e!6 t&e a!(orit&m a0oi % !oca! minima an con0er(in( to %ub optima! %o!ution%< In t&i% 'a*6 GA% &a0e been %&o'n to be capab!e o# !ocatin( &i(& per#ormance area% in comp!e= omain% 'it&out e=periencin( t&e i##icu!tie% a%%ociate 'it& &i(& imen%iona!it*6 a% ma* occur 'it& (ra ient ecent tec&ni$ue% or met&o % t&at re!* on eri0ati0e in#ormation<

8.8 Chara)*&ri'*i)' !% G&+&*i) A(,!ri*h


Genetic A!(orit&m% are %earc& an optimi@ation tec&ni$ue% in%pire b* t'o bio!o(ica! princip!e% name!* t&e proce%% o# <natura! %e!ection< an t&e mec&anic% o# <natura! (enetic%<< GA% manipu!ate not ju%t one potentia! %o!ution to a prob!em but a co!!ection o# potentia! %o!ution%< T&i% i% 5no'n
20

PID CONTROLLER TUNING USING GENETIC ALGORITHM

a% popu!ation< T&e potentia! %o!ution in t&e popu!ation i% ca!!e <c&romo%ome%<< T&e%e c&romo%ome% are t&e enco e repre%entation% o# a!! t&e parameter% o# t&e %o!ution< Eac& C&romo%ome% i% compare to ot&er c&romo%ome% in t&e popu!ation an a'ar e #itne%% ratin( t&at in icate% &o' %ucce%%#u! t&i% c&romo%ome% to t&e !atter< To enco e better %o!ution%6 t&e GA 'i!! u%e <(enetic operator%< or <e0o!ution operator% %uc& a% cro%%o0er an mutation #or t&e creation o# ne' c&romo%ome% #rom t&e e=i%tin( one% in t&e popu!ation< T&i% i% ac&ie0e b* eit&er mer(in( t&e e=i%tin( one% in t&e popu!ation or b* mo i#*in( an e=i%tin( c&romo%ome%< T&e %e!ection mec&ani%m #or parent c&romo%ome% ta5e% t&e #itne%% o# t&e parent into account< T&i% 'i!! en%ure t&at t&e better %o!ution 'i!! &a0e a &i(&er c&ance to procreate an o##%prin(< A (enetic a!(orit&m i% t*pica!!* initia!i@e 'it& a ran om popu!ation onate t&eir bene#icia! c&aracteri%tic to t&eir

con%i%tin( o# bet'een 431233 in i0i ua!%< T&i% popu!ation or a!%o 5no'n a% matin( poo! i% u%ua!!* repre%ente b* a rea!10a!ue number or a binar* %trin( ca!!e a c&romo%ome< "or i!!u%trati0e purpo%e%6 t&e re%t o# t&i% %ection repre%ent% eac& c&romo%ome a% a binar* %trin(< Ho' 'e!! an in i0i ua! per#orm% a ta%5 i% mea%ure an a%%e%%e b* t&e objecti0e #unction< T&e objecti0e #unction a%%i(n% eac& in i0i ua! a corre%pon in( number ca!!e it% #itne%%< T&e #itne%% o# eac& c&romo%ome i% a%%e%%e an a %ur0i0a! o# t&e #itte%t %trate(* i% app!ie < In t&i% project6 t&e ma(nitu e o# t&e error 'i!! be u%e to a%%e%% t&e #itne%% o# eac& c&romo%ome<
21

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&ere are t&ree main %ta(e% o# a (enetic a!(orit&m< T&e%e are 5no'n a% reproduction, crosso(er an mutation< T&i% 'i!! be e=p!aine in etai!% in t&e #o!!o'in( %ection<

8.3 P!-#(a*i!+ Si;&


Determinin( t&e number o# popu!ation i% t&e one o# t&e important %tep in GA< T&ere are man* re%earc& paper% t&at 'e!! in t&e %ubject< Man* t&eorie% &a0e been ocumente an e=periment% recor e < Ho'e0er t&e matter o# t&e #act i% t&at more an more t&eorie% an

e=periment% are con ucte an te%te an t&ere i% no #a%t an t&umb ru!e 'it& re(ar % to '&ic& i% t&e be%t met&o to a opt< "or a !on( time t&e eci%ion on t&e popu!ation %i@e i% ba%e on tria! an error< In t&i% project t&e approac& in eterminin( t&e popu!ation i% rat&er

un%cienceti#ic< "rom m* rea in( o# 0ariou% paper%6 it %u((e%te t&at t&e %a#e popu!ation %i@e i% #rom /3 to 233< In t&i% project an initia! popu!ation o# 43 'ere u%e an t&e re%u!t ob%er0e < T&e re%u!t 'a% not promi%in(< Hence an initiati0e o# -36 A36 ,3 an ?3 %i@e o# popu!ation 'ere e=perimente < It 'a% ob%er0e t&at t&e popu!ation o#,3 %eem% to be a (oo (ue%%< Popu!ation o# ?3 an abo0e oe% not re%u!t% in an* #urt&er optimi@ation<

8.1 R&-r!"#)*i!+
22

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Durin( t&e repro uction p&a%e t&e #itne%% 0a!ue o# eac& c&romo%ome i% a%%e%%e < T&i% 0a!ue i% u%e in t&e %e!ection proce%% to pro0i e bia% to'ar % #itter in i0i ua!%< Gu%t !i5e in natura! e0o!ution6 a #it c&romo%ome &a% a &i(&er probabi!it* o# bein( %e!ecte #or repro uction< An e=amp!e o# a a% common %e!ection tec&ni$ue i% t&e <+oulette ,heel %e!ection met&o

%&o'n in "i(ure 4< Eac& in i0i ua! in t&e popu!ation i% a!!ocate a %ection o# a rou!ette '&ee!< T&e %i@e o# t&e %ection i% proportiona! to t&e #itne%% o# t&e in i0i ua!< A pointer i% %pun an t&e in i0i ua! to '&om it point% i% %e!ecte < T&i% continue% unti! t&e %e!ection criterion &a% been met< T&e probabi!it* o# an in i0i ua! bein( %e!ecte i% t&u% re!ate to it% #itne%%6 en%urin( t&at #itter in i0i ua!% are more !i5e!* to !ea0e o##%prin(< Mu!tip!e copie% o# t&e %ame %trin( ma* be %e!ecte #or repro uction an t&e #itter %trin(% %&ou! be(in to ominate< Ho'e0er6 #or t&e %ituation i!!u%trate in #i(ure6 it i% not imp!au%ib!e #or t&e 'ea5e%t %trin( 832332: to ominate t&e %e!ection proce%%<

35% 2>H 32223 -?H 23333

32332

23

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 4< Depiction o# rou!ette '&ee! %e!ection T&ere are a number o# ot&er %e!ection met&o % a0ai!ab!e an it i% up to t&e u%er to %e!ect t&e appropriate one #or eac& proce%%< A!! %e!ection met&o % are ba%e on t&e %ame principa! t&at i% (i0in( #itter c&romo%ome% a !ar(er probabi!it* o# %e!ection< "our common met&o % #or %e!ection are+ 2< Rou!ette B&ee! %e!ection 4< Stoc&a%tic Uni0er%a! %amp!in( /< Norma!i@e (eometric %e!ection -< Tournament %e!ection Due to t&e comp!e=itie% o# t&e ot&er met&o %6 t&e Rou!ette B&ee! met&o % i% pre#erre in t&i% project<

8.2 Cr!''!7&r
Once t&e %e!ection proce%% i% comp!ete 6 t&e cro%%o0er a!(orit&m i% initiate < T&e cro%%o0er operation% %'ap% certain part% o# t&e t'o %e!ecte %trin(% in a bi to capture t&e (oo part% o# o! c&romo%ome% an create better ne' one%< Genetic operator% manipu!ate t&e c&aracter% o# a c&romo%ome irect!*6 u%in( t&e a%%umption t&at certain in i0i ua!;% (ene co e%6 on a0era(e6 pro uce #itter in i0i ua!%< T&e cro%%o0er probabi!it* in icate% &o' o#ten cro%%o0er i% per#orme < A probabi!it* o# 3H mean% t&at t&e o##%prin( 'i!! be e=act rep!ica% o# t&eir parent% an a probabi!it* o# 233H mean% t&at eac& (eneration 'i!! be

24

PID CONTROLLER TUNING USING GENETIC ALGORITHM

compo%e o# entire!* ne' o##%prin(< T&e %imp!e%t cro%%o0er tec&ni$ue i% t&e Sin(!e Point Cro%%o0er< T&ere are t'o %ta(e% in0o!0e in %in(!e point cro%%o0er+ 2< Member% o# t&e ne'!* repro uce %trin(% in t&e matin( poo! are mate 8paire : at ran om< 4< Eac& pair o# %trin(% un er(oe% a cro%%o0er a% #o!!o'%+ An inte(er - i% ran om!* %e!ecte bet'een one an t&e !en(t& o# t&e %trin( !e%% one6L .,L-.M< S'appin( a!! t&e c&aracter% bet'een po%ition% 5N2 an L inc!u%i0e!* create% t'o ne' %trin(%< E=amp!e+ I# t&e %trin(% .//// an /.../ are %e!ecte #or cro%%o0er an t&e 0a!ue o# - i% ran om!* %et to / t&en t&e ne'!* create %trin(% 'i!! be .//./ an /..//a% %&o'n in "i(ure /< 233 322 33 23 23323 32233

"i(ure /< I!!u%tration o# Cro%%o0er< More comp!e= cro%%o0er tec&ni$ue% e=i%t in t&e #orm o# Mu!ti1point an Uni#orm Cro%%o0er A!(orit&m%< In Mu!ti1point cro%%o0er6 it i% an e=ten%ion o# t&e %in(!e point cro%%o0er a!(orit&m an operate% on t&e princip!e t&at t&e part% o# a c&romo%ome t&at contribute mo%t to it% #itne%% mi(&t not be a jacent< T&ere are t&ree main %ta(e% in0o!0e in a Mu!ti1point cro%%o0er< 2< Member% o# t&e ne'!* repro uce %trin(% in t&e matin( poo! are <mate < 8paire : at ran om< 4< Mu!tip!e po%ition% are %e!ecte ran om!* 'it& no up!icate% an %orte into a%cen in( or er<
25

PID CONTROLLER TUNING USING GENETIC ALGORITHM

/< T&e bit% bet'een %ucce%%i0e cro%%o0er point% are e=c&an(e to pro uce ne' o##%prin(< E=amp!e+ I# t&e %trin( ..... an ///// 'ere %e!ecte #or cro%%o0er an t&e mu!tipoint cro%%o0er po%ition% 'ere %e!ecte to be 4 an - t&en t&e ne'!* create %trin(% 'i!! be ..//. an //../ a% %&o'n in "i(ure -< 22 33 22 2 33 3 22332 33223

"i(ure -< I!!u%tration o# Mu!ti1Point Cro%%o0er<

In uni#orm cro%%o0er6 a ran om ma%5 o# one% an @ero% o# t&e %ame !en(t& a% t&e parent %trin(% i% u%e in a proce ure a% #o!!o'%< 2< Member% o# t&e ne'!* repro uce %trin(% in t&e matin( poo! are <mate < 8paire : at ran om< 4< A ma%5 i% p!ace o0er eac& %trin(< I# t&e ma%5 bit i% a one6 t&e un er!*in( bit i% 5ept< I# t&e ma%5 bit i% a @ero t&en t&e corre%pon in( bit #rom t&e ot&er %trin( i% p!ace in t&i% po%ition<

E=amp!e+ I# t&e %trin( ././. an /././ 'ere %e!ecte #or cro%%o0er 'it& t&e ma%5././. t&en ne'!* create %trin(% 'ou! be ..... an ///// a% %&o'n in "i(ure .<

26

PID CONTROLLER TUNING USING GENETIC ALGORITHM

23232 23232 32323

22222 33333

"i(ure .< I!!u%tration o# a Uni#orm Cro%%o0er< Uni#orm cro%%o0er i% t&e mo%t i%rupti0e o# t&e cro%%o0er a!(orit&m% an &a% t&e capabi!it* to comp!ete!* i%mant!e a #it %trin(6 ren erin( it u%e!e%% in t&e ne=t (eneration< )ecau%e o# t&i% Uni#orm Cro%%o0er 'i!! not be u%e in t&i% project an Mu!ti1Point Cro%%o0er i% t&e pre#erre c&oice<

8.< M#*a*i!+
U%in( selection an crosso(er on t&eir o'n 'i!! (enerate a !ar(e amount o# i##erent %trin(%< Ho'e0er t&ere are t'o main prob!em% 'it& t&i%+ 2< Depen in( on t&e initia! popu!ation c&o%en6 t&ere ma* not be enou(& i0er%it* in t&e initia! %trin(% to en%ure t&e Genetic A!(orit&m %earc&e% t&e entire prob!em %pace< 4< T&e Genetic A!(orit&m ma* con0er(e on %ub1optimum %trin(% ue to a ba c&oice o# initia! popu!ation<

T&e%e prob!em% ma* be o0ercome b* t&e intro uction o# a mutation operator into t&e Genetic A!(orit&m< Mutation i% t&e occa%iona! ran om a!teration o# a 0a!ue o# a %trin( po%ition< It i% con%i ere a bac5(roun operator in t&e (enetic a!(orit&m< T&e probabi!it* o# mutation i% norma!!* !o' becau%e a &i(& mutation rate 'ou! e%tro* #it %trin(% an e(enerate t&e (enetic
27

PID CONTROLLER TUNING USING GENETIC ALGORITHM

a!(orit&m into a ran om %earc&< Mutation probabi!it* 0a!ue% o# aroun 3<2H or 3<32H are common6 t&e%e 0a!ue%..repre%ent t&e probabi!it* t&at a certain %trin( 'i!! be %e!ecte #or mutation i<e< #or a probabi!it* o# 3<2HI one %trin( in one t&ou%an 'i!! be %e!ecte #or mutation< Once a %trin( i% %e!ecte #or mutation6 a ran om!* c&o%en e!ement o# t&e %trin( i% c&an(e or mutate < "or e=amp!e6 i# t&e GA c&oo%e% bit po%ition #or mutation in t&e binar* %trin( .////6 t&e re%u!tin( %trin( i% .//./ a% t&e #ourt& bit in t&e %trin( i% #!ippe a% %&o'n in "i(ure A< 23333 23323

"i(ure A< I!!u%tration o# Mutation Operation

8.= S#

ar> O% G&+&*i) A(,!ri*h

Pr!)&''

In t&i% %ection t&e proce%% o# Genetic A!(orit&m 'i!! be %ummari@e in a #!o'c&art< T&e %ummar* o# t&e proce%% 'i!! be e%cribe be!o'<

28

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e %tep% in0o!0e in creatin( an imp!ementin( a (enetic a!(orit&m+ 2< Generate an initia!6 ran om popu!ation o# in i0i ua!% #or a #i=e %i@e< 4< E0a!uate t&eir #itne%%< /< Se!ect t&e #itte%t member% o# t&e popu!ation< -< Repro uce u%in( a probabi!i%tic met&o 8e<(<6 rou!ette '&ee!:< .< Imp!ement cro%%o0er operation on t&e repro uce c&romo%ome% 8c&oo%in( probabi!i%tica!!* bot& t&e cro%%o0er %ite an t&e mate%<:< A< E=ecute mutation operation 'it& !o' probabi!it*< >< Repeat %tep 4 unti! a pre e#ine con0er(ence criterion i% met<

29

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e con0er(ence criterion o# a (enetic a!(orit&m i% a u%er1%peci#ie con ition #or e=amp!e t&e ma=imum number o# (eneration% or '&en t&e %trin( #itne%% 0a!ue e=cee % a certain t&re%&o! <

8.0 E(i*i'
In t&e proce%% o# t&e cro%%o0er an mutation1ta5in( p!ace6 t&ere i% &i(& c&ance t&at t&e optimum %o!ution cou! be !o%t< T&ere i% no (uarantee t&at t&e%e operator% 'i!! pre%er0e t&e #itte%t %trin(< To a0oi t&i%6 t&e e!iti%t mo e!% are o#ten u%e < In t&i% mo e!6 t&e be%t in i0i ua! #rom a popu!ation i% %a0e be#ore an* o# t&e%e operation% ta5e p!ace< B&en a ne' popu!ation i% #orme an e0a!uate 6 t&i% mo e! 'i!! e=amine to %ee i# t&i% be%t %tructure &a% been pre%er0e < I# not t&e %a0e cop* i% rein%erte into t&e popu!ation< T&e GA 'i!! t&en continue% on a% norma!<

8.? O46&)*i7& F#+)*i!+ Or Fi*+&'' F#+)*i!+


T&e objecti0e #unction i% u%e to pro0i e a mea%ure o# &o' in i0i ua!% &a0e per#orme in t&e prob!em omain< In t&e ca%e o# a minimi@ation prob!em6 t&e mo%t #it in i0i ua!% 'i!! &a0e t&e !o'e%t numerica! 0a!ue o# t&e a%%ociate objecti0e #unction< T&i% ra' mea%ure o# #itne%% i% u%ua!!* on!* u%e a% an interme iate %ta(e in eterminin( t&e re!ati0e per#ormance o# in i0i ua!% in a GA< Anot&er #unction t&at i% t&e $itness $unction i% norma!!* u%e to tran%#orm t&e objecti0e #unction 0a!ue into a mea%ure o# re!ati0e #itne%%6 t&u% '&ere $ i% t&e objecti0e #unction6 g tran%#orm% t&e 0a!ue o# t&e objecti0e #unction to a non ne(ati0e number an 0 i% t&e re%u!tin( re!ati0e #itne%%< T&i% mappin( i%
30

PID CONTROLLER TUNING USING GENETIC ALGORITHM

a!'a*% nece%%ar* '&en t&e objecti0e #unction i% to be minimi@e a% t&e !o'er objecti0e #unction 0a!ue% corre%pon to #itter in i0i ua!%< In man* ca%e%6 t&e #itne%% #unction 0a!ue corre%pon % to t&e number o# o##%prin( t&at an in i0i ua! can e=pect to pro uce in t&e ne=t (eneration< A common!* u%e tran%#ormation i% t&at o# proportiona! #itne%% a%%i(nment<

8.5@ A--(i)a*i!+ O% G&+&*i) A(,!ri*h ' I+ C!+*r!( E+,i+&&ri+,


Pre%ent!* GA &a% been recei0in( a !ot o# attention an more re%earc& &a% been %*%tem one to %tu * it% app!ication%< App!ication in t&e area o# Contro! e0e!ope tremen ou%!*< E0en t&ou(& in contro! e%i(n6 i%%ue% %uc& a% per#ormance6 %*%tem %tabi!it*6 %tatic an %*%tem robu%tne%% &a0e to be ta5en into account< epen ence u%ua!!* cannot be e=pre%%e in a En(ineerin( &a% a!%o *namic in e= an an

Ho'e0er eac& o# t&e%e i%%ue% %tron(!* epen % on t&e contro!!er %tructure parameter%< T&i% mat&ematica! #ormu!a but o#ten a tra e1o## &a% to be ma e amon( con#!ictin( per#ormance i%%ue%< T&e #o!!o'in( are %ome GA app!ication% in u%e contro! en(ineerin(< Mu!ti objecti0e Contro!< PID contro!< Optima! Contro!< Robu%t Contro!< Inte!!i(ent Contro!<

31

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Cha-*&r 3
PID C!+*r!((&r
3.5 I+*r!"#)*i!+
PID contro!!er con%i%t% o# Proportiona! Action6 Inte(ra! Action an Deri0ati0e Action< It i% common!* re#er to Eie(!er1Nic&o!% PID tunin( parameter%< It i% b* #ar t&e mo%t common contro! a!(orit&m < In t&i% c&apter6 t&e ba%ic concept o# t&e PID contro!% 'i!! be e=p!aine < PID contro!!er;% a!(orit&m are mo%t!* u%e in #ee bac5 !oop%< PID

contro!!er% can be imp!emente in man* #orm%< It can be imp!emente a% a %tan 1a!one contro!!er or a% part o# Direct Di(ita! Contro! 8DDC: pac5a(e or e0en Di%tribute Contro! S*%tem 8DCS:< T&e !atter i% a &ierarc&ica! i%tribute proce%% contro! %*%tem '&ic& i% 'i e!* u%e in proce%% p!ant% %uc& a% p&arceumatica! or oi! re#inin( in u%trie%< It i% intere%tin( to note t&at more t&an &a!# o# t&e in u%tria! contro!!er% in u%e to a* uti!i@e PID or mo i#ie PID contro! %c&eme%< )e!o' i% a %imp!e ia(ram i!!u%tratin( t&e %c&ematic o# t&e PID contro!!er< Suc& %et up i% 5no'n a% non interactin( #orm or para!!e! #orm<

32

PID CONTROLLER TUNING USING GENETIC ALGORITHM

3.8 PID C!+*r!((&r


In proportiona! contro!6 Pterm O FP P Error It u%e% proportion o# t&e %*%tem error to contro! t&e %*%tem< In t&i% action an o##%et i% intro uce in t&e %*%tem< In Inte(ra! contro!6 It i% proportiona! to t&e amount o# error in t&e %*%tem< In t&i% action6 t&e I1 action 'i!! intro uce a !a( in t&e %*%tem< T&i% 'i!! e!iminate t&e o##%et t&at 'a% intro uce ear!ier on b* t&e P1action<

33

PID CONTROLLER TUNING USING GENETIC ALGORITHM

In Deri0ati0e contro!6 It i% proportiona! to t&e rate o# c&an(e o# t&e error< In t&i% action6 t&e D1 action 'i!! intro uce a !ea in t&e %*%tem< T&i% 'i!! e!iminate t&e !a( in t&e %*%tem t&at 'a% intro uce b* t&e I1action ear!ier on<

3.3 C!+*i+#!#' PID


T&e t&ree contro!!er% '&en combine to(et&er can be repre%ente b* t&e #o!!o'in( tran%#er #unction< Gc(s) = K (1 + 1/sTi + sTd) T&i% can be i!!u%trate be!o' in t&e #o!!o'in( b!oc5 ia(ram

B&at t&e PID contro!!er oe% i% ba%ica!!* i% to act on t&e 0ariab!e to be Manipu!ate t&rou(& a proper combination o# t&e t&ree contro! action% t&at i% t&e P contro! action6 I contro! action an D contro! action< T&e P action i% t&e contro! action t&at i% proportiona! to t&e actuatin( error
34

PID CONTROLLER TUNING USING GENETIC ALGORITHM

%i(na! '&ic& i% t&e i##erence bet'een t&e input an t&e #ee bac5 %i(na!< T&e I action i% t&e contro! action '&ic& i% proportiona! to t&e inte(ra! o# t&e actuatin( error %i(na!< "ina!!* t&e D action i% t&e contro! action '&ic& i% proportiona! to t&e eri0ati0e o# t&e actuatin( error %i(na!< Bit& t&e inte(ration o# a!! t&e t&ree action%6 t&e continuou% PID can be rea!i@e < T&i% t*pe o# contro!!er i% 'i e!* u%e in in u%trie% a!! o0er t&e 'or! < In #act a !ot o# re%earc&6 %tu ie% an app!ication &a% been i%co0ere in t&e recent *ear%<

35

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Cha-*&r 1
O-*i i;i+, O% PID C!+*r!((&r
1.5 I+*r!"#)*i!+
"or t&e %*%tem un er %tu *6 Eie(er1Nic&o!% tunin( ru!e ba%e on critica! (ain Fer an critica! perio Per 'i!! be u%e < In t&i% met&o 6 t&e inte(ra! time Ti 'i!! be %et to in#init* an t&e eri0ati0e time T to @ero< T&i% i% u%e to (et t&e initia! PID %ettin( o# t&e %*%tem< T&i% PID %ettin( 'i!! t&en be #urt&er optimi@e u%in( t&e %teepe%t e%cent (ra ient met&o << In t&i% met&o 6 on!* t&e proportiona! contro! action 'i!! be u%e < T&e F p 'i!! be increa%e to a critica! 0a!ue Fer at '&ic& t&e %*%tem output 'i!! e=&ibit %u%taine o%ci!!ation%< In t&i% met&o 6 i# t&e %*%tem output oe% not e=&ibit t&e %u%taine o%ci!!ation% &ence t&i% met&o oe% not app!*<

In t&i% c&apter6 it 'i!! be %&o'n t&at t&e ine##icienc* o# e%i(nin( PID contro!!er u%in( t&e c!a%%ica! met&o < T&i% e%i(n 'i!! be #urt&er impro0e b* t&e optimi@ation met&o %uc& a% <%teepe%t e%cent (ra ient met&o a% mentione ear!ier<

36

PID CONTROLLER TUNING USING GENETIC ALGORITHM

1.8

D&'i,+i+, PID Para &*&r'

"rom t&e re%pon%e be!o'6 t&e %*%tem un er %tu * i% in ee o%ci!!ator* an &ence t&e E1N tunin( ru!e ba%e on critica! (ain F er an critica! perio Per can be app!ie <

"i(ure 23< I!!u%tration o# Su%taine O%ci!!ation 'it& Perio Per<

T&e tran%#er #unction o# t&e PID contro!!er i% Gc(s) = Kp(1+1/ TiS + Tds ) T&e objecti0e i% to ac&ie0e a unit1%tep re%pon%e cur0e o# t&e e%i(ne %*%tem t&at e=&ibit% a ma=imum o0er%&oot o# 4. H< I# t&e ma=imum o0er%&oot i%

37

PID CONTROLLER TUNING USING GENETIC ALGORITHM

e=ce%%i0e %a*% about (reater t&an -3H6 #ine tunin( %&ou! be one to re uce it to !e%% t&an4.H< T&e %*%tem un er %tu * abo0e &a% a #o!!o'in( b!oc5 ia(ram

"i(ure 22< )!oc5 Dia(ram O# Contro!!er An P!ant<

Since t&e Ti O an T O 36 t&i% can be re uce to t&e tran%#er #unction o# R(s)/C(s) = kp/ s(s+ 1)(s+ 5)+ Kp T&e 0a!ue o# Fp t&at ma5e% t&e %*%tem mar(ina!!* %tab!e %o t&at %u%taine o%ci!!ation occur% can be obtaine b* u%in( t&e Rout&;% %tabi!it* citerion< Since t&e c&aracteri%tic e$uation #or t&e c!o%e 1!oop %*%tem i%

s^3+ 6s^2+ 5s+ Kp= 0


"rom t&e Rout&;% Stabi!it* Criterion6 t&e 0a!ue o# Fp t&at ma5e% t&e %*%tem
38

PID CONTROLLER TUNING USING GENETIC ALGORITHM

mar(ina!!* %tab!e can be etermine <

T&e tab!e be!o' i!!u%trate% t&e Rout& arra*<

Tab!e 2< Rout& Arra*

)* ob%er0in( t&e coe##icient o# t&e #ir%t co!umn6 t&e %u%taine o%ci!!ation 'i!! occur i# FpO/3< Hence t&e critica! (ain Fer i% Fer O /3 T&u% 'it& Fp %et e$ua! to Fer6 t&e c&aracteri%tic e$uation become% %Q N A%R N .% N /3 O 3 T&e #re$uenc* o# t&e %u%taine o%ci!!ation can be etermine b* %ub%titutin( t&e % term% 'it& 1 term. Hence t&e ne' e$uation become% 8 1 )Q + A 8 1 :R N . 8 1 : N /3 O 3

39

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&i% can be %imp!i#ie to A 8 . 1 :R N 1 8 . 1 : O 3 "rom t&e abo0e %imp!i#ication6 t&e %u%taine o%ci!!ation can be re uce to R O . or O . Per O 4/. O 4<,3?? "rom Eie(!er1Nic&o!% #re$uenc* met&o o# t&e %econ met&o 6 t&e tab!e %u((e%te tunin( ru!e accor in( to t&e #ormu!a %&o'n< "rom t&e%e 'e are ab!e to e%timate t&e parameter% o# Fp6 Ti an T < T&e perio o# t&e %u%taine o%ci!!ation can be ca!cu!ate a%

Tab!e 4< Recommen e PID Ca!ue Settin(<

Hence #rom t&e abo0e tab!e6 t&e 0a!ue% o# t&e PID parameter% Fp6 Ti an T 'i!! be Fp O /3 Ti O 3<. P 4<,3?? O 2<-3. T O 3<24. P 4<,3?? O 3</.2<
40

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e tran%#er #unction o# t&e PID contro!!er 'it& a!! t&e parameter% i% (i0en a%

"rom t&e abo0e tran%#er #unction6 'e can %ee t&at t&e PID contro!!er &a% po!e at t&e ori(in an oub!e @ero at % O 12<-4/.< T&e b!oc5 ia(ram o# t&e contro! %*%tem 'it& PID contro!!er i% a% #o!!o'%<

"i(ure 24< I!!u%trate t&e C!o%e Loop Tran%#er "unction<

U%in( t&e MATLA) #unction6 t&e #o!!o'in( %*%tem can be ea%i!* ca!cu!ate < T&e abo0e %*%tem can be re uce to %in(!e b!oc5 b* u%in( t&e #o!!o'in( MATLA) #unction< )e!o' i% t&e Mat!ab co e% t&at 'i!! ca!cu!ate t&e t'o b!oc5% in %erie%<

41

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&i% 'i!! (i0e% t&e #o!!o'in( an%'er

Hence t&e abo0e b!oc5 ia(ram i% re uce to

"i(ure 2/< Simp!i#ie S*%tem<

42

PID CONTROLLER TUNING USING GENETIC ALGORITHM

U%in( anot&er MATLA) #unction6 t&e o0era!! #unction 'it& it% #ee bac5 can be ca!cu!ate a% #o!!o'

T&i% 'i!! re%u!t to

T&ere#ore t&e o0era!! c!o%e !oop %*%tem re%pon%e o#

T&e unit %tep re%pon%e o# t&i% %*%tem can be obtaine 'it& MATLA)<

43

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 2-< Unit Step Re%pon%e O# T&e De%i(ne S*%tem<

T&e #i(ure abo0e i% t&e %*%tem re%pon%e o# t&e e%i(ne %*%tem< "rom t&e abo0e re%pon%e it i% ob0iou% t&at t&e %*%tem can be #urt&er impro0e <

1.3 A+a(>'i' O% Th& C(a''i)a((> D&'i,+&" C!+*r!((&r


44

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"rom t&e abo0e ia(ram6 'e can ana!*@e t&e re%pon%e o# t&e %*%tem< T&e @ero an po!e o# t&e %*%tem can be ca!cu!ate u%in( t&e MATLA) #unction *%8;-< Be can ana!*@e t&em 0ia t&e #o!!o'in( parameter%+ De!a* time6 t Ri%e time6 tr Pea5 time6 tp Ma=imum O0er%&oot6 Mp Sett!in( time6 t%

T&e e!a* time6 t o# t&e abo0e %*%tem '&ic& i% t&e time ta5en to reac& .3H o#t&e #ina! re%pon%e time i% about 3<. %ec< T&e ri%e time6 tr i% t&e time ta5en to reac& . to ?. H o# t&e #ina! 0a!ue i% about2<>. %ec< T&e Pea5 time6 tp i% t&e time ta5en #or t&e %*%tem to reac& t&e #ir%t pea5 o# o0er%&oot i% about 4<3 %ec< T&e Ma=imum O0er%&oot6 Mp o# t&e %*%tem i% appro=imate!* A3H< "ina!!* t&e Sett!in( time6 t% i% about 23<4 %ec< "rom t&e ana!*%i% abo0e6 t&e %*%tem &a% not been tune to it% optimum< Here 'e can impro0e t&e %*%tem b* !oo5in( into t&e %*%tem @ero an po!e< T&e %*%tem @ero% an po!e% can be ca!cu!ate u%in( MATLA) #unction
45

PID CONTROLLER TUNING USING GENETIC ALGORITHM

mentione be!o'<

T&e abo0e re%u!t %&o'% t&at t&e %*%tem i% %tab!e %ince a!! t&e po!e% are !ocate on t&e !e#t %i e o# t&e %1p!ane< To optimi@e t&e re%pon%e #urt&er6 t&e PID contro!!er tran%#er #unction mu%t be re0i%ite < T&e tran%#er #unction o# t&e e%i(ne PID contro!!er i%

46

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e PID contro!!er &a% a oub!e @ero o# <2<-4/.< )* tria! an error6 !et 5eep% t&e Fp O 2, an c&an(e t&e !ocation o# t&e oub!e @ero #rom 2<-4/. to 3<A.<

T&e ne' PID contro!!er 'i!! &a0e t&e #o!!o'in( parameter%<

T&e PID tran%#er #unction an

p!ant tran%#er #unction in %erie% can be

ca!cu!ate b* Mat!ab an t&e re%u!t a% #o!!o'6

T&e tota! re%pon%e 'it& a unit* #ee bac5 can be ca!cu!ate a% #o!!o'

T&e re%pon%e o# t&e abo0e %*%tem can be i!!u%trate in t&e #o!!o'in( p!ot<

47

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 2.< Impro0e S*%tem Re%pon%e<

T&e ne' %*%tem re%pon%e &a% %ome&o' impro0e < T&e Ma=imum O0er%&oot6 Mp &a% re uce to appro=imate!* 2,H<T&e Sett!in( Time6 t% &a% impro0e #rom 2-%ec to A %ec< T&e Pea5 Time6 tp an De!a* Time6 t &a% increa%e < T&e #ina! amp!itu e &a% impro0e at t&e e=pen%e o# t&e %*%tem time< T&e ne' PID parameter% can be ca!cu!ate a% are Fp O 2,6 Ti O /<3>> an T O 3<>A?4< To impro0e t&e %*%tem #urt&er6 !et% increa%e t&e Fp 0a!ue to /?<-4< T&e !ocation o# oub!e @ero 'i!! be 5ept t&e %ame i<e % O 13<A.< T&e ne' tran%#er #unction o# t&e PID contro!!er 'i!! be

48

PID CONTROLLER TUNING USING GENETIC ALGORITHM

U%in( t&e Mat!ab comman 6 t&e abo0e #unction to(et&er 'it& t&e p!ant tran%#er #unction an t&e unit* #ee bac5 can be etermine < T&e re%u!t i%

T&e %*%tem re%pon%e can be %&o'n a% #o!!o'

"i(ure 2A< <Optimi@e < S*%tem Re%pon%e<


49

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e abo0e re%pon%e %&o'% t&at t&e %*%tem &a% impro0e < T&e re%pon%e i% #a%ter t&an t&e one %&o'n in #i(ure 2.< T&e Ma=imum O0er%&oot6 Mp &a% increa%e to about 44H< T&i% i% %ti!! acceptab!e %ince t&e Ma=imum O0er%&oot a!!o'ab!e i% !e%% t&an 4.H<T&e Sett!in( Time6 t% remain t&e %ame i<e< A %ec< T&e Pea5 Time6 tp an De!a* Time6 t &a% impro0e < T&e ne' PID parameter% can be ca!cu!ate a% Fp O /?<-46 Ti O /<3>> an T O 3<>A?4< In t&e 0ariou% p!ot% abo0e6 t&e 0ariou% re%pon%e% an it% e%i(n parameter% can be ob%er0e < Hence 'e can c!ear!* %ee t&at t&e #ina! parameter% are more %uperior t&en t&e ear!ier t'o re%pon%e%< Ho'e0er t&e %etbac5 i% t&e Mp6 '&ic& i% more t&an t&e Mp o# t&e %econ re%pon%e< Ne0ert&e!e%% t&e #ina! re%pon%e Mp i% %ti!! 'it&in t&e 4.H Ma=imum O0er%&oot a!!o'ab!e< T&e %ett!in( time6 t% o# t&e %econ an t&e t&ir re%pon%e% #are muc& better t&an t&e #ir%t re%pon%e< T&e t% reac&e it%%tea *1%tate in muc& #a%ter t&an t&e ori(ina! time ta5en b* t&e ori(ina! re%pon%e< It i% intere%tin( to ob%er0e t&at t&e%e 0a!ue% are appro=imate!* t'ice t&e 0a!ue% %u((e%te b* t&e %econ met&o o# E1N tunin( ru!e< Hence 'e can conc!u e t&at E1N tunin( ru!e &a% pro0i e u% a %tartin( point #or a #iner tunin(< It i% ob%er0e t&at #or t&e ca%e '&ere t&e oub!e @ero i% !ocate at % O 12<-4.6 increa%in( t&e 0a!ue o# Fp increa%e% t&e %pee o# t&e re%pon%e< Ho'e0er t&i% oe% not impro0e t&e percenta(e ma=imum o0er%&oot< In #act 0ar*in( Fp
50

PID CONTROLLER TUNING USING GENETIC ALGORITHM

&a% !itt!e impact on t&e percenta(e ma=imum o0er%&oot< On t&e ot&er &an 6 0ar*in( t&e oub!e @ero &a% %i(ni#icant e##ect on t&e ma=imum o0er%&oot< T&e @ero i% %&i#te #orm <2<-4. to <3<A. an 'e ob%er0e t&at t&e ma=imum o0er%&oot re uce%< "ina!!* to ac&ie0e a better re%u!t6 'e &a0e to &a0e to oub!e t&e Fp 0a!ue coup!e 'it& t&e ne' @ero 0a!ue an &ence t&e better percenta(e ma=imum o0er%&oot can be ac&ie0e < T&e abo0e can e=p!aine t&rou(& t&e root1!ocu% ana!*%i%< T&e %*%tem e%cribe abo0e can be #urt&er impro0e or optimi@e < In t&e #o!!o'in( %ection6 t&e optimi@ation met&o u%e 'i!! be i%cu%%e <

1.1 O-*i i;i+, O% Th& D&'i,+&" PID C!+*r!((&r.


T&e optimi@in( met&o u%e #or t&e e%i(ne PID contro!!er i% t&e %teepe%t (ra ient e%cent met&o << In t&i% met&o 6 'e 'i!! eri0e t&e tran%#er #unction o# t&e contro!!er a%

T&e minimi@in( o# t&e error #unction o# t&e c&o%en prob!em can be ac&ie0e i# t&e %uitab!e 0a!ue% o# can be etermine < T&e%e t&ree combination% o# potentia! 0a!ue% #orm a t&ree imen%iona! %pace< T&e error #unction 'i!! #orm %ome contour 'it&in t&e %pace< T&i% contour &a% ma=ima6 minima an (ra ient% '&ic& re%u!t in a continuou% %ur#ace<

51

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e i ea o# t&i% optimi@ation met&o i% reac& t&e minima b* t&e %&orte%t pat&< In or er to ac&ie0e t&i% %&orte%t pat&6 mo0in( o'n t&e %teepe%t (ra ient 'i!! !ea to reac&in( t&e minima t&e %oone%t< B&en t&e (ra ient c&an(e% #rom point to point to en%ure t&at t&e %teepe%t pat& i% %ti!! bein( u%e 6 it i% %i(ni#icant to c&oo%e a ne' irection an ma5e c&an(e% accor in(!*< Hence t&e minimi@ation o# t&e error #unction i% ac&ie0e b* ana!*@in( t&e #unction o# t&e #unction it%e!#< In t&e ne=t para(rap&6 t&e eri0ation o# t&e p!ant tran%#er #unction to t&e minimi@in( o# error #unction 'i!! be %&o'n<

T&e #o!!o'in( i% t&e Optimi@ation eri0ation<

52

PID CONTROLLER TUNING USING GENETIC ALGORITHM

53

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e abo0e e$uation can be imp!emente 'it& MATLA) an t&e re%pon%e ob%er0e < T&e etai!% o# t&e Mat!ab co e% can be %een in t&e appen i=<
54

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"rom t&e p!ot be!o' 'e can %ee t&e optimi@ation re%pon%e< In t&i% p!ot 'e can %ee &o' t&e optimi@e contro!!er be&a0e< It can be %een t&at t&e cur0e be&a0e% a% i# it c!imbin( up t&e &i!!< It 'i!! impro0e it% per#ormance unti! t&ere i% !itt!e error e=i%t an #ina!!* it 'i!! reac& t&e #ina! 0a!ue<

"i(ure 2>< Optimi@ation Bit& Steepe%t De%cent Gra ient Met&o

In t&i% met&o 6 t&e %*%tem i% #urt&er optimi@e u%in( t&e %ai met&o < Bit& t&e %teepe%t e%cent (ra ient met&o <6 t&e re%pon%e &a% e#inite!* impro0e a% compare to t&e one in "i(ure 2A< T&e %ett!in( time &a% impro0e to 4<. %econ a% compare to A<3 %econ % pre0iou%!*< T&e %etbac5 i% t&at t&e ri%e time an t&e ma=imum o0er%&oot cannot be ca!cu!ate < T&i% i% ue to t&e &i!!

55

PID CONTROLLER TUNING USING GENETIC ALGORITHM

c!imbin( action o# t&e %teepe%t

e%cent (ra ient met&o < Ho'e0er t&i%

%etbac5 'a% rep!ace 'it& t&e $uic5 %ett!in( time ac&ie0e < )e!o' i% t&e p!ot o# t&e error %i(na! o# t&e optimi@e contro!!er< In t&e #i(ure be!o' it i% %&o'n t&at t&e error 'a% minimi@e an t&i% corre!ate 'it& t&e re%pon%e %&o'n in "i(ure 2> A% t&e error 'a% minimi@e 6 t&e %*%tem i% reac&in( it% %tabi!it*<

"i(ure 2,< Error Si(na! O# T&e Optimi@e S*%tem

"rom t&e abo0e #i(ure6 t&e initia! error o# 2 i% #ina!!* re uce to @ero< It too5 about 4<. to / %econ % #or t&e error to be minimi@e <

56

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Cha-*&r2
D&'i,+i+, O% PID U'i+, G&+&*i) A(,!ri*h
2.5 I+*r!"#)*i!+
)e#ore 'e (o into t&e abo0e %ubject< It i% (oo to i%cu%% t&e i##erence% bet'een Genetic% A!(orit&m a(ain%t t&e tra itiona! met&o %< T&i% 'i!! &e!p u% un er%tan '&* GA i% more e##icient t&an t&e !atter< Genetic a!(orit&m% are %ub%tantia!!* i##erent to t&e more tra itiona! %earc& an optimi@ation tec&ni$ue%< T&e #i0e main i##erence% are+ 2< Genetic a!(orit&m% %earc& a popu!ation o# point% in para!!e!6 not #rom a %in(!e point< 4< Genetic a!(orit&m% au=i!iar* 5no'!e (eI on!* t&e objecti0e #unction an in#!uence t&e irection o# t&e %earc&< /< Genetic a!(orit&m% u%e probabi!i%tic tran%ition ru!e%6 not etermini%tic ru!e%<
57

o not re$uire

eri0ati0e in#ormation or ot&er corre%pon in( #itne%% !e0e!%

PID CONTROLLER TUNING USING GENETIC ALGORITHM

-< Genetic a!(orit&m% 'or5 on an enco in( o# a parameter %et not t&e parameter %et it%e!# 8e=cept '&ere rea!10a!ue in i0i ua!% are u%e :< .< Genetic a!(orit&m% ma* pro0i e a number o# potentia! %o!ution% to a (i0en prob!em an t&e c&oice o# t&e #ina! i% !e#t up to t&e u%er<

2.8 I+i*ia(i;i+, *h& P!-#(a*i!+ !% *h& G&+&*i) A(,!ri*h


T&e Genetic A!(orit&m &a% to be initia!i@e be#ore t&e a!(orit&m can procee < T&e Initia!i@ation o# t&e popu!ation %i@e6 0ariab!e boun % an t&e e0a!uation #unction are re$uire < T&e%e are t&e initia! input% t&at are re$uire in or er #or t&e Genetic A!(orit&m proce%% to %tart< T&e #o!!o'in( co e i% ba%e Too!bo= 8GAOT:< HInitia!i%in( t&e (enetic a!(orit&m popu!ationSi@eO,3I 0ariab!e)oun %OL1233 233I1233 233I1233 233MI e0a!"NO;PIDSobj#unSMSE;I HC&an(e t&i% to re!e0ant object #unction e0a!Op%OLMI option%OL2e1A 2MI initPopOinitia!i@e(a8popu!ationSi@e60ariab!e)oun %6e0a!"N< e0a!Op%6option%:
"i(ure 2?< Initia!i@e T&e GA<

on t&e Genetic A!(orit&m Optimi@ation

58

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e #o!!o'in( co e% are u%e e=p!aine in etai!%<

to initia!i@e t&e GA< T&e co e% 'i!! be

PopulationSize - T&e #ir%t %ta(e o# 'ritin( a Genetic A!(orit&m i% to create a popu!ation< T&i% comman e#ine% t&e popu!ation %i@e o# t&e GA< Genera!!* t&e bi((er t&e popu!ation %i@e t&e better i% t&e #ina! appro=imation< VariableBounds - Since t&i% project i% u%in( (enetic a!(orit&m% to optimi@e t&e (ain% o# a PID contro!!er t&ere are (oin( to be t&ree %trin(% a%%i(ne to eac& member o# t&e popu!ation6 t&e%e member% 'i!! be compri%e o# a P6 I an a D %trin( t&at 'i!! be e0a!uate t&rou(&out t&e cour%e o# t&e GA proce%%e%< T&e t&ree term% are entere into t&e (enetic a!(orit&m 0ia t&e ec!aration o# a t&ree1ro' (aria&le&ounds matri=< T&e number o# ro'% in t&e (aria&le&ounds matri= repre%ent% t&e number o# term% in eac& member o# t&e popu!ation< "i(ure 2?i!!u%trate% a popu!ation o# ei(&t* member% bein( initia!i@e 'it& 0a!ue% ran om!* %e!ecte bet'een 1233 an 233< EvalFN - T&e e0a!uation #unction i% t&e mat!ab #unction u%e to ec!are t&e objecti0e #unction< It 'i!! #etc& t&e #i!e name o# t&e objecti0e #unction an e=ecute t&e co e% an return t&e 0a!ue% bac5 to t&e main co e%< Options - A!t&ou(& t&e pre0iou% e=amp!e% in t&i% %ection 'ere a!! binar* enco e t&i% 'a% ju%t #or i!!u%trati0e purpo%e%< )inar* %trin(% &a0e t'o main ra'bac5%+ 2< T&e* ta5e !on(er to e0a!uate ue to t&e #act t&e* &a0e to be con0erte to an #rom binar*< 4< )inar* %trin(% 'i!! !o%e it% preci%ion urin( t&e con0er%ion proce%%<

59

PID CONTROLLER TUNING USING GENETIC ALGORITHM

A% a re%u!t o# t&i% an t&e #act t&at t&e* u%e !e%% memor*6 rea! 8#!oatin( point: number% 'i!! be u%e to enco e t&e popu!ation< T&i% i% %i(ni#ie in t&e option% comman in "i(ure 2?6 '&ere t&e T2e1A; term i% t&e #!oatin( point preci%ion an t&e T2; term in icate% t&at rea! number% are bein( u%e 83 in icate% binar* enco in( i% bein( u%e :< Initialisega . T&i% comman i% #rom t&e GAOT too!bo=< It 'i!! combine% a!! t&e pre0iou%!* e%cribe term% an create% an initia! popu!ation o# ,3 rea! 0a!ue member% bet'een <233 an 233 'it& A ecima! p!ace preci%ion<

2.3 S&**i+, Th& GA Para &*&r'


T&e #o!!o'in( are co e% #or %ettin( up t&e GA< T&e etai!% o# t&e co e u%e 'i!! be e=p!aine be!o'< HSettin( t&e parameter% #or t&e (enetic a!(orit&m boun %OL1233 233I1233 233I1233 233MI e0a!"NO;PIDSobj#unSMSE;IHc&an(e t&i% to re!e0ant object #unction e0a!Op%OLMI %tartPopOinitPopI opt%OL2e1A 2 3MI term"NO;ma=GenTerm;I termOp%O233I %e!ect"NO;normGeomSe!ect;I %e!ectOp%O3<3,I =O0er"N%O;arit&Po0er;I =O0erOp%O-I mut"N%O;uni#Mutation;I mutOp%O,I

60

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 43< Parameter% Settin( O# GA<

Bounds - T&e 0ariab!e boun are #or t&e (enetic a!(orit&m to %earc& 'it&in a %peci#ie area< T&e%e boun % ma* be i##erent #rom t&e one% u%e to initia!i@e t&e popu!ation an t&e* (enetic a!(orit&m< startPop - T&e %tartin( popu!ation o# t&e GA6 TstartPop;6 i% e#ine a% t&e popu!ation e%cribe in t&e pre0iou% %ection i<e< TinitPop;6 %ee "i(ure 2?< opts - T&e option% #or t&e Genetic A!(orit&m con%i%t o# t&e preci%ion o# t&e %trin( 0a!ue% i<e< 2e1A6 t&e ec!aration o# rea! co e 0a!ue%6 26 an a re$ue%t #or t&e pro(re%% o# t&e GA to be i%p!a*e 6 26 or %uppre%%e 6 3<
TermFN - T&i% i% t&e ec!aration o# t&e termination #unction #or t&e (enetic

e#ine t&e entire %earc& %pace #or t&e

a!(orit&m< T&i% i% u%e to terminate t&e (enetic a!(orit&m once certain criterion &a% been met< In t&i% project6 e0er* GA 'i!! be terminate '&en it reac&e% a certain number o# (eneration% u%in( t&e Tma=GenTerm; #unction< T&i% termination met&o a!!o'% #or more contro! o0er t&e compi!e time t&at i% t&e amount o# time it ta5e% #or t&e (enetic a!(orit&m to reac& it% termination criterion o# t&e (enetic a!(orit&m '&en compare 'it& ot&er termination criteria e<(< con0er(ence termination criterion< TermOps - T&i% comman e#ine% t&e option%6 i# an*6 #or t&e termination

#unction< In t&i% e=amp!e t&e termination option% are %et to 2336 '&ic& mean% t&at t&e GA 'i!! repro uce one &un re (eneration% be#ore terminatin(< T&i% number ma* be a!tere to be%t %uit t&e con0er(ence criteria o# t&e (enetic a!(orit&m i<e< i# t&e GA con0er(e% $uic5!* t&en t&e termination option% %&ou! be re uce <
61

PID CONTROLLER TUNING USING GENETIC ALGORITHM

SelectFN - Norma!i%e

(eometric %e!ection 8TnormGeomSe!ect;: i% t&e

primar* %e!ection proce%% to be u%e in t&i% project< T&e GAOT too!bo= pro0i e% t'o ot&er %e!ection #unction%6 Tournament %e!ection an Rou!ette '&ee! %e!ection< Tournament %e!ection &a% a !on(er compi!ation time t&an t&e re%t an a% t&e o0era!! run time o# t&e (enetic a!(orit&m i% an i%%ue6 tournament %e!ection 'i!! not be u%e < T&e rou!ette '&ee! option i% inappropriate ue to t&e rea%on% mentione in %ection 4<-< SelectOps - B&en u%in( t&e TnormGeomSe!ect; option6 t&e on!* parameter t&at &a% to be ec!are i% t&e probabi!it* o# %e!ectin( t&e #itte%t c&romo%ome o# eac& (eneration6 in t&i% e=amp!e t&i% probabi!it* i% %et to 3<3,< OverFN - Arit&metic cro%%o0er 'a% c&o%en a% t&e cro%%o0er proce ure< Sin(!e point cro%%o0er i% too %imp!i%tic to 'or5 e##ecti0e!* on a c&romo%ome 'it& t&ree a!!e!e%6 a more uni#orm cro%%o0er proce ure t&rou(&out t&e c&romo%ome i% re$uire < Heuri%tic cro%%o0er 'a% i%car e becau%e it per#orm% t&e cro%%o0er proce ure a number o# time% an t&en pic5% t&e be%t one< T&i% increa%e% t&e compi!ation time o# t&e pro(ram an i% un e%irab!e< T&e Arit&metic cro%%o0er proce ure i% %peci#ica!!* u%e #or #!oatin( point number% an i% t&e i ea! cro%%o0er option #or u%e in t&i% project< OverOptions -T&i% i% '&ere t&e number o# cro%%o0er point% i% %peci#ie < mutFNs - T&e Tmu!tiNonUni#Mutation;6 or mu!ti non1uni#orm!* i%tribute mutation operator6 'a% c&o%en a% t&e mutation operator a% it i% con%i ere to #unction 'e!! 'it& mu!tip!e 0ariab!e%< MutOps - T&e mutation operator ta5e% in t&ree option% '&en u%in( t&e Tmu!tiNonUni#Mutation; #unction< T&e #ir%t i% t&e tota! number o# mutation%6 norma!!* %et 'it& a probabi!it* o# aroun 3<2H< T&e %econ parameter i% t&e ma=imum number o# (eneration% an t&e t&ir parameter i% t&e %&ape o# t&e
62

PID CONTROLLER TUNING USING GENETIC ALGORITHM

i%tribution< T&i% !a%t parameter i% %et to a 0a!ue o# t'o6 t&ree or #our '&ere t&e number re#!ect% t&e 0ariance o# t&e i%tribution<

2.1 P&r%!r i+, Th& G&+&*i) A(,!ri*h


T&e (enetic a!(orit&m i% compi!e u%in( t&e comman %&o'n in "i(ure < T&e #unction T,a. ; 'i!! e0a!uate an iterate t&e (enetic a!(orit&m unti! it #u!#i!% t&e criteria e%cribe b* it% termination #unction< HPer#ormin( t&e (enetic a!(orit&m L=6en Pop6bPop6traceIn#oMO(a8boun %6e0a!"N6e0a!Op%6%tartP op6opt%6<<< term"N6termOp%6%e!ect"N6%e!ectOp%6=O0er"N%6=O0erOp%6m ut"N%6mutOp%:I

"i(ure 42< Per#ormin( T&e GA<

Once t&e (enetic a!(orit&m i% comp!ete 6 t&e abo0e #unction 'i!! return #our 0ariab!e%+ = O T&e be%t popu!ation #oun urin( t&e GA< en Pop O T&e GA<% #ina! popu!ation< be%tPop O T&e GA<% be%t %o!ution trac5e o0er (eneration%< traceIn#o O T&e be%t 0a!ue an a0era(e 0a!ue #or eac& (eneration< T&e be%t popu!ation ma* be p!otte to (i0e an in%i(&t into &o' t&e (enetic A!(orit&m con0er(e to it% #ina! 0a!ue% a% i!!u%trate in "i(ure 44<

63

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 44< I!!u%tration O# Genetic A!(orit&m Con0er(in( T&rou(& Generation%<

2.2 Th& O46&)*i7& F#+)*i!+ O% Th& G&+&*i) A(,!ri*h


T&i% i% t&e mo%t c&a!!en(in( part o# creatin( a (enetic a!(orit&m i% 'ritin( t&e objecti0e #unction< In t&i% project6 t&e objecti0e #unction i% re$uire to e0a!uate t&e be%t PID contro!!er #or t&e %*%tem< An objecti0e #unction cou! be create to #in a PID contro!!er t&at (i0e% t&e %ma!!e%t o0er%&oot6 #a%te%t ri%e time or $uic5e%t %ett!in( time< Ho'e0er in or er to combine a!! o# t&e%e objecti0e% it 'a% eci e to e%i(n an objecti0e #unction t&at 'i!! minimi@e t&e error o# t&e contro!!e %*%tem in%tea < Eac& c&romo%ome in t&e
64

PID CONTROLLER TUNING USING GENETIC ALGORITHM

popu!ation i% pa%%e

into t&e objecti0e #unction one at a time< T&e

c&romo%ome i% t&en e0a!uate an a%%i(ne a number to repre%ent it% #itne%%6 t&e bi((er it% number t&e better it% #itne%%< T&e (enetic a!(orit&m u%e% t&e c&romo%ome;% #itne%% 0a!ue to create a ne' popu!ation con%i%tin( o# t&e #itte%t member%< )e!o' are t&e co e% #or t&e Objecti0e "unction<

#unction L=Spop6 #=S0a!MOPIDSobj#unSMSE8=Spop6option%: (!oba! %*%Scontro!!e (!oba! time (!oba! %*%r! H Sp!ittin( t&e c&romo%one% into / %eparate %trin(%< FpO=Spop84:I FiO=Spop8/:I F O=Spop82:I Hcreatin( t&e PID contro!!er #rom current 0a!ue% pi S enOL2 3MI pi SnumOLF Fp FiMI pi S%*%Ot#8pi Snum6pi S en:I Ho0era!! PID contro!!er

"i(ure 4/< Objecti0e "unction

Eac& c&romo%ome con%i%t% o# t&ree %eparate %trin(% con%titutin( a P6 I an D term6 a% popu!ation< B&en t&e c&romo%ome enter% t&e e0a!uation #unction6 it i% %p!it up into it% t&ree Term%< T&e P6 I an D (ain% are u%e to create a PID contro!!er accor in( to t&e e$uation be!o'< e#ine b* t&e /1ro' Tboun %; ec!aration '&en creatin( t&e

65

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&e ne'!* #orme PID contro!!er i% p!ace in a unit* #ee bac5 !oop 'it& t&e S*%tem;% tran%#er #unction< T&i% 'i!! re%u!t in a re uction o# t&e compi!ation time o# t&e pro(ram< T&e %*%tem tran%#er #unction i% e#ine in anot&er #i!e an importe a% a (!oba! 0ariab!e< T&e contro!!e %*%tem i% t&en (i0en a %tep input an t&e error i% a%%e%%e u%in( an error per#ormance criterion %uc& a% Mean S$uare Error or in %&ort MSE< T&e MSE i% an accepte mea%ure o# contro! an o# $ua!it* but it% practica! u%e a% a mea%ure o# $ua!it* i% an o0era!! #itne%% 0a!ue %ome&o' !imite < T&e c&romo%ome i% a%%i(ne

accor in( to t&e ma(nitu e o# t&e error6 t&e %ma!!er t&e error t&e !ar(er t&e #itne%% 0a!ue< )e!o' i% t&e co e% u%e to imp!ement t&e MSE per#ormance criteria<

HCa!cu!atin( t&e error #or iO2+/32 error8i: O 21*8i:I en HCa!cu!atin( t&e MSE errorS%$ O errorUerror;I MSEOerrorS%$9ma=8%i@e8error::I

"i(ure 4-< Ca!cu!atin( t&e error o# t&e %*%tem u%in( MSE citeria<

A itiona! co e 'a% a

e to en%ure t&at t&e (enetic a!(orit&m con0er(e% to

a contro!!er t&at pro uce% a %tab!e %*%tem< T&e co e6 %&o'n in "i(ure 4.6
66

PID CONTROLLER TUNING USING GENETIC ALGORITHM

a%%e%%e% t&e po!e% o# t&e contro!!e %*%tem an i# t&e* are #oun to be un%tab!e t&at i% on t&e ri(&t &a!# o# t&e %1p!ane6 t&e error i% a%%i(ne an e=treme!* !ar(e 0a!ue to ma5e %ure t&at t&e c&romo%ome i% not re%e!ecte <

HEn%urin( contro!!e %*%tem i% %tab!e po!e%Opo!e8%*%Scontro!!e :I i# po!e%82:V3 MSEO233e/33I e!%ei# po!e%84:V3 MSEO233e/33I e!%ei# po!e%8/:V3 MSEO233e/33I e!%ei# po!e%8-:V3 MSEO233e/33I e!%ei# po!e%8.:V3 MSEO233e/33I en #=S0a!O29MSEI

"i(ure 4.< Stabi!it* O# T&e Contro!!e S*%tem<

2.< R&'#(*' O% Th& I -(& &+*&" G&+&*i) A(,!ri*h C!+*r!((&r

PID

In t&e #o!!o'in( %ection6 t&e re%u!t% o# t&e imp!emente Genetic A!(orit&m PID Contro!!er 'i!! be ana!*@e < T&e GA e%i(ne PID contro!!er i% initia!!* initia!i@e 'it& popu!ation %i@e o# 43 an t&e re%pon%e ana!*@e < It 'a% t&en initia!i@e 'it& popu!ation %i@e o# -36 A36 ,3 an ?3< T&e re%pon%e o# t&e GA e%i(ne PID 'i!! t&en be ana!*@e #or t&e %ma!!e%t o0er%&oot6 #a%te%t ri%e time an t&e #a%te%t %ett!in( time< T&e be%t re%pon%e 'i!! t&en be %e!ecte <

67

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"rom t&e #o!!o'in( re%pon%e%6 t&e GA e%i(ne PID 'i!! be compare to t&e Steepe%t De%cent Gra ient Met&o < T&e %uperiorit* o# GA a(ain%t t&e SDG met&o 'i!! be %&o'n< T&e #o!!o'in( i% t&e p!ot o# t&e GA e%i(ne PID 'it& t&e popu!ation %i@e 43< "rom t&e #i(ure be!o'6 t&e re%pon%e o# t&e GA PID 'i!! be ana!*@e <

"i(ure 4A< PID Re%pon%e Bit& Popu!ation Si@e O# 43<

"rom t&e "i(ure 4A6 t&e re%pon%e o# %*%tem !oo5% rea%onab!e %tab!e< Ho'e0er it can be %een in t&e abo0e p!ot t&at t&ere i% an o##%et in t&e

68

PID CONTROLLER TUNING USING GENETIC ALGORITHM

re%pon%e< Let ob%er0e i# t&e o##%et can be remo0e 'it& a bi((er popu!ation %i@e< T&e%e can be ob%er0e in t&e #uture p!ot%<

"i(ure 4>< Ana!*%i% o# PID Re%pon%e Bit& Popu!ation Si@e O# 43<

"rom t&e abo0e #i(ure 6 t&e etai!% o# t&e %*%tem re%pon%e 'i!! be ana!*@e < T&e pea5 amp!itu e o# t&e re%pon%e i% 2<22< T&e o0er%&oot o# t&e re%pon%e i% 23<AH<T&e %ett!in( time o# t&e re%pon%e i% A<?> %econ % an #ina!!* t&e re%pon%e o# t&e ri%e time i% 3<AAA %econ %< "rom one !oo56 t&e abo0e re%pon%e i% c!a%%ica! PID tunin( met&o a% %&o'n in t&e c&apter -< Ho'e0er &o' oe% it #are a(ain%t t&e one optimi@e u%in( t&e Steepe%t De%cent Gra ient Met&o D T&i% 'i!! be
69

e#inite!* muc& better t&an t&e

PID CONTROLLER TUNING USING GENETIC ALGORITHM

an%'ere a#ter 'e ana!*@e t&e #o!!o'in( re%pon%e%< T&e #o!!o'in( #i(ure epict t&e re%pon%e o# GA e%i(ne PID 'it& t&e popu!ation %i@e o# -3<

"rom t&e #o!!o'in( "i(ure 4, abo0e6 t&e %*%tem re%pon%e i% muc& better t&an t&e one %imu!ate 'it& t&e popu!ation %i@e o# 43< It can be ob%er0e t&at t&e %*%tem o##%et &a% been remo0e < In t&e be!o' p!ot6 t&e etai! o# t&e re%pon%e 'i!! be ana!*@e <

70

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure 4?< Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# -3<

"rom t&e abo0e #i(ure6 t&e etai!% o# t&e re%pon%e 'i!! be ana!*@e < T&e pea5 amp!itu e o# t&e re%pon%e i% 2<3>< T&e o0er%&oot o# t&e re%pon%e i% A<?,H< T&e %ett!in( time o# t&e re%pon%e i% 4<4 %econ % an t&e ri%e time o# 3<A%econ %< "rom t&e #o!!o'in( re%u!t%6 it i% ob0iou% t&at t&e popu!ation o# %i@e -3 &a% returne a better re%u!t% t&an t&e one 'it& t&e popu!ation %i@e o# 43< In t&i% re%pon%e6 t&e o0er%&oot 0a!ue &a% impro0e < T&e %ett!in( time &a% re uce #rom A<?> %econ % to 4<4 %econ %< T&e ri%e time &a% impro0e %!i(&t!* t&at i% 3<A-%econ % a% compare to 3<AAA %econ %< T&e o0era!! re%pon%e i% t&at it &a% impro0e a% compare to t&e one in #i(ure 4><

71

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure /3< Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# A3<

T&e abo0e #i(ure

epict t&e re%pon%e o# t&e GA

e%i(ne

PID 'it&

popu!ation %i@e o# A3< T&e re%pon%e &a% t&e pea5 amp!itu e o# 2<3A< It &a% an o0er%&oot o# .<>-H6 %ett!in( time o# 2<?2 %ec an t&e ri%e time o# 3<A2, %ec< T&i% #urt&er e%tab!i%&e t&at t&e bi((er popu!ation %i@e returne t&e better %*%tem re%pon%e<

72

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure /2< PID Re%pon%e Bit& Popu!ation Si@e O# ,3<

"ina!!* !et% !oo5 at t&e %*%tem re%pon%e o# t&e popu!ation %i@e o# ,3< "rom ob%er0ation6 t&e %*%tem returne a muc& better re%pon%e< Let ana!*@e &o' oe% t&e pre%ent re%pon%e per#orm a(ain%t t&e ot&er GA re%u!t% an #ina!!* t&e one optimi@e 'it& t&e Steepe%t De%cent Gra ient Met&o <

73

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"i(ure /4< Ana!*%i% O# PID Re%pon%e Bit& Popu!ation Si@e O# ,3<

T&e GA e%i(ne PID 'it& popu!ation %i@e o# ,3 &a% t&e #o!!o'in( re%pon%e #actor%< T&e Pea5 Amp!itu e o# 2<3.< O0er%&oot o# -<,AH< Ri%e time o# 3<.?4 %econ %< Sett!in( time o# 2<AA %econ %< T&e popu!ation %i@e o# ?3 an abo0e 'ere trie an t&e pro(ram &a% not %&o'n an* %i(n o# impro0ement in t&e optimi@ation< Hence a eci%ion 'a% ma e to %tic5 to t&e popu!ation %i@e o# ,3 an ana!*@e it a(ain%t t&e Steepe%t De%cent Gra ient Met&o PID optimi@ation< Procee in( 'it& t&e &i(&er popu!ation %i@e 'i!! ta5e up a !ot o# computer memor* %pace< Since t&e Genetic A!(orit&m e%i(ne PID 'it& popu!ation %i@e o# ,3 %eem% to &a0e t&e be%t re%pon%e a% compare to t&e ot&er% re%pon%e%< No' &o' oe%
74

PID CONTROLLER TUNING USING GENETIC ALGORITHM

t&e GA e%i(ne PID %tan % a(ain%t t&e Steepe%t De%cent Gra ient Met&o PIDD T&e #o!!o'in( p!ot 'i!! %&o' t&at t&e GA e%i(ne PID per#orme better t&an t&e Steepe%t De%cent Gra ient Met&o 8SDGM:<

"i(ure //< Re%pon%e O# GA De%i(ne PID Cer%u% Steepe%t De%cent Optimi@ation Met&o <

T&e abo0e ana!*%i% i% %ummari@e in t&e #o!!o'in( tab!e<

Tab!e /< Re%u!t% O# SDGM De%i(ne Contro!!er An GA De%i(ne Contro!!er<


75

PID CONTROLLER TUNING USING GENETIC ALGORITHM

"rom tab!e /6 'e can %ee t&at t&e GA e%i(ne contro!!er &a% a %i(ni#icant Impro0ement o0er t&e SDGM e%i(ne contro!!er< On a0era(e t&e percenta(e impro0ement o# GA contro!!er a(ain%t SDGM contro!!er ran(e #rom /3 H to -3 H 'it& t&e e=ception o# t&e mea%urement on o0er%&oot< In t&e SDGM contro!!er6 it out per#orme t&e GA e%i(ne contro!!er< Ho'e0er t&e %etbac5 i% t&at it i% in#erior '&en it i% compare to t&e ri%e time an t&e %ett!in( time< T&i% i% '&ere GA e=ce!< "ina!!* t&e impro0ement &a% imp!ication on t&e e##icienc* o# t&e %*%tem un er %tu *< In t&e area o# turbine %pee contro! t&e #a%ter re%pon%e to re%earc& %tabi!it*6 t&e better i% t&e re%u!t #or t&e p!ant< T&i% 'i!! be i%cu%%e #urt&er in t&e #o!!o'in( c&apter<

76

PID CONTROLLER TUNING USING GENETIC ALGORITHM

Cha-*&r <
F#r*h&r W!r.' A+" C!+)(#'i!+'
<.5 F#r*h&r W!r.'
It i% &ope t&at t&i% project can be impro0e to inc!u e t&e imp!ementation o# tunin( t&e PID contro!!er 0ia GA in an on!ine en0ironment< T&i% 'i!! &a0e muc& impact in t&e optimi@ation o# t&e %*%tem un er contro! < A% #or t&e %ubject un er %tu *6 i# t&e p!ant or t&e turbine %*%tem can be tune u%in( GA in an on!ine en0ironment6 t&ere 'i!! be minimum !o%%e% on t&e proce%%< T&e %team u%e to ri0e t&e turbine 'i!! be #u!!* uti!i@e an t&e ener(* tran%#erre ma=imi@e < T&ere 'i!! be minimum !o%% %ince t&e re%pon%e %&o'n abo0e i% a% c!o%e to t&e unit %tep< Hence in t&e re#inerie%6 t&i% 'i!! tran%!ate to better pro#it mar(in

<.8 C!+)(#'i!+'
In conc!u%ion t&e re%pon%e% a% %&o'n in c&apter .6 &a %&o'e to u% t&at t&e e%i(ne PID 'it& GA &a% muc& #a%ter re%pon%e t&an u%in( t&e c!a%%ica! met&o < T&e c!a%%ica! met&o i% (oo #or (i0in( u% a% t&e %tartin( point o# '&at are t&e PID 0a!ue%< Ho'e0er a% %&o'n in c&apter -6 t&e approac&e in eri0in( t&e initia! PID 0a!ue% u%in( c!a%%ica! met&o i% rat&er troub!e%ome<

77

PID CONTROLLER TUNING USING GENETIC ALGORITHM

T&ere are man* %tep% an a!%o b* tria! an error in (ettin( t&e PID 0a!ue% be#ore *ou can narro' o'n in (ettin( c!o%e to t&e optimi@e 0a!ue%< An optimi@e a!(orit&m 'a% imp!emente in t&e %*%tem to %ee an %tu * &o' t&e %*%tem re%pon%e i%< T&i% 'a% ac&ie0e t&rou(& imp!ementin( t&e %teepe%t e%cent (ra ient met&o < T&e re%u!t 'a% (oo but a% 'a% %&o'n in Tab!e / an "i(ure //< Ho'e0er t&e GA e%i(ne PID i% muc& better in term% o# t&e ri%e time an t&e %ett!in( time< T&e %teepe%t e%cent (ra ient met&o &a% no o0er%&oot but ue to it% nature o# T&i!! c!imbin(;6 it %u##er% in term% o# ri%e time an %ett!in( time< Bit& re%pect to t&e computationa! time6 it i% notice t&at t&e SDGM

optimi@ation ta5e% a !on(er time to reac& it pea5 a% compare to t&e one e%i(ne 'it& GA< T&i% i% not a po%iti0e point i# *ou are to imp!ement t&i% met&o in an on!ine en0ironment< It on!* mean% t&at t&e SDGM u%e% more memor* %pace% an &ence ta5e up more time to reac& t&e pea5< T&i% project &a% e=po%e me to 0ariou% PID contro! %trate(ie%< It &a%

increa%e m* 5no'!e (e in Contro! En(ineerin( an Genetic A!(orit&m in %peci#ic< It &a% a!%o %&o'n me t&at t&ere are numerou% met&o % o# PID tunin(% a0ai!ab!e in t&e aca emic% an in u%tria! #ie! %< Pre0iou%!* I 'a% com#ortab!e 'it& E1N c!a%%ica! met&o % but no' I 'ou! !i5e to 0enture into ot&er% met&o % a0ai!ab!e< "ina!!* t&i% project &a% ma e me more appreciati0e o# t&e Contro! En(ineerin( an it% contribution to t&e impro0ement o# t&e in u%tria! an %ociet*< T&e #act i%6 in e0er* a%pect o# our !i#e6 Contro! En(ineerin( i% a!'a*% 'it& u%< Let it be in our room6 in our car or e0en in t&e comp!e=
78

PID CONTROLLER TUNING USING GENETIC ALGORITHM

app!ication o# t&e )io1me ica! #ie! < A% our !i#e impro0e% 'it& more automate %*%tem a0ai!ab!e in our ai!* !i#e6 be con%ciou% t&at t&e bac5(roun o# t&e%e &appenin( i% t&e 'or5in( o# contro! en(ineerin(<

79

PID CONTROLLER TUNING USING GENETIC ALGORITHM

R&%&r&+)&'
L2M A%trom6 F<6 T< Ha((!un 6 <P D !ontrollers2 Theor#, Design and Tuning.6 In%trument Societ* o# America6 Re%earc& Trian(!e Par56 433.< L4M Go! ber(6 Da0i E< <Genetic Algorithms in Search, Optimization and Machine Learning<A i%on1Be%!e* Pub< Co< 433/< L/M C&ri% Houc56 Ge## Goine%6 an Mi5e Fa*6 3A Genetic Algorithm $or 0unction Optimization" A Matla& mplementation3 NCSU1IE TR ?.13?6 2??.<&ttp+99'''<ie<nc%u<e u9mira(e9GAToo!)o=9(aot9 L-M G<G< )atta(!ia an G<M< Ma*nar 6 < Mean s4uare %rror" A *se$ul Tool $or Statistical Process Management6 AMP G< Tec&no!< 46 ->1..6 4332< L.M J<Ban(6 P<Spronc5 7 R<Trac&t6 . An O(er(ie) O$ Genetic Algorithms Applied To !ontrol %ngineering Pro&lems, Procee in(% o# t&e Secon Con#erence on Mac&ine Learnin( an C*bernetic%6 4333< LAM Lu5e6S<6 )a!an6 G<C< an Panait6 L6 <Population mplosion n Genetic Programming<6 Department O# Computer Science6 Geor(e Ma%on Uni0er%it*<&ttp+99'''<c%<(mu<e u9Wec!ab L>M Got%&a!!6S< an Con#erence64333< R*!an er6 )<6 <Optimal Population Size And The E0o!utionar* Computation

GeneticAlgoithm.<6 Proc On Genetic An

80

PID CONTROLLER TUNING USING GENETIC ALGORITHM

L,M Naeem6 B<6 Sutton6 R< C&u !e*< G6 Da!(!ei%&6 "<R< an Tet!o'6 S< An Online Genetic Algorithm Based Model Predicti(e !ontrol Autopilot Design ,ith %'perimental 5eri$ication.< Internationa! Gourna! O# Contro!6 Co! >,6 No< 2-6 p( 23>A < 23?36 September 4333< L?M S5o(e%ta 6 S<6 Pro&a&l# The Best Simple P D Tuning +ules n The ,orld<< Gourna! O# Proce%% Contro!6 September 4333< L23M Herrero6 G<M<6 )!a%co6 P6 Martine@6 M an Sa!ce o6 G<C<6 <Optimal P D Tuning ,ith Genetic Algorithm 0or 6on Linear Process Models<2.t& Triennia! Bor! Con(re%%6 2???< L22M O<D'*er6 A< <P And P D !ontroller Tuning +ules 0or Time Dela# Process" A Summar#. Part ." P !ontroller Tuning +ules<Procee in(% O# Iri%& Si(na!% An S*%tem% Con#erence6 Gune 2???< L24M F< Fri%&na5umar an D< E< Go! ber(6 <!ontrol S#stem Optimization *sing Genetic Algorithms< Gourna! o# Gui ance6 Contro! an D*namic%6 Co!< 2.6 No< /6 pp< >/.1>-36 2??4< L2/M T O< Ma&on*6 C G Do'nin( an F "at!a6 Genetic Algorithm $or P D Parameter Optimization" Minimizing %rror !riteria< Proce%% Contro! an In%trumentation 4333 4A14, Gu!* 43336 Uni0er%it* o# Stract&c!* e6 p( 2-,1 2./6 Gu!* 2??,<

81

PID CONTROLLER TUNING USING GENETIC ALGORITHM

A--&+"iA 5
S*&&-&'*B"&')&+*B%!rB'*&-.
%------------------------------------------------------------clear pack clc format long e M = 1601; %number of samples taken starting from nT=0 T = 0.0025; %in second r = ones(1,M); %Unit step signal q0 = 0.001; q1 = -q0; q2 = 0; initial_q = [q0 q1 q2]; s_old = []; %store the value of s delta_q = 0.00009; gamma = 0.005; %step length number_of_trial = 51; for index = 1:1:number_of_trial, %Finding S [k,e] = e_function(T,q0,q1,q2,r); s = abs(e)*k'; %absolute value of matrix e multiply %with transpose of matrix k %Finding S_q0 [k,e] = e_function(T,(q0+delta_q),q1,q2,r); s_q0 = abs(e)*k'; %Finding S_q1 [k,e] = e_function(T,q0,(q1+delta_q),q2,r); s_q1 = abs(e)*k'; %Finding S_q2 [k,e] = e_function(T,q0,q1,(q2+delta_q),r); s_q2 = abs(e)*k'; grad_of_s_due_to_q0 = (s_q0-s)/delta_q; grad_of_s_due_to_q1 = (s_q1-s)/delta_q; grad_of_s_due_to_q2 = (s_q2-s)/delta_q; delta = sqrt(grad_of_s_due_to_q0^2+... grad_of_s_due_to_q1^2+... grad_of_s_due_to_q2^2); constant_p = gamma/delta;

q0_old = q0;

82

PID CONTROLLER TUNING USING GENETIC ALGORITHM

q1_old = q1; q2_old = q2; if index < number_of_trial, s_old = s; end q0 = q0 - constant_p * grad_of_s_due_to_q0; q1 = q1 - constant_p * grad_of_s_due_to_q1; q2 = q2 - constant_p * grad_of_s_due_to_q2; end save try_step initial_q q0 q1 q2 T r index delta_q gamma save try_step_backcopy initial_q q0_old q1_old q2_old s_old save try_step_backcopy q0 q1 q2 s T r index delta_q gamma -append disp('Previous value q0 q1 q2 s') [q0_old,q1_old,q2_old,s_old] disp('Latest value q0 q1 q2 s') [q0,q1,q2,s] [k,e] = e_function(T,q0,q1,q2,r); c = r - e; plot(k,e) xlabel('time(nT)'),ylabel('e(nT)') title('Error signal,e(nT)') figure(1); plot(k,c) xlabel('time(nT)'),ylabel('c(nT)') title('Output signal,c(nT)') figure(2);

%---------------------------------------------------------------------

EBF#+)*i!+.
function [k,e]=e_function(T,q0,q1,q2,r)

83

PID CONTROLLER TUNING USING GENETIC ALGORITHM

%E_FUNCTION % % % % % % % % % % % %

Calculate the error signal, e(nT) in a closed loop system The format is given as [k,e]=e_function(T,q0,q1,q2,r) r is the input signal which starts from nT = 0. Since the E_FUNCTION is derived using 'nT', r should be a function of 'nT'. T is the sample period. q0, q1, q2, are the parameters of a digital PID controller. E_FUNCTION returns the error ouput, e and matrix k which contains [0 T 2T 3T ...].

%Check the number of input arguments if nargin < 5, error('The number of input arguments is less than 5.'); end %Check the number of output arguments if nargout < 2, error('The number of output arguments is less than 2.'); end A = 2*exp(-5*T)+1+exp(-T); B = exp(-5*T)+exp(-6*T); B1 B2 B3 B4 B5 B6 = = = = = = q0; q1; q2; (1+A); (A+B); B;

D=2+B1; [n,M] = size(r); signal_r = r; r = [0 0 0 0]; %Make a copy of signal r(nT) %r(1) %r(2) %r(3) %r(4) point point point point to to to to r(nT); r(nT-T); r(nT-2T); r(nT-3T); to to to to e(nT); e(nT-T); e(nT-2T); e(nT-3T);

e_temp = [0 0 0 0 ];

%e_temp(1) %e_temp(2) %e_temp(3) %e_temp(4)

point point point point

for k = 1:1:M,

r(1) = signal_r(k); e_temp(1) = (2/D)*r(1)+(B4/D)*r(2)+(B5/D)*r(3)+(B6/D)*r(4)-... ((B4+B2)/D)*e_temp(2)-((B5+B3)/D)*e_temp(3)-...

84

PID CONTROLLER TUNING USING GENETIC ALGORITHM

(B6/D)*e_temp(4);

e(k)=e_temp(1); r(4)=r(3); r(3)=r(2); r(2)=r(1); e_temp(5)=e_temp(4); e_temp(4)=e_temp(3); e_temp(3)=e_temp(2); e_temp(2)=e_temp(1); end k=T*[0:1:M-1]; %The time that a particular sample is taken

%----------------------------------------------------------------

I+i*ia(BPIDBGA.
%____________________________________________________________________ clc clear

85

PID CONTROLLER TUNING USING GENETIC ALGORITHM

close all global sys_controlled global time global sysrl %Plant. %____________________________________________________________________ %Defining sysrl den1=[1 6 5 0]; num1=[1]; sysrl=tf(num1,den1); %____________________________________________________________________ %Initialising the genetic algorithm populationSize=80; variableBounds=[-100 100;-100 100;-100 100]; evalFN='PID_objfun_MSE'; %Change this to relevant object function evalOps=[]; options=[1e-6 1]; initPop=initializega(populationSize,variableBounds,evalFN,... evalOps,options); %____________________________________________________________________ %Setting the parameters for the genetic algorithm bounds=[-100 100;-100 100;-100 100]; evalFN='PID_objfun_MSE';%change this to relevant object function evalOps=[]; startPop=initPop; opts=[1e-6 1 0]; termFN='maxGenTerm'; termOps=100; selectFN='normGeomSelect'; selectOps=0.08; xOverFNs='arithXover'; xOverOps=4; mutFNs='unifMutation'; mutOps=8; %____________________________________________________________________ %Iterating the genetic algorithm [x,endPop,bPop,traceInfo]=ga(bounds,evalFN,evalOps,startPop,opts,... termFN,termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps); %____________________________________________________________________ %Plotting Genetic algorithm controller den1=[1 6 5 0]; num1=[1]; sysrl=tf(num1,den1); %Creating the optimal PID controller from GA results ga_pid=tf([x(1) x(2) x(3)],[1 0]); ga_sys=feedback(series(ga_pid,sysrl),1); figure(1) hold on; step(ga_sys,time,'g');%Green-genetic algorithm %____________________________________________________________________ %Plotting best population progress figure(2) subplot(3,1,1),plot(bPop(:,1),bPop(:,3)),... title('Kp Value'),, ylabel('Gain'); subplot(3,1,2),plot(bPop(:,1),bPop(:,4)),... title('Ki Value'),, ylabel('Gain'); subplot(3,1,3),plot(bPop(:,1),bPop(:,2)),... title('Kd Value'),xlabel('Generations'), ylabel('Gain');

86

PID CONTROLLER TUNING USING GENETIC ALGORITHM

%____________________________________________________________________

PIDSobj#unSm%e<m
%____________________________________________________________________ function [x_pop, fx_val]=PID_objfun_MSE(x_pop,options) global sys_controlled global time global sysrl %____________________________________________________________________ Kp=x_pop(2);

87

PID CONTROLLER TUNING USING GENETIC ALGORITHM

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); %overall PID controller %Placing PID controller in unity feedback system with 'sysrl' sys_series=series(pid_sys,sysrl); sys_controlled=feedback(sys_series,1); %____________________________________________________________________ time =0:0.1:30; [y t] = step(sys_controlled,time); % Step response of closed-loop system %____________________________________________________________________ %Calculating the error for i=1:301 error(i) = 1-y(i); end %Calculating the MSE error_sq = error*error'; MSE=error_sq/max(size(error)); %____________________________________________________________________ %Ensuring controlled system is stable poles=pole(sys_controlled); if poles(1)>0 MSE=100e300; elseif poles(2)>0 MSE=100e300; elseif poles(3)>0 MSE=100e300; elseif poles(4)>0 MSE=100e300; elseif poles(5)>0 MSE=100e300; end fx_val=1/MSE; %____________________________________________________________________

Ma*(a4 C!"&' Fr! Ga.

GAOT

%------------------------------------------------------------------function [x,endPop,bPop,traceInfo] = ga(bounds,evalFN,evalOps,startPop,opts,... termFN,termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps) % GA run a genetic algorithm % function

88

PID CONTROLLER TUNING USING GENETIC ALGORITHM

%[x,endPop,bPop,traceInfo]=ga(bounds,evalFN,evalOps,startPop,opts, % %termFN,termOps,selectFN,selectOps, % %xOverFNs,xOverOps,mutFNs,mutOps) % % Output Arguments: % x - the best solution found during the course of the run % endPop - the final population % bPop - a trace of the best population % traceInfo - a matrix of best and means of the ga for each %generation % % Input Arguments: % bounds - a matrix of upper and lower bounds on the variables % evalFN - the name of the evaluation .m function % evalOps - options to pass to the evaluation function ([NULL]) % startPop - a matrix of solutions that can be initialized % from initialize.m % opts - [epsilon prob_ops display] change required to %consider two % solutions different, prob_ops 0 if you want to apply %the % genetic operators probabilisticly to each solution, %1 if % you are supplying a deterministic number of operator % applications and display is 1 to output progress 0 %for % quiet. ([1e-6 1 0]) % termFN - name of the .m termination function (['maxGenTerm']) % termOps - options string to be passed to the termination %function % ([100]). % selectFN - name of the .m selection function %(['normGeomSelect']) % selectOpts - options string to be passed to select after % select(pop,#,opts) ([0.08]) % xOverFNS - a string containing blank seperated names of Xover.m % files (['arithXover heuristicXover simpleXover']) % xOverOps - A matrix of options to pass to Xover.m files with %the % first column being the number of that xOver to %perform % similiarly for mutation ([2 0;2 3;2 0]) % mutFNs - a string containing blank seperated names of %mutation.m % files (['boundaryMutation multiNonUnifMutation ... % nonUnifMutation unifMutation']) % mutOps - A matrix of options to pass to Xover.m files with %the % first column being the number of that xOver to %perform % similiarly for mutation ([4 0 0;6 100 3;4 100 3;4 0 0]) % % Binary and Real-Valued Simulation Evolution for Matlab % Copyright (C) 1996 C.R. Houck, J.A. Joines, M.G. Kay % % C.R. Houck, J.Joines, and M.Kay. A genetic algorithm for function % optimization: A Matlab implementation. ACM Transactions on

89

PID CONTROLLER TUNING USING GENETIC ALGORITHM

%Mathmatical % Software, Submitted 1996. % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 1, or (at your option) % any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. A copy of the GNU % General Public License can be obtained from the % Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. %%$Log: ga.m,v $ %Revision 1.10 1996/02/02 15:03:00 jjoine % Fixed the ordering of imput arguments in the comments to match % the actual order in the ga function. % %Revision 1.9 1995/08/28 20:01:07 chouck % Updated initialization parameters, updated mutation parameters to reflect % b being the third option to the nonuniform mutations % %Revision 1.8 1995/08/10 12:59:49 jjoine %Started Logfile to keep track of revisions % n=nargin; if n<2 | n==6 | n==10 | n==12 disp('Insufficient arguements') end if n<3 %Default evalation opts. evalOps=[]; end if n<5 opts = [1e-6 1 0]; end if isempty(opts) opts = [1e-6 1 0]; end

if any(evalFN<48) %Not using a .m file if opts(2)==1 %Float ga e1str=['x=c1; c1(xZomeLength)=', evalFN ';']; e2str=['x=c2; c2(xZomeLength)=', evalFN ';']; else %Binary ga e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',... evalFN ';']; end else %Are using a .m file if opts(2)==1 %Float ga e1str=['[c1 c1(xZomeLength)]=' evalFN '(c1,[gen evalOps]);']; e2str=['[c2 c2(xZomeLength)]=' evalFN '(c2,[gen evalOps]);']; else %Binary ga e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' evalFN ...

90

PID CONTROLLER TUNING USING GENETIC ALGORITHM

'(x,[gen evalOps]); endPop(j,:)=[f2b(x,bounds,bits) v];']; end end if n<6 %Default termination information termOps=[100]; termFN='maxGenTerm'; end if n<12 %Default muatation information if opts(2)==1 %Float GA mutFNs=['boundaryMutation multiNonUnifMutation nonUnifMutation unifMutation']; mutOps=[4 0 0;6 termOps(1) 3;4 termOps(1) 3;4 0 0]; else %Binary GA mutFNs=['binaryMutation']; mutOps=[0.05]; end end if n<10 %Default crossover information if opts(2)==1 %Float GA xOverFNs=['arithXover heuristicXover simpleXover']; xOverOps=[2 0;2 3;2 0]; else %Binary GA xOverFNs=['simpleXover']; xOverOps=[0.6]; end end if n<9 %Default select opts only i.e. roullete wheel. selectOps=[]; end if n<8 %Default select info selectFN=['normGeomSelect']; selectOps=[0.08]; end if n<6 %Default termination information termOps=[100]; termFN='maxGenTerm'; end if n<4 %No starting population passed given startPop=[]; end if isempty(startPop) %Generate a population at random

%startPop=zeros(80,size(bounds,1)+1); startPop=initializega(80,bounds,evalFN,evalOps,opts(1:2)); end if opts(2)==0 %binary bits=calcbits(bounds,opts(1)); end xOverFNs=parse(xOverFNs); mutFNs=parse(mutFNs); xZomeLength = size(startPop,2); %Length of the xzome=numVars+fittness numVar = xZomeLength-1; %Number of variables popSize = size(startPop,1); %Number of individuals in the pop endPop = zeros(popSize,xZomeLength); %A secondary population

91

PID CONTROLLER TUNING USING GENETIC ALGORITHM

matrix c1 = zeros(1,xZomeLength); %An individual c2 = zeros(1,xZomeLength); %An individual numXOvers = size(xOverFNs,1); %Number of Crossover operators numMuts = size(mutFNs,1); %Number of Mutation operators epsilon = opts(1); %Threshold for two fittness to differ oval = max(startPop(:,xZomeLength)); %Best value in start pop bFoundIn = 1; %Number of times best has changed done = 0; %Done with simulated evolution gen = 1; %Current Generation Number collectTrace = (nargout>3); %Should we collect info every gen floatGA = opts(2)==1; %Probabilistic application of ops display = opts(3); %Display progress while(~done) %Elitist Model [bval,bindx] = max(startPop(:,xZomeLength)); %Best of current pop best = startPop(bindx,:); if collectTrace traceInfo(gen,1)=gen; %current generation traceInfo(gen,2)=startPop(bindx,xZomeLength); %Best fittness traceInfo(gen,3)=mean(startPop(:,xZomeLength)); %Avg fittness traceInfo(gen,4)=std(startPop(:,xZomeLength)); end if ( (abs(bval - oval)>epsilon) | (gen==1)) % if display fprintf(1,'\n%d %f\n',gen,bval); %Update the display end if floatGA bPop(bFoundIn,:)=[gen startPop(bindx,:)]; %Update bPop Matrix else bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)... startPop(bindx,xZomeLength)]; end bFoundIn=bFoundIn+1; %Update number of changes oval=bval; %Update the best val else if display fprintf(1,'%d ',gen); %Otherwise just update num gen end

end endPop = feval(selectFN,startPop,[gen selectOps]); %Select if floatGA %Running with the model where the parameters are numbers of %ops for i=1:numXOvers, for j=1:xOverOps(i,1), a = round(rand*(popSize-1)+1); %Pick a parent b = round(rand*(popSize-1)+1); %Pick another parent xN=deblank(xOverFNs(i,:)); %Get the name of crossover function [c1 c2] = feval(xN,endPop(a,:),endPop(b,:),bounds,[gen xOverOps(i,:)]); if c1(1:numVar)==endPop(a,(1:numVar)) %Make sure we created a new c1(xZomeLength)=endPop(a,xZomeLength); elseif c1(1:numVar)==endPop(b,(1:numVar)) c1(xZomeLength)=endPop(b,xZomeLength); else %[c1(xZomeLength) c1] = feval(evalFN,c1,[gen evalOps]); eval(e1str); end

92

PID CONTROLLER TUNING USING GENETIC ALGORITHM

if c2(1:numVar)==endPop(a,(1:numVar)) c2(xZomeLength)=endPop(a,xZomeLength); elseif c2(1:numVar)==endPop(b,(1:numVar)) c2(xZomeLength)=endPop(b,xZomeLength); else %[c2(xZomeLength) c2] = feval(evalFN,c2,[gen evalOps]); eval(e2str); end endPop(a,:)=c1; endPop(b,:)=c2; end end for i=1:numMuts, for j=1:mutOps(i,1), a = round(rand*(popSize-1)+1); c1 = feval(deblank(mutFNs(i,:)),endPop(a,:),bounds,[gen mutOps(i,:)]); if c1(1:numVar)==endPop(a,(1:numVar)) c1(xZomeLength)=endPop(a,xZomeLength); else %[c1(xZomeLength) c1] = feval(evalFN,c1,[gen evalOps]); eval(e1str); end endPop(a,:)=c1; end end else %We are running a probabilistic model of genetic operators for i=1:numXOvers, xN=deblank(xOverFNs(i,:)); %Get the name of crossover function cp=find(rand(popSize,1)<xOverOps(i,1)==1); if rem(size(cp,1),2) cp=cp(1:(size(cp,1)-1)); end cp=reshape(cp,size(cp,1)/2,2); for j=1:size(cp,1) a=cp(j,1); b=cp(j,2);

[endPop(a,:) endPop(b,:)] = feval(xN,endPop(a,:),endPop(b,:),... bounds,[gen xOverOps(i,:)]); end end for i=1:numMuts mN=deblank(mutFNs(i,:)); for j=1:popSize endPop(j,:) = feval(mN,endPop(j,:),bounds,[gen mutOps(i,:)]); eval(e1str); end end end gen=gen+1; done=feval(termFN,[gen termOps],bPop,endPop); %See if the ga is done startPop=endPop; %Swap the populations [bval,bindx] = min(startPop(:,xZomeLength)); %Keep the best solution startPop(bindx,:) = best; %replace it with the worst end [bval,bindx] = max(startPop(:,xZomeLength)); if display

93

PID CONTROLLER TUNING USING GENETIC ALGORITHM

fprintf(1,'\n%d %f\n',gen,bval); end x=startPop(bindx,:); if opts(2)==0 %binary x=b2f(x,bounds,bits); bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)... startPop(bindx,xZomeLength)]; else bPop(bFoundIn,:)=[gen startPop(bindx,:)]; end if collectTrace traceInfo(gen,1)=gen; %current generation traceInfo(gen,2)=startPop(bindx,xZomeLength); %Best fittness traceInfo(gen,3)=mean(startPop(:,xZomeLength)); %Avg fittness end %-----------------------------------------------------------------

94

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy