3.2.3. Constraints

The constraints include the balance of electricity, heating and cooling, and the capacity limits of the equipment.

(1) Equality constraints.

The electricity balance is as follows:

$$P\_{pv}^t + P\_{mt}^t + P\_{buy,grid}^t + P\_{sell}^t + P\_{vacancy}^t = P\_{load}^t + P\_{cc}^t + P\_{buy}^t + P\_{uaste}^t \tag{19}$$

where *Ptload* indicates the required electricity of the system at time *t*, and *Ptvacancy* and *Ptwaste* are the shortage and waste of electricity at time *t*.

The heating balance is as follows:

$$H\_{hr}^t + H\_{\text{tst,disch}}^t + H\_{gb}^t + H\_{\text{vacancy}}^t = H\_{\text{load}}^t + H\_{\text{tst,ch}}^t + H\_{\text{vaste}}^t \tag{20}$$

where *Htvacancy* and *Htwaste* represent the shortage and waste of heat at time *t*, respectively. The cooling balance is as follows:

$$\mathbf{C}\_{ac}^{t} + \mathbf{C}\_{cc}^{t} = \mathbf{C}\_{load}^{t} \tag{21}$$

where *Ctload* denotes the cooling load required by the user at time *t*.

(2) Inequality constraints.

The inequality constraints are mainly the capacity limits of the equipment. The inequality constraints involved in this study are listed in Table 1.


**Table 1.** Inequality constraints of the system.
