*Article* **Intelligent Energy Management in a Prosumer Community Considering the Load Factor Enhancement**

**Fernando V. Cerna <sup>1</sup> , Mahdi Pourakbari-Kasmaei 2,\* , Luizalba S. S. Pinheiro <sup>1</sup> , Ehsan Naderi <sup>3</sup> , Matti Lehtonen <sup>2</sup> and Javier Contreras <sup>4</sup>**


**Abstract:** In prosumers' communities, the use of storage batteries (SBs) as support for photovoltaic (PV) sources combined with coordination in household appliances usage guarantees several gains. Although these technologies increase the reliability of the electricity supply, the large-scale use of home appliances in periods of lower solar radiation and low electricity tariff can impair the performance of the electrical system. The appearance of new consumption peaks can lead to disturbances. Moreover, the repetition of these events in the short term can cause rapid fatigue of the assets. To address these concerns, this research proposes a mixed-integer linear programming (MILP) model aiming at the optimal operation of the SBs and the appliance usage of each prosumer, as well as a PV plant within a community to achieve the maximum load factor (LF) increase. Constraints related to the household appliances, including the electric vehicle (EV), shared PV plant, and the SBs, are considered. Uncertainties in consumption habits are simulated using a Monte Carlo algorithm. The proposed model was solved using the CPLEX solver. The effectiveness of our proposed model is evaluated with/without the LF improvement. Results corroborate the efficient performance of the proposed tool. Financial benefits are obtained for both prosumers and the energy company.

**Keywords:** community of prosumers; new consumption peak; shared PV plant; storage batteries; load factor

#### **1. Introduction**

#### *1.1. Overview*

The need for efficient electricity management in large cities worldwide has led electric utilities to implement the *Smart Grid* (SG) concept in their electrical distribution networks (EDNs) [1]. In an advanced communication environment, the SG is characterized by the bidirectional flow of data and power between the smart meters of customers with the information center of energy companies [1,2]. In this context, traditional electricity consumers play an active role in the electrical grid operation either through the photovoltaic (PV) generation [3] or the change in habits of usage of residential appliances [4]. In the case of PV generation, some part is used for the customer's own consumption, while the surplus PV energy is injected into the power grid [5,6]. In this way, energy credits are obtained by the prosumers, allowing them to reduce the energy bill for the coming months [6]. Moreover, sometimes, in smart homes, energy storage devices are used to mitigate the intermittency in PV production during the day to ensure supply continuity [7,8]. In the case of a consumption habit change, the appliances whose scheduling is based on hourly

**Citation:** Cerna, F.V.; Pourakbari-Kasmaei, M.; Pinheiro, L.S.S.; Naderi, E.; Lehtonen, M.; Contreras, J. Intelligent Energy Management in a Prosumer Community Considering the Load Factor Enhancement. *Energies* **2021**, *14*, 3624. https://doi.org/10.3390/ en14123624

Academic Editor: Luis Hernández-Callejo

Received: 19 May 2021 Accepted: 16 June 2021 Published: 18 June 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

rates allow reducing energy consumption during periods of higher energy prices, i.e., peak consumption period [4]. The aspects mentioned above represent the most well-known strategies to guarantee the security and reliability of the EDN in the SG environment [9]. However, the diurnal and intermittent characteristics of solar radiation, as well as the dynamic energy tariffs on a given day, can contribute to the appearance of new consumption peaks in the consumption profile of the community [10,11]. As during off-peak hours the energy tariff is cheaper, many prosumers prefer to postpone or anticipate the usage of the appliance, then the usage of their appliances may coincide, especially those with higher average power, within these periods [12]. These events can affect the power grid performance, compromising the assets lifetime, mainly of the power transformers, feeders, and protection devices [13].

The International Energy Agency (IEA), in its 2017 report, *Residential Prosumers in the European Energy Union*, highlights the impact on the electricity grid (e.g., congestion and its stability), focusing on the increase in the number of prosumers in a short term horizon [14]. Upon these challenges, the development of smart tools that assist decisionmakers toward efficient energy management of prosumers communities is of critical importance. Furthermore, such tools should consider the assessment of indexes related to the rational usage of energy to guarantee the efficiency of the power supply. One way can be through the evaluation of the load factor (LF). The LF is defined as the ratio between the average demand and the maximum demand for a given period [15]. This indicator varies over a range of values, with a minimum of 0 and a maximum of 1 [16]. Depending on the adopted value, the LF related to a given consumption profile indicates the efficiency level at which the electric energy is being utilized. For example, when the LF value is low, e.g., 0.5, 0.4, 0.2, etc., the profile shows high energy consumption (peaks) at different times of the day, as well as the periods at which the consumption is almost zero (valleys). In contrast, when the value is close to 1, e.g., 0.75, 0.8, 0.9, etc., the profile shows a wide distribution of energy consumption throughout the day, indicating efficient electricity management [15,17]. Therefore, the LF improvement as part of the intelligent energy management strategy of prosumers communities can contribute to planning the EDN more economically and efficiently.

The literature review below highlights the existence of a gap related to the topic of energy communities to be addressed. To address such shortcomings and fill the existing gap, this paper proposes a MILP model to manage electricity consumption in a prosumer community efficiently. The proposed model aims to minimize the energy purchased from the power grid by scheduling the loads. At the same time, a system of SBs combined with a shared PV plant fulfills the energy needs of the prosumer community, and, in the case of generating surpluses of power, these are directed to the grid. These objectives are achieved in a coordinated manner to obtain a wide distribution of consumption during the day, which is represented by improving the LF. By increasing the LF, this work seeks to mitigate the appearance of new peaks in periods with cheap energy tariffs (due to the coincident usage of appliances with higher average power) via intelligent operation of PV-based technology and energy storage, ensuring continuity of supply. Operational constraints related to the operation periods of household appliances and battery charging of EVs within each smart home, SBs, shared PV plant, and power balance in the power distribution system are taken into account. Moreover, the uncertainties in the usage patterns of household appliances and charging of EVs are simulated using a Monte Carlo algorithm. Our work seeks to go beyond the model proposed in [18]. In this research, the problem of improving the LF was addressed to a group of consumers differentiated by domestic income, that is, each consumer having a different number of appliances. In addition, in this research, the group of consumers has been supplied solely by the energy company, disregarding the presence of sources of electricity generation and/or storage. This work addresses the empowerment of residential consumers (especially those with higher household income), through the use of power technologies to generate surplus energy once all the community's energy requirements are met. The proposed MILP model

is implemented in the AMPL [19] language, and to guarantee to obtain the global optimal solution, the commercial solver CPLEX [20] is used. Consequently, the main contributions of this research are itemized hereunder.


#### *1.2. Literature Review*

Most of the works addressing energy management of prosumers communities focused on trading the purchase/sale of energy among stakeholders. The authors in [21] addressed the problem of energy consumption scheduling for the day-ahead. Cooperative game theory was implemented to model the scheduling strategy aiming at minimizing the total costs of each prosumer. Moreover, this strategy was tested in a community with ten energy self-producers. The impact of consumption patterns of the prosumers, as well as the levels of solar radiation in the integration of the PV generation in the communities, was investigated in [22]. The primary objective was to reduce the total costs related to investments in power technologies (i.e., PV panels and SBs), and results revealed considerable savings for prosumers, mainly in the electricity bill. The authors in [23] proposed an optimization model to represent several regulatory aspects related to tariff schemes and the self-consumption of PV energy. Real data has been used to determine the economic implications of these regulatory mechanisms. The profitability obtained by the consumer community shows its strong dependence on regulatory incentives. A MILP model that aimed to minimize the energy bill of prosumers was developed in [24], where the constraints related to the operation of PV units in each residence were considered. The results highlighted the monetary benefits and the possibility of adapting the contracted demand to the new consumption profile. The work in [25] implemented a two-stage control architecture to efficiently schedule residential loads taking into account thermal comfort. The first stage aimed to allocate the PV power according to the production level of each building. Subsequently, the load of each building was scheduled at the second stage. The results indicated that flexibility in the allocation of power is a key factor for occupant comfort. Similarly, the authors in [26] developed a strategy for controlling the injected PV energy into the power grid. The purpose of this strategy was to stabilize the voltage profile in the distribution system. For this purpose, a non-cooperative game-based algorithm was implemented to control PV generators. In [27] and [28], techniques for optimal management of PV systems, SBs, as well as shared power strategies of energy communities were applied. In [27], an adaptive robust optimization (ARO) structure was used to reduce the consumption costs of prosumers, as well as to optimize the management of thermal loads, while [28] proposed a technique for controlling priority electrical loads together with SBs, both according to flexibility in community consumption. The authors in [29] developed a community energy market model (CEM) aiming at maximizing the financial benefits of both consumers and prosumers. For the consumers, this goal was achieved through the reduction in consumption costs, and for the prosumers by managing the power injected into the electrical network. The work revealed that, depending on the configuration in the consumer and prosumer communities, the economic gains could increase. Another case of CEMs was addressed in [30] by proposing two schemes based on the coordination of generation sources and energy storage within a community. These

schemes considered game theory, Karush–Kuhn–Tucker conditions, and strong duality theorem to allow achieving a win-win situation for all participants. To manage the power of a community in real-time, a fog-based model was developed in [31] aiming to improve the energy contract for all electricity self-producers. Three scenarios were presented to evaluate this model, such as (i) supply of demand by the electricity company, (ii) cooperation between prosumers and microgrids to meet demand, and (iii) integration of the electricity company, prosumers, and microgrids. The results show the effectiveness of the fog model for real-time data flow in addition to the financial gain. To minimize the operating costs of both individual residences and an entire residential community, a peer-to-peer (P2P) energy trading methodology was developed in [32]. Each residence was equipped with a rooftop PV system, SBs, and a set of DC and AC electrical loads, where the P2P methodology resulted in energy savings for different levels of PV energy penetration. The authors in [33] implemented two approaches related to prosumers' microgrids. In the first approach, a genetic algorithm was developed to improve the incompatibility between generation and demand of microgrids. The second approach is aimed at optimizing the coordination of SBs charging/discharging. Both approaches were carried out in a regulatory context in Spain and contributed to the efficient performance of the electricity grid. To minimize the total operational costs of a set of prosumers in the EDN, the authors in [34] developed strategies based on the Directed Steiner Tree (DST) and Weighted Dominating Set (WDS) algorithms. In this work, the economic and operational constraints of each microgrid belonging to a given prosumer were considered in formulating the problem. A MILP model was proposed in [35] for optimal sizing of SBs, PV panels, and inverters in the prosumer residence. This model was tested in a deterministic and stochastic manner, demonstrating its potential to establish more economical and operational plans. Some works in the literature on the same topic have used machine learning techniques to better capture different aspects. Suitable adaptation techniques and learning strategies were proposed in [36] to model the behavior patterns of prosumers, as well as the levels of participation in the power grid through power injection. In [37], machine learning strategies were applied to manage the renewable resources of a community of prosumers. In this work, the objective was to minimize the energy consumption expenditures of the community. The aforementioned works highlight the application of strategies based on game theory and artificial intelligence, among others, where most surveys aim to reduce expenses related to energy consumption in the prosumers community by reducing peak demand and/or increasing their financial gain by selling energy to EDN operators. However, there is little attention to research related to the appearance of new consumption peaks in periods with cheaper energy prices by reducing consumption in peak periods through the intelligent management of SBs and accomplishing the shared PV plant.

Furthermore, some works addressed the increase in LF through energy efficiency, integration of distributed generation, or recharging/discharging EVs in the power grid. The authors in [38] implemented a methodology to improve the LF aiming at reducing the active losses, as well as integrating the medium voltage PV plants and plug-in EVs. In [39], the LF improvement through scheduling the charging of EVs was addressed while minimizing the total costs. This work considered two cases. In the first case, through operational planning, the charging of EVs was evaluated. And, in the second case, the LF is improved by charging EVs through efficient scheduling. The LF behavior of a university building was studied in [40] over a period of three years, where strategies related to loading balance were implemented to enhance the building LF. Similarly, in [16], the LF of another university building was improved by replacing old equipment, as well as scheduling priority loads. Through a multi-objective formulation and several stochastic-based cases, the work in [41] aimed to minimize the energy costs of a residential customer and increase the LF related to the domestic consumption profile. The effectiveness of the proposed method was confirmed by obtaining a reduction in customer bills while guaranteeing a satisfactory LF. An operational technique to reduce the peak load was implemented in [17]. In this work, based on classified data according to the frequency of electricity

consumption, the household appliances having the most significant impact on the energy bill were identified. By applying this strategy, the peak demand for a set of residential customers was reduced and, consequently, the LF improved. To improve the LF of a group of commercial buildings, the authors in [42] proposed demand-side management (DSM) strategy aiming at reducing energy consumption costs. In addition, a tariff structure to minimize peak demand was considered. The results showed a reduction in electricity costs, in addition to an improvement in the performance of the distribution network. As can be seen, in these works, the improvement of the LF was addressed by some surveys that consider the presence of distributed generation and fleets of EVs in the operation of the EDN, while others have considered the implementation of energy efficiency programs in public buildings. However, strategies related to intelligent energy management that consider the LF enhancement as an indicator of efficient electricity usage were disregarded.

The rest of the paper is organized as follows. In Section 2, the main hypotheses that drive the MILP model are presented, while the Monte Carlo simulation algorithm and the SG environment for this problem are explained. Section 3 describes the MILP model in detail. Simulation results and analysis are discussed in Section 4. Finally, Section 5 concludes the paper.

#### **2. Simulation Setup**

In this Section, the main hypotheses related to the set of household appliances, PV plant, and operation of SBs are presented. The treatment of the hourly preferences of each prosumer, and the simulation algorithm in the habitual usage of household appliances, are explained. Additionally, the flow of energy and information in the SG environment is mentioned in detail.

#### *2.1. Hypotheses*

The following hypotheses are used to develop the model and analyze its potential are as follows.


 

௩ × <sup>௧</sup>

௧

, ∀ ∈

 ௧ ௗௗ

 

**Figure 1.** The daily operational performance of the prosumers community.

 − 

௩ = × ௧ × ௗௗ × × × ௩ × <sup>௧</sup>

௧ ௩

௧


**Table 1.** Technical Data related to Home Appliances with *β<sup>a</sup>* = 1.

**Table 2.** Technical Data related to Home Appliances with *β<sup>a</sup>* = 0.


**Table 3.** Technical Data related to EVs (*β<sup>a</sup>* = −1).


#### *2.2. Shared PV Plant and Prosumers Community Operation*

In the shared PV plant, the solar radiation, A*pv* × G*<sup>t</sup>* , is converted to electrical power in DC, *P pv t* , using (1).

$$P\_t^{pv} = \mathbb{\mathcal{J}}^p \times \mathbb{\mathcal{J}}^{\text{ti}} \times \mathbb{\mathcal{J}}^{\text{dd}} \times \mathbb{\mathcal{J}}^{\text{ml}} \times \mathbb{\mathcal{J}}^{\text{cl}} \times \mathcal{A}^{pv} \times \mathcal{G}\_{t\prime} \,\forall t \in T \tag{1}$$

The power conversion is performed considering the effect of the tolerance levels on the panel production, temperature, dirt and dust, power losses in the cabling, and power losses on the DC and AC sides represented by the coefficients *ζ p* , *ζ ti* , *ζ dd* , *ζ ml*, and *ζ cl* , respectively [43,44]. Note that the PV power produced by the shared plant depends on the levels of solar radiation throughout the day, G*<sup>t</sup>* [45,46]. It is worth mentioning that in a more realistic scenario, the PV power produced by the shared plant can be reduced to more than 40% of its nominal power (depending on the number of connected arrays) due to cloud displacement during the day [47–49]. In this sense, in our proposed model, once introduced as a feature in the smart meter, it must evaluate the stochastic behavior of solar radiation (e.g., due to the presence of clouds, etc.) and determine, for each period *t*, an average of solar radiation values (based on the weather data). Therefore, each radiation value in period t can be assigned to G*<sup>t</sup>* in (1) and thus our proposal can be applied in real systems.

The daily operation of the prosumers' community in the SG environment is depicted in Figure 1. In this scheme, energy storage devices (such as SB 1, SB 2, SB 3, and SB 4), which support the energy consumption of each prosumer *u*, consider the power flows *P abs u*,*t*

and *P inj u*,*t* in each period *t*. Note that both powers are the components of *P s <sup>u</sup>*,*<sup>t</sup>* depending on the state of each SB (recharge/discharge) in period *t*. In addition, the energy stored in the SB, C *sb u* , during the day considers the *η abs <sup>u</sup>* and *η inj <sup>u</sup>* rates. Also, note that the power *P s u*,*t* has two directions (i.e., from the grid to the smart home or from the smart home to the power grid) depending on the C *sb u* in the SB, the power generation *P pv t* of the PV plant, and the electricity price, *ζ<sup>t</sup>* . Household appliances *a*, including the EV of each prosumer *u* are supplied through the power *P sr t* throughout the day. Each smart home has a habitual consumption profile represented by H *cp u*,*a*,*t* , which is optimized through the MILP model, obtaining O *cp u*,*a*,*t* .

#### *2.3. Habitual Consumption Profile and Hourly Preferences*

Hourly preferences and the habitual usage patterns of each appliance are two key aspects causing changes in the consumption profile of customers. The habitual consumption profile considers the usage habits of each appliance *a*, existing in a smart home, according to the needs of the prosumer *u* throughout the day. In each smart home, a number of appliances equal to twenty-one are being considered, including the EV. Tables 1–3 present the technical characteristics of each appliance *a* [50,51]. Appliances *a* with working time greater than 1 h are shown in Table 1. In Table 2, all appliances *a* with working hours less than 1 h are listed. Finally, Table 3 reports the technical data for EVs. Due to the variable nature of customers' needs during the day and the day-to-day, uncertainties in the usage of household appliances *a* in given periods *t* need to be considered for having a more practical model. Algorithm 1, which is based on the Monte Carlo method [52], is used to simulate these uncertainties.

Algorithm 1 starts considering the date related to *Pa*, C*a*,*<sup>t</sup>* , *Q<sup>a</sup>* , *Qa*, *Qev u* , and ∆*t*, which are the average power of each appliance *a*, the probability of using each appliance *a* in the period *t* [53], the minimum number of times that a given appliance *a* with *β<sup>a</sup>* = 1 is turned on, the number of times that a given appliance *a* with *β<sup>a</sup>* = 0 is turned on, the number of times that EV with *β<sup>a</sup>* = –1 is connected for battery charging, and the duration of each period *t*. The values to be adopted by indexes *u*, *a*, and *t* are established through intervals 1 . . . |*U*|, 1 . . . |*A*|, and 1 . . . |*T*|, respectively. Then, the values of Cˆ *a*,*t* , X *hp u*,*a*,*t* , and Ψ*u*,*<sup>a</sup>* are initialized; Cˆ *<sup>a</sup>*,*<sup>t</sup>* and X *hp u*,*a*,*t* to zero, and the value of Ψ*u*,*<sup>a</sup>* depends on *βa*. Note that for values of *<sup>β</sup><sup>a</sup>* such as 1, 0, and −1, the parameter <sup>Ψ</sup>*u*,*<sup>a</sup>* assumes the values *<sup>Q</sup><sup>a</sup>* , *Qa*, and *Qev u* , respectively. After that, an iterative process related to each appliance *a* is performed. For each iteration, the value of the accumulator *k* is set to zero. Additionally, for each iteration *a*, another iterative process for each period *t* is done. Within this process, C*a*,*<sup>t</sup>* is added to the current value of *k*, thus obtaining a new value for *k,* which in turn is assigned to Cˆ *a*,*t* . Both iterative processes are completed once the indexes *a* and *t* reach the values of |*A*| and |*T*|, respectively. Hereafter, an iterative process related to each prosumer *u* is performed. Next, another iterative process for each appliance *a* is also performed. Within this last iterative process, an infinite loop is executed. For each iteration, a random number, *ρ*, between zero and one hundred is generated. Then, within the iterative process related to periods *t*, the random value *ρ* is evaluated through the condition Cˆ *<sup>a</sup>*,*t*−<sup>1</sup> ≤ *ρ* ≤ Cˆ *a*,*t* . If this condition is met, then a value of one is assigned to X *hp u*,*a*,*t* , otherwise, X *hp u*,*a*,*t* remains zero. Once all values of *t* are completed, a new condition is evaluated. Thus, if the condition ∑ |*T*| *t*=1 X *hp <sup>u</sup>*,*a*,*<sup>t</sup>* = Ψ*u*,*<sup>a</sup>* is verified, then, another iterative process for each period *t* is performed, and, in each iteration *t*, the value of H *cp u*,*a*,*t* is calculated as the product *P<sup>a</sup>* × X *hp <sup>u</sup>*,*a*,*<sup>t</sup>* × ∆*t*. Still in the same condition with ∑ |*T*| *t*=1 X *hp <sup>u</sup>*,*a*,*<sup>t</sup>* = Ψ*u*,*<sup>a</sup>* being verified, after index *t* has completed the total number of iterations, |*T*|, the execution of the algorithm goes back to step 12, and the infinite loop stops. When the previous condition is not met, the algorithm returns to step 18, and then the infinite loop also ends. The algorithm ends when *u* and *a* have completed all their values.

ℭ

× Χ௨,,௧

∑ Χ௨,,௧ |்|

௧ୀଵ = Ψ௨,


,௧ Χ௨,,௧

× ∆ <sup>∑</sup> <sup>Χ</sup>௨,,௧

<sup>Χ</sup>௨,,௧

ℋ௨,,௧ 

௧ୀଵ = Ψ௨,



ℋ௨,,௧ ℋ௨,,௧ As a result of the execution of this Algorithm 1, the values of the habitual consumption profile, H *cp u*,*a*,*t* , are obtained for each prosumer *u*, for each appliance *a*, and in each period *t*. Moreover, the H *cp u*,*a*,*t* values are part of the MILP model input data.

௨,,௧ The hourly preferences *θ p u*,*a*,*t* of household appliances *a* are understood as flexibility, i.e., postponing or anticipating the periods *t* when a given appliance *a* can be turned on for consumption without compromising the comfort or lifestyle of each residential prosumer *u*. In this work, these periods *t* of flexibility in the household appliances usage are represented through the binary parameter *θ p u*,*a*,*t* . Thus, when *θ p u*,*a*,*t* adopts the value of 1, then the corresponding period *t* is part of the hourly preferences related to the appliance *a*, otherwise, periods *t* with *θ p u*,*a*,*t* = 0 do not correspond to the hourly preferences but may have the habitual consumption of electricity, H *cp u*,*a*,*t* . For example, Figure 2 shows the *θ p u*,*a*,*t* = 1 values for air conditioning as well as the EV during the day. In the case of air conditioning, prosumers can switch on their appliance at certain times, including peak hours. For EVs, the night and dawn periods are considered. For all prosumers *u*, the *θ p u*,*a*,*t* values for each appliance *a* in each period *t* are assumed to be [54], taking into account the criteria of [12,50,51,55].

௨,,௧ 

**Figure 2.** Hourly preferences related to air conditioning and the EV.

= <sup>ଵ</sup> + <sup>ଶ</sup>

#### **3. Mathematical Model**

௨,,௧ 

The initial formulation of the problem is represented by a mixed-integer nonlinear programming (MINLP) model. Nonlinear terms are presented in the objective function as well as in the operational constraints. These constraints are related to household appliances, including each EV presented in homes, as well as the power balance of the electrical system and the energy stored through the SB.

௨,,௧ 

> ℋ௨,,௧

௨,,௧ 

> ௨,,௧

#### *3.1. Objective Function*

<sup>ଵ</sup> <sup>ଶ</sup> <sup>ଵ</sup> (ଵ) (ଶ) (ଷ) <sup>ଵ</sup> <sup>ଶ</sup> The objective function (2) is composed of two functions, *ψ*<sup>1</sup> and *ψ*2. In function *ψ*1, the terms starting with the weighting coefficients *̟*(1) , *̟*(2) , and *̟*(3) are respectively related to the reduction in costs per energy consumption, coincident usage of household appliances with higher average power, and electricity purchase from the utility company. Therefore, *ψ*<sup>1</sup> aims to minimize the key elements that have a direct effect on prosumer's electricity bill. On the other hand, the function *ψ*<sup>2</sup> allows reshaping of the optimal consumption profile by reducing the difference between *P at t* and *P av*, which implicitly maximizes the value of LF.

$$\text{Minimize } f = \psi\_1 + \psi\_2 \tag{2}$$

௩

where,

$$\psi\_1 = \mathcal{O}^{(1)} \times \left[ \sum\_{\forall u \in I} \sum\_{\forall a \in A} \sum\_{\forall t \in T} \zeta\_t \times \mathcal{O}^{ep}\_{u,t,t} \right] + \mathcal{O}^{(2)} \times \left[ \sum\_{\forall u \in I} \sum\_{\forall t \in T} \theta^i\_{u,t} \right] + \mathcal{O}^{(3)} \times \left[ \sum\_{\forall t \in T} P^{eu}\_t \right] \quad \text{(4)}$$

$$\psi\_2 = \mathcal{O}^{(4)} \times \left[ \sum\_{\forall t \in T} \left( P^{ut}\_t - P^{av} \right)^2 \right]$$

∀௧∈்

#### *3.2. Constraints*

#### 3.2.1. Home Appliances Constraints

The constraints described below are related to the operating regime of household appliances as well as the charging of EV batteries and are based on the research [40]. Equations (3) and (4), through variable *X op u*,*a*,*t* , determine for each period *t*, the on/off state of each appliance *a* belonging to the prosumer *u*. In (3), the off state of each appliance *a* is established only for hourly preferences with *θ p u*,*a*,*t* = 0. For each prosumer *u* with hourly preference values *θ p u*,*a*,*t* = 1, (4) indicates whether the appliance *a* can be turned on or off in a given period *t*. Equation (5) is related to household appliances with higher average power, *β i <sup>a</sup>* = 1. Thus, for each prosumer *u*, the value of *θ i u*,*t* calculates the number of appliances *a* in each period *t* with *β i <sup>a</sup>* = 1 that can be turned on.

$$X\_{\
u,a,t}^{op} = 0, \forall \iota \in \mathcal{U}, \forall a \in A, \forall t \in T \mid \theta\_{\iota,a,t}^{p} = 0 \land t \ge 1 \tag{3}$$

$$\{X\_{\mu,a,t}^{op} \le 1, \forall u \in \mathcal{U}, \forall a \in A, \forall t \in T \mid \theta\_{\mu,a,t}^p = 1 \land t \ge 1\tag{4}$$

$$\theta\_{\mathsf{u},t}^{i} = \sum\_{\forall a \in A} \left( \mathbf{X}\_{\mathsf{u},a,t}^{op} \times \theta\_{\mathsf{u},a,t}^{p} \times \beta\_{\mathsf{a}}^{i} \right), \forall \mathsf{u} \in \mathsf{U}, \forall t \in T \mid t \ge 1 \tag{5}$$

The operating regime of household appliances with working hours greater than or equal to 1 h, *β<sup>a</sup>* = 1, is modeled by (6)–(9). The number of times this type of appliance is turned on during the day is established by the limits *Q<sup>a</sup>* and *Q<sup>a</sup>* in (6), while the time of usage of the appliance *a* within each period *t* is obtained by (7). The optimal consumption profile, O *cp u*,*a*,*t* , in each period *t* in which appliances *a* with *β<sup>a</sup>* = 1 are turned on is calculated using (8). In (9), for each prosumer *u*, the total time of usage of the appliance *a* during the day, *τa*, is guaranteed through the product of *θ p u*,*a*,*t* , *X op u*,*a*,*t* and *τ us u*,*a*,*t* .

$$\underline{Q}\_{a} \le \sum\_{\forall t \in T \mid t \ge 1} X\_{u,a,t}^{op} \times \theta\_{u,a,t}^{p} \le \overline{Q}\_{a\prime} \,\forall u \in \mathcal{U}, \,\forall a \in A \mid \beta\_{a} = 1 \tag{6}$$

$$
\underline{\tau}\_a \le \underline{\tau}\_{u,a,t}^{\rm us} \le \overline{\tau}\_{a\prime} \; \forall u \in \mathcal{U}, \; \forall a \in A, \; \forall t \in T \; | \; \beta\_a = 1 \; \land \; t \ge 1 \tag{7}
$$

$$\mathcal{O}^{cp}\_{\mathsf{u},\mathsf{a},\mathsf{t}} = \mathsf{P}\_{\mathsf{a}} \times \theta^{p}\_{\mathsf{u},\mathsf{a},\mathsf{t}} \times X^{op}\_{\mathsf{u},\mathsf{a},\mathsf{t}} \times \tau^{\mathsf{us}}\_{\mathsf{u},\mathsf{a},\mathsf{t}\prime} \,\forall \mathsf{u} \in \mathsf{U}, \,\forall a \in A, \,\forall t \in T \,\mid \, \beta\_{a} = 1 \land t \ge 1 \tag{8}$$

$$\sum\_{\substack{\forall t \in T \mid t \ge 1}} X\_{u,a,t}^{op} \times \theta\_{u,a,t}^p \times \tau\_{u,a,t}^{us} = \tau\_{a\prime} \forall u \in \mathcal{U}, \forall a \in A \mid \beta\_a = 1 \tag{9}$$

Constraints (10)–(11) are related to appliances *a* with working hours less than 1 h, i.e., type of appliance with *β<sup>a</sup>* = 0. In (10), the number of times that each appliance *a* is utilized throughout the day is established, while the optimal consumption, O *cp u*,*a*,*t* , of each appliance *a* related to the prosumer *u* is obtained by (11).

$$\sum\_{\substack{u,t \in T \ t \ge 1}} \theta\_{u,a,t}^p \times X\_{u,a,t}^{op} = \mathbb{Q}\_a \,\forall u \in \mathcal{U}, \,\forall a \in A \mid \beta\_a = 0 \tag{10}$$

$$\mathcal{O}^{cp}\_{\mathsf{u},\mathsf{a},\mathsf{t}} = \mathsf{P}\_{\mathsf{a}} \times \theta^{\mathsf{p}}\_{\mathsf{u},\mathsf{a},\mathsf{t}} \times X^{\mathsf{o}\mathsf{p}}\_{\mathsf{u},\mathsf{a},\mathsf{t}} \times \tau\_{\mathsf{a}}, \forall u \in \mathsf{U}, \,\forall a \in A, \,\forall t \in T \,\mid \: \beta\_{\mathsf{a}} = 0 \land t \ge 1 \tag{11}$$

Through (12)–(18), the operating regime of EV (the type of appliance *a* with *β<sup>a</sup>* = −1) related to the prosumer *u* is represented. For each prosumer *u*, the energy stored in the EV battery in each period *t* is determined in (12). In (13), the variation interval related to the charging time of the EV battery is established considering the limits [*τ ev u* , *τ ev u* ], while (14) ensures the number of times that the EV battery can be charged within the range <sup>h</sup> *Q ev u* , *Q ev u* i . The optimal profile, O *cp u*,*a*,*t* , of the EV (*β<sup>a</sup>* = −1) related to prosumer *u* is obtained by (15) as the total energy stored in the EV battery during the day is calculated using (16). This total energy, *ε ev u* , must be equal to a percentage *λ*<sup>1</sup> of the battery capacity, C *ev u* , of the EV, as (17).

$$\text{SoC}^{\text{ev}}\_{\mathfrak{u},t} = \mathbb{P}^{\text{ev}} \times \text{X}^{\text{op}}\_{\mathfrak{u},\mathfrak{a},t} \times \tau^{\text{ev}}\_{\mathfrak{u},t}, \forall \mathfrak{u} \in \mathsf{U}, \ \forall a \in A, \ \forall t \in T \mid \mathcal{S}\_{\mathfrak{a}} = -1 \land t \ge 1 \tag{12}$$

$$
\underline{\tau}\_{\mu}^{\varepsilon\upsilon} \le \underline{\tau}\_{\mu,t}^{\varepsilon\upsilon} \le \overline{\tau}\_{\mu}^{\varepsilon\upsilon}, \forall \mu \in \mathcal{U}, \ \forall t \in T \mid t \ge 1 \tag{13}
$$

$$\underline{Q}\_{\boldsymbol{u}}^{cv} \le \sum\_{\forall t \in T \mid t \ge 1} X\_{\boldsymbol{u},a,t}^{op} \le \overline{Q}\_{\boldsymbol{u}}^{cv}, \forall \boldsymbol{u} \in \mathcal{U}, \forall a \in A \mid \mathcal{S}\_{a} = -1 \tag{14}$$

$$\mathcal{O}^{cp}\_{\mathsf{u},a,t} = \mathrm{SoC}^{cv}\_{\mathsf{u},t'} \forall u \in \mathsf{U}, \,\forall a \in A, \,\forall t \in T \,\,\middle|\,\beta\_a = -1 \land t \ge 1\tag{15}$$

$$\mathfrak{e}\_{\mathfrak{u}}^{\varepsilon\upsilon} = \mathrm{SoC}\_{\mathfrak{u}} + \sum\_{\forall t \in T \mid t \ge 1} \mathrm{SoC}\_{\mathfrak{u},\mathfrak{t}'}^{\varepsilon\upsilon} \forall \mathfrak{u} \in \mathsf{U} \tag{16}$$

$$
\varepsilon\_{\mu}^{ev} = \lambda^1 \times \mathcal{C}\_{\mu}^{ev} \,\forall \mu \in \mathcal{U} \tag{17}
$$

$$\sum\_{\forall a \in A} \mathcal{O}\_{\mathsf{u},a,t}^{cp} \le \mathsf{Max}\_{\forall t' \in T} \left[ \sum\_{\forall a \in A} \mathcal{H}\_{\mathsf{u},a,t'}^{cp} \right], \forall \mathsf{u} \in \mathsf{U}, \forall t \in T \mid t \ge 1 \tag{18}$$

After calculating O *cp u*,*a*,*t* of each appliance *a* related to the prosumer *u*, (18) ensures that the total consumption in each period *t* of the optimal profile O *cp u*,*a*,*t* not exceed the peak consumption of the habitual profile H *cp u*,*a*,*t* .

#### 3.2.2. Power Balance Constraints

Constraints (19)–(24) are related to the power flow between the PV plant, the electricity company, the smart home of each prosumer (including EV), as well as the SB, as depicted in Figure 1. The power balance is guaranteed in (19). Note that this equation considers the surplus of energy injected into the electrical network, either by the PV plant or by the SBs in each period *t*. The non-negativity of the power coming from the electric grid, *P en t* , is guaranteed in (20). In (21), the power *P s u*,*t* is calculated for each period *t* as the sum of power supplied to the smart home of the prosumer *u*, *P sr u*,*t* , and the *P inj u*,*t* / *P abs <sup>u</sup>*,*<sup>t</sup>* powers, related to the SB. The *P sr u*,*t* values for the prosumer *u* in each period *t* are computed in (22). The total power required by all smart homes, *P at t* , in each period *t* is obtained using (23). Finally, (24) determines the average value of *P at t* that is represented by *P av*. It is worth noting that both (23) and (24) are linked to the improvement of the LF, as can be seen in (2).

$$P\_t^{pv} + \left(P\_t^{en} - P\_t^{splus}\right) = \sum\_{\forall u \in U} P\_{u,t\prime}^s \,\forall t \in T \mid t \ge 1 \tag{19}$$

$$0 \le P\_t^{\text{en}}, \forall t \in T \mid t \ge 1 \tag{20}$$

$$P\_{\mathbf{u},t}^{\mathbf{s}} = P\_{\mathbf{u},t}^{\mathbf{s}r} + \left(\eta\_{\mu}^{\text{abs}} \times P\_{\mathbf{u},t}^{\text{abs}} - \eta\_{\mu}^{\text{inj}} \times P\_{\mathbf{u},t}^{\text{inj}}\right), \forall \mu \in \mathcal{U}, \forall t \in T \mid t \ge 1 \tag{21}$$

$$P\_{\mathsf{u},t}^{sr} = \left(\frac{1}{\Delta t}\right) \times \sum\_{\forall a \in A} \mathcal{O}\_{\mathsf{u},\mathsf{a},t'}^{cp} \,\forall u \in \mathsf{U}, \,\forall t \in T \mid t \ge 1 \tag{22}$$

$$P\_t^{at} = \sum\_{\forall u \in \mathcal{U}} P\_{u,t\prime}^{sr} \; \forall t \in T \; | \; t \ge 1 \tag{23}$$

$$P^{av} = \left(\frac{1}{|T|}\right) \times \sum\_{\forall t \in T \mid t \ge 1} P\_t^{at} \tag{24}$$

#### 3.2.3. Energy Storage Constraints

Constraints (25)–(31) represent the operation of the SBs related to each prosumer *u*. The injected power *P inj u*,*t* and the absorbed power *P abs u*,*t* by the SB are limited by (25) and (26), respectively. The injection/absorption status of the SB is established by (27). Note that when the SB is injecting power (*µ inj u*,*t* = 1), it cannot absorb power (*µ abs <sup>u</sup>*,*<sup>t</sup>* = 1), and vice versa. In (28), the initial state of charge *SoCsb u*,*t* (*t* = 0) of the batteries is established as a percentage *λ* 2 *<sup>u</sup>* of the storage capacity, of each SB related to the prosumer *u*, C *sb u* . It is worth mentioning that the period *t* = 0 is related to the last period of the previous day. The state of charge of the SB for the rest of the periods *t* is obtained by (29). Constraint (30) guarantees that at the end of the day *t* = |*T*| the *SoCsb u*,*t* of the SB is equal to its storage capacity, C *sb u* , while (31) guarantees that the SoC of SB throughout the day does not exceed the C *sb u* capacity.

$$
\mu\_{\boldsymbol{u},t}^{\mathrm{inj}} \times \underline{\mathbf{P}}\_{\boldsymbol{u}}^{\mathrm{inj}} \le \mathbf{P}\_{\boldsymbol{u},t}^{\mathrm{inj}} \le \mu\_{\boldsymbol{u},t}^{\mathrm{inj}} \times \overline{\mathbf{P}}\_{\boldsymbol{u}}^{\mathrm{inj}}, \forall \boldsymbol{u} \in \mathsf{U}, \ \forall t \in T \; | \; t \ge 1 \tag{25}
$$

$$\mu\_{\mathfrak{u},t}^{\mathrm{abs}} \times \underline{\mathbf{P}}\_{\mathfrak{u}}^{\mathrm{abs}} \le \mathbf{P}\_{\mathfrak{u},t}^{\mathrm{abs}} \le \mu\_{\mathfrak{u},t}^{\mathrm{abs}} \times \overline{\mathbf{P}}\_{\mathfrak{u}}^{\mathrm{abs}} \, \forall \mathfrak{u} \in \mathsf{U}, \,\forall t \in T \,\mid t \ge 1 \tag{26}$$

$$
\mu\_{u,t}^{\rm inj} + \mu\_{u,t}^{\rm abs} = 1, \forall u \in \mathcal{U}, \forall t \in T \mid t \ge 1 \tag{27}
$$

$$So\mathcal{C}\_{\boldsymbol{\mu},t}^{sb} = \lambda\_{\boldsymbol{\mu}}^2 \times \mathcal{C}\_{\boldsymbol{\mu}'}^{sb}, \forall \boldsymbol{\mu} \in \mathcal{U}, \; \forall t \in T \; | \; t = 0 \tag{28}$$

$$\text{SoC}\_{\text{u},t}^{\text{sb}} = \text{SoC}\_{\text{u},t-1}^{\text{sb}} + \left(\eta\_{\text{u}}^{\text{abs}} \times \text{P}\_{\text{u},t}^{\text{abs}} \times \Delta t - \eta\_{\text{u}}^{\text{inj}} \times \text{P}\_{\text{u},t}^{\text{inj}} \times \Delta t\right), \forall \mu \in \mathcal{U}, \forall t \in T \mid t \ge 1 \tag{29}$$

$$So\mathcal{C}\_{\boldsymbol{u},t}^{sb} = \mathcal{C}\_{\boldsymbol{u}}^{sb}, \forall \boldsymbol{u} \in \mathcal{U}, \forall t \in T \; |\; t = |T|\tag{30}$$

$$0 \le \mathcal{S}o\mathcal{C}\_{\boldsymbol{\upiota},t}^{sb} \le \mathcal{C}\_{\boldsymbol{\upiota}}^{sb}, \forall \boldsymbol{\upiota} \in \mathcal{U}, \; \forall t \in T \; | \; t \ge 1 \tag{31}$$

#### *3.3. Linearization*

As the original model is a mixed-integer nonlinear one, commercial solvers face difficulties in finding the global solution. To address this issue, linearization techniques are applied to recast the nonlinear terms in the objective function *ψ*2, as well as in constraints (8), (9), and (12).

The Big-M method [56] is applied to linearize (8) and (9). Thus, these equations are replaced by (32)–(35).

$$\mathcal{O}^{cp}\_{\mathsf{u},\mathsf{a},t} = P\_{\mathsf{a}} \times \theta^{p}\_{\mathsf{u},\mathsf{a},t} \times \Delta \tau^{\mathsf{u}s}\_{\mathsf{u},\mathsf{a},t}, \forall u \in \mathsf{U}, \ \forall a \in A, \ \forall t \in T \mid \beta\_{a} = 1 \ \wedge t \ge 1 \tag{32}$$

$$\sum\_{\forall t \in T \mid t \ge 1} \theta\_{u,a,t}^p \times \Delta \tau\_{u,a,t}^{\mu s} = \tau\_{a\prime} \forall u \in \mathcal{U}\_{\prime} \; \forall a \in A \mid \beta\_a = 1 \tag{33}$$

$$0 \le -\Delta \mathfrak{r}\_{\mathfrak{u},\mathfrak{a},t}^{\mathrm{us}} + \mathfrak{r}\_{\mathfrak{u},\mathfrak{a},t}^{\mathrm{us}} \le M \times \left(1 - X\_{\mathfrak{u},\mathfrak{a},t}^{\mathrm{op}}\right), \forall \mathfrak{u} \in \mathsf{U}, \forall \mathfrak{a} \in A, \ \forall t \in T \mid t \ge 1 \tag{34}$$

$$0 \le \Delta \tau\_{\mathfrak{u},\mathfrak{a},t}^{\mathfrak{us}} \le M \times X\_{\mathfrak{u},\mathfrak{a},t'}^{\mathfrak{op}} \; \forall \mathfrak{u} \in \mathcal{U}, \; \forall a \in A, \; \forall t \in T \; |t \ge 1 \tag{35}$$

Likewise, (36)–(38) present the linear representation of constraint (12).

$$\text{SoC}\_{\text{u},t}^{\text{ev}} = \mathbb{P}^{\text{ev}} \times \Delta \text{r}\_{\text{u},t'}^{\text{ev}} \forall u \in \mathcal{U}, \forall a \in A, \; \forall t \in T \; | \; \beta\_a = -1 \land t \ge 1 \tag{36}$$

$$0 \le -\Delta \tau\_{\mathfrak{u},t}^{\varepsilon v} + \tau\_{\mathfrak{u},t}^{\varepsilon v} \le M \times \left(1 - X\_{\mathfrak{u},\mathfrak{a},t}^{\rho p}\right), \forall u \in \mathcal{U}, \forall a \in A, \ \forall t \in T \mid t \ge 1\tag{37}$$

$$0 \le \Delta \tau\_{\mathfrak{u},t}^{\varepsilon \upsilon} \le M \times X\_{\mathfrak{u},\mathfrak{a},t'}^{op} \; \forall \mathfrak{u} \in \mathsf{U}, \; \forall a \in A, \; \forall t \in T \; |t \ge 1\tag{38}$$

To linearize the function *ψ*2, a discretization process related to the square of the difference between *P at t* and *P av* is performed [57,58]. As a result, function *ψ*<sup>2</sup> is presented by *ψ* ′ 2 , while (39)–(42) are also considered.

$$\begin{aligned} \psi\_2' = \mathcal{O}^{(4)} \times \begin{bmatrix} \sum\_{\forall t \in T} \sum\_{\forall y \in 1Y} \Pi\_{t,y} \times \Delta \Lambda\_{t,y} \\ P\_t^{\text{d}I} - P^{\text{av}}, \,\forall t \in T \mid t \ge 1 \end{bmatrix} \end{aligned} \tag{39}$$

$$
\Lambda\_t^+ - \Lambda\_t^- = \Lambda\_{t\prime} \,\forall t \in T \,\big|\, t \ge 1 \tag{40}
$$

$$
\Lambda\_t^+ + \Lambda\_t^- = \sum\_{y=1}^Y \Delta \Lambda\_{t,y\_\prime} \,\forall t \in T \mid t \ge 1 \tag{41}
$$

$$0 \le \Delta \Lambda\_{t,y} \le \overline{\Delta}\_{t\prime} \,\forall t \in T\_{\prime} \, y \in 1 \ldots \, Y \, | \, t \ge 1 \tag{42}$$

*3.4. Linearized Model*

The obtained mixed-integer linear programming (MILP) model is presented as follows. Minimize *f* = *ψ*<sup>1</sup> + *ψ* ′ 2

s.t.

Constraints: (3)–(7), (10), (11), (13)–(18), (19)–(24), (25)–(31), (32)–(35), (36)–(38), (39)–(42).

#### **4. Results and Discussion**

This section presents the simulation results and the corresponding discussions to validate the proposed framework related to intelligent energy management in a prosumers community, considering the LF improvement. This model was written in the algebraic language AMPL and solved using the solver CPLEX on an Intel(R) Core(TM) i5 CPU M480@2.67GHz personal computer with a 4.00 GB RAM and a 64-bit Windows 7 operating system.

#### *4.1. Basic Data*

The proposed model is evaluated using the information provided in Tables 1–3 related to the technical data of household appliances *a*, as well as the hourly preferences *θ p u*,*a*,*t* whose periods *t* are specified in [54]. By executing Algorithm 1, the values of the habitual consumption profile, H *cp u*,*a*,*t* , are simulated for each prosumer *u*, each appliance *a*, and for all periods *t*. Then, the proposed MILP model is executed based on the information mentioned above to obtain the optimal consumption profile, O *cp u*,*a*,*t* , result in efficient scheduling of household appliances *a*, as well as the optimal performance of energy generation and storage technologies, i.e., shared PV plant and SBs. The efficient scheduling of household appliances *a* is driven by a scheme tariff *ζ<sup>t</sup>* [59] that reflects the price of energy in a given period *t*, see Table 4. The EV belonging to each prosumer *u* starts the day with a state of charge equal to zero and must be charged with a rate of *P ev* over 4.00 kW until it is fully charged (*λ* <sup>1</sup> = 1 and C *ev <sup>u</sup>* = 20 kWh) [56]. The operation of the PV plant and storage batteries is derived from [60–63]. In the shared PV plant, the power is produced according to (1). Here, the G*<sup>t</sup>* values during the day are obtained considering the maximum local solar radiation Gˆ equal to 0.22 kW/m<sup>2</sup> [64], as well as the per-unit values of standard solar radiation *γ<sup>t</sup>* [65]. This PV power production also considers the loss factors that are associated with energy conversion, such as *ζ <sup>p</sup>* = 0.95, *ζ ti* = 0.89, *ζ dd* = 0.93, *ζ ml* = 0.95, and *ζ cl* = 0.90. Moreover, the effective PV area of 116.64 m<sup>2</sup> considers an arrangement of 60 panels of 330 kW [66]. For SBs, the energy storage capacity, C *sb u* , of prosumers 1, 2, and 3 are 12.0 kWh, 10.0 kWh, and 15.0 kWh, respectively. The SBs start their operation with *λ* 2 *<sup>u</sup>* = 35%, 45%, and 25% of the capacity C *sb u* , for each prosumer *u* [62]. Limits [*P inj <sup>u</sup>* , *P inj u* ] of the power injected by each SB are [1.00, 3.00] for prosumer 1, [1.50, 3.50] for prosumer 2, and [0.50, 2.50] for prosumer 3. Also, limits <sup>h</sup> *P abs u* , *P abs u* i of the power absorbed by SBs are assumed to be [1.00, 3.50] for prosumer 1, [0.50, 4.00] for prosumer 2, and [0.50, 3.00] for prosumer 3. In addition, the recharging and discharging of SB is performed with efficiencies *η abs <sup>u</sup>* and *η inj <sup>u</sup>* of 0.98 and 0.99, respectively [63]. The weighting factors *̟*(1) , *̟*(2) , *̟*(3) , and *̟*(4) related to the functions *ψ*<sup>1</sup> and *ψ*<sup>2</sup> adopt the values 1.0, 10.0, 100.0, and 100.0, respectively. Note that the weights *̟*(3) and *̟*(4) have a higher value and are related to the power supplied by the energy company and the term related to the improvement of the LF. The constants *M*, and the number of discretization blocks |*Y*| are set to 1000, and 5, respectively. Also, the value of ∆*<sup>t</sup>* is calculated as 10/|*Y*| in each period *t* [57].


10 10:00–11:00 h 0.22419 0.90 0.198 22 22:00–23:00 h 0.32629 0.00 0.00 11 11:00–12:00 h 0.22419 0.95 0.209 23 23:00–24:00 h 0.22419 0.00 0.00 12 12:00–13:00 h 0.22419 1.00 0.220 24 24:00–01:00 h 0.22419 0.00 0.00

**Table 4.** Hourly values related to the price of energy, standard and local solar radiation.

#### *4.2. Simulation Results*

Based on the information presented above, the optimal management of electricity consumption in a prosumer community can be performed without considering (Case 1) or with considering (Case 2) the improvement of the LF. In Case 1, the proposed model is executed without taking into account the *ψ* ′ 2 function as part of (2). Unlike Case 1, Case 2 considers the function *ψ* ′ 2 to guarantee the improvement of the LF.

Figure 3 shows the profile of habitual, H *cp u*,*a*,*t* , and optimal consumption for each prosumer (in Figure 3a–c) and for all prosumers (community, in Figure 3d). The H *cp u*,*a*,*t* profile obtained through Algorithm 1 is shown by the red line. The O *cp u*,*a*,*t* profiles in the blue and black line represent Case 1 and 2, respectively. In Figure 3a, the H *cp u*,*a*,*t* profile related to prosumer 1 reaches the maximum values of 8.35 kWh and 8.94 kWh in the intermediate period (*t* = 18) and peak period (*t* = 20), respectively. In Case 1, the maximum peak is reduced to 6.49 kWh and shifted to period *t* = 11. Although this consumption profile presents a smooth distribution of consumption throughout the day, the maximum consumption peak appears during off-peak hours. Also, other peaks of consumption of 4 kWh are presented in the respective periods of *t* = 1 and *t* = 6 with the lowest electricity price. In Case 2, the distribution of consumption during the day is greater than Case 1 previously described. Note that there is not a single maximum peak, but a distributed consumption with values of 3.63 kWh (*t* = 1), 3.43 kWh (*t* = 4), 3.88 kWh (*t* = 5), 3.96 kWh (*t* = 11), 3.20 kWh (*t* = 12), and 3.50 kWh (*t* = 17). Moreover, a slight consumption concentration of 4.50 kWh at *t* = 23 shows how improving the LF contributes to a wide distribution of consumption without creating high peaks. Figure 3b,c related to the consumption profiles H *cp u*,*a*,*t* of prosumers 2 and 3 show consumption peaks during peak hours (*t* = 20 with 8.96 kWh, prosumer 3) and in times close to that (*t* = 23 with 7.60 kWh, prosumer 2). In the same way, as in Figure 3a, the O *cp u*,*a*,*t* profile for both prosumers, in Case 1, shows a shift from the maximum consumption peak to periods with cheap energy prices, as *t* = 13 and *t* = 12 with 5.50 kWh (prosumer 2) and 5.87 kWh (prosumer 3), respectively. For Case 2, the O *cp u*,*a*,*t* profile related to prosumer 2 presents a peak consumption of 5.43 kWh at *t* = 19. Within the same period, prosumers 2 and 3 present zero consumption. Also, note that within *t* = 20 and *t* = 21, the only consumption belongs to prosumer 3. At this same time, the consumption of prosumers 1 and 2 are reduced such that it does not increase the cost of electricity consumption by the community, as well as to avoid congestion during power supply in peak periods. This fact shows the efficiency of the proposed model to schedule the usage of domestic loads, especially those with a higher average power, to obtain a more homogeneous distribution in the consumption profile without harming the lifestyle of the prosumers' community. This homogeneous distribution due to the efficient scheduling of household appliances can be seen in Figure 3d. In this figure, the habitual profile of the community reaches a peak of 18.84 kWh at *t* = 20. For the O *cp u*,*a*,*t* profiles, the maximum consumption peaks represent 81.48% (in Case 1) and 40% (in Case 2) of 18.84 kWh, both in the respective periods of *t* = 12 and *t* = 1, 8, 11, 12, and 13. Furthermore, the optimal consumption profile Case 1, the blue line, shows the maximum peak at *t* = 12; in addition to this peak, other consumption peaks are presented within off-peak hours, creating potential load concentrations, which in turn it can cause congestion during power supply. However, in Case 2, for the O *cp u*,*a*,*t* profile, the black line, this occurrence of new peaks is mitigated. Note that, in this case, there is a consumption during peak hours, i.e., the habitual peak consumption has been reduced but not completely eliminated. In Case 1, during peak hours, consumption was completely shifted to other times that possibly contributed to the formation of the new peaks. Therefore, this demonstrates that it is possible to reduce consumption without compromising the reliability of the EDN by considering the improvement in the efficient usage of energy (i.e., increased LF) in intelligent management.

Figure 4a,b demonstrate the values related to the total costs and the LF of each prosumer (1, 2, and 3), as well as the community (total). In both figures, the lines in red, blue, and black are related to the H *cp u*,*a*,*t* profile, the O *cp u*,*a*,*t* profile considering Case 1, and the O *cp u*, *a*, *t* profile considering Case 2, respectively. For each of these consumption profiles, the respective total costs result in \$44.67 (red square), \$30.32 (blue square), and \$36.47 (black square). Note that the costs of each prosumer *u* and the total of prosumers related to the Case 1 are lower than those related to Case 2. Financially, Case 1 is more advantageous only for prosumers. This is because energy consumption in the peak period is completely shifted to periods with lower energy prices. However, this schedule of consumption for

off-peak periods can contribute to the appearance of new concentrations of consumption in these periods (see Figure 3d), causing disturbances in the reliability of the electrical network, which can increase the maintenance expenses. To alleviate this concern, Case 2, in addition to being an alternative for reducing the community's electricity bill, also reduces the occurrence of peak consumption during off-peak hours (see Figure 3d) through efficient scheduling of home appliances *a* considering hourly preferences, which is advantageous for the energy company and prosumers.

**Figure 3.** Habitual consumption profile and profiles of optimal consumption without and with the improvement of the LF. (**a**) Consumption profiles for prosumer 1; (**b**) Consumption profiles for prosumer 2; (**c**) Consumption profiles for prosumer 3; and (**d**) Consumption profiles for all prosumers.

**Figure 4.** Values related to total costs for energy consumption and LF in the prosumers' community. (**a**) Values of total monetary costs; and (**b**) LF values.

Figure 4b shows the values related to the LFs of each prosumer and the community. For profile H *cp u*,*a*,*t* , prosumers 1, 2, and 3 have LF values equal to 0.21, 0.24, and 0.21, while the LF of the community is equal to 0.29. Such values close to zero indicate large concentrations of consumption in given periods of the day, e.g., peak period. Moreover, these low values also indicate that energy is being wasted, i.e., high consumption during peak hours can create stress, especially in the cabling, due to the transformation of electricity into heat that increases energy losses. For Case 1, the LFs have resulted in 0.28, 0.34, and 0.32. Although these LF values are higher than the LF values of the H *cp u*,*a*,*t* profile, the obtained O *cp u*,*a*,*t* profiles still present a heterogeneous distribution of consumption during the day. For Case 2, the

LF values of prosumer 1 and 3 have increased while the LF of prosumer 2 has remained the same. Note that the LF values of 0.42, 0.34, and 0.37 related to prosumer 1, 2, and 3 are still close to zero. This fact shows that the proposed strategy has efficiently scheduled the consumption of each customer (Figure 3a–c) in such a way that the consumption profile of all of them (Figure 3d) presents a wide distribution of consumption during the day. Thus, the value of the LF related to the total of prosumer has increased from 0.36 to 0.73 (approximately double).

From Figure 5 onwards, the performance of the PV plant, the energy SBs, and the power flow within the community for Case 1 (blue line) and Case 2 (black line) are analyzed. Figure 5a shows, for each case, the power supplied by the electrical network, *P en t* , to the community of prosumers in each period *t*. For Case 1, the electric grid supplies the community's energy needs in the interval from *t* = 1 to *t* = 6, and in the period *t* = 24. Note that these periods have cheap energy tariffs. Also, the power grid does not provide power during peak periods, but it is evident that consumption peaks appear at other times, such as at *t* = 2 and *t* = 24, with consumptions equal to 13.72 kWh, and 20.33 kWh, respectively. In Figure 3d, the consumption at *t* = 24 related to this case is less than 20.33 kWh. In this way, part of that consumed energy is provided for each SB presented in a smart home. For Case 2, the power grid supplies energy between periods *t* = 2 to *t* = 6, and *t* = 18 to *t* = 24. Note that in this case, during the peak period, the power supply meets part of the community requirements, specifically 67.83%, while the remainder can be attributed to the energy injected by the SBs. In the same way as in Case 1, a large part of the energy supplied by the electric network in the period *t* = 24 is absorbed by the SBs to guarantee their full charging at the end of the day. Figure 5b shows the values of the surplus power injected into the power grid, *P splus t* , in both cases. Note that for both cases, most of the energy is injected between periods *t* = 9 to *t* = 15, with full presence of solar radiation, G*<sup>t</sup>* . Moreover, the total amount of surplus energy injected for each case turns out to be 33.32 kWh (Case 1) and 46.73 kWh (Case 2). This fact highlights the effectiveness of Case 2, which ensures the rational usage of energy between the Energy Company and prosumers and adds financial gain to prosumers regarding the sale of PV power produced at the shared plant. Figure 5c shows that the power produced by the shared PV plant is the same for both cases. It is important to note that the surplus power *P splus t* in Case 1 and 2 represent 24.20% and 33.94% of the power produced by the PV plant, *P pv t* , in the day. Although *P splus t* is not entirely composed of the plant's PV power, this sold power to the grid contributes to reducing the community's energy bill by approximately 35% when the LF improvement is taken into account.

Figure 6 reports the *P s <sup>u</sup>*,*<sup>t</sup>* power values for each prosumer *u* in each period *t* of the day. The directions of this power are differentiated by the positive and negative values shown in each case. Positive values indicate that the power *P s <sup>u</sup>*,*<sup>t</sup>* measured by the smart meter flows towards the smart home and SB. Otherwise, the power *P s u*,*t* can flow towards the electrical grid or contribute to the energy needs of another smart home in a given period *t*, see Figure 1. For both cases, the number of periods *t* in the day when the *P s <sup>u</sup>*,*<sup>t</sup>* power flows towards the SB and the smart home is much greater than the number of periods *t* related to the opposite flow. This situation indicates that a minimum part of the energy injected by the SBs is delivered to the electric grid, and the rest of this energy contributes to meet the consumption of household appliances in each smart home. In Case 1, during peak and intermediate periods, the positive values of *P s u*,*t* are minimal. According to Figure 3d, in these periods, energy consumption by household appliances is zero. Thus, the positive values mentioned above represent only the powers absorbed by the SBs. During the same periods, the negative values of *P s u*,*t* represent the power injected by the SBs, which in turn contribute to meeting the energy consumption needs of other smart homes. For example, during peak hours (*t* = 20), it can be seen that there is no presence of solar radiation G*<sup>t</sup>* , and energy price *ζ<sup>t</sup>* is high. However, the SB related to prosumer 1 absorbs power (equal to 2.94 kW) from the SB related to prosumer 2 (injects 2.44 kW) and 3 (injects 0.50 kW). For Case 2, at *t* = 20, due to the lack of solar radiation, the supply of power to the community

is done by the electrical network with a value of *P en t* equal to 3.67 kW, as can be seen in Figure 5a. This power is provided for each prosumer *u* according to the operational status of the SB and the energy consumption of the smart home. For prosumer 1, the demand at *t* = 20 is equal to 0.5 kW (Figure 3a). Being *P s <sup>u</sup>*,*<sup>t</sup>* positive and equal to 1.48 kW (Figure 6b), the SB absorbs a power *P abs u*,*t* of 0.98 kW (Figure 7b). For prosumer 2, the power *P s u*,*t* is negative, with a value equal to 3.33 kW (Figure 6d). Furthermore, in the same period, prosumer 2 has a low demand of 0.1 kW (Figure 3b), causing the SB to inject the power *P inj u*,*t* of 3.43 kW (Figure 7d). The highest demand value of 5.03 kW (Figure 3c) in this period is related to prosumer 3. And in this circumstance, *P s u*,*t* adopts a positive value of 5.52 kW (Figure 6f). In this way, the SB absorbs approximately 9% of *P s u*,*t* (Figure 7f). This fact shows the influence of the power supplied by the electric network and the operation of the SBs to serve each smart home during the peak period.

**Figure 5.** Variation during the day of the (**a**) power supplied by the energy company, (**b**) surplus power injected into the power grid, and (**c**) power produced by the shared PV plant.

௨,௧ ௦ ௨,௧ ௦ ௨,௧ ௦ ௨,௧ ௦ ௨,௧ ௦ ௨,௧ ௦ <sup>௧</sup> <sup>௧</sup> ௧ ௨,௧ ௦ ௨,௧ ௦ Figures 7 and 8 show the injection (negative values) or absorption (positive values) of power, as well as the state of charge of the SBs in the community of prosumers, respectively. In Figure 7, for both cases, the largest number of periods *t* in which the SBs absorb power is within hours with the presence of solar radiation G*<sup>t</sup>* . As shown in Figure 5a, the power grid does not contribute to the community's energy needs during this time. Therefore, the PV plant, in addition to contributing to surplus power and the supply of household appliances, also assists the SBs within these hours. It is worth noting that, for Case 1, during peak hours, both the shared PV plant and the electricity grid do not supply energy to the community. Also, during this period, the total energy consumption of the community is zero (Figure 3d). Therefore, the injected power *P inj u*,*t* and absorption power *P abs u*,*t* of the SBs during the peak period shown in Figure 7a,c,e indicate the exchange of power between the same storage technologies. In Case 2, during peak hours, the SBs inject power with a maximum value of 3.0 kW (prosumer 1), 3.5 kW (prosumer 2), and 2.0 kW (prosumer 3). These power values allow managing the state of charge of each SB while the energy consumption of each prosumer is met. Finally, Figure 8 shows the state of charge, *SoCsb u*,*t* , of each SB for both cases. It is worth mentioning that the state of charge of each SB in the last period of the previous day (*t* = 0) is equal to 35%, 45%, and 25% of its capacity. In all cases, the SBs reach full charge (12 kWh for prosumer 1; 10 kWh for prosumer 2; and 15 kWh for prosumer 3) at the end of the day. In the operation of each SB, for Cases 1 and 2, its state of charge at *t* = 1 shows a reduction of the stored energy to a value of 10% of the capacity at the same time as the powers of 3.0 kW, 3.50 kW, and 2.5 kW are injected. Note that at the beginning of the day, i.e., from *t* ≥ 1, the SBs do not have consecutive recharges. Also, note that consecutive recharge occurs within the hours with available solar radiation. In addition, in most cases, the SBs reach full recharge in periods close to the end of the afternoon. Thus, at night hours,

> ௨,௧ ௦

௨,௧ ௦

௨,௧ ௦

> ௨,௧

when energy prices are high and there is no production of PV energy, SBs contribute to share power among themselves (Case 1) or meet the consumption of household appliances (Case 2).

௨,௧ ௦ **Figure 6.** Bidirectional power *P s <sup>u</sup>*,*<sup>t</sup>* measured by smart meter during the day for prosumer 1 ((**a**) Case 1, and (**b**) Case 2); prosumer 2 ((**c**) Case 1, and (**d**) Case 2); and prosumer 3 ((**e**) Case 1, and (**f**) Case 2). ௨,௧ ௦

௨,௧ ௨,௧ ௦ ௨,௧ ௨,௧ ௦ **Figure 7.** Injection *P inj <sup>u</sup>*,*t*and absorption *P abs u*,*t* powers related to the SB of the prosumer 1 ((**a**) Case 1, and (**b**) Case 2); prosumer 2 ((**c**) Case 1, and (**d**) Case 2); and prosumer 3 ((**e**) Case 1, and (**f**) Case 2).

௨,௧ ௦ **Figure 8.** State of charge *SoCsb u*,*t* of SBs for Case 1 (in blue) and Case 2 (in black) related to (**a**) prosumer 1; (**b**) prosumer 2; and (**c**) prosumer 3.

௧

௨,௧

௦

௨,௧

≥

#### **5. Conclusions**

௨,௧ ௦

In this paper, a MILP model has been proposed to address the problem of intelligent energy management in a community of prosumers by improving the LF. The formulation of the proposed model considers a set of economic and operational constraints related to the household appliances usage and charging of EV batteries and the SBs present in each smart home. Constraints related to energy production by a shared PV plant, surplus energy, and community energy balance are also taken into account. Moreover, the efficient scheduling of appliances has been carried out considering the flexibility of their hours of usage, i.e., hourly preferences, without jeopardizing the prosumers' lifestyle. Uncertainties in the habitual usage of each appliance during the day were simulated using a Monte Carlo algorithm. In evaluating the effectiveness of the proposed model, two cases have been considered. In Case 1, the MILP model performs intelligent management without considering the LF improvement. For Case 2, the LF improvement is considered in energy management. The results have shown that the strategy that adopts the improvement of the LF guarantees financial benefits for both the energy companies and prosumers. For prosumers, this strategy allows minimizing energy consumption expenditures through the optimal scheduling of appliances, especially those with higher average power, to avoid the appearance of new consumption peaks during off-peak hours. Moreover, the strategy performs intelligent management of PV generation and energy storage technologies to meet the community's energy needs while any surplus energy produced is injected into the electricity grid. On the other hand, energy companies obtain financial benefits when the wide load distribution (i.e., increasing the LF) in the optimal consumption profile relieves the stress of the power grid and reduces energy waste during power supply. Consequently, several operating costs are minimized in the short and long term, among them the costs related to the maintenance of assets, e.g., power transformers, feeders, and protection devices.

**Author Contributions:** Investigation, F.V.C. and L.S.S.P.; methodology, F.V.C.; writing—review and editing, F.V.C., M.P.-K., E.N., and J.C.; resources, M.P.-K. and M.L. All authors have read and agreed to the published version of the manuscript.

**Funding:** The APC was funded by Aalto University.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

#### **Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Nomenclature**

Functions



].

#### **References**

1. Rawlings, J.; Coker, P.; Doak, J.; Burfoot, B. Do smart grids offer a new incentive for SME carbon reduction? *Sustain. Cities Soc.* **2014**, *10*, 245–250. [CrossRef]

Gˆ Maximum value of the local solar radiation [kW/m<sup>2</sup>

