An educational tool for DC motor PID speed controller

In this study, an educational tool was prepared for a direct current (DC) motor, proportional (P), integrated (I) and derivative (D) speed controller with a shorter term and more economic education of the control systems. Parallel with the improvements of industrial technology, the development of computer and control technology has magnified the importance of either the theoretical or practical education of the motor speed control. The education of motors speed control in laboratory is very important, but this education is usually difficult because of a lot of abstract equations, difficult motor dynamic models and PID parameters. To overcome the mentioned negativities, an education tool was prepared for the education of DC motor speed control with PID controller. The tool which was prepared on C# environment has a flexible structure and a graphical interface. It has enabled the analysis of working principles of the P, PI, PD and PID control and traceability of the system response by the help of graphics, under different conditions created by changing the values of PID parameters. Besides, the motor could control the motor speed and reference speed and the changed PID parameters can be observed in the distance space over the internet.


INTRODUCTION
In recent years, computer-assisted education method is frequently used for training most of the engineering disciplines such as electronics, mechanics and computer (Master et al., 2005;Huang and Lu, 2004;Spanias et al., 2000;Marin et al., 2005;Djordjevic et al., 2005;Chang et al., 2003).Computer based educational tools can be used in some courses in which laboratory education is important such as DC motor speed control, on account of being more flexible and interactive.In applied education of motor control course (laboratory-workshop), there are many negative factors, such as: probable risks of electrical accidents in laboratory for students, breaking down of circuit equipment due to misuse, high prices and hard supply of those materials (Ko et al., 2001).Another factor is that laboratory education takes long time and high cost.These negativities of motor control during laboratory education can be overcome by the usage of a simulator (Stark et al., 1998;Pedro et al., 2005;Lin et al. 2002).
With a suitable simulator analyser, the design and development of the motor control could be easier, shorter and with a low-cost (Hurley and Chi, 2005;Drofenik and Kolar, 2003;Sivakumar et al., 2005;Sepe et al., 1999;Wong and Kapila, 2005).In a computer simulation, currents, voltages and speed of all circuit elements can be examined and in fact, much more effective results than a laboratory experiment can be obtained (Chang and Hung, 2000;Chen et al., 1999;Harkin et al., 2002, Gustavsson, 2002;Record, 2005;Stafford, 2005;Hernandez et al., 1999;Akcayol and Yigit, 2004;Pires and Silva, 2002;Daniel, 1993).On the contrary, as regards the laboratory environment, with the help of computer simulation, the effect of the change that occurred in values of circuit elements on the performance of the circuit can be examined easily.For power measures and spectrum analysis of such experiments, proper devices should be used.Due to high cost and hard supply of these devices, they may not be provided for each student or not always be present at a laboratory (Debebe and Rajagopalan, 1995).As a result of all these reasons, using a suitable simulator program during the education process may help students to learn and develop motor control and improve the education quality of motor control course.Nowadays, there are many types of software which can simulate motor control.System memory, RAM capacity and processor speed are the factors that restrain the performances of these softwares (Akcayol et al., 2002).The appearance of Microsoft Windows has removed the prolixity of programs, which have been created on DOS environment through its visual menus and functional user interface.Studies are proceeding in order to produce an educational tool which has a graphical interface (Gustavsson, 2002).Hernandez and his friends have prepared an educational tool of Power Electronics called "Power Lab", which describes the working principle of DC Motors and AC/DC Converters (Hernandez et al., 1999).
There are some commercially available programs that can simulate motor control circuits.By drawing the circuit shape on the computer screen, using programs like ELECTRONICS WORKBENCH (developed by Ultimate Technology) and MICROCAP (developed by Spectrum Software, Sunnyvale, CA 94086-8874 USA), it is possible to carry out the simulation; but, even though these programs are visually user-friendly, they have limited features for the simulation of motor control circuits (Record, 2005) (Stafford, 2005), serves as a general circuit simulation software tool for power system work.They are easy to use and have an effective interface.Another advantage of PSPICE Program is that it has a large integrated library, but it is also possible to come across high oscillations due to the constancy of sampling time during the numerical analysis of circuit equations (Masters et al., 2005;Djordjevic, 2005).Programs such as MATLAB-Simulink (developed by Mathworks, Inc Natick) and MATRIXx (developed by National Instruments Corperation) are other software packages which simulate motor control circuits.MATLAB-Simulink program has a lot of advantages structure with tool boxes of fuzzy logic and artificial intelligence.As a result of this, the controlled simulation of motor control circuits can be performed.For all that, because of its complicated structure and impracticability, only master degree students can use it for training during a limited time period (Chang et al., 2003).These programs can be used for the simulation of power electronics and motor control simulations.However, because of those disadvantages (complicated structure, commercial difficulty), they may not be useful in the education process of the control systems' course.
So, in this study, an educational tool for cost-effective education and training of motor control is presented.The tool is a part of a control systems course, which helps students learn the operational principles of DC motor speed control.Within the context of control systems course, this tool is composed of the simulators of DC, motor, induction motor modeling and speed control, transfer functions, P, PD, PI and PID.The tool has been written on C# environment and the setup files have been created.It has a flexible and functional interface.Motor control parameters can easily be changed in the program menu and the motor speed, which responds under different working conditions, can be examined by the help of graphs.
As a matter of fact, this tool has been used in control systems course at the Electrical Education Department, Technical Education Faculty, Gazi University and its positive contributions for student development have been observed.

PID controller and motor modelling
Block diagram of the PID controller is shown in Figure 1.In this figure, the closed-loop system in t-domain with negative unit loop gain is represented (Lyshevski, 1999).
The linear PID control law is given as: where e(t)=r(t)-y(t) is the error between the reference signal and the system output, and kp, ki, and kd are the proportional integral and derivative feedback gains, respectively.If the kd parameter is equal to zero, the proportional-integral (PI) controller is obtained.Alternatively, the integral feedback coefficient ki is set to be zero, if one obtains the proportional derivative (PD) controller, and moreover If the ki and kd are set to be zero, the proportional (P) control law is achieved.If the system output y(t) tracks the  reference signal r(t) as time approaches infinity, then perfect tracking is achieved as: e(t)=r(t)-y(t)=0 as

∞ → t
For most of the systems, ki, kp and kd feedback gains can be found in the following way.For the specified reference input r(t)=const, the integral and derivative feedback is set as equal to zero; that is, ki=0 and kp=0.Thus, one increases the proportional feedback gain kp to the critical value max p k .When the system is marginally stable, y(t) is bounded, but the system exhibits the sustained oscillates.
Typically suggested values of the feedback coefficients that can be applied to the PID-type controllers can be seen in Table 1 (Lyshevski, 1999).It must be adjusted first to provide acceptable performance and derivative feedback in order to improve the stability and decrease the overshoot and oscillations.The integral feedback allows one to decrease or eliminate the study-state error.
PMDC motors have been widely used in high-performance electric drives and servo-systems.A schematic diagram of PMDC motors and PM generator are illustrated in Figure 2. In this study, a PM generator driven by PMDC motor was used.
The goal of the study is to analyze the transient and steady-state of the system.Therefore initially, a mathematical model of system including the generator and prime mover dynamics should be derived.
Using Kirchoff's voltage law and Newton's second law of motion, the differential equations for permanent magnet DC motors can be easily derived.Assuming that the susceptibility is constant, one For the fact that the permanent magnet motors do not have field winding, torque constants are denoted by ka=Laf.if,.The motor has the following parameters: ram = 2.7 ohm, La = 0.004H, ka = 0.105 Vs/rad, ka = 0.105 Nm/A, J = 0.0001 kgm 2 , and Bm = 0.000093 Nms/rad.Block diagram of PMDC motor by PID controller is shown in Figure 3.
Motor control systems are generally composed of power processors shown in Figure 4 (a).The location of the switch affects Voi voltage in the circuit.For example, if Voi = Vs is switched on and off, then Voi = 0.The wave form for the switched voltage, voi was shown in Figure 4(b) and the duty ratio of the switch, D=ton/Ts, is determined by the controller of the real system depending on the working conditions.Figure 5 shows picture of the DC motor, generator and driver device, while the circuit diagram is shown in Figure 6.

Sample application performed by educational tool
Here, in order to explain the tool, sample applications were given.
The tool is a Windows based application.When the program is set up, the user interface shown in Figure 7 comes up on the screen.The flow chart of the user interface control application is given in Figure 8.As could be seen, students can easily start, stop and choose rotation direction of the motor in terms of user interface.Moreover, parameters of the PID controller could be set up by means of the same user interface.Additionally, the motor could be run in either local computer or internet.With this feature of application, students could be trained through the internet.
Therefore, this application could also be used for distance learning.

Experimental results
The transient and steady-state performance of the control system was tested with different reference speeds and various PID parameters.On the graph page, current and voltage graphs belonging to the circuit elements exist.Current graphs of circuit elements are located on the right side of the page and the voltage graphs are located on the left side of the page.Each graph on that page can be saved individually or they can be copied by using the "Copy" key which stands on the same graph with Microsoft Word, and then pasted on a word processor program page.Besides, graph pages can be printed out by using the keys at the bottom of the page and the page can be wholly saved as a picture file in "bmp" format.This feature of the graph pages provides the student with the ability to reach his/her previously studied and saved graphs easily without running the program and thus he/she can compare them with other graphs.The graph page is shown in Figure 9.The only reference and actual speed of the motor were considered.For example, Figure 9 (a) shows performance of the controller when the parameters of PID controller was incorrectly set.As could be seen, there is a steady state error.On the other hand, when the parameters of the controller were chosen correctly, the tracking performance shown in Figure 9

Educational evaluation of tool
The prepared tool was applied for the first time in the control systems course for the 4 th grade students of Electrical Education Department, Technical Education Faculty, Gazi University.The course contains 3 h theoretical and 2 h laboratory education.In the context of the course, there are basic control techniques which are composed of stability, controllability of dynamic systems, P, PI, PID and PD control.In the laboratory section of the course, the real experiments were performed.With the tool, the circuits of the course context were simulated and designed in order to help students in both the theoretical  and laboratory parts of the course.Before using the tool, the students took 3 h theoretical education.The working principle of the motor control with the aforementioned PID systems is described during the theoretical education.Subsequently, in the laboratory, the students did the experiments of the described circuit by using the tool.
The experimental results are recorded in the "experiment page" which takes place in the tool and are presented as a report the week after.After each course of the tool, the subjects are reviewed by real circuit experiments.The tool has been produced according to results of real circuit experiments.Therefore, the students can analyze the circuit results in a realistic way through the tool under different loads easily, and individually understand the working principle of the circuit without wasting much time.
The DC motor speed control systems educational tool has been designed for the purpose of achieving the educational aim explained as follows.By using this tool, the students: (i) Understand the principles of speed control and the effect of such as K i , K p and K d parameters.
(ii) Store the motor speed graphics and data.
(iii) Can be ready for real laboratory experiments by making realistic experiments via computer.
(iv) While improving their knowledge, they also save their time.
The educational results have been compared before and after using tool.The answers of the students have been obtained via evaluation sheets as shown in    training methods through this tool.On the basis of this idea, it is intended that everyone who wants to have the tool can get it easily.

Conclusion
In this study, an educational tool was prepared in order to improve the education quality of the control systems' course.This tool helps students to learn and develop the control system and DC motor control by PID control method and the effect of the PID control parameters.Besides, students can do new experiments for PID parameters and they can see the response of the motor's different speed by changing easily the PID control variables.It is not only that the students have learnt at their own progressive rate, but they have actively participated with more interest as well.This has been brought visually in the foreground during education and has provided individual education.Moreover, the students can accumulate the graphs or they can see at any time that the graph or part of it is their concern.The tool has a flexible structure and a functional interface; therefore, the PID variables can be changed easily and the motor speed which responds under different conditions can be examined by the help of graphs.Thus, they do not need any tachometer or speed sensor.On account of this feature, it can be used easily for both their education and program development by instructors.The results, obtained from the students that have experienced the tool, are quite positive.Hence, it can be installed easily into a computer with Windows application.

Figure 1 .
Figure 1.A closed-loop control system with negative feedback.

Figure 2 .
Figure 2. Permanent magnet DC generator driven by PMDC motor.
supposes that the flux established by the permanent magnet poles is constant.Then, denoting the back emf and torque constants as ka, one obtains the following differential equations describing the transient behavior of the armature winding and torsionalmechanical dynamics:

Figure 5 .
Figure 5. Picture of DC motor, generator and driver.

Figure 6 .
Figure 6. Circuit of motor control unit.
(b) was achieved.The step change in speed reference could also be tested in real time by students.Figure 10 (a) shows the response of the system from 250 to 500 rpm, while Figure 10 (b) shows the reaction of the motor from 500 to 1000 rpm. Figure 11 (a) shows the response of the system from 1000 to 1500 rpm, while Figure 11 (b) shows reaction of the motor from 1500 to 2000 rpm. Figure 12(a) shows the response of system from 2000 rpm to 1500 rmp while Figure 12(b) shows reaction of motor from 2000 to 500 rpm.It can be seen that in all figures there is a time delaying between start comment time and release times.Because of this delaying it was used relay as a switching element instate of power electronic elements.

Figure 10 .
Figure 10.Response to step change.(a) Parameters of the controller chosen incorrectly; (b) parameters of the controller chosen correctly.

Figure 11 .
Figure 11.Response to step change.(a) Parameters of the controller chosen incorrectly; (b) parameters of the controller chosen correctly.

Figure 12 .
Figure 12.Response to step change.(a) parameters of controller were chosen incorrectly (b) parameters of controller were chosen correctly.

Table 1 .
Typical values of feedback coefficients for PID-type controllers

Table 2 .
The results for tool presentation are quiet positive.The scores of laboratory homeworks are higher than the scores of previous years.Instructors can develop new ideas and