*3.1. Problem Formulation*

The focus of this work is on developing a methodology for load peak-shaving to be applied to the managemen<sup>t</sup> of autonomous HES. In this regard, EMS monitors the state variables of all the elements connected to the point of common coupling (Figure 1). Then, using this information and the day-ahead forecasts of wind power and load demand, determines how power sources should be dispatched to minimize the operating costs of the system for the corresponding day. Note that the influence of forecasting error on system operation has not been considered in this work.

In a general sense, BESS operation can be defined by means of three different states: charging, discharging, and disconnection. These states can be represented by using integers: charging can be represented as +1, discharging can be represented as −1, whereas 0 represents the battery disconnection.

The goal of the managemen<sup>t</sup> strategy proposed in this paper consists of finding out the appropriate pattern (charging, discharging, and disconnection) of usage of BESS during the day in order to reduce NL-peak. This is carried out by means of a heuristic optimization algorithm in which each individual or agen<sup>t</sup> is represented as shown in Figure 2. If NL is negative, it means that BESS should be charged in order to store the energy surplus during periods of high wind speed. On the contrary, when NL is positive, it is not evident whether BESS should be discharged or disconnected from HES. Thus, a set of *I* individuals, who take into account different operational conditions (discharging and disconnection) during different hours, is considered.

**Figure 2.** Structure of a single individual.

The structure of a single individual (*i* = 1, ... ,*I*) at a determined iteration (*k*) of the heuristic optimization algorithm can be described according to (28):

$$\stackrel{\rightarrow}{\mathcal{S}}\_{(i,k)} = \begin{bmatrix} \mathcal{S}\_{(i,1,k)} & \cdots & \mathcal{S}\_{(i,t,k)} & \cdots & \mathcal{S}\_{(i,T,k)} \end{bmatrix} \\ \forall \ i = 1, \ldots, I; \tag{28}$$

where each element *g*(*<sup>i</sup>*,*t*,*k*) is an integer between −1 and +1, depending on the time (*t*) and NL value (*PN*(*t*)). Similarly, the population or group of agents of the optimization algorithm for iteration *k* can be expressed as a matrix according to (29):

$$\mathbf{G}\_{(k)} = \begin{bmatrix} \stackrel{\rightarrow}{\mathcal{S}}\_{(1,k)} \\ \vdots \\ \stackrel{\rightarrow}{\mathcal{S}}\_{(i,k)} \\ \vdots \\ \stackrel{\rightarrow}{\mathcal{S}}\_{(l,k)} \end{bmatrix}. \tag{29}$$

Considering a determined individual *i*, the value of its objective function (*O*(*<sup>i</sup>*,*k*)) during a determined iteration (*k*), which has to be minimized, is calculated according to (30):

$$\mathbb{C}O\_{(ik)} = \sum\_{t=1}^{T} P\_{N(t)} P\_{C(i,t,k)} \; \forall \; i = 1, \dots, l; k = 1, \dots, K; \tag{30}$$

where the pattern *PC*(*<sup>i</sup>*,*t*,*k*) corresponds to that obtained from the application of the model previously described in Section 2 (Equation (20)), considering the influence of power converter (*PC*(*<sup>i</sup>*,*t*,*k*) = *PC*(*t*)). In other words, *PC*(*<sup>i</sup>*,*t*,*k*) is calculated according to (20), the indexes *i* and *k* have been introduced to represent the fact that it is calculated for a specific individual (*i*) during a determined iteration (*k*).

The magnitude presented in (30) does not have any physical meaning. Indeed, this has been taken from previous experience of BESS operating in RTP programs [39], where sold and purchased power all over the day is considered as the optimization variable. Following this analogy, *PC*(*<sup>i</sup>*,*t*,*k*) can be considered as the transaction power of BESS (sold and purchased power), whereas *PN*(*t*) could be considered as linearly related to the fuel-consumption curve of the diesel generator. In other words, in the analogy with selling and purchasing prices under RTP, the variable *PN*(*t*) could be considered as a linear function of fuel-consumption costs.

The main conclusion of this reasoning is that, the hour at which BESS should be discharged, in order to maximize profits from energy trading with the RTP scheme, is exactly the same hour at which BESS should be discharged in order to reduce NL-peak in an autonomous HES.
