# Distributed Energy Sharing for PVT-HP Prosumers in Community Energy Internet: A Consensus Approach
## 5 Problem Formulation and Algorithm
### Design of Algorithm
The net power of each prosumer, CHP and utility grid can be seen in Figure 7. As shown in Figure 7a, the net thermal power of prosumers 4-6 are positive which means they are always a thermal consumer during the day and prosumers 1-3 can act as a thermal producer or a thermal consumer alternatively. Especially, from 10:00 to 17:00, as a thermal producer, prosumers 1-3 share their excess thermal energy to prosumers 4-6. During the time, the heat pump of each prosumer makes full use of the abundant solar energy to produce high temperature thermal energy to meet the load demand. The CHP is stopped during 9:00-17:00 to increase the economic effectiveness because the load rate is less than 30%. Moreover, Figure 7b shows the net electric power of each prosumer. From 12:00 to 16:00, there are plenty of solar energy and all the prosumers act as a electric producer to sell electric energy to utility grid. Figure 6: (**a**) Electric price and (**b**) thermal price during the daytime. By using the results of each time slot, an interesting result can be found that there are four types of role attributes for PVT-HP prosumers. That is, in one time slot, a thermal producer can be an electric consumer, and a thermal consumer can also be acted as an electric producer, which can be further shown in Figure 8. The horizontal axis represents electric net power while the vertical axis represents the thermal net power. The results show that the number of prosumer roles acted as electric producer is much less than the number of electric consumer. This is mainly due to the fact that the solar electric power is only excess during the periods 12:00-16:00 of daytime. In contrast, the roles of thermal producers and

Figure 2:0 Roles of prosumer during the day. Figure 2:1 Net power during the day. (**a**) Net thermal power; (**b**) Net electric power. consumers are distributed evenly in the vertical axis, because the capacity of heat pump is matched with the load demand. ### Analysis of Computation Time and Applications

With the development of smart grid, the user side has gradually been equipped with smart meters, building energy management system, as well as high speed Internet connections, which lay the hardware foundation of the consensus algorithm applications. Figures 3 and 4 show the Algorithm 2 can approach the optimum solution in 55 iterations. According to the designed Algorithm 2 in Section 5.3, only increment cost (utility) and local power mismatch are exchanged between participants at each iteration which is presented in Equations (35), (36), (44) and (45). Each participant broadcasts its value of last iteration while receives data from neighboring participants. Therefore, there are about 2 Bytes data broadcasted and 14 Bytes data received in one iteration for a participant, the total data exchange for the hour-ahead optimization is less than 110 Bytes (broadcasted) and 770 Bytes (received). If we use the LTE 230 MHZ VPN network for data exchange, the latency of each message is less than 3 s (average 2 s). Furthermore, we use a computer with Intel Core i5-4570 CPU 3.2 GHz (Intel, Santa Clara, CA, USA), 8G memory (Samsung Corporation, Seoul, Korea), and MATLAB 2014a as the time cost testing environment for the algorithm. The average computation time is 0.037 s for one iteration, combined with the communication latency, the maximum time cost of the hour-ahead optimization is about 2.78 min (average 1.87 min). Thus, the optimal scheduling of the CEI can be start at 5 min prior to the energy sharing. As mentioned above, the consensus algorithm is bound to be a good distributed algorithm in future energy management system. ## 7 Conclusions

In this paper, we have proposed a consensus-based energy sharing method for solving social welfare problem of the CEI. From the results of case study, we have shown that all the increment costs (utilities) convergence to a same value while the power balance is satisfied, which means that all participants achieve their own maximal profits and the social welfare maximization problem has been solved.