problem with fmincon to optimize ISE for pid tuning using Bode s ideal trunsfer function
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i am new to MATLAB and i am trying to find the optimum values of Kp,Ti,Td. the objective function i am using is ISE generated in simulink.the code for objective function is given below
function f = objecfun(x)
global Kp Ti Td Y_out
Kp=x(1);
Ti=x(2);
Td=x(3);
tt=0:100;
[t,y]=sim('optimisation_pid_model',tt);% simulink model call
f=Y_out;
the constraint function being function [c,ceq]=nonlinearconstraints(x) global Kp Ti Td Y_out ti_me k=10; a=1; Kp=x(1); Ti=x(2); Td=x(3); s=tf('s'); pid=(x(1) +(x(1)/x(2))*1/s +x(1)*x(3)*s); process=(1.5/(43*s^2 +3*s +1)); open_loop =pid*process; desired_response=((k/s)^a); c=[ x(1) ; x(2); x(3) ]; ceq=[ open_loop - desired_response];
i am not exactly sure whether i can use a transfer function as a constraint.the master program which calls the above 2 functions are given below clc clear mem global Kp Ti Td Y_out ti_me %t_end=100; x0=[1 1 1]; options = optimset('Display','iter','Algorithm','active-set'); [x,fval]=fmincon(@objecfun,x0,[],[],[],[],[],[],@nonlinearconstraints,options);
the simulink file i couldnt upload its ia simple model where the pid is computed with basic blocks like integrator,differentiator etc. THE integral squared error is being calculated in simulink using i/s block and abs block and dumped into a global variable in workspace..the error i am getting is "??? Error using ==> lti.subsref at 56
Use two or more subscripts to select or delete all elements, as in
the "sys(:,:)" command.
Error in ==> fmincon at 668 initVals.ncineq = ctmp(:);
Error in ==> master_program_optimization at 7 [x,fval]=fmincon(@objecfun,x0,[],[],[],[],[],[],@nonlinearconstraints,options); Warning: Direct access of structure fields returned by a function call (e.g., call to lti) is not allowed. See MATLAB 7.10 Release Notes, "Subscripting Into Function Return Values" for details. ??? Error using ==> lti.subsref at 45 No property of the class "subsref" matches the string " "
0 Commenti
Risposte (1)
Taniadi
il 15 Mag 2012
I don't think that the tranfer function can be used as constraint, and one other think, your script cannot be read well!
0 Commenti
Vedere anche
Categorie
Scopri di più su Classical Control Design in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!