186 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) ISSN (Print) 2313-4410, ISSN (Online) 2313-4402 © Global Society of Scientific Research and Researchers http://asrjetsjournal.org/ Modeling and Performance Evaluation of P, PI, PD and PID Temperature Controller for Water Bath J. S. Madugua*, P. G. Vasirab a,bDepartment of Pure and Applied Physics, Adamawa State University, Mubi, Adamawa State, Nigeria aEmail: justinemad@gmail.com bEmail: ask4glandu@gmail.com Abstract Water bath temperature control is one of the most widely used processes in academic laboratories and industries. It usually contains single or mixture of liquid substances whose temperature is the subject of control. In this paper, a performance evaluation of P, PI, PD, and PID algorithms for the system was investigated. A mathematical model of the first order system was derived using the lumped parameter model. The time constant of the water bath was obtained theoretically and found to be 356s and time lag of 5s. The gain of the heater of 1500 W was computed and found to be 0.047 oC/K. An open loop reaction curve of the system was then obtained by measuring the temperature response to step input against time and plotting same using MATLAB. The P, PI, PD and PID control strategies were subsequently designed to control the temperature of the water bath. The compensators were manually tuned to P = 3000; P = 21.5599, I = 0.0034539; P = 22.7179, D = 0.0067356; and P = 25.4904, I = 0.0034802, D = 10.5302 respectively. These gains were used to manipulate the temperature set points for the water bath. The performance of the MATLAB simulated results were evaluated and compared against each other. The results show that P control requires high step input (3000 W) though the offset could be reduced. The PI control on the other hand exhibits fast response and reduced steady state error. PD control for the plant was found to be highly unstable for all the tuned values of the gains which makes it unfit for the first order system. The PID compensator provided compromise between the P and PI. It exhibited a rise time of 541s, settling time of 794s and an overshoot 1.10%. Keywords: Water bath; PID; compensator; offset; response; heater; steady-state; open-loop. ------------------------------------------------------------------------ * Corresponding author. http://asrjetsjournal.org/ American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 187 1. Introduction A water bath is a tank−heater system with single feed stream and single output stream. It is a vessel which is usually adiabatic that contains some liquidized food materials in which its objective is to control the temperature of the mixture. Reference [1] Water baths are used in industrial clinical laboratories, academic facilities, government research laboratories, environment applications as well as food technology and water plants [2-5]. Because water retains heat so well, using water baths was one of the very first means of incubation. Applications of Water Baths include sample thawing, bacteriological examinations, warming reagents; coli form determination and microbiological assays [6-8]. Temperature is the most often measured environmental quantity. This might be expected since most physical, electronic, chemical, mechanical and biological systems are affected by temperature. Some processes work well within a narrow range of temperatures. Certain chemical reactions, biological processes and even electronic circuits perform best within specified temperature ranges. When the processes need to be optimized, control systems that keep temperatures within specified limits or constant are often used [9]. The field of process control has grown rapidly since its inception in the 1950s. It has become one of the core areas of chemical engineering. One of the most important process variables to be controlled is temperature of liquids in industrial problems [10]. Water bath temperature control is one of the most important and widely used in process control industries. Its application in the production of a variety of products is common in process industries such as Nestle and Yeoh Seng [11-13]. Since temperature is critical in such processes, its lack of proper control will result in defective products or damage to the plant. Hence suitable temperature controller for water bath is one of the common requirements of industry. While significant number of works, in industry and academic, has been done on water bath temperature control, it still continues to elicit interest because of the critical role it plays in the quality of products and safety. 2. Materials and Method In this study, a water bath was constructed. The temperature gain of the system was then obtained by supplying power to the plant and measuring the temperature variation with an MAS 345 digital multi-meter with computer interface. The reaction curve of the bath water bath was obtained using both experimental and theoretical parameters. The major tool used is MATLAB along with laptop computer. 2.1 Thermal model of the water bath The major components of the water bath are water tank, coil heater, sensor and stirrer. The physical size of the bath is 4 litters. The heating element is fixed inside the bath. It has suitable inlet and outlet and stores water. The temperature of this water is to be kept constant at desired value. A temperature sensor is used for the measurement of the process variable, temperature, inside the bath. The output of the sensor which is proportional to the temperature is feedback to the controller to initiate necessary steps for taking proper control American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 188 action. Since water is characterized by heat capacitance, it has negligible resistance to heat flow. Thus, θ∆= Kq (1) where: q = heat flow rate, kJ/s Δθ = temperature difference, oC K = Coefficient, kJ/s oC For heat transfer by convection or conduction between two substances, Kdq dRT 1)( = ∆ = θ (2) Since thermal conductivity and convection coefficients are almost constant, the thermal resistance for either conduction or convection is constant. The thermal capacitance, CT is defined as: mcCT = m = mass of substance considered in kg c = specific heat of substance in kJ/kg oC Figure 1: Thermal model of the water bath The diagram of the water bath thermal system is shown in Figure 1. It consists of a heat tank, heater, sensor, and a stirrer. The vessel consists of one inlet and one outlet. The tank was locally fabricated and has a 1500 W boiling ring fitted into it. The tank was insulated to prevent heat loss to the environment. Since in practice, it American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 189 might not be easy to isolate the system from interaction with the ambient conditions, several assumptions were made. It is assumed that the tank is insulated to eliminate heat loss to the surrounding air. It is also assumed that there is no heat storage in the insulation and that the liquid in the tank is perfectly mixed so that it is at a uniform temperature (notwithstanding the position of the heater). Thus a single temperature is used to describe the temperature of the liquid inside the tank and of the outflowing liquid. Defining the system variables: Өi = steady state temperature of inflowing liquid, oC Өo = steady state temperature of outflowing liquid, oC L = steady state liquid flow rate, kg/s m = mass of liquid in tank, kg c = specific heat of liquid, kJ/kg oC RT = thermal resistance, oC s /kJ CT = thermal capacitance, kJ/oC Q = steady state heat input rate, kJ/s It is also assumed that the temperature of the outflowing liquid is kept constant while the heat input by the heater is varied from Q to Q + qi. The heat flow rate will then vary gradually from Q to Qo. Consequently, the temperature of the outflowing liquid will also vary from Өo to Өo + θ. Then, θLcqo = mcCT = Lcq R o T 1 == θ (3) The heat balance equation for this system is: dtqqdC oiT )( −=θ or oiT qq dt dC −= θ (4) which may be re-written as: American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 190 iTTT qR dt dCR =+θθ (5) Note that the time constant of the system is τ== L mCR TT (6) The transfer function relating θ and qi in (5) is given by: )()()( sQRsssCR iTTT =Q+Q )()1)(( sQRsCRs iTTT =+Q 1)( )( + = Q sCR R sQ s TT T i , which implies that: 1)( )( + = Q s K sQ s i τ (7) Design requirements are that the system should have minimum overshoot and minimum settling time with minimum steady state error. The accuracy with which the control system will meet the design specifications rests on the accuracy of the mathematical model, design methodology, tools and skills and experience of the designer [15]. For this work, obtaining the thermal model of the system is reduced to finding the gain K and the time constant τ. Simple open loop experiment shows that for range of initial temperatures (27−97oC) and heat input (1500W), K ≈ 0.047oC/W. The time constant of the process could be theoretically obtained. Given that the heat capacity of water, CT = 4.184kJ and since the mass of the 4 liters water inside the bath is 4 kg, it follows that: τ = RTCT = 21.43 × 4.184 ×4 = 356s. Also, since the response of the heater is not instantaneous, the system will have a dead time, 5s, as shown in Figure 2. It follows from Figure 3 that the transfer function of the system from equation (7) is given by: 1356 047.0 )( )( 5 + = Q − s e sQ s s i (8) Equation (8) is the transfer function of the systems with dead time td = 5s American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 191 Figure 2: Reaction curve: dead time Figure 3: Reaction curve: time constant 2.2 P−Control The closed loop transfer function is expressed as: 1 1. 11 1 1 1 )( )( , ++ = ++ = + + += Q sKK KK KKs KK s KK s KK sQ s p p p p p p i ττ τ τ where: 1 , + = pKK ττ For a unit-step input, s AsQi =)( , )1( . 1 )( , ++ =Q ss A KK KK s p p τ (9) or,         − + = − ,1 1 )( τ τ θ s p p e KK AKK t (10) From (8) and (P control), it can be seen that the response time improves by a factor 1 1 +pKK , that is, the time constant decreases. There is also a steady state offset between the desired response and the output response: 11 1 + =        + − pp p KK A KK KK A American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 192 (11) This steady state offset error can be reduced by increasing the proportional gain. For higher order system, increasing the gain causes oscillation. This is demonstrated by the result of the simulation of Proportional control algorithm in Figures 2.2 PI control PI−action provides the dual advantages of fast response due to P−action and the zero steady state error due to the I−action. The error transfer function of the above system can be expressed as: where the characteristic equation for PI action is (12) Solving (10), τ ζ p ip KK TKK         + = 2 1 (13) For the PI control action, the damping constant can be changed by varying Kp. This implies that for PI, steady state error can be brought down to zero while the transient response can be improved. 2.3 PD control The transfer function of a PD controller is given by: (14) PD control for the process transfer function 1 )( + = s KsF τ is obviously not very useful since it cannot reduce the steady state error to zero. 2.4 PID control A PID controller is the classical control algorithm in the field of process control. Its predominance of conventional controller in the process control remains satisfactory for many years due to its robustness and effectiveness for a variety of operating conditions and its function simplicity. ppii i i ipi KKKKsTTs ssT ssT sTKKsQ se +++ + = + + + = )1( )1( )1( )1( 1 1 )( )( 2τ τ τ 0)1(2 =+++ pipi KKsTKKsTτ )1()( sTKsU dp += American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 193 A PID controller provides smooth and fast change of parameters without oscillation. Majority of appliances at home and some water baths use on-off control algorithm. While being relatively simple, the main drawback is that, it is unstable and oscillatory temperature due to the inertia of the heater. The control system is simplified to a single input single output (SISO). This implies that all disturbances into the system are neglected. The controller could take different structures which means different design methodologies are available for designing the controller in order to achieve desired performance level. The output of the PID controller U(t) can be expressed in terms of the input e(t) as:         ++= ∫ t i dp de Tdt tdeTteKtU 0 )(1)()()( ττ (15) where U(t) is the manipulated variable, e(t) the error signal and Kp, Ti, and Td represents proportional, integral and derivative gains respectively [20]. Obviously, a suitable combination of proportional, integral and derivative actions provides the design requirements of the water bath system, .and the transfer function of the controller is given by: (16) Simulations tools help define the recommended PID gains. The gains are tuned, thus: 1818 235.0 2.4272.1 === d p Kt K τ ; 10.0 52 1 2 1 = × == d i t K ; 50.25.0 == dd tK This tuning of gains and control of temperatures is found in many literatures [16-18]. A PID Controller computes an error value as the difference between a measured process variable and a desired set point. It then attempts to reduce the error by adjusting the process through use of a manipulated variable. The weighted sum of these three actions (PID) is used to adjust the process via a control element such a Triac which supplies power to the heating element. 3. Results and Discussion Figure 4 is the steady state closed loop response with only the proportional compensator. This unturned steady state response demonstrated fast response (7.96s) and quick settling time (14.20s). While it is important that a system should response fast to step input, it is much more important that there should be no steady state error. Figures 5 and Figure 6 show that there is steady state offset between the set point temperature and the output response. This steady state offset reduces as the proportional gain is increased. However, increasing the gain also means that a larger heater would be needed to meet such response. Table 1 show that even when the gain is increased to 3000, there is still offset or steady state error. Proportional control for this system is only used within a narrow band.         ++= sT sTKsU dp 11)( American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 194 Figure 4: Un-tuned steady state response for P = 1818 Figure 5: Steady state response for P = 100 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 195 Figure 6: Steady state response for P = 3000 Figure 7 shows the unturned MATLAB simulated closed loop steady state control with proportional and integral (PI) control action. Obviously, the rise time is relatively short and the settling as well. However, the system overshoots (20.1%). However, the response can be improved (equation 13) by varying the proportional gain, Kp. Obviously, the response could also be improved by varying the integral time. Figure 8 shows the PI control action driven by fast integral time (56.1798 and low proportional gain (0.0047576). The system has long rise time and very long settling time (2800s) and overshoot of 46.6%. This implies that whereas the proportional gain could be reduced, it makes the system to oscillate until 2800s before it achieve stability. Figure 9 is a better tuned system. The overshoot is significantly reduced to 0.664%, though the response is still relatively high as seen in Table 1. Figure 7: Steady state response for P = 1818; I = 0.10 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 196 Figure 8: teady state response for P = 0.0047576; I = 56.1798 Figure 9: Steady state response for P = 21.5599; I = 0.0034539 Figure 10 shows the unturned proportional and derivative (PD) control response. The system does not only oscillate but is very unstable. Figure 11 is the tuned response. Though the system rise and settling times have improved, the steady sate offset cannot be reduced to zero. Apparently, PD control is not so useful to the simple first order system (equation 7) under consideration. Figure 10: Steady state response for P = 1818; D 2.50 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 197 Figure 11: Steady state closed loop response for P = 22.7179; D = 0.0067356 The MATLAB simulated unturned steady state closed loop response of the PID compensated system is shown in Figure 12. It shows that the system is highly unstable due to the oscillation. This oscillation is very unhealthy for systems. Figure 13 shows the tuned PID response. Though the response in Figure 13 is slower than either P or PI, the gains (P = 25.4904; I = 0.0034802; D = 10.5302) as in Table 1 are relatively lower (as against P = 3000), which means a heater with smaller input power could be employed. The overshoot is also relatively low. Figure 12: Steady state response P = 1818; I = 0.10; D = 2.50 Figure 13: Steady state response for P = 25.4904; I = 0.0034802; D = 10.5302 American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 198 Table 2: Summary of results for P, PI, PD and PID compensation S/No. P I D Rise time (s) Settling time(s) Overshoot (%) Peak Closed loop stability 1 1818 7.96 14.2 0 0.988 Stable 2 100 136 243 0 0.825 Stable 3 500 30.90 55 0 0.959 Stable 4 1000 15.2 27.10 0 0.979 Stable 5 2000 7.15 12.70 0 0.989 Stable 6 3000 4.42 7.87 0 0.993 Stable 7 1818 0.10 4.97 30.50 20.10 1.20 Stable 8 0.0047 56.1798 211 2800 46.60 1.47 Stable 9 21.5599 0.0034539 612 936 0.664 1.01 Stable 10 1818 2.50 NaN NaN NaN Inf Unstable 11 22.7179 0.0067356 331 1170 9.96 1.10 Stable 12 1818 0.10 2.50 NaN NaN NaN Inf Unstable 13 25.4904 0.0034802 10.5302 541 794 1.10 1.01 Stable 3.2 Conclusion From the results of the simulation and Table 1, it is found that tuning the P controller. However, it introduces steady state errors. Therefore, it is not suitable for the thermal model under study. The PI controller is also found not to cause the offset exhibited by P control. It is suitable for use in systems which do not have large time constants. From the results, it could also be concluded that PD control is suitable for only higher order system , not like the first order system under study. PID control is generally found to be the best compromise between the other three compensators studied. It finds universal application, though tuning the gains is more challenging. It is best used for controlling slow process variables, such as temperature as studied. References [1] M. F. Basar and N. Hasim. A Water Bath Control System in a Virtual Laboratory Environment. Journal of Computer Science and Engineering, Volume 9, Issue 1, September 2011. [2] N. Hasim, M. F. Basar, M. S. Aras. “Design and Development of a Water Bath Control System: A Virtual Laboratory Environment”, IEEE Students Conference on Research and Development (SCOReD, 2011). [3] M. Khalid and S. Omatu. A neural network controller for a temperature control system, IEEE Control American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 199 Systems, Vol. 12, pp.58−64, June 1992. [4] P. M. Mary, N. S. Marimuthu and A. Singh. Design of Intelligent Self-Tuning Temperature Controller for Water Bath Process, International Journal of Imaging Science and Engineering, pp. 121−124, Vol. 1, No. 4, October 2007. [5] B. Claudia, F. Cesare and R. Riccado.” International Summer School on Fuzzy Logic Control: Advance in Methodology”, Singapore World Scientific, 1998. [6] K. Shimojima, T. Fukuda and Y. Hasegawa, self-tuning fuzzy modeling with adaptive membership function rules and hierarchical structure based on genetic algorithm, Fuzzy Sets Syst., Vol. 71 pp. 295−309, 1995. [7] J. G. Dawson, Z. Gao and T. A. Trautzsch. “A Stable Self-Tuning Fuzzy Logic Control System for Industrial Temperature Regulation”. [8] A. Lindsay, D. Liu, S. Murray and D. Lowe. “Remote Laboratories in Engineering Education Trends in Students’ Perceptions”, Proceedings of the 2007 AaeE Conference, Melbourne. [9] S. D. Markande, P. M. Joshi, S. K. Katti. Microcontroller Based Temperature Controller Implementation of Fuzzy Logic, IE (I) Journal−CP, Vol. 85, May 2004. [10] E. H. Goud, A. Harshika, G. Akhil, D. Charishma, K. Bhupathi and I. K. Swamy. Real Time Based Temperature Control Using Arduino. International Journal of Innovations in Engineering and Technology, Volume 8 Issue 2, April, 2017, pp. 209−215. [11] O. P. Verma, R. Singla and R. Kumar. Intelligent Temperature Controller for Water-Bath System; World Academy of Science, Engineering and Technology. International Journal of Electrical and Computer Engineering, Vol. 6, No. 9, 2012. [12] P. Madheswari and L. Rose. Temperature Control using Artificial Intelligence in Water Bath System. International Journal on Advanced Electrical and Computer Engineering, Volume-1, Issue-1, 2014. [13] T. Kativa, B. N. Parvathi, M. Lavanya and M. Arivalagan. Temperature Control Water Bath System using PID Controller, International Journal of Applied Engineering Research, Vol. 10, N0. 4, 2015, pp.3443−3446. [14] Katsuhiko Ogata (2012). Modern Control Engineering, PHI Learning Private Limited, 5th Edition, New Delhi. [15] Farhan, A. S. and Albaradi A. R. PID Controllers and Algorithms: Selection and Design Techniques Applied in Mathematical Syaytems Design−Part II. International Journal of Engineering Sciences, 2(5) May, 2013, pp. 191−203. American Scientific Research Journal for Engineering, Technology, and Sciences (ASRJETS) (2018) Volume 47, No 1, pp 186-200 200 [16] J. Tavoosi, M. Alaei, B. Jahani and M. A. Daneshwar. A Novel Intelligent Control System Design for Water Bath Temperature Control, Australian Journal of Basic and Applied Sciences, 5(12): 1879−1885. [17] L. Xinping and Z. Xiaodong. Multi-variable Fuzzy Controller for Water Tank Temperature Control System, International Journal of Digital Content Technology and its Application (JDTA), Volume 6, Number 13, July 2012. doi:10.4156/jdeta.vol6./Issue13:10 [18] Y. V. Parkale. Comparism of ANN Controller and PID Controller for Industrial Water Bath Temperature Control System using MATLAB Environment. International Journal of Computer Applications (0975−8887), Volume 33, No. 2, September 2012. [19] R. J. Richards. Solving Problems in Control, Longman Scientific and Technical Group Ltd, John Wiley and Sons Inc., New York, 1993. [20] M. Ramzi, H. Youlal, and M. Haloua. Continuous Time Identification and decentralized PID Controller of an Aerothermic Process, Instrumentation Journal of Smart Sensing and Intelligent Systems, Vol. 5, No. 2. June 2012.