RLC Circuit of February 10, 2011: Difference between revisions
Jump to navigation
Jump to search
(Created page with 'The problem was set up in class starting on [http://people.wallawalla.edu/~Rob.Frohne/ClassNotes/ENGR352/2011/Background/index.php?image=20110210BgDSCN3532.jpg&d=d.html February…') |
No edit summary |
||
Line 52: | Line 52: | ||
TAtotTI=T*Atot*T^(-1); |
TAtotTI=T*Atot*T^(-1); |
||
polestot_transformed=eig(TAtotTI); |
polestot_transformed=eig(TAtotTI); |
||
The controller exacerbates the overshoot because the observer has significant error on one state variable until about .2 seconds. In order to help the situation, we can just not drive the circuit until the observer has caught up. This cuts the overshoot roughly in half. |
Revision as of 10:43, 23 February 2011
The problem was set up in class starting on February 10, 2011. The Octave script below simulates the control system using a full order observer for the states, and assuming that the output voltage is all that is available for measurement.
% This script simulates the RLC circuit from the notes of February 10, % 2011. It uses a full order observer. It also shows how to reorder % the states. It includes a simulation of the system which is very % interesting because it shows how there is a big error in the observer % at first. c=2 %Capacitance R=3 %Resistance L=4 %Inductance A=[[0 -1/L];[1/c -1/(R*c)]] B=[1/L; 0] C=[0 1] D=0 sys1=ss(A,B,C,D); T=fliplr(eye(2)); %Transformation Matrix for swapping states Ar=T*A*T^(-1); %Transformed system Br=T*B; Cr=C*T^(-1); sysr=ss(Ar,Br,Cr,0); Rr=obsv(sysr); %Observability Matrix for swapped states R=obsv(sys1); %Not swapped Observability Matrix rank_r=rank(R); %Is the system observable rank_rr=rank(Rr) g=place(sys1,[-1.5 -2.5]); %Place the poles for the controller printf("Check to see if the place did the right thing.") printf("The poles after feedback are at: ") controller_poles = eig(A-B*g) K=place(A',C',[-33,-30.5])' %Place poles for the observer % Note: you can see the observer problem with poles [-100,-105] % and initial conditions [1 2 3 4] Ahat=A-K*C; printf("Check to see if the place did the right thing.") printf("The poles of the observer are: ") observer_poles = eig(Ahat) Bhat=B; %Make a concatinated system of the observer and system Atot=[[A, -B*g];[K*C, Ahat-Bhat*g]]; Btot=[B;Bhat]; Ctot=eye(size(Atot)); systot=ss(Atot,Btot,Ctot); polestot=pole(systot) t=0:.0001:.5; [X,Y]=lsim(systot, zeros(size(t))', t, [5 5 1 1]'); plot(t,X) legend('x_1','x_2','xhat_1','xhat_2') title('System and Observer Simulation') xlabel('Time (seconds)') % Check the transformed to error terms total system. T=[[1 0 0 0];[0 1 0 0];[1 0 -1 0];[0 1 0 -1]]; TAtotTI=T*Atot*T^(-1); polestot_transformed=eig(TAtotTI);
The controller exacerbates the overshoot because the observer has significant error on one state variable until about .2 seconds. In order to help the situation, we can just not drive the circuit until the observer has caught up. This cuts the overshoot roughly in half.