1. Introduction
In this work, the authors propose an electrical battery model. Furthermore, the authors have modelled the electrical consumption and the consequent bills with reference to the different penalties that apply when the maximum power level is exceeded. This battery model is cognizant of the state of health losses via a charge and discharge policy for managing the reduction in maximum power. Therefore, the authors introduce a power smoothing technique. Despite the fact that there is other research work related to energy storage policies, all of them are developed from the electric energy producer’s point of view [
1,
2,
3]. Generally, these works do not study the problem considering multiple distributed little electrical energy consumption points.
The authors propose a model that is optimized by employing a particle swarm optimization algorithm. Sandhu et al. [
4] employed this type of optimizer in power smoothing applications for sizing the battery energy storage system according to the level of smoothing power requirement. The optimization attempts to reduce electrical bills by making maximum power consumption cuts using an electrical battery as a power smoother. There are similar optimization problems that are solved by conventional algorithms [
5], but they prove that intelligent algorithms must be utilized in order to apply real-world non-linear restrictions. The most important conventional optimization is the gradient descent-based optimization. This algorithm is widely applied in artificial neural network training [
6,
7], and it has different versions, such as stochastic descent gradient [
8,
9] or batch gradient descent [
10]. This algorithm appropriately solves the neural network training problem as the loss functions are mathematically known, continuous and derivable. Usually, the gradient descent algorithm does not manage restrictions. However, restrictions are introduced when modifying the loss function with regularization techniques, such as L1 and L2, or batch normalization techniques [
11,
12,
13]. These algorithms are able to manage very extensive dimension optimization problems. Nevertheless, they need many iterations or epochs of optimization in order to reach an admissible solution. In fact, these algorithms are usually executed in graphical process units as they need plenty of computational resources. Often, these algorithms reach, yet do not leave, local minima points. Their convergence decreases heavily when they reach certain local optima, although momentum techniques are very common [
14]. In this gradient descent algorithm, explicit mathematical expressions are needed in order to obtain the gradient components. In addition, these expressions must be finite as they are used to update the weights of the neural network. There are other conventional optimization algorithms, such as the Nelder–Mead simplex method [
15]. This algorithm has heuristics that can manage discontinuities in cost or loss function. Moreover, it is able to consider inequality restrictions in loss or cost function and, in addition, it does not need any explicit mathematical expressions of cost or loss function regarding the variable set. It also has a very good optimization performance if the initial variable set values are close to the global solutions. Furthermore, it has some capability to avoid local minima, but it is not easy for it to avoid all local minima.
In order to solve the optimization problems, a particle swarm optimization (PSO) algorithm has been developed. This algorithm belongs to the family of heuristic algorithms, which are commonly used to solve complex multi-objective and non-linear problems. A very good introduction to, and application of, an example of particle swarm optimization can be found in [
16]. Furthermore, there are other intelligent algorithms that are able to solve these problems, such as differential evolution [
17]. However, the authors have chosen PSO because the changes in particles or solutions are smoother compared with that in differential evolution or genetic algorithms. In [
18], a PSO-based optimization was employed to solve a problem regarding material dynamics behaviour identification. This work shows that this kind of algorithm can solve complex optimization problems.
At first, the PSO algorithm was applied in order to simulate the flocking process of birds. With time, the algorithm was discovered to be highly successful as an optimizer [
19]. This algorithm has solved many optimization problems, as shown in [
20]. Unfortunately, PSO does not guarantee the achievement of the absolute optimal solution. Nevertheless, this algorithm always improves at each iteration. PSO is similar to a genetic algorithm (GA), where the system is initialized with a population of random solutions. For each solution, a randomized velocity is assigned, and the original solutions, which are called particles, are then flown through the problem space. Each particle keeps track of its coordinates in the problem space, which are associated with the best solution (fitness) it has achieved so far [
19]. The authors have applied PSO successfully in other optimization problems related to energy applications, such as [
21,
22,
23].
The core of the current study consists of evaluating the installation of an electrical battery in the local council of Arrasate-Mondragon in order to reduce the peak power. The significance of this work resides in the expensive terms of the energy bill, which are due to the excessive maximum power levels assigned in electrical contracts and aggravated by certain maximum power levels. A detailed description of the European electrical energy market can be found in [
24]. Thus, a particle swarm optimization (PSO)-based algorithm is used for battery sizing in peak power smoothing applications for different electrical consumption points. Therefore, the original process for the implementation of particle swarm optimization consists of changing the following steps of Eberhart et al. [
19]. First, the population of particles with random positions and velocities is initialized. Next, the desired optimization fitness function is evaluated. The particle’s fitness evaluation is then compared with the best solution achieved so far (
pbest). If the current value is better than the current best, then
pbest is set equal to the current value. The current value’s location is also stored as
pbest’s location in the space. The fitness evaluation is compared with the population’s previous best (
gbest). If the current value is better than the current best, then
gbest is reset to the current particle’s array index and value. Subsequently, the velocity and position of the particle is changed. Finally, loop to the second step until a criterion is met.
2. Electrical Bill Model
The authors chose the 3.0A tariff since it is the most common one for 15 kW electrical links. In fact, 3.0A is the tariff that Arrasate-Mondragon’s town council employs as a studied electrical consumption point [
25]. This tariff is very common for low-voltage electrical consumption points with 15-kW contracted power or more, and it has three time spans. The time span hours of the day are specified in the Spanish electrical system. Therefore, each hour is assigned to one of these three time spans [
25]. A similar work was presented by Martinez-Rico et al. [
26], but from the point of view of the electrical energy producer. These time spans have their own energy price and maximum power price. In this tariff, the maximum contracted power at least in one time span grants 15 kW or more, see Equation (1):
The 3.0A tariff has several penalties or bonuses depending on the maximum power reached at each time span. The Spanish electrical system defines all penalties and bonuses according to the ratio between the maximum power consumption reached at a given time span (at least for 15 consecutive minutes), known as
, and the maximum power contracted at that time span,
. This ratio is defined as “
”:
where
is the power consumption at the
i-th instant, while
is the maximum power contracted. If the power consumption at the
i-th instant
overcomes
for more than 15 consecutive minutes, the electrical consumer must pay this maximum
power over the whole month for that time span. Note that all days are divided into three time spans: peak, valley, and medium consumption time spans. Each time span has its own
. All the days in a year and all the hours in a day are classified considering these three time spans by the Spanish Government.
Based on this ratio, three different cases are defined. The first one occurs when
, and the power is billed as stated:
Second, in the case where
is fulfilled, the maximum power consumed is considered as the hired power:
Finally, if
, the following equation is applied to measure the bill:
Due to the variety of penalizations and the number of periods from the tariff, a brute force optimization is proposed, as it only requires an adjustment of the hired power for each maximum power consumption period. In the case where no maximum power is higher than 15 kW, three iterations would be enough to obtain the optimum power to hire. Equations (6) and (7) illustrate the correct method to resolve this optimization issue:
where
is the number of iterations accomplished by the proposed optimization algorithm.
To sum up the optimizing modelling for the 3.0A tariff, the function to minimize (
Z) represents the cost of the hired powers:
where
is the price of the hired power for the
period, which is the number of billed days during the consumption periods considered for the experiments performed in this study.
4. Optimization Process
In the optimization process, the variables to change are the battery capacity , the nominal power of the battery , and the power smoothing coefficient of the power smooth policy, .
The authors propose a particle swarm optimization (PSO) algorithm as optimizer. This algorithm was proposed by Kennedy and Eberhart [
30] and is based on swarm intelligence. This algorithm tries to optimize the cost function using a particle set. Each particle has a solution for the optimization problem, and there is a vector that contains three values: battery capacity, nominal power, and power smoothing coefficient.
The algorithm has a set of particles, and each particle has a proposed solution for the optimization problem. This solution is the generalized position of the particle . Each particle has a position given by its solution. Furthermore, each particle has a speed vector, , which is calculated in order to reach better solutions or positions.
During optimization iterations, each particle evaluates its position or solution. This evaluation is made with the cost function defined previously. Each
i-th particle has its positions and speed vector, and the best position reached by this particle is
. All particles know the best position,
, reached by the whole set of particles until that iteration. The particle’s position is defined via the following equation at the
-th iteration:
where
is the speed at each
t iteration. The speed of the
i-th particle changes to
and to the best position
reached by whole set. There are three parameters that modulate the behaviour of the PSO algorithm: the weight of the
i-th particle
,
, and
. The last two parameters modulate the exploration or exploitation behaviours of the algorithm.
is the maximum value that can achieve
which is a positive uniform random number at each iteration and particle.
is also the maximum value that can achieve
, which is a positive uniform random number at each iteration and particle:
The weight of each particle has been examined in many studies [
31,
32,
33,
34] as it can heavily affect the PSO optimizer’s solutions. In this case, the authors have proposed a time variable weight policy, as suggested in [
32]. The weights start at a high value and decrease time linearly until a minimum value is reached. This time variable policy is described in Equation (34):
where
is the number of iterations needed to change the weight from
to
. In fact, the weight decreases when the number of optimization algorithm iterations increases (see
Figure 2).
5. Study Cases and Consumption Data
5.1. Consumption Data
The authors collected electrical consumption data from the northern Spanish town of Arrasate-Mondragon. This town council is in the Basque Country and has about 22,000 inhabitants. The town council of Arrasate has more than 200 electrical consumption points. Some of them are public illumination systems, while others are different public services such as sports centres. The consumptions that are taken into account in this work are real power consumption values measured in real time. The authors proposed the sports centre of Musakola, Arrasate as being the most important power consumption point to study. The authors collected 4922 power consumption samples between 20 May 2020 and 11 December 2020, with a sample time of one hour.
A web application was created by the authors that was based on web scraping, in order to collect all the data from the electrical company (Iberdrola) automatically. The authors created this application using C# programming language, as it was very easy to develop a frontend for the town council’s technical personnel. The electrical power consumptions are shown in
Figure 3.
This power consumption point has a three-period electrical bill system [
25]. A three-period bill system specifies three different prices during the day. Generally, the first period is related to the low general consumption hours of the day, the second one is related to the medium general consumption hours of the day, and, finally, the third period is related to the high general consumption hours of the day. Therefore, each period has its own maximum power. Usually, these powers are in ascending order. In this case, the town council has the same maximum power levels for each period (see
Table 1).
The battery health loss has been modelled as per [
29]. According to the depth of discharge (
DoD), the authors applied a health loss function, which is defined in
Table 2. This table is defined by an Arrhenius curve as per [
29] (see
Figure 1).
The authors made an exponential regression of this data in order to calculate the health loss per cycle of discharge for a given
DoD, following Equation (35):
where
is the
DoD of the discharge cycle of the battery. The authors did not take into account aging factors such as temperature, so as to keep the battery model simple.
The maximum power level prices per kW and the energy prices in euros per kWh of power consumption are shown in
Table 3 for 1 February 2020. The prices of the three-period bill system are also displayed (the 3.0A tariff, to be precise, see [
25]).
The exact time spans of each day for each period and the maximum power levels for the three-period bill system (the 3.0A tariff bill system) are defined in the Spanish electrical market law.
5.2. Electrical Battery Economical Return Analysis
Next, the authors reveal the economic returns caused by implanting an electrical battery in order to smooth the power demand curve. The analysis was carried out using prices and costs from 20 May 2020. At that time, the relative cost of an energy unit’s capacity was EUR 126.9976 per kWh [
29]. The authors interpolated the cost using the prediction equation in [
29].
The parameter set applied to the PSO optimization algorithm is shown in
Table 4.
The particle position initialization follows a uniform random distribution.
The authors executed the same optimization many times in order to verify that the obtained optimal solution was really the best solution with different initialization points. The same optimal solution was always achieved. This solution is shown in
Figure 4 and
Figure 5.
It is clear that, nowadays, it is not worth applying battery systems in order to smooth power peaks. However, the authors carried out a sensitivity analysis of the solutions changing the price of the battery capacity.
5.3. Sensitivity Analysis of Battery Capacity Price (EUR/kWh)
In this section, the authors pose the following question: Which battery capacity price is worth a power curve smoothing battery?
In order to answer this question, the authors defined a set of optimization problems. Each optimization problem has its own capacity price. A PSO optimizer was applied to each optimization problem. The capacity price was uniformly increased for each case. Each PSO optimization applies a capacity price as per Equation (36). Therefore, the authors achieve the optimal battery capacity for a given capacity price:
where
is the number of optimization problems,
is the optimization problem index, and
and
are the maximum and minimum capacity prices, respectively.
The particles are initialized around the best solutions achieved in the previous optimization. The initialization process at each optimization problem generates a particle with a better solution than before. If an initialized particle does not achieve a better solution, then the best solutions reached in the previous optimization problem are taken.
In order to ensure the coherence of the algorithm in the first iteration, a particle with a non-optimal fitness is introduced. This way, it is guaranteed that the optimal cost obtained during the brute force algorithm’s iterations is decreasing.
Figure 6 illustrates the flux diagram of the process.
Table 5 shows the parameters used for the algorithm. The number of particles is reduced because, as it is executed several times, it ends up being computationally expensive, and it would otherwise take a lot of time to conclude the sensitivity study.
Figure 7 displays the results obtained for the optimal costs of the problem’s solution for each price of the battery.
According to
Figure 7, the total optimal cost starts descending faster as of iteration 20. With regard to the power term, it stays stable for all iterations. The savings come in terms of energy.
Figure 8 shows the evolution of the battery parameters along the iterations.
For this study, in which the sample periods are an hour, a nominal power value higher than the battery’s capacity means that the optimal nominal power is equal to the battery’s capacity. The parameter kept a constant value of 1 during all the iterations of the sensitivity algorithm.
Regarding the power consumption of the electrical grid,
Figure 9,
Figure 10,
Figure 11 and
Figure 12 show a comparison with and without the battery of iterations 30, 50, 80, and 100, respectively, after implanting a battery.
According to the previous figures, the bigger the battery, the better the control function works. In addition,
Figure 13 illustrates how all the optimal batteries are submitted to very deep cycles, increasing the cycle’s depth as the battery’s capacity also increases.
Another interesting relationship is between the average minimum and maximum charges along the cycles and the battery’s capacity. From this, it can be observed that, in batteries with a
DoD distinct from 100%, the complete charge of the battery has prevailed over the complete discharge, or vice versa.
Figure 14 represents the average maximum and minimum charge along the cycles related to the nominal capacity.
6. Conclusions
Performing a profitability analysis after implanting a battery at a consumption point has shown that, at the present time, it is still not profitable.
Subsequently, the sensitivity of the price per kWh of the battery has been analysed to determine the prices at which the implantation of a battery could be profitable, and it has been observed that, despite it not being profitable at this time, it is likely to become so soon enough, with profitability increasing faster as the kWh price decreases. However, this profitability has come from the non-consumption of energy obtained from the electrical grid rather than from a lower demand for maximum power peaks.
On one hand, there are set characteristics for the data from the consumption point, where there are three different zones. The first zone involved the first 600 consumption data, where all the consumption values are inferior to the average consumption. The second zone comprised the next 3000 data, where practically all the consumptions are superior to the average. The third included the last 1500 data, where most consumptions are below the average. In the second zone, the higher consumptions are caused by the fact that the battery is continuously undergoing a discharging process, so the moment the maximum points are reached, there is no, or very little, energy stored. Therefore, it is impossible to reduce the maximum peaks.
On the other hand, the type of model employed is based on releasing energy indiscriminately when the demanded consumption is superior to the average.
In terms of the aging of the batteries, the sensitivity study concluded that the use of short lifespan batteries may be profitable in the future. Despite not being highly profitable, the mere fact that a result like this may become profitable means that the price of the kWh would lower until the indiscriminate use of these batteries becomes profitable. This demonstrates that, in 10 or 20 years, it will be a factor to keep in mind.
One interesting result that was obtained is the optimal nominal power that has been assigned to every optimal battery. Considering that the employed sample period was an hour, it was observed during most sensitivity iterations that the optimal nominal power was slightly lower than the optimal capacity of the battery. Furthermore, the average maximum charge per cycle was inferior to the maximum capacity of the battery. Therefore, the authors conclude that, for this particular study, the nominal power of the battery performed as a limiting mechanism to lower the depth of discharge of the battery.