## 3 Proposed Predictive Dynamic Smoothing PRRC Method  
The proposed Predictive Dynamic Smoothing (PDS) method uses predicted PV output power values to adjust the PRR considering future power fluctuations. For example, if the prediction indicates that there will be a ramp-down violation, the PDS method will charge the battery prior to that event. Thus, the DoD and the battery degradation will be reduced. For this work, it is assumed that the predicted PV output power values are already acquired. The prediction algorithms presented in [6; 35; 36; 39; 40] are examples with suitable results for the implementation of the proposed PDS method and their development is out of the scope of this work. In the results section, the PDS method was tested considering inaccuracies in the predicted PV output power. The PDS uses a prediction window W to extrapolate the PRR considering the present output power \(\mathrm{P}_{\mathrm{out}}[\mathrm{k}]\) and the predicted PV output power \(\mathrm{P}_{\mathrm{pv}}[\mathrm{k}+\mathrm{W}]\) at the end of the prediction window. To demonstrate the concept of the PDS method, and example with \(\mathrm{T}_{\mathrm{s}}\)= 1 min, \(\mathrm{PRR}_{\mathrm{max}}=(10\%)\mathrm{P}_{\mathrm{max}}/\mathrm{min}\), and W = 10 is presented in Figure 4, where \(\mathrm{P}_{\mathrm{max}}\) is the maximum contracted power. The prediction horizon is located between the present time \(\mathrm{t}_{\mathrm{ck}}\) and the final time \(\mathrm{t}_{\mathrm{tk}}\) such that \(\mathrm{WT}_{\mathrm{s}}\)= \(\mathrm{t}_{\mathrm{tk}}-\mathrm{t}_{\mathrm{ck}}\). The control horizon moves with each sample instant. When a PRR violation event is detected in the prediction window, a line is projected between \(\mathrm{P}_{\mathrm{out}}[\mathrm{k}]\) and \(\mathrm{P}_{\mathrm{pv}}[\mathrm{k}+\mathrm{W}]\). This line is used to determine the PRR at the output (\(\mathrm{PRR}_{\mathrm{out}}[\mathrm{k}]\)) and the output power at the next time interval (\(\mathrm{P}_{\mathrm{out}}[\mathrm{k}+1]\)). If \(\mathrm{P}_{\mathrm{out}}[\mathrm{k}]<\mathrm{P}_{\mathrm{pv}}[\mathrm{k}]\), the excess of energy is used to charge the energy storage system (ESS). Likewise, if \(\mathrm{P}_{\mathrm{out}}[\mathrm{k}]>\mathrm{P}_{\mathrm{pv}}[\mathrm{k}]\), the ESS is discharged. When no future PRR violations are detected, the output of the inverter is the output of the PV and the ESS will not be charged nor discharged. To guarantee that the PRR output of the PDS fulfills the regulations in the worst-case scenario, the prediction window \(\mathrm{W}\) is selected such that:  
\[\frac{\mathrm{P_{max}}}{\mathrm{WT_{s}}}\ \leq\ \mathrm{PRR_{max}} \tag{12}\]  
where \(\mathrm{T_{s}}\) is the sampling period in minutes. The predicted PRR of the PV array is given by:  
\[\mathrm{PRR_{pv}[k+i]}=\left\{ \begin{array}{ll}\frac{\mathrm{P_{pv}[k+i]-P_{ out}[k+i-1]}}{\mathrm{T_{s}}},\ \mathrm{when\ i}\ =\ 1\\ \frac{\mathrm{P_{pv}[k+i]-P_{pv}[k+i-1]}}{\mathrm{T_{s}}},\ \mathrm{when\ i}\ >\ 1\end{array} \right. \tag{13}\]  
where \(\mathrm{i}=1,2,\ldots,\mathrm{W}\) is the number of time periods in the future being forecasted. To detect if \(\mathrm{PRR_{pv}[k+i]}\) will be above \(\mathrm{PRR_{max}}\) at any time of the prediction window, a detection variable \(\mathrm{V[k]}\) is defined by:  
\[\mathrm{V[k]}=\sum_{i=1}^{W}\mathrm{Flag[i]} \tag{14}\]  
where:  
\[\mathrm{Flag[i]}=\left\{ \begin{array}{ll}1,\ \mathrm{when}\ \mathrm{PRR_{pv}[k+i]}\ \geq\ \mathrm{PRR_{max}}\\ 0,\ \mathrm{when}\ \mathrm{PRR_{pv}[k+i]}\ <\ \mathrm{PRR_{max}}.\end{array} \right. \tag{15}\]  
The PRR of the power plant is given by:  
\[\mathrm{PRR_{out}[k]}=\left\{