Index: mttroot/mtt/lib/control/PPP/ppp_int_obs.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_int_obs.m +++ mttroot/mtt/lib/control/PPP/ppp_int_obs.m @@ -1,6 +1,6 @@ -function [x_p,y_p,error] = ppp_int_obs (x,y,U,A,B,C,D,A_u,delta,L) +function [x_p,y_p,y_new,error] = ppp_int_obs (x,y,U,A,B,C,D,A_u,delta,L) ## usage: x_new = ppp_int_obs (x,y,U,A,B,C,D,A_u,delta,L) ## ## Intermittent observer for PPP ## @@ -8,10 +8,15 @@ ## U PPP control weights ## A,B,C,D System matrices ## A_u PPP basis matrix ## delta time step ## L Observer gain + ## x_p, y_p predicted estimated state and output + ## y_new corrected estimated current output + ## error corresponding error + + ## Copyright (C) 2003 by Peter J. Gawthrop ## Sanity check [n_x,n_u,n_y] = abcddim(A,B,C,D); if nargin<10 @@ -19,10 +24,11 @@ endif ## Corrector (on current value of output) error = (C*x-y); x_new = x - L*error; + y_new = C*x_new; ## Predictor (predicts Delta_OL ahead) [y_p,us,x_p] = ppp_ystar (A,B,C,D,x_new,A_u,U,delta); endfunction Index: mttroot/mtt/lib/control/PPP/ppp_lin_run.m ================================================================== --- mttroot/mtt/lib/control/PPP/ppp_lin_run.m +++ mttroot/mtt/lib/control/PPP/ppp_lin_run.m @@ -209,20 +209,20 @@ [t_i,y_i,u_i] = ppp_put_get(U); # Generic interface to real-time endif ## Observer if strcmp(p_o.method, "intermittent") - [x_est y_est e_est] = ppp_int_obs \ + [x_est y_est y_new, e_est] = ppp_int_obs \ (x_est,y_i,U,A,B,C,D,p_c.A_u,p_c.delta_ol,L); elseif strcmp(p_o.method, "continuous") Ui = U; # U at sub intervals for k = 1:p_c.N - [x_est y_est e_est] = ppp_int_obs \ + [x_est y_est y_new e_est] = ppp_int_obs \ (x_est,yi(:,k),Ui,A,B,C,D,p_c.A_u,dt,L); Ui = A_ud'*Ui; - y_e = [y_e; y_est']; - e_e = [e_e; e_est]; + y_e = [y_e; y_new']; + e_e = [e_e; e_est']; endfor endif ##Control U = K_w*w - K_x*x_est; @@ -238,11 +238,11 @@ u = [u;u_i']; endif if strcmp(p_o.method, "intermittent") - y_e = [y_e; y_est']; + y_e = [y_e; y_new']; e_e = [e_e; e_est']; t_e = [t_e; t_i]; endif delta_comp = time-tim;