% TITLE: CVV.M % DONE BY: Reno Cipolla % DATE: JAN/94 % VERSION 2.0 % COPYRIGHT 1995 T. Marlin and R. Cipolla % This is a function file which calculates the CV overshoot. % ************************************************************************* function CVover = cvv(pvv); % Set all menu variables to global which allows them to be passed from mfile % to mfile. global tau1 tau2 tau3 Kp set deltat dist vp time pv Dyn junk2 rho1 obj distg global tdist D change tset SP t usegrh maxit IAE ISE ITAE tmg boundg violates global cn_t scn_t bound mvtest betaa Kn A useopt td maxdev mindev rise rho chg global epsl p pp bdpos bdneg bd kc ti bgen Xmis vpmis bdmis Kpp ob_j op_ts lim_it global Qp mm theta taulead xi thetad tauleadd xid taud1 taud2 taud3 Kpd x_ ver_sion global c_1 c_2 c_i b_1 b_2 b_i int_kc int_ti o_func le_vel numlev global ss ss1 ss2 ss3 v v1 v2 v3 al_pha save_graph ct_count CVover = 0; l= betaa /deltat; if change == 1 if D > 0 sigm_a = -4*Kn; else sigm_a = 4*Kn; end elseif change == 2 if SP > 0 sigm_a = SP + 4*Kn; else sigm_a = SP - 4*Kn; end end while l < (time/deltat) l=l+1; if sigm_a > 0 if (pvv(l) > sigm_a) CVover = CVover + (pvv(l) - sigm_a)^2; end elseif sigm_a <= 0 if (pvv(l) < sigm_a) CVover = CVover + (abs(pvv(l)) - abs(sigm_a))^2; end end end % end while