## 2 Materials and Methods
### Proposed Control Strategy  
The proposed control strategy is implemented in a Li-Ion BESS, which is connected to the grid via a bidirectional power inverter. This inverter enables precise control of active and reactive power injection and absorption. Controlled conditions were defined in this study to assess the effectiveness of our proposal. The standalone diesel generator is connected to an off-grid bus bar and acts as a three-phase voltage source, thus providing the voltage and frequency reference to the isolated grid. This isolated bus bar seamlessly integrates the inverters associated with the wind and photovoltaic power systems (PV and WP, respectively) and the emulated EV BESS. Our main goal was to smooth PV and WP power fluctuations, achieving a more uniform power injection into the grid facilitated by the energy cushion of the Li-Ion BESS.  
To achieve this objective, we implemented an innovative strategy that enhances the effectiveness of the R-R method through the use of FLC. This FLC function serves as a control system that dynamically adjusts the power change rate limits based on the input energy (PV and WP) and the state of charge (SoC) of the Li-Ion BESS. The output of the FLC provides an adjustable power change rate over time, allowing flexibility when the load is high and resources are limited. Figure 2 presents the overall block diagram of the proposed controller. The algorithm takes as input the measurement of injected active power (PV and WP) and the SoC of the Li-Ion BESS. The proposed method utilizes predefined fuzzy rules to make decisions that directly influence the dynamic ramp-rate (%R-R), adapting it to the real-time power smoothing requirements. Thus, the output variable is conditioned by the actual state of the input variables \(P_{T}\) and the SoC of the storage system.  
The R-R percentage is adjusted by applying fuzzy logic using the smoothing factor to optimize the state of charge of the Li-Ion BESS in real-time. Thus far, the literature has not described its value by relating it to the active power of PV or WP and the SoC of the Li-Ion BESS in real-time. This work introduces a heuristic method for its determination.  
Table 1 details the control rules for the proposed strategy in this article, where NS = No Smoothing, LS = Low Smoothing, S = Smoothing, MS = Moderate Smoothing, HS = High Smoothing, VL = Very Low, L = Low, M = Medium, H = High, and VH = Very High. In addition, Figure 3 displays the membership functions of the FLC. The controller adapts the ramp-rate percentage at each moment based on the variations in power and the SoC of the Li-Ion BESS. Triangular and trapezoidal group membership functions are employed in the  
Figure 2: Schematic representation of the fuzzy logic controller (FLC).  
design of fuzzy values. Finally, the centroid method is used for defuzzification. Figure 4 presents the resulting surface showing the variation of the two inputs and the output when evaluating the FLC.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & & & & \multicolumn{3}{c}{**P [kW]**} \\ \hline  & & VL & L & M & H & VH \\ \cline{2-7}  & VL & NS & S & MS & HS & VHS \\ SoC & L & S & NS & S & MS & HS \\ [\%] & M & MS & S & S & S & MS \\  & H & HS & MS & S & HS & MS \\  & VH & VHS & HS & MS & VHS & VHS \\ \hline \hline \end{tabular}
\end{table}
Table 1: FLC Rules.  
Figure 3: Membership Functions of the Proposed FLC: (**a**) Input 1: P, (**b**) Input 2: SoC, and (**c**) Output: Smoothing Factor (%R-R). NS = No Smoothing, LS = Low Smoothing, S = Smoothing, MS = Moderate Smoothing, HS = High Smoothing. Input 1 Values: VL = Very Low, L = Low, M = Medium, H = High, VH = Very High. Input 2 Values: Very Low = 10%, Low = 30%, Medium = 50%, High = 70%, Very High = 90%.