## 4 Energy Management System Based on Fuzzy Logic Controller (FLC)
### Fuzzy Logic Controller (FLC)  
The nonlinear characteristics of the DC motor could degrade the performance and efficiency of the conventional controller. The conventional controller has fixed parameters and structure and the tuning of their parameters is tedious and tiresome work. The FLC, unlike other controllers, is used for modeling systems with no exact values defined for process flow. Fuzzy logic can also be defined in such a way as \"computing words rather than numbers\" and \"control with a sentence rather than equations\". A basic block diagram of the FLC is shown below in Figure 6, in which there are three main processes. Firstly, fuzzification is used to convert the input data into some crisp value or linguistic variable. There are three main types of fuzzifier used for the fuzzification process, namely:  
1. Gaussian Fuzzifier
2. Singleton Fuzzifier
3. Triangular/Trapezoidal Fuzzifier  
Figure 5: Flowchart for proposed EMS. All the input to the proposed fuzzifier is triangular [37]. This crisp value or fuzzy set is then used to construct some rule in the inference-making block for simulating the human decision-making process. There are two main types of fuzzy inference system (FIS) such as:  
I. Mamdani FIS  
II. Takagi-Sugeno-Kang FIS  
The last defuzzification process is used for converting linguistic variables into numerical ones or crisp outputs. There are several different types of defuzzification process. In the proposed FLC, the center of gravity (COG) defuzzification method is used, which is given as (in Equation (32)):  
\[U_{\text{COG}}=\sum_{j\,=\,1}^{n}u_{c}\big{(}x_{j}\big{)}x_{j} \tag{32}\]  
where, \(U_{\text{COG}}\) represents the center of gravity, \(X_{j}\) is the point in the universe of conclusion, and \(U_{c}\big{(}X_{j}\big{)}\) is the membership value of the resulted conclusion. Pulse width modulation (PWM) for the duty cycle of the designed boost converter in the EMS is determined by the FLC. There are three inputs to the FLC, i.e.,  
1. Error between the input and output current of the boost converter. 2. SOC of the battery. 3. Speed of the BLDC motor. Based on these three parameters, the PWM signal is generated as shown in Figure 7.  
According to this figure, PWM signals are generated by using FLC in which the Mamdani rule-based system is utilized. The error current, battery's SOC, and speed are the three inputs given to this FLC, while the error current is calculated as the difference between the input and output current of the boost converter. Based upon these inputs, the FLC will generate the membership functions. The ranges of these inputs are further explained in detail in Figures 8-11, respectively. Figure 6: Basic block diagram of FLC. Figure 8: Membership functions of error current. Figure 7: Fuzzy logic duty cycle controller. Figure 9: Membership functions of battery’s SOC. The error current input and battery SOC input has three member functions; the speed of the BLDC motor input has five member functions. The membership functions of error current are shown in Figure 8. If the error current is between \(-\)30 and 5 A, it belongs to the negative membership function. If the error current is between \(-\)30 and 40 A, it belongs to the zero membership function. If the error current is between 5 and 40 A, it belongs to the positive membership function. The membership functions of the battery's SOC are shown in Figure 9. If the battery's SOC is between 0 and 30%, it belongs to the low membership function. If the battery's SOC is between 30 and 70%, it belongs to half the membership function. If the battery's SOC is between 70 and 100%, it belongs to the full membership function. The membership function for the speed of the BLDC motor is shown in Figure 10. If the speed is between 0 and 66.67 RPM, it belongs to the very low membership function. If the speed is between 26.66 and 106.6 RPM, it belongs to the slow membership function. If the speed is between 66.67 and 146.6 RPM, it belongs to the medium membership function.