*3.2. Optimization by TVMS-BPSO*

PSO is an optimization algorithm based on the dynamic behavior of a group of agents interacting with each other. Important variables such as the position (*g*(*<sup>i</sup>*,*t*,*k*)) and velocity (*<sup>v</sup>*(*<sup>i</sup>*,*t*,*k*)) of each agen<sup>t</sup> (*i*) are considered during the evolution of the algorithm (*k*). Using constriction factor approach, the agen<sup>t</sup> velocity can be expressed using (31):

$$\boldsymbol{\upsilon}\_{(i,k+1)} = \chi \left[ \boldsymbol{\upsilon}\_{(i,k)} + \boldsymbol{\mathcal{C}}\_{\rm PSO}^{a} \boldsymbol{R}\_{\rm PSO}^{a} \left( \boldsymbol{g}\_{(i)}^{\rm PRES} - \boldsymbol{g}\_{(i,k)} \right) + \boldsymbol{\mathcal{C}}\_{\rm PSO}^{b} \boldsymbol{R}\_{\rm PSO}^{b} \left( \boldsymbol{g}\_{(i)}^{\rm GRES} - \boldsymbol{g}\_{(i,k)} \right) \right] \tag{31}$$

where *CaPSO* and *CbPSO* are coefficients selected so that the condition (32) is fulfilled,

$$
\mathcal{Q} = \mathsf{C}\_{PSO}^{a} + \mathsf{C}\_{PSO}^{b}; \mathcal{Q} > 4. \tag{32}
$$

The coefficient ∅ is then used to calculate the factor χ required in (31),

$$\chi = \frac{2}{\left| 2 - \mathcal{Q} - \sqrt{\mathcal{Q}^2 - 4\mathcal{Q}} \right|}. \tag{33}$$

Using the coefficient ∅, the convergence of the algorithm can be managed.

TVMS transfer function has been recently proposed by Beheshti [40] to improve the capabilities of BPSO. TVMS-BPSO uses two sigmoid functions during the conversion of reals to binaries, and these functions are shown in (34) and (35):

$$S\_{PSO(i, t, k+1)}^d = \frac{1}{1 + e^{\sigma\_{(k)} \left(-v\_{(i, t, k+1)}\right)}};\tag{34}$$

$$S\_{PSO(i, t, k+1)}^b = \frac{1}{1 + \epsilon^{\sigma\_{(k)}\left(v\_{(i, t, k+1)}\right)}};\tag{35}$$

where the coefficient <sup>σ</sup>(*k*) varies during the algorithm evolution according to (36):

$$
\sigma\_{(k)} = (\sigma\_{\text{max}} - \sigma\_{\text{min}}) \left( \frac{k}{K} \right) + \sigma\_{\text{min}}.\tag{36}
$$

Once the variables *SaPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>) and *<sup>S</sup>bPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>) have been calculated, they are evaluated on (37) and (38) to ge<sup>t</sup> the binary variables *JaPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>) and *<sup>J</sup>bPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>), which are a preliminary result of the algorithm.

$$J\_{PSO(i,t,k+1)}^{\mathrm{a}} = \begin{cases} 1; \ R\_{PSO}^{\mathrm{c}} < S\_{PSO(i,t,k+1)}^{\mathrm{a}} \\ 0; \ R\_{PSO}^{\mathrm{c}} \ge S\_{PSO(i,t,k+1)}^{\mathrm{a}} \end{cases}; \tag{37}$$

$$J\_{PSO(i, t: k+1)}^b = \begin{cases} 1; \ R\_{PSO}^d < S\_{PSO(i, t: k+1)}^b \\ 0; \ R\_{PSO}^d \ge S\_{PSO(i, t: k+1)}^b \end{cases} \tag{38}$$

The definitive result from the conversion of reals to binaries is based on the value of the objective function *Oa*(*<sup>i</sup>*,*k*) and *Obi*,*k* obtained from the evaluation of *JaPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>) and *<sup>J</sup>bPSO*(*<sup>i</sup>*,*t*,*k*+<sup>1</sup>) previously estimated. Then, the positions to be considered during the next iteration (*k* + 1) are defined by using (39):

$$\mathcal{g}\_{(i,k+1)} = \begin{cases} \int\_{PSO(i,k+1)}^{a} ; \, \mathcal{O}^{a}\_{PSO(i,k+1)} < \mathcal{O}^{b}\_{PSO(i,k+1)} \\\ J^{b}\_{PSO(i,k+1)} ; \, \mathcal{O}^{a}\_{PSO(i,k+1)} > \mathcal{O}^{b}\_{PSO(i,k+1)} \end{cases} \tag{39}$$

Once the principles of TVMS-BPSO have been exposed. The problem of day-ahead BESS scheduling on a daily basis and the TVMS-BPSO performance to solve this problem are analyzed in Sections 4 and 5, respectively.

## **4. Testing the Problem Formulation**

To evaluate the mathematical formulation previously presented in Section 3.1, the performance of HES of Figure 1 is analyzed using a GA and a typical system with a wind generator of 75 kW (*Pmax W* = 75 kW), and the load profile of Figure 3 has been used. Cut-in, rated, and cut-out wind speeds equal to 3, 12, and 25 m/s, respectively, have been assumed.

**Figure 3.** Load profile.

Regarding the fuel-based generator, a diesel unit of 100 kW (*Pmax D* = 100 kW) with minimum operating power of 50% (*Pmin D*= 50 kW) has been assumed.

As the effects of wind generation and BESS managemen<sup>t</sup> on the reduction of fuel consumption have been deeply studied in the technical literature [41], special attention to the influence of these devices on GHG emissions has been paid in this work. Thus, the GHG-emission measurements published in [42] have been adopted.

During the GA implementation, the initial population is randomly initialized, so that an operator has to be incorporated in order to fix the elements of the matrix *<sup>G</sup>*(*k*) to +1 at those hours at which NL is negative (Figure 2). Additionally, such operator has to be included after the application of mutation operator.

Regarding the GA parameters, a population with 75 individuals, 100 generations, a crossover rate of 90%, and a mutation rate of 5% were considered.

Wind speed profile has been modeled by using the general purposes profile of (40) [7,10], which depends on the average wind speed (*SaW*), diurnal pattern strength (*SbW*), and the hour of peak wind speed (*ScW*).

$$S\_{W(t)} = S\_W^a \left\{ 1 + S\_W^b \cos \left[ \left( \frac{2\pi}{T} \right) (t - S\_W^c) \right] \right\} \,\forall \, t = 1, \ldots, T. \tag{40}$$

Different values of average wind speed and diurnal pattern strength have been considered. Specifically, *SbW* = 0, 0.1, 0.2, 0.3, 0.4 and *ScW* = 15 h were evaluated through the analysis of three case studies. These are typical values for places located in the United States. In this way, different values of *SbW* allow us to evaluate the wind speed profile with high or low oscillation, and consequently their impact on the operation of BESS.

A typical VRFB of 5 kW/20 kWh (*Pmax B* = 5 kW/ *Emax B* = 20 kWh) has been considered. Minimum and maximum SOC were assumed as 15 and 90% (*SOCmin B* = 0.15 and *SOCmax B* = 0.9), respectively, and minimum and maximum voltage were assumed as 42 and 56.5 V (*Umin B* = 42 V and *Umax B* = 56.5 V), respectively. The entire bank is composed of 10 of these batteries connected in parallel.

The simulation and optimization analysis were implemented in MATLAB®, using a personal computer with i7-3630QM CPU at 2.4 GHz, 8 GB of memory and a 64-bit operating system.

The previously mentioned cases are carefully discussed in the next subsections.

### *4.1. Case I: Low Wind Speed with Fully Charged Battery*

Conditions of low wind speed and fully charged BESS were simulated by considering an average speed of 4 m/s (*SaW* = 4 m/s) and an initial SOC equal to 85% (*SOCB*(0) = 0.85).

Figure 4 presents the wind speed (left) and wind power (right) obtained from the evaluation of (40) for the aforementioned values of *<sup>S</sup>bW*. Because the average speed is close to the cut-in one, high wind speed oscillations (*SbW* = 0.4) are directly reflected in the wind power profile.

**Figure 4.** Wind speed and wind power (Case I).

Figure 5 shows the GA-convergence, which takes around 20 iterations to establish a near-optimal schedule.

**Figure 5.** Genetic algorithm (GA) evolution (Case I).

Figure 6 presents the day-ahead schedule of BESS for this case. As can be observed, BESS remains disconnected during the morning, between *t* = 1 h and *t* = 10 h in all cases. Then, BESS is discharged between *t* = 11 h and *t* = 15 h for most of the cases, followed by some disconnection periods, so as to be later discharged during the last hours of the day, between *t* = 20 h and *t* = 24 h. These resting intervals or periods of battery disconnection allow us to improve the managemen<sup>t</sup> of the stored energy by moving it towards the NL-peak hours.

**Figure 6.** Battery managemen<sup>t</sup> (Case I).

Figure 7 shows the power (left) and SOC (right) of VRFB, where it is possible to observe how battery power is gradually reduced in order to fulfill the operating conditions (16) and (17) for battery voltage and SOC, respectively.

**Figure 7.** Battery power and state of charge (SOC) (Case I).

Figure 8 presents NL considering the entire architecture of Figure 1 (left) and only considering the wind and diesel generators (right), calculated using (22) and (21), respectively. According to these results, the proposed peak-shaving strategy is effective at discharging the energy initially stored on BESS during those hours of high electricity demand.

**Figure 8.** Net load with and without battery (Case I).

Figure 9 presents THC (left) and CO (right) emissions. By comparing NL considering the effect of wind and BESS previously shown in Figure 8 (left) with THC emissions shown in Figure 9 (left), it is possible to observe how NL has a convex shape, whereas THC emissions have concave behavior, which clearly suggests that THC emissions could increase as NL is reduced. Regarding the relationship between NL (Figure 8 left) and CO emissions (Figure 9 right), concave behavior of both surfaces is clearly observed, which means that CO emissions can be reduced with the corresponding limitation of the NL to be supplied by diesel generator.

**Figure 9.** THC and CO emissions (Case I).

Figure 10 shows NOx (left) and CO2 (right) emissions, and Figure 11 presents PM emissions. It is possible to observe how all of them slightly increase at the end of the day, due to the fact that BESS managemen<sup>t</sup> strongly focuses on NL-peak mitigation.

**Figure 10.** NOX and CO2 emissions (Case I).

**Figure 11.** PM emissions (Case I).

Figure 12 verifies that there is no energy surplus (left) or energy not supplied (right) because renewable generation is very low and the diesel generator is able to supply all electricity demand.

**Figure 12.** Excess and energy not supplied (ENS) (Case I).

Tables 1–4 summarize the daily results related to GHG emissions and diesel generation. By comparing the second columns of Tables 1 and 2, it is possible to observe how THC emissions increase as previously discussed. In the contrary case, a reduction on CO, NOx, CO2, and PM is clearly observed.


**Table 1.** Total GHG emissions without battery (Case I).


**Table 2.** Total GHG emissions with battery (Case I).

**Table 3.** Reduction of GHG emissions (Case I).



**Table 4.** Diesel power generation (Case I).

Table 3 shows the change on GHG emissions based on the results reported in Tables 1 and 2. The increment of THC emissions is between 12.92% and 14.43%, whereas the reduction of CO, NOx, CO2, and PM are approximately 51.02%, 20.80%, 12.59%, and 32.92%, respectively.

Table 4 shows in bold those hours at which power generation is reduced as a result of BESS incorporation, especially during the peak-load of the afternoon and night.

### *4.2. Case II: High Wind Speed with Empty Battery*

In this case, conditions of high wind speed with an empty battery are studied. Specifically, an average wind speed of 14 m/s (*SaW* = 14 m/s) and an initial SOC of 15% (*SOCB*(0) = 0.15) are considered. Wind speed and wind power under these conditions are shown in Figure 13, in the left and right sides, respectively, for *SbW*between 0 and 0.4, as previously specified.

**Figure 13.** Wind speed and wind power (Case II).

According to the wind power profile (Figure 13 right), rating power is reached in almost all cases, except when a high wind speed oscillation (*SbW* →0.4) is observed, resulting in a wind power reduction during the morning.

GA evolution is shown in Figure 14, where it can be observed how fast the algorithm converges due to the influence of the high wind speed. In other words, in the presence of high wind speed, the energy surplus forces BESS to be charged, limiting the number of possible operational combinations, and consequently speeding up the convergence.

**Figure 14.** GA evolution (Case II).

BESS managemen<sup>t</sup> is shown in Figure 15, where the battery is charged during the morning in most situations. However, discharging actions are also advised sometimes in the morning, and this is observed when wind generation reduces as a consequence of wind speed profile oscillations. Initially, the battery is empty, so that discharging the battery in this situation does not result in any load satisfaction, because the battery is not able to provide any power. In other words, battery discharge when *SOCB*(*t*) = *SOCmin B* is equivalent to the battery disconnection obtained by setting *g*(*<sup>i</sup>*,*t*,*k*) ←0.

**Figure 15.** Battery managemen<sup>t</sup> (Case II).

Figure 16 shows the results obtained from the simulation of the managemen<sup>t</sup> signal previously shown in Figure 15. Battery power (Figure 16 left) and SOC (Figure 16 right) are presented, and the battery is charged during the morning and then discharged during the afternoon. The situations of high wind speed oscillations result in a reduction of energy surplus, and consequently less power is available to be used in the peak-shaving process during the afternoon.

**Figure 16.** Battery power and SOC (Case II).

Figure 17 shows the NL profile depending on if the effects of BESS are considered (left) or not (right), calculated by using (22) and (21), respectively. By comparing these results, it is possible to observe how NL-peak is reduced.

**Figure 17.** Net load with and without battery (Case II).

As NL is so low when BESS is incorporated, energy surplus is produced because the diesel generator is forced to operate at its minimum capacity in order to satisfy a very low load. This operating mode produces a fixed amount of GHG emissions. This reasoning can be verified in Figure 18 for THC (left) and CO (right), in Figure 19 for NOX (left) and CO2 (right), and in Figure 20 for PM.

**Figure 18.** THC and CO emissions (Case II).

**Figure 19.** NOX and CO2 emissions (Case II).

**Figure 20.** PM emissions (Case II).

Figure 21 shows the daily profiles of energy surplus (left) and ENS (right), respectively. As wind generation is abundant from the high wind speed, energy excess is observed at almost any time. Conversely, there is no ENS.

**Figure 21.** Excess and ENS (Case II).

Tables 5 and 6 report the cumulative daily values of GHG emissions for different wind speed profiles. Then, the reduction on the emitted pollutants as a consequence of BESS integration is reported in Table 7. Because the diesel generator is operating at its minimum allowed power (*PD*(*t*) = *Pmin D* ), the reduction of GHG emissions is the same for all the factors considered, up to 12.5%.

To improve understanding of the HES operation, Table 8 presents the output power of the diesel generator with and without considering the BESS operation. In bold are shown those situations where the diesel unit is disconnected, all of them during the first peak between *t* = 12 h and *t* = 13 h.


**Table 5.** Total GHG emissions without battery (Case II).

**Table 6.** Total GHG emissions with battery (Case II).


**Table 7.** Reduction of GHG emissions (Case II).


**Table 8.** Diesel power generation (Case II).


### *4.3. Case III: Very High Wind Speed with Empty Battery*

In this case, conditions of extreme wind speed are analyzed by setting the average speed to 24 m/s (*SaW* = 24 m/s), while the battery remains empty (*SOCB*(0) = 0.15).

Figure 22 shows the wind speed (left) and wind power (right) for this case. As wind speed becomes higher than the cut-out speed (25 m/s) for those cases with wind speed oscillation, the wind turbine is taken out of service in order to preserve it. Thus, NL suddenly increases during the afternoon.

**Figure 22.** Wind speed and wind power (Case III).

GA evolution is shown in Figure 23, where a fast convergence is observed due to the fact that the battery has to be charged during the first hours of the day, reducing the number of possible combinations of the optimization problem.

**Figure 23.** GA evolution (Case III).

Management signal is shown in Figure 24. According to these results, battery should be charged during the morning. Then, a short resting period is advised so that enough energy is available to be discharged during the peak-load hours.

**Figure 24.** Battery managemen<sup>t</sup> (Case III).

Charging and discharging cycles are represented by means of the battery power and SOC shown in Figure 25 at the left and right sides, respectively.

**Figure 25.** Battery power and SOC (Case III).

The reduction of NL as a result of BESS integration can be observed at the left side of Figure 26. NL without considering the influence of BESS is presented at the right side of Figure 26, where the increment of load demand during the afternoon can be clearly observed.

**Figure 26.** Net load with and without battery (Case III).

GHG emissions are fully described in Figures 27–29, where the lack of wind generation during the afternoon, as a result of the extremely high wind speed, directly influences the behavior of all emission factors.

**Figure 27.** THC and CO emissions (Case III).

**Figure 28.** NOX and CO2 emissions (Case III).

**Figure 29.** PM emissions (Case III).

Energy surplus and ENS are reported in the left and right sides of Figure 30, respectively, where the energy excess is directly related to the operation of the diesel generator during the afternoon. As expected, there is no ENS because the diesel generator is able to supply any value of electricity demand.

**Figure 30.** Excess and ENS (Case III).

Tables 9–12 summarize the GHG emissions and diesel generation for this case. By comparing Tables 9 and 10, it is possible to observe that, in some situations, THC emissions can increase when BESS reduces NL in a considerable manner. Regarding the wind speed oscillation, as *SbW* increases, wind speed in the hours close to 15 h (*ScW* = 15 h) increases to a value higher than cut-out speed (25 m/s), removing the wind power generation. Thus, BESS supplies a part of the required power, but essentially most of it is provided by the diesel generator, increasing even more the emissions of CO, NOx, CO2, and PM to the atmosphere.

**Table 9.** Total GHG emissions without battery (Case III).


**Table 10.** Total GHG emissions with battery (Case III).


**Table 11.** Reduction of GHG emissions (Case III).


In Table 12, it can be observed how the diesel generator reduces its power production or is disconnected. This happens in those hours between *t* = 12 h and *t* = 20 h, when BESS has an active role in mitigating NL.

From the sensitivity analysis of Cases I-III, it is possible to conclude that the objective function defined in (30) offers reasonable results in terms of BESS managemen<sup>t</sup> for peak-shaving. The next section studies the performance of TVMS-BPSO implemented to minimize this already tested objective function.


**Table 12.** Diesel power generation (Case III).
