Ta Proj 1 Reportl
Ta Proj 1 Reportl
1. Abstract The purpose of this project is to design a controller for a second order system(the most common prototype control problem). A Proportional Integral derivative(PID) will be adopted for the give system. The study will be approached analytically and experimentally. 2. Introduction Practically, there are f ew systems that dont have any control system inside. More complicated become systems, more sophisticated controllers are needed. To design a controller, several issues should be considered e.g., modeling, system performance, tuning gain and stability. For a simple second order system, those issues will be studied in this project. The given single pendulum system is a basic second order system to be controlled. The system will be modeled as a linear system. The poles and zeros of the system will be fo und to test the stability of the given system. The controller will be developed in the order of proportional(P) controller, proportional-derivative(PD) controller-proportional and proportional- integral-derivative(PID) controller. To meet the given specifications and stability, the gains will be tuned. The controllers will be implemented in continuous time domain(S plane) and in discrete time domain(Z plane), respectively. The analytical controller will be verified by simulation with simulink of Matlab.
3. Controller Design for A Single Pendulum 3.1 Linearization(Task 1) The analysis and control design are far easier for the linear than for nonlinear models. Linearization is the process of finding a linear mode that approximates a no nlinear one. Linearization process depends on the expanding the nonlinear state equation in to a Taylor series. In the given dynamic equation (1), two non- linear functions exist, e.g., sgn( ), sin .
.
(I
2 m
..
(1)
Parameter m I Im lg N Fc Fv K
Name Mass Link Inertia Motor Inertia Distance Gear Ratio Coulomb Friction Coefficient Viscous Friction Coefficient Torque Constant
Value .048Kg .000187 Kg m2 2.2e-7 Kg m2 .051 m 70.35 .014 N-m .0034 N-m-sec .01447
sgn( ) can be set to be zero since at the equilibrium state, = 0. For sin , the first two terms(linear terms) of the Taylor series expansion(2) are used. sin = sin + cos ( ) .5 sin ( )2 + (2) The the linearized system becomes
2 N 2 + I + ml g + Fv + mgl g cos des = mgl g sin des (3) where = ( des ) m
(I
..
(4)
Then, the transfer function of the system is ( s ) 1 H ( s) = = 2 I ( s ) s + Fv s + mgl g cos des From the transfer function, it has poles at
(5)
2 mgl g cos des Fv Fv 4 s= (6) 2 and no zeros. For the system to be stable, every poles should be in left hand side of splane. In the equation (6), cos des > 0 is the condition for the system to be stable. In 3 other words, 0 < des < or < des < 2 . With those given parameter values and 2 2 des = , the poles are at 0 and -4.8549 and for des = , poles are at 6.1984 and 2 -11.0532. Therefore the system is marginally stable or unstable by itself.
3.2 Implementation Simulink diagram for the given system and the top level diagram(with PID Controller) are shown in Figure 1 and Figure 2. The parameters are defined in the file pendinit.m. To initialize the parameters, the subsystem block(initialization) is in the system.
Figure 1
Figure 2 With only the single pendulum system, the step response goes infinity in figure 3.
As a basic controller operation, the controller is simply an amplifier with a constant gain K p and a feedback loop, = K p ( des ) . Hence the output of P controller is related with the input of the controller by a proportional constant. Adding a P controller to the given system results in changing the transfer function of overall system such as s d = 2 des + 2 (7) s + Fv s + mgl g cos des + K p as + Fv s + mgl g cos des + K p where disturbance d = mgl g sin des . From (7), the location of the poles depends on the given parameters and K p . The poles are mgl g cos des + K p F F v v 4 s= (8) 2 The locations of the poles are changing by varying K p . If K p > mgl g cos des , the system
2
becomes stable.
With given parameters and K p = 5, the poles are located at 2.4274 119i for des = and des = such that the system is stable. The analytical 2 result is verified by the simulation( K p =5, K i =0 and K i =0). In figure 4, the system is stable for both values.
Figure 4 3.4 PD Feed Back Controller(task 4) Even though the system with P controller is stable, the output has relatively high peak overshoot and is oscillating. The oscillation results from the excessive amount of
torque and the lack of damping. Adding the derivative of the input makes the system critical damped. In the equation (9), the locations of poles are
2 mgl g cos des + K p Fv + K d Fv + K d 4 s= 2
(9)
As it is shown in (9), tuning K d and K p make it possible for the system to meet the given specifications e.g., rise time (90%), settling time (2%) small overshoot(less 5%) and steady state error(less then 2%). Once the inside of the square root is negative, the damping depends on its magnitude. For fixed K d = .1 , the step responses are shown for various K p values in the figure 5.
Figure 5 The plots show increasing K p results in decreasing rise time( K p =1,10) but increasing overshoot( K p =10). For fixed K p =1 in the figure 6, the step responses are shown for various K d values.
Figure 6 In the figure, decreasing K d values leads to decrease the rise time. For the given specification, K d =.1 and K p =2 make the system meet the specifications very well in Figure 7.
Figure 7 From the given transfer function for the system with PD controller (10), steady state error can be calculated by setting s = 0. s d = 2 des + 2 s + (Fv + Kd )s + mglg cos des + K p as + (Fv + K d )s + mgl g cos des + K p where d = mgl g sin des (10) Therefore the steady state error is the function of des in (11). mgl g sin des ess = mglg cos des + K p 7
(11)
With simulation with the parameters des = same with .024 calculated by (11).
Figure 8 3.5 Washout Filter Design(task 5) In practice, is not measured. In stead of that, one high pass filter which has one zero at the origin in feedback loop.
.
Scope theta double double Kp.s+Ki s Step PI control Single Pendulum Simulator Terminator double double In1 thetadot double To Workspace double theta
SubSystem
Figure 8-1 The step response of the washout filter controller is oscillated at transient part and has damping. But the filter reduces the steady state error in Figure 8-2.
Figure 8-2 3.6 PD controller in sample data implementation(task 6) So far, the controller has been implemented in continuous time domain. The discrete implementation, however, becomes more popular by appearing computers and small digital microprocessors. In continuous domain, a differential equation can be approximated with a difference equation e.g., (k ) ( (k ) (k 1)) / t s . With the approximation, the PD controller system is implemented in figure 9.
Figure 9 The simulation result is well approximated in sampled data implementation in figure 10.
Figure 10 3.7 PID controller in continuous and sampled data implementation (task 7,8) To compensate the steady state error, the integral controller should be added. One obvious effect of the integral control is that it increases the type of the system by one; that is, if the steady-state error to a given input is constant, the integral control reduces it to zeros. The transfer function of the PID controller system is Kd s 2 + Kd s + Ki ds = 3 des + 3 2 s + ( Fv + K d )s + (mgl g cos des + K p )s + K i as + (Fv + K d )s + (mgl g cos des + K d )s + K i where d = mgl g sin des (12)
then des s 0 goes to zero as S 0 . In other word, the integral controller compensates steady state error. The continuous and sampled data implemented PID controllers are simulated and compared in figure 11 and figure 12.
Scope
d o u b l e t h e t a d o u b l e d o u b l e
theta To Workspace
Kp.s+Ki s
d o u b l e
d o u b l e I n 1 d o u b l e t h e t a d o t
Step
PI control Single
d o u b l e
Pendulum Simulator
Kd
Gain
SubSystem
d o u b l e
t1 Clock time
Figure 11
10
The performances of both controllers meet the given specifications in figure 12 and figure 13.
Figure 13
Figure 14 Continuous Controller des = des = / 2 4.42 3.5 .27 .354 .079 1.053 1.5e-4
Sampled ZOH controller des = des = / 2 4.37 3.45 .269 .368 .079 1.113 1.47e-4 .08 1.056 1.57e-4
3.8 Tracking(task 9) Up to now, the input has been a step function. But in real system, the input tends to be a time varying function such as a sinusoidal function. The given input des (t ) = sin (4t )
11
increases the transfer function by 2 because the Laplace transform of the input is 4 2 . The total system becomes (13). s 2 + 16 2
= s 3 + ( Fv + K d )s 2 + (mgl g cos des + K p )s + K i K d s 2 + K d s + Ki 4 2 + s 2 + 16 2
(13)
As shown in (13), the system is a fifth order system. First of all, dominant second order system needs to be found which has the poles most close to imaginary axis. Then tuning the poles of the second system to make the system meet the specifications. With the same gains with task 8, the output is shown in Figure 15.
4. Conclusion In this project, the controller design of a second order system(a single pendulum) has been studied. As a controller, PID controller has been adopted. Mathematical analysis of the transfer function has been used and simulation justify the analysis. Even though, a PID controller is simple, the robust of the controller has been experienced and justified.
12