Control System Lab Report

Lab Report Control System Submitted to: Mr. Usman Submitted by: Junaid Mukhtar 2012-MC-139 Lab Session 1 Introduction

Views 266 Downloads 2 File size 2MB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Lab Report Control System Submitted to: Mr. Usman

Submitted by: Junaid Mukhtar 2012-MC-139

Lab Session 1 Introduction of MATLAB and its application in control system design and analysis.

MATLAB: MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, and Fortran. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing capabilities. An additional package, Simulink, adds graphical multidomain simulation and Model-Based Design fordynamic and embedded systems.

Application of Matlab:       

Mathematical operations Vector Matrices and Matrix operations Solving systems of linear equations Plotting Curve fitting, Interpolation Solving Ordinary Differential Equations

Compiling MATLAB and Toolboxes: MATLAB Compiler supports the full MATLAB language and most MATLAB toolboxes, with some exceptions. For details on compliable features and products.

Control System Toolbox: Control System Toolbox™ provides industry-standard algorithms and apps for systematically analyzing, designing, and tuning linear control systems. You can specify your system as a transfer function, state-space, pole-zero-gain, or frequency-response model. Apps and functions, such as step response plot and Bode plot, let you visualize system behavior in time domain and frequency domain. You can tune compensator parameters using automatic PID controller tuning, Bode loop shaping, root locus method, LQR/LQG design, and other interactive and automated techniques.

Three Steps: There are three major steps which are followed in Control System design.

(1) Building Models: In building models there are two systems  SISO system  MIMO system

SISO Systems: SISO means "single input single output" systems e.g. dc motor speed control. In which we give step input voltage to motor and resulting speed control of dc motor rotor.

MIMO Systems: MIMO means" multiple input multiple outputs" systems e.g. jet transport air craft. All standard model representations are supported, including;  Transfer function  State Space Model  Zeros, poles and gains etc.

Control System Toolbox provides commands for:  Performing arithmetic on linear models  Building complex block diagrams by connecting simple models in series, parallel, or feedback  Discretizing continuous-time models  Computing low-order approximations of high-order models

Consider a block diagram:

(2) Analyzing Models: We can analyze the model by LTIview (Linear time invariant) and GUI (Graphical user interface). In which we can analyze the model behavior by plotting different graphs e.g.    

Step Response Impulsive Response Bode diagram Nyquist Plot

By comparing the time and frequency responses of several linear models at once we can analyze the system behavior for different parameters.

(3) Designing Compensator: How we build compensators using functions from the Control System Toolbox. We can build SISO system by  Roots locus method  Bode diagram (compensator)  Pole placement technique (for MIMO) Controller design can be validated by verifying rise time, overshoot, settling time, gain and phase margins, and other requirements.

Lab Session 2 To illustrate control system characteristics with the help of MATLAB by introducing a control to speed Techo-generator system.

DC Motor: The DC motor is a power actuator device that delivers energy to a load, as shown in Figure2.18 (a); a sketch of a DC motor is shown in Figure2.18 (b). The DC motor converts direct current (DC) electrical energy in to rotational mechanical energy. A major fraction of the torque generated in the rotor (armature) of the motor is available to drive an external load. The transfer function of the DC motor will be developed for a linear approximation to an actual motor, and second order effects, such as hysteresis and the voltage drop across the brushes, will be neglected. The input voltage may be applied to the field or armature terminals. The air gap flux of the motor is proportional to the field current, provided the field is unsaturated, so that

The torque developed by the motor is assumed to be related linearly to and the armature current as follows:

Then we have, in Laplace transform notation,

Where = is a constant armature current, and field current is related to the field voltage as,

The motor torque expressed as,

is defined as the motor constant. The

is equal to the torque delivered to the load. This relation may be

As,

The block diagram model of the field controlled DC motor is shown in Figure2.19. Alternatively, the transfer function may be written in terms of the time constants of the motor as,

Where,

and,

, and

Armature controlled DC motor: The armature controlled DC motor uses the armature current as the control variable. The stator field can be established by a field coil and current or a permanent magnet. When a constant field current is established in a field coil, the motor torque is

Where is a function of the permeability of the magnetic material. The armature current is related to the input voltage applied to the armature by

Where is the back electromotive force voltage proportional to the motor speed. Therefore, we have

Where

the transform of the angular speed and the armature is current is,

Open loop control of DC motor: Ra=1; Km=10; J=2; f=0.5; Kb=0.1; b=0.5; num1=[1]; den1=[J,b]; sys1=tf(num1,den1); num2=[Km*Kb/Ra]; den2=[1]; sys2=tf(num2,den2) sys_o=feedback(sys1 ,sys2); sys_o=-sys_o [yo,T]=step(sys_o); plot(T,yo) title('Open-Loop Disturbance Step Response') xlabel('Time (s)'),ylabel('\omega_o'), grid yo(length(T))

Output: Transfer function: -1 --------2 s + 1.5 ans = 0.6650

Closed loop control of DC motor (Techogenerator system): clc; clear all; Ra=1; Km=10; J=2; f=0.5; Kb=0.1; b=0.5; Kt=8; for(i=1:10); Ka=i; num1=[1]; den1=[J,b]; sys1=tf(num1,den1); num2=[((Ka*Km*Kt*Ka)+(Ka*Km*Kt*Kb))/(Ra*Ka)]; den2=[1]; sys2=tf(num2,den2); sys=feedback(sys1 ,sys2); step(sys); hold on; end

Output: Transfer function: 1 ---------2 s + 808.5

Comments:  As we can see from the graph that in closed loop system the response meet with x-axis but in open loop system the response meet with x-axis after a little bit of time. It takes more time to touch real axis for open loop system as compared to closed loop system.  Open loop system response is quicker than the system response of closed loop system.

Lab Session 3 To determine the performance of a second order system & adjust the system’s performance with the variation of parameter.

Second Order System: Let us consider a single loop second order system and determine its response to a unit step input. A closed loop feedback control system is shown in Figure. The closed loop system is,

With a unit step input, we obtain,

For which the transient output, as obtained from the Laplace transform is,

Where,

, and

,

Damping ratio (ζ): The damping ratio plays a fundamental role in closed loop system performance. As seen in the design formulas for settling time, percent overshoot, peak time, and rise time, the damping ratio is a key factor in determining the

overall performance. Infect, for second order systems, the damping ratio is the only factor determining the value of the percent overshoot to a step input. As it turns out, the damping ratio can be estimated from the response of a system to a step input  Over-damped (ζ > 1): The system returns (exponentially decays) to equilibrium without oscillating. Larger values of the damping ratio ζ return to equilibrium more slowly.  Critically damped (ζ = 1): The system returns to equilibrium as quickly as possible without oscillating. This is often desired for the damping of systems such as doors.  Under-damped (0 < ζ < 1): The system oscillates (at reduced frequency compared to the un-damped case) with the amplitude gradually decreasing to zero.  Un-damped (ζ = 0): The system oscillates at its natural resonant frequency ( ).

Part 1: Effect of Damping ratio “Zeta” on system performance clc t=[0:0.1:12];num=[1]; zeta=0.3:0.1:1.2; zeta(9)=2; for(i=1:9) sys(i)=tf(1,[1 2*zeta(i)1]); end [y1,T1]=step(sys(1),t); [y2,T]=step(sys(2),t); [y3,T3]=step(sys(3),t);[y4,T4]=step(sys(4),t); [y5,T5]=step(sys(5),t);[y6,T6]=step(sys(6),t); [y7,T7]=step(sys(7),t);[y8,T8]=step(sys(8),t); [y9,T9]=step(sys(9),t) plot(T1 ,y1 ,T2,y2,T3,y3,T4,y4,T5,y5,T6,y6,T7,y7,T8,y8,T9,y9); xlabel('\omega_n t'), ylabel('y(t)') legend('underdamped:zeta1','criticallydamped:zeta=0','un damped:zeta=1 ')

Graph:

Assignment: clc t=[0:0.1:12]; a=0.5:0.5:3; for(i=1:length(a)) sys(i)=tf([a(i)*a(i)],[1 2*0.4 a(i)*a(i)]); end ltiview %import system “sys” in ltiview % or [y1,T1]=step(sys(1),t);[y2,T2]=step(sys(2),t); [y3,T3]=step(sys(3),t);[y4,T4]=step(sys(4),t); [y5,T5]=step(sys(5),t); % plot(T1 ,y1 ,T2,y2,T3,y3,T4,y4,T5,y5); xlabel('\omega_n t'), ylabel('y(t)') title('\omega_n t=0.5, 1.0, 1.5. 2.0, 2.5'), grid

Comments:  As we can see from the first graph by decreasing the damping ratio (ζ) the over shoot is less. From second graph, it is clear that by increasing the value of natural frequency ( ) the response is quicker but over shoot is increase.so varying value of wn and zeta both effect the system response.so these two are the important factor which effect P.O,Tr,Ts. Perameters of system is totally dependent of these two variables.(wn,zeta)

Lab Session 4 To determine the steady state error of a mobile robot steering control.

Part 1: Steady state response to a triangular wave input (kind of ramp input) clc; K1=1; K2=2; K=1; a=1/10; numg=[K1*K K*K2]; deng=[a 1 0]; sysg=tf(numg,deng); [sys]=feedback(sysg, [1 ]); t=[0:0.1:8.2]'; v1=[0:0.1:2]; v2=[2:-0.1:2]; v3=[-2:0.1:0]; u=[v1 v2 v3]; [y,T]=lsim(sys,u,t); plot(T,y,t,u,'-'), xlabel('Time (s)'), ylabel('\theta (rad)'), grid

Output:

Assignment: clc syms s d1 d2 ; a=input('enter numinator:') b=input('enter denumerator:') M=d2*s^2+d1*s+1 m1=diff(M,s) m2=diff(m1,s) m3=diff(m2,s) m4=diff(m3,s) %%%%% putting s=0 in M and its derrivatives m0=limit(M,s,0) m10=limit(m1,s,0) m20=limit(m2,s,0) m30=limit(m3,s,0) m40=limit(m4,s,0) %%%%% finding M2 and M4.................. M2=(-(m0*m20)/2)+((m10*m10)/1)-((m20*m0)/2) M4=((m20*m20)/(4)) D=tf(a,b); %%D=((1)/(114))*s^3+((11.4)/(114))*s^2+((14)/(114))*s+1 d1=diff(D,s) d2=diff(d1,s) d3=diff(d2,s) d4=diff(d3,s) %%%%% putting s=0 in D and its derrivatives d0=limit(D,s,0) d10=limit(d1,s,0) d20=limit(d2,s,0) d30=limit(d3,s,0) d40=limit(d4,s,0) %%%%% finding D2 and D4.................. D2=(-(d0*d20)/2)+((d10*d10)/1)-((d20*d0)/2) D4= -2*(d10*d30/6)+((d20*d20)/(4)) f=D2-M2 g=D4-M4 %%%%%% calculating d1 and d2 from (f and g)equation [d1,d2]=solve(f,g) d1=sym2poly(abs(d1(1))) d2=sym2poly(abs(d2(1))) den11=1+d1*s+d2*s^2 p=sym2poly(den11); num=1; den=p; X=sym2poly(D) disp('orignal transfer') sys1=tf(num,X) disp('approximate 2nd order system') sys=tf(num,p) t=0:.01:4; [y,t]=step(sys1,t); plot(t,y); hold on [y1,t1]=step(sys,t);

plot(t1,y1);

Output:

Assignment: (General code) function RouthApprox=Routh_Approximation(G,r) Function RouthApprox=Routh_Approximation(G,r) % it Computes the r-th order Routh Approximation of a given n-th order % transfer function G, with 10 check=1; end end if check==1 break end end k(i)

Output: ans =

10.5000

Assignment: K=[0:0.5:20]; for i=1:length(K) q=[1 2 4 K(i)]; p(:,i)=roots(q); end plot(real(p),imag(p),'x'), grid xlabel('Real axis'), ylabel('Imaginary axis');

Assignment: (General code) clc; disp(' ') D=input('Input coefficients of characteristic equation'); l=length (D); disp(' ') disp('--------------------') disp('poles of characteristic equation :') roots(D) ---- Bulding array-------if mod(l,2)==0

m=zeros(l,l/2); [cols,rows]=size(m); for i=1:rows m(1,i)=D(1,(2*i)-1); m(2,i)=D(1,(2*i)); end else m=zeros(l,(l+1)/2); [cols,rows]=size(m); for i=1:rows m(1,i)=D(1,(2*i)-1); end for i=1:((l-1)/2) m(2,i)=D(1,(2*i)); end end for j=3:cols if m(j-1,1)==0 m(j-1,1)=0.001; end for i=1:rows-1 m(j,i)=(-1/m(j-1,1))*det([m(j-2,1) m(j-2,i+1);m(j-1,1) m(j-1,i+1)]); end end disp('--------The Routh-Hurwitz array is:--------'),m Temp=sign(m);a=0; for j=1:cols a=a+Temp(j,1); end if a==cols disp(' ----> System is Stable System is Unstable