Optimum PID Controller with Fuzzy Self-Tuning for DC Servo Motor

— DC motors are simple and controllable, making them a popular choice for various applications. However, the speed and load characteristics of DC motors can change, making it difficult to control them effectively. This paper proposes an optimum PID controller with fuzzy self-tuning for DC servo motors. The controller uses two steps to adjust the PID gains: The ACS algorithm is employed to identify the optimal PID gains in the first step. A fuzzy logic (FLC) controller is employed in the second stage to further fine-tune the gains. The FLC considers two cost functions: the first function is the sum of the squares of the error between the controlled output and reference input. The second function is a mathematical expression that specifies the required characteristics of the system response. The fuzzy self-tune then uses a set of rules to adjust the PID gains in response to changes in the system. The rules are based on the two cost functions designed to maintain the optimum PID gains for various operating settings. The outcomes of the two functions are: Kp = 5.2381, Ki = 7.0427, and Kd = 0.49468, with rising time = 0.2503, overshoot = 2.5079, and settling time = 10.4824 in the first cost function. The second cost function outcomes are Kp = 8.1381; Ki = 8.6427; and Kd = 0.49468. The FST-PID controller's performance is evaluated using Matlab-Simulink. The proposed controller was tested on a DC servo motor, and the results showed good performance in both steady-state and transient responses. The controller also maintained the optimum PID gains in the event of changes or disturbances. So, the motor's speed can effectively control under a variety of conditions.


INTRODUCTION
Due to its simplicity and controllability, the DC motor is a desirable for various applications that demand changing speed and load characteristics.It is a typical actuator used in various mechanical systems and commercial products, including rolling mills, traction devices, industrial robots, and educational robots [1][2][3][4][5].These advantages motivate researchers to create various algorithms and strategies for control of DC motor speed and position [6][7][8][9][10][11].
A tracking and regulating constrained optimal PID parameters (  ,   ,   ) for DC motor speed controller design is presented [12][13][14][15].A great-performance motor drive system often needs to have a great dynamic response to implement angle and speed tracking.Furthermore, the motor drive should respond to real-time load changes [16,17].
Scientists have developed multiple control system mechanisms to acquire the optimum output signals for position and velocity control.The control system can either be a traditional PID control or fuzzy-logic control (FLC) with set-point tracking performance that may be self-tuned [18].
Gain adjustments in PID controllers are fast and simple, resulting in a stable response.However, PID control system operates inefficiently when some variables are altered, or the torque burden is changed, resulting in an insufficient response [22][23][24][25][26].
FLC mimics the human foresight method by employing linguistic ideology rather than numerical calculations.Through their linguistic expression, fuzzy principles generate an output value.FLC offers an optimum response when torque loads change; however, the system architecture causes a sluggish response [27][28][29][30][31].
The benefits of the PID control system (fast tuning) and FLC (a better-executed approach to complex systems) are combined to produce a "fuzzy self-tuning PID controller" that produces a best response.FLC functions as the system's supervisor and configures the PID controller's coefficients [32][33][34][35].
The PID gains;   ,   , and   can be self-adjusted online after controlling the system's output [36][37][38][39].In PID control, fine-tuning a PID controller's parameters is crucial.Ziegler and Nichols introduced the well-known Ziegler-Nichols approach to fine-adjust a PID controller's coefficients.Despite being straightforward, this tuning technique can sometimes be relied upon to work.In many industrial facilities, it is typically difficult to obtain optimum or nearoptimum PID parameters using the Ziegler-Nichols formula [40][41].
Using fuzzy logic control (FLC), the gains ( 1 ,  1 , and  1 ) were outputs from the controller design, while the error and change of error were inputs to the self-adjusted [42][43][44].The FLC is an addition to the traditional PID controller that allows the PID controller's settings to be adjusted online in response to changes in the signals' errors [45][46][47].To satisfy the operating ranges and make them more generic, the controller also includes scaling gain inputs for the error and change of error (  ,  ∆ ) [48][49][50].
Analyzing, classifying, or enhancing existing systems or data necessitates the utilization of an algorithm for optimization to choose the optimal solution from all possible solutions.The most efficient optimization algorithm is the Ant colony system (ACS).Using this algorithm, the controller will produce the best and optimum outcome for the specified control system while being evaluated repeatedly when Ant Colony System (ACS) is used for tweaking [51][52][53][54][55].In all optimization problems, the aim is to get at least one fitness function or more than one fitness function to obtain the optimum key that achieve the complementary statuses [56][57][58][59][60].
As seen from the previous presentation, many methodologies and algorithms exist to improve the PID gains.This article is a contribution for improving the PID gains.It proposes a fuzzy self-adjusted optimal PID controller for a DC servo motor.The optimal gains;   ,   , and   are obtained using the ACS algorithm.Using FLC, the best gains ( 1 ,  1 , and  1 ) considering two cost functions is obtained.The first function to be minimized is the squared error sum between the reference input and the controlled output.The "rise time", the "maximum overshoot", the "settling time" and "steady-state error" with the desired ones are formulated and considered as the second function to be minimized.Then the Fuzzy Self Tune was used to overcome any change or neutrality and thus maintain Optimum PID gains.
The effectiveness of the suggested controllers is evaluated through 4 tests.In the first test, the PID parameters were obtained using the two cost functions and then compared to the parameters obtained by trial and error.
In test 2, the PID parameters were obtained from the two cost functions while decreasing the motor speed.These parameters were then compared to each other to determine which set of parameters produced the best results.In this test, the velocity increased in the tenth second.In test 3, the best PID parameters were obtained using the first cost function.These parameters were then self-tuned using the center-ofgravity defuzzification technique.In test 4, the PID parameters were obtained by considering the uncertainty caused by a 30% change in Ra or La.Simulations showed that the PID parameters obtained using two cost functions outperformed those obtained by trial and error.The first cost function produced better results than the second cost function.The proposed algorithm can achieve optimal tuning parameter values when the ACS is used for tuning.

II. DC MOTOR MODELING
As a reference, consider the DC-servo motor shown in Fig. 1.A simple mathematical link between the shaft position and the voltage supplied to the DC motor can be drawn using physical rules.DC servo motors can be viewed as a single input, single output (SISO) drives from the perspective of the control system.The field coil and armature are parallel in DC servo motors.The armature's current is unrelated to the current in the field coil.These motors have exceptional control of velocity and position as a result.The electrical, mechanical, and electro-mechanical equations are the three main equations that make up a DC motor's modeling [52].Apply Kirchhoff's Voltage Law (KVL) to derive the electrical equation for a DC motor system, which is as (1).
Using Newton's 2 nd law as a foundation, the mechanical equation is produced as (2).
As the input voltage is applied to the armature, current passes through resistance and inductance to create magnetic flux, which in turn causes the rotor to move under the motor torque as shown equation (3).
The motor shaft speed produced the following "back" electromagnetic force (EMF) as shown in (4).
where   is the DC input voltage, Rais the stator's resistance,  is the stator's inductance,  is the damping coefficient,  is the evaluated rotor moment of inertia,  is the instant rotor speed,   is the phase back-EMF coefficient, and   is the constant of line phase torque.Table I presents the parameter values of the DC-servo motor.
The block diagram in Fig. 2 depicts the DC motor's dynamic behavior, as indicated by (9).

III. METHODOLOGY
This study proposes a method to control the velocity of a DC servo motor.The method uses a fuzzy self-tuning (FST) technique to update the PID gains.The procedure involves two steps: 1. Determining the PID gains using an antcolony optimization strategy (ACS).2. Self-tuning the gains using FST.
Simulations in MATLAB-SIMULINK were used to evaluate the efficacy of the FST-PID controller, taken into consideration both nominal system parameters and uncertain parameters under various disturbances.The result demonstrates that the proposed algorithm effectively determines the optimal PID gains for the DC servo motor.Three steps can be used to summarize the proposed method: 1. Determine the system's needs, which is the speed DC servo motor.2. Tune the PID gains using the ACS algorithm.3. Use FST to self-tune the optimal PID gains online.This design will develope the transient performance of the DC servo motor when subjected to changing loads, uncertain parameters, and demand conditions.The flowchart in Fig. 3 provides a clear and concise overview of the methodology.

IV. CONTROL TECHNIQUES
Two parts are proposed as the primary construction of the fuzzy self-tuning PID controller.The ant colony optimization procedure is the first control strategy that determines the optimal PID control parameters [51].This strategy is done by creating an artificial ant colony that explores the parameter space, looking for the combination of parameters that obtains the optimum performance.The second control technique uses a fuzzy self-adjusted PID controller to improve the performance of the controller outputs.This controller uses fuzzy logic to tune the PID parameters based on the system's current state in real-time.
The DC servo-motor is used as a practical study case to determine the performance of the suggested controller.Different simulations are carried out, including random load and parameter variations [52][53].The result indicates that the suggested controller can achieve good control performance under various conditions.

A. Ant Colony System Based PID Controller
The Ant Colony Optimization algorithm (ACS) was initially suggested by Colorni, Dorigo, and Maniezzo [54].It uses a group of artificial ants that communicate indirectly with each other to obtain the shortest path from their nest to a predefined objective [55][56][57].ACS is often used to optimize control systems.In this context, the goal is to obtain the controller gains for a closed-loop system with an unknown plant and an ant-based PID controller that would minimize or maximize a defined cost function.To search controller settings as efficient as possible, ACS approaches employ the following two performance index criteria [58][59][60]: • The number of iterations: This is the number of times the ACS algorithm runs through its entire search process.• Cost function: This measures how well the controller parameters perform in terms of minimizing or maximizing the defined cost function.ACS aims to find controller parameters that minimize the number of iterations while also minimizing the cost function.

First Cost Function:
The cost function, J1, given in (11), measures the error between the predicted and the factual values.It is calculated by squaring the difference between each predicted value and its corresponding actual value, and then summing the squared differences.The goal is to minimize this cost function by finding the values of the parameters that make the squared differences as small as possible.
Second Cost Function: The cost function, J2, given in ( 12) is a mathematical expression that specifies the required characteristics of the system response.It includes four terms: the required "rise time" (trd), the required "maximum overshoot" (Mpd), the required "settling time" (tsd), and the required "steady state error" (essd).The values of the constants c1, c2, c3, and c4 are positive weighting factors that are selected based on the relative importance of each term.If the required "rise time" is more important than the required maximum overshoot, then c1 will be larger than c2.Similarly, if the desired "steady state error" is more important than the desired "settling time", then c4 will be larger than c3.The second cost function can evaluate different control designs and select the one that best meets the desired system response characteristics.
The suggested design process consists of two steps: i. Determine the system's optimal PID gains.
ii. Design a fuzzy logic controller (FLC) component to selfadjust based on the discovered PID gains.
The transfer function of the PID controller is represented by equation (13).
Where,   ,   , and   stand for PID gains.
The optimal PID controller in this work is based on the "Ant Colony System (ACS)" optimization technique.The "ACS" technique was described in [52].Table II presents the results of the ideal PID gains for the DC servo motor.

B. Design Procedure of "PID Fuzzy Self Tuning"
The four primary components of a fuzzy logic system are depicted in Fig. 4  The PID gains;   ,   , and   can be adjusted online after the controlling the system's output.This process is called selftuning or self-adjusted and is depicted in Fig. 5.Here are the steps involved in fuzzy self-tuning design:

Define the input and output variables of the fuzzy controller
The PID controller is a control system that uses three parameters to control a system.The following equation can represent the PID controller as shown in (14).
In other words, the PID controller's gains are multiplied by the fuzzy logic controller's output gains.This results in a new PID controller with improved performance which is then used to calculate the controller output, U.The controller output U after the fuzzy effectis given by equation (15).

𝑈 = 𝐾 𝑃2 + 𝐾 𝐼2 ∫ 𝑒𝑑𝑡 + 𝐾 𝐷2 𝑑𝑒(𝑡) 𝑑𝑡
(15) 6. Determine the "membership functions" for the input/output variables The rule databases of 49 fuzzy rules, input/output variables in the simulation are represented by symmetric triangular fuzzy sets (shown in Fig. 6 and Fig. 7).Table III, Table IV, and Table V simplify the "rule bases."The linguistic labels for a self-tuning PID controller are given as follows: N is for "negative," P is for "positive," Z is for "zero," L is for "small," A is for "medium," and G is for "large."For example, NA denotes "negative-medium," PG denotes "positive-big," and so on.

Create the fuzzy rules
The "normalizing gain" for  and ∆ can be evaluated using the formulas in ( 16) and (17). ) Where,   is the normalizing error input gain. ∆ is the Gaining error input normalization.The rule bases are instructions that can be used to determine the values of  1 ,  1 , and  1 .These values are used to control the system's response due to changes in the error signal.

Defuzzify the output of the fuzzy controller
The defuzzification method is a process that takes fuzzy sets and converts them into single, precise values.In this case, the center of gravity method is used for "defuzzification."This method finds the gravity center of the fuzzy set and uses that value as the output of the defuzzification process, which is formulated as (18).
Where, (  ) is the element's membership weight.  is the output of the rule .
9. Calculate the  1 ,  1 , and  1 gains based on the defuzzified output Determine  1 ,  1 , and  1 using Table III through Table V, ased on the defuzzified output.
10. Implement the gains in the PID controller 11.Repeat steps 4-6 until the system's output is stable This section illustrates how the proposed control techniques were implemented using the Matlab and Simulink Toolbox.The first method is an Ant Colony Algorithm-based optimal PID controller.The second method is a self-adjusted fuzzy PID controller.Fig. 8 and Fig. 9 depict the block diagrams of PID controller and fuzzy self-adjusted PID controller, respectively.

A. Simulation Results
The simulation results of the suggested techniques are presented in this section.Optimal PID parameters and Fuzzy Self-adjusted PID gains are derived through a series of tests, which include parameter uncertainty and load torque variations.
In test 1, the optimal PID parameters are obtained using the two cost functions after increasing the motor speed.These parameters are then compared to those obtained using trial and error.
In test 2, the optimal PID parameters are obtained using the two cost functions after decreasing the motor speed.The results of these two cost functions are then compared to each other.
In test 3, the best optimal parameters obtained from test 2 (calculated using the first cost function) are self-tuned.
In test 4, obtains the system response due to uncertainty in Ra and La.

Test 1: Step Disruption Speed (r.p.m.) Equals 1v and Under Load Torque
A step disturbance of about 1V was applied to the DCservo motor to compare the optimal ACS-PID controller with the trial-and-error-PID controller.Fig. 10 and Fig. 11 show the response of the rotor speed and the control input.
The ACS-PID controllers with the two cost functions performed better than the trial-and-error-PID controllers in terms of having quicker settling times and no steady-state error.The trial-and-error-PID controller still performed worse than the ACS-PID controller, especially when the results were based on the two cost functions.The results are presented in Table VI.At time t = 10 seconds, the speed was abruptly slowed by 0.3v to evaluate the effectiveness of the proposed controllers.This decrease in speed caused a rise in load torque.Fig. 12 and Fig. 13 show the rotor speed response and the control input against time.
The system responses of both the PID C.F1 (cost function 1) controller and the PID C.F2 (cost function 2) controller clearly show that they were able to overcome these changes and provide a good response with a small "settling time."However, the PID C.F1 controller was more effective than the PID C.F2 controller, as it achieved a smaller settling time

m.) = 1v and Under Load Torque
The effectiveness of the suggested algorithm was determined by abruptly increasing the speed by 0.3 volts at t = 10 seconds.This increase in speed led to a decrease in burden torque.Fig. 14 illustrates that using a self-tuned PID controller resulted in less overshoot and a shorter settling time than using an ideal PID.Fig. 15 illustrates the output controller's time response.In the practical simulation, FST-PID controller output has a slight overshoot, but it responds more rapidly to speed adjustments at this point.
In conclusion, the self-tuned PID controller was demonstrated to be more effective than the ideal PID controller in terms of minimizing "overshoot and settling time".Despite a modest overshoot, the FST-PID controller performed well in the practical simulation.With variation 30%, the Ra and La parameters of the DC Servo Motor are regarded to be uncertain.The parameters are modified as follow: from 0 to 5 (a value of -30%), from 5 to 10 (a value of 0%), and from 10 to 15 (a value of +30%).
The uncertain system parameters are presented in Table VII.The proposed "self-tuning PID controller" is shown to respond robustly to these uncertain parameters.
The results of the self-tuning PID controller are extremely encouraging, particularly in the presence of system linearity and indeterminate parameters.This is shown in Fig. 16, which compares the results of the "self-tuning PID controller" to a regular PID controller.The time response of the controller inputs is displayed in Fig. 17.
In summary, the "self-tuning PID controller" is a robust and effective method of controlling DC Servo Motors, even in ambiguous parameters.

VI. CONCLUSION
This study demonstrates the design method of PID controller with fuzzy self-adjusted applied to DC Servo Motor to enhance performance, as reduced "transient time" and immunity to external perturbations.To investigate the proposed technique, a comparative study was carried out between fuzzy self-adjusted PID, and PID controllers based on various tests, such as parameter uncertainty and load torque variations.The results indicate that the fuzzy selfadjusted PID and PID controllers can dampen system oscillations adequately.In comparison to the "PID controller," the self-adjusted-PID controller significantly enhances the performance of the DC servo motor's speed control.PID Controllers are less capable of handling parameter uncertainty than self-adjusted-PID Controllers.In conclusion, the results confirmed the effectiveness of the suggested self-adjusted-PID controller, and the system performance was adequate in both normal and abnormal cases (due to parameters uncertainties).Also, fuzzy logic is unable to handle uncertainty accurately, so in future work,

Fig. 10 .
Fig. 10.DC servo motor system response with PID C.F1, PID C.F2 and trial and error-PID controllers

Fig. 14 .
Fig. 14.DC servo motor system response with PID and self-tuning of PID

Fig. 16 .Fig. 17 .
Fig. 16.DC servo motor system response with PID and self-tuning of PID

TABLE I .
DC SERVO MOTOR PARAMETER VALUES

TABLE III .
RULE BASE FOR DETERMINING KP1

TABLE VI .
PARAMETERS COMPARISON OF TWO COST FUNCTIONS WITH TRIAL AND ERROR PARAMETERS

TABLE VII .
UNCERTAIN PARAMETERS OF THE SYSTEM