You are on page 1of 5
020%6 a o2) tere Nex Boos Control Design with Sela Control Design with Scilab Tuna. January 2012 PID Optimization with Scilab ‘The goalof his exaro's to compute tho optimal prators of 2 PID conte, ‘Te dagram whichis used inthis examle, Fst, wo ina Xeos by loading sme inp Xe rare (ene by cana cos “Tan, wo load sur cigar using inpatXeosDiagram. we = 2etptt09; Faxevalrune = 305, Pract = 2; wact = 2; histep = 26-3; // the celta used to compute finite difference derivative xd = [2)5]s // 1nitial paraneters 11.9 4s proporticnnal to Pract 11-135 proportionnal to 1f2ct Lower = [0.01:0.01); Upper = (2680; 309); global rer: Once is one, we define wo furor + the objective urtion (5) + the wapper tatoos th jet unton athe eptin’ Sb arti “Ta cctv uncon (we nme the aor betwoen tha efeence eral the square generat ana te cutpat srl We lo ty to mime the devtve ofthe opi sigh co 35 la have ome kind of smouh command), function y = # pteOs) floeal Teer: secicos_context.? = x(1)*Pfacts sscicos_context.T = x(2)*2#30ts eto = scicos_simulate(ses_n,List() tscicos_ context, #lage"aw nerve Yoalee = rean(ass(lser(alockeutpue(values”)(:,2))))5 Y= O.sty error + 8.Seity ditty printe(“Gvaluation Xd ~ ipconrcdosignwthslab Mogspol my! rrean(ans((bleck output values")(2)2) block eutput(-vatues")(+,2)))9: Followers (1) 20128) ¥ anus) gf LL AE y =F (yLerrar =, y abet = )\n Ter x(H) X(2),y,9 emer y-abe): 4s 02016 Control Design with Sela Fer the optim we compute the value ofthe bce funtion andthe grade (using the func function [fsd6, in) = £pidesh: y_optin. ptd(xsina) p,oneer=4); (Once these functions ae defied, we Ini ft serulation to oe the iia behavior, 03) +2002); Info = scicos_sinulate(ses ny list() tsekeos context); “ine benavior shown by Xcos Now, we launch he optimization [eopt, Lope) = optingay_optin ot, "b,Lower Upper x algo=" qn", "ar* ha Fay, welaurch a ssrubion using the optimized prams to £08 Ie havo of he oop Uf We tind a good solution, but It doesn't ke Soto account the stabélity of the system. seicos_contextin = 9; scicos_context.P = x_opt(a)*PFacti seicos contexts = xopt(2)*TFact x.opt = [Pfactssfact)."1 o9ts nfo = scicos_sinulate(ses_n,tnfo,45cicos context): ipconrcdosignwthslab Mogspol my! Fane MexEvalFune,te-3,16-3,(1e-3;1¢-3))

You might also like