*3.3. Model Solving*

The solution methods of the bi-level optimization model usually include classical mathematical programming theory and the combination of intelligent optimization algorithms and classical mathematical programming theory [46,47]. In this study, the lower-level scheduling model takes into account the off-design characteristics of the equipment, which makes the lower-level scheduling model non-convex and nonlinear, and thus makes it difficult for classical mathematical programming theory to solve the bi-level dynamic optimization model. Therefore, this study will adopt the method of combining an intelligent optimization algorithm and classical mathematical programming theory to solve it, in which the upper-level optimization model is solved by a genetic algorithm. However, the calculation of the upper-level optimization objective often depends on the solution of the lower-level model. To realize the fast and accurate solution of the lower-level optimization model, this paper performs piecewise linearization on the performance curve of the equipment and calls Gurobi's non-convex solver to solve it to obtain the minimum operating cost and operating energy consumption. The lower-level optimization model transfers the optimization results to the upper-level optimization model to calculate the total cost of the system, while the upper-level optimization model transfers the optimized equipment capacity to the lower optimization model to constrain its scheduling. After repeated iterations, the optimal configuration and scheduling schemes of three RIESs can be obtained. Figure 3 shows the flow chart of the bi-level dynamic optimization model.

**Figure 3.** Solution flow chart of the bi-level optimization model.

#### **4. Case Study**

This paper takes a public building in Changsha as an example to explore the impact of energy storage equipment on the optimal design and operation results of RIESs. The building consists of two parts, the main building and the podium building, of which the main building has twelve floors, and the podium building has five floors, covering a total area of 2500 m2. Considering the energy-saving requirements of the building, its envelope adopts the standard building envelope structure in hot-summer and cold-winter climates.

#### *4.1. System Design Parameters*

In the process of the optimization of RIESs, outdoor meteorological parameters and design load are the basis of system optimization design. Therefore, through relevant literature, this paper determines the outdoor design temperature of air conditioning in Changsha and the average water temperature of the Xiangjiang River, whose values are shown in Table 5. Unlike the heat load in winter, the cooling load calculation in summer is usually transient. For this reason, this paper corrects the outdoor design temperature of air conditioning in summer, and the hourly outdoor design temperatures and solar radiation intensities obtained from the correction are shown in Figure 4a. Based on the above design parameters, this paper uses Energy Plus to calculate the design load of the building, and the result is shown in Figure 4b. On summer design days, the heating load is mainly domestic hot water load, while the winter heating load includes air conditioning heating load and domestic hot water load. When the design load is known, this paper determines the equipment capacity optimization range, shown in Table 6, according to the design load and equipment installation requirements.

**Table 5.** Air conditioning outdoor design temperature and groundwater temperature Reproduced from [48,49].


**Figure 4.** Outdoor parameters and building load under design conditions: (**a**) Hourly outdoor design temperature and solar radiation intensity in summer; (**b**) Cooling, heating, and electric load on the design day.



In addition, the energy price and carbon tax price are also indispensable input parameters for calculating the optimization objectives. For this reason, this paper determines the energy and carbon tax prices shown in Table 7 according to relevant literature.


**Table 7.** Energy price and carbon tax Reproduced from [50–52].

#### *4.2. System Optimization Results and Analysis*
