1 Introduction

Microgrid is a novel concept that has been innovated through integrating several types of energy resources including renewable and non-renewable ones like photovoltaic (PV) cells, wind turbines (WT), distributed energy sources and cogeneration systems (Alipour et al. 2015; Abu-Sharkh et al. 2006). Renewable units used in these systems can reduce total emission of power system (Barklund et al. 2008; Kanchev et al. 2011). Furthermore, microgrids can exchange power with the upstream network to gain economic profit (Nazari-Heris et al. 2017). Generating electrical and thermal energy at the same time, combined heat and power systems increase total system efficiency (Alipour et al. 2014). Since economic dispatch of CHP units is a non-convex nonlinear problem, integration of these units with other generation systems can be challenging (Nazari-Heris et al. 2017). In order to solve such a non-convex problem, various methods including benders decomposition approach (Abdolmohammadi and Ahad 2013), Lagrangian relaxation method (Sashirekha et al. 2013) and branch and bound technique (Rong and Lahdelma 2007) can be used. Economic dispatch problem of microgrid energy systems has been studied in some researches as follows: uncertainty-based economic dispatch of microgrid under different optimization goals, planning methods and reliability indices have been studied in Wu et al. (2014). Monte Carlo simulation approach along with particle swarm optimization method has been used to model power flow of microgrid in both grid-connected and islanded modes. Microgrid energy system has been optimally allocated and scheduled using improved adaptive genetic algorithm in Wu et al. (2016) in which management costs, investment costs, the rate of extra energy of microgrid and cost of emission have been taken into account. Particle swarm optimization method and two-point estimate approaches have been used to manage energy consumption of microgrid in Baziar and Kavousi-Fard (2013). Chaotic local search and fuzzy self-adaptive techniques have been employed to solve economic dispatch problem of microgrid with considering environmental issues in Moghaddam et al. (2011). In order to minimize total operation cost and emission of microgrid, epsilon-constraint approach and hybrid augmented-weighted technique have been employed in Rezvani et al. (2015). Uncertainty-based operation of microgrid has been studied considering uncertainty of real-time market price in Liu et al. (2016). Controlling operation of a DC microgrid has been studied in the presence of electric vehicles in Kai-Wei and Liaw (2016) in which wind permanent magnet synchronous generator capable of exchanging power with the upstream network has been used. Controlling strategies of a hybrid PV-diesel-battery microgrid containing on/off control and monitoring have been studied in Kusakana (2015). Modified adaptive firefly algorithm has been employed to minimize total operation cost of microgrid in Talari et al. (2015). Microgrid energy system has been optimally planned using a mixed-integer linear programming in Jaramillo and Weidlich (2016) to minimize total operation cost and emission of microgrid. Uncertainty-based operation of microgrid under uncertainty of renewable energy resources has been studied in Sobu and Guohong (2012). Uncertainty-based operation CHP-based microgrid has been studied with subject to uncertainty of wind generation in Dolatabadi and Behnam (2017) in which conditional value-at-risk (CVaR) measure has been used to evaluate the risks.

In this paper, a new optimization framework has been presented for optimal dispatch of a CHP-based microgrid in a 10-bus test system. The studied model is composed of conventional thermal plants, two CHP systems, boiler units, heat buffer tanks, wind generation system, PV system and electrical storage. Effects of dual dependency of generated heat and power by CHP unit as well as start-up and shutdown costs of generation systems have been taken into account in the proposed paper. A mixed-integer linear programming has been used to formulate optimal operation of CHP system with non-convex feasible operating zones. Studied test system is divided into several zones, each one with its own generation units and demands. Each zone can be operated in grid-connected or islanded mode to supply its local energy demand. The main goal of proposed paper is to optimize operation of microgrid in a way that both electrical and thermal demands are supplied while total operation cost of system is minimized.

Proposed paper is categorized as follows: Economic dispatch problem is formulated in Sect. 2. Case studies are presented in Sect. 3, and the results are reported in Sect. 4. Finally, the conclusions are provided in Sect. 5.

2 Problem Formulation

Studied model in this paper is composed of CHP systems, boiler, conventional power generators, heat tank, PV systems, wind units and electrical storage system.

As the objective function, total operation cost of CHP-based microgrid including cost of power procurement from upstream network, cost of generation of heat and power by CHP units, cost of conventional power generators, cost of boilers, cost of storage system and start-up and shutdown costs of local generation units should be minimized as follows:

$${\text{Min}}\,\,\sum\limits_{t = 1}^{H} {\sum\limits_{n = 1}^{{N_{\text{bus}} }} {\left\{ \begin{aligned} \left( {p_{{{\text{t}},{\text{n}}}}^{\text{buy}} \times \lambda_{\text{t}} } \right) + \sum\limits_{k = 1}^{{N_{CHP} }} {C_{{{\text{k}},{\text{t}},{\text{n}}}}^{\text{CHP}} } + \sum\limits_{l = 1}^{{N_{\text{G}} }} {C_{{{\text{l}},{\text{t}},{\text{n}}}}^{\text{G}} } + \sum\limits_{m = 1}^{{N_{\text{B}} }} {C_{{{\text{m}},{\text{t}},{\text{n}}}}^{\text{B}} } \hfill \\ + \sum\limits_{{i\hat{I}l,m,k}} {\left( {{\text{CSU}}_{{{\text{i}},{\text{t}},{\text{n}}}} \times {\text{SU}}_{{{\text{i}},{\text{t}},{\text{n}}}} + {\text{CSD}}_{{{\text{i}},{\text{t}},{\text{n}}}} \times {\text{SD}}_{{{\text{i}},{\text{t}},{\text{n}}}} } \right)} \hfill \\ \end{aligned} \right\}} }$$
(1)

In this formulation, \(N_{\text{Bus}}\) is the number of buses of studied test system. \(h\) is time period. \(P_{\text{k,t,n}}^{\text{CHP}}\) and \(H_{\text{k,t,n}}^{\text{CHP}}\) are the power and heat production of CHP system. Power and heat production of conventional power generators and boilers are expressed by \(P_{\text{l,t,n}}^{\text{G}}\) and \(H_{\text{m,t,n}}^{\text{b}}\). \(P_{\text{t,n}}^{\text{buy}}\) is the purchased power from upstream network. Price of upstream network is expressed by \(\lambda_{\text{t}}\), and \(C_{\text{k,t,n}}^{\text{CHP}}\), \(C_{\text{l,t,n}}^{\text{G}}\) and \(C_{\text{m,t,n}}^{\text{B}}\) are power and heat generation of CHP systems, conventional power generators and boilers, respectively. \({\text{SU}}_{\text{i,t,n}}\) and \({\text{SD}}_{\text{i,t,n}}\) are start-up and shutdown states of local generation units. \({\text{CSU}}_{\text{i,t,n}}\) and \({\text{CSD}}_{\text{i,t,n}}\) are start-up and shutdown costs of local generation units.

2.1 CHP Units

Cost of operation of CHP systems is presented as follows:

$$C_{\text{k,t,n}}^{\text{CHP}} = \left\{ \begin{aligned} a_{\text{k}} \times (P_{\text{k,t,n}}^{\text{CHP}} )^{ 2} { + }b_{\text{k}} \times P_{\text{k,t,n}}^{\text{CHP}} { + }c_{\text{k}} \hfill \\ +\,d_{\text{k}} \times (H_{\text{k,t,n}}^{\text{CHP}} )^{ 2} { + }e_{\text{k}} \times H_{\text{k,t,n}}^{\text{CHP}} \hfill \\ +\, f_{\text{k}} \times H_{\text{k,t,n}}^{\text{CHP}} \times P_{\text{k,t,n}}^{\text{CHP}} \hfill \\ \end{aligned} \right\}$$
(2)

In this formulation, \(a_{\text{k}}\), \(b_{\text{k}}\), \(c_{\text{k}}\), \(d_{\text{k}}\), \(e_{\text{k}}\) and \(f_{\text{k}}\) are coefficients of operation cost function of CHP system. \(P_{\text{k,t,n}}^{\text{CHP}}\) is the generated power by CHP systems and \(H_{\text{k,t,n}}^{\text{CHP}}\) is generated heat by these systems.

The relationships between the heat and power generation of CHP systems are expressed in Fig. 1.

Fig. 1
figure 1

Feasible region for operation of CHP systems

Feasible operational region of CHP system 1 is expressed in Fig. 1 (a) which can be modeled linearly as follows:

$$P_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{A}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{1,{\text{A}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} }}{{H_{{1,{\text{A}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{A}},{\text{n}}}}^{\text{CHP}} } \right) \le 0$$
(3)
$$P_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} }}{{H_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} } \right) \ge - \left( {1 - V_{{1,{\text{t}},{\text{n}}}} } \right) \times M$$
(4)
$$P_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} - P_{{1,{\text{D}},{\text{n}}}}^{\text{CHP}} }}{{H_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{D}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{1,{\text{C}},{\text{n}}}}^{\text{CHP}} } \right) \ge - \left( {1 - V_{{1,{\text{t}},{\text{n}}}} } \right) \times M$$
(5)
$$0 \le H_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} \le H_{{1,{\text{B}},{\text{n}}}}^{\text{CHP}} \times V_{{1,{\text{t}},{\text{n}}}}$$
(6)
$$0 \le P_{{1,{\text{t}},{\text{n}}}}^{\text{CHP}} \le P_{{1,{\text{A}},{\text{n}}}}^{\text{CHP}} \times V_{{1,{\text{t}},{\text{n}}}}$$
(7)

In these formulations, M is a great number. A, B, C and D are FOR marginal points of CHP system type-1. The area below AB is modeled by (3). The area above the curve BC is modeled by (4). Also, Eq. (5) is used to model the area above curve CD. \({\text{V}}_{{1,{\text{t}},{\text{n}}}}\) is binary variable to express the commitment or decommitment of CHP system which is used in Eqs. (6) and (7).

Non-convex FOR of CHP system type-2 is expressed in Fig. 2b. Mentioned FOR can be separated into two convex regions utilizing binary variables X1 and X2. Linear form of FOR of CHP system type-2 is expressed as follows:

$$P_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{B}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{2,{\text{B}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} }}{{H_{{2,{\text{B}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{B}},{\text{n}}}}^{\text{CHP}} } \right) \le 0$$
(8)
$$P_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} }}{{H_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} } \right) \ge 0$$
(9)
$$P_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{F}},{\text{n}}}}^{\text{CHP}} }}{{H_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{F}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} } \right) \ge - \left( {1 - X_{{1,{\text{t}},{\text{n}}}} } \right) \times M$$
(10)
$$P_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} - \frac{{P_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} - P_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} }}{{H_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} }}\left( {H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{D}},{\text{n}}}}^{\text{CHP}} } \right) \ge - \left( {1 - X_{{2,{\text{t}},{\text{n}}}} } \right) \times M$$
(11)
$$H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} \ge - \left( {1 - X_{{2,{\text{t}},{\text{n}}}} } \right) \times M$$
(12)
$$H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} - H_{{2,{\text{E}},{\text{n}}}}^{\text{CHP}} \ge - \left( {1 - X_{{1,{\text{t}},{\text{n}}}} } \right) \times M$$
(13)
$$X_{{1,{\text{t}}}} + X_{{2,{\text{t}}}} = V_{{{\text{i}},{\text{t}}}}$$
(14)
$$0 \le H_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} \le H_{{2,{\text{C}},{\text{n}}}}^{\text{CHP}} \times V_{{2,{\text{t}},{\text{n}}}}$$
(15)
$$0 \le P_{{2,{\text{t}},{\text{n}}}}^{\text{CHP}} \le P_{{2,{\text{A}},{\text{n}}}}^{\text{CHP}} \times V_{{2,{\text{t}},{\text{n}}}}$$
(16)

In these formulations, A, B, C, D, E and F are FOR marginal points of CHP system type-2. The area under BC is modeled by (8), and the area above CD is modeled by (9). Equation (10) is used to model the area above EF. Also, the area above curve DE is modeled by (11). \(X_{{1,{\text{t}}}}\) is the binary variable representing first convex region of FOR of CHP system type-2, and \(X_{{2,{\text{t}}}}\) is the binary variable representing first convex region of FOR of CHP system type-1. It should be noted that \(V_{{i,{\text{t}},{\text{n}}}}\) is binary variable expressing the commitment or decommitment of CHP system.

Fig. 2
figure 2

Studied test system (Malakar et al. 2014)

2.2 Conventional Power Generators

Operation cost of conventional power generators can be expressed as follows:

$$C_{{{\text{l}},{\text{t}},{\text{n}}}}^{\text{G}} = \psi_{\text{l}} \times P_{{{\text{l}},{\text{t}},{\text{n}}}}^{\text{G}}$$
(17)

In this formulation, \(\psi_{\text{l}}\) is coefficient of operation cost of conventional power generator. \(P_{{{\text{l}},{\text{t}},{\text{n}}}}^{G}\) is the generated power by these units. It should be noted that the limitation of generation by these units is expressed as follows:

$$P_{\text{l}}^{{{\text{G}},{ \rm{min} }}} \times V_{{{\text{l}},{\text{t}},{\text{n}}}} \le P_{{{\text{l}},{\text{t}},{\text{n}}}}^{\text{G}} \le P_{\text{l}}^{{{\text{G}},{ \rm{max} }}} \times V_{{{\text{l}},{\text{t}},{\text{n}}}}$$
(18)

In this equation, \(P_{\text{l}}^{{{\text{G}},{ \rm{min} }}}\) and \(P_{\text{l}}^{{{\text{G}},{ \rm{max} }}}\) are the minimum and the maximum possible generation of conventional power generators.

2.3 Boiler Units

Operation cost of boilers can be expressed as follows:

$$C_{{{\text{m}},{\text{t}},{\text{n}}}}^{\text{B}} = \psi_{\text{m}} \times H_{{{\text{m}},{\text{t}},{\text{n}}}}^{\text{B}}$$
(19)

In this formulation, \(\psi_{\text{m}}\) is coefficient of operation cost of boilers and \(H_{{{\text{m}},{\text{t}},{\text{n}}}}^{B}\) is the generated heat by these units. It should be noted that the limitation of generation by these units is expressed as follows:

$$H_{\text{m}}^{{{\text{B}},{ \rm{min} }}} \times {\text{V}}_{{{\text{m}},{\text{t}},{\text{n}}}} \le H_{{{\text{m}},{\text{t}},{\text{n}}}}^{\text{B}} \le H_{\text{m}}^{{{\text{B}},{ \rm{max} }}} \times {\text{V}}_{{{\text{m}},{\text{t}},{\text{n}}}}$$
(20)

In this equation, \(H_{\text{m}}^{{{\text{B}},{ \rm{min} }}}\) and \(H_{\text{m}}^{{{\text{B}},{ \rm{max} }}}\) are the least and the most heat generation of boilers.

Start-up and shutdown conditions of CHP systems, conventional generation system and boilers can be expressed as follows:

$${\text{SU}}_{{{\text{i}},{\text{t}},{\text{n}}}} = V_{{{\text{i}},{\text{t}},{\text{n}}}} \times \left( {1 - V_{{{\text{i}},{\text{t}} - 1,{\text{n}}}} } \right)$$
(21)
$${\text{SD}}_{{{\text{i}},{\text{t}},{\text{n}}}} = (1 - V_{{{\text{i}},{\text{t}},{\text{n}}}} ) \times (V_{{{\text{i}},{\text{t}} - 1,{\text{n}}}} ).$$
(22)

2.4 Wind Turbines

Generation of wind turbine is presented as:

$$P_{{{\text{u}},{\text{t}},{\text{n}}}}^{{\prime {\text{W}}}} = \left\{ {\begin{array}{*{20}l} 0 & {V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} > V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CO}} ,V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} < V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CI}} } \\ {P_{{{\text{u}},{\text{t}},{\text{n}}}}^{ \rm{max} } \times \left( {\frac{{V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} - V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CI}} }}{{V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{R}} - V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CI}} }}} \right)} & {V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CI}} { < }V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} < V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{R}} } \\ {P_{{{\text{u}},{\text{t}},{\text{n}}}}^{ \rm{max} } } & {V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{R}} { < }V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} < V_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{CO}} } \\ \end{array} } \right.$$
(23)

In this formulation, \(V_{\text{u,t,n}}^{\text{W}}\) is the wind speed. \(P_{\text{u,t,n}}^{{\prime {\text{W}}}}\) is available generated power by wind turbine. \(V_{\text{u,t,n}}^{\text{CI}}\), \(V_{\text{u,t,n}}^{\text{CO}}\) and \(V_{\text{u,t,n}}^{\text{R}}\) are cut-in, cut-out and rated wind speeds. \(P_{\text{u,t,n}}^{ \rm{max} }\) is the maximum capacity of wind system. It should be noted that scheduled power of wind turbine cannot exceed available generated power by wind turbine which is expressed by (24):

$$P_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} \le P_{{{\text{u}},{\text{t}},{\text{n}}}}^{\prime W}$$
(24)

2.5 Photovoltaic Units

Generation of PV system is presented as:

$$P_{{{\text{f}},{\text{t}},{\text{n}}}}^{{\prime {\text{PV}}}} = A \times P_{\text{PV}}^{\text{rated}} \times \eta_{\text{PV}}^{\text{t}}$$
(25)

In this formulation, \(P_{{{\text{f}},{\text{t}},{\text{n}}}}^{\text{PV}}\) is produced power by PV system. \(A\) is installation area of PV system.\(P_{\text{PV}}^{\text{rated}}\) is the rated capacity of PV unit per 1 m2 and \(\eta_{\text{PV}}^{\text{t}}\) is the efficiency of PV system. It should be noted that scheduled power of PV system cannot exceed available generated power by PV system which is expressed by (26).

$$P_{{{\text{f}},{\text{t}},{\text{n}}}}^{\text{PV}} \le P_{{{\text{f}},{\text{t}},{\text{n}}}}^{{\prime {\text{PV}}}}$$
(26)

2.6 Battery Storage System

Available energy in the battery storage is expressed as follows (Alipour et al. 2015):

$$E_{{{\text{r}},t + 1,{\text{n}}}}^{\text{B}} = E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{B}} + \eta_{{{\text{r}},{\text{n}}}}^{\text{charge}} \times P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}} - \frac{1}{{\eta_{{{\text{r}},{\text{n}}}}^{\text{discharge}} }} \times P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}}$$
(27)

In this formulation, \(E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{B}}\) is the available energy in the battery storage. \(\eta_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}}\) and \(\eta_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}}\) are the efficiencies of charge and discharge of battery storage system. The constraint of available energy in the battery storage is as follows:

$$E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\rm{min} } \le E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{B}} \le E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\rm{max} }$$
(28)

In this formulation, \(E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\rm{min} }\) and \(E_{{{\text{r}},{\text{t}},{\text{n}}}}^{\rm{max} }\) are the minimum and the maximum available energy in the battery. Limitations of charge and discharge of battery storage are expressed as follows:

$$P_{{{\text{r}},{\text{t}},{\text{n}}}}^{{{\text{charge}},\rm{min} }} \times \alpha_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}} \le P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}} \le P_{{{\text{r}},{\text{t}},{\text{n}}}}^{{{\text{charge}},\rm{max} }} \times \alpha_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}}$$
(29)
$$P_{{{\text{r}},{\text{t}},{\text{n}}}}^{{{\text{discharge}},\rm{min} }} \times \beta_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}} \le P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}} \le P_{{{\text{r}},{\text{t}},{\text{n}}}}^{{{\text{discharge}},\rm{max} }} \times \beta_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}}$$
(30)
$$\alpha_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}} + \beta_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}} \le 1$$
(31)

In order to separate charge and discharge conditions of battery from each other, Eq. (31) is used.

2.7 Power Flow Constraint

Power balance limitation of studied model including CHP systems, boiler units, conventional power generators, PV systems, wind turbines and battery storage system is expressed as follows:

$$p_{{{\text{t}},{\text{n}}}}^{\text{buy}} + P_{{{\text{k}},{\text{t}},{\text{n}}}}^{\text{CHP}} + P_{{{\text{l}},{\text{t}},{\text{n}}}}^{\text{G}} + P_{{{\text{u}},{\text{t}},{\text{n}}}}^{\text{W}} + P_{{{\text{f}},{\text{t}},{\text{n}}}}^{\text{PV}} + P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{discharge}} - P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{charge}} - P_{{{\text{r}},{\text{t}},{\text{n}}}}^{\text{demand}} = \sum\limits_{{u,r\hat{I}N_{\text{bus}} }} {V_{\text{t}}^{\text{n}} \times V_{\text{t}}^{\text{u}} \times } Y_{\text{line}}^{\text{un}} \times (\theta_{\text{t}}^{\text{n}} - \theta_{\text{t}}^{\text{u}} )$$
(32)

In this equation, \(V_{\text{t}}^{\text{n}}\) is voltage of bus n and \(V_{\text{t}}^{\text{u}}\) is voltage of bus u. \(\theta_{\text{t}}^{\text{n}}\) is the voltage angle of bus n and \(\theta_{\text{t}}^{\text{u}}\) is the voltage angle of bus u. \(Y_{\text{line}}^{\text{un}}\) is line admittance between buses n and u.

Limitation of line connecting different buses to each other is expressed as follows:

$$V_{\text{t}}^{\text{n}} \times V_{\text{t}}^{\text{u}} \times Y_{\text{line}}^{\text{un}} \times (\theta_{\text{t}}^{\text{n}} - \theta_{\text{t}}^{\text{u}} ) \le P_{\text{L}}^{\text{un}}$$
(33)

where \(P_{\text{L}}^{\text{un}}\) is maximum capacity of the line connecting different buses to each other.

2.8 Heat Buffer Tank

Utilized model for heat buffer tank is taken from (Shahverdi and Moghaddas-Tafreshi 2008). Total generated heat by microgrid is equal to the heat generation of CHP system and boiler units which is expressed as follows:

$$\overline{{H_{{{\text{t}},{\text{n}}}} }} = \mathop \sum \limits_{k = 1}^{{N_{\text{CHP}} }} H_{{k,{\text{t}},{\text{n}}}}^{\text{CHP}} + \mathop \sum \limits_{m = 1}^{{N_{\text{b}} }} H_{{m,{\text{t}},{\text{n}}}}^{\text{b}}$$
(34)

Generated heat by buffer tank while considering loss and extra heat production during shutdown and start-up condition is expressed as follows:

$$H_{{{\text{t}},{\text{n}}}} = \overline{{H_{{{\text{t}},{\text{n}}}} }} - \beta_{\text{loss}} SU_{{{\text{h}},{\text{t}},{\text{n}}}} + \beta_{\text{gain}} SD_{{{\text{h}},{\text{t}},{\text{n}}}}$$
(35)

In this formulation, \(\beta_{\text{loss}}\) and \(\beta_{\text{gain}}\) are losses during shutdown condition and extra heat production during start-up condition. So, available heat of heat buffer tank can be expressed as follows:

$$B_{{{\text{t}},{\text{n}}}} = \left( {1 - \eta } \right)B_{{\left( {t - 1} \right),{\text{n}}}} + H_{{{\text{t}},{\text{n}}}} - H_{{{\text{t}},{\text{n}}}}^{\text{D}}$$
(36)

In this formulation, \(\eta\) is the heat loss rate of the heat buffer tank. It should be noted that available heat of heat buffer tank is constrained as follows:

$$B_{\rm{min} } \le B_{{{\text{t}},{\text{n}}}} \le B_{\rm{max} }$$
(37)

In this equation, \(B_{ \rm{min} }\) and \(B_{ \rm{max} }\) are the minimum and maximum rate of capacities of heat buffer tank. The limitations related to the ramp up and down rates of heat buffer tank are expressed as follows:

$$B_{{{\text{t}},{\text{n}}}} - B_{{t - 1,{\text{n}}}} \le B_{\rm{max} }^{\text{charge}}$$
(38)
$$B_{{t - 1,{\text{n}}}} - B_{{{\text{t}},{\text{n}}}} \le B_{\rm{max} }^{\text{discharge}}$$
(39)

It should be noted that \(B_{ \rm{max} }^{\text{charge}}\) and \(B_{ \rm{max} }^{\text{discharge}}\) are the maximum limitations of charge and discharge of heat buffer tank.

3 Case Study

Studied model in this paper is a 10-bus test system including CHP systems, boiler units, conventional power generators, PV system, wind turbine and battery storage. The studied model is captured in Fig. 2. In the studied system, boiler units and heat buffer tank are connected to buses 1, 3 and 7 and battery storage is placed at bus 5. Furthermore, CHP system type-1 is placed at bus 7 and CHP system type-2 is placed at bus 5. PV system is placed at bus 7. Wind units are placed at buses 1 and 3. Furthermore, conventional thermal units are placed at buses 1, 3 and 10. It should be noticed that upstream network is connected to buses 1 and 3.

Info of utilized CHP systems is presented in Table 1.

Table 1 Info of utilized CHP systems (Nazari-Heris et al. 2018)

The cost coefficients related to thermal units and boilers are 100 $/MW and 23.4 $/MWth, respectively (Alipour et al. 2015). Minimum and maximum values of capacity of conventional thermal units are presented in Table 2.

Table 2 Rated capacity of boilers and thermal units (Alipour et al. 2015)

Info of utilized battery storage is presented in Table 3.

Table 3 Info of utilized battery storage (Alipour et al. 2015)

Data of utilized heat buffer tank are provided in Table 4.

Table 4 Data of heat buffer tank (Alipour et al. 2015)

Start-up and shutdown costs of CHP units, boilers and conventional thermal systems are presented in Table 5.

Table 5 Start-up and shutdown costs of different units (Alipour et al. 2015)

Output power of PV system is illustrated in Fig. 3.

Fig. 3
figure 3

Output power of PV system

Wind speed profile is taken from (Malakar et al. 2014) which is captured in Fig. 4. According to this figure, rated, cut-in and cut-out wind speeds of wind turbine are 13, 3 and 25 m/s. The maximum wind speed is 10.55 m/s. The maximum generation of wind turbine at buses 9 and 14 is 0.5 MW and 0.4 MW.

Fig. 4
figure 4

Wind speed

Electrical demand and heating demand of CHP-based microgrid are depicted in Figs. 5 and 6, respectively. It is noteworthy that the exchanged power between the buses in microgrid should be lower than rated value which is 0.4 MWh.

Fig. 5
figure 5

Electrical demand of microgrid

Fig. 6
figure 6

Heat demand of microgrid

Each bus of studied model has its own share from electrical and heat demands of network which is illustrated in Fig. 7.

Fig. 7
figure 7

Share of each bus from electrical and heating demands

Finally, price of upstream network is captured in Fig. 8 (Nazari-Heris et al. 2017).

Fig. 8
figure 8

Price of upstream network

4 Simulation Results

In this section, simulation results related to the economic dispatch of CHP-based microgrid in a 10-bus test system have been presented. Studied test system is divided into several zones, and local generation units in each zone can be operated either in grid-connected mode or islanded mode. Zone 1 covers buses 1, 2 and 6. Zone 2 includes buses 3, 4 and 5, and zone 3 includes buses 7, 8, 9 and 10. So, two case studies are investigated, namely operation of CHP-based microgrid in grid-connected mode which is case 1 and operation of CHP-based microgrid in islanded mode which is case 2.

In order to solve the proposed model, DICOPT solver of General Algebraic Modeling System (GAMS) has been used (Brooke and Meeraus 1990). DICOPT is a well-known solver of the GAMS, which is able to solve models of the form:

$$\begin{aligned} {\text{MINLP}} & \quad \rm{min} /\rm{max} \, f(x, \, y) \\ & {\text{subject}}\;{\text{to}}\;g(x, \, y) \sim b \\ & l_{x} \le x \le u_{x} \\ & {\text{y}} \in \left\lceil {l_{y} } \right\rceil , \ldots ,\left\lfloor {u_{y} } \right\rfloor \\ \end{aligned}$$
(40)

In which, continuous and discrete variables of the optimization problem are indicated by x and y, respectively. The symbol \(\sim\) is utilized in the optimization problem to define relational operators of \(\{ \le , = , \ge \}\). It can be mentioned that the constraints of the optimization problem can be either linear or nonlinear ones. Bounds l and u on the variables are dealt with directly. To define the smallest integer, greater than or equal to x, \(\left\lceil x \right\rceil\) is used. Similar to such indication, \(\left\lfloor x \right\rfloor\) is utilized to define the largest integer, less than or equal to x. It is notable that the discrete variables can be either binary or integer variables. Accordingly, the DICOPT solver is implemented in this study to solve the presented model for solving the economic dispatch problem of multi-zone microgrids containing the CHP plants, boilers, power generators, PV units, WT and battery storage under limitations of electrical networks. Here, \(f(x, \, y)\) in (40) is the operation cost of the problem mentioned by (1), (2), (17) and (19). The constraints \(g(x, \, y) \sim b\) in (40) are the constraints of the problem (3)–(5), (8)–(14), (21)–(27), (31)–(36), (38) and (39). Additionally, the variables limitation of \(l_{x} \le x \le u_{x}\) in (40) is the variables limitation of the problem mentioned in (6), (7), (15), (16), (18), (20), (28)–(30) and (37).

The results obtained from simulations are presented in the following.

4.1 Results

Case (1) Operation of CHP-based microgrid in grid-connected mode: In this mode, in addition to the local generation units available in the microgrid such as PV system, wind turbines, power generators, CHP units and electrical energy storage system in each zone, provided power by the upstream network which is injected to the buses 1 and 3 can be used to supply energy demand. Total operation cost of CHP-based microgrid in this mode is $3805.634 which includes $1584.706 cost of purchased power from upstream network, $ 309.514 cost of generated power by PO units, $1105.378 cost of CHP units and $ 806.036 cost of HO units. In this case, injected power by the upstream network to the substations 1 and 3 is used to supply some energy demand. The provided power by the upstream network is depicted in Fig. 9. Total generated power by renewable units including PV and wind units is captured in Fig. 10. Furthermore, generated power by power generators or so-called power-only (PO) units at buses 1, 3 and 10 as well as generated heat by boiler units or so-called heat-only (HO) units at buses 3, 5 and 7 are illustrated in Figs. 11 and 12, respectively.

Fig. 9
figure 9

Purchased power from upstream network in grid-connected mode

Fig. 10
figure 10

Produced power by renewable units in grid-connected mode

Fig. 11
figure 11

Produced power by PO units in grid-connected mode

Fig. 12
figure 12

Produced heat by HO units in grid-connected mode

Case (2) Operation of CHP-based microgrid in islanded mode: In this mode, local generation units of microgrid in each zone are the only resources to supply energy demands of microgrid. So, total operation cost of microgrid in this mode is $ 3513.902 which includes $ 1105.378 cost of CHP units, $ 1602.488 cost of PO units and $ 806.036 cost of HO units. According to the obtained results, total operation cost of microgrid in the islanded mode is reduced 7.66% in comparison with grid-connected mode. This reduction is mainly because in islanded mode, renewable units have been operated more to generate more power to supply energy demand in comparison with grid-connected mode. Also, distributed power-only units have generated more power to make up the energy deficiency caused by the absence of power of upstream network. It can be understood from these results that by integrating distributed energy units in microgrids, energy demands can be supplied without considering upstream network which can lead to better economic results. The produced power by renewable units and well-generated power and heat by PO and HO units are illustrated in Figs. 13, 14 and 15.

Fig. 13
figure 13

Produced power by renewable units in islanded mode

Fig. 14
figure 14

Produced power by PO units in islanded mode

Fig. 15
figure 15

Produced heat by HO units in islanded mode

As it can be seen from Figs. 9, 10, 11 and 12, in gird-connected mode, most of the active electrical demand has been satisfied through the imported power from power market. In fact, imported power from power market seems to be more economic for the operator of system. In other words, from economic viewpoints, purchased power from power market with various hourly prices has been preferred to the generated power by local generation units operated with fixed operation cost.

On the other hand, when microgrid has been operated in islanded mode, responsibility of local generation units has been increased to supply electrical demand. As depicted in Figs. 13, 14 and 15, generation of power generators located in buses 1 and 3 has been increased to supply electrical demand. In detail, since power market power is injected to buses 1 and 3 in grid-connected mode, when the injected power to the mentioned buses has been ignored in the islanded mode, total generated power by power generators located in buses 1 and 3 has been increased. For more comparison, total generated power by power generators located in buses 1, 3 and 10 is illustrated in grid-connected and islanded operation modes in Figs. 16, 17 and 18.

Fig. 16
figure 16

Produced heat by PO unit located in bus 1 in different cases

Fig. 17
figure 17

Produced heat by PO unit located in bus 3 in different cases

Fig. 18
figure 18

Produced heat by PO unit located in bus 10 in different cases

4.2 Comparison

The proposed methodology in this paper aims at minimizing total operation cost of renewable-based microgrid by considering power flow constraints. The proposed mathematical-based model is studied in islanded and grid-connected modes. In comparison with other researches that have investigated the similar problem, the results obtained in this paper seem to be more realistic. In other words, there have been some papers that have dealt with economic scheduling of CHP-based microgrid energy system. For instance, Alipour et al. (2015) have studied optimal scheduling of CHP-based microgrids in which feasible regions of CHP units have been linearly modeled. However, power flow limitations have not been considered in the mentioned paper. In this paper, similar problem has been studied in a 10-bus test system with considering power flow limitations. Considering power flow constraints can lead to accurate simulations so that supplied power by the generation sections can be calculated more accurately. In this paper, the main goal of proposing optimization model for microgrid energy systems is to assess optimal scheduling of CHP-based microgrid energy systems in realistic condition to reach practical results.

A comprehensive comparison of the literature with the present study is provided in Table 6, which includes different viewpoints. The main objective of each study as well as time horizon of each work has been reported. In addition, the system components of studied systems have been introduced including CHP, thermal generator, boiler, wind, PV, fuel cell and battery. Moreover, the consideration of multi-zone structure and implementation of the frameworks on multi-bus system are determined. Finally, the solution method of each introduced model is investigated, which contains GAMS optimization solvers, Lagrangian relaxation method, branch and bound technique and heuristic optimization method. It can be observed that the presented model in this paper can be defined as a comprehensive model in terms of consideration of multi-zone structure and multi-bus system in integrated heat and power microgrids taking into account the limitation of electrical energy network. Thus, the presented model is superior to other works in the literature by solving the optimal scheduling of integrated heat and power energy systems in realistic condition since both multi-zone structure and multi-bus system as well as CHP units, energy storage technologies and renewable energy sources are taken into account in the present study.

Table 6 Comparison of the literature with the current work

5 Simulation Results

Economic dispatch of CHP-based microgrid in a 10-bus test system is studied under power flow constraints in this paper. Studied test system is divided into several zones, and each zone can operate either in grid-connected mode or islanded mode. The studied test system includes local generation units including renewable and non-renewable ones such as conventional thermal plants, CHP units, WT units, PV system, battery storage systems, boiler units and heat buffer tank. Mixed-integer linear programming is used to model the feasible operating regions of CHP units. The simulation results revealed that total operation cost of CHP-based microgrid in islanded mode is reduced 7.66% in comparison with grid-connected mode. In fact, in the islanded mode, by integrating renewable and non-renewable distributed generation units, energy demand is supplied through local units, which has led to better economic operation of microgrid. In other words, increase in portion of renewable units in supplying energy demand has reduced total cost of operating system. So, it can be concluded that optimal operation of CHP-based microgrid can be obtained in islanded mode.