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

: 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 perfor ‐ mance 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.


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 rates allow reducing energy consumption during periods of higher energy prices, i.e., peak consumption period [4]. The aspects mentioned above represent the most wellknown 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 offpeak 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 decision-makers 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.


Proposing a computationally efficient MILP model to improve the value of LF related to the consumption profile of prosumers while taking into account the efficient scheduling of technologies such as SBs and shared PV generation.  Investigating the intelligent management of an energy community by improving an indicator of the rational usage of energy.  Establishing the management of household appliances (including the EV) to avoid their coincident consumption, especially those with higher average power, to mitigate the occurrence of peak consumption in off-peak periods and/or with insufficient levels of solar irradiation.  Contributing to reducing the dependence on fossil fuels to meet the energy of domestic customers aiming at a sustainability context.

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.

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.

Hypotheses
The following hypotheses are used to develop the model and analyze its potential are as follows.
1. The research is carried out in the SG environment depicted in Figure 1, which highlights the bidirectional flows between various technologies. 2. Considering that household income is proportional to the number of appliances present at home, it is assumed that all consumers have the same household income taking into account the appliances reported in Tables 1 and 2 including the presence of a single EV (to be charged within each household) according to Table 3. 3. The habitual consumption of each appliance (including the EV) for each period of the day is obtained using the Monte Carlo simulation algorithm. 4. The study horizon considers one day, which is divided into 24 hourly periods. 5. A tariff structure is divided into three levels (peak, intermediate, and off-peak) to efficiently schedule the consumption periods of household appliances and the EV charging. 6. The PV plant is shared by the community of prosumers. The PV panels operate in a horizontal position and at the point of maximum power. 7. The effect of the presence of clouds on the yield of the PV plant is not considered.

Shared PV Plant and Prosumers Community Operation
In the shared PV plant, the solar radiation, , is converted to electrical power in DC, , using (1). , ∀ ∈ (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 , , , , and , respectively [43,44]. Note that the PV power produced by the shared plant depends on the levels of solar radiation throughout the day, [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][48][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 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 , and , in each period t. Note that both powers are the components of , depending on the state of each SB (recharge/discharge) in period t. In addition, the energy stored in the SB, , during the day considers the and rates. Also, note that the power , has two directions (i.e., from the grid to the smart home or from the smart home to the power grid) depending on the in the SB, the power generation of the PV plant, and the electricity price, . Household appliances a, including the EV of each prosumer u are supplied through the power throughout the day. Each smart home has a habitual consumption profile represented by ℋ , , , which is optimized through the MILP model, obtaining , , .

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 , ℭ , , , , , and ∆ , 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 = 1 is turned on, the number of times that a given appliance a with = 0 is turned on, the number of times that EV with = -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…| |, 1…| |, and 1…| |, respectively. Then, the values of ℭ , , Χ , , , and Ψ , are initialized; ℭ , and Χ , , to zero, and the value of Ψ , depends on . Note that for values of such as 1, 0, and −1, the parameter Ψ , assumes the values , , and , 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, ℭ , is added to the current value of k, thus obtaining a new value for k, which in turn is assigned to ℭ , . Both iterative processes are completed once the indexes a and t reach the values of | | and | |, 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 ℭ , ℭ , . If this condition is met, then a value of one is assigned to Χ , , , otherwise, Χ , , remains zero. Once all values of t are completed, a new condition is evaluated. Thus, if the condition ∑ Χ , , | | Ψ , is verified, then, another iterative process for each period t is performed, and, in each iteration t, the value of ℋ , , is calculated as the product Χ , , ∆ . Still in the same condition with ∑ Χ , , | | Ψ , being verified, after index t has completed the total number of iterations, | |, 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. Algorithm 1. Simulation of uncertainties in household appliances usage 1.

29.
End for

End for
As a result of the execution of this Algorithm 1, the values of the habitual consumption profile, ℋ , , , are obtained for each prosumer u, for each appliance a, and in each period t. Moreover, the ℋ , , values are part of the MILP model input data.
The hourly preferences , , 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 , , . Thus, when , , 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 , , = 0 do not correspond to the hourly preferences but may have the habitual consumption of electricity, ℋ , , . For example, Figure 2 shows the , , = 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 , , values for each appliance a in each period t are assumed to be [54], taking into account the criteria of [12,50,51,55].

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.

Objective Function
The objective function (2) is composed of two functions, and . In function , the terms starting with the weighting coefficients , , and 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, aims to minimize the key elements that have a direct effect on prosumer's electricity bill. On the other hand, the function allows reshaping of the optimal consumption profile by reducing the difference between and , which implicitly maximizes the value of LF.

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 , , , 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 , , = 0. For each prosumer u with hourly preference values , , = 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, = 1. Thus, for each prosumer u, the value of , calculates the number of appliances a in each period t with = 1 that can be turned on.
, , , , The operating regime of household appliances with working hours greater than or equal to 1 h, = 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 and in (6), while the time of usage of the appliance a within each period t is obtained by (7). The optimal consumption profile, , , , in each period t in which appliances a with = 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, , is guaranteed through the product of , , , , , and , , .
, ∀ ∈ , ∀ ∈ , ∀ ∈ | 0 ∧ 1 (11) Through (12)- (18), the operating regime of EV (the type of appliance a with = −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 , , while (14) ensures the number of times that the EV battery can be charged within the range , . The optimal profile, , , , of the EV ( = −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, , must be equal to a percentage of the battery capacity, , of the EV, as (17).

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, , is guaranteed in (20). In (21), the power , is calculated for each period t as the sum of power supplied to the smart home of the prosumer u, , , and the , / , powers, related to the SB. The , values for the prosumer u in each period t are computed in (22). The total power required by all smart homes, , in each period t is obtained using (23). Finally, (24) determines the average value of that is represented by . It is worth noting that both (23) and (24) are linked to the improvement of the LF, as can be seen in (2).

Energy Storage Constraints
Constraints (25)-(31) represent the operation of the SBs related to each prosumer u. The injected power , and the absorbed power , 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 ( , = 1), it cannot absorb power ( , = 1), and vice versa. In (28), the initial state of charge , (t = 0) of the batteries is established as a percentage of the storage capacity, of each SB related to the prosumer 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 = | | the , of the SB is equal to its storage capacity, , while (31) guarantees that the SoC of SB throughout the day does not exceed the capacity.

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 , as well as in constraints (8), (9), and (12).

Linearized Model
The obtained mixed-integer linear programming (MILP) model is presented as follows.

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.

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 , , whose periods t are specified in [54]. By executing Algorithm 1, the values of the habitual consumption profile, ℋ , , , 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, , , , 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 [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 over 4.00 kW until it is fully charged ( = 1 and = 20 kWh) [56]. The operation of the PV plant and storage batteries is derived from [60][61][62][63]. In the shared PV plant, the power is produced according to (1). Here, the values during the day are obtained considering the maximum local solar radiation equal to 0.22 kW/m 2 [64], as well as the per-unit values of standard solar radiation [65]. This PV power production also considers the loss factors that are associated with energy conversion, such as = 0.95, = 0.89, = 0.93, = 0.95, and = 0.90. Moreover, the effective PV area of 116.64 m 2 considers an arrangement of 60 panels of 330 kW [66]. For SBs, the energy storage capacity, , of prosumers 1, 2, and 3 are 12.0 kWh, 10.0 kWh, and 15.0 kWh, respectively. The SBs start their operation with = 35%, 45%, and 25% of the capacity , for each prosumer u [62]. , and related to the functions and adopt the values 1.0, 10.0, 100.0, and 100.0, respectively. Note that the weights and 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 , and the number of discretization blocks | | are set to 1000, and 5, respectively. Also, the value of Δ is calculated as 10/| | in each period t [57].

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 function as part of (2). Unlike Case 1, Case 2 considers the function to guarantee the improvement of the LF. Figure 3 shows the profile of habitual, ℋ , , , and optimal consumption for each prosumer (in Figure 3a-c) and for all prosumers (community, in Figure 3d). The ℋ , , profile obtained through Algorithm 1 is shown by the red line. The , , profiles in the blue and black line represent Case 1 and 2, respectively. In Figure 3a, the ℋ , , 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 ℋ , , 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 , , 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 , , 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 , , 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 , , 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.   (1, 2, and 3), as well as the community (total). In both figures, the lines in red, blue, and black are related to the ℋ , , profile, the , , profile considering Case 1, and the , , 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 4b shows the values related to the LFs of each prosumer and the community. For profile ℋ , , , 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 ℋ , , profile, the obtained , , 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, , 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, , 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, . 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 in Case 1 and 2 represent 24.20% and 33.94% of the power produced by the PV plant, , in the day. Although 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.  Positive values indicate that the power , measured by the smart meter flows towards the smart home and SB. Otherwise, the power , 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 , 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 , 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 , 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 , and energy price 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 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 , positive and equal to 1.48 kW (Figure 6b), the SB absorbs a power , of 0.98 kW (Figure 7b). For prosumer 2, the power , 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 , 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, , adopts a positive value of 5.52 kW (Figure 6f). In this way, the SB absorbs approximately 9% of , (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 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 . 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 , and absorption power , 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, , , 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).

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.

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

Functions
Cost function related to the optimal consumption profile of prosumers: appliances with higher average power, and the surplus power to be injected into the electric network of the energy company. Cost function related to the load factor of prosumers. Indexes u Index for prosumers. a Index for home appliances. Represents the type of appliance a: −1: EV; 0: appliance a with working hours greater than or equal to 1 h; and 1: appliance a with working hours less than 1 h. Binary parameter that adopts 1 for appliances with power higher than average. Otherwise, adopts 0. ℭ , Usage probability of a given appliance a in period t. ℭ , Accumulated probability related to the usage of a given appliance a in period t.