# Distributed Energy Sharing for PVT-HP Prosumers in Community Energy Internet: A Consensus Approach
## 5 Problem Formulation and Algorithm
### Design of Algorithm
\] (39) \[H_{i}(k+1)=H_{i}(k+1)-P_{i}^{hp}(k+1)COP\] (40)
4: Update electric power \(P_{i}\) according to: when \(i\in V_{G}\), \[P_{i}(k+1)=\arg\min[C_{i}(P_{i}(k))-\lambda_{i}(k+1)P_{i}(k)],P_{i}(k)\in[{P _{i}}^{min},{P_{i}}^{max}]\] (41) when \(i\in V_{CHP}\), \[P_{i}(k+1)=H_{i}(k+1)K_{CHP},P_{i}(k)\in[{P_{i}}^{min},{P_{i}}^{max}]\] (42) when \(i\in V_{P}\), \[P_{i}(k+1)=P_{i}(k+1)+P_{i}^{hp}(k+1)\] (43)
5: Update thermal power mismatch \(\xi_{i}^{H}\) according to: \[\xi_{i}^{H}(k+1)=\sum\limits_{j\in V_{t}}y_{ij}(k)\xi_{i}^{H}(k)+[(H_{i}(k+1)- H_{i}(k))|i\in V_{P}]+[(H_{i}(k)-H_{i}(k+1))|i\in V_{CHP}]\] (44)
6: Update electric power mismatch \(\xi_{i}^{E}\) according to: \[\xi_{i}^{E}(k+1)=\sum\limits_{j\in V_{e}}s_{ij}(k)\xi_{i}^{E}(k)+[(P_{i}(k+1)- P_{i}(k))|i\in V_{P}]+[(P_{i}(k)-P_{i}(k+1))|i\in V_{G}\cup V_{CHP}]\] (45)
7:If\(|\xi_{i}^{E}(k)|\leq\varepsilon_{g\xi},\forall i\in V_{e}\), \(|\lambda_{i}(k)-\lambda_{i}(k-1)|\leq\varepsilon_{\lambda_{i}E},\forall i\in V _{e}\), \(|\xi_{i}^{H}(k)|\leq\varepsilon_{g\mu},\forall i\in V_{t}\) and \(|\mu_{i}(k)-\mu_{i}(k-1)|\leq\varepsilon_{\lambda_{H}},\forall i\in V_{t}\), Output: \(\lambda_{i}(k)\), \(P_{i}(k)\), \(i\in V_{e}\), \(\mu_{i}(k)\), \(H_{i}(k)\),\(i\in V_{t}\). Break. ```

**Algorithm 2** Iteration Process

For Algorithm 1, in Initialization, the value of \(\lambda_{i}(0)\), \(P_{i}(0)\), \(\mu_{i}(0)\), \(H_{i}(0)\) and \(\xi_{i}^{H}(0)\) can be set to any valid value. Please note that the initial value of \(\xi_{i}^{E}(0)\) should be \(-PV_{i}\) when \(i\in V_{P}\) for the PV energy is preferentially self-consumed. For Algorithm 2, first, the convergence of both incremental cost (utility) and local power mismatch are guaranteed by the update rules Equations (35) and (36) which are derived from Lemma 1. Second,the thermal and electric power are calculated based on the updated \(\lambda_{i}(k+1)\), \(\mu_{i}(k+1)\) according to Equations (37)-(43). Third, each participant updates its own local power mismatch based on the updated power \(H_{i}(k+1),P_{i}(k+1)\) according to Equations (44) and (45) that come from Lemma 2. Fourth, the iteration breaks until all the \(\lambda_{i}\), \(\mu_{i}\) approach to the same value and the total power mismatch get close to 0. By choosing a small enough value for \(\rho_{e},\rho_{t}\), the iterative procedure finally converges to the global optimum. ## 6 Case Study

### Basic Data

In this paper, a CEI comprises 6 residential buildings is choosed as the study case and each building represents a PVT-HP prosumer. The parameters of utility grid, CHF and PVT-HP prosumer are listed in Table 1. All the load data are collected from the smart residential buildings of demonstration projects in Beijing [33]. The settings of the case study are consistent with these projects to make the method capable of the practical applications. The daily curves of electric, thermal load, and electric net power are shown in Figure 2 and the range of load adjustment is set between \(-20\%\) and \(+20\%\). Figure 2 shows the daily load profiles and PV energy curve of the CEI. Figure 2 is the daily electric load profiles of six prosumers, the peak loads appear at 20:00. Figure 2 is the daily thermal load profiles of six prosumers. With the change of temperature, end users need more heat at night. By equipping with PVT systems, end users utilize the solar energy to meet part of the electric load and thermal load from 8:00 to 20:00. Therefore, the electric net power has shown negative values from 12:00 to 16:00. \(\rho_{e}\), \(\rho_{t}\), \(\varepsilon_{\xi^{E}}\) and \(\varepsilon_{\lambda^{H}}\) are set as 0.000595, 0.000555, 0.01 and 0.01, respectively. ### Results of Simulation

#### 6.2.1 Convergence and Optimality of Consensus Algorithm

In this section, we apply the proposed model in the CEI and use MATLAB (2014a, The MathWorks, Inc, Natick, MA, USA) to programme for testing the convergence and optimality of Algorithm 2.