Optimal Control of Energy Systems in Net-Zero Energy Buildings Considering Dynamic Costs: A Case Study of Zero Carbon Building in Hong Kong

: Net-zero energy buildings coupled with multiple energy demands on the load side, which utilize renewable energy to a larger extent, are an effective way to consume distributed capacity in situ and need to face the operational challenges brought by the uncertainty of renewable energy while meeting different energy demands. To this end, this paper proposes a Dynamic Cost Interaction Optimization Model (DCI-OM) with Electric Vehicle Charging Station (EVCS) based on dynamic cost (i.e., oil price, electricity price) and considers a larger proportion of renewable energy capacity to be consumed. In this model, the optimized electricity and cooling demand dispatch scheme is given with daily operating cost as the objective function. Using the Zero Carbon Building in Hong Kong, China, as an example, simulations are performed for typical days (i.e., 21 March, 21 June, 22 September, and 21 December) in four seasons throughout the year. The results show that the electric and cooling load demand response scheme given by DCI-OM achieves peak and valley reduction according to the dynamic cost and reduces the original operating costs while ensuring that the customer’s comfort needs are within acceptable limits. The optimized scheduling scheme meets the demand while reducing the daily operating cost.


Introduction
With the current calling for carbon emission reduction at home and abroad, the development of net-zero energy buildings (nZEB) is seen as an effective solution to achieve the "double carbon goal" of energy development in China. Net-zero energy buildings reduce the carbon emissions by efficiently using renewable energy as part of the building energy supply, and by optimizing the design of the energy system to achieve the goal of producing more energy than it consumes during operation. Meanwhile, new energy sources have become a major force in the future energy transition and an important part of carbon substitution in achieving the carbon neutrality goal [1,2]. In responding to the national goal of "double carbon", increasing the utilization of renewable energy and the penetration of renewable energy in buildings has become an important direction for energy development [3,4]. Renewable energy is a key component of the energy production of net-zero energy buildings. However, due to the intermittent and uncertain nature of its production process, it can lead to a mismatch between renewable energy generation and the actual demand of buildings, resulting in the phenomenon of "wind/solar abandonment". Therefore, to ensure the full utilization of renewable energy, it is necessary to consider the carbon emissions in the building energy use process, to optimize the operation control of the building operation process. For example, Yu et al. [5] proposed an energy storage system configuration scheme to reduce the abandonment rate of photovoltaic (PV) plants based on the operational data of PV plants in a region of Qinghai, China. This configuration scheme can achieve a friendly interaction between the solar/storage system and the power grid and can solve the problem of wasted renewable energy capacity. To alleviate the waste of capacity generated by "wind/light abandonment", Xiao et al. [6] took thermal power plants as an example, which used abandoned wind power to drive electric boilers and add backwater to the thermal power plants. Results showed that this method provides great economic and environmental benefits and is considered a reasonable solution for the utilization of abandoned wind power. The above improvement methods for wind/solar electricity abandonment are effective, but net-zero energy buildings couple multiple energy types, thus, the optimization of zero-energy buildings contains many aspects.
To reduce the carbon emission of building energy systems and increase the utilization of renewable energy, the optimization of building energy systems can be carried out in different aspects. Many scholars have conducted extensive researche on optimization, including the optimal design of net-zero energy buildings and the optimal control of the operation process. For example, for the optimal design of net-zero energy buildings [7,8], Lu et al. [9] considered the effect of uncertainty parameters in nZEB designing and proposed a robust design method for sizing renewable energy systems in nZEB. Ferrara et al. [10] proposed a method based on deep residual learning, aimed at simplifying the nZEB optimization design, and the results showed that the use of this simulation method can effectively improve energy efficiency with low accuracy error. Borrelli et al. [11] developed a building energy model for optimal control of Heating, Ventilation, and Air Conditioning (HVAC) systems in nZEB using a classroom located in Belgium as a case study. Experimental results showed that based on a combined outdoor time-by-time and thermal storage tank temperature control scheme, energy consumption can be significantly reduced (32-64%), and thermal comfort time was increased (0.6-3.4%). Fan et al. [12] proposed a new collaborative control approach to share and potentially cooperate with renewable energy sources in a net-zero energy building. The results show that this collaborative control approach can effectively improve the performance of net-zero energy buildings and improve the cost-effectiveness and grid-friendliness of the building complex.
The uncertainty of renewable energy and the volatility of loads are among the parts that must be considered in the optimization of building energy systems. To alleviate the challenges posed by both for system operation, Yang et al. [13] developed a two-stage robust optimization model, aiming to find a direct balance between economy and robustness of system operation, and the optimization results showed that based on this model, the system operation robustness can be guaranteed while reducing costs. By considering the uncertainty parameters, Jiao et al. [14] proposed a three-stage online scheduling scheme to coordinate the charging behavior of EVs. Based on the proposed day-ahead scheduling model, the next day's operating cost was optimized, and results showed that it is more economically efficient compared to the traditional optimal scheduling scheme.
To mitigate the effects of scenery and load uncertainty on system operation, many optimization algorithms are now widely used in the optimal control of building energy systems. These include artificial neural networks (ANN) [15], particle swarm optimization (PSO) [16], nonlinear programming (NLP) [17], genetic algorithms (GA) [18], etc. For example, Das et al. [19] proposed a model to optimize the optimal capacity of renewable energy capacity and energy storage systems. The strategy used the NLP algorithm to consider 24-h generation and load demand, and through test runs, the rated power and capacity of the energy storage system were provided under different operating conditions, which reduce the cost waste of designing energy storage capacity. On this basis, Lu et al. [20] proposed an optimization method based on mixed-integer nonlinear programming (MINLP), which can solve more complex control models compared to the NLP method, so the optimization results of the MINLP method are more reliable. Compared with these traditional algorithms, intelligent algorithms (e.g., ANN, PSO, GA) are now widely used in control systems due to their powerful exploration capabilities [21]. Borges et al. [22] proposed a particle swarm optimization method to solve the day-ahead scheduling problem in distributed generation considering uncertainty from the impact of PV and WT (Wind turbine) on distributed Sustainability 2022, 14, 3136 3 of 25 generation systems. Chiñas-Palacios et al. [23] proposed an artificial neural network (ANN) optimization model combined with a particle swarm algorithm to optimize the amount of feedstock preparation required for biomass gasification field (BGP) synthesis, the results showed that the hybrid system not only ensures the prediction of the necessary parameters but also has lower errors compared to the traditional ANNs.
Most of the existing optimal control studies focused on optimizing the power system of nZEB systems, the system operating economy was selected as the objective function. For example, Gao et al. [24] proposed a demand response control method based on a genetic algorithm (GA) to optimally control the charging and discharging power of the energy storage system, and, thus, achieve a reduction in the peak daily operating load of the building, and a reduction in the daily operating cost. Similarly, Shehzad et al. [25] proposed a particle swarm optimization (PSO)-based load demand response method, and simulation results showed that the proposed scheme satisfies both load flexibility and minimization of operating costs. Similar to this, by setting the operating cost and pollutant gas emissions as the objective functions, Yang et al. [26] used a modified mixed-integer linear programming (MILP) model to optimize the scheduling of a combined cooling and heating power microgrid system, and the results showed that the optimized scheduling scheme effectively reduced the operating cost.
In summary, the existing studies on nZEB optimization are extensive, and most of them tend to optimize the daily operating cost, of which the daily operating cost only considers the dynamic electricity price and lacks the impact of various dynamic costs. In addition, the studies on the optimal scheduling of energy system in nZEB were usually conducted based on designed energy system, and few studies have found in the application of electric vehicle units in nZEB. In this study, energy storage systems are optimally designed first and electric vehicle units are assumed in the studied building, then optimal scheduling is conducted by proposing Dynamic Cost Interaction Optimization Model (DCI-OM), which considers dynamic costs (i.e., oil price, electricity price). The zero carbon building (ZCB) in Hong Kong, China, was taken as an example, and the EV charging load was considered to obey the scheduling as another energy storage unit of nZEB. The capacity of the energy storage system is designed by combining the cost and the ability to consume renewable energy capacity. The probabilistic sequences of wind and light power generation are generated based on the sequence operation theory, and the chance constraint is transformed into a mixed-integer linear model (MILP) that is easy to solve. Then CPLEX is called to solve the model. Finally, the advantages and disadvantages of the optimization results are analyzed by comparing them with the original solution.

Methodology
The prices of purchased electricity, natural gas, and fuel are important parts for the system's operating costs and play a key role in optimal control. When one or more of these costs become dynamic (real-time electricity prices, real-time oil prices, etc.), how to achieve economy and ensure stable system operation must be solved. On the other hand, whether demand response programs by adjusting the electricity load can keep customers within an acceptable range is not clear. Therefore, this paper focuses on the control optimization of grid-connected zero energy building energy systems considering the dynamic cost. The cost considered in this paper is the dynamic electricity price and the dynamic generation cost of the assumed oil-fired generator. The scheduling scheme of the cooling/electricity unit capacity considering the dynamic cost is based on the demand response of the load. The microgrid of zero energy buildings does not participate in trading excess power to the main grid, and all the power from the microgrid is used to ensure the stable operation of each part.
The microgrid of net-zero energy building studied in this paper mainly includes the renewable distributed energy system, traditional power system, energy storage system, and electricity load. Among them, the renewable distributed energy system is mainly composed of photovoltaic and wind turbines; the traditional power system is a micro biomass diesel fuel turbine. DCI-OM is mainly composed of two parts: cooling and power optimization control. The scheduling of energy/information flows for the cooling/electricity loads is given separately in Figure 1, and the power load demand response scheme and unit capacity scheduling schemes are provided. DCI-OM aims to optimize energy systems for zero energy building considering dynamic costs, with economic benefits (daily operating costs) and environmental benefits (carbon emissions) as the objective function, and to compare it with original operating scenarios.

Renewable Generations Models
Since the power generation of wind turbine (WT) and photovoltaic (PV) is intermittent and stochastic, the probability density function (PDF) is usually used to describe the uncertainty of such variables. The output power probabilities of WT and PV are assumed to obey the Beta and Weibull distributions, respectively. The PDF model described in the literature [27] and the derivation process are used in this paper.

Electric Vehicle Charging Station Model
The model of EV arrival/departure and EV charging used in this paper are described detailed in the literature [28][29][30][31], the probability density function of arrival and departure/arrival times at charging stations can be described according to its probability distribution conforming to the normal distribution as: (1) where µ 1 and µ 2 are the mean value of arrival and departure time of electric vehicles at charging stations, σ 1 and σ 2 are the standard deviations of the arrival and departure times of electric vehicles at charging stations, respectively.

Dynamic Cost Model
The basic operating costs are divided into two categories: dynamic costs and fixed costs, depending on whether the operating costs have time fluctuations. Fixed costs include unit start-up and shutdown costs, equipment depreciation costs, etc. Existing dynamic costs generally only consider the impact of dynamic electricity prices on the system operation scheme. In this study, we assume that the raw materials of power-producing equipment have dynamic fluctuation properties over time, and a price design method was proposed for the cost of fuel turbine power generation regarding the description of basic prices within the literatures [28][29][30]. The design process is illustrated in Figure 2.

Integrated Demand Response Model
The flexible electricity load can be defined as a load that requires electricity to be "scaled" or time-shifted or interrupted at different periods within the specified range by the dispatching instructions received by the user while the electricity consumption remains unchanged. It also applies to flexible cooling load since interruption of cooling load will have a greater impact on thermal comfort. The response considers the characteristics of both electricity and cooling loads. The electricity load is divided into time-shiftable and interruptible loads, and the cooling load is divided into fixed and time-shiftable thermal loads.

Demand Response of Electricity Load
Based on the impact of dynamic cost fluctuations, the supply-demand balance and cost reduction of the system can be achieved through real-time dispatch. The time-shiftable portion of the electricity load can be described by the following equation.
where P SYL t is the power of the load shifted at the time of occurrence of period t, P SYL t,min and P SYL t,max are the upper and lower limits of the time-shifted load, respectively. In the period when the dynamic electricity price is too high and the power system is undersupplied, the relief of the supply pressure on the power system and the improvement of the system stability are achieved by interrupting a part of the electricity consumption load, then the constraint of the interrupted load can be described as: where P ZL t,max is the maximum interruptible load in period t.
where C Loss,t is the loss caused by the lack of power in the system at time t, P Loss,t is the system power deficit at time t, k, β is the load-related constant.

Demand Response of Cooling Load
The time-shiftable cooling load can be described by the following equation.
where P CP,t is the cooling power supply in time t, P CD TL,t is the cooling power released from the cooling storage device in time t, P CC TL,t is the storage power of the cooling storage unit in time t, P CSY TL,t is the time-shiftable cooling load power at time t, P UCSY TL,t is the time-unshiftable cooling load power in period t.
To ensure the balance of supply and demand of the absorption/electric refrigeration cooling system during operation, the following constraints need to be met for the timeshiftable cooling load.
(1) In the period of low demand for cooling load, part of the time-shiftable cooling load of other periods will be shifted into this period. In the operation process, it is necessary to ensure that the cooling load demand in this period cannot exceed the maximum cooling load demand allowed in this period, this can be expressed as: where P CSY TLA,t is the actual time-shifted power of the cooling load for each period. (2) In the period of high demand for cooling load, part of the time-shiftable cooling load is moved out of the period to reduce the pressure of the system supply during the period. In the operation process, it is necessary to ensure that the cooling load demand in Sustainability 2022, 14, 3136 7 of 25 this period cannot be lower than the minimum cooling load demand allowed in this period, this can be expressed as: (3) During the whole dispatching cycle, it is necessary to ensure that the total cooling load demand of the system before and after the time shift remains the same, this can be expressed as:

Evaluation Indexes for Demand Response
Based on the previous section, two indexes of economy (A eco ) and comfort (A com ) are established concerning the demand response evaluation method proposed in the literature [31], as shown in Equations (11) and (12), respectively, to evaluate the demand response scheme of this paper in terms of customer satisfaction.
where, d t is the real-time electricity price at time t, q b,t and q a,t are the electricity load at time t before and after the demand response, and ∆q t is the load change at time t.

Objective Function
The total operating cost of DCI-OM consists of the following three components: the cost of power purchased from the grid by the integrated energy system (i.e., electricity load, cooling load, and electric vehicle charging load), the cost of gas turbines, and energy storage for providing backup to the system, the cost of depreciation of energy storage devices and the cost of equipment losses, then the optimization objective function for DCI-OM can be expressed as: ε n R BY n,t + τS n,t + U n,t δ n + ϕ n P BT n,t where, T represents the duration of a scheduling cycle (24 is taken in this study), M B is the number of BDG units, R BY n,t is the power output for the standby BDG, S n,t is the output power of the BDG, δ n and ϕ n are the consumption coefficients of BDG, respectively; U n,t and S n,t is the unit status variable and the power-on variable, ε n and τ are the backup costs and start-up costs of BDG, P BT n,t and R BY n,t are the output power and the backup output power provided by the BDG at time t, a is the price for energy storage backup, R ESS t the backup capacity provided for energy storage, b is the depreciation cost of energy storage, P ESS in,t is the energy storage charging power in time t, c is the load disruption cost.

Constraints Conditions
(1) Power supply system constraints For the power supply system, the main constraints are described as in Equations (14)- (23), which mainly include the constant total load during the dispatch cycle, the upper and lower limits of fluctuating load, and the upper and lower limits of unit output.
where, P BT t is the power of the fuel-consuming turbine of the system in time t, P ESS CC,t and P ESS DC,t are the charging and discharging power of energy storage at time t, P SYL t is the time-shiftable load at time t, P UTSL t is the non-time-shiftable load at time t, P CSY t is the controllable load at time t, C ESS t is the energy storage capacity at time t, R Grid t is the backup capacity provided by the grid at time t, P Ress,t is the backup capacity provided by energy storage at time t, a is the system confidence level, P WT t is the wind power at time t, and P PV t is the photovoltaic power at time t, respectively.
(2) Cooling system constraints (1) The constraints for cooling power balance where, C load,t is the cooling load demand in time t, P ec,n,t is the cooling power of the nth refrigeration unit in time t, N is the total number of refrigeration units, P CSS DC,t is the cooling power of the storage unit in time t, P CSS CC,t is the cooling power of the storage unit in time t.  (2) Constraints for the operation of the refrigeration unit P elc,n,t = γP elc,n,t 0 ≤ P elc,n,t ≤ P ec,n where, P elc,n,t is the power consumption of the nth refrigeration unit at time t, P ec,n is the rated cooling power of the nth refrigeration unit; γ is the performance coefficient of the refrigeration unit.
Constraints for cold storage

Comparison of Optimization Options
In this paper, the advantages and disadvantages of the Optimized scheduling scheme of the DCI-OM model are evaluated in terms of daily operation cost, carbon emission, and abandonment ratio, where carbon emission and abandonment ratio can be calculated by Equations (30) and (31).
where, C DE is the sum of carbon emissions in the dispatch cycle, f e is the carbon emission factor, P Grid t is the power purchased from the grid in each period, P Load t is the power demanded in each period. Figure 3 shows the steps for solving the DCI-OM model. Energy system models for the building are firstly designed in TRNSYS to derive building electrical load and cooling load. The distributed energy storage unit capacity was designed in the MATLAB platform by considering the cost and the probability of consuming the scenery output; then the energy systems for zero energy building and the designed distributed energy storage capacity are input into the MATLAB optimization program. The dynamic cost and other fixed operating costs are set as the input parameters. Then the CPLEX solver is called while the daily operating cost is used as the objective function for the optimization of DCI-OM. The optimization results are the cooling/electricity load demand response scheme, unit scheduling scheme, and daily operating cost.

Case Study
To verify the effectiveness of the DCI-OM method proposed in this study, the Zero Carbon Building (ZCB) located in Hong Kong is selected to test the proposed DCI-OM. An aerial view of the building is shown in Figure 4.

Model Parameters Settings
In literature [30], the building and system parameters have been provided for the ZCB. As shown in Table 1, the actual values are the actual parameters for the ZCB, and the model value represents the parameters used in this study. Based on the parameters provided, the energy system is modeled in TRNSYS and design is then optimized for the air conditioning system (type of chiller unit) and the power components (type and capacity of renewable energy). Therefore, the electricity/cooling load of the building and renewable energy generation can be calculated. To investigate the effectiveness of the proposed optimization model, four typical days (i.e., 21 March, 21 June, 22 September, and 21 December) in spring, summer, autumn, and winter are used for optimal scheduling analysis. A more economical operation scheme is given compared to the initial control scheme, i.e., the start and stop of the equipment are aligned with the building usage time (8:00 a.m.-6:00 p.m.).
DCI-OM is developed by MATLAB to optimize the energy system, energy system parameters are set as follows.
(1) Load parameters: four typical daily loads are calculated on TRNSYS. Since Hong Kong is located in a subtropical climate with high winter temperatures and long cooling periods throughout the year, only the electricity and cooling loads are considered in this study. The calculated electricity and cooling loads are shown in Figure 5.  (2) Grid parameters: the maximum power provided by the grid for the system is 100 kW.
(3) Cold storage device parameters: C ESS max = 200 kW·h, P CSS CC,max = P CSS DC,max = 100 kW, the maximum and minimum storage(CSC)/discharge(CSS) power are both 75 kW. (4) Refrigeration unit parameters: the system contains two refrigeration units (i.e., absorption refrigeration chiller, ground source heat pump), the rated power of the refrigeration output is both 100 kW, the cooling performance coefficient (COP) of absorption refrigeration chiller (ABC) and ground source heat pump (ELC) are 3.5 and 5, respectively. (5) Electric vehicle charging station parameters: the system contains one charging station with 10 charging posts, each with a charging power of 15 kW. A total of 15 electric vehicles are assumed in the office area, each with a battery capacity of 60 kWh. Total charging power of 900 kW is assumed for electric vehicles in one dispatch cycle, and the probability model of disorderly charging of electric vehicles in this study refers to the literature [32], i.e., µ 1 = 14.47, σ 1 = 3.41, µ 2 = 8.92, σ 2 = 3.24. The joint probability density of arrival and departure of EVs is shown in Figure 6. (6) Cost parameters: based on the method described in Figure 3, dynamic oil prices are generated, combined with the dynamic electricity prices described in the literature [33], where the high electricity price periods are 10 a.m.-8 p.m., medium electricity price periods are 6 a.m.-10 a.m. and 8 p.m.-10 p.m., and low electricity price periods are 10 p.m.-6 a.m.; dynamic costs are generated as shown in Figure 7. Other fixed costs, such as energy storage system losses, electricity load interruption, BDG unit start/stop cost are 0. 002USD, 0. 070USD, and 0. 167USD, respectively.

Design of Energy Storage Unit
The uncertainty and volatility of renewable energy generation are easy to cause disturbance to the system operation. An effective solution is to transform the load from rigid to controllable and flexible electricity consumption by designing suitable energy storage units. Based on the method proposed in the literature [27], the impact of the discrete step size and confidence level of the probability of renewable energy capacity on the investment cost of energy storage is considered, and the results are shown in Figure 8. When the discrete step size is larger than 4 kW, the difference in the investment cost of energy storage is larger under the same confidence level interval. Conversely, when the discrete step size is smaller than 4 kW, it has less impact on the cost, while the time required for calculation increases. To meet the reliability of the energy storage system and the economy of investment at the same time, 5 kW is taken as the discrete step length in this study.
Based on this, the optimal backup energy storage capacity is calculated for each of the four typical days, as shown in Figure 9. The energy storage parameters are set as follows: this study. Based on this, the optimal backup energy storage capacity is calculat the four typical days, as shown in Figure 9. The energy storage parame follows: * 45 kW • h , 30 kW • h, 135 kW • 0.9, , , 75 kW .   Figure 10 shows the electricity load demand response for four typical days (i.e., 21 March, 21 June, 22 September, and 21 December) of the year. It can be seen that the required electricity load is reduced by time-shifting and interruptions during the peak hours (8:00 am-6:00 pm) of the grid, and the electricity load is increased during the low tariff hours (12:00 pm-8:00 am, 6:00 pm-12:00 pm). The purpose of peak-shaving and valley-filling is achieved for the four typical days in different seasons, which reduces the pressure on the power supply of energy system.   Figure 11 shows the cooling load demand response for typical days (i.e., 21 March, 21 June, 22 September, and 21 December) in different seasons, and it can be seen that the building cooling load are all changed after demand response by time-shifting. The cooling load in the daily peak period (1:00 pm-6:00 pm) can be shifted to another off-peak period (8:00 am-1:00 pm) by time-shifting. Thus, the staggered operation is achieved, and the operating pressure of the refrigeration unit is reduced.  Figure 11 shows the cooling load demand response for typical days (i.e., 21 March, 21 June, 22 September, and 21 December) in different seasons, and it can be seen that the building cooling load are all changed after demand response by time-shifting. The cooling load in the daily peak period (1:00 p.m.-6:00 p.m.) can be shifted to another off-peak period (8:00 a.m.-1:00 p.m.) by time-shifting. Thus, the staggered operation is achieved, and the operating pressure of the refrigeration unit is reduced.  b Comfort index Figure 13 shows the comfort evaluation (A com ) in response to electrical load demand. The fluctuation range of A com on the typical days is between 0 and 1.5, and the limits proposed in the literature [31] range from 0 to 2. Thus, the fluctuation of A com is reduced after demand response, which is within the acceptable range of personnel. Table 2 shows the daily average of A com indicators, it can be seen that the average maximum fluctuation for a typical day was 12.90% (21 Mar), and the minimum fluctuation was 2.30% (22 September), both of which are within the allowable range.   Figures 14 and 15 show the power system scheduling schemes before and after optimization, respectively. Based on the daily dynamic electricity price, the whole day is divided into two periods: high energy use period (8:00 a.m.-6:00 p.m.) and low energy use period (6:00 p.m.-8:00 a.m.). The original scheduling scheme is shown in Figure 16. Electricity load is firstly undertaken by renewables and the grid. As the load increases, the BDG will be turned on.   In Figure 16, during periods of low energy consumption, the energy storage unit is mainly charged under the DCI-OM. The electricity demand of the building can be met by the grid, BDG, renewable energy system, and energy storage unit. Electricity was purchased at night when the electricity price was low, and was stored by the energy storage unit. However, in the original scheme, the energy storage unit is not setup and the operation time of the energy systems (i.e., chillers and BDG) are consistent with the office hours in the building, which lead to the waste of renewable energy production at night and, thus, cannot be effectively linked to dynamic electricity prices. During periods of high energy consumption, the energy storage unit is mainly discharged under the DCI-OM; the electricity demand of the building can be met by BDG, renewable energy system, and energy storage unit. No electricity was purchased during the daytime when the electricity price was high. By contrast, in the original scheme, the BDG operated at its maximum capacity once it was turned on, which easily causes production abandonment. Therefore, energy production and energy storage can be coordinated reasonably under the DCI-OM.

Scheduling Schemes for Cooling Demand
The working hours of the office building are 8:00 a.m.-6:00 p.m., and there are no people in the building at other times. Therefore, the time of the cooling load is the same as the people's working hours. The cooling load scheduling scheme given by DCI-OM is similar to the electricity load scheduling scheme, the cooling load is undertaken by absorption chillers, ground source heat pump units and storage units. In winter, since there is no cooling demand in Hong Kong, the cooling load on the typical day (21 December) is 0.
From the scheduling scheme, it is clear to see from Figure 17 that when electricity prices are low at night, the system purchases electricity from the grid. The purchased electricity is stored by the energy storage unit and used to drive the electric chiller. The generated cooling capacity will be stored by the storage unit. In the period of high energy consumption, through the cooperation of the cold storage unit and the absorption chiller, the opening time of the electric chiller is reduced and, therefore, the cost reduction is achieved. The original control scheme was: when the cooling load is lower than the maximum cooling capacity of one chiller, only one chiller is turned on. Otherwise, two chillers are turned on. Compared with the original plan, the optimized solution is more flexible and relieves the power demand on the grid at times of high energy use.

Comparison before and after Optimization
The daily operating costs, the proportion of renewable energy, and carbon emissions are considered as indicators for optimization, and the advantages and disadvantages of the DCI-OM optimization scheme (AO) compared with the original scheme (BO) are analyzed. Figure 17 shows the carbon emissions and the ratio of power abandonment before and after optimization, and Table 3 shows the comparison of daily operating costs, carbon emissions, and power curtailment before and after optimization. It can be seen that to reduce the daily operating cost, electricity is purchased from the grid and stored by energy storage units during the low electricity price period (10:00 p.m.-8:00 a.m.) of the typical days, and some carbon emissions are generated. In the original scheme, electricity was purchased directly from the grid when the power from the wind turbine, PV system, and BDG did not meet the electricity demand. For example, during the period of high electricity prices on 21 March, i.e., between 8:00 a.m. and 4:00 p.m., the disorderly purchase of electricity increased the operating pressure of the grid, and, thus, it lacks the friendliness of the interaction between the building and the grid.  On the other hand, due to the lack of considering the uncertainty of the wind and solar output, the phenomenon of large-scale abandonment of renewable energy exists in the original operation scheme. Especially in the summer and autumn, the abandonment of power is more than 50% in many hours of the day. The percentages of daily abandonment on the typical days are 17.35%, 48.08%, 34.74%, and 60.21%, respectively. However, there is no abandonment for the four typical days under DCI-OM. Figure 18 shows the daily operating costs and carbon emissions of four typical days before and after optimization. Through flexible demand response and design of energy storage units, the optimized scheme under DCI-OM has reduced daily operating costs for the four typical days compared with the original scheme, and the reduction is 57.14%, 51.79%, 31.96%, and 30.62%, respectively. Meanwhile, under the original operation scheme, the building will purchase electricity from the grid during the daytime when renewable energy generation is insufficient, while under DCI-OM, carbon emissions were increased due to the purchase of electricity during the low electricity price period, and power consumption during the peak hours can be avoided. Therefore, DCI-OM can ensure grid friendliness and a more stable operation.

Conclusions
To improve the economy and comfort for users by demand response, and alleviate the uncertainty of renewable energy, this study proposes an optimized control method that considers economic and environmental benefits. Firstly, electricity and cooling load response strategies were formulated, and evaluations from the aspects of economy and comfort were made. Then the optimized electricity and cooling load dispatching scheme were provided. Finally, Hong Kong Zero Carbon Building was taken as an example to verify the applicability of the proposed method, simulation results show: The DCI-OM takes into account the impact of real-time dynamic costs on users and provides a demand response scheme that effectively achieves peak-shaving and valleyfilling. The cost of purchased electricity was reduced by 22.46/USD, 23.96/USD, 24.55/USD, and 30.48/USD in the typical days, respectively. The average comfort indexes on the typical days maintain fluctuations between 0 and 1.5. This shows that the fluctuations caused by the proposed demand response scheme are within the acceptable range of users, the daily operating costs can also be reduced.
The scheduling scheme given by the DCI-OM reduces daily operating costs (i.e., 57.14%, 51.79%, 31.96%, and 30.62%). The daily operating cost of a similar optimal control study was reduced by 28% [34]. Therefore, DCI-OM is more effective in reducing costs.
Compared with the original dispatching scheme, the DCI-OM optimization plan can eliminate the phenomenon of power abandonment by setting up flexible energy storage units. Electricity was purchased and stored during low electricity prices at night, which reduces the demand for electricity purchase during peak power grid periods and improves the friendliness of interaction with the grid.
In this study, since the electric vehicle units are assumed in the building, surplus electricity generated by renewable energy systems can be stored and consumed by electric vehicle units. Therefore, the building will purchase electricity from the grid when electricity generated by the renewable energy system is not sufficient for the building and no surplus electricity will be sent to the grid. The two-way flow of buying and selling electricity between the building and the grid will be considered in our future study. In addition, the electric vehicle units considered can only store and consume surplus electricity while it cannot discharge electricity for the building. Further studies will be conducted by considering the role of dynamic rotating energy storage for the electric vehicle units.