1 Introduction

Recently, modern electricity supply systems have been undergoing a dramatic transition toward decentralized, decarbonized, and democratized power systems. Driven by this trend, microgrids have emerged as a promising solution for settling the generation-demand balance locally. In general, a microgrid integrates distributed energy resources (DERs), including non-dispatchable renewables and dispatchable local generators, and flexible operation modes, i.e., grid-connected or stand-alone modes [1,2,3]. To realize the economic operation of microgrids, it is indispensable to optimize energy scheduling, for coordinating the internal DERs of microgrids and an external grid, to minimize the overall operation cost while satisfying the time-varying load demand [4, 5].

Unlike traditional power grids, microgrids have unique drawbacks that preclude the optimization of economic scheduling [6, 7]. Firstly, the abrupt changes of weather conditions affect non-dispatchable generation, i.e., solar photovoltaic (PV) and wind turbines. Secondly, temporal uncertainty is always associated with volatile load profiles. Hence, it becomes challenging to make accurate forecasting regarding the future state of supply and demand, which is essential for successful microgrid scheduling [8].

Existing methods of uncertainty management in microgrids for energy scheduling can be categorized into three classes. The first class of methods formulates the energy management problem as a day-ahead scheduling problem, the solution to which is obtained by solving an offline deterministic problem using the tools of stochastic programming [9,10,11,12,13,14]. For the methods in this class, a sufficient number of operation scenarios are typically required as model inputs. Thus, the solution process can be computationally expensive. Furthermore, the effectiveness of such methods greatly relies on the representativeness of selective operation scenarios. For a small-scale microgrid, stochastic scenarios may not be able to capture time-changing conditions, as the typical loading profile is highly volatile and the aggregation effect vanishes. Robust optimization characterizes the second class of methods, which consider worst-case conditions in the presence of the highest forecasting error [15,16,17,18]. Although robust optimization can treat inherent operation uncertainties, the obtained scheduling solutions may be too conservative and uneconomic. The last class of methods includes the methods for energy scheduling in shorter periods of time, typically ranging from a few minutes to one hour. This is also known as real-time scheduling. Many approaches have been considered, for example, using online optimization algorithms [19,20,21] or model predictive control (MPC) [22,23,24]. These methods can timely adapt to the fast-changing operation conditions, while they still require the information on the future. In Section 3, we discuss MPC methodology for microgrid real-time applications.

Microgrid energy scheduling can be in general represented as an across-time correlation problem, in which the future conditions are considered as necessary inputs. Obviously, the above-mentioned approaches naturally lead to proactive decisions based on the forecasting information, the applicability of which is passively restricted by the forecasting accuracy. In this sense, prediction-independent scheduling approaches are of high interest to small-scale microgrid applications.

The concept of “perfect dispatch” (PD) has been firstly proposed in the initiative of PJM interconnection to improve the real-time performance of power grids, which refers to the least production cost commitment and dispatch solution by assuming full knowledge of future conditions and decisions [25]. PD performs retrospective direct optimization by spanning the entire dispatching horizon of interest. Unfortunately, PD cannot be fully implemented in real applications because weather conditions cannot be perfectly forecasted. However, PD solutions can provide some useful information for scheduling. Inspired by this, a competitive microgrid scheduling algorithm, CHASE, is firstly proposed in [26, 27]. Using this algorithm, online decisions are made by tracking the underlying PD solutions in a retroactive manner. Distinguished from proactive approaches, the CHASE algorithm relies on no future information while the scheduling performance has a strong guarantee. In a pioneering work described in [26,27,28], the foundation is laid and a new direction is suggested for managing microgrid operation uncertainties based on the theoretical performance guarantee. Based on CHASE, rCHASE and iCHASE are proposed in [29] to further determine the advantages of randomization and interval prediction for microgrid scheduling. Normally, the CHASE algorithm is designed for applications to single or multiple homogeneous local generators. In this paper, we describe a general retrospection-inspired scheduling algorithm, hCHASE, which complements and extends the CHASE algorithm by extending the applicability to scheduling multiple heterogeneous generators.

2 System model and problem formulation

We consider a small-scale microgrid as a single-bus system comprising of multiple local generators, renewables, and an aggregated load. This system connects to an external grid, which can complement power imbalance of the microgrid in a due course. The system model is shown in Fig. 1.

Fig. 1
figure 1

Microgrid system

In this paper, the microgrid energy scheduling problem is formulated based on the following assumptions:

  1. 1)

    The microgrid system operates in a self-sustained manner. The power mismatch between scheduled power and system net load is met by the external grid.

  2. 2)

    Renewable generators, including solar PV and wind turbines, are free-running and non-dispatchable.

  3. 3)

    The microgrid system operates in a time-slotted manner. Dispatch orders are periodically sent to dispatchable units at the beginning of each time slot and take effect without time delay.

  4. 4)

    We deploy a steady-state energy model assuming the generation output of local generators, renewables, and load demand at each time slot to be constant.

  5. 5)

    Renewable generation and electrical load demand are merely predictable at a certain accuracy rate d. Section 2.1 provides the mathematical model of renewable forecasting. Day-ahead forecasting of the system net load is difficult at a satisfactory accuracy rate, while a general trend can be obtained as a model input. This assumption is reasonable based on the state-of-the-art forecasting techniques of renewables and residential load [30, 31].

2.1 Renewable energy generation and system net load

In each time slot t, the electrical load and renewable energy generation (e.g., solar PV and wind energy) are denoted as \(P_{e} (t)\) and \(P_{renewable} (t)\), respectively. The system net load is defined as:

$$P_{load} (t) = P_{e} (t) - P_{renewable} (t)$$
(1)

In practice, a future net load is forecasted with specific techniques for energy scheduling purposes. For the convenience of analysis, we use the following model to approximate the forecasting process:

$$\eta (t + \sigma ) \le \frac{{P_{load}^{*} (t + \sigma )}}{{P_{load} (t + \sigma )}} \le 2 - \eta (t + \sigma )$$
(2)

where \(P_{load}^{*} (t)\) is the forecasting net load at time slot t; \(\sigma\) is the number of look-ahead steps and \(\eta\) is defined in (3).

$$\eta (t + \sigma ) = \sigma (d - 1) + 1$$
(3)

where d is the forecasting accuracy and \(d \in [0,1]\).

2.2 Conventional generation

In this paper, conventional thermal generators (e.g., gas turbines, steam turbines, and diesel generators) are considered as the only dispatchable units for maintaining the power balance in the microgrid. This study deploys a linear cost model for a specific local generator by integrating the start-up, sunk, and incremental operation costs, which is formulated as:

$$C(y_{i} (t),P_{i} (t)) = c_{i}^{incr} P_{i} (t)y_{i} (t) + c_{i}^{sunk} y_{i} (t) + c_{i}^{start} [y_{i} (t) - y_{i} (t - 1)]^{ + }$$
(4)

where \(y_{i} (t)\) and \(P_{i} (t)\) are the operation on/off status and the output power of generation unit i at time slot t, respectively; \(c_{i}^{incr}\), \(c_{i}^{sunk}\), \(c_{i}^{start}\) are the incremental, sunk, and start-up costs of unit i, respectively; “+” means taking the positive number.

Thermal local generators in a microgrid normally operate subject to the following operational constraints.

  1. 1)

    Power limit constraint

    $$P_{i}^{\hbox{min} } \le P_{i} (t) \le P_{i}^{\hbox{max} }$$
    (5)

    where \(P_{i}^{\hbox{min} }\) and \(P_{i}^{\hbox{max} }\) are the minimal power output and the power capacity of generation unit i, respectively.

  2. 2)

    Power balance constraint

    Given that there are N local generators in the microgrid, we obtain:

    $$\sum\limits_{i = 1}^{N} {P_{i} (t) + P_{grid} (t) \ge P_{load} (t)}$$
    (6)

    where \(P_{grid} (t)\) is the power extracted from the main grid at time slot t.

  3. 3)

    Ramp-up and ramp-down constraints

    The incremental output of a thermal generator in two consecutive time slots is limited by the ramp-up and ramp-down rates \(P_{i}^{up}\) and \(P_{i}^{down}\), i.e.,

    $$P_{i} (t + 1) - P_{i} (t) \le P_{i}^{up}$$
    (7)
    $$P_{i} (t) - P_{i} (t - 1) \le P_{i}^{down}$$
    (8)
  4. 4)

    Minimum on-time and off-time constraints

    If a thermal generator is committed at time slot t, it remains committed for at least minimum on-time, and vice versa.

    $$y_{i} (\tau ) \ge \text{1}_{{\{ y_{i} (t) > y_{i} (t - 1)\} }} \quad t + 1 \le \tau \le t + T_{i}^{on} - 1$$
    (9)
    $$y_{i} (\tau ) \le 1 - \text{1}_{{\{ y_{i} (t) < y_{i} (t - 1)\} }} \quad t + 1 \le \tau \le t + T_{i}^{off} - 1$$
    (10)

    where \(\text{1}_{{\{ \cdot \} }}\) denotes the indicator function; \(\tau\) is the time instance between t+1 and \(t + T_{i}^{on} - 1\). \(T_{i}^{on}\) and \(T_{i}^{off}\) are the minimum on-time and off-time of local generator, respectively.

In general, thermal generators scheduled in real time in a small-scale microgrid respond timely to satisfy the time-varying electrical demand. That is, they normally exhibit negligible Ton (Toff) and relatively large ramp-up/ramp-down rates.

2.3 Problem formulation of microgrid energy scheduling

Based on the assumptions and technical models previously mentioned, we formulate the microgrid cost-minimization scheduling as a receding horizon optimization problem (RHOP), which is expressed as

$$\left\{ {\begin{array}{*{20}l} {\hbox{min} \, \sum\limits_{{t = t_{1} }}^{t*} {\left\{ {\left\{ {\sum\limits_{i = 1}^{N} {c_{i}^{incr} P_{i} (t) + c_{i}^{sunk} y_{i} (t) + c_{i}^{start} [y_{i} (t) - y_{i} (t - 1)]^{ + } } } \right\} + \lambda (t)P_{grid} (t)} \right\}} } \hfill \\ {{\text{s}}.{\text{t}}. \;\;\left( 5\right) - \left( { 10} \right)} \hfill \\ \end{array} } \right.$$
(11)

where \(\lambda (t)\) is the spot price of power obtained from the main grid at time slot t. The optimization window is bounded within [t1, t*]. We assume that the price of electricity sent from the microgrid to the main grid is negligible. This assumption allows us to underscore the effective coordination of dispatchable sources in the microgrid, to minimize the operation cost, which is the main focus of our study.

It should be noted that the RHOP is correlated across the slots, owing to the existence of a start-up cost. PD is an offline optimal solution to the RHOP, spanning the entire dispatching period with the full knowledge of future information, including the system net load and electricity spot prices.

3 MPC

The classical MPC can be used for the real-time scheduling problem of the power system. As illustrated in Fig. 2, the entire dispatching horizon is divided into several temporal segments coupled in the chronological order. The basic principle of MPC is to solve the RHOP for a current segment offline and retain the dispatching order for the starting time slot. Such optimization process proceeds dynamically based on the scale of the look-ahead time window.

Fig. 2
figure 2

Basic principle of MPC

Obviously, the MPC method directly targets sub-optimal scheduling solutions and makes proactive decisions. However, it may be practically flawed in a small-scale microgrid for the following reasons:

  1. 1)

    A limited look-ahead window prevents the scheduling solution. Compared with the PD, the competitiveness of such solutions relates to the forecasting horizon of interest.

  2. 2)

    The MPC method strongly relies on the forecasting of future information. Large forecasting errors cause the solutions to deviate from the optima and generate misleading or ineffective dispatch order. In a small-scale microgrid, a high forecasting accuracy of the system net load is impossible.

  3. 3)

    Due to the uncertainty associated with the prediction process, the MPC method cannot provide performance guarantees.

  4. 4)

    With the increase of the look-ahead time window, the optimization process will become computationally inefficient.

4 Retroactive algorithm for real-time scheduling

The formulated RHOP is generally known to be NP-complete. As discussed in Section 3, proactive decision-making based on MPC significantly depends on accurate forecasting, which exposes limitations in tackling unpredictable net loads in small-scale microgrids. Instead, the retroactive algorithm explored in this paper relies on zero or little forecasting information, while it is still capable of tracking the PD.

4.1 Fundamental case with a single local generator

We first consider the fundamental case of the RHOP with only one local generator. At time slot t, the opportunity benefit of switching on a local generator is defined as:

$$\delta (t) = C[y(t) = 0,P(t) = 0,P_{grid} ] -C[y(t) = 1,P(t),P_{grid} = 0]$$
(12)

The opportunity benefit cumulates from the beginning time slot to the current time slot. The cumulative opportunity benefit is defined as:

$$\Delta (t) = \hbox{min} \{ 0,\hbox{max} \{ - c^{start} ,\Delta (t - 1) + \delta (t)\} \}$$
(13)

The PD solution can be interpreted through the following types of dispatching segments over the entire horizon. A rigorous mathematical proof can be found in [26]. As illustrated in Fig. 3, four types of dispatching segments are defined as follows. The red point in Fig. 3 indicates a look-ahead window containing \(\phi\) time slots.

Fig. 3
figure 3

Schematic of\(\Delta (t)\)and classification of dispatching segments

  1. 1)

    Type 0: \([1,\;T_{1}^{c} ]\)

  2. 2)

    Type 1: \([T_{i}^{c} + 1,\;T_{i + 1}^{c} ]\), if \(\Delta (T_{i}^{c} ) = - c^{start}\) and \(\Delta (T_{i + 1}^{c} ) = 0\)

  3. 3)

    Type 2: \([T_{i}^{c} + 1,\;T_{i + 1}^{c} ]\), if \(\Delta (T_{i}^{c} ) = 0\) and \(\Delta (T_{i + 1}^{c} ) = - c^{start}\)

  4. 4)

    Type 3: \([T_{end}^{c} + 1,\;T]\)

As concluded in [26], the PD solution to the RHOP is given by:

$$y^{PD} (t) = \left\{ {\begin{array}{*{20}l} 0 \hfill & {{\text{if }}t \in [T_{i}^{c} + 1,T_{i + 1}^{c} ],} \hfill & {\text{Type 0, Type 2 or Type 3}} \hfill \\ 1 \hfill & {{\text{if }}t \in [T_{i}^{c} + 1,T_{i + 1}^{c} ],} \hfill & {\text{Type 1}} \hfill \\ \end{array} } \right.$$
(14)

Recall that the CHASE algorithm proposed in [26] is devised to make online decisions at critical points \(\tilde{T}_{i}^{c}\). Different from MPC, this is a “look back” algorithm by nature. At each time slot, the cumulative opportunity benefit, i.e., cumulative cost difference, is calculated and compared by looking into the historical states. Obviously, there always exist delays (i.e., \([T_{i}^{c} ,\;\tilde{T}_{i}^{c} ]\)) for those online decisions, while a quantifiable competitive ratio can be guaranteed rigorously. Furthermore, in the CHASE algorithm, it is evident that scheduling decisions can be made several steps ahead before \(\tilde{T}_{i}^{c}\). It is provided that the future information is forecasted in a look-ahead time window, i.e., \([t,t + \sigma ]\). However, it is worth noting that such decision-making may be misleading or ineffective, resulting from inherent forecasting errors. To avoid this, the following novel algorithm conserves the leverage forecasting information. Algorithm 1 calculates the competitive ratio of this algorithm.

figure a

Theoretically, the competitive ratio of CHASE in consideration of the forecasting error satisfies:

$$CR_{hCHASE} \le 1 + \frac{{4c^{start} + \varepsilon \, P_{load}^{\hbox{min} } (\lambda_{\hbox{min} }^{up} - \lambda_{\hbox{max} }^{dw} ) + 4(\sigma + 1)c^{sunk} }}{{2c^{start} (1 + \gamma )}}$$
(15)
$$\varepsilon = \sigma^{2} - \sigma - \sigma^{2} d - \sigma d - 2$$
(16)
$$\gamma = \frac{{P_{load}^{\hbox{max} } \, c^{incr} + c^{sunk} }}{{P_{load}^{\hbox{max} } (\lambda_{\hbox{max} } - c^{incr} ) - c^{sunk} }}$$
(17)
$$\lambda_{\hbox{min} }^{up} { = }\hbox{min} \{ \lambda (t)|\lambda (t) \ge c^{incr} \}$$
(18)
$$\lambda_{\hbox{max} }^{dw} { = }\hbox{max} \{ \lambda (t)|\lambda (t) < c^{incr} \}$$
(19)

where \(P_{load}^{\hbox{min} }\) and \(P_{load}^{\hbox{max} }\) are the minimum and maximum system net loads, respectively.

4.2 General case with multiple heterogeneous generators

The essential idea of handling multiple heterogeneous generators is to partition the electrical load into N layers and allocate each layer to a dedicated generator, where N is the total number of local thermal generators. In this sense, the formulated RHOP is decomposed into N sub-problems and each one is solved individually with Algorithm 1. Intuitively, generators with a large start-up cost cover the load at the bottom layers as these normally exhibit least frequent variations. It should be noted that the ineffective partition of the load can increase the operation cost. The combined solution to all sub-problems is optimal on the condition of the optimal partitioning of load demand.

In particular, given N local dispatchable generators in a microgrid, the generation capacity is \(\{ P_{1}^{\hbox{max} } ,P_{2}^{\hbox{max} } , \ldots ,P_{N}^{\hbox{max} } \}\). The load demand is partitioned into N layers by following an order \(\{ \beta_{1} ,\beta_{2} , \ldots ,\beta_{N} \}\) (from the bottom to the top) based on the power capacity of individual generators. Specifically, each layer is defined as

$$P_{load}^{ly,n} (t) = \hbox{min} \{ P_{{\beta_{n} }}^{\hbox{max} } ,P_{load} (t) - \sum\limits_{j = 1}^{n - 1} {P_{load}^{ly,j} (t)} \} \quad n \in [1,N]$$
(20)

If \(\{ \alpha_{1} ,\alpha_{2} , \ldots ,\alpha_{N} \}\) corresponds to an optimal partitioning order, it should satisfy:

$$C[(y_{{\alpha_{i} }} ,P_{{\alpha_{i} }} ),P_{grid} ] \le C[(y_{{\beta_{i} }} ,P_{{\beta_{i} }} ),P_{grid} ]$$
(21)

Suppose \((y_{{\alpha_{n} }} ,P_{{\alpha_{n} }} ,P_{grid}^{{\alpha_{n} }} )\) is an optimal solution for the nth sub-problem, and \(\{ \alpha_{1} ,\alpha_{2} , \ldots ,\alpha_{N} \}\) indicates the optimal partitioning order, then \([(y_{{\alpha_{n} }}^{\dag } ,P_{{\alpha_{n} }}^{\dag } )_{n = 1}^{N} ,P_{grid}^{\dag } ]\) is an optimal solution to the entire RHOP, i.e., \(y_{{\alpha_{n} }}^{\dag } (t) = y_{{\alpha_{n} }} (t)\), \(P_{{\alpha_{n} }}^{\dag } (t) = P_{{\alpha_{n} }} (t)\), \(P_{grid}^{\dag } (t) = \sum\limits_{i = 1}^{N} {P_{grid}^{{\alpha_{n} }} (t)}\).

Obviously, load partitioning is a necessary step for tackling multiple generators. Optimal partitioning becomes a premise for obtaining the optimal combined solution of the RHOP. In particular, load partitioning can be formulated as a permutation optimization problem, which is expressed in the following section.

Given that \(\{ P_{load}^{*} (t)|t \in [1,T_{day} ]\}\)is the day-ahead forecasting net loading profile, which can well reflect the general trend (i.e., net load variations), the partitioning objective and constraints are:

$$\left\{ {\begin{array}{*{20}l} {\hbox{min} \, \sum\limits_{t = 1}^{{T_{day} }} {\sum\limits_{n = 1}^{N} {cost} (y_{{\beta_{n} }} (t),P_{{\beta_{n} }} (t),P_{grid}^{{\beta_{n} }} (t))} } \hfill \\ {{\text{s}}.{\text{t}}.\, \left( 5\right), \, \left( 7\right) - \left( { 10} \right), \, \left( { 20} \right)} \hfill \\ {\;\;\;\;\;\;P_{{\beta_{n} }} (t) + P_{grid}^{{\beta_{n} }} (t) \ge P_{load}^{ly,n} (t)} \hfill \\ \end{array} } \right.$$
(22)

The variable is the permutation of \(\{ \beta_{1} ,\beta_{2} , \ldots ,\beta_{N} \}\).

This optimal partitioning problem can be efficiently solved by exhaustive search when N ≤ 6, or by intelligent optimization methods (e.g., particle swarm optimization) when N > 6.

Based on the illustration above, Algorithm 2 lists the hCHASE algorithm.

figure b

5 Numerical simulations

The upper limit on the competitive ratio of the proposed hCHASE algorithm is provided in (15), which corresponds to the theoretical worst case. In this section, we aim to investigate the practical competitive ratio based on extensive numerical simulations. Realistic data of the Belgium grid [32], including solar PV generation and electrical load demand during 2014–2016 is used and scaled down to a 1 MW-level microgrid. Figures 4 and 5 present the solar PV generation and loading profiles and a day is divided into 96 points by every 15 min.

Fig. 4
figure 4

Solar PV generation for 3 years

Fig. 5
figure 5

Electrical loading profiles for 3 years

5.1 Parameter settings

In the case studies, the system has a 15-minute-long scheduling resolution. Table 1 reports the parameters for both single and multiple generator cases.

Table 1 Parameter settings

In the case studies, we assume that the electricity spot price can be accurately forecasted, which is shown in Fig. 6.

Fig. 6
figure 6

Electricity spot price in summer and winter

5.2 Single-generator case with net load prediction errors

In this case, we compare hCHASE and MPC with different forecasting accuracies and different look-ahead time windows. The operation profiles of the PD of hCHASE and MPC for five days are shown in Fig. 7. Visually, the scheduling profiles for hCHASE are much closer to the PD than the ones obtained by MPC. Figures 8 and 9 show the detailed comparison results including cumulative distribution function (CDF) and box plots.

Fig. 7
figure 7

Scheduling profiles of PD of hCHASE and MPC for 5 days

Fig. 8
figure 8

Simulation results for hCHASE and MPC in single-generator case where forecasting accuracy is 0.9

Fig. 9
figure 9

Simulation results for hCHASE and MPC in single-generator case where forecasting accuracy is 0.65

As shown in Figs. 8 and 9, the competitive ratio improves monotonously for both hCHASE and MPC along with the increase of look-ahead time window. This is reasonable, owing to the high forecasting accuracy. However, such monotone improvement of the competitive ratio vanishes in the condition of low forecasting accuracy, as shown in Fig. 8. This is because inaccurate forecasting information can mislead scheduling decisions and will result in a large operation cost. Overall, hCHASE outperforms MPC on the condition of no or little forecasting information. The box plots also show that the competitive ratio of MPC is better than the one of hCHASE, when the look-ahead window is sufficiently long (i.e., more than 2.5 hours). However, a satisfactory prediction accuracy for such a long period is impossible in a small-scale microgrid.

5.3 Multiple-generator case with net load prediction errors

Similarly, we compare hCHASE and MPC for the multiple-generator case, for different forecasting accuracies and different look-ahead time windows. Figures 10 and 11 show the simulation results. The single-generator case reaches the same conclusions. Obviously, the competitive ratio CDF of hCHASE completely dominates the one of MPC for both the conditions of high and low forecasting accuracies. The simulation results show that, compared with the PD, hCHASE gives rise to less than 11% cost difference.

Fig. 10
figure 10

Simulation results for hCHASE and MPC in multiple-generator case where forecasting accuracy is 0.9

Fig. 11
figure 11

Simulation results for hCHASE and MPC in multiple-generator case where forecasting accuracy is 0.65

6 Conclusion

This paper proposes a retroactive algorithm hCHASE for microgrid real-time scheduling. The advantages of the proposed algorithm are its forecasting independence and high computational efficiency. The proposed approach can effectively tackle multiple heterogeneous generators in the presence of certain degrees of forecasting errors with guarantee of theoretical performance. Extensive case studies for the proposed algorithm and classical MPC are carried out, using a 3-year-long realistic system data. Simulation results show that the cost difference between hCHASE and PD is less than 11% on average, which suggests better performance than the conventional MPC approach with the cost difference at 30% compared to PD.