*3.2. Power Supply Equipment Model*

#### 3.2.1. Microgas Turbine (MT) Model

MT is an important CHP equipment in community CHP system, and its model is as follows:

$$\begin{cases} \begin{aligned} P\_{MT}^t &= V\_{MT}^t \cdot H\_{\eta g} \cdot \eta\_{MT} \\ Q\_{MT}^t &= V\_{MT}^t \cdot H\_{\eta g} \cdot (1 - \eta\_{MT} - \eta\_{loss}) \end{aligned} \tag{12}$$

where *P t MT* is the MT output power at time *t*; *V t MT* is the MT gas consumption at time *t*; *Hng* is the calorific value of natural gas; *ηMT* is the MT power generation efficiency; *Q<sup>t</sup> MT* is the MT output heat power at time *t*; *ηloss* is the MT power loss efficiency.

#### 3.2.2. Gas Boiler (GB) Model

GB burns natural gas to provide heat for community users and can be modeled as:

$$Q\_{GB}^t = V\_{GB}^t \cdot H\_{\text{reg}} \cdot \eta\_{GB} \tag{13}$$

where *Q<sup>t</sup> GB* is the GB output heat power at time *t*; *V t GB* is the GB gas consumption at time *t*; *ηGB* is the GB heat production efficiency.

#### 3.2.3. Waste Heat Recovery (WHR) Device Model

WHR can recover the flue gas waste heat after MT power generation to improve the energy utilization efficiency, and can be modeled as:

$$Q\_{WHR}^t = Q\_{WH}^t \cdot \eta\_{WHR} \tag{14}$$

where *Q<sup>t</sup> WHR* is the WHR recovered heat power at time *<sup>t</sup>*; *<sup>Q</sup><sup>t</sup> WH* is the MT waste heat at time *t*; *ηWHR* is the WHR heat recovery efficiency.

#### 3.2.4. Heat Exchanger (HE) Model

HE can convert the heat of hot stream into hot water to provide heating for community end users, and is modeled as:

$$\mathbf{Q}\_{HE}^{t} = \mathbf{Q}\_{HE,in}^{t} \cdot \eta\_{HE} \tag{15}$$

where *Q<sup>t</sup> HE*/*Q<sup>t</sup> HE*,*in* is the HE heat power output/input at time *t*; *ηHE* is the HE heat exchange efficiency.

#### *3.3. Energy Storage Equipment Model*

#### 3.3.1. Battery (BT) Model

The charging and discharging of BT can greatly improve the utilization rate of the response load on the user side, and the model of BT is:

$$\mathcal{W}\_{\rm BT}^{t} = \mathcal{W}\_{\rm BT}^{t-\Delta t} \cdot (1 - \eta\_{\rm BT,loss}) \; + \; \left( P\_{\rm BT,ch}^{t} \cdot \eta\_{\rm BT,ch} - \frac{P\_{\rm BT,dis}^{t}}{\eta\_{\rm BT,dis}} \right) \cdot \Delta t \tag{16}$$

where *W<sup>t</sup> BT* represents the stored energy in BT; *ηBT*,*loss* is the power loss rate of BT; *P t BT*,*ch* and *P t BT*,*dis* are the charging and discharging power of BT, respectively; *ηBT*,*ch* and *ηBT*,*dis* are the charging and discharging efficiency of BT, respectively.

#### 3.3.2. Thermal Storage Tank (TST) Model

When the output thermoelectric power ratio of MT does not match the thermoelectric load ratio of community users, TST can compensate for the difference of thermoelectric ratio through heat storage and release behavior, and improve the utilization efficiency of user-side response heat load. TST can be modeled as:

$$\mathcal{W}\_{TST}^{t} = \mathcal{W}\_{TST}^{t-\Delta t} \cdot (1 - \eta\_{TST, \text{loss}}) + \left( Q\_{TST, \text{ch}}^{t} \cdot \eta\_{TST, \text{ch}} - \frac{Q\_{TST, \text{dis}}^{t}}{\eta\_{TST, \text{dis}}} \right) \cdot \Delta t \tag{17}$$

where *W<sup>t</sup> TST* is the amount of heat stored in TST at time *t*; *ηTST*,*loss* is the energy loss rate of TST; *Q<sup>t</sup> TST*,*ch* is the heat storage power of TST; *<sup>η</sup>TST*,*ch* is the heat storage efficiency; *<sup>Q</sup><sup>t</sup> TST*,*dis* is the heat release power; *ηTST*,*dis* is the heat release efficiency.

#### **4. Community CHP System Model Based on UDDSR**

In this paper, the community CHP system consists of MT, GB, WHR, HE, PV, BT and TST, and its structure diagram is shown in Figure 2.

where *Wt* 

where *Wt* 

TST; *Qt* 

TST; *Qt* 

( ) η

( ) η

1

1

the heat release power; *ηTST,dis* is the heat release efficiency.

the heat release power; *ηTST,dis* is the heat release efficiency.

*Energies* **2021**, *14*, x FOR PEER REVIEW 7 of 24

**4. Community CHP System Model Based on UDDSR** 

**4. Community CHP System Model Based on UDDSR** 

TST, and its structure diagram is shown in Figure 2.

TST, and its structure diagram is shown in Figure 2.

 η

 η

*<sup>Q</sup> WW Q t* (17)

*<sup>Q</sup> WW Q t* (17)

−Δ = ⋅ − + ⋅ − ⋅Δ

−Δ = ⋅ − + ⋅ − ⋅Δ

, ,,

*t tt t TST dis TST TST TST loss TST ch TST ch*

*t tt t TST dis TST TST TST loss TST ch TST ch*

*TST,ch* is the heat storage power of TST; *ηTST,ch* is the heat storage efficiency; *Qt* 

*TST,ch* is the heat storage power of TST; *ηTST,ch* is the heat storage efficiency; *Qt* 

In this paper, the community CHP system consists of MT, GB, WHR, HE, PV, BT and

In this paper, the community CHP system consists of MT, GB, WHR, HE, PV, BT and

, ,,

*TST* is the amount of heat stored in TST at time *t*; *ηTST,loss* is the energy loss rate of

*TST* is the amount of heat stored in TST at time *t*; *ηTST,loss* is the energy loss rate of

η

η

*t*

*t*

,

,

,

*TST,dis* is

*TST,dis* is

*TST dis*

,

*TST dis*

**Figure 2.** Community CHP system structure diagram based on UDDSR. **Figure 2.** Community CHP system structure diagram based on UDDSR. **Figure 2.** Community CHP system structure diagram based on UDDSR.

Then, an energy hub model based on the bus bar form [21] is adopted to model the community CHP system. The bus bar structure of the community system is shown in Figure 3, and the flow relations of electricity, gas and heat energy are marked by arrows. Then, an energy hub model based on the bus bar form [21] is adopted to model the community CHP system. The bus bar structure of the community system is shown in Figure 3, and the flow relations of electricity, gas and heat energy are marked by arrows. Then, an energy hub model based on the bus bar form [21] is adopted to model the community CHP system. The bus bar structure of the community system is shown in Figure 3, and the flow relations of electricity, gas and heat energy are marked by arrows.

**Figure 3.** Community CHP system bus bar structure diagram based on UDDSR. **Figure 3. Figure 3.** Community CHP system bus bar structure diagram based on UDDSR. Community CHP system bus bar structure diagram based on UDDSR.

#### *4.1. Day-Ahead Energy Optimization Model*

In the community system studied in this paper, by participating in the UDDSR response arranged by CEMS, users can submit the day-ahead IDR bid of load response that fully meets their own comfort, and respond to the IDR request issued by the power grid operator or dispatching department the next day according to the planned capacity of IDR bid. For users, they can reduce or transfer unnecessary loads during the IDR event, and at the same time receive the subsidy of IDR response from the grid operator. For the entire community energy system, CEMS can schedule the user loads to the greatest extent according to the IDR bid plan of users, and thus achieve "peak clipping and valley filling" in energy use. Meanwhile, on the basis of ensuring the stability of the system operation, the overall operation cost of the system can also be reduced, and the economy of the system operation can be improved.

The goal of system optimization is to minimize the total cost of system operation and the temperature change caused by the thermal load response adjustment within the

allowable range of users, so as to ensure their satisfaction with energy use as much as possible. This can be described as the objective function below:

$$\min \left\{ \mathbf{C}\_{total} + \sum\_{t=1}^{N} \delta^t \cdot \left( T\_{in}^t - T\_{ref} \right)^2 \right\} \tag{18}$$

where *Ctotal* is the total cost of system operation; *Tref* is the national standard indoor optimum temperature; *δ<sup>t</sup>* is a time-varying parameter that measure the thermal comfort of users, and during the UDDSR event, *δ<sup>t</sup>* is relaxed to achieve the purpose of temperature regulation and consumption reduction, while in other moments *δ<sup>t</sup>* plays the role of making the indoor temperature close to the optimal temperature; *N* is the optimal scheduling cycle.

The total cost of system operation is calculated by the following function:

$$\mathbf{C}\_{total} = \mathbf{C}\_{grid} + \mathbf{C}\_{ng} + \mathbf{C}\_{om} + \mathbf{C}\_{UDDSR} \tag{19}$$

where *Cgrid* is the cost of electricity purchasing from the grid; *Cng* is the cost of natural gas; *Com* is the cost of equipment operation and maintenance; *CUDDSR* is the total subsidy for UDDSR participation given to users by the operator.

*Cgrid* and *Cng* can be calculated as:

$$\mathbb{C}\_{grid} = \sum\_{t=1}^{N} \mathbf{e}\_{P}^{t} \cdot \mathbf{P}\_{grid}^{t} \tag{20}$$

$$\mathcal{C}\_{\text{ug}} = \sum\_{t=1}^{N} e\_{\text{gas}} \cdot \left( V\_{MT}^{t} + V\_{GB}^{t} \right) \tag{21}$$

where *P t grid* is the power purchased from the grid; *e t p* is the market price; *egas* is the price of natural gas.

*Com* can be calculated as:

$$\mathbf{C}\_{om} = \sum\_{t=1}^{N} \left( \mathbf{C}\_{om,MT} \cdot \mathbf{P}\_{MT}^{t} + \mathbf{C}\_{om,GB} \cdot \mathbf{Q}\_{GB}^{t} + \mathbf{C}\_{om,PV} \cdot \mathbf{P}\_{PV}^{t} \right) \tag{22}$$

where *Com*,*MT*, *Com*,*GB* and *Com*,*PV* are the unit power operation and maintenance costs of MT, GB, and PV, respectively.

*CUDDSR* can be calculated as:

$$\mathbb{C}\_{\text{UDDSR}} = \mathbb{C}\_{\mu} + \mathbb{C}\_{\text{es}} \tag{23}$$

$$\mathcal{C}\_{u} = \sum\_{t=1}^{N} e\_{DRE}^{t} \cdot \left( L\_{DRE, \text{int}}^{t} + \left| L\_{DRE, shf}^{t} \right| \right) + \left. e\_{DRH}^{t} \cdot L\_{DRH}^{t} \right. \tag{24}$$

$$\mathbf{C}\_{\text{es}} = \sum\_{t=1}^{N} e\_{\text{BT}} \cdot (\mathbf{P}\_{\text{BT},\text{ch}}^{t} - \mathbf{P}\_{\text{BT},\text{dis}}^{t}) + e\_{\text{TST}} \cdot (\mathbf{Q}\_{\text{TST},\text{ch}}^{t} - \mathbf{Q}\_{\text{TST},\text{dis}}^{t}) \tag{25}$$

$$L\_{DRH}^{\text{f}} = \frac{1}{R} \cdot \frac{\Delta T^{\text{t}}}{1 - e^{-\frac{\Delta t}{R \cdot C\_{\text{air}}}}} \tag{26}$$

$$
\Delta T^t = \max \{ T^t\_{im0} - T^t\_{im'} 0 \} \tag{27}
$$

where *C<sup>u</sup>* is the load response subsidy for users; *Ces* is the energy storage subsidy; *e t DRE* is electric load response compensation per unit power; *e t DRH* is the thermal load response compensation per unit power; *L t DRH* is the change of thermal power caused by lowering the room temperature ∆*T <sup>t</sup>* within the range allowed by users at time *t*; *T t in*0 is the indoor temperature before UDDSR event; *eBT* is the unit power subsidy for the charging and discharging behavior of BT; *eTST* is the unit power subsidy for heat storage and release behavior of TST.

The operation constraints are described as follows.

1. Energy balancing constraints

$$P\_{grid}^t + P\_{MT}^t + P\_{PV}^t - P\_{BT, \text{dis}}^t = L\_{AE}^t - L\_{DRE, \text{int}}^t - L\_{DRE, \text{shf}}^t + P\_{BT, \text{ch}}^t \tag{28}$$

$$(Q\_{GB}^t + Q\_{MT}^t \cdot \eta\_{WHR}) \cdot \eta\_{HE} - Q\_{TST,dis}^t = L\_{AH}^t + L\_{AC}^t + Q\_{TST,ch}^t \tag{29}$$

where *L t AE* and *L t AH* are the basic electrical load and basic hot water load at time *t* after load aggregation, which cannot be scheduled during the UDDSR event.

2. Energy supply constraints

$$P\_{grid}^t \le P\_{grid\text{max}}\tag{30}$$

$$P\_{MT\text{min}} \le P\_{MT}^t \le P\_{MT\text{max}}\tag{31}$$

$$0 \le Q\_{GB}^t \le Q\_{GB\text{max}}\tag{32}$$

where *Pgrid*max is the maximum interactive power between the community system and the power grid per unit time; *PMT*max and *PMT*min are the maximum and minimum generating power of MT; *QGB*max is the maximum heating power of GB.

#### 3. Energy storage constraints

For BT, the constraints are:

$$0 \le P\_{\text{BT},\text{cl}}^t \cdot S\_{\text{BT},\text{cl}}^t \le P\_{\text{BT},\text{cl}\text{max}}\tag{33}$$

$$P\_{BT, \text{dismax}} \le P\_{BT, \text{dis}}^t \cdot \mathbf{S}\_{BT, \text{dis}}^t \le \mathbf{0} \tag{34}$$

$$\rm S\_{BT,cl}^t + S\_{BT,dis}^t \le 1 \tag{35}$$

$$\mathcal{W}\_{\text{BTmin}} \le \mathcal{W}\_{\text{BT}}^t \le \mathcal{W}\_{\text{BTmax}} \tag{36}$$

where *S t BT*,*ch* and *S t BT*,*dis* are 0–1 variables representing the charging and discharging state of BT; *PBT*,*ch*max and *PBT*,*dis*max are the maximum charging and discharging power of BT; *WBT*max and *WBT*min are the maximum and minimum energy storage capacity of BT.

For TST, the constraints are:

$$0 \le \mathbf{Q}\_{TST,\acute{c}\mathbf{h}}^t \cdot \mathbf{S}\_{TST,\acute{c}\mathbf{h}}^t \le \mathbf{Q}\_{TST,\acute{c}\mathbf{l}\max} \tag{37}$$

$$Q\_{TST, \text{dismax}} \le Q\_{TST, \text{dis}}^t \cdot \mathbf{S}\_{TST, \text{dis}}^t \le \mathbf{0} \tag{38}$$

$$\mathbf{S}\_{TST,ch}^{t} + \mathbf{S}\_{TST,dis}^{t} \le 1 \tag{39}$$

$$\mathcal{W}\_{\text{TSTmin}} \le \mathcal{W}\_{\text{TST}}^t \le \mathcal{W}\_{\text{TSTmax}} \tag{40}$$

where *S t TST*,*ch* and *S t TST*,*dis* are 0–1 variables representing the heat storing and releasing state of TST; *PTST*,*ch*max and *PTST*,*dis*max are the maximum heat storing and releasing power of TST; *WTST*max and *WTST*min are the maximum and minimum heat storage capacity of TST.

#### *4.2. CVaR-Based Energy Optimization Model*

The day-ahead energy optimization model mentioned in the above section is based on the accurate prediction of the basic electric and heat loads, PV output, and outdoor temperature. It ignores the error between the predicted value and actual value, and assumes that users will maximize the UDDSR response according to the response load capacity of the IDR bid. However, actually, the prediction error may have a significant impact on the optimization results, and users may not respond according to the maximum capacity after UDDSR bid, which must be taken into consideration. In order to solve the above questions, CVaR is applied.

#### 4.2.1. CVaR Model

CVaR theory was firstly used to solve the optimal portfolio problem of investment risk related to financial hedging. It is mainly used to measure the investment loss when the investment loss exceeds the expected maximum loss (i.e., Value-at-Risk (VaR)) under a given confidence level. The CVaR model is shown as follows.

$$\text{CVaR}\_{\text{con}} = E[f(X, \gamma) | f(X, \gamma) \, > \, VaR\_{\text{con}}] \tag{41}$$

where *CVaRcon* is the average excess loss under a given confidence level; *con* is the confidence level; *f*(*X*, *γ*) is the loss function; *X* is the investment portfolio; *γ* is the risk variable; *VaRcon* is the expected maximum loss under the *con*; *E*[.] expresses the expect function.

If the probability of *γ* in different scenarios is known, the formulation of discrete CVaR can be expressed as follows.

$$\text{CVaR}\_{\text{con}} = VaR\_{\text{con}} + \frac{1}{1 - con} \sum\_{t=1}^{N} p\_{\gamma}^{t} \max\{f(\mathbf{X}, \gamma) \, - \, VaR\_{\text{con}}, 0\} \tag{42}$$

where *p t γ* is the probability of *γ* occurring at time *t*; *N* is the number of discrete time intervals.

However, (42) needs to obtain VaR at the same confidence level first, which complicates the computing process. To increase the computing speed, the relaxation method in [22] is applied to solve CVaR and VaR simultaneously. The relaxed CVaR discrete function is converted into a common optimization problem, and its calculation formula is expressed as follows.

$$\min g(\mathbf{X}, \boldsymbol{\alpha}) \ = \mathbf{a} + \frac{1}{1 - \text{con}\, \sum\_{t=1}^{N} p\_{\gamma}^{t} \max\{f(\mathbf{X}, \gamma) \ - \ \mathbf{a}, \mathbf{0}\} \tag{43}$$

where *CVaRcon* is the minimum value of *g*(*X*, *α*); *α* is the intermediate variable after relaxation of VaR, and when *g*(*X*, *α*) goes to the minimum, *α* is equal to *VaRcon*.

#### 4.2.2. Day-Ahead Energy Optimization Model Based on CVaR

In the community CHP system, the uncertainties include the prediction errors of electric and heat load, PV output and outdoor temperature, and the response load fluctuation of UDDSR. In this section, the random simulation algorithm is used to generate a set of uncertinty scenarios. It is assumed that the probability distribution of forecast errors and load response fluctuation obeys the normal distribution with the mean value being the forecast, i.e., *γ*~*N*(*rforecast*, *σ* 2 ), and the probability distribution formula is:

$$h(r) \;= \frac{1}{\sqrt{2\pi}\sigma} \cdot e^{\frac{-\left(r - r\_{\text{forecast}}\right)^2}{2r^2}}\tag{44}$$

where *r* is the uncertainty variable; *σ* is the standard deviation of *r*; *rforecast* is the forecast value of *r*.

According to (43), the day-ahead energy optimization model based on CVaR is formulated as follows.

$$\text{CVaR}\_{con} = \text{min}a + \frac{1}{M(1 - con)}\sum\_{i=1}^{M} \phi\_i \tag{45}$$

$$\begin{cases} \ \phi\_i \ge \mathbb{C}\_{total,i} - \mathrm{E}[\mathbb{C}\_{total,i}] \ - \ \mathcal{A} \\\ \phi\_i \ge 0(i = 1, 2, \dots, M) \end{cases} \tag{46}$$

where *Ctotal,i* is the total cost of system operation in scenario *i*; E[*Ctotal,i*] is the expected cost of system operation in all simulated uncertainty scenarios; *φ<sup>i</sup>* is the middle variable in scenario *i*; *M* is the total number of uncertainty scenarios.

Then, after considering the uncertainties of forecast error and response fluctuation, the total cost of system operation can be converted into:

$$\mathcal{C}\_{total} = \mathcal{C}\_{grid} + \mathcal{C}\_{ng} + \mathcal{C}\_{om} + \mathcal{C}\_{LEDSR} - \mathcal{C}\_{pumpish} \tag{47}$$

$$\begin{cases} \begin{array}{c} \mathcal{C}\_{punish} = \sum\_{t=1}^{N} \mathcal{e}\_{punish}^{t} \cdot \left| L\_{DRE}^{t} - L\_{DRE0}^{t} \right|\\\ L\_{DRE}^{t} = L\_{DRE, \text{int}}^{t} + L\_{DRE, slf}^{t} \end{array} \end{cases} \tag{48}$$

where *Cpunish* is the penalty fee when users do not respond according to the response load optimized by day-ahead UDDSR; *L t DRE* is the total actual response load; *L t DRE*0 is the response load optimized by day-ahead UDDSR.

Additionally, according to (18), the objective function can be converted into

$$\min \left\{ E[\mathbb{C}\_{total,i}] \; + \; \beta \cdot \text{CVaR}\_{con} + \frac{1}{M} \cdot \sum\_{i=1}^{M} \sum\_{t=1}^{N} \delta^{t} \cdot \left( T\_{in,i}^{t} - T\_{ref} \right)^{2} \right\} \tag{49}$$

where *β* is the uncertainty factor, i.e., the willingness of the community system to take risks, and *β* Є[0,1].

Meanwhile, the purpose of the energy optimization based on CVaR is to meet the operating conditions in all uncertainty scenarios, thus the bus balancing constraints can be converted into:

$$P\_{grid}^t + P\_{MT}^t + P\_{PV,i}^t - P\_{BT,dis}^t \ge L\_{AE,i}^t - L\_{DRE,int,i}^t - L\_{DRE,shf,i}^t + P\_{BT,ch}^t \tag{50}$$

$$\left(Q\_{GB}^t + Q\_{MT}^t \cdot \eta\_{WHR}\right) \cdot \eta\_{HE} - Q\_{TST, \text{dis}}^t \ge L\_{AH,i}^t + L\_{AC,i}^t + Q\_{TST, \text{ch}}^t \tag{51}$$

#### **5. Case Study**

analyzed.

The proposed model is conducted on a community IES modified from a central neighborhood in Anhui province in China. The community structure diagram is presented in Figure 2. The forecast curves of electricity load, hot water load, PV output and outdoor temperature of the system on a typical winter day is shown in Figure 4. In the appendix, the peak-valley time-of-use electricity price, the subsidy for users participating in UDDSR and the gas price are shown in Table A1, the equipment operating parameters are shown in Table A2, and the equipment cost and subsidy parameters are shown in Table A3, which are all modified from [23]. The cases were compiled with Python 3.7, and solved by Gurobi solver. *Energies* **2021**, *14*, x FOR PEER REVIEW 12 of 24 are shown in Table A2, and the equipment cost and subsidy parameters are shown in Table A3, which are all modified from [23]. The cases were compiled with Python 3.7, and solved by Gurobi solver.

**Figure 4.** The forecast curves of electric load, hot water load, PV output and outdoor temperature of the system on a typical winter day. **Figure 4.** The forecast curves of electric load, hot water load, PV output and outdoor temperature of the system on a typical winter day.

When users do not participate in the UDDSR response, the community CHP optimizes energy consumption according to the prediction values of electric and heat loads, PV outputs, and outdoor temperature. The optimization results of equipment outputs are shown in Figure 5. It can be seen that during the valley period of the electricity price, since the cost of purchasing electricity from the grid is lower than that of MT generation, the electrical load is almost entirely satisfied by the power supply from the grid. Meanwhile, since the cost of heat production per unit power of GB is lower than that of MT, and the heat load at this time is higher, GB gives priority to full power to ensure heat supply. During the peak period of the electricity price, the cost of power supply from MT is lower than the electricity price, thus the power supply of MT increases significantly. At this time,

On the other hand, due to the CHP characteristics of MT, after complementing the heat load, MT has excess power. BT charges at the time of 04:00–05:00 and 15:00–16:00 to dissipate the excess power, and discharges during the peak period of power consumption, which improves the energy utilization rate and operating economy of the system. Similarly, when MT produces too much heat, TST uses the heat storage and release character-

5.1.1. Energy Optimization Results without UDDSR Response

*5.1. Day-Ahead Energy Optimization Based on UDDSR* 

the remaining heat load is supplemented by GB.

istics to meet the thermal load demand.

#### *5.1. Day-Ahead Energy Optimization Based on UDDSR*

In order to verify the impact of the UDDSR mechanism on the whole community system, the outputs of the system equipment before and after the UDDSR response were analyzed.

## 5.1.1. Energy Optimization Results without UDDSR Response

When users do not participate in the UDDSR response, the community CHP optimizes energy consumption according to the prediction values of electric and heat loads, PV outputs, and outdoor temperature. The optimization results of equipment outputs are shown in Figure 5. It can be seen that during the valley period of the electricity price, since the cost of purchasing electricity from the grid is lower than that of MT generation, the electrical load is almost entirely satisfied by the power supply from the grid. Meanwhile, since the cost of heat production per unit power of GB is lower than that of MT, and the heat load at this time is higher, GB gives priority to full power to ensure heat supply. During the peak period of the electricity price, the cost of power supply from MT is lower than the electricity price, thus the power supply of MT increases significantly. At this time, the remaining heat load is supplemented by GB.

On the other hand, due to the CHP characteristics of MT, after complementing the heat load, MT has excess power. BT charges at the time of 04:00–05:00 and 15:00–16:00 to dissipate the excess power, and discharges during the peak period of power consumption, which improves the energy utilization rate and operating economy of the system. Similarly, when MT produces too much heat, TST uses the heat storage and release characteristics to meet the thermal load demand. *Energies* **2021**, *14*, x FOR PEER REVIEW 13 of 24

**Figure 5.** Energy optimization results without UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus. **Figure 5.** Energy optimization results without UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus.

The change of indoor heating temperature is depicted in Figure 6. It can be observed that the indoor temperature is always maintained near the optimal room temperature, and the heating needs are met. The change of indoor heating temperature is depicted in Figure 6. It can be observed that the indoor temperature is always maintained near the optimal room temperature, and the heating needs are met.

5.1.2. Energy Optimization Results with UDDSR Response

the heating range is changed into *Tin*min- *Tadj* ≤ *Tt* 

**Figure 6.** The change of indoor heating temperature without UDDSR response.

When users participate in the UDDSR response, they submit a flexible IDR bid to CEMS according to their own energy demand. The bid content includes the interruptible load, the shiftable load, the time and capacity of the adjustable load and the CEMS aggregates and optimizes the responsive loads of the users. Based on the aggregated results of the responsive loads, the energy use of the community CHP system is optimized. The UDDSR bid results are shown in Figure 7. In this figure, the green curve indicates the adjustable time of the heating temperature allowed by users. When L\_DRH State > 0, the upper and lower limits of the heating temperature are allowed to be reduced by *Tadj*, i.e.,

heating temperature cannot be reduced, i.e., the thermal load cannot be adjusted. In this case, it is assumed that *Tadj* = 1, *Tin*min = 18, *Tin*max = 26. It can be seen that the operating costs

*in* ≤ *Tin*max- *Tadj*; when L\_DRH State < 0, the

results of heat bus.

(**a**) (**b**) **Figure 5.** Energy optimization results without UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization

and the heating needs are met.

**Figure 6.** The change of indoor heating temperature without UDDSR response. **Figure 6.** The change of indoor heating temperature without UDDSR response.

5.1.2. Energy Optimization Results with UDDSR Response 5.1.2. Energy Optimization Results with UDDSR Response

When users participate in the UDDSR response, they submit a flexible IDR bid to CEMS according to their own energy demand. The bid content includes the interruptible load, the shiftable load, the time and capacity of the adjustable load and the CEMS aggregates and optimizes the responsive loads of the users. Based on the aggregated results of the responsive loads, the energy use of the community CHP system is optimized. The UDDSR bid results are shown in Figure 7. In this figure, the green curve indicates the adjustable time of the heating temperature allowed by users. When L\_DRH State > 0, the upper and lower limits of the heating temperature are allowed to be reduced by *Tadj*, i.e., the heating range is changed into *Tin*min- *Tadj* ≤ *Tt in* ≤ *Tin*max- *Tadj*; when L\_DRH State < 0, the heating temperature cannot be reduced, i.e., the thermal load cannot be adjusted. In this case, it is assumed that *Tadj* = 1, *Tin*min = 18, *Tin*max = 26. It can be seen that the operating costs When users participate in the UDDSR response, they submit a flexible IDR bid to CEMS according to their own energy demand. The bid content includes the interruptible load, the shiftable load, the time and capacity of the adjustable load and the CEMS aggregates and optimizes the responsive loads of the users. Based on the aggregated results of the responsive loads, the energy use of the community CHP system is optimized. The UDDSR bid results are shown in Figure 7. In this figure, the green curve indicates the adjustable time of the heating temperature allowed by users. When L\_DRH State >0, the upper and lower limits of the heating temperature are allowed to be reduced by *Tadj*, i.e., the heating range is changed into *Tin*min- *Tadj* ≤ *Tt in* ≤ *Tin*max- *Tadj*; when L\_DRH State < 0, the heating temperature cannot be reduced, i.e., the thermal load cannot be adjusted. In this case, it is assumed that *Tadj* = 1, *Tin*min = 18, *Tin*max = 26. It can be seen that the operating costs of the community CHP system are lower when users perform UDDSR based on the optimized IDR response load, compared with performing UDDSR according to the maximum response capacity of the aggregated IDR bid. *Energies* **2021**, *14*, x FOR PEER REVIEW 14 of 24 of the community CHP system are lower when users perform UDDSR based on the optimized IDR response load, compared with performing UDDSR according to the maximum response capacity of the aggregated IDR bid.

> The optimization results of the equipment output after the UDDSR response are shown in Figure 8. Figure 8a indicates that after the UDDSR response, the power purchas-

> Figure 9 represents the comparison of the electric heating load before and after the user response. It can be observed that the UDDSR mechanism has an obvious "peak-shaving and valley-filling" effect on the community system, and can successfully complete the demand response events initiated by the grid operator or dispatching department.

> Figure 10 displays the indoor heating temperature changes before and after UDDSR response. After the UDDSR response, the heat load during the period of 00:00–05:00 and 21:00–23:00 has been reduced to a certain extent. Although the actual room temperature has been lowered, it is still higher than *Tin*min- *Tadj*. This means the community system does not operate according to the minimum heating temperature, which guarantees the energy satisfaction of users to the greatest extent, and verifies the accuracy and validity of the

> 00:00–05:00 and 21:00–23:00, the MT heat supply is significantly reduced, and the heat

The change of indoor heating temperature is depicted in Figure 6. It can be observed that the indoor temperature is always maintained near the optimal room temperature,

**Figure 7.** The response loads of users participating in UDDSR. **Figure 7.** The response loads of users participating in UDDSR.

load of the users has been adjusted.

heating temperature constraint in (18)

The optimization results of the equipment output after the UDDSR response are shown in Figure 8. Figure 8a indicates that after the UDDSR response, the power purchasing from the grid during the peak load period is significantly reduced, since part of the unnecessary load is interrupted or shifted. Figure 8b indicates that during the period of 00:00–05:00 and 21:00–23:00, the MT heat supply is significantly reduced, and the heat load of the users has been adjusted.

Figure 9 represents the comparison of the electric heating load before and after the user response. It can be observed that the UDDSR mechanism has an obvious "peak-shaving and valley-filling" effect on the community system, and can successfully complete the demand response events initiated by the grid operator or dispatching department.

Figure 10 displays the indoor heating temperature changes before and after UDDSR response. After the UDDSR response, the heat load during the period of 00:00–05:00 and 21:00–23:00 has been reduced to a certain extent. Although the actual room temperature has been lowered, it is still higher than *Tin*min- *Tadj*. This means the community system does not operate according to the minimum heating temperature, which guarantees the energy satisfaction of users to the greatest extent, and verifies the accuracy and validity of the heating temperature constraint in (18) *Energies* **2021**, *14*, x FOR PEER REVIEW 15 of 24 *Energies* **2021**, *14*, x FOR PEER REVIEW 15 of 24

**Figure 8.** Energy optimization results with UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus. **Figure 8.** Energy optimization results with UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus. **Figure 8.** Energy optimization results with UDDSR response. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus.

**Figure 9.** Comparison of electric and heat load before and after UDDSR. (**a**) Comparison of electric load before and after response; (**b**) comparison of heat load before and after response. **Figure 9.** Comparison of electric and heat load before and after UDDSR. (**a**) Comparison of electric load before and after response; (**b**) comparison of heat load before and after response. **Figure 9.** Comparison of electric and heat load before and after UDDSR. (**a**) Comparison of electric load before and after response; (**b**) comparison of heat load before and after response.

**Figure 10.** Indoor heating temperature before and after UDDSR. **Figure 10.** Indoor heating temperature before and after UDDSR.

The comparison of system operating costs before and after UDDSR response is shown in Table 1. It can be seen that after participating in the UDDSR response, users can directly receive a load response compensation of RMB 250.49 (including power load and thermal load response compensation). The total daily operating cost of the community system is reduced by RMB 543.75, and the saving rate can reach 3.09%. The results verify the effectiveness of the proposed UDDSR mechanism. The comparison of system operating costs before and after UDDSR response is shown in Table 1. It can be seen that after participating in the UDDSR response, users can directly receive a load response compensation of RMB 250.49 (including power load and thermal load response compensation). The total daily operating cost of the community system is reduced by RMB 543.75, and the saving rate can reach 3.09%. The results verify the effectiveness of the proposed UDDSR mechanism.


Total cost (RMB) 17,620.31 17,076.56 3.09%

**Table 1.** System operation costs before and after UDDSR response. **Table 1.** System operation costs before and after UDDSR response.

#### *5.2. CVaR-Based Energy Optimization*

*5.2. CVaR-Based Energy Optimization*  In this subsection, the random simulation sampling method based on (44) is used to model the uncertainties that the community system may face. Four scenarios where the maximum prediction error and maximum load response fluctuation (maximum uncertainty fluctuations) are not more than 5%, 10%, 15% and more than 15% are set for comparison. Among them the maximum prediction error of outdoor temperature is set to be not more than 2°C. The number of subscenarios in the uncertainty scenario set for each scenario is 100. The influence of different confidence levels con and different uncertainty In this subsection, the random simulation sampling method based on (44) is used to model the uncertainties that the community system may face. Four scenarios where the maximum prediction error and maximum load response fluctuation (maximum uncertainty fluctuations) are not more than 5%, 10%, 15% and more than 15% are set for comparison. Among them the maximum prediction error of outdoor temperature is set to be not more than 2 ◦C. The number of subscenarios in the uncertainty scenario set for each scenario is 100. The influence of different confidence levels *con* and different uncertainty coefficients *β* on the system optimization results is analyzed.

## 5.2.1. Energy Risk Optimization Results Based on CVaR

uncertainty scenarios is depicted in Figure 11.

coefficients β on the system optimization results is analyzed.

5.2.1. Energy Risk Optimization Results Based on CVaR Scenario 2, where the maximum uncertainty fluctuation does not exceed 10%, is taken as an example to analyze the optimization results when con = 0.95, β = 1. A set of Scenario 2, where the maximum uncertainty fluctuation does not exceed 10%, is taken as an example to analyze the optimization results when *con* = 0.95, *β* = 1. A set of uncertainty scenarios is depicted in Figure 11.

**Figure 11.** Uncertainty scenarios set with maximum risk fluctuation ≤10%. **Figure 11.** Uncertainty scenarios set with maximum risk fluctuation ≤10%.

The electrical load response is assumed to fluctuate below the optimal response obtained by day-ahead optimization based on UDDSR, i.e., the case only considers the situation where the actual response of users does not meet the standard. The adjustable thermal load is allowed to be regulated at 00:00–05:00 and 21:00–23:00, and this setting has a certain logical consistency with the heating needs of users. The electrical load response is assumed to fluctuate below the optimal response obtained by day-ahead optimization based on UDDSR, i.e., the case only considers the situation where the actual response of users does not meet the standard. The adjustable thermal load is allowed to be regulated at 00:00–05:00 and 21:00–23:00, and this setting has a certain logical consistency with the heating needs of users.

The system energy optimization results of scenario 2 are depicted in Figure 12. From Figure 12a, it can be observed that when *β =* 1, the power supply of the community system is greater than the predicted electric load in most periods. In Figure 12b, L\_AC0 is the thermal load of users before the UDDSR response, and the heating power of the community system during 00:00 and 06:00–13:00 is greater than the predicted heating load. The community system adopts a completely conservative risk avoidance strategy, i.e., to make the system operate normally under the interference of any risk fluctuations in the second scenario, the system equipment output as much power as possible to meet the electric and heating demand of users. Figure 13 shows the changes in indoor temperature in the four scenarios. It can be The system energy optimization results of scenario 2 are depicted in Figure 12. From Figure 12a, it can be observed that when *β =* 1, the power supply of the community system is greater than the predicted electric load in most periods. In Figure 12b, L\_AC0 is the thermal load of users before the UDDSR response, and the heating power of the community system during 00:00 and 06:00–13:00 is greater than the predicted heating load. The community system adopts a completely conservative risk avoidance strategy, i.e., to make the system operate normally under the interference of any risk fluctuations in the second scenario, the system equipment output as much power as possible to meet the electric and heating demand of users.

seen that the greater the risk fluctuation, the greater the indoor temperature variation. However, the change of the indoor temperature remains within 2°C per unit time, and the indoor temperature is kept within the upper and lower limits allowed by users. Figure 13 shows the changes in indoor temperature in the four scenarios. It can be seen that the greater the risk fluctuation, the greater the indoor temperature variation. However, the change of the indoor temperature remains within 2 ◦C per unit time, and the indoor temperature is kept within the upper and lower limits allowed by users.

*Energies* **2021**, *14*, x FOR PEER REVIEW 18 of 24

**Figure 12.** System energy optimization results with maximum uncertainty fluctuation ≤10%. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus. **Figure 12.** System energy optimization results with maximum uncertainty fluctuation ≤10%. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus. **Figure 12.** System energy optimization results with maximum uncertainty fluctuation ≤10%. (**a**) Optimization results of electric bus; (**b**) optimization results of heat bus.

The comparison of system operating costs in the four scenarios is shown in Table 2. When the maximum risk fluctuation is less than or equal to 5%, the expected total cost of system operation is reduced by RMB 158.7 compared with the total cost without UDDSR response, that is, a saving of 0.9%. When the maximum risk fluctuation is less than or equal to 10%, the expected cost of the community system operating in the second scenario is RMB 212.33 higher than that without UDDSR response. The system only needs to pay 1.21% more in operating expenses to deal with the impact of 10% risk fluctuation. When the maximum risk fluctuation is larger than 10%, the expected cost of system operation will continue to rise as the risk fluctuation becomes larger. Once the prediction error is large, the system must pay high costs in order to avoid operational risks. On the other hand, the average excess loss of the system increases with the increase in risk fluctuations, indicating that the system needs to increase investment to better deal with risks, which verifies the rationality of the algorithm proposed in this paper. The comparison of system operating costs in the four scenarios is shown in Table 2. When the maximum risk fluctuation is less than or equal to 5%, the expected total cost of system operation is reduced by RMB 158.7 compared with the total cost without UDDSR response, that is, a saving of 0.9%. When the maximum risk fluctuation is less than or equal to 10%, the expected cost of the community system operating in the second scenario is RMB 212.33 higher than that without UDDSR response. The system only needs to pay 1.21% more in operating expenses to deal with the impact of 10% risk fluctuation. When the maximum risk fluctuation is larger than 10%, the expected cost of system operation will continue to rise as the risk fluctuation becomes larger. Once the prediction error is large, the system must pay high costs in order to avoid operational risks. On the other hand, the average excess loss of the system increases with the increase in risk fluctuations, indicating that the system needs to increase investment to better deal with risks, which verifies the rationality of the algorithm proposed in this paper. The comparison of system operating costs in the four scenarios is shown in Table 2. When the maximum risk fluctuation is less than or equal to 5%, the expected total cost of system operation is reduced by RMB 158.7 compared with the total cost without UDDSR response, that is, a saving of 0.9%. When the maximum risk fluctuation is less than or equal to 10%, the expected cost of the community system operating in the second scenario is RMB 212.33 higher than that without UDDSR response. The system only needs to pay 1.21% more in operating expenses to deal with the impact of 10% risk fluctuation. When the maximum risk fluctuation is larger than 10%, the expected cost of system operation will continue to rise as the risk fluctuation becomes larger. Once the prediction error is large, the system must pay high costs in order to avoid operational risks. On the other hand, the average excess loss of the system increases with the increase in risk fluctuations, indicating that the system needs to increase investment to better deal with risks, which verifies the rationality of the algorithm proposed in this paper.

**Figure 13.** *Cont*.

**Figure 13.** Comparison of indoor heating temperature in different scenarios (con = 0.95, *β =* 1): (**a**) maximum uncertainty fluctuation ≤5%; (**b**) maximum uncertainty fluctuation ≤10%; (**c**) maximum uncertainty fluctuation ≤15%; (**d**) maximum uncertainty fluctuation >15% (about 50%) **Figure 13.** Comparison of indoor heating temperature in different scenarios (con = 0.95, *β =* 1): (**a**) maximum uncertainty fluctuation ≤5%; (**b**) maximum uncertainty fluctuation ≤10%; (**c**) maximum uncertainty fluctuation ≤15%; (**d**) maximum uncertainty fluctuation >15% (about 50%).

**Table 2.** System operation costs in different scenarios (con = 0.95, *β =* 1). **Table 2.** System operation costs in different scenarios (con = 0.95, *β =* 1).


5.2.2. Impact of Confidence Level and Uncertainty Coefficient of CVaR on Energy Use 5.2.2. Impact of Confidence Level and Uncertainty Coefficient of CVaR on Energy Use Optimization

Total cost savings ratio / 0.90% −1.21% −6.34% −28.61%

Optimization To further study the impact of confidence level *con* and uncetianty coefficient *β* (the risk preference of system operators) on the system optimization results, scenario 2 is used as an example to construct the following test set. To further study the impact of confidence level *con* and uncetianty coefficient *β* (the risk preference of system operators) on the system optimization results, scenario 2 is used as an example to construct the following test set.

$$con = \{0.99, 0.95, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0\}\tag{52}$$

$$
\beta = \{1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0\}\tag{53}
$$

The performance of the expected cost of community system operation on the test set under scenario 2 is shown in Figure 14. The expected cost of system operation decreases as the confidence level decreases. This is because the predicted value of the uncertainty variable is used to generate the scenario. The lower the value of *con*, the lower the probability that the predicted value of the uncertainty variable is included in the uncertainty scenario set (i.e., the closer the uncertainty variable is to the predicted value). On the other hand, *β* represents the weight of CVaR in the optimization objective function. The larger The performance of the expected cost of community system operation on the test set under scenario 2 is shown in Figure 14. The expected cost of system operation decreases as the confidence level decreases. This is because the predicted value of the uncertainty variable is used to generate the scenario. The lower the value of *con*, the lower the probability that the predicted value of the uncertainty variable is included in the uncertainty scenario set (i.e., the closer the uncertainty variable is to the predicted value). On the other hand, *β* represents the weight of CVaR in the optimization objective function. The larger the weight, the more the system tends to avoid uncertainties. Therefore, when *con* is determined, the expected cost of the system increases with the increase of *β*.

Figure 15 shows the average excess loss CVaR that the community runs under uncertainty on the test set. The average excess loss of the system decreases with the increase in the CVaR weight. The larger the CVaR weight, the more prone the system is to uncertainties, and the system will try to reduce possible uncertainty-induced losses even if this results in of higher operation costs. On the other hand, when *β* is determined, the average excess loss increases with the rise of *con*. This is because CVaR measures the tail uncertainty outside the confidence interval. The larger *con* is, the greater the deviation between the uncertainty variables and the predicted value in the uncertainty scenario, and the greater the possible uncertainty loss is.

To more clearly show the relationship between CVaR and the expected cost of system operation, a case where *con* = 0.95 is analyzed. In this case, the uncertainty variables contained in the uncertainty scenario set are more volatile, and the system is faced with greater possible uncertainties. The results are shown in Figure 16. When *β* increases, the expected cost of the system continues to increase, while the average excess loss of the system continues to decrease. This is because the greater *β* is, the more the system prefers to avoid uncertainties, and the system is willing to pay higher operating costs in exchange for lower excess losses.

**Figure 14.** The changes of expected cost of system operation with *con* and *β* (maximum uncertainty fluctuation ≤10%).

**Figure 15.** The changes of CVaR with *con* and *β* (maximum risk fluctuation ≤10%).

**Figure 15.** The changes of CVaR with *con* and *β* (maximum risk fluctuation ≤10%)

**Figure 16.** The changes of CVaR and expected cost with *β* (maximum uncertainty fluctuation ≤10%). **Figure 16.** The changes of CVaR and expected cost with *β* (maximum uncertainty fluctuation ≤10%).

#### **6. Conclusions 6. Conclusions**

This paper proposes an energy optimization method for community IES based on UDDSR. The thermal model of aggregated buildings is introduced to measure users' adjustable thermal load, and the responsive loads including power loads and thermal loads are aggregated and optimized through UDDSR optimization. Then, a day-ahead scheduling model is proposed to optimize the energy management for the community IES, and CVaR theory is introduced to deal with the volatility of PV output, user load, outdoor temperature, and user actual UDDSR response load. The case study shows that the proposed UDDSR mechanism can effectively reduce the operating costs under the premise of fully considering the willingness of users to participate in IDR events. Additionally, the optimization method based on CVaR enables the community system to pay less than 2% in additional operating costs to deal with the energy deviation caused by the maximum uncertainty of 10%, thus verifying the correctness and effectiveness of the method presented in this paper. For further study, the relationship between user energy consumption This paper proposes an energy optimization method for community IES based on UDDSR. The thermal model of aggregated buildings is introduced to measure users' adjustable thermal load, and the responsive loads including power loads and thermal loads are aggregated and optimized through UDDSR optimization. Then, a day-ahead scheduling model is proposed to optimize the energy management for the community IES, and CVaR theory is introduced to deal with the volatility of PV output, user load, outdoor temperature, and user actual UDDSR response load. The case study shows that the proposed UDDSR mechanism can effectively reduce the operating costs under the premise of fully considering the willingness of users to participate in IDR events. Additionally, the optimization method based on CVaR enables the community system to pay less than 2% in additional operating costs to deal with the energy deviation caused by the maximum uncertainty of 10%, thus verifying the correctness and effectiveness of the method presented in this paper. For further study, the relationship between user energy consumption behavior and response capacity can be explored, so as to construct a reward and punishment mechanism that is more suitable for the energy needs of users.

**Author Contributions:** Conceptualization, J.Z.; Formal analysis, Y.L.; Funding acquisition, Z.M.; Investigation, Y.P.; Methodology, J.Z.; Project administration, Z.M.; Resources, Z.M.; Software, Y.L.; Supervision, Y.P. and S.Z.; Validation, J.Z. and Z.M.; Writing—original draft, Y.L.; Writing—review and editing, Y.P. and S.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the Science and Technology Project of Jiangsu State Grid Corporation of China, Grant J20210148.

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

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

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