Beruflich Dokumente
Kultur Dokumente
(MATLAB/Simulink)
Acknowledgments
I am grateful to all those who have had a direct impact on this work. I would also like to thank and recognize all the undergraduate students in mechatronic engineering program at Southern Polytechnic State University, over the years with whom I had good fortune, and who contributed in some ways and feedback to the development of this material. In addition, I greatly owe my indebtedness to all the authors of the articles listed in the bibliography of the paper. Finally, I would very much like to acknowledge the encouragement, patience, and support provided by my family members as well as Dr. Chan Ham who pushed me to strive to excellence.
Kader Conde
Page |2 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
Abstract
The project shall describe a MATLAB/SIMULINK realization of a DC Motor (Brushless) as well as implementing controls methods. The paper will presents with the design of a control system that shall control the speed/torque of the motor taking into account all factors. All major elements of classical control theories will be represented, coupled with ingenious and conventional tuning methods. Electric machines such as DC Motor, AC Motor, Induction Motors and Generators play important roles in industry as well as everyday life. The same general concept can be applied for each type whether it is for generating electrical power in power plants or provide mechanical energy in production industry. The aim of this project is to deeply investigate the behavior of an electrical machine; precisely a specific type of DC motor. The second focus of the paper to use computer simulation as a tool for conducting transient and control studies. The fact of the matter is that simulation and optimization represent the last steps in the design process. Aside from constructing the actual system; which happens to be time consuming, tedious, and costly, simulation is often chosen by engineers in their individual approach. MATLAB/SIMULINK represents the ideal companion in studying controls and conceptual designs. MATLAB and SIMULINK not only offer matrix computer algebra in handling control systems, but also an entire control system toolbox for advanced simulation.
Page |3 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
List of Symbols
Voltage across coil of armature Resistance of armature Current of armature Inductance of armature Voltage induced Angular Velocity of motor Electromagnetic torque Torque due to rotor acceleration Torque due to rotor velocity Torque of mechanical load Damping coefficient from mechanical rotation Inertia of the motor Torque constant Motor constant Rotation per minute Natural Frequency Damping Ratio Percent Overshoot Settling Time Rise Time Proportional Gain Integral Gain Derivative Gain
Page |4 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
Table of Figures
Figure 1: Multiview Drawing of Permanent Magnet DC Motor ................................................................ 11 Figure 2: Electrical Representation of a DC Motor ................................................................................... 12 Figure 3: Complete Block Diagram of DC Motor Model ........................................................................... 14 Figure 4: Simplified Block Diagram of DC Motor Model .......................................................................... 14 Figure 5: Open-loop Block Diagram of DC Motor Model ......................................................................... 16 Figure 6: Typical Feedback Control System .............................................................................................. 16 Figure 7: DC Step Motor Response via Transfer Function State-Space Model ......................................... 20 Figure 8: Step Response of DC Motor Model Manually Obtained ............................................................ 21 Figure 9: Root Locus Plot of DC Motor Model .......................................................................................... 22 Figure 10: Impulse Response of DC Motor Model ..................................................................................... 23 Figure 11:Ramp Response of DC Motor Model ......................................................................................... 24 Figure 12: Bode Diagrams of DC Motor Model ........................................................................................ 25 Figure 13: Nyquist Diagram of DC Motor Model ...................................................................................... 26 Figure 14: Step Response with Proportion Control: 30<Kp<70 with Increment of 5 ............................... 28 Figure 15: Step Response with PD Controller Kp = 122; 0<Kd<10 ......................................................... 29 Figure 16: Step Response of DC Motor with PI Controller Kp = 30; 30<Ki<80...................................... 30 Figure 17: Step Response of DC Motor with PID Controller Kp = 30; Kd = 1.4; 30<Ki<80 .................. 31 Figure 18: Step Response of DC Motor with Tuned PID Controller.......................................................... 33 Figure 19:Schematic of a Full-State Feedback System .............................................................................. 35 Figure 20:Step Response with Full-State Feedback Controller ................................................................. 36 Figure 21:Final Step Response with Full-State Feedback Controller........................................................ 37 Figure 22: Step Response of DC Motor for Discrete Model Ts = 0.1 ........................................................ 38 Figure 23:Step Response of DC Motor for Discrete Domain with PID Controller ................................... 40 Figure 24: Simulation Block Diagram of DC Motor Model in Simulink .................................................... 41 Figure 25:Step Response of DC Motor Model in Simulink......................................................................... 41 Figure 26:Simulation Block Diagram of Dc Motor via State-Space Model ............................................... 42 Figure 27:Step Response of Dc Motor Simulink Model via State-Space Modeling.................................... 42 Figure 28: Step Response with Proportion Control: 25<Kp<45 ............................................................... 44 Figure 29: Final PID Controller Tuning .................................................................................................... 46 Figure 30: Step Response of Final PID Controller Tuning Kp = 30.1, Kd = 59.2, Ki = 1.4 ..................... 47
Page |5 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
Table of Contents
ACKNOWLEDGMENTS ............................................................................................................................................ 2 ABSTRACT .............................................................................................................................................................. 3 LIST OF SYMBOLS ................................................................................................................................................... 4 TABLE OF FIGURES ................................................................................................................................................. 5 TABLE OF CONTENTS.............................................................................................................................................. 6 INTRODUCTION ..................................................................................................................................................... 8 PROJECT OBJECTIVES ......................................................................................................................................................8 MINIMUM SUCCESS CRITERIA ..........................................................................................................................................8 TECHNICAL APPROACH .......................................................................................................................................... 9 SUMMARY OF MAIN FOCUS .............................................................................................................................................9 SCOPE OF MATHEMATICAL ANALYSIS .................................................................................................................................9 DC MOTOR BACKGROUND ................................................................................................................................... 10 GENERAL MACHINE BACKGROUND ..................................................................................................................................10 AN AUTOINDUCTIVITY...................................................................................................................................................10 MODELING A DC MOTOR ..................................................................................................................................... 11 PERMANENT MAGNET DC MOTOR .................................................................................................................................11 IM-15 GEARMOTOR PERMANENT MAGNET 455A116-2 ................................................... ERROR! BOOKMARK NOT DEFINED. ELECTRICAL SYSTEM .....................................................................................................................................................12 MECHANICAL SYSTEM...................................................................................................................................................13 STATE SPACE REPRESENTATION ......................................................................................................................................13 TRANSFER FUNCTION BLOCK DIAGRAM ............................................................................................................................14 FEEDBACK CONTROL SYSTEM .........................................................................................................................................16 MATLAB/SIMULINK SIMULATION ........................................................................................................................ 17 INTRODUCTION TO MATLAB .......................................................................................................................................17 INTRODUCTION TO SIMULINK .........................................................................................................................................17 MATLAB APPROACH ............................................................................................................................................ 18 MATLAB MODELING...................................................................................................................................................18 LINEAR ANALYSIS .........................................................................................................................................................21 Root Locus Diagram of DC Motor Model ...........................................................................................................22 Impulse Response of DC Motor Model ...............................................................................................................23 Ramp Response of DC Motor Model ..................................................................................................................24 Bode Plots of DC Motor Model ...........................................................................................................................25 Nyquist Diagram of DC Motor Model.................................................................................................................26 CONTROLLER DESIGN....................................................................................................................................................27 PID Controller Approach .....................................................................................................................................27 Matlab Tuning Tool ............................................................................................................................................32 State-Variable Feedback Design Controller ........................................................................................................34 CONTINUOUS TO DISCRETE CONVERSION.............................................................................. ERROR! BOOKMARK NOT DEFINED.
Page |6 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
SIMULINK MODELING & SIMULATION ................................................................................................................. 41 CONCLUSION AND FUTURE WORK ....................................................................................................................... 49 BIBLIOGRAPHY ..................................................................................................................................................... 50 APPENDICES......................................................................................................................................................... 51 APPENDIX A: MATLAB SOURCE CODE ............................................................................................................................51 APPENDIX B: DC MOTOR DATASHEET .............................................................................................................................54
Page |7 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
Introduction
Project Objectives
The aim of this paper is to further research on analysis, synthesis, and modeling; as well as the actual behavior of a DC motor with a controller. It will require a heavy usage of powerful computation and simulation software. MATLAB shall be the software package used for high performance numerical computation and visualization. The combinations of classical and modern control theories to its flexibility, reliability and powerful graphics make MATLAB/SIMULINK essential for this paper. They enable user to simulate linear, as well as nonlinear, systems easily and efficiently. A theory is a general statement of principle abstracted from observation; while a model is a representation of a theory that can be used for control and prediction. For a model to be useful, it must be realistic and yet simple enough to be understood and manipulated. These requirements are not easily fulfilled as realistic models arent simple and simple model are seldom realistic.
Page |8 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
Technical Approach
Summary of Main Focus
The main focus is to accurately derive a Mathematical model for describing the behavior of a permanent magnet dc motor. It will have to be a kinematics model relating either the output angular velocity or torque to the inputted voltage or current. Thus using control theories to extend the model representation including different control systems in order to obtain desired responses. The use of MATLAB and SIMULINK in modeling, analysis and control design is demonstrated. It will be assumed throughout that the reader already possesses basic knowledge of MATLAB and SIMULINK; therefore, the main focus will be on the actual implementation of the Control System Toolbox Functions.
Page |9 CONTROL SYSTEM FOR DC MOTOR: Advanced Control Method using MATLAB/SIMULINK
DC Motor Background
General Machine Background
We consider DC motor with permanent magnets. The force provided by the motors is known as torque. The stall torque usually provided by the data sheets represents the theoretical maximum torque produced by the motor in case of totally free unrestricted motion. The DC motor rotates as a result of current flowing through a coil inside a magnetic field repelled by permanent magnets mounted in the armature. When a motor is rotating, the applied voltage to the motor is diminished by the voltage E produced by the rotor. The faster it rotates, the larger the value of E is. In general, where is a constant, and is the angular velocity of the motor. The torque on the rotor (the useful torque for a machine) is proportional to the current in the coil: In SI units, . Since , where is the resistance.
An Autoinductivity
The voltage generated by the motor coil is produced because the coil is rotating through the magnetic flux lines of the permanent magnet. If the current in the coil is changing, then the magnetic field generated by the coil is also changing. The magnetic flux of the field generated by the own current is varying, and this is equivalent to a movement of the coil through a magnetic field. This means that variations in the current through the coil lead to a generated voltage given by:
where is the inductance of the coil. It is important to note that the induced voltage opposes the voltage applied to the motor.
Modeling a DC Motor
The intent is to develop a linear model for a DC motor, how to analyze the model under MATLAB (poles and zeros, frequency response, time-domain response etc.), how to design a controller, and how to simulate the open-loop and closed-loop system under SIMULINK. In our design, an actual DC motor will be used. In fact, it will be a Permanent Magnet DC motors.
Figure 1: Multiview Drawing of Permanent Magnet DC Motor: IM-15 GEARMOTOR Permanent Magnet 455A1162
Torque constant Motor constant Inductance of armature Resistance of armature Damping of the mechanical system Moment of Inertial of the rotor
Electrical System
The electrical system can be represented by a voltage source across the coil of the armature. The electrical equivalent of the armature coil can be described by an inductance in series with a resistance and an induced voltage which opposes the voltage source. It usually result from the rotation of the electrical coil through fixed flux of the permanent magnets and known as the back emf (Electromotive Force) as state above.
Mainly, in the analysis of the above circuitry, Kirchhoffs Voltage and Current Laws will be applied. Therefore, we have:
With: voltage across armature [Volt] armature coil resistance, [ohms] armature coil inductance [Henry] induced Voltage [Volt] motor angular velocity [rad/s] motor constant [N.m/amps]
Mechanical System
The conservation of energy theorem states that in an isolated system, the total amount of energy shall remain constant over time except in presence of combustion or nuclear reaction. As a result, the sum of the torques of the motor must be equal to zero. Therefore, we have:
With electromagnetic torque torque due to rotor acceleration torque due to rotor velocity torque constant damping coefficient
Finally, using the Control Canonical Form, the Block Diagram we can derive the block diagram of the system. It becomes:
The block diagram can be simplified by making numerous assumptions. First, let us assume that the load torque is constant. Since the change in becomes zero (assuming that no load is acting against the torque from the motor), it does not need to appear in the block diagram. Secondly, if the only focus is places on the angular velocity , the armature current does not need to appear as well in the block diagram (can always be observe in simulation since it is an output). Therefore, the simplified diagram becomes:
Finally, using different simplification theorem, or Masons rule, on can derive the overall Transfer Function of the DC Motor. It becomes:
Another way to obtain the transfer function would be to use the transfer function formula from state space variables which is: Since , the feedforward matrix does not apply to our system, Therefore, we have: . Thus,
We note that using both methods, we obtain the same result. Thus this can be used as a confirmation method in order to ensure that the result is accurate. From the overall transfer function of the kinematic model of the permanent magnet dc motor, we obtain the simplified open loop block diagram of the system:
Introduction to MATLAB
The name MATLAB stands for matrix laboratory. MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-touse environment where problems and solutions are expressed in familiar mathematical notation. Typically, MATLAB is used for Math and computation, algorithm development, modeling, simulation, and prototyping, data analysis and scientific and engineering graphics. MATLAB features a family of application-specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions (M-files) that extend the MATLAB environment to solve particular classes of problems. Areas in which toolboxes are available include signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many others.
Introduction to Simulink
Simulink has become over the past years the most widely software package use in colleges and universities for modeling and simulating dynamics systems. It has the capabilities of supporting linear and nonlinear system, modeled in continuous time, sampled time, or hybrid of the two. One of the main advantages of Simulink is the fact that it encourages user to try things out. User can easily build models from scratch, or take an existing model and modify it. Simulations are interactive, so users can change parameters on the spot and immediately see what happens. Finally, since MATLAB and Simulink are incorporated together, user can simulate, analyze, and revise the models in either environment at any point. Simulink turn the user computer into a lab for modeling and analyzing systems that simply wouldnt be possible or practical. It is so practical that thousands of engineers use it to solve real problems in their professional careers.
MATLAB Approach
MATLAB Modeling of DC Motor
To produce a good design, there needs to be some amount of modeling. The above transfer function can be entered into MATLAB by defining the numerator and denominator polynomials, using conventions of MATLABs Control Toolbox. We will start defining the different motor constants:
% Motor Constants % --------------------------------------------------------------------------kt = 0.0212; % Torque Constant kv = 1.64; % Motor Constant K = 0.212; % Constant since kt = kv La = 1; % Armature Inductance Ra = 2; % Armature Resistance J = 0.04; % Moment of inertial of rotor B = 0.15: % Damping Coefficient %----------------------------------------------------------------------------
The transfer function can be entered in MATLAB in a number of different ways. A good approach is in fact utilizing MATLAB built in control system toolbox to derive the transfer function from the state-space variable. Therefore, we have:
% Transfer Function Model (angular velocity)/(armature voltage) % --------------------------------------------------------------------------AA = [-Ra/La -kv/La; kt/J -B/J]; % State Matrix BB = [1/La; 0]; % Input Matrix CC = [0 1]; % Output Matrix DD = 0; % Feedforward Matrix [numTF denTF] = ss2tf(AA,BB,CC,DD); disp('DC Motor Model Representation'); TF = tf(numTF,denTF) %----------------------------------------------------------------------------
DC Motor Model Representation Transfer function: -8.882e-016 s + 0.53 -------------------s^2 + 5.75 s + 8.369
At this point of the analysis, we can utilize the result through MATLAB analysis to the one obtained manually as a mean of verification. As a result, we will simply compare both final transfer functions. Therefore, we have:
% Verification using Transfer Function Model obtained manually % --------------------------------------------------------------------------num = [kt/J*La]; den=[1 (J*Ra+B*La)/(J*La) (B*Ra+kt*kv)/(J*La)]; disp('Verification Transfer Function model'); TF2 = tf(num,den) % ---------------------------------------------------------------------------
Verification Transfer Function model Transfer function: 0.53 -------------------s^2 + 5.75 s + 8.369
Observing both results, we notice that they pretty much equal. In fact; State-Space Model Transfer Function:
Now that we have the transfer function entered in MATLAB, the intent is to analyze the system through various plots and responses. First we want to ensure that both transfer functions entered in MATLAB produce the same response. Therefore, we will plot basic step response in both cases:
% Step Response of DC Motor via Transfer Function % --------------------------------------------------------------------------step(TF); xlabel('t (sec)'); ylabel ('\omega_m (rad/sec)');
title('DC Motor Step Response via Transfer Function via State-Space Modeling');
% Step Response of DC Motor via obtained model % --------------------------------------------------------------------------step(TF2); xlabel('t (sec)'); ylabel ('\omega_m (rad/sec)'); title('DC Motor Step Response via Transfer Function via Manual result'); % --------------------------------------------------------------------------DC Motor Step Response via Transfer Function via State-Space Modeling
0.07 System: TF Final Value: 0.0633 0.06 System: TF Rise Time (seconds): 1.15 0.05
(rad/sec)
0.04
0.03
0.02
0.01
0.5
1.5
2.5
t (sec) (seconds)
0.06
System: TF2 Settling Time (seconds): 1.99 System: TF2 Rise Time (seconds): 1.15
0.05
m (rad/sec)
0.04
0.03
0.02
0.01
0.5
1.5
2.5
t (sec) (seconds)
Characteristic Constants
Rise Time Settling Time Steady State response Transfer Function from State-Space Model 1.15 sec 1.99 sec 0.0633 rad/sec Transfer Function Manually Obtained 1.15 sec 1.99 sec 0.0633 rad/sec
We shall note that using both models, we obtained the same Step Response which confirms the result obtained above. Now let us create different analysis plot to fully understand the behavior of our system. We shall plot the RootLocus, an Impulse and Ramp Responses, the Bode Plots, and the Nyquist Plot.
Linear Analysis
Let us look and analyze the different response and plot of the system. We will be looking at the following different plots: Root Locus, Impulse response Ramp response
1.5
0.5
-0.5
-1
-1.5
-2 -3.5
-3
-2.5
-2
-1.5
-1
-0.5
0.5
The importance of the root locus method for control system theory lies in the fact that the location of the system poles determines its overall stability as well as the transient response. It is a simple graphical approach different from the Routh-Hurwitz Stability Table. In our case, we observe that both poles are located on the negative side of the imaginary axis (i.e. on the left side). This implies that the system is Stable throughout.
0.06
0.05
0.04
Amplitude
0.03
0.02
-0.01
0.5
1.5
2.5
3.5
Time (seconds)
In control theory the impulse response is the response of a system to a Dirac Delta input. A Dirac Delta input or function is generalized function on the real number line that is zero everywhere except at zero, with an integral of one over the entire real line. As a result, its Laplace transform is 1. It is usually utilized to ensure proper settling time.
0.045
0.04
0.035
0.03
Amplitude
0.025
0.02
0.015
0.01
0.005
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Time (seconds)
315
270
225
180 10
-1
10
10
10
Frequency (rad/s)
0.04
0.03
0.02
Imaginary Axis
0.01
System: TF Gain Margin (dB): 316 At frequency (rad/s): 5.86e+007 Closed Loop Stable? Yes
-0.01
-0.02
-0.03
-0.04
-0.05 -1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
Real Axis
Any system can be unstable depending on certain characteristics that can be graphically analyzed. Thus oscillation with increasing amplitudes in the signal can occur. It is also important to realize that stability shall remain independent of the input signal. To summarize the result obtain from the above analytical graphs and diagram, we have: The root locus as stated above display both poles (root of the characteristic equation) of the system on the left side of the imaginary axis; which predict total stability. Later, it is confirm by the plot of the responses. Finally, the system is observed to be overdamped which turn out to be crucial in the sense that the motor rotation does not oscillate.
Controller Design
As states above, the implementation of the PID type Controller is generically couple with a control loop feedback mechanism. The PID controller has historically been considered the best controller. By tuning the parameters, the controller can provide control action designed for specific process requirements. Because of its now feedback structure the system can become unstable; oscillations with increasing amplitudes in the response can occur. We shall focus on stability for our linear system that is independent of the input-output signals. In doing so, of the most commonly applied techniques is coupling the plant with a Proportional-Integral-Derivative Controller. The most important/crucial aspect of such application is appropriately tuning all three parameters in order to obtain the desired output. Therefore the approach chosen is to observe the response of the system as a result of step excitations and varying gain parameters.
0.8
m (rad/sec)
0.6
0.4
0.2
0.5
2.5
Figure 14: Step Response with Proportion Control: 30<Kp<70 with Increment of 5
Typically, the proportional term produces an output value that is proportional to the current error value. The proportional response is adjusted by multiplying the error by a constant Kp, known as proportional gain. As we observe the effect of the PD controller, but particularly Kp on the system, we note the following: - Regardless of the value of Kp, the system becomes underdamped with increasing overshoot - The proportional has an important impact on the steady state error, - The rise time as well as the settling time does change by a very slight amount sometime negligible, - The system remain stable, even its overall stability can be degraded. Proportional-Derivative Controller
% Proportional-Derivative Controller % --------------------------------------------------------------------------Kp = 122; Kd = 0:2:10; for j=1:length(Kd); num_pd = conv(num,[Kd(j) Kp]); [num_PD,den_PD] = cloop(num_pd,den); step(num_PD,den_PD); hold on; end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)');
1.2
0.8
(rad/sec)
0.6
0.4
0.2
0.5
1.5
2.5
t (sec) (seconds)
We observe the following: - First with constant proportional gain, the derivative gain does not influence the steady state error as well as overall stability - However, the rise time, settling time, and overshoot are influenced as they all decrease as the derivative gain increases.
Proportional-Integral Controller
% PI Controller % --------------------------------------------------------------------------Kp = 30; Ki = 30:10:80; Kd = 0; for k=1:length(Ki); num_pi = [Kd Kp Ki(k)]; den_pi = [1 0]; [num_PI,den_PI] = cloop(conv(num,num_pi),conv(den,den_pi));
step(num_PI,den_PI); hold on; end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response with PI Controller'); % --------------------------------------------------------------------------Step Response w ith PI Controller 1.4
1.2
(rad/sec)
m
0.8
0.6
0.4
0.2
t (sec) (seconds)
We observe the following: The integral gain affect minutely the rise time and settling time of the system However it does not change the overall stability of the system On the other hand, it appears that it does affect the overshoot or peak response
PID Controller
% PID Controller % --------------------------------------------------------------------------Kp = 30; Kd = 1.4; Ki = [30:10:80]; for k=1:length(Ki);
num_C = [Kd, Kp, Ki(k)]; den_C = [1 0]; num_pid = conv(num,num_C); den_pid = conv(den,den_C); [num_PID,den_PID] = cloop(num_pid,den_pid); step(num_PID,den_PID); hold on; end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title ('Step Response with PID-Controller'); % --------------------------------------------------------------------------Step Response w ith PID-Controller
1.2
0.8
(rad/sec)
0.6
0.4
0.2
0.5
1.5
2.5
3.5
4.5
t (sec) (seconds)
Figure 17: Step Response of DC Motor with PID Controller Kp = 30; Kd = 1.4; 30<Ki<80
The final tuning of the controller was done using an arbitrary approach of trial and error. The fact of the matter is that it was only possible due to the fact that we are dealing with a fairly simple system. In the case of more complex system such as those above second degree systems, or nonlinear system including disturbance, this approach will more than likely fail. Nonetheless there are different established methods that exist: Manual Tuning Which is the one employed above; it does not involves any Mathematical method, but is more effective for users with personnel experiences Ziegler-Nichols
It is a proven mathematical method; however this process also includes some trial anderror with very aggressive tuning. Cohen-Coon It is a good process models that include some math. Nonetheless it is often limited to first order system. Software Tool Software such as MATLAB often have methodology to automatically derive the best tuning gains for a great range of system. Their high cost is usually their major flaws couple with required training.
% Verification using Transfer Function Model obtained manually % --------------------------------------------------------------------------num = kt/J*La; den=[1 (J*Ra+B*La)/(J*La) (B*Ra+kt*kv)/(J*La)]; disp('Verification Transfer Function model'); TF2 = tf(num,den) Pidtune(TF2,'pid') Kp = 30.1; Ki = 59.2; Kd = 1.4; num_pid = [Kd Kp Ki]; den_pid = [1 0]; [num_PID,den_PID] = cloop(conv(num,num_pid),conv(den,den_pid)); step(num_PID,den_PID); xlabel('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response of DC Motor with Tuned PID Controller'); % ---------------------------------------------------------------------------
Continuous-time PID controller in parallel form: 1 Kp + Ki * --- + Kd * s s With Kp = 30.1, Ki = 59.2, Kd = 1.4
1.2
System: sys Peak amplitude: 1.1 Overshoot (%): 9.72 At time (seconds): 0.949 System: sys Settling Time (seconds): 1.43
(rad/sec)
0.8
0.6
0.4
0.2
0.5
1.5
2.5
t (sec) (seconds)
Finally, we obtain the best PID gain as follow: Proportional Gain: Integral Gain: Derivative Gain:
The result shows that for the best fit under PID controller, the characteristic of the controlled system are the following: Rise Time: Settling Time: Percent Overshoot:
% State-Space Variable Feedback Controller; % --------------------------------------------------------------------------AA = [-Ra/La -kv/La; kt/J -B/J]; % State Matrix BB = [1/La; 0]; % Input Matrix CC = [0 1]; % Output Matrix DD = 0; % Feedforward Matrix TFss = ss(AA,BB,CC,DD); CM = ctrb(TFss) % Controllability Matrix rank(CM) %----------------------------------------------------------------------------
CM = 1.0000 0 ans = 2
-2.0000 0.5300
As stated above, the point of the above analysis was to determine whether or not our DC motor is controllable. The rank of the controllability matrix turns out to be 2, which is equal to the order of the system. Thus we can apply state-space variable feedback theories since the system is controllable.
Full-State Feedback Controller Now that we ensure that our system is controllable, we want to define the governing parameters for the dc motor. Arbitrarily, we decided that the most important characteristics a dc motor transient response shall be the percent overshoot, and the settling time. Thus we want to design the phase-variable feedback gains to yield 5% overshoot and a settling time of 0.8 second. Note that the methodology through MATLAB shall be not only different but a little different that the approach when solving the problem by hand. The schematic for a full-state feedback system is:
The characteristic equation for the closed loop system is the determinant of . The expectation is 2 poles for the system. Therefore, we can arbitrarily pick the poles to fit the design requirements. Therefore we have:
% Feedback Design Controller % --------------------------------------------------------------------------OS = 5; Ts = 0.8; caushy = (-log(OS/100))/sqrt(pi^2+(log(OS/100))^2); Wn = 4/(caushy*Ts); p1 = -caushy * Wn + sqrt(-Wn^2 + caushy^2 * Wn^2); p2 = -caushy * Wn - sqrt(-Wn^2 + caushy^2 * Wn^2) K = place(AA,BB,[p1 p2]); step(AA-BB*K,BB,CC,DD,1,3); xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response with Full-State Feedback Controller'); % ---------------------------------------------------------------------------
System: sys 0.012 Peak amplitude: 0.0106 Overshoot (%): 5 At time (seconds): 0.598
0.01
0.008
(rad/sec)
0.006
0.004
0.002
0.5
1.5
2.5
t (sec) (seconds)
We observe that the system is behaving as expected. In fact the response displayed an overshoot of 5% and a settling time of 0.827 second. However, we observe that there is a huge steady state error with can be handle by adding a constant gain such as a proportional gain. Therefore, we have:
1.2
Amplitude
0.8
0.6
0.4
0.2
0.5
1.5
2.5
Time (seconds)
Note that, in the program, we used a function called rscale, that is not included in MATLAB library. rscale, simply find the factor for a full-state feedback system to eliminated the steadystate error. Credit is given to Yanjie Sun of the University of Michigan under the supervision of Prof. D. Tilbury. In addition, the result turned out to be very accurate.
% --------------------------------------------------------------------------Ts = 0.12; [numz,denz] = c2dm(num,den,Ts,'zoh'); numz = [numz(2) numz(3)]; [numz_cl,denz_cl] = cloop(numz,denz); [x1] = dstep(numz_cl,denz_cl,101); t = 0:0.12:12; stairs(t,x1) xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response of DC Motor for Discrete Model Ts = 0.1 sec') % --------------------------------------------------------------------------Step Response of DC Motor for Discrete Model Ts = 0.1 sec 0.06
0.05
0.04
m (rad/sec)
0.03
0.02
0.01
0.5
1.5 t (sec)
2.5
We observe that for sampling time equal to 0.1 sec the response behave like a desired discrete model. Therefore, it shall be the required sampling time. Now that we converted the DC motor system model to convenient discrete time model, we want to couple it to a convenient PID controller as operated for continuous time domain. The approach will not change in order to be more efficient.
PID Controller Discrete Time Domain In the step above, MATLAB helped convert the continuous time system to discrete time. Now in order to implement the PID controller, we shall apply the same process to convert the controller to discrete domain as well. The same gains will be applied except for the Integral gain; the reason being that we desire better control on the overshoot of the response. Therefore, we have:
% Discrete PID Controller % --------------------------------------------------------------------------Kp = 35; Ki = 59.2; Kd = 1.4; [dencz,numcz] = c2dm([1 0],[Kd Kp Ki],Ts,'zoh'); numaz = conv(numz,numcz); denaz = conv(denz,dencz); [numaz_cl,denaz_cl] = cloop(numaz,denaz); [x2] = dstep(numaz_cl,denaz_cl,31); stairs(t,x2) xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response of DC Motor for Discrete Model with PID Controller') % ---------------------------------------------------------------------------
Step Response of DC Motor for Discrete Model with PID Controller 1.4
1.2
m (rad/sec)
0.8
0.6
0.4
0.2
0.5
1.5 t (sec)
2.5
Figure 23:Step Response of DC Motor for Discrete Domain with PID Controller
An observation of the response shows that the system behaves as expected. It displays the exact same characteristics as the time domain response. The plot shows that the settling time is about 1.5 seconds which satisfies our design requirements.
Simulink also offer the possibility to work on state-space domain. This implies that it is not require to convert the state-space variables to time domain form in order to obtain simulation. As a result, we have the possibility to model the DC Motor simply by using the state-space variable obtained above. Therefore, we have:
Controller Design
We want to observe as done above different step responses as a result of PID gain parameters. The approach is rather simple; first create a subsystem that will be the DC motor model (above system). A second system will be implemented. It will represent the PID Controller. Finally replicate the process for changing the value of the desired gain; then display all output on a single scope using an appropriate bus creator. Thus we have:
Proportional Controller
Proportional-Derivative Controller
Proportional-Integral Controller
PID Controller
We observe the same the result as the one produced in the Matlab program. Thus, it confirms not only the viability of the model and the methodology. Now using this new and enhanced tool that is Simulink, we will produce the final response for the tuned PID Controller. Therefore, we have:
Figure 30:Step Response of Final PID Controller Tuning Kp = 30.1, Kd = 59.2, Ki = 1.4
Bibliography
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] M. Ong, Dynamic Simulation of Electric Machinery using MATLAB/Simulink, Prentice Hall, Upper Saddle River, NJ, 1998 M. S Sarma, Electric Machines: Steady State Theory and Dynamic Performance, 2nd ed, West, St. Paul MN, 1994 P. C, Sen. Principles of Electric Machines and Power. John Wiley & Sons, 1997 S. J. Chapman, Electric Machines Fundamentals, 3rd ed, WCB/McGrawHill, New York, 1998 M. H. Rashid, Power Electronics: Circuit, Devices, and Applications, Prentice Hall, New Jersey, 1988 J. J. Cathey, Electric Machine: Analysis and Design Applying Matlab, McGraw Hill Company, New York, 2011 Matlab/Simulink Software, Version 7.120 R2011a, The Math Works, Inc., 2002. H. R. Bishop, C. Richard, Modern Control Systems 9th ed Upper Saddle River, New Jersey, Prentice-Hall Inc. G. J. Bollinger, A. Neil, Computer Control of Machines and Processes, New York, Addisson-Wesley Publishing Company, 1998 R. S. Burns, Advanced Control Engineering, Boston, Butterworth Heineman, 2001. N. S.Nise, Control Systems Engineering 6th ed, John Wiley & Sons, Inc., 2006.
Appendices
Appendix A: MATLAB Source Code
clear; clear all; clc; % Motor Parameters Constants % ---------------------------------------------------kt = 0.0212; % Torque Constant kv = 1.64; % Motor Constant K = 0.0212; % Constant La = 1; % Armature Inductance Ra = 2; % Armature Resistance J = 0.04; % Moment of inertial of rotor B = 0.15; % Damping Coefficient % ----------------------------------------------------
% Transfer Function Model (angular velocity)/(armature voltage) % --------------------------------------------------------------AA = [-Ra/La -kv/La; kt/J -B/J]; % State Matrix BB = [1/La; 0]; % Input Matrix CC = [0 1]; % Output Matrix DD = 0; % Feedforward Matrix [numTF denTF] = ss2tf(AA,BB,CC,DD); disp('DC Motor Model Representation'); TF = tf(numTF,denTF) %----------------------------------------------------------------
% Verification using Transfer Function Model obtained manually % ------------------------------------------------------------num = [kt/J*La]; den=[1 (J*Ra+B*La)/(J*La) (B*Ra+kt*kv)/(J*La)]; disp('Verification Transfer Function model'); TF2 = tf(num,den) % -------------------------------------------------------------
% Step Response of DC Motor via Transfer Function % ------------------------------------------------------figure(6); step(TF) xlabel('t (sec)'); ylabel ('\omega_m (rad/sec)'); title('DC Motor Step Response via Transfer Function via State-Space Modeling');
% Step Response of DC Motor via obtained model % --------------------------------------------------------------figure(7); step(TF2) xlabel('t (sec)'); ylabel ('\omega_m (rad/sec)'); title('DC Motor Step Response via Transfer Function via Manual result');
% ---------------------------------------------------------------
% Creating the Plot for Analysis % ------------------------------------------------------figure(1); rlocus(TF); figure(2); impulse(TF); figure(3); step(TF,1); figure(4); bode(TF); figure(5); nyquist(TF); figure(8); nichols(TF); % -------------------------------------------------------
% Proportional Controller % ------------------------------------------------------Kp = [30:5:70]; for i=1:length(Kp); num_p = Kp(i)*num; den_p = den; [num_P,den_P] = cloop(num_p,den_p); step(num_P,den_P); hold on end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title ('Step Response with Proportion Control: 30 < K < 70'); % --------------------------------------------------------
% Proportional-Derivative Controller % -------------------------------------------------------Kp = 122; Kd = [0:2:10]; for j=1:length(Kd); num_pd = conv(num,[Kd(j) Kp]); [num_PD,den_PD] = cloop(num_pd,den); step(num_PD,den_PD); hold on; end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title ('Step Response with PD-Controller'); % --------------------------------------------------------
% PI Controller % -------------------------------------------------------Kp = 30; Ki = [30:10:80]; Kd = 0; for k=1:length(Ki); num_pi = [Kd Kp Ki(k)]; den_pi = [1 0]; [num_PI,den_PI] = cloop(conv(num,num_pi),conv(den,den_pi)); step(num_PI,den_PI); hold on;
end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Step Response with PI Controller'); % --------------------------------------------------------
% PID Controller % -------------------------------------------------------Kp = 30; Kd = 1.4; Ki = [30:10:80 ]; for z=1:length(Ki); num_C = [Kd, Kp, Ki(z)]; den_C = [1 0]; num_pid = conv(num,num_C); den_pid = conv(den,den_C); [num_PID,den_PID] = cloop(num_pid,den_pid); step(num_PID,den_PID); hold on; end xlabel ('t (sec)'); ylabel('\omega_m (rad/sec)'); title ('Step Response with PID-Controller'); % --------------------------------------------------------
% Continous to Discrete Modeling % -------------------------------------------------------Ts = 0.1; TF_D = c2d(TF,Ts,'zoh'); TF_CL = feedback(TF_D,1); dstep(TF_CL,1); xlabel('t (sec)'); ylabel('\omega_m (rad/sec)'); title('Stairstep Response:Original'); % --------------------------------------------------------
% Tuned PID Controller Response % ------------------------------------------------------------pidtune(TF2,'pid') Kp = 30.1; Ki = 59.2; Kd = 1.4; num_pid = [Kd Kp Ki]; den_pid = [1 0]; [num_PID den_PID] = cloop(conv(num,num_pid),conv(den,den_pid)); step(num_PID,den_PID); xlabel('t (sec)'); ylabel ('\omega_m (rad/sec)'); title('Step Response of DC Motor with Tuned PID Controller'); % -------------------------------------------------------------