The Development of a Matlab-Based Fuzzy PID Controller and The Simulation

: Fuzzy PID control is a process control technique combining the advantages of fuzzy logic and PID control. It maintains precise control over processes by combining fuzzy logic and proportional-integral-derivative (PID) controllers. With this method, it is possible to achieve higher levels of accuracy and stability in controlling process variables such as temperature, pressure, flow rate, and position. This makes Fuzzy PID control an ideal cordial application requiring precise process control. Fuzzy PID control uses the PID parameter tuning experience to make the fuzzy controller automatically tune its parameters, giving PID control a better control effect. In this paper, a fuzzy PID controller is designed to control the temperature of an electric boiler. The control effects of PID control, fuzzy control, and fuzzy PID control are compared by simulation analysis. The simulation results show that the unclear PID control effect is ideal and has a good application prospect.


Introduction
Fuzzy controllers are automated control systems that use fuzzy logic to make decisions and take action. They are employed in several tasks, from robotics to business operations. One of the most prevalent fuzzy controllers is the Proportional Integral Derivative (PID) controller.
It can adjust the output based on changes in the input variable. Another type of fuzzy controller, Type 1 Fuzzy Logic Controller (FLC), is used for more complex applications such as process optimization and nonlinear control systems (Kafle, 2020). It combines both rulebased data-driven approaches to make decisions and take (Muškinja et al., 2023). Fuzzy PID control is a powerful tool for controlling complex systems. It uses fuzzy logic to adjust the parameters of the PID algorithm in ortomize system performance (Li-guo, 2012).
controllers are becoming increasingly popular in various industries due to their ability to make decisions based on unclear input data (Valášková et al., 2014). Fuzzy PID control is a widely used method of controlling the behaviour of a process. It combines the advantages of the PID controller and fuzzy logic to provide an effective and efficient solution for controlling complex systems (Yong-juan, 2009).
PID control is widely used as a classical control system, and it can achieve satisfactory results in systems with precise mathematical models. However, in practical applications, when the mathematical model of the controlled object changes, it is difficult to adjust the PID parameters in real-time, and the mechanism of a large number of controlled processes is complex, the establishment of the mathematical model of the controlled object is complicated.
The control effect is not ideal (Jinyu & Tao, 2015;Zhou, 2022). Fuzzy control has the characteristics of intelligence. It does not depend on the mathematical model of the object and has specific adaptability to the time-delay, nonlinear, and time-varying controlled object (Weiwen, 2006). However, the control rules limit the accuracy of fuzzy control, and there is always a steady-state error. Fuzzy PID control utilizes the experience of adjusting PID parameters to design a fuzzy controller to automatically adjust the PID controller's parameters to find the most suitable parameters for the PID controller (Zhang, 2014). In this paper, a fuzzy PID controller based on Matlab is used to control the temperature of an electric boiler. The results of traditional PID control, fuzzy logic control, and fuzzy PID control are compared through experimental simulation (Morilla, 2012).

Analysis of Controlled Object
The electric boiler is an energy conversion device that directly converts electrical energy into heat energy (Jiantao et al., 2020). Its working principle is similar to that of the traditional boiler. The control object in this paper is a direct-heated hot water boiler, which is heated by resistance. The working pressure is 0.4 MPa, and the maximum water temperature in the boiler is 95℃.
In the production process, there are various electric boilers. The theoretical analysis and experimental results show that an electric heating device is a self-balancing object, which the pure delay link of the second-order system can describe. The second-order system can be reduced to the first-order model by parameter identification. Therefore, the temperature control system of an electric boiler can generally be described by a first-order inertial lag system. The model's transfer function can be described by Equation 1.
According to the reference (Wang, 2014), the transfer function of the control system in this paper is defined as Equation 2.

Research of Control Strategy
The applicable research scheme is determined by studying the structure and system of the electric boiler. The first control scheme that can be adopted is PID control, the most typical control method in classical control theory. Most linear time-invariant systems in industrial production use the classical control method, which is easy to implement and eliminates steady-state error. In most cases, the traditional PID control can meet the performance requirements (Zhou, 2022).
The second available solution is fuzzy control because it is an intelligent control technology based on prior knowledge and expert experience as the control rule. It can simulate the human reasoning and decision-making process and realize a good control effect without knowing the mathematical model of the controlled object. Moreover, the response time of fuzzy control is short, and the system overshoot is low.
When the PID control and fuzzy logic control are combined, another kind of control can be realized: fuzzy PID control. Fuzzy PID control uses fuzzy logic to optimize PID parameters in real time according to certain fuzzy rules to overcome the shortcomings of traditional PID parameters that cannot adjust PID parameters in real time. It has both advantages of PID control and fuzzy logic control.

PID Control
PID control is a widely used control method in the production process (Live et al., 2017). It is a proportional, integral, and differential parallel controller. The conventional PID control system block diagram is shown in Figure 2.1.  The ideal PID controller is based on the control deviation ( ) formed by the given value ( ) and the actual output value ( ).
The PID controller algorithm involves three separate constant parameters and is accordingly sometimes called three-term control: Proportional (P), Integral (I), and Derivative (D). The proportional, integral, and derivative terms are summed to calculate the output of the PID controller. Defining as the controller output, the final form of the PID algorithm is: Where ( ) is the output of the controller, ( ) is the input of the controller, ( ) is the proportional term, is termed the proportional gain, ∫ 0 ( ) is the integral term, is termed the integral gain, ( ) is the derivative term, and is termed the derivative gain.
A PID controller relies only on the measured process variable, not on the knowledge of the underlying process, making it a broadly useful controller. The controller can provide control action designed for specific process requirements by tuning the three parameters in the PID controller algorithm. The tuning of the three parameters of the PID controller is the key to achieving satisfactory control effects and also the most difficult part of PID control. The controller's response can be described in terms of the controller's responsiveness to an error, the degree to which the controller overshoots the set point, and the degree of system oscillation. Note that using the PID algorithm for control does not guarantee optimal control of the system or system stability. Some applications may require only one or two actions to provide the appropriate system control. This is achieved by setting the other parameters to zero. A PID controller will be called a PI, PD, P, or I controller without the respective control actions. PI controllers are fairly common, since derivative action is sensitive to measurement noise, whereas the absence of an integral term may prevent the system from reaching its target value due to the control action

Fuzzy Logic Control
Fuzzy control is an important aspect of fuzzy set theory. It is a computer numerical control based on the fuzzy set, fuzzy language variables, and fuzzy logic reasoning. Fuzzy control is a kind of nonlinear control from the aspect of the linear or nonlinear control system. From the intelligence of the controller, fuzzy control belongs to the category of intelligent control.  (Xie et al., 2022).
The knowledge about the operation of the process of a domain is stored by the fuzzy rule base.
The inference engine acts as a kernel of any fuzzy logic controller (Guo et al., 1996)

Fuzzy PID Control
To achieve an ideal control effect, fuzzy PID control uses a fuzzy logic algorithm to optimize the proportion, integral and differential coefficients of PID control in real time according to certain fuzzy rules. Fuzzy PID control includes parameter fuzzification, fuzzy rule reasoning, parameter defuzzification, PID controller, etc (Du et al., 2011). The computer calculates the deviation between the actual and theoretical positions. The current deviation changes it according to the set input and feedback signals and performs fuzzy reasoning according to the fuzzy rules. Finally, the fuzzy parameters are defuzzified, and the proportional, integral, and differential coefficients of the PID controller are output.

Fuzzy PID Controller Design
The structure of the adaptive fuzzy PID controller is shown in Figure 2. It is based on conventional PID control and adopts the idea of fuzzy reasoning. The deviation and deviation change rate of the controlled valuable are used as the input variables of the two-dimensional fuzzy controller, while the values of , , and After tuning is used as the output, the parameters of PID are adjusted online using the fuzzy control law. The fuzzy control part includes fuzzification, fuzzy reasoning calculation, and defuzzification.

Create Fuzzy Control Rules
Based on expert experience and adjustment through simulation experiments, the table of fuzzy control rules can be summarized as shown in Table 1、Table 2, and Table 3.
During operation, the electric boiler temperature control system uses the above fuzzy control rules to complete the online self-calibration of the PID parameters, continuously detects and , and finds out the fuzzy relationship between the three PID parameters and and at the fastest speed. The online real-time adjustment makes the response speed, overshoot, and steady-state error of the fuzzy PID control system superior to single PID control or fuzzy control (Kafle, 2020).

Build the Fuzzy Reasoning System
Use the Fuzzy Inference System Editor and Membership Function Editor with an interactive graphical interface in the Matlab environment. According to the above results, select parameters such as the domain range of the input and output fuzzy variables, the shape of the membership function of each language variable, and the default center of gravity method for the defuzzification method. After the setting is completed, the interface is shown in Figure 2.

Result and Discussion
In this control system, the given value of the temperature is 85 ∘ C. The Fuzzy PID controller structure for simulation is shown in Figure 5. According to the experience and simulation, the initial values of PID controller parameters are = 3, = 0.07, = 0. To better show the control effect of fuzzy PID control, the PID control and fuzzy control are added into this simulation, as shown in Figure 6. The simulation time is 500 seconds, and these control systems' step response output curves are shown in Figure 7.