Optimal Operation of Combined Heat and Power System Based on Forecasted Energy Prices in Real-Time Markets

This paper develops a discrete operation optimization model for combined heat and powers (CHPs) in deregulated energy markets to maximize owners’ profits, where energy price forecasting is included. First, a single input and multi-output (SIMO) model for typical CHPs is established, considering the varying ratio between heat and electricity outputs at different loading levels. Then, the energy prices are forecasted with a gray forecasting model and revised in real-time based on the actual prices by using the least squares method. At last, a discrete optimization model and corresponding dynamic programming algorithm are developed to design the optimal operation strategies for CHPs in real-time. Based on the forecasted prices, the potential operating strategy which may produce the maximum profits is pre-developed. Dynamic modification is then conducted to adjust the pre-developed operating strategy after the actual prices are known. The proposed method is implemented on a 1 MW CHP on a typical day. Results show the optimized profits comply well with those derived from real-time prices after considering dynamic modification process.


Introduction
The combined heat and power (CHP) system produces heat and electricity with high efficiency by consuming oil, natural gas, and biomass, etc.
[1]. The well-known cogeneration system has been considered to be the most promising alternative to traditional energy supplying systems. Compared to conventional generation of heat and electricity in a decoupled way, the overall efficiency of the co-generating technique can reach up to 70%-80% [2,3]. As a low-carbon, cost-effective, and high energy conversion efficiency technology, the total capacity of CHP is expected to reach 483.7 GW in 2023 worldwide [4].
Generally, CHPs' operating strategies are categorized into two groups: heat lead (HL) and electricity lead (EL) [5]. For HL CHPs, they are operated mainly to satisfy heat load and the heat deficit is imported from auxiliary boilers, district heating or heating grid [6]. While for EL CHPs, electric loads are satisfied first and the deficient demand is provided from the power grid. The main drawback for the two types of CHPs is the inflexibility between electric and heat output. Heat to power ratio (HTPR) is introduced to characterize the heat and electric output proportion, which is also closely linked with overall efficiency and loading level of CHPs [7,8]. Thus, CHPs can be operated at different loading levels to serve various heat and electric loads.
The existing literatures on CHP operation mainly concentrate on achieving economic goals (e.g., low operation cost, reduction of fuel consumption) and environmental goals (e.g., low carbon dioxide emission). The output of CHP is optimized to minimize the annual operating and maintaining costs of the whole system in [9]. The heat and electric loads are supposed to be known, which might lead to inaccuracy if actual demand diverts greatly from the forecasted demand. The least-cost operating strategy for CHPs is studied in [10], and results show that the strategy does not mean the lowest carbon dioxide emission. Thus in [11], the optimal strategy for CHPs is studied by taking several indicators into account, including the least energy consumption, the lowest operation cost and the lowest carbon dioxide emission. The main disadvantage of the mentioned literatures is that energy prices are supposed to be constant for a long period of time. As a result, the CHPs are not optimized in real-time, failing to reflect the actual conditions.
In order to address the problem, various optimization algorithms have been proposed to achieve real-time energy management. A comprehensive review of modeling methods, planning approaches (various indicators are introduced) and energy management algorithms for a combined cooling, heat, and power (CCHP) microgrid are presented in [12]. An online algorithm is devised in [13] for real-time energy management. The algorithm is superior to conventional dynamic programming approaches in realization of arbitrary energy prediction errors. An optimal power management strategy for hybrid energy systems is presented in [14], aiming to minimize the total cost and fuel emissions. In [15], the optimal size of a CHP-plant with thermal store is analyzed in the Germany spot market to maximize the profits, where only the electricity spot price is considered and the other prices (those of heat and gas) are supposed to be constant. In [16], a CHP-based district heating system with renewable energy source and energy storage system is optimized by using LP (linear programming) method, where the overall costs of net heat and power acquisition is minimized effectively. A model predictive control strategy is proposed for the CHP to achieve effective demand response in [17]. The results show the cost reductions for the households reach their highest when the real-time energy prices fluctuate strongly. Reference [18] proposes a smart hybrid renewable energy for communities (SHREC) system, where both thermal and electricity markets are considered. A planning model is developed for the SHREC system and optimized by using the LP algorithm, whose effectiveness and flexibility are verified through specific calculation results.
All the aforementioned literatures proposed effective approaches to design optimal operating strategy for the CHP from different aspects. While during the research, the real-time energy prices are assumed to have been already known. However, in real-time markets, the prices of electricity, heat, and natural gas are not known in advance. The operation schedules of CHPs are pre-developed based on forecasted prices or load conditions. On the other hand, the influence of loading level on overall efficiency and HTPR of CHPs is not considered either. The overall efficiency is generally in positive correlation with the loading level of CHPs, i.e., a high loading level means high overall efficiency. Another problem for existing researches is that the profit optimization of CHP considering the forecast prices is neglected, where the profits of pre-developed operating strategy differ greatly from those of adjusted strategy in response to actual prices. In deregulation energy markets, the profits are key incentive for CHP owners. Thus, to optimize the profits of CHPs in real-time, there are several challenges: (i) to determine the heat and electricity output proportion, i.e., HTPR; (ii) to forecast energy prices; (iii) to adjust pre-developed operating strategies to comply with actual conditions.
A discrete operation optimization model is developed in this paper to devise the optimal operation strategy for CHPs in real-time, where the profits reach the maximum. First, the SIMO (single input and multi-output) CHP model is established, where both the overall efficiency and HTPR are in variation with the loading level. Then, energy prices, including that of heat, electricity and natural gas, are forecasted by the gray forecasting model GM(1,n) (i.e., first-order, n variables grey model) and revised with actual prices by using the least square method. Finally, a discrete optimization model is developed to obtain the optimal operating points, which may produce maximum profits. The profits are optimized every 30 min, which determine the heat and electricity output in real-time. Then the operating strategy is pre-developed based on the forecasted prices. A dynamic programming algorithm is proposed to adjust the pre-developed strategy after actual prices are known, where the maximum profits are achieved through reducing the profit loss during the modification to the least. The proposed model and optimization approach are demonstrated with a 1MW CHP under different loading levels.
The novelty of this paper is that it: (i) introduces varying HTPR with respect to the loading level of CHP, which is fixed in most previous research; (ii) proposes a discrete optimization model to project the indication optimal operating points which may produce potential maximum profits; (iii) proposes a dynamic programming algorithm to obtain the maximum profits based on actual and forecasted energy prices.
The remaining parts of this paper are organized as follows. In Section 2, the SIMO model for CHP is established, whose overall efficiency and HTPR both vary with the loading level. The price forecasting method is presented in Section 3. Then the discrete optimization model for CHP is developed in Section 4, followed by the dynamic programming algorithm. In Section 5, a 1 MW CHP is optimized with the proposed approach. Finally, conclusions are drawn in Section 6.

Basic Diagram of Combined Heat and Power
The main characteristic of CHPs is that they reuse waste heat from prime mover during electricity generation processes to serve thermal loads, which is superior to traditional boilers. Extraction-condensing steam turbine-based CHP is very popular because the ratio between heat and electricity output could be adjusted according to various loading ratios between the two loads, providing more flexibility during peak and off-peak hours [19]. A typical CHP system consists of a combustion chamber, a turbine generator and a heat recovery boiler according to [20]. The SIMO model of CHP can then be established, shown in Figure 1.
In the SIMO model of CHP, two key parameters should be determined first: overall energy conversion efficiency and HTPR.
Energies 2015, 8, page-page A dynamic programming algorithm is proposed to adjust the pre-developed strategy after actual prices are known, where the maximum profits are achieved through reducing the profit loss during the modification to the least. The proposed model and optimization approach are demonstrated with a 1MW CHP under different loading levels.
The novelty of this paper is that it: (i) introduces varying HTPR with respect to the loading level of CHP, which is fixed in most previous research; (ii) proposes a discrete optimization model to project the indication optimal operating points which may produce potential maximum profits; (iii) proposes a dynamic programming algorithm to obtain the maximum profits based on actual and forecasted energy prices.
The remaining parts of this paper are organized as follows. In Section 2, the SIMO model for CHP is established, whose overall efficiency and HTPR both vary with the loading level. The price forecasting method is presented in Section 3. Then the discrete optimization model for CHP is developed in Section 4, followed by the dynamic programming algorithm. In Section 5, a 1 MW CHP is optimized with the proposed approach. Finally, conclusions are drawn in Section 6.

Basic Diagram of Combined Heat and Power
The main characteristic of CHPs is that they reuse waste heat from prime mover during electricity generation processes to serve thermal loads, which is superior to traditional boilers. Extraction-condensing steam turbine-based CHP is very popular because the ratio between heat and electricity output could be adjusted according to various loading ratios between the two loads, providing more flexibility during peak and off-peak hours [19]. A typical CHP system consists of a combustion chamber, a turbine generator and a heat recovery boiler according to [20]. The SIMO model of CHP can then be established, shown in Figure 1.
In the SIMO model of CHP, two key parameters should be determined first: overall energy conversion efficiency and HTPR.

Overall Energy Conversion Efficiency
As shown in Figure 1, the output of a CHP system mainly includes four parts: electricity, heat, and unavoidable heat loss and exhaust gas emissions, while only the heat and electricity output are called useful energy. The overall energy conversion efficiency of a CHP is expressed as: where η is the overall efficiency; Q Σ is the useful energy converted from natural gas, which is also the total energy of heat and electricity, in kJ; G is the energy of natural gas, in kJ. In most existing research, the nominal value of η is adopted. However, η is found to be changing with different loading levels and operating modes of CHPs [21]. The overall efficiency is mainly determined and affected by the loading level and generally, expressed as:

Overall Energy Conversion Efficiency
As shown in Figure 1, the output of a CHP system mainly includes four parts: electricity, heat, and unavoidable heat loss and exhaust gas emissions, while only the heat and electricity output are called useful energy. The overall energy conversion efficiency of a CHP is expressed as: where η is the overall efficiency; Q Σ is the useful energy converted from natural gas, which is also the total energy of heat and electricity, in kJ; G is the energy of natural gas, in kJ.
In most existing research, the nominal value of η is adopted. However, η is found to be changing with different loading levels and operating modes of CHPs [21]. The overall efficiency is mainly determined and affected by the loading level and generally, expressed as: where L is CHP's loading condition. A typical curve of η is shown in Figure 2, which is derived from [22]. When the CHP's loading is lower than L 1 , η is zero, indicating that it is not economic to run the CHP because the cost is higher than its income. When the CHP is fully loaded, η reaches its nominal value, denoted by η N (about 90%). As shown in Figure 2, the curve of η is divided into five sections. At low loading level, η increases more rapidly than that at high loading level. where L is CHP's loading condition.
A typical curve of η is shown in Figure 2, which is derived from [22]. When the CHP's loading is lower than L1, η is zero, indicating that it is not economic to run the CHP because the cost is higher than its income. When the CHP is fully loaded, η reaches its nominal value, denoted by ηN (about 90%). As shown in Figure 2, the curve of η is divided into five sections. At low loading level, η increases more rapidly than that at high loading level. In Figure 2, η1, η2, η3, and η4 are the overall efficiency of CHP in response to loading level: L1, L2, L3, and L4 respectively, which can be modeled as a discrete function: The field test is usually conducted by the manufacturers to obtain the efficiency data under different loading levels. The η-load curve of a CHP is then got through curve fitting.

Heat to Power Ratio
Although CHPs are able to provide heat and electricity simultaneously, there is a fixed relation between the two products. To study the ratio between heat and electricity, E γ and H γ , are introduced.
The HTPR of CHPs is defined as the ratio of the heat output to the electricity output, which In Figure 2, η 1 , η 2 , η 3 , and η 4 are the overall efficiency of CHP in response to loading level: L 1 , L 2 , L 3 , and L 4 respectively, which can be modeled as a discrete function: The field test is usually conducted by the manufacturers to obtain the efficiency data under different loading levels. The η-load curve of a CHP is then got through curve fitting.

Heat to Power Ratio
Although CHPs are able to provide heat and electricity simultaneously, there is a fixed relation between the two products. To study the ratio between heat and electricity, γ E and γ H , are introduced.
where E CHP is the energy of electricity generated by CHP, in kJ; H CHP is the energy of heat generated by CHP, in kJ; γ E and γ H are just used to describe the energy proportion of E CHP and H CHP , respectively, and there is no practical significance for them. By substituting Equation (1) into Equation (4), the output of CHP can be expressed in another form: where γ E η is usually called electric efficiency of CHP, also denoted by η E ; γ H η is usually called the heat efficiency of CHP, also denoted by η H . Apparently, γ E and γ H naturally satisfy: The HTPR of CHPs is defined as the ratio of the heat output to the electricity output, which reflects the ability of CHPs to meet heat and electric demand. The HTPR of CHPs, denoted by ζ, is expressed as: According to [23], the loading level will influence the HTPR, but the specific relation between them is not addressed. Based on the research in [24,25], the ζ-load curve should be a step function with several intervals. A typical ζ-loading level curve is shown in Figure 3.
According to [23], the loading level will influence the HTPR, but the specific relation between them is not addressed. Based on the research in [24,25], the  -load curve should be a step function with several intervals. A typical  -loading level curve is shown in Figure 3.
. Relation between  and loading level.
From Figure 3, the step function for  can be expressed as: In Figure 3, there are five sections for the  -load curve: including four non-zero sections and a zero section. When the loading level is less than 1 L , the CHP does not work, and the HTPR is zero, correspondingly. The higher the loading level is, the lower the HTPR will be. At low loading level, the heat efficiency is higher than electricity efficiency. At high loading level, the overall efficiency of CHP increases a lot, and the electricity efficiency increases correspondingly. More generally, the relation between ζ and the overall efficiency of CHP is also studied in [26]. If the efficiency reaches certain threshold, the CHP will then be operated at a new HTPR.

Price Forecasting
When optimizing the operation strategy of CHPs to achieve maximum profits, energy prices should also be determined. In the wholesale market, electric price varies at 30-min resolution. The real-time price of natural gas and heat are supposed to be varying every 30 min as well in the study. Each price interval is also called a dispatching step and therefore there are 48 dispatching steps in one day. Usually, the real-time prices of the kth dispatching step are not known until beforehand. Thus, the operation schedules of CHPs should be pre-determined based on forecasted prices. The real-time energy prices fluctuate with the load of the energy system, the climate and so on. However, there is still strong regularity compared to the history prices for the same time in one day.
For the energy prices are relevant to several factors, the gray forecasting model GM(1,n) [27] is adopted in this paper to forecast the energy prices. In the model, "1" means the first-order differential equations are used and "n" is the number of relevant variables. Suppose the price to be forecasted at t is 1 x , and the historical price series is x i is the historical price for different days at t . The relevant variable (including load, climate and etc.) sequences are: From Figure 3, the step function for ζ can be expressed as: In Figure 3, there are five sections for the ζ-load curve: including four non-zero sections and a zero section. When the loading level is less than L 1 1 , the CHP does not work, and the HTPR is zero, correspondingly. The higher the loading level is, the lower the HTPR will be. At low loading level, the heat efficiency is higher than electricity efficiency. At high loading level, the overall efficiency of CHP increases a lot, and the electricity efficiency increases correspondingly. More generally, the relation between ζ and the overall efficiency of CHP is also studied in [26]. If the efficiency reaches certain threshold, the CHP will then be operated at a new HTPR.

Price Forecasting
When optimizing the operation strategy of CHPs to achieve maximum profits, energy prices should also be determined. In the wholesale market, electric price varies at 30-min resolution. The real-time price of natural gas and heat are supposed to be varying every 30 min as well in the study. Each price interval is also called a dispatching step and therefore there are 48 dispatching steps in one day. Usually, the real-time prices of the kth dispatching step are not known until beforehand. Thus, the operation schedules of CHPs should be pre-determined based on forecasted prices. The real-time energy prices fluctuate with the load of the energy system, the climate and so on. However, there is still strong regularity compared to the history prices for the same time in one day.
For the energy prices are relevant to several factors, the gray forecasting model GM(1,n) [27] is adopted in this paper to forecast the energy prices. In the model, "1" means the first-order differential equations are used and "n" is the number of relevant variables. Suppose the price to be forecasted at t is x 1 , and the historical price series is X 0 1 "`x 0 1 p1q , x 0 1 p2q ,¨¨¨, x 0 1 pmq ,¨¨¨x 0 1 pMq˘, where x 0 1 piq is the historical price for different days at t. The relevant variable (including load, climate and etc.) sequences are: (   9) where X 0 i , i " 2, 3,¨¨¨, n is the historical value series for the ith variable in M days at the fixed time t; x 0 i pmq is historical value of the ith variable in the mth day. Then calculate the 1-AGO (accumulated generating operation) sequence for each relevant variable to reduce the randomness of the data: where i " 2, 3,¨¨¨, n and x p1q i pkq " The adjacent mean value sequence for X p1q i is calculated as follows: where i " 2, 3,¨¨¨, n and z i , x 1 is obtained with the GM p1, nq model. The forecasting method mentioned above is applied in each dispatching step to get the forecasted prices for heat, electricity, and natural gas in one day.
After the actual prices for heat, electricity, and natural gas are known at the start of kth dispatching step, the forecasted prices for the (k + 1)th dispatching step should be revised with certain method. Suppose the forecast prices for k + 1 dispatching steps are X pFq " x pFq p1q , x pFq p2q , x pFq p3q ,¨¨¨, x pFq pk`1q¯, which are obtained from the gray forecasting model, and the actual prices for k dispatching steps are X pAq "´x pAq p1q , x pAq p2q , x pAq p3q ,¨¨¨, x pAq pkq¯.
The fitting price curves for X pFq and X pAq can then be obtained by using the least squares method, as shown in Figure 4.
where 0 , 2,3, , is the historical value series for the ith variable in M days at the fixed time t; x m is historical value of the ith variable in the mth day.
Then calculate the 1-AGO (accumulated generating operation) sequence for each relevant variable to reduce the randomness of the data: The adjacent mean value sequence for   1 i X is calculated as follows: x is obtained with the   1, GM n model. The forecasting method mentioned above is applied in each dispatching step to get the forecasted prices for heat, electricity, and natural gas in one day.
After the actual prices for heat, electricity, and natural gas are known at the start of kth dispatching step, the forecasted prices for the (k + 1)th dispatching step should be revised with certain method. Suppose the forecast prices for k + 1 dispatching steps are x k , which are obtained from the gray forecasting model, and the actual prices for k dispatching steps are The fitting price curves for   F X and   A X can then be obtained by using the least squares method, as shown in Figure 4.  In Figure 4, l A is the fitting curve for X pAq and a new forecasted price x pFq 1 pk`1q (denoted by a small circle) for the (k + 1)th dispatching step is obtained. l F in red is the fitting curve for X pFq . The blue curve l 1 F is obtained by using the least square method, whose square of distance to l A and l F is the minimum. At last, the revised forecasted price x pFq 2 pk`1q (denoted by a small solid square) is obtained, which is in the curve l 1 F .

Discrete Optimization Model for Combined Heat and Power
In the wholesale market, electricity, heat and natural gas prices all vary at 30-min resolution, denoted by p E , p H and p G , respectively. Thus, CHPs could be operated according to the combination of the three prices to maximize benefits in the 48 dispatching steps.
In the kth dispatching step, the profit is calculated by: where PRO is abbreviation of profit and PRO CHP pkq denotes the profit in the kth step; I H pkq and I E pkq are the income from selling heat and electricity, respectively; C G pkq is the cost of buying natural gas. Equation (12) can be further written as follows: where V G pkq is the volume of natural gas consumed in the kth dispatching step; p H pkq, p E pkq and p G pkq are the prices of heat, electricity and natural gas in the kth dispatching step respectively. Usually, the energy contained in a cubic meter of natural gas is a constant, denoted by q, in kJ/m 3 . Thus the total energy injected into the CHP in the kth step is expressed as: Through substituting Equation (6) into Equation (7), γ H and γ E are obtained and shown as follows: By substituting Equations (5), (14) and (15) into Equation (13), the objective function of CHP is obtained, given by: To solve the objective function Equation (16), we define a new variable PRO CHP_base pkq, which means the profit obtained through consuming a cubic meter of natural gas by CHP: Obviously, as long as PRO CHP_base pkq reaches its maximum, the maximum value of PRO CHP pkq will be obtained. In Equation (17), after ζ, p H pkq, p E pkq, and p G pkq are all determined in the kth dispatching step, PRO CHP pkq is just a function of η, which is quite easy to solve.
There are also a set of constraints which must be satisfied during optimization.

Output Constraints
The heat and electricity outputs of CHP must vary between their maximum and minimum capacities, respectively: where H CHP,min and H CHP,max are allowable minimum and maximum heat outputs of CHP; E CHP,min and E CHP,max are the allowable maximum electricity outputs of CHP.

Input Constraints
The input of CHP is the natural gas only and the input should be limited between its minimum and nominal value due to capacity limits of CHP: where S N is the rated capacity of CHP; V G,min and V GN are the allowable minimum and nominal input volume of natural gas respectively.

Ramp Constraints
The output power of CHP between two consecutive dispatching steps cannot be modified randomly, which is constrained by a certain ramp rate of CHP. The whole process is modeled by: where Q Σ pk´1q and Q Σ pkq are the useful energy converted from natural gas by CHP in the pk´1q th and kth dispatching step, respectively; τ ramp is the ramp capacity of CHP, in kW/min; ∆T is the discrete time step length of 30 min. By submitting Equations (4) and (15) into Equation (20), the heat and electricity outputs ramp constraints of CHP are:

Solution for the Model
In actual application of CHPs, η is described with a series of data from field test. A discrete method is proposed to solve the optimization model. In this paper, the typical loading levels in Figures 2 and 3 are shown in Table 1.   By combining Figures 2 and 3 the relation between ζ and η is rather clear, as shown in Figure 5. In Figure 5, there are mainly seven intervals where CHP could be operated at corresponding efficiency and HTPR. The seven intervals are shown in Table 2.

Intervals
Overall Efficiency HTPR Interval type  (17) in the six non-zero intervals, respectively, the maximum profit for each interval will be obtained. Take the case in Interval II as an example. In this interval, a fixed step of L is adopted, which is denoted by I L  . Then a series profit can be obtained, shown as: The results obtained from Equation (22)

Dynamic Programming
Based on the forecasted prices of heat, electricity, and natural gas, the indication optimal operation points for CHP in one day can be obtained and corresponding operating schedules are

Intervals
Overall Efficiency HTPR Interval type In Table 2, there are one zero interval (Interval I) and six non-zero intervals (from Interval II to Interval VII). In the kth dispatching step, the forecasted p H pkq, p E pkq and p G pkq are all constant. Through solving Equation (17) in the six non-zero intervals, respectively, the maximum profit for each interval will be obtained.
Take the case in Interval II as an example. In this interval, a fixed step of L is adopted, which is denoted by ∆ L I . Then a series profit can be obtained, shown as: The results obtained from Equation (22) where PRO CHP_base,max pkq is the maximum value of PRO CHP_base pkq in the kth dispatching step; PRO piq CHP_base,max pkq is the maximum value of PRO CHP_base pkq in the ith interval.

Dynamic Programming
Based on the forecasted prices of heat, electricity, and natural gas, the indication optimal operation points for CHP in one day can be obtained and corresponding operating schedules are pre-developed. Since the actual prices for each dispatching step are known at its beginning, certain modification has to be made to the operating schedule to obtain the actual maximum profits for CHP.
From ∆T to 2∆T, the optimal operation points with maximum profits are obtained first based on forecasted prices. Around ∆T, the loading level is to be modified to the optimal loading level of the following dispatching step. The whole process is presented in Figure 6. L pmq ∆T is the optimal loading level obtained based on the actual prices of 0-∆T, where the profit of CHP is the maximum.
The loading level is modified from 70% to L pmq ∆T at the ramp rate of CHP. At ∆T, the actual prices for ∆T-2∆T are known immediately and the corresponding optimal loading level is L pmq 2∆T,A . The load has the characteristic of retaining unchanged during a short period, which is reflected as the retaining characteristic of price. Thus, the CHP should be modified to the target optimal operation point when it is different from the current one.
Energies 2015, 8, page-page modification has to be made to the operating schedule to obtain the actual maximum profits for CHP.
From ΔT to 2ΔT, the optimal operation points with maximum profits are obtained first based on forecasted prices. Around ΔT, the loading level is to be modified to the optimal loading level of the following dispatching step. The whole process is presented in Figure 6. the characteristic of retaining unchanged during a short period, which is reflected as the retaining characteristic of price. Thus, the CHP should be modified to the target optimal operation point when it is different from the current one. For different relationship between the actual prices and forecasted prices, the actual maximum loading level may be higher or lower than the forecasted maximum loading level, named as Case 1 and Case 2, respectively.

Case 1
In Case 1, the forecasted optimal loading level   To decide which route is better, the profit during the two modification processes should be calculated first. The two routes are denoted by A C H F     and A D E F     , respectively.
(1) Route A C H F     In 0-ΔT, the pre-modification time ΔT' can be calculated as follows: where L  is the ramp rate and L r a m p N S    .
At ΔT, the loading level is modified to   2 T,A m L  directly and ends at F. The overall profit during the modification process from A' to F is: For different relationship between the actual prices and forecasted prices, the actual maximum loading level may be higher or lower than the forecasted maximum loading level, named as Case 1 and Case 2, respectively.

Case 1
In Case 1, the forecasted optimal loading level L pm,1q 2∆T,F , obtained from the revised forecasted prices, is lower than L pmq 2∆T,A . There are two potential operation routes: In the first route, L pmq ∆T is modified to L pm,1q 2∆T,F in advance, and then modified to L pmq 2∆T,A at ∆T directly. In the second route, CHP is operated at L pmq ∆T until ∆T, and then modified to L pmq 2∆T,A directly.
To decide which route is better, the profit during the two modification processes should be calculated first.
The two routes are denoted by A 1 Ñ C Ñ H Ñ F and A 1 Ñ D Ñ E Ñ F , respectively.
(1) Route A 1 Ñ C Ñ H Ñ F In 0-∆T, the pre-modification time ∆T' can be calculated as follows: where δ L is the ramp rate and δ L " τ ramp {S N . At ∆T, the loading level is modified to L pmq 2∆T,A directly and ends at F. The overall profit during the modification process from A' to F is: where PRO p∆Tq pLq is the profit-loading curve in 0-∆T, PRO p2∆Tq pLq is the profit-loading curve in ∆T-2∆T.
The loading level keeps unmodified until D and modified to L pmq 2∆T,A . During the whole process, the forecast optimal loading level L pm,1q 2∆T,F does not affect the operating schedule. The overall profit is: Based on PRO p1q A and PRO p1q B , the optimal modification route with the maximum profit can then be determined. If

Case 2
In Case 2, the forecast optimal loading level is L pm,2q 2∆T,F , which is also obtained from the revised forecasted prices, is higher than L pmq 2∆T,A . There are also two potential operation routes.
In the first route, L pmq ∆T is pre-modified to L pm,2q 2∆T,F , and then decreased to L pmq 2∆T,A at ∆T. In the second route, CHP is operated at L pmq ∆T until ∆T, and then modified to L pmq 2∆T,A . The second route is almost the same with that in Case 1.
The two routes are denoted by A Ñ B Ñ G Ñ F and A Ñ D Ñ E Ñ F , respectively.
(1) Route A Ñ B Ñ G Ñ F In 0-∆T, the pre-modification time ∆T" is determined as follows: The actual prices for ∆T-2∆T are known at B. Then the loading level of CHP is modified to G and ended at F. The overall profit for the modification process is expressed as: The route is almost same with that in Case 1, with a different beginning point A. The overall profit for the modification process is calculated by: Based on PRO p2q A and PRO p2q B , the optimal modification route can be obtained.
The same way is applied to each 2∆T time window, which starts at k∆T and ends at pk`2q ∆T, to obtain the optimal modification route for one day. During the whole process, the price forecasting is considered, which is more practical in real-time markets.

Demonstration Examples
In this paper, a 1 MW CHP is optimized based on the proposed method. The other technical parameters of the CHP are presented in Table A1 in the appendix.
The prices of electricity, heat, and natural gas are forecasted by using the gray forecasting model and revised in real-time with the least square method, where the actual prices are from [28]. The results are shown in Figure 7.
As shown in Figure 7, the energy prices are forecasted accurately by using the proposed method. The variances between the actual and forecasted price of electricity, heat and gas are 0.023, 0.00011, and 0.00018, respectively. In Figure 7a, the forecasted price is almost the same with its actual value when the price curve is flat, between 0:00 and 7:00, 16:00 and 19:30, 21:00 and 24:00 When the price changes suddenly, which reflects the sudden change of the electric loads, there will exist certain error between the actual and forecasted prices. The case happens at 10:00 and 13:00. The similar phenomenon also occurs in Figure 7b,c.

Demonstration Examples
In this paper, a 1 MW CHP is optimized based on the proposed method. The other technical parameters of the CHP are presented in Table A1 in the appendix.
The prices of electricity, heat, and natural gas are forecasted by using the gray forecasting model and revised in real-time with the least square method, where the actual prices are from [28]. The results are shown in Figure 7.
As shown in Figure 7, the energy prices are forecasted accurately by using the proposed method. The variances between the actual and forecasted price of electricity, heat and gas are 0.023, 0.00011, and 0.00018, respectively. In Figure 7a, the forecasted price is almost the same with its actual value when the price curve is flat, between 0:00 and 7:00, 16:00 and 19:30, 21:00 and 24:00 When the price changes suddenly, which reflects the sudden change of the electric loads, there will exist certain error between the actual and forecasted prices. The case happens at 10:00 and 13:00. The similar phenomenon also occurs in Figure 7b,c. Based on the actual and forecasted prices, the optimal operation points, where the profits of CHP reach their maximum, are obtained and shown in Figure 8. At 0:00, The CHP is operated at the loading level of 70%, which is obtained from the day-ahead operating data. In Figure 8, the profits of CHP operated at different loading levels at different time in one day are presented. The white dotted line is the indication operation points for CHP in one day, which is obtained based on actual prices.
From Figure 8, it can be found that the maximum profit occurs at 10:00, about 12 Euro shown in deep red, when the CHP is in full load. The relatively high profit for CHP is between 8:00 and 16:00, 20:00 and 21:00. From Figure 7, it is found the electric price is much higher than that of heat in between 8:00 and 16:00 and, thus, the profit of CHP is relatively higher than other time. Between 0:00 and 8:00, 16:00 and 20:00, when the electric price is the same with or lower than heat price, the profits  Based on the actual and forecasted prices, the optimal operation points, where the profits of CHP reach their maximum, are obtained and shown in Figure 8. At 0:00, The CHP is operated at the loading level of 70%, which is obtained from the day-ahead operating data. In Figure 8, the profits of CHP operated at different loading levels at different time in one day are presented. The white dotted line is the indication operation points for CHP in one day, which is obtained based on actual prices. From Figure 8, it can be found that the maximum profit occurs at 10:00, about 12 Euro shown in deep red, when the CHP is in full load. The relatively high profit for CHP is between 8:00 and 16:00, 20:00 and 21:00. From Figure 7, it is found the electric price is much higher than that of heat in between 8:00 and 16:00 and, thus, the profit of CHP is relatively higher than other time. Between 0:00 and 8:00, 16:00 and 20:00, when the electric price is the same with or lower than heat price, the profits for CHP are relatively low. So the profit of CHP is mainly determined by the electric price, for its usually high value than heat. Based on the indication operation points, specific operation schedule can be developed after considering the ramp constraints. The green dotted line in Figure 8 is the forecasted operating route obtained from the forecasted prices. The red line in Figure 8 in is the optimal operating route obtained from the proposed dynamic programming method. It can be found that the red line and the white dotted line almost coincide with each other. Namely, the optimized profits comply quite well with those derived from actual conditions. At 1:30, the loading level for maximum profit point got from the forecasted prices is 90%, and it is modified to 90% before 1:30. However, the loading level for the maximum profit point got from the actual price is 80% at 1:30, thus the loading level has to be modified back to 80%. During the process, a lot of profits are lost for CHP. The optimal operating route is staying unchanged, as shown in the red line. At 2:30, the operating route is modifying CHP before 2:30 in the green dotted line, while the optimal route is modifying CHP after 2:30, shown in the red line. Sometimes, the operating route obtained from the forecasted prices happen to be the optimal one, such as at 6:30, 16:30, 19:00, 21:30, and 22:30. Take the case at 6:00 as an example, the loading level of CHP should be modified to 100% before 6:30, and the results of the green dotted line are consistent with that of the red line. The profits of the routes in green and red are shown in Table 3, respectively.   Based on the indication operation points, specific operation schedule can be developed after considering the ramp constraints. The green dotted line in Figure 8 is the forecasted operating route obtained from the forecasted prices. The red line in Figure 8 in is the optimal operating route obtained from the proposed dynamic programming method. It can be found that the red line and the white dotted line almost coincide with each other. Namely, the optimized profits comply quite well with those derived from actual conditions. At 1:30, the loading level for maximum profit point got from the forecasted prices is 90%, and it is modified to 90% before 1:30. However, the loading level for the maximum profit point got from the actual price is 80% at 1:30, thus the loading level has to be modified back to 80%. During the process, a lot of profits are lost for CHP. The optimal operating route is staying unchanged, as shown in the red line. At 2:30, the operating route is modifying CHP before 2:30 in the green dotted line, while the optimal route is modifying CHP after 2:30, shown in the red line. Sometimes, the operating route obtained from the forecasted prices happen to be the optimal one, such as at 6:30, 16:30, 19:00, 21:30, and 22:30. Take the case at 6:00 as an example, the loading level of CHP should be modified to 100% before 6:30, and the results of the green dotted line are consistent with that of the red line. The profits of the routes in green and red are shown in Table 3, respectively.
From Table 3, it can be found that the profits for CHP of the optimal route reach their maximum. The maximum profit in one day is about 14 Euro, between 10:00 and 11:00. The maximum profit is just about 1 Euro in the deep night. The high loading level for CHP does not mean high profits, either. Between 0:00 and 2:30, 2:30 and 6:00, the CHP is operated at the loading level of 80% and 90% to obtain the maximum profits. The similar case occurs between 16:00 and 18:00, 21:00 and 24:00. The reason is that the price of electricity is low and the CHP is operated at relatively low loading level to gain a high value of HTPR.

Conclusions
In this paper, a SIMO model is established for CHP, whose overall efficiency and HTPR are both in variation with the loading level. To optimize the operation of CHP in the real-time market, the real-time prices of heat, electricity, and natural gas are forecasted. A dynamic programming method is also proposed to design the optimal operation. The conclusions are drawn and summarized as follows: With the proposed method, the energy prices are forecasted, where the variances between actual and forecasted prices of electricity, heat and gas are only 0.023, 0.00011, and 0.00018, respectively. In addition, the optimized profits of the CHP obtained from modifying the pre-developed strategy comply well with actual conditions by using the proposed dynamic programming algorithm, as the red and white dotted lines shown in Figure 8. In day time, the optimal operation routine is mainly dominated by high electric prices and high electric demand. The CHP should be operated at a high loading level to gain a relatively low HTPR (e.g., 0.8) to generate more electricity. At night, the optimal operation routine is mainly dominated by high heat price and high heat demand. The CHP should be operated at a low loading level to gain a high HTPR (e.g., 2.2) to generate more heat. Thus, it is found that high loading level or high output of CHP does not always produce high profits.