Implementation of Fuzzy Logic Based Speed Control of Brushless Direct Current Motors via Industrial PC

The brushless direct current motors are often preferred in the industry due to their high development torques, efficiencies, speed and position controls. Especially, they are used with robotic, numeric-controlled machines, electrical vehicles, etc. One of the biggest difficulties of these motors is the closed loop operation of these motors with driver circuits and a controller. In this study, the speed control of the brushless direct current motors was made with PLC-based industrial computer by using the methods of PID and Fuzzy Logic. PLC based industrial computer of Beckhoff firm CX9020 was preferred as a controller. In this industrial computer, the software of the controller was developed by using Structured Text programming language of Twincat 2.11 program. In experimental studies, the speed control of the brushless direct current motors is made with PID and fuzzy logic controller, according to the requested reference. The performances of the controllers were tested by using step, ramp and ladder functions. While PID controller gave better results in reference speed areas whose parameters were determined, fuzzy logic controller gave better results in variable references. Although PID is given as a ready block in PLC and PLC based controllers, fuzzy logic is under development in many of them. In this study, classical PLCs and PLC based industrial PCs, which did not have any fuzzy logic controller module, were transformed into intelligent controllers with Structured Text programming language. As a result of this, classical PLCs and PLC based industrial PCs can be used in intelligent control, which is very important for industry 4.0.


Introduction
The brushless direct current motors (BLDC Motors) are electric machines used widely on applications requiring high efficiency and strength They are used in many areas, especially in automotive and aviation industries, as an actuator [1].The brushless direct current motors are often preferred for special implementations in the industry, compared to brushed direct current motors and asynchronous motors, due to their features such as speed-torque characteristics, high-dynamic-responses and high efficiencies [2].Strength is very important for motors being used in automotive and aviation industries.They are preferred for almost every implementation in the industry because decay probability of brushes of brushed direct current motors under dynamic forces is high and efficiency and performance of asynchronous motors are low [3].Speed control of a brushless direct current motor can be made by using the pulse width modulation (PWM) [4].Requested input/output operations are widely used in the industry by using programmable logic controllers (PLC), and they are also used for motor speed control applications requiring high precision and accuracy [5].For speed control of brushless DC motors, fuzzy logic controller can be used by integrating it in PID controller software [4,5].Additionally, speed controls of brushless and brushed DC motors can be modeled on Matlab/Simulink platforms without any applications, and speed controls can be made by using a fuzzy logic controller [6].At the present time, it is known that they are being used in electric vehicle technologies by making speed controls on permanent-magnet (PM) in-wheel electric motors [7].Industrial PCs are the general name of Intel x86-based computer platforms manufactured for industrial purposes as in the definition.As an example for other platforms, PLCs, microcontrollers and DSP-based processors can be given.Main features which differ industrial PCs from commercial PCs are their high security, endurance under difficult conditions and suitability for long-term uses [8].Industrial PC manufacturers in the World are Advantech, Allied Electronics, Aplex Technology, AutomationDirect, B&R Industrial Automation and Beckhoff Automation.In this study, speed control of a brushless direct current motor has been made in an experimental setup designed and prepared for the study conducted, by using fuzzy logic controller and PID controller on an industrial computer.On the industrial computer, fuzzy logic controlled has been executed in "Structured Text" programming language as software, and the performance of the software developed via smart controllers that are available to use in Industry 4.0 of which name is mentioned most often in recent years have been tested with experimental works thanks to the study.
Brushless direct current motors are hard-to-control applications.Relaying power components in motor driver circuits and reading the speed data on the encoder require speed and computational time.For testing these softwares developed because of these reasons, this problem has been preferred.Brushless direct current motors are used in robotics, numeric controls (NC), computer numeric controls (CNC) and precise implementations.Areas of usage are rapidly increasing.In the study, PID and fuzzy logic control has been chosen on speed control for the brushless direct current motor brand Oriental type BLH230KC-30 by using Beckhoff CX9020 industrial computer.The experimental setup has been designed and prepared in order to perform this implementation.2 "two" motors have been used in experimental setup, and has been loaded with fixed load by connecting wheels to motor shafts with direct-connection and 2 "two" drums have been attached under them with a tangential-connection for the purpose of force application to the wheels.With the fixed load implemented, the motor is caused to consume 0,64 A(Ampere) current.Revs per minute during the motor run time has been read by encoders being used in the system, speed measurement has been performed via Beckhoff CX9020.With the thermocouple type "K" connected in between motors, mean temperature of the motors is determined, and the system is halted in case of the potential temperature increasing and high velocities being reached.The visual of the block diagram belonging to the study and the visual belonging to the experimental setup prepared have been given, respectively, on (Figure .1 & 2).

Brushless Direct Current Motor
BLH230 series BLDC motors manufactured by Oriental brand are one type of motors manufactured by the firm that can work with high precision.For the control of the motor, a motor driver is provided, as well, for the user by the firm.In this way, the motor control can be made more easily and with more precision.By means of the sensors integrated on motor driver card, damages to the system are prevented with motor poweroff system activating when there is over current, over heat and over strain [10].Suggested work area of the motor is between 0.12-0.15Nm torque range and 100-2500 rpm/min revolution range.

Pid control system in use in the experimental setup prepared
PID control method is widely used in process control in industrial applications.Control systems engineers prefer PID controller because of its flexibility and reliability.The transfer function of a PID controller including proportional, integral and derivative terms are given in (Equations.1).
In (Equations.1),Kp is proportional gain, Ki is integral gain and Kd is derivative gain.By tuning coefficients of PID controller, it provides control for specific process requirements.
The proportional term produces an output value that is proportional to the current error value.This proportional term is related to current state of process variable.the integral term is proportional to both the magnitude of the error and the duration of the error.When integral term is added to proportional term it accelerates the movement of the process towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional controller.The rate of change of process error is calculated by determining the slope of the error over time.the rate of change is multiplied by derivative gain [11].In (Equations.2), the error which is the input parameter of PID controller is calculated by the difference between measured value (r(t)) and the output of PID controller (y(t)).In (Equations.3), the output function of PID controller is given.(3)

Fuzzy Logic Control
Fuzzy Logic is a logical structure that has come in sight as a result of an article published by LotfiZadeh in 1961.The fuzzy logic is based on fuzzy-set and sub-sets.When it is stated mathematically, the value of the entity is set as "1" when it is an element of the set, and set as "0" when it is not an element of the set, in terms of its relationship with the set.Fuzzy logic is an extension of classical set notation.In a fuzzy set, each entity has a membership degree.Membership degree of entities can have any value between (0,1) range and membership function is shown with M(x) [12].In fuzzy logic deduction, linguistic varieties can be formed as membership functions of triangle type, trapezium type and cauchy type [13].In the study, variables have been generated based on triangle type membership functions.Triangle membership function is given on (Equations.4).Here 2 can be defined as a fixed value.Fuzzy logic presumes, depending on  coefficient, that values close to 2 would be represented with the meaning assigned to this value.In other words, uncertainty 2 can be reduced to minimum values with a  coefficient that will be presumed or can be found based on the distribution.In this study, engine rpm has been chosen as the process variable.System input variables have been defined as the revolution fault (e) between reference motor rpm and current motor rpm, and the change in revolution fault (ce).As system output variable, cycle change of the analog output signal sent to the driver circuit making the speed control of the motor.Step response given by fuzzy logic controller under the load is (a), step response given by PID controller under the load is (b), step response given by Fuzzy logic controller without load is (c), the step response given by PID controller without load is (d).
Figure 17.Ladder response given by fuzzy logic controller under the load is (a), ladder response given by PID controller under the load is (b), ladder response given by Fuzzy logic controller without load is (c), the response given by PID controller without load is (d).
Figure 18.Ramp response given by fuzzy logic controller under the load is (a), ramp response given by PID controller under the load is (b), ramp response given by Fuzzy logic controller without load is (c), the ramp response given by PID controller without load is (d) The reason for this is constant coefficients of P, Ki and Kd within the software of PID controller.In step response in the (Figure .18-c), it is seen that the revolution of motor is reaching to the requested step value softer and steadier, and lesser oscillation is seen compared to the (Figure .18-d).

Conclusion
In this study, speed control of brushless direct current motor has been made by using fuzzy logic controller via an industrial computer.Responses given by fuzzy logic controller to the requested reference value have been obtained from step, ladder and ramp functions, and they have been compared via PID controller designed for the purpose of monitoring the performance of the responses given by the fuzzy logic controller.According to the results of system responses, although PID controller runs at certain value ranges more efficiently, it has been seen that the controller efficiency was decreasing as the reference range was increased.However, since the fault variable is determined in the fuzzy logic controller linguistically, it is seen that increasing the value range of the reference does not affect the operation of the controller.Additionally, since the oscillation of the brushless direct current motor was being prevented, it has been seen that its system responses had been more efficient.
Since fuzzy logic controllers contain linguistic variables within, the implemented software generates a huge memory space in the memory of the hardware used.Implementations of fuzzy logic controllers are performed by using high-speed processors or electronic cards in general.As a result of the study, it has been determined that Beckhoff CX9020 industrial computer properly runs the designed fuzzy logic controller of which software was written.Having a major importance in the industry, industrial PCs supporting these sorts of controller structures is seen to be providing comfort and opportunity for applications having Industry 4.0 standards in terms of utility of industrial PCs due to their availability for coding and them being faster than PLCs used in the industry.

Figure 1 .
Figure 1.Block Diagram of the Study

Figure 5 .
Figure 5. BLH230KC Motor and Motor Driver[10] There is a speed-torque graph given belonging to BLH230KC-100 brushless direct current motor in the (Figure.4),and pictures belonging to the motor and motor driver in the (Figure.5).According to (Figure.4), take-off torque of the motor is 0.15 Nm and nominal torque is 0.12 Nm. 2500 rpm/min is the threshold value of the nominal torque provided by the motor.When the motor reaches to the maximum speed, the torque value is half of the nominal running torque (0.6 Nm).

6 )
() = () − () (5) () = () − ( − 1) (Here ref(i) is the reference number of revolutions required during the ith sampling, (i) is the present number of revolutions of the motor during the ith sampling, e(i) is the revolution fault during the ith sampling, and ce(i) is the change in revolution fault during the ith sampling.The fault, the change in the fault and control variables are placed in the universal set.After the measurement of the system variables, input data measured is turned into suitable linguistic variables in a way that they would be labels of fuzzy sets.These linguistic variables are; PH: (Positive High), PM: (Positive Medium), N: (Null), NM: (Negative Medium), NH: (Negative High).A fuzzy set is defined by assigning a degree of membership value for each elements in the universal set.There are many types of membership function.Preference of those membership functions is up to the user [14].Since this implementation requires a simpler calculation, triangle type membership functions have been preferred.For the speed control of the motor, the fuzzy logic controller has been designed first, and fault, change in fault and variable data fuzzification has been made.After the fuzzificated data has been processed in rule basis, they have been defuzzificated and acquired as analog output data.Visuals belonging to fuzzificated membership functions of input and output variables of fuzzy logic controller and belonging to sample software codes developed via "Structured Text" language on Twincat program which is the industrial PC control interface are given on (Figure.6 & 7 & 8 & 9 & 10 & 11).

Figure 9 .Figure 10 .Figure 11 .
Figure 9. Software fuzzification of the change in the fault

Figure 12 .
Figure 12.Defining the rule base linguisticallyAfter the necessary designs have been made for fuzzy logic control, software codes have been written on Twincat interface in order to execute the application.The study has been performed after all processes were completed, controls of the motors have been performed.Revolution data and heat data obtained from the motors have been processed with the controller, and the study has been completed according to the program developed.Additionally, with touch panel of BeckhoffCP6907, all variable information is displayed on the panel with an integrated study.On the panel, information of motor revolutions, heat and analog output value given by the controller has been shown.Screen image of the study has been given on (Figure.15).

Figure 15 .
Figure 15.Control Panel System Control Page Additionally, while the response of fuzzy logic controller at low revolution reference in responses in the (Figure.17-a& 17c), there is oscillation in responses in the (Figure.17-b&17-c).As the reason for the said oscillation, it is seen that process coefficients of PID controller being constant negatively affects the system response in reference values.Since the variables of fuzzy logic controller are defined linguistically, it does not change its response among defined reference values.According to the ladder response, in graphs of the (Figure.17-c& 17-d) acquired without applying load on the motor, it has been seen that the revolution of motor has dropped to the zero based on the oscillation from the rotor of the motor.In reference response in the (Figure.17-c), it is seen that the revolution of motor is reaching to the reference value softer and steadier, and there is seen lesser oscillation compared to the (Figure.17-d).Response of PID and fuzzy logic controllers to ramp type function reference is given in the (Figure.18).In reference response in the (Figure.18-a), the revolution of motor is reaching to the requested step value with more oscillation and later steadiness.The reason for this is the slowness of the response of fuzzy logic controller to the rapidly-changing reference.However, although the reference was changing rapidly, while unwanted sawtooth response graph did not occur in the (Figure.18a), it has been seen in low references in the (Figure.18b).

Figure 16 .
Figure 16.Step response given by fuzzy logic controller under the load is (a), step response given by PID controller under the load is (b), step response given by Fuzzy logic controller without load is (c), the step response given by PID controller without load is (d).