## 3 Design of Fuzzy Logic System
### Building the Model  
There are some reasons for choosing the membership functions and the type of modeling in fuzzy logic. In complex systems such as HESS, it is important to have the ability to model the complex interactions of various input variables. Trapezoidal membership functions better handle the complexities of such systems, providing flexibility and helping to make clearer decisions in uncertain situations. Therefore, the membership functions for the inputs defined in the fuzzy logic control system are characterized as trapezoidal 'trapmf' shaped. In terms of the modeling type in fuzzy logic, there are two different approaches. These are Sugeno-type modeling and Mamdani-type modeling. While Sugeno-type modeling is mainly used to create and analyze a mathematical model of uncertain systems, Mamdani-type modeling is preferred for creating and interpreting fuzzy logic rule sets using natural language expressions. The Sugeno-type modeling method was chosen in order to define the energy transfer rates of batteries and SCs more clearly. In addition, the Sugeno modeling method is more successful than the Mamdani modeling method in explaining non-linear relationships, such as in the HESS, clarity of outputs, and ease of mathematical analysis. Therefore, the Sugeno-type modeling method was chosen for a clearer description of the battery and SC transfer rates. Table 5 provides the boundary points of the membership functions. In this table, the input levels are expressed as low (L), nominal (N), and high (H). The boundary points provided in Table 5 were determined on the basis of the experiments conducted. The representation of the membership functions for these boundary points in the Matlab program is illustrated in Figure 8. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**No**} & \multicolumn{5}{c}{**Fuzzy Logic Input Parameters**} & \multicolumn{3}{c}{**Fuzzy Logic Output Parameters**} \\ \cline{2-7}  & **Temperature (°C)** & **Cell C Rate** & **Battery SoC (\%)** & **SC SoC (\%)** & **Battery Rate (\%)** & **SC Rate (\%)** \\ \hline
1 & 34 & 0.395 & 13 & 93 & 62.5 & 37.5 \\ \hline
2 & \(-\)16 & 1.594 & 47 & 17 & 0 & 100 \\ \hline
3 & \(-\)7 & 0.439 & 12 & 28 & 37.5 & 62.5 \\ \hline. &. &. &. &. &. &. \\ \hline. &. &. &. &. &. &. \\ \hline. &. &. &. &. &. &. \\ \hline
999 & 47 & 0.458 & 15 & 100 & 100 & 0 \\ \hline
1000 & \(-\)5 & 0.544 & 6 & 86 & 75 & 25 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Fuzzy logic dataset. After the membership functions for all the input values were created according to the specified boundary values, 800 data points were entered for the training phase in the ANFIS environment. Based on these data, ANFIS generated 81 rules. These rules are shown in Figure 9, and the interval variables associated with them are shown in Figure 10.  
A total of 800 data were used in the training phase, while the remaining 100 data were used in the testing phase, and 100 data were used in the validation phase. In the results obtained using the ANFIS method, the model achieved very successful learning and could make decisions with high accuracy rates. The performance of the model with the test data is given in Table 6. The fact that the R\({}^{2}\) value is close to 1 and the MSE and RMSE values are close to 0 indicates the success of the model. The connection between the input variables of the model is shown in three dimensions in Figure 11.  
Another important feature of the model is the switching between the battery and SC. The output results can be battery-only, SC-only, or the HESS with different ratios. In the case of battery-only or SC-only, routing must be provided by switching. Similarly, in the case of the HESS, the third switch should be used, and the connec  
Figure 8: Membership functions related to the battery temperature.