Keywords

1 Introduction

Energy consumption is the subject of primary importance. Today research proposals seek to optimize the use of electricity in an efficient way. In this sense, it is desired to acquire various benefits, such as: reduction of the payment of the electricity bill, adaptation of renewable energies, improving the reliability of the electrical system, among others. The importance of the efficient use of electrical energy is high because it faces a global problem such as climate change. Nowadays, it is an undeniable reality that greenhouse gases cause damage to the planet’s environment, causing various problems that deteriorate the quality of life on Earth. An example of these environmental disasters represents the increase of Earth’s temperature from 0.4 to 0.8 °C in the last 100 years; it is expected that by the year 2100 the increase will reach a maximum value of 5.8 °C. This reality, unfortunately, would mean the melting of the polar caps and an extremely severe increase in the level of water in the seas and oceans [1].

In Ecuador, a new productivity matrix is trying to change the constant dependency of fossil fuels for utilization of renewable energies. This alternative might mitigate the undesirable climate change’s problems presented around the world. The installed capacity increased since 2007 from 4478 MW to 6005 MW at the end of 2015. The hydro power constitutes a strong power source, since 2017 new hydroelectrical projects started development like Sopladora of 487 MW and Coca Codo Sinclair of 1500 MW [2]. On the other hand, energy waste represents a latent problem. Many consumers who possess electrical or electronic equipment turned on and are not necessarily employing it. Residential consumption is characterized by this problem because there is no culture of proper use of electricity. This problem can generate significant consequences such as the decrease in the reliability of the electrical service when consumption is in peak hours. If it is considered that apart from residential consumption there is also industrial consumption, the consumer must be prudent with electricity consumption to continue with a constant and uninterrupted electricity service. In [3], a study was carried out on the constant losses that are generated in Ecuador through the public lighting system and how this problem is reflected in residential consumers. Many homes in the country still have fluorescent lamps where their ballasts generate losses due to the Joule effect, which is produced by the circulation of current through the conductor that makes up the ballast coil. Since the ballast must deliver a high discharge to the fluorescent lamp, its coil must be large enough in size to meet this objective.

The previously mentioned problems have generated different research that seek to optimize electricity consumption. There are several alternatives suggested to diminish energy losses at residential consumption suggest. From control algorithms to hardware structures, the alternatives seek to optimize the control algorithms for closed-loop regulation, and the use of semiconductors for stable fewer consuming appliances [4]. Also, sellers of electricity give consumers some suggestions to pay less money for electricity bill. For example, turning off equipment that is unused or using equipment in non-peak hours where it will not represent a problem for the electrical system. In this sense, there are proposals that use computer processing to generate intelligent solutions; these techniques are identified as metaheuristic algorithms. These processes seek a solution from a problem that the algorithm designer chooses. In [5], authors developed a work where they incorporate different metaheuristic techniques with artificial neural networks (ANN) to model energy consumption in Thailand. The paper showed different alternatives such as the ant colony algorithm, the harmonic search algorithm, or the teaching learning method optimization algorithm. This work showed several alternatives for the analysis of consumption, however the identification of the largest consumers of electricity is not clearly determined. Authors in [6] studied other alternatives for metaheuristic algorithms such as particle swarm optimization (PSO), cuckoo optimization or gray wolf optimization (GWO). The results showed an accurate prediction about consumers demanding a specific level of electrical energy. However, it was necessary to use data from smart devices to identify all these consumptions, leaving aside possible consumers who do not possess these elements. Also [7] developed an algorithm for search economics home appliance scheduling to address the home appliance consumption to minimize electricity bill. The metaheuristics were placed as consumption simulations to find research results but other capabilities of these algorithms such us cost optimization were unused [7].

The earlier mentioned investigations adequately use metaheuristics algorithms, but other options such as clustering or classification algorithms can be explored. These algorithms perform an intelligent classification of data according to objectives such as: levels, intensities, hierarchies, among others. For this reason, this work looks for to offer an energy optimization method with the previous classification of consumers through a clustering algorithm. This algorithm will take the consumption data samples to divide them into three groups: high, medium, and low. The essential goal is to reduce high consumption by optimizing the time your non-essential loads are on. This paper is divided as follow, Sect. 1 shows the introduction of this research, Sect. 2 briefly describes the metaheuristics algorithms needed in this work, Sect. 3 shows experiments and assessments, and lastly, Sect. 4 determines the main conclusions obtained after completing this research.

2 Metaheuristics Algorithms

2.1 K-means Clustering

The K-means algorithm is a clustering technique designed for partitioning a set of raw data. K-means. This method finds K groups of clusters depending on similarities placed by the algorithm’s designer. The algorithm places one centroid on each iteration to find K groups where the closest neighbors to each centroid are identified. Finally, each data belongs to one exclusive cluster, that is why this method is known as hard clustering [8].

As previous mentioned, each point on the data set is grouped to the closest centroid where the distance is obtained by Euclidean distance as follows:

$$d=\sqrt{\sum_{i=1}^{d} {\left({x}_{i}-{y}_{i}\right)}^{2}}$$
(1)

where \(d\) is the Euclidean distance, \({x}_{i}\) and \({y}_{i}\) are the point for a 2-dimentional Euclidean space. At first place, the algorithm selects randomly K centroids, also known as seeds. Each data point is assigned to the closest centroid and the position of the point is updated in each iteration where the centroid is redistributed according to the optimization of a cost function. The main objective is to minimize the Sum of Square Error (SSE) of the Euclidean distance of each point to its closest centroid by:

$$SSE=\sum_{i=1}^{d} \sum_{{x}_{i\in {C}_{k}}} {\left({x}_{i}-{c}_{k}\right)}^{2}$$
(2)

where \({\mathrm{c}}_{\mathrm{k}}\) is the centroid and it is defined as:

$${c}_{k}=\frac{\sum_{{x}_{i\in {C}_{k}}} {x}_{i}}{{c}_{k}}$$
(3)

The iterative steps of K-means are described as follows (Table 1):

Table 1. K-means pseudocode [9].

An example of data classification is presented in Fig. 1, where raw data is classified into 3 groups according to the closest centroid for each point in the data set.

Fig. 1.
figure 1

K-means clustering in random data to determine 3 groups.

2.2 Particle Swarm Optimization (PSO)

PSO algorithm is a metaheuristics process developed by Kennedy and Eberhart [10] to simulate the behavior of biological systems. In a detailed way, the algorithm is compared with a search process performed by a group of birds or a group of fishes. Everyone in the group collaborates with its neighbors to find a specific objective.

The PSO algorithm is simple, and it is described as follows: The objective is in a space of \(D\) solutions. At first, \(N\) particles are distributed in the solution space as random points. Each particle represents a point with coordinates:

$${X}_{i}=\left({x}_{i1},{x}_{i2},\cdots ,{x}_{iD}\right)$$
(4)

Each element moves with a velocity:

$${V}_{i}=\left({v}_{i1},{v}_{i2},\cdots ,{v}_{iD}\right)$$
(5)

When the search process begins, each particle updates its velocity and position on each iteration:

$${V}_{i}=\omega {V}_{i}+{c}_{1}{r}_{1}\left({p}_{{besti- }{x}_{i}}\right)+{c}_{2}{r}_{2}\left({g}_{{best }}-{X}_{i}\right)$$
(6)
$${X}_{i}={X}_{i}+{V}_{i}$$
(7)

where \({p}_{{besti}}\) is the best position of each particle, \({g}_{{best}}\) is the best global position of the swarm, \({c}_{1}\) and \({c}_{2}\) represent learning factors, \({r}_{1}\) and \({r}_{2}\) random numbers between 0 to 1, and \(\omega \) the inertial weight commonly represented by values between 0.1 to 0.9.

Fig. 2.
figure 2

Position transition of each particle.

Figure 2 shows a graphical representation of the movement and position of each particle from the previous best solution (blue) to the current solution (black) related to the global best solution (red). In the following Table, the PSO process is resumed (Table 2):

Table 2. PSO pseudocode [11].

PSO is a very versatile algorithm that can be combined with other optimization techniques [12,13,14] to acquire better results. These alternatives solve the local optimum problem, where particles in PSO tend to be moving around a specific point and finds a solution that it is not necessary the global optimum [15].

3 Experiments and Assessments

3.1 Clustering of Consumer’s Data

The experiment data comes from a collection of electricity bills of 80 consumers from southern part of Quito city. The consumer’s bill shows the cost of energy and the KWh consumed in a month. An average of the last 3 months was used to determine the use of energy and cost for each consumer. The classification of data with K-means algorithm is presented as follows:

Fig. 3.
figure 3

Energy cost and consumption of experiment’s data.

The number of clusters founded were 3 for low, medium, and high consumption of electricity. The consumption is proportional to the cost of energy as seen in Fig. 3. From the data set, the main points are determined for consumption and cost are (Table 3):

Table 3. Limits from dataset.

After clustering, the centroids for each group as placed as follows:

Table 4. Differences from centroid and average points from dataset.

Table 4 shows the differences between positions of centroid and average from minimum and maximum points. K-means takes properly the centroids because its values are closest to the average points and the 3 groups are clearly determined.

3.2 Optimization of Consumption by PSO

The optimization process takes the data from clustering at the last step. The main objective is to minimize a cost function represented by the quadratic difference between the electrical energy consumed monthly and the maximum value of the medium consumption. The energy consumed by each user is represented as follows:

$$E/day=\sum_{k=1}^{n}{P}_{i}{t}_{i}$$
(8)

where \(E/day\) is the energy consumed in a day in Kwh, \({P}_{i}\) is the power of each appliance in W and \({t}_{i}\) is the time of the use of each appliance in hours. The values are calculated by a period of 30 days to meet the data set from each consumer’s bill.

Before applying PSO method to minimize this problem its mandatory to analyze what appliances can be adopted for this task. In other words, some appliances are important to do daily tasks and are not susceptible for reducing the time of use. Moreover, there are other electrical and electronical devices that can reduce the time of use because are not primordial. A priority matrix [16] is developed to analyze in general, the most important devices for electricity consumers. This matrix compares all home appliances between them and gives a grade of importance. The matrix was developed with a common group of appliances existing in each consumer and a criterion for a hierarchical classification. In the process of comparing each element, values are dismissed when comparing an appliance with itself. Values of 1 are assigned to the most important element and 0 to the less important. The important elements mean appliances that can not be reduced its use. The assignation values are performed from row-row analysis.

Results show the components with higher value of priority can be taken as part of the objective function to find a solution by minimizing the cost function. A priority of lower values means the appliance is very important at home and a higher value means the opposite. The criterion is the same as previously explained with the difference of the number of appliances taken to calculate the electrical energy consumed monthly. Values highlighted will be used for this new optimization process (Table 5).

Table 5. Priority matrix for domestic appliances.
Fig. 4.
figure 4

Displacement of particles in PSO for optimum search.

Figure 4 presents the displacement of particles on each iteration until getting closer to the optimum point. In this case, the energy of 3 appliances were used to determine a const function. The number of particles utilized were 50 and the iteration number was changed to observe the improvement of the best cost.

Table 6. Results of PSO for different number of iterations.

This analysis was performed in one user; it means the optimization on the rest of higher electricity consumers followed the same procedure. The evolution of best cost is presented in the next figure as follows (Fig. 5):

Fig. 5.
figure 5

Number of iterations vs best cost.

The algorithm reaches a value of 0.00056594 as expressed in Table 6, the PSO response is better after adding more iterations. To reach this objective, various tests need to be performed.

Finally, the perspectives for energy savings are presented (Fig. 6):

Fig. 6.
figure 6

Electrical energy improvement for higher consumers.

The consumers for high energy demand will receive benefits from paying less cost of electricity bill between 5 to 20%.

4 Conclusions

PSO algorithm has a precise response to minimize the objective function. Less time of using appliances was put under the tests extracting new times of use for non-essential loads. The analysis performed better results with a larger horizon of iterations.

K-means method divided in 3 well-known groups the data set for consumers of electricity. The groups could take a perspective of more than 3 groups, but the first data point of high consumption was almost $28 which means a good start point of optimization for a conventional family of more than 3 members.

Savings reaches maximum values of almost 20% monthly, which represents an annual improvement in energy consumption proportional to the saving value. The perspectives projected after this experiment emphasizes an increasing in the reliability of the interconnected electrical system.