Distributed energy management for community microgrids considering phase balancing and peak shaving

: In this study, a distributed energy management for community microgrids considering phase balancing and peak shaving is proposed. In each iteration, the house energy management system (HEMS) installed in each house minimises its electricity costs and the costs associated with the discomfort of customers due to deviations in indoor temperature from customers’ set points. At the community level, the microgrid central controller (MCC) schedules the distributed energy resources (DERs) and energy storage


Abstract:
In this study, a distributed energy management for community microgrids considering phase balancing and peak shaving is proposed. In each iteration, the house energy management system (HEMS) installed in each house minimises its electricity costs and the costs associated with the discomfort of customers due to deviations in indoor temperature from customers' set points. At the community level, the microgrid central controller (MCC) schedules the distributed energy resources (DERs) and energy storage based on the received load profiles from customers and the forecast energy price at the point of common coupling. The MCC updates the energy price for each phase based on the amount of unbalanced power between generation and consumption. The updated energy price and unbalanced power for each phase are distributed to the HEMSs on corresponding phases. When the optimisation converges, the unbalanced power of each phase is close to zero. Meanwhile, the schedules of DERs, energy storage systems and the energy consumption of each house are determined by the MCC and HEMSs, separately. In particular, the phase balancing and peak shaving are considered in the proposed distributed energy management model. The effectiveness of the proposed distributed energy management has been demonstrated by case studies.

Nomenclature
The symbols used in this paper are defined as follows. A symbol with (k) at the upper right position stands for its value at the kth iteration. A bold symbol stands for its corresponding vector.

Introduction
A microgrid can be defined as a low-voltage power system comprising various distributed energy resources (DERs) collocated with loads. It can be operated either grid-connected or islanded from the utility grid [1]. When grid connected, a microgrid interacts with the utility distribution system through the point of common coupling (PCC). Power could be imported from or exported to the utility system under an agreement. In addition, a microgrid can provide various ancillary services such as frequency regulation and voltage support in response to the request of the utility [2,3]. Once the utility distribution network is faulted, a microgrid automatically transforms from grid-connected mode into the islanded mode and continues to serve its islanded portion without any interruptions. By integrating renewable generation, energy storage devices, flexible loads, advanced control and information and communication technology, a microgrid provides a new scheme of electricity supply with high reliability and low costs and emissions [4]. These benefits of microgrids have prompted a growing amount of research from both academia and industry [5].
In general, a microgrid central controller (MCC) performs the energy management of a microgrid in both modes. The MCC determines the output power of controllable distributed generators (DGs), charging/discharging power of energy storage devices and the imported/exported power from/to the utility system by solving an optimisation problem. The optimisation problem is usually formulated to minimise the system operating cost while satisfying various constraints related to characteristics of components and/or reliability of the electricity supply [6]. Various models for microgrid energy management in islanded mode [7][8][9] and gridconnected mode [10][11][12][13][14][15][16] have been proposed in the existing literature. In particular, Bracco et al. [10], Li and Xu [11] and Martinez Cesena et al. [12] proposed deterministic programming models that ignore the uncertainty of renewable generation, while stochastic and robust programming models that consider the uncertainty of renewable generation have been presented in [13][14][15][16].
In general, the vast majority of the proposed microgrid energy management systems in the existing literature is based on solving a centralised optimisation problem. Although these methods are straightforward and easy to implement, two problems are associated with them. First, energy consumption by consumers is mostly considered as fixed or interruptible loads in the form of direct load control (DLC). However, the customers are usually very careful while allowing a utility or an MCC to directly control their appliances -such as water heaters and heating, ventilation and airconditioning [high-voltage AC (HVAC)] systems -because of various issues such as psychological safety and privacy protection. Second, the centralised optimisation model is subject to 'the curse of dimensionality'. As the number of customers increases, the solution efficiency is reduced rapidly. To overcome these issues, distributed optimisation models based on dual decomposition are proposed in [17][18][19][20]. Since the variables of DERs and each house are only coupled by the power balance constraint, the centralised optimisation model can be decoupled into subproblem of DERs and subproblem of each house. The home energy management system (HEMS) in each house solves the corresponding subproblem to determine the schedule of house appliances, while the MCC solves the subproblem of DERs to determine the schedule of DGs and energy storage systems. During each iteration, the Lagrangian multipliers are adjusted based on the imbalance of power supply and consumption. Then, the schedule of DERs and house appliances are updated by the MCC and each HEMS, separately. The iteration repeats until the power supply and consumption are balanced, i.e. the power balance constraint is satisfied. By this method, the MCC no longer needs to control the appliances of customers directly. Similar to dual decomposition, other distributed optimisation algorithms such as the predictor corrector proximal multiplier [21] have been applied to solve the microgrid energy management problem in a distributed manner. To ensure the convergence of the dual decomposition algorithm, convexity and finiteness are assumed for all subproblems. In practise, however, the subproblems are usually non-convex owing to binary constraints (on/off of generators and HVAC systems), leading to non-convergence of the optimisation.
In this paper, a new distributed energy management for community microgrids is developed. The single-phase model in [22] is extended into a practical three-phase unbalanced model to enable the adjustment of loads and generation in specific phases. The alternating direction method of multipliers (ADMMs) algorithm is used to decompose the centralised optimisation into parallel subproblems of DERs and HEMSs [23]. The main contributions of this paper in addition to [22] are as follows: • Reducing the phase unbalance of the microgrid at the PCC to avoid mal-operation of zero-sequence protections and potentially provide phase balancing service. In particular, phasewise price signals are proposed to enable the adjustment of loads and generation in specific phases. Note that the phase balancing function is an innovative contribution to this paper. • Adding the function of peak shaving for the community microgrid controller to reduce demand charge. This function can also be used for emergency load shedding by setting the PCC power limits in specified intervals to a certain percentage of normal PCC power.
For the rest of this paper, the community microgrids and thermal dynamic model of buildings are introduced in Section 2. In Section 3, centralised optimisation-based microgrid energy management is formulated. On the basis of that, distributed energy management for microgrids is developed in Section 4. The proposed distributed energy management is demonstrated on a community microgrid in Section 5. This paper is finally concluded in Section 6.

Community microgrid
As an alternative way to increase local energy supply independence and resilience, a community microgrid is a special kind of microgrid normally serving a residential community. Various DGs and energy storage systems are installed on-site to ensure a continuous and reliable electricity supply to customers even in the face of widespread blackouts. For each house, HEMS is installed and schedules all appliances in the house based on user settings such as desired indoor temperature, and communicates with the MCC for price signals or control orders. In a centralised optimisation-based microgrid energy management system, the user settings, consumption schedule of house appliances as well as detailed house thermal dynamic model are all forwarded to the MCC by the HEMSs. On the basis of this received information, as well as the rate/price from the utility, the MCC determines the optimal schedule of DGs, energy storage and home appliances by solving a centralised optimisation that minimises the total cost of operating the community microgrid while preserving customer comfort. The optimal schedules of home appliances are sent to the corresponding HEMSs, which will control the HVAC and other appliances accordingly. An example of the community microgrid is shown in Fig. 1.
Unlike in centralised optimisation-based microgrid energy management, the HEMSs actually withhold user settings, house thermal parameters and other load information from the MCC in the proposed distributed energy management system. Specifically, the HEMS schedules the appliances in the house based on the price signal received from the MCC to minimise the electricity bill while ensuring user comfort. Meanwhile, the MCC determines the schedule of DERs at the microgrid level to optimise certain objectives. The price signal is iteratively updated based on the power unbalance between generation and load. When this iterative process converges, the HEMSs and MCC reach a consensus on the price signal and energy consumption of each house.

HVAC system
An HVAC system is usually controlled by a thermostat. In the case of cooling, for instance, the HVAC is switched on when the indoor temperature reaches the upper limit of the allowed indoor temperature range, then continues running until the lower limit is reached. Thermostats based on this automatic temperature control scheme are widely used.
In a departure from the automatic temperature control scheme described, the HEMS intelligently optimises the consumption of HVAC as well as other house appliances to reduce the electricity cost and discomfort of customers. As is known, the change of indoor temperature is a gradual process because of the thermal inertia of the house. A house could be taken as a thermal storage facility, which provides the HEMS extra flexibility in scheduling the HVAC system. Specifically, the HVAC system can be switched on to precool/preheat the house during times when electricity prices are low or renewable generation is high. Thus, the house can ride through peak-price periods without high electricity consumption and still maintain the indoor temperature within an allowable range. This method is expected to achieve significant electricity cost savings compared with autonomous temperature control [15].

Building thermal dynamic model
Intelligent control of the HVAC system requires to model the house as a thermostatically controlled load, which is related with a number of factors including thermal capacitance of indoor air, inner walls and house envelope, thermal resistance between indoor air, inner walls, house envelope and ambient air, effective window area etc. There has been extensive research on the accurate modelling of thermal dynamics of houses/buildings. In this work, a two-layer thermal insulation model is utilised to model each house. On the basis of the rules of heat transfer, the thermal dynamic characteristic of a house could be modelled as first-order differential equations in continuous time. Then, these differential equations can be further transformed into an equivalent discrete time model by using Euler discretisation (i.e. zero-order hold) with a constant sampling time [24]. In this paper, the thermal dynamic model of a house is described by the following state-space model: where is the state vector, which indicates the temperatures at different layers of the house.
is the input vector, which includes the ambient temperature, solar irradiance and the heat transferred by the HVAC system. In specific, u ϕht H = 1 corresponds to the heating mode of the HVAC system and u ϕht C = 1 corresponds to the HVAC cooling mode. The coefficients of matrices A ϕh and B ϕh of a house h on phase ϕ could be determined with the thermal parameters of the house and the time step size of the optimisation horizon. More details on the mathematical modelling and parameter estimation of the house can be found in [24]. The indoor temperature for the house h is limited in a comfortable range as in the equation below:

Centralised community microgrid energy management
In community microgrids, on-site DERs and the utility distribution feeder together supply electricity to all houses. The on-site DERs are divided into two categories: dispatchable units and nondispatchable units. The dispatchable units include various DGs (e.g. diesel generators, combined heat and power, fuel cells etc.) and energy storage systems (e.g. batteries and pump-hydro), which could be dispatched by the MCC. On the contrary, renewable generation resources (e.g. photovoltaic systems) are nondispatchable units with power output depending on weather conditions. The community microgrid imports/exports power from/to the utility through the PCC. All DGs, renewable generation resources and energy storage systems are assumed to be threephase balanced. Each house is associated with an HVAC load, and the other loads in the house are aggregated as an interruptible load, a certain percentage of which could be shed. All house loads are assumed to be single phase. All houses are distributed on an average on three phases. Under these assumptions, a centralised optimisation problem for the energy management of community microgrids is formulated. The objective is usually to minimise the operation and maintenance cost as well as the discomfort of customers due to indoor temperature deviations, as in (3). Specifically, the piecewise linear operation cost and start-up cost of DGs are represented in lines 1 and 2; the purchasing/selling cost/ benefit of the microgrid at PCC is in line 3; the degradation cost of energy storage systems is in line 4; and finally, the discomfort and inconvenience of customers caused by indoor temperature deviations and voluntary load shedding for each house are described in line 5 The reliable and efficient operation of a community microgrid is subject to various limits and constraints from DERs, customers as well as the MCC u bt C + u bt D ≤ 1, ∀b, ∀t SOC bt min ≤ SOC bt ≤ SOC bt max , ∀b, ∀t P btϕ C = P bt C /N Φ , ∀b, ∀t, ∀ϕ The power output of a DG is divided into several blocks in (4). Each block is limited by a maximum value as in constraint (5). The operating cost in each block is assumed linear. Thus, the operating cost of the DG is piecewise linear. The minimum and maximum power outputs of DGs are limited by the constraint (6). In particular, DG outputs are three-phase balanced, which is ensured by (7). For energy storage, the charging and discharging powers of an energy storage system are constrained by (8) and (9). The charging and discharging states of energy storage are mutually exclusive, a condition enforced by (10). The state of charge (SOC) of an energy storage system at the end of the current time period t is determined by the SOC at the previous time period t − 1, plus/ minus the energy charged/discharged during the current time period. This coupling relationship is described in (11). To avoid overcharging and undercharging of an energy storage system, the SOC is limited as in (12). The loss during the charging and discharging process is described with the parameters η b C and η b D . Similar to DGs, energy storage devices are phase balanced, which is ensured by the constraints of (13) and (14). For DGs and energy storage systems with unbalanced output, we could simply relax (7), (13) and (14) to make sure the sum of generated/consumed power at all phases equals the total power for each DG and energy storage system. For each house, a total load of the house h on phase ϕ at time t equals the HVAC load plus the aggregated rest loads, as in constraint (15). The heating and cooling states of an HVAC system are mutually exclusive, as is guaranteed by constraint (16). The voluntary load shedding of the house h during the time period t is limited by a certain percentage of the aggregated load specified by the customer as shown in constraint (17). Note that the thermal dynamic characteristic of a house (1) and the indoor temperature requirements (2) should be included as constraints as well.
Besides the constraints associated with each component or house, there are several system level constraints such as generation and load balance, peak load limits and maximum phase unbalances at the PCC. The generation and load balance on each phase are guaranteed by (18). In particular, wind and photovoltaic (PV) systems could be balanced three-phase or single-phase sources. The peak load seen by the utility at PCC is limited, as in (19), which could be requested by the utility or required by the MCC to reduce the demand charge. Note that the peak shaving in this paper is realised by real-time pricing. Other methods such as demand charge [25] will be investigated in future work. To avoid maloperation of zero-sequence protections, the maximum phase unbalance at the PCC is constrained by (20). Note that the phase coupling has been ignored for two reasons. First, the feeders in community microgrids are mostly single-phase laterals. Second, these feeders are usually short because of the limited capacity and low-voltage level of microgrids It should be noted that the centralised optimisation is mixed-integer linear programming (MILP), except the two logic terms in the objective function (3), which could be easily formulated in linear or MIL form by introducing auxiliary variables. In specific, by introducing a binary variable, the start-up cost of DG (in line 2) could be represented in MIL form [26]. As to the absolute value of the indoor temperature deviation (in line 5), it could be substituted by an auxiliary variable X ϕht with constraints (21)- (23). In general, this centralised optimisation problem could be solved by various commercial MILP solvers X ϕht ≥ 0, ∀ϕ, ∀h, ∀t More complicated phase-coupled internal models of DGs and energy storage systems need to be considered if their outputs are unbalanced or reactive power is considered. Under this situation, piecewise linearisation techniques could be used to formulate these non-linear models into special-ordered-sets-of-type 2 constraints IET Gener. Transm. Distrib., 2019, Vol. 13 Iss. 9, pp. 1612-1620 © The Institution of Engineering and Technology 2019 [27]. As a result, the dimension of the problem, especially the number of binary variables, will increase significantly. Nevertheless, the optimisation model is still MILP.

Distributed community microgrid energy management
The centralised community microgrid energy management presented in Section 3 is straightforward and easy to solve. However, this model is subject to dimensional and privacy issues in practical implementation, since the HVAC systems and voluntary load shedding are directly controlled by the MCC. First of all, the dimension of the optimisation problem rises rapidly with the growth of customer scale, which compromises the solution efficiency. As a result, more computing resources are required by the MCC. Besides, the MCC requires access to the thermal dynamic models and detailed load information for all houses, whereas customers generally prefer to conceal all information behind the metres and control their home appliances by themselves. Therefore, our objective is to break down the centralised optimisation and obtain a distributed, scalable, privacypreserving microgrid energy management.
In this section, we propose a distributed algorithm to solve the centralised optimisation model (1)-(23) using ADMM [23]. The centralised optimisation model has a separable structure since the only constraint (18) is a complicating constraint involving variables from both the microgrid level and the house level. Therefore, we use ADMM to decompose the centralised optimisation model into optimisation subproblems at the microgrid and house levels. The subproblems are solved by the MCC and the HEMSs separately, and the solutions are coordinated by an iterative process Initially set at k ← 0, the HEMSs schedule their appliances randomly and communicate them to the MCC. In the meantime, the MCC sets initial price curves for each phase and schedules the microgrid-level resources randomly. At the beginning of each iteration, the MCC updates the unbalanced power of each phase according to (24) and communicates the prime residual R ϕt (k) and price signal λ ϕt (k) to the corresponding HEMSs connected to each phase. Then the following process occurs.
i. Each HEMS solves the HEMS subproblem as follows: s.t.

(4) − (14) and (19) − (20)
At the end of each iteration, the HEMSs communicate their updated schedules P ϕht (k) and P ϕht LS, (k) to the MCC, then the MCC updates the prime residual R ϕt (k + 1) and price signal λ ϕt (k + 1) according to (24) and (27). This iterative process is repeated until convergence occurs. In this distributed optimisation scheme, prices are iteratively negotiated between customers and generators (including DGs, energy storage and utility). Therefore, this approach has the advantage of being self-contained in the sense that it does not need other price constraints because price procurement is based on an iterative negotiation process A complete description of the proposed distributed energy management system can be found in Algorithm 1 (see Fig. 2). Compared to the traditional dual decomposition algorithm, ADMM adds an augmented Lagrangian term with a penalty factor ρ > 0. This augmented Lagrangian term is introduced in part to bring robustness to the dual decomposition algorithm, and particularly to yield convergence when assumptions of strict convexity and finiteness of (3) are no longer valid. In other words, ADMM improves the classic dual decomposition algorithm with the superior convergence properties of augmented Lagrangian methods. Note that ADMM cannot guarantee a global optimum such as other non-convex optimisation algorithms. The convergence of ADMM for the non-convex problem has not been proved mathematically. In practise, the solution might oscillate around an optimum because of the non-convexity of the integer variables. In this situation, a suboptimal solution can still be obtained for practical use by increasing the penalty factor ρ or relaxing the converge criterion R max . Nevertheless, it is often the case that ADMM converges to modest accuracy within a few tens of iterations [23]. In this distributed energy management system, the power unbalances and price signals of each phase are broadcasted to the corresponding HEMSs through the advanced metering infrastructures. For each house, the HEMS subproblem (25) is solved, then the total consumption P ϕht (k) and voluntary load 1616 IET Gener. Transm. Distrib., 2019, Vol. 13 Iss. 9, pp. 1612-1620 © The Institution of Engineering and Technology 2019 shedding P ϕht LS, (k) are communicated to the MCC. In this way, customers have absolute control over their HVAC systems and other appliances behind the metre. In addition, the schedules of individual appliances and customer preferences are concealed from the MCC. Therefore, the privacy of customers is preserved. Fig. 3 illustrates the information exchange between the MCC and HEMSs.

Case studies
The proposed distributed energy management was tested using an Oak Ridge National Laboratory microgrid test system as shown in Fig. 4. All DGs, PVs and batteries are assumed to have threephase-balanced output/input. Their parameters can be found in [16]. The community microgrid supplies electricity to 20 houses. A 5 kW HVAC system is installed in each house. The coefficients of performance of all HVAC systems are set as η h = 3. For simplicity, the desired room temperatures of all houses during the whole scheduling horizon are set at 23°C. To avoid excessively rapid cycling of the HVAC systems, the indoor temperature is allowed to deviate ±2°C from the set point. The temperature deviations lead to discomfort of customers, which is penalised at $0.05/°C. The maximum voluntary load shedding is limited as 50% of the non-HVAC load in each house, with the price of lost load set as the PCC price doubled. The thermal dynamic models of the houses are taken from [24] (Table 7.1 in [24]). Small random errors are introduced to represent the diversity of houses. The ambient temperature and solar irradiance are the measured data of the Oak Ridge, Tennessee, area on 1 August 2015 [28], which is a typical summer day in the southern states of the USA.
The forecast non-HVAC load of house #1 and the electricity price at the PCC are shown in Fig. 5. All houses are assumed to have the same non-HVAC loads. The penalty parameter ρ is set as 0.1. The initial price is set as 0.1 $/kWh for all time intervals. The simulation is conducted in a day (24 h) with 15 min time resolution. Noted that the forecasts of load and renewable resources are subject to errors, which usually increase rapidly as the forecast horizon increases. To handle the uncertainty of forecasts, model predictive control (MPC) has been used in power system balancing models considering uncertain forecasts [29]. For example, if the load and renewable forecasts are updated every hour, the optimisation should be run every hour, but only schedules of the first hour will be implemented into the system and the rest will be discarded. The parameters of MPC, in this case, are summarised in Table 1. In this work, the forecast errors for load and renewable resources have been neglected in the simulation since the MPC approach does not change the proposed optimisation model and solution algorithm, but repeatedly run the optimisation with the most recent forecast data.
All problems are solved using the commercial MILP solver CPLEX 12.6. With a pre-specified duality gap of 0.5%, the solution time of centralised optimisation is about 15 min on a 2.66 GHz Windows-based personal computer with 4 GB of random access memory. For the distributed optimisation, the solution time of each subproblem is <10 s using the same computer. Since all subproblems are solved in parallel, the total solution time distributed optimisation is around 3 min.

Comparing costs of different cases
The total operating costs of the community microgrid in various cases are compared in this section. The test cases include autonomous thermostatic control (without considering building thermal dynamics in the optimisation), base case (considering building thermal dynamics in the optimisation), the base case with phase balancing constraints, the base case with peak shaving constraints, and finally, the base case with both phase balancing and peak shaving constraints. In the case of autonomous thermostat control, (1) is solved first, then the thermostats determine the on/off state of the HVAC system based on the internal temperature controlled relay circuit. Given the HVAC states, we solve the centralised optimisation and obtain the total operating cost as in (3).
The costs are compared in Table 2. First, compared to autonomous thermostat control, the total operating cost of the base case is reduced by 26.11% by integrating building thermal dynamics in the optimisation. The cost savings are significant for community microgrids, in which HVAC systems dominate the load. Second, compared to the base case, adding the phase balancing and/or peak shaving constraints to the base case has very little effect on the total operating cost. Note that the base case could be considered as our previous work in [22]. In other words, the functions of phase balancing and peak shaving are realised in this paper with very little additional cost compared with [22]. This also indicates that HVAC energy consumption can easily be shifted for phase balancing and peak shaving without obvious effects on system operating cost and customer discomfort. Third, as mentioned earlier, ADMM converges to a local optimum. However, comparing the difference between the costs of centralised optimisation and of distributed optimisation, the proposed distributed algorithm has almost the same performance as centralised optimisation; i.e. the solution is very close to the global optimum.
The calculated indoor temperature and HVAC status of house #1, in the cases of an autonomous thermostat control and the base case, are compared in Fig. 6. Comparing Fig. 6a with Figs. 6b and c, it clearly shows, in the base case (considering building thermal dynamics in the optimisation), the HVAC cooling is switched on around 9 AM when the indoor temperature is perfect 23°C, i.e. the set point. Thus, the house is precooled during low price periods to avoid or reduce the consumption of HVAC during peak-price periods (1-2 PM and 7-8 PM), so that the electricity bill of the customer is reduced. Since the PCC can be seen as the marginal unit, in this case, the price for house #1 converges to the PCC price, as shown in Fig. 6c.

Distributed energy management with constraints of phase balancing or/and peak shaving
The maximum phase unbalances and total power at the PCC in the different cases solved by the proposed distributed energy management method are compared in Fig. 7. For the phase balancing constraint, the maximum difference in power between any two phases for all time intervals is limited to <20 kW. For the peak shaving constraint, the peak demand at the PCC is limited to <50 kW. As can be seen in Fig. 7a, the maximum phase unbalance is reduced to <20 kW for the cases with the phase balancing constraint. Similarly, the total power at the PCC is reduced to be <50 kW for the cases with peak shaving constraint, as can be seen in Fig. 7b. When both constraints are considered, the maximum phase unbalances and total power at the PCC are reduced to the corresponding limits simultaneously. It should be noted that unwanted demand spikes occur during the periods of 3-4 AM and 10-11 PM. The reason is that the energy price at the PCC is very low during these hours, which causes the shutdown of all DGs.
It should be noted that the peak shaving function can also be used for emergency load shedding. For example, if the community  microgrid is requested by the utility to reduce its imported power at PCC by 50% in the next 15 min. The MCC can simply reset the PCC power limit in the next time interval to 50% of the power imported in a normal situation.

Convergence of the proposed distributed energy management
For the case with both phase balancing and peal shaving constraints, the converged price signals for all three phases and the utility rate at the PCC are compared in Fig. 8. As can be seen, the price curves for all three phases generally follow the utility rate at the PCC, except for three periods (9-10 AM, 3-4 PM and 9-10 PM). In the periods 9-10 AM and 3-4 PM, the prices in phase C are extremely high. This is because the load in phase C is much higher than in phases A and B (see Fig. 7a). Thus, high price signals are generated to reduce the energy consumption of houses connected to phase C during these periods. Like congestion pricing in transmission level wholesale market, the synchronised consumption on phase C causes an unbalanced issue in this case. As a result, a penalty price is generated to solve this issue. Similarly, during the period 9-10 PM, the price signals for all three phases are higher than the utility rate at the PCC. This is because the total load at the PCC exceeds the peak demand limits (see Fig. 7b). As a result, high price signals are generated to reduce the energy consumption of houses on all three phases during this period.
For the case with both phase balancing and peak shaving constraints, the load curtailments on all three phases over the scheduling horizon are shown in Fig. 9. As can be seen, during the periods of 9-10 AM and 3-4 PM, only loads on phase C are curtailed for phase balancing. However, during the period 9-10 PM, the loads on all three phases are curtailed for peak shaving.
Although there are several convergence criterions for the ADMM algorithm (e.g. prime residual convergence, objective convergence and dual variable convergence), a reasonable convergence criterion for the proposed distributed energy management for community microgrids is that the primal residual R ϕt must be very small, i.e. the total generation equals the total consumption for each phase. The satisfaction of this criterion means the MCC and customers (both DERs and consumers) reach an agreement on the price and the amount of electricity generation/ consumption. The primal residual could be calculated according to (24), and the stopping criterion used in the simulation is R ϕt ≤ 0.5. The primal residual of three phases as a function of the iteration number is shown in Fig. 10. For each iteration, the primal residuals of all time intervals are included and shown in chronological order. As can be seen, the proposed distributed optimisation converges after eight iterations. ADMM can be very slow to converge at high accuracy. However, it usually can produce acceptable results for practical use within a few tens of iterations.

Conclusions
In this paper, a distributed energy management model for community microgrids considering phase balancing and peak shaving is proposed. Given the price signals and unbalanced power between generation and demand received from the MCC, the HEMS in each house optimises its electricity cost and the customer's comfort, considering the thermal dynamic model of the house. Then, the MCC optimises the output of DERs and energy storage at the microgrid level, updates the price signals and unbalanced power and then communicates them to the houses