1 Introduction

Under the circumstances of fossil energy shortage and environment issues, the world has paid great attention to renewable energy sources like solar and wind [1, 2]. But due to the high uncertainty of renewable energy, traditional micro-grids which use renewable energy to provide electricity may not be sufficiently stable [3,4,5,6]. To balance supply and load in micro-grids, dispatching has led to great curtailment of renewable energy or large capacity of energy storage. In order to improve the utilization of renewable energy, and adapt to various requirements of energy consumers, hybrid energy systems (HES) have been proposed to connect and balance different energy supplies and enhance robustness of the resulting systems.

There are already many prior works focusing on the operation optimization of multi-source micro-grids and distribution systems containing different kinds of energy production and consumption [7]. Most of the studies focused on economic operating optimization of HES [8,9,10,11]. Others have proposed theoretical modeling and optimization methods to ensure the stability and efficiency of HES [11,12,13]. A hierarchical energy management system for multi-source multi-product micro-grids is proposed in [8], which includes thermal, gas, and electrical management using three control layers under different time scales. Numerical studies were based on a building energy system integrating photovoltaic arrays and micro-turbines. Energy management can cover different kinds of energy, but the hybrid energy system used was very simple, and the application is limited to small scale systems.

Flexibility in hybrid energy system has been studied widely. In [11], a hierarchical framework was developed for an integrated community energy system, with both operating cost minimization and tie-line power smoothing considered as objectives, and thermostatically controlled load was used to smooth the tie-line power according to its demand response potential. An integrated optimal power flow method was developed to obtain the optimal set-points of different components. Thermostatically controlled load, together with battery storage, was also used in [14] for providing micro-grid smoothing services. So far the thermostatically controlled load was only used as demand side response to service the external grid. Thermostatically controlled load has characteristics that allow it to solve many other problems, such as to improve the economic performance of a hybrid energy system.

Therefore, an economic optimization method for hybrid energy system based on the particular characteristics of thermostatically controlled load is proposed in this paper. The main contributions are summarized as follows.

  1. 1)

    A universal hybrid energy system was developed with the ability to add or move components according to practical requirements. In this hybrid energy system, gas, electricity, and heat are coupled with each other to make them more flexible for dispatching.

  2. 2)

    The thermal dynamic characteristics of thermostatically controlled load were linearized, and described as virtual storage in preparation for detailed optimization.

  3. 3)

    An economic optimization method for hybrid energy system based on two time scales was developed. The first time scale is day-ahead economic optimization of a whole day, and the second time scale is heat load adjustment in a particular period to ensure accuracy and efficiency.

This paper is organized as follows. Section 2 presents an overview of a hybrid energy system and the special component characteristics that this paper assumes. Section 3 presents a detailed description of the proposed economic optimization method. Section 4 analyses and discusses the optimization results for a simulated system to illustrate the effectiveness of the proposed method. Conclusions and future expectations are given in section 5.

2 Hybrid energy system description

Hybrid energy systems can have diverse topologies, and consist of different kinds of providers and customers [8, 12, 15]. This paper proposes a universal heating and power hybrid energy system which contains common energy supplies and customers. Components can be easily added to or removed from the universal system according to need.

2.1 Components and connection

The universal hybrid energy system is presented in Fig. 1. This kind of hybrid energy system acts as the energy supply of an area, which has different customers with different consumption behavior, such as an office building, residential building, factory, hospital, school or university, and so on. Regular electricity consumption includes lightning, appliances, heat pumps, and so on, and could be fed by grid power (GP), photovoltaic (PV) generation, wind generation (WG), biomass generation (BG), a combined heating and power unit (CHP) or an electric energy storage system (EESS). Heat consumption includes room heating and hot water, and could be fed by a CHP unit, a gas boiler (GB), a photo-thermal (PT) unit, a heat pump (HP), an electric boiler (EB) or a thermal energy storage system (TESS). Some special components, such as the HP and the EB, play the roles of energy consumer in the electrical system and energy supply in the heating system at the same time.

Fig. 1
figure 1

Universal topology of hybrid energy system

The universal hybrid energy system is used to present all the feasible options. For a particular area, we can choose a suitable energy supply combination from the universal system to constitute a specific energy system according to the local geographical conditions and natural environment.

Based on the topology of the hybrid energy system in Fig. 1, the flows between energy supply, energy storage and load are shown in Fig. 2. In this paper, the utility is taken to be an infinite and stable electric power supply, and the gas company is represented by a constant pressure natural gas source.

Fig. 2
figure 2

Energy flow of hybrid energy system

The electricity and heat systems are coupled with each other by some components in the hybrid energy system. CHP uses gas as source and provides electricity and heat at the same time, and its operation can be represented by the hybrid thermal-electric load model in [16]. Maximum Power Point Tracking is applied to PV and PT units, so their maximum outputs vary along with solar power in real time [17]. The HP and EB use electricity to supply heat.

The electrical and heat systems have their own forms of energy storage, in order to reduce system operating costs and smooth the electric load fluctuation [11]. The EESS and TESS are defined as ideal storage systems by the model in [18].

In this paper, the coupling relationship between heating and electricity is simplified as a linear proportion based on an energy hub model [19, 20].

2.2 Virtual storage characteristic of thermostatically controlled loads

This subsection introduces the storage characteristic of a thermostatically controlled load (TCL). Thermostatically controlled loads have great potential to become an important demand response control technology and a tool for economic operating optimization [14].

In the hybrid energy system there are buildings getting heat from different heat providers. As a typical example of a TCL we consider the rooms in these buildings and the heat provider that is a heating, ventilation and air conditioning (HVAC) system as in [21]. In practice, the HVAC could comprise an electrical heat pump as the heating appliance and a few rooms as heat consumer. Its thermal dynamic process has a certain degree of delay compared with the electrical system, so it can be used to adapt its power requirements according to scheduling requests from the power grid, by switching the HVAC system while maintaining the indoor temperature according to comfort requirements.

In this paper, we assume that there is a two-way communication system, which is available for a central controller to schedule the distributed energy resources, including the HVAC behavior. The indoor temperature set-point can be set by both the consumer and the central controller, and the consumer has a higher priority. The basic thermal dynamic performance of an HVAC system is shown in Fig. 3 [22]. The rising curve represents the temperature performance when the HVAC switch is on, and the falling curve represents the temperature performance when the HVAC switch is off. The indoor temperature rises and falls according to the switch state. Here, \(\left[ {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{T}_{in} ,\bar{T}_{in} } \right]\) represents the indoor temperature range around the temperature set-point \(T_{set}\).

Fig. 3
figure 3

Basic thermal dynamic performance of an HVAC system

We can see that the room temperature is rising when the heat supply is on and falling when the heat supply is off. The indoor temperature variation can be modeled by a simplified thermodynamic model according to [23]:

$$\left\{\begin{array}{l} Q_{1} (t) = Q_{2} (t) + Q_{3} (t) \hfill \\ Q_{1} (t) = A_{1} K_{1} \left( {T_{heat} (t) - T_{in} (t)} \right) \hfill \\ Q_{2} (t) = \rho cV \cdot \frac{{\partial T_{in} (t)}}{\partial t} \hfill \\ Q_{3} (t) = A_{2} K_{2} \left( {T_{in} (t) - T_{out} (t)} \right) \hfill \\ \end{array}\right.$$
(1)

where t is the simulation time; Q1 is the heat that the radiator puts into the room; Q2 is the heat that the indoor air absorbs when the indoor temperature rises; Q3 is the heat that the room dissipates; A1 and A2 are the radiating areas of the radiator and the room respectively; K1 and K2 are the heat radiating coefficients of the radiator and the outer wall of the room; Theat is the heating temperature of radiator; Tin is the indoor temperature; Tout is the outdoor temperature.

To utilize the thermal energy storage characteristic of the HVAC conveniently, we linearize the model described above as follows:

$$\left\{\begin{array}{l} Q_{1} (i) = Q_{2} (i) + Q_{3} (i) \hfill \\ Q_{1} (i) = A_{1} K_{1} \left( {T_{heat} (i) - T_{in} (i)} \right) \hfill \\ Q_{2} (i) = \rho cV \cdot \frac{{T_{in} (i + 1) - T_{in} (i)}}{\Delta t} \hfill \\ Q_{3} (i) = A_{2} K_{2} \left( {T_{in} (i) - T_{out} (i)} \right) \hfill \\ \end{array}\right.$$
(2)

where i counts simulation time intervals and \(\Delta t\) is the duration of a time interval.

If we rewrite the modified model, as in (3), we can see that the difference equation reflects the virtual storage characteristic of the HVAC system. In an electrical energy storage system, power is the output that the EESS provides, and energy is the amount of electricity energy that the EESS stores, and when power is positive, energy will increase, and when power is negative, energy will decrease. Here for an HVAC system, Theat and Tout together play the role of power and Tin plays the role of energy.

$$T_{in} (i + 1) = \left( {1 - \frac{{A_{1} K_{1} \Delta t}}{\rho cV} - \frac{{A_{2} K_{2} \Delta t}}{\rho cV}} \right)T_{in} (i) + \frac{{A_{1} K_{1} \Delta t}}{\rho cV}T_{heat} (i) + \frac{{A_{2} K_{2} \Delta t}}{\rho cV}T_{out} (i)$$
(3)

Using the virtual storage characteristic of the HVAC system, we can dispatch it to improve the economic performance of the whole system.

3 Economic optimization with two time scales using virtual storage

3.1 Framework of economic optimization method

The framework of the proposed economic optimization method for a hybrid energy system is shown in Fig. 4.

Fig. 4
figure 4

Framework of the proposed economic optimization method using two time scales

The economic optimization method includes three steps, as follows.

Step 1: Predict the energy demand and renewable energy supply output in the next 24 h based on weather conditions and generator characteristics, and analyze the thermostatically controlled load capacity in the system. It should be mentioned that this step is the common operating practice for energy systems, and thus it will not be discussed in this paper.

Step 2: Based on demand forecast results, considering energy balance constraints and operating constraints of the whole system, minimize the total operation cost of the day to determine a dispatch schedule for all the controllable energy supplies.

Step 3: On the basis of first scale optimization results, dispatch HVAC within a subset of hours considering comfort constraints, to improve the economic performance and electric load behavior in those selected hours.

3.2 Day-ahead economic operating optimization model

3.2.1 Objective

For the first time scale of optimization, the objective is the minimum of the total operation cost in the next 24 h. We ignore the maintenance and depreciation costs of equipment in this paper, and only consider the expenses of purchasing electricity and natural gas. Because the optimization model is based on the universal hybrid energy system, we can add or remove elements from the equation according to need. The objective is expressed as

$$\left\{ {\begin{array}{l} {{ \hbox{min} }\sum\limits_{i = 1}^{N} {(C_{e} + C_{g} )} } \\ {C_{e} = [C_{elec,b} (i)P_{GP,b} (i) - C_{elec,s} (i)P_{GP,s} (i)]\Delta t} \\ {C_{g} = [C_{gas} V_{CHP} (i) + C_{gas} V_{GB} (i)]\Delta t} \\ \end{array} } \right.$$
(4)

where N is number of time intervals in the day; \(\Delta t\) is the duration of a time interval; Celec,b and Celec,s are the electricity prices for buying and selling over the grid connection; Cgas is the unit price of natural gas; VCHP and VGB are the gas flows into the CHP unit and the GB.

3.2.2 Constraints

  1. 1)

    Energy balance constraints

To maintain electricity balance and thermal energy balance, the energy supply and load should satisfy the constraints in (5). In order to reduce the required computational time, the output characteristics of all the components have been linearized in this paper.

$$\left\{ {\begin{array}{l} {\eta P(i) = L(i)} \\ {\eta = \left[ {\begin{array}{*{20}c} {\eta_{GP,b} \;} & { - 1/\eta_{GP,s} \;} & {\eta_{CHP,e} } & 0 & {\;\eta_{PV} \;} & {\eta_{WG} \;} & {\eta_{BG} \;} & 0 & { - 1/\eta_{HP} \;} & { - 1\;} & 0 & 0 & {\; - 1/\eta_{EESS,c} } & {\;\;\eta_{EESS,d} } \\ 0 & 0 & {\eta_{CHP,h} \;} & {\eta_{GB} } & 0 & 0 & 0 & {\eta_{PT} \;} & 1 & {\eta_{EB} \;} & { - 1/\eta_{TESS,c} \;\;} & {\eta_{TESS,d} } & 0 & 0 \\ \end{array} } \right]} \\ {P(i) = [\begin{array}{*{20}c} {P_{GP,b} (i)} & {P_{GP,s} (i)} & {V_{CHP} (i)} & {V_{GB} (i)} & {P_{PV} (i)} & {P_{WG} (i)} & {P_{BG} (i)} & {P_{PT} (i)} & {P_{HP} (i)} & {P_{EB} (i)} & {P_{TESS,c} (i)} & {P_{TESS,d} (i)} & {P_{EESS,c} (i)} & {P_{EESS,d} (i)} \\ \end{array} ]^{\text{T}} } \\ {L(i) = [\begin{array}{*{20}c} {L_{e} (i)} & {\;\;\sum\limits_{h = 1}^{M} {L_{h} (i,h)} } \\ \end{array} ]^{\text{T}} } \\ \end{array} } \right.$$
(5)

where \(\eta\) is the coefficient matrix; P(i) is a vector of energy supplies at time i; L(i) is a vector of loads at time i; ηGP,b and ηGP,s are the transfer efficiencies with the external power grid when buying and selling electricity; ηCHP,e and ηCHP,h are the gas-electric and gas-heat conversion efficiencies of the CHP unit; ηGB is the efficiency of the GB; ηPV is the efficiency of PV generation; ηPT is the efficiency of the PT unit; ηHP is the efficiency of the HP; ηEB is the efficiency of the EB; ηEESS,d and ηEESS,c are the discharging and charging efficiency of the EESS; ηTESS,d and ηTESS,c are the discharging and charging efficiency of the TESS; PGP,b and PGP,s represent the electricity bought from and sold to the external grid; VCHP represents the gas flow into the CHP unit; VGB represents the gas flow into the GB; PPV denotes the power which PV injects into the system using solar power; PPT denotes the power which the PT unit injects into the system using solar power; PHP denotes the heat power which the HP injects into thermal loads; PEB denotes the heat power which the EB injects into thermal loads; PEESS,d and PEESS,c represent the discharging and charging power of the EESS; PTESS,d and PTESS,c represent the discharging and charging power of the TESS; Le represents the electric load in the hybrid energy system; Lh represents a heating load, and there are M heating loads in the system.

  1. 2)

    Operating constraints of components

Constraints on power exchange with the external power grid are:

$$\left\{ {\begin{array}{l} u_{GP,b} (i) \in \{ 0,1\} \hfill \\ u_{GP,s} (i) \in \{ 0,1\} \hfill \\ {0 \le u_{GP,b} (i) \le 1} \\ {0 \le u_{GP,s} (i) \le 1} \\ {u_{GP,b} (i) + u_{GP,s} (i) \le 1} \\ \end{array} } \right.$$
(6)
$$\left\{ {\begin{array}{*{20}c} {0 \le P_{GP,b} (i) \le u_{GP,b} (i)\overline{P}_{GP,b} } \\ {0 \le P_{GP,s} (i) \le u_{GP,s} (i)\overline{P}_{GP,s} } \\ \end{array} } \right.$$
(7)

where ugrid,b(i)=1 indicates buying from the grid at time i; ugrid,s(i)=1 indicates selling to the grid at time i; buying and selling cannot occur at the same time, which means ugrid,b(i) and ugrid,s(i) cannot be 1 at the same time; \(\bar{P}_{grid,b}\) and \(\bar{P}_{grid,s}\) are the maximum power exchange levels when buying and selling.

Equipment operating constraints are as follow:

$$0 \le V_{CHP} (i) \le \overline{V}_{CHP}$$
(8)
$$0 \le V_{GB} (i) \le \overline{V}_{GB}$$
(9)
$$0 \le P_{PV} (i) \le \overline{P}_{PV} (i)$$
(10)
$$0 \le P_{WG} (i) \le \overline{P}_{WG} (i)$$
(11)
$$0 \le P_{BG} (i) \le \overline{P}_{BG} (i)$$
(12)
$$0 \le P_{PT} (i) \le \overline{P}_{PT} (i)$$
(13)
$$0 \le P_{HP} (i) \le \overline{P}_{HP}$$
(14)
$$0 \le P_{EB} (i) \le \overline{P}_{EB}$$
(15)

where \(\overline{V}_{CHP}\), \(\overline{V}_{GB}\), \(\overline{P}_{PV}\), \(\overline{P}_{WG}\), \(\overline{P}_{BG}\), \(\overline{P}_{PT}\), \(\overline{P}_{HP}\), and \(\overline{P}_{EB}\) are the upper limits of output of the CHP, GB, PV, WG, BG, PT, HP and EB units, among which \(\overline{P}_{PV}\), \(\overline{P}_{WG}\), \(\overline{P}_{BG}\) and \(\overline{P}_{PT}\) have different values at different times of the day, while the others are constant.

  1. 3)

    Energy storage constraints

The constraints of the EESS and the TESS are similar, so consider the EESS as an example to describe the energy storage constraints.

EESS constraints include discharging/charging state, power, and energy constraints as follows:

$$\left\{ {\begin{array}{l} u_{EESS,d} (i) \in \{ 0,1\} \hfill \\ u_{EESS,c} (i) \in \{ 0,1\} \hfill \\ {0 \le u_{EESS,d} (i) \le 1} \\ {0 \le u_{EESS,c} (i) \le 1} \\ {u_{EESS,d} (i) + u_{EESS,c} (i) \le 1} \\ \end{array} } \right.$$
(16)
$$\left\{ {\begin{array}{*{20}c} {0 \le P_{EESS,d} (i) \le u_{EESS,d} (i)\overline{P}_{EESS,d} } \\ {0 \le P_{EESS,c} (i) \le u_{EESS,c} (i)\overline{P}_{EESS,c} } \\ \end{array} } \right.$$
(17)
$$\left\{ {\begin{array}{l} {E_{EESS} (i) = E_{EESS} (i - 1) - P_{EESS,d} (i)\Delta t + P_{EESS,c} (i)\Delta t} \\ {\underline{E}_{EESS} \le E_{EESS} (i) \le \overline{E}_{EESS} } \\ \end{array} } \right.$$
(18)

where uEESS,d(i)=1 indicates discharging at time i; uEESS,c(i)=1 indicates charging at time i; the EESS cannot discharge and charge at the same time, which means uEESS,d(i) and uEESS,c(i) cannot be 1 at the same time; \(\overline{P}_{EESS,d}\) and \(\overline{P}_{EESS,c}\) are the maximum discharging and charging power levels; EEESS(i) is the stored energy (or state of charge) of the EESS at the end of time period i; \(\underline{E}_{EESS}\)and \(\overline{E}_{EESS}\) are the lower and upper limits of stored energy.

3.3 Short-term detailed optimization model in selected periods

Day-ahead economic optimization can work out the minimum operating cost of the whole day, subject to the time resolution \(\Delta t\), but the operating cost of some hours, such as the period of electricity peak load, forms the majority of the whole day cost. The peak load also has negative effects on grid stability. Since electric heating is a big part of the whole electric load, this subsection focuses on detailed adjustment of the HVAC system in particular hours, in order to reduce electric load and thus reduce the operating cost further.

3.3.1 Objective

The objective of the short-term optimization model is the minimum operating cost in a selected period. In addition to fuel and electric power costs, it is assumed there is an operational cost of switching the HVAC system on and off. The objective can be formulated as:

$$\left\{ {\begin{array}{l} {\hbox{min} \sum\limits_{i = 1}^{n} {\left( {C_{e} + C_{g} + C_{s} } \right)} } \\ {C_{e} = \left[ {C_{elec,b} (i)P_{GP,b} (i) - C_{elec,s} (i)P_{GP,s} (i)} \right]\Delta t} \\ {C_{g} = \left[ {C_{gas} V_{CHP} (i) + C_{gas} V_{GB} (i)} \right]\Delta t} \\ {C_{s} = \sum\limits_{j = 1}^{{\sum\limits_{h = 1,2, \ldots ,M} {S_{h} } }} {\left[ {C_{on} w_{on} (i,j) + C_{off} w_{off} (i,j)} \right]} } \\ \end{array} } \right.$$
(19)

where n is the number of time intervals in the selected period; Cs is the cost of switching the HVAC system in this period; Sh is the number of switches of the hth heating load, so that there are \(h = \sum\limits_{1,2, \ldots M} {S_{h} }\) switches altogether in the system; j is the switch number; Con and Coff are the costs of switching any part of the HVAC system on and off, they are caused by maintenance and depreciation of switches, which we assume that they are same on every switch; won and woff indicate switching transitions, with won(i,j)=1 when the jth switch turns off at time i after being on, and woff(i,j) = 1 when the jth switch turns on at time i after being off.

3.3.2 Constraints

  1. 1)

    Energy balance constraints

The energy balance constraints are similar to those of the day-ahead optimization (see (5)), but every HVAC system has several switches that can be on or off. Usually, every building has different heat requirement due to different human activity. So it is convenient to assume every building as a heat load, and there are many switches in the building that can be controlled on or off, one switch controls a group of rooms in the building, and the scale of the building determines the number of switch in it. If there are M buildings in the scenario, and the number of switches in each building is Sh (h=1,2,,M), and the maximum heating load in each building is Lh(i,h), then the new adjusted heating load can be described as:

$$\frac{{\sum\limits_{j = 1}^{{S_{1} }} {u_{on} (i,j)} }}{{S_{1} }} \cdot L_{h} (i,1) + \frac{{\sum\limits_{{j = S_{1} + 1}}^{{S_{1} + S_{2} }} {u_{on} (i,j)} }}{{S_{2} }} \cdot L_{h} (i,2) + \cdots + \,\frac{{\sum\limits_{{j = S_{1} + S_{2} \ldots S_{M - 1} + 1}}^{{S_{1} + S_{2} \ldots S_{M} }} {u_{on} (i,j)} }}{{S_{M} }} \cdot L_{h} (i,M)$$
(20)

where \(u_{on} (i,j) \in \left\{ {0,1} \right\}\) is the state variable of the jth switch at time i.

  1. 2)

    Operating constraints of components

The operating constraints of hybrid energy system components are similar to those for the day-ahead optimization (see (6)–(15)).

  1. 3)

    Energy storage constraints

The energy storage output of the short-term optimization in a selected period is defined to be equal to the energy storage output in the same period obtained from the day-ahead optimization.

  1. 4)

    Virtual storage constraints

There are thermostatically controllable and uncontrollable heating loads in any hybrid energy system, for example, a hospital might be a thermostatically uncontrollable load due to its rigorous heating and cooling requirements. With respect to the controllable loads, the thermal dynamic performance of HVAC systems in different buildings varies according to different functions and different behaviors of its occupants. For example, an office building may require a comfortable temperature in day time when people are working, and in contrast it won’t be an issue if the temperature is lower (though still with the equipment running) in the evening because there is no one in it. Despite these variations, the switch states and indoor temperature of all buildings follow the same virtual storage constraints, but with different indoor temperature set-points.

The virtual storage constraints contains on/off state constraints in (21), the temperature constraints in (22), and switch state transition constraints in (23).

$$\left\{ {\begin{array}{l} u_{on} (i,j) \in \left\{ { 0 , 1} \right\} \hfill \\ u_{off} (i,j) \in \left\{ { 0 , 1} \right\} \hfill \\ {0 \le u_{on} (i,j) \le 1} \\ {0 \le u_{off} (i,j) \le 1} \\ {u_{on} (i) + u_{off} (i) = 1} \\ \end{array} } \right.$$
(21)
$$\left\{ {\begin{array}{*{20}l} {T_{in} (i + 1) = \left( {1 - \frac{{A_{1} K_{1} \Delta t}}{\rho cV} - \frac{{A_{2} K_{2} \Delta t}}{\rho cV}} \right)T_{in} (i) + \frac{{A_{1} K_{1} \Delta t}}{\rho cV}\left( {u_{on} (i,j)T_{on} + u_{off} (i,j)T_{off} } \right) + \frac{{A_{2} K_{2} \Delta t}}{\rho cV}T_{out} (i)} \\ {T_{set} (i) - \delta \le T_{in} (i) \le T_{set} (i) + \delta } \\ {T_{in} (0) = T_{in,firstscale} } \\ \end{array} } \right. $$
(22)
$$\left\{ {\begin{array}{*{20}l} {0 \le w_{on} (i,j) \le 1} \hfill \\ {0 \le w_{off} (i,j) \le 1} \hfill \\ {w_{on} (i,j) \ge u_{on} (i,j) - u_{on} (i - 1)} \hfill \\ {w_{off} (i,j) \ge u_{off} (i,j) - u_{off} (i - 1)} \hfill \\ \end{array} } \right.$$
(23)

where uon(i,j) and uoff(i,j) are state variables of jth switch at time I; since the HVAC switch cannot be on and off at the same time, uon = 1 and uoff = 0 when the HVAC switch is on, uon = 0 and uoff = 1 when the HVAC switch is off, and there are no other conditions allowed; Ton and Toff are the temperatures of the radiator when HVAC switch is on and off, respectively; Tset is the indoor temperature set-point with allowable deviation \(\delta = 4\,^\circ {\text{C}}\); Tin(0) is the initial temperature of the short-term optimization, which is equal to the temperature in the same period obtained from day-ahead optimization.

The day-ahead economic operating optimization model and the short-term detailed optimization model are both Mixed Integer Linear Programming (MILP) problems. They can be solved efficiently by advanced optimization solvers, such as the IBM ILOG CPLEX Optimizer, making them suitable for robust online application. The robust convergence of this kind of optimization problem solved this way has been discussed and proved in [24,25,26].

4 Case study

4.1 Description

  1. 1)

    Basic configuration

The case study is based on a demonstrator in Tianjin, China, the State Grid Customer Service North Centre. There are mainly 6 types of building in this demonstrator, including business, office, factory and residential buildings, each with different consumption behaviors. The supplies satisfying the energy consumption in this scenario include GP, CHP, PV, PT, HP, EB, EESS and DESS. Their basic parameters are shown in Table 1.

Table 1 Basic parameters of energy supplies and storage

Different types of building have different floor areas, and therefore different numbers of switches to control the HVAC systems. In this case study, one switch is designed to cover a group of rooms in the building, 20-30 rooms, with total area about 1500 square meters on average. The number of switches in each thermostatically controllable building Sh is shown in Table 2.

Table 2 Number of switches in buildings in the case study

According to construction practices in Tianjin, North China, the thermal parameters including radiating ratio K1, radiating area of the radiator A1, radiation coefficient of a typical room K2, average outer wall area of typical room A2, average air density \(\rho\), average heat capacity c and average room volume V are given in Table 3.

Table 3 Value of thermal parameters
  1. 2)

    Load data

Daily load data for the State Grid Customer Service North Centre have been obtained, and a typical load profile is shown in Table 4.

Table 4 Heating and electric load data
  1. 3)

    Renewable energy data

Solar energy is the only renewable energy in this demonstration. The day-ahead predicted PV output profile and electric load profile are shown in Fig. 5.

Fig. 5
figure 5

Day-ahead predicted PV output and electric load

We can see from Fig. 5 that the electric load is much higher than the PV output, so we can use Maximum Power Point Tracking technology and maintain 100% use of renewable energy.

  1. 4)

    Energy price

Time-of-use electricity pricing that applies in Tianjin is used in this case study. The electricity price profile and the constant natural gas price profile are shown in Fig. 6.

Fig. 6
figure 6

Natural gas price profile and electricity price profile

4.2 Results and analysis

The economic optimization model is formulated in MATLAB with YALMIP, and solved by the IBM ILOG CPLEX Optimizer. The total optimization time of two time scales is about 5 min, and the convergence index is lower than 0.1%.

  1. 1)

    Day-ahead economic operating results

In this case, the peak load period is from 7 p.m. to 10 p.m., and this is selected as the period for short-term optimization. The minimum operating cost for the whole day and for the peak load period are shown in the first row in Table 5, and the corresponding energy supply compared with load is shown in Fig. 7 for electrical supply and load and Fig. 8 for heating supply and load.

Table 5 Operating cost comparison
Fig. 7
figure 7

Electric load and energy supply resulting from day-ahead optimization

Fig. 8
figure 8

Heating load and energy supply resulting from day-ahead optimization

We can see from the result that the particular period is 1/6 of the whole day, but the operating cost for that period is over 1/3 of the whole day cost. Therefore, applying the short-term optimization to this period can significantly reduce the overall cost.

  1. 2)

    Short-term optimization results in peak load hours

A simulation time step of 10 min was used during the peak load period from 19:00 to 22:00. The operating costs for this selected period and for the full day are shown in Table 5.

It is observed that the operating cost during the peak load period has been reduced by 13,163 yuan after the short-term optimization, and the total operating cost has been reduced by the same amount. This means the short-term optimization can lead to better economic performance for this kind of hybrid energy system.

The comparison between adjusted heating load and original heating load is shown in Fig. 9. From this we can see that the total heating load in the peak load period is much lower and fluctuating greatly compared to the original data. However, because of the virtual storage characteristic of the HVAC system, the indoor temperature is still in the permitted range, as shown in Fig. 10. Meanwhile, the peak electricity power imported from the external grid in this period is 10,940 kW, which is 442 kW lower than the day-ahead optimization result. That is to say, the peak load has been reduced to some extent.

Fig. 9
figure 9

Comparison between original and adjusted heating load

Fig. 10
figure 10

The adjusted indoor temperature

Taking the 4nd HVAC system in the “Office 1” building as an example, the switch state and indoor temperature variation are shown in Fig. 10. The indoor temperature fluctuated around the temperature set-point within the permitted range. In this case study, the demonstrator has different kinds of building, with different temperature requirements. The indoor temperature variation shown in Fig. 10 was selected randomly from all of the HVAC systems in this scenario, and reflects the temperature fluctuation of a group of rooms in one office building in the selected peak load period. This building would hardly have any people in it in this period of the day, so the indoor temperature set-point is reduced during the selected period and is about 2 °C lower than normal at the end of the period. This would reduce the operating cost in this building in this period. That is to say, economic optimization on two time scales can satisfy the building demand while improving the economic performance of the whole system.

5 Conclusion

This paper proposed an economic optimization method on two time scales for a hybrid energy system, based on virtual storage characteristics of thermostatically controlled loads. The optimization considered customer temperature requirements. Based on temperature constraints and operating results from day-ahead optimization, the heat load dispatching was optimized on a shorter time scale to improve accuracy and efficiency. The effectiveness of this method is illustrated by a case study based on the State Grid Customer Service North Centre in Tianjin, China. The benefit of using thermostatically controlled load as virtual storage to improve economic performance, while ensuring customer requirements, has been proved.

A general conclusion is that, if we weaken the temperature constraint and make the heat load controllable, the load will have similar role to energy supply and can be dispatched. The range of adjustment of energy supply is limited, so the traditional approach of adjusting supply to meet the load and get better economic performance is circumscribed. When the load and supply are both adjustable, a more effective operating method is available. That is to say, thermostatically controlled load can play an important role in improving economic performance of hybrid energy systems.

Beyond economic performance, there are many other benefits that we can focus on in the future, by using the virtual storage characteristics of thermostatically controlled load. Valuable goals that can be approached include improving the stability of the larger scale grid, presenting a feasible strategy for the customers to engage in the electrical market or using hybrid energy systems to participate in the operation of an active distribution network.