Introduction

Continuous increasing of residential, commercial, and industrial energy needs [1], restrictions in existing new energy sources [2] and rising emission production [3] are present and future challenges of energy management issues.

Extensive power loss in electricity transmission lines from central power plants to the points of consumption [4] and low fuel conversion efficiency in electricity production [5] have made the distributed generation (DG) systems attractive. Researchers have focused on applications and performance of DG systems especially when these systems provide combined cooling, heating, and power loads with overall efficiency higher than 80% [6].

Vaithilingam et al. [7] presented different types and methods of desalination using solar energy from the perspective of exergy analysis. In this paper, exergy performance cost factors and economic feasibility have been used to investigate several types of desalination plants including solar stills, humidification and dehumidification, multi-effect distillation, reverse osmosis, and multi-stage flash desalination. The results showed that the use of solar energy instead of other energy sources in the desalination process had the highest economic savings and the highest exergy efficiency. Jassem Al Doury et al. [8] used a new and accurate method based on real data from energy and exergy analyzes for each component of the proposed system to extract energy and exergy flows in buildings. The case study in this paper was the Al-Andalus school building. The results showed that the total energy and the total exergy consumptions are the same in the new and traditional methods, but the use of the new method leads to a reduction in energy/exergy losses (from 934 GJ to 725 GJ) and energy costs (from $ 40,500 to $ 37,000). Ahmadimanesh et al. [9] used district heating (DH) and cooling systems. In their system, the grid provided the required electricity load, gas boilers and electrical boilers besides heat pump provided heating load, and electrical chiller and heat pump provided cooling load. Their studied DH annual operation condition, economic analysis and emission production were investigated and optimized for various system configurations. They concluded that the use of electrical chiller and heat pump was a suitable option in providing heating and cooling loads with higher energy efficiency. Erdeweghe et al. [10] proposed four geothermal configurations for district heating which were optimized with Net Present Value (NPV) as an objective function. They used Organic Rankine Cycle (ORC) to provide the electricity load at the consumption point and district heating for providing required heating load. They also optimized their systems with defining NPV as an objective function. Chahartaghi et al. [11] presented energy and exergy analyses along with thermo-economic optimization of a geothermal heat pump to supply hot water for domestic application by defining the total annual cost (TAC) as the objective function. In this paper, the effect of water temperature at the evaporator inlet on the system coefficient of performance and the effects of heat capacity and soil total heat transfer coefficient in different climates on the optimal value of the objective function were investigated using different refrigerants in the refrigeration system. Results showed that by selecting R507a as the working fluid, the maximum value of COP is obtained. Also, the results showed a 34% share of ground heat exchanger cost in the TAC value and a 53% share of the compressor in the whole system irreversibility. Finally, the optimum values of saturation temperatures in the evaporator and condenser were calculated to be − 1.5 and 51.89 °C, respectively. Wang et al. [12] optimized a CHP system with DH and concluded that optimization with two thermal and economic objective functions provides more energy efficient results in comparison with NPV as one objective function. They also emphasized that the emission in these systems has to be investigated besides technical and economic studies. Zeini Vand et al. [13] have presented energy and economic modeling of a gas turbine-based CHP system. In this paper, the total cost is selected as the objective function and by defining system design variables including compressor pressure ratio, compressor isentropic efficiency, turbine isentropic efficiency, combustion inlet temperature, and turbine inlet temperature, the optimization of the proposed system is performed by using Genetic Algorithm. The results showed that with the optimal fuel consumption in the combustion chamber, the thermal efficiency of the system has increased from 36.6 to 48.9%. Noussan et al. [14] analyzed DH systems in Italy. He concluded that the most of their studied DH systems have Primary Energy Factor (PEF) of 0.9–1.8 and have emission factor of zero to 0.3 kg kWh−1. Primary energy factor indicates how much primary energy is used to generate a unit of electricity or a unit of useable thermal energy. The current standard value for PEF in the EU is 2.5. Thermoeconomics has been also applied for the retrofitted heating and domestic hot water facility of four dwelling blocks located in Bilbao by Picallo-Perez et al. [15]. Their exergy analysis showed that with retrofitting, the average exergy efficiency of heating system improved from 2.55 to 4.01% and the operating cost reduced 32.71% for heating and 48.5% for domestic hot water. Both district heating and district cooling were studied by Sanaye et al. [16] in a combined cycle power plant. They applied multi-objective genetic algorithm optimization method with exergy efficiency and total annual cost of system as two objective functions to optimally design the operating parameters of that integrated system. Silva et al. [17] showed that in a typical gas engine, the exergy of exhaust gases can be recovered and by the use of an Organic Rankine Cycle (ORC) they could recover about 45% of the exergy of exhaust gases which increased the gas engine overall fuel conversion energy efficiency from 43.1 to 46.2%. With a similar concept, Comodi et al. [18] proposed a reciprocating engine besides an electrical heat pump and a heating energy storage tank for providing electricity, cooling and heating in Italy. The heating energy storage was charged by exhaust gases from the engine. They analyzed their proposed integrated system in both energy (energy efficiency) and economic (Net Present Value) aspects for obtaining the system configuration and the capacity of equipment. Wang et al. [19] modeled and optimized a combined heating and power integrated system with district heating (DH), which also included solar energy and energy storage systems. They selected the system total cost as an objective function. Authors also provided a discussion regarding the storage tank volume and its charging mode with change in heating load. Trochio [20] investigated two CHP-DH systems with two types of prime movers including reciprocating engines as the first type and fuel cell with microturbine as the second type. He selected the total cost as the objective function in optimization of two above systems. Wang et al. [21] studied a CHP-DH system with an auxillary boiler for covering peaks of heating load during a year. The location of boiler in integrated CHP-DH system for achieving the lowest heat loss and cost was also investigated. Uris et al. [22] analyzed a biomass-fired Organic Rankine Cycle (ORC) CHP-DH system. They selected the profit as an objective function and estimated the optimum value of system nominal power. Heating oil recovered heat from biomass system. This heating power was then used as a heat source for evaporator of an ORC system. Heating and cooling were also provided by heat recovery from ORC condenser which used for space heating and domestic hot water in cold seasons and for cooling by an absorption chiller in hot seasons. Their system was also equipped with a backup boiler. Fabrizio et al. [23] proposed an integrated combined cooling, heating and power system for a city in Italy. They reported results of decrease in fuel consumption and CO2 emission for their proposed system. Mostafavi et al. [24, 25] studied a gas turbine-based CHP-DH system for a city in Iran. They used heat recovery steam generators for steam production to be used for both district heating and power production by a steam turbine. They also proposed adding five thermal storage tanks for considering fluctuations in heating load consumption. Rezaei et al. [26] in a review paper introduced district energy systems and their applications for providing heating and cooling loads. They compared the traditional and district energy-CHP systems (with gas turbines and diesel engines as prime movers) with various working fluids, size of piping network, and energy sources. Three indexes named energy and exergy efficiencies as well as the payback period were applied for their analyses. Verda et al. [27] analyzed a CHP-DH system for providing power and heat. They also reported that with using heating storage tank, the fuel consumption of backup boilers decreased. Results showed that district heating system in Turin could decrease the fuel consumption for 12% and dropped the total costs for 5%.

Contents and novelties

In this paper, a comprehensive approach for optimization of a gas engine-based integrated system is proposed. This approach includes energy, exergy, economic, and environmental analyses besides multi-objective optimization for estimating the optimum values of design parameters. Two objective functions are exergy efficiency (\(\eta_{\mathrm{Ex,tot}}\)) and relative annual benefit (RAB). Design parameters are number and nominal power of gas engines and backup boilers as well as effectiveness of heat exchangers.

The above approach is applied for optimum selection of equipment in an integrated system for a residential complex located in Mazandaran province close to Caspian Sea.

The above presented system analysis and optimization as well as the case study itself have the following novelties:

  1. 1.

    Two new cycles for providing thermal (space heating, space cooling, and domestic hot water) and electrical loads in hot and cold seasons for a residential complex are designed and proposed. Theses cycles which include gas engines, heat recovery heat exchangers, backup boilers and chillers are first modeled (in energy, exergy, economic, and environmental aspects). Variable electricity, heating and cooling loads during the year are considered here.

  2. 2.

    Variable prices of electricity, fuel, and emissions (including, CO, CO2, and NOx) penalties during the system lifetime were considered in the system analysis which is the actual condition in economic analysis. Results in this condition were compared with constant operating price condition.

  3. 3.

    Multi-objective optimization procedure for choosing the equipment for the optimized integrated system uses a new objective function (Relative Annual Benefit, RAB) besides the exergy efficiency. Decision variables are also new and suitable for the investigated application. Furthermore, the optimum selection of equipment is from those available in market which matches the optimization results with what really exists in our market.

  4. 4.

    Sensitivity analysis is another interesting part of the work which investigated the effects of change in electricity and fuel prices on optimum values of design parameters. The results of this analysis can be used for predicting changes which might be made in the proposed integrate system at various locations with different energy unit prices.

System modeling

Energy modeling

Energy analysis of an integrated combined heating, cooling, and power production system is performed here for cold and hot seasons. Figures 1 and 2 show two cycles of power generation and heat recovery for the above two seasons. The recovered heat from engine jacket cooling water is used for providing domestic hot water during both cold and hot seasons as well as a part of DH hot water during cold seasons. The rest of the required domestic hot water during both cold and hot seasons is provided by backup boilers. The engine exhaust gases also provide heat for district heating (DH) in cold seasons. In hot seasons, the recovered heat from exhaust gas is used for heating up water which passes through generator of absorption chiller for providing cooling load.

Fig. 1
figure 1

The schematic view of heat recovery from gas engine jacket cooling water for domestic hot water and heat recovery from exhaust hot gases for district heating during cold seasons

Fig. 2
figure 2

The schematic view of heat recovery from gas engine jacket cooling water for domestic hot water and heat recovery from exhaust hot gases for district cooling during hot seasons

Cold seasons

Based on Fig. 1, warm water at point (1) and hot water exiting from jacket water enter water–water Gasketed plate heat exchanger (GHX). A part of warm water exiting from GHX (1 − N) at point (2) enters SHX (1 − N), a water–gas shell and tube heat exchanger. Engine exhaust hot gases warm up district heating water flow which exits from SHX (1 − N) at point (3). DH water is used for space heating. The rest of warm water exiting from GHX (1 − N) at point (2) enters GHX (N + 3) for domestic hot water. Then, the total water mass flow rate (\(\dot{m}_{\text{w,tot}}\)) at point (2) with temperature T2 is computed by writing Eqs. (1) and (2) for the effectiveness of GHX ((1 − N)) and SHX (1 − N) [28, 29]:

$$\begin{aligned} & \varepsilon = \frac{{{Q}_{\mathrm{h}} }}{{{Q}_{ \max} }} = \frac{{Q_{\mathrm{c}} }}{{{Q}_{\max}}} = \frac{Q}{C_{\min} \left( T_{{\rm{h}}_ 1} - T_{{\rm{c}}_1}\right)} \hfill \\ & {{\varepsilon}}_{{{\rm{GHX}}(1 - {\text{N}})}} = \frac{{{\dot{m}}_{\mathrm{wj}} {C}_{\mathrm{p,wj}} \left(T_{\mathrm{w,out}} - {T}_{\mathrm{w,in}} \right)}}{C_{\min }\left(T_{\mathrm{w,out}} - T_{1} \right)} =\frac{\dot{m}_{\mathrm{w,tot}} C_{\mathrm{p,w}} \left(T_2 - T_1 \right)}{C_{\min} \left( T_{\mathrm{w,out}} - T_1 \right)}\hfill \\\end{aligned}$$
(1)

Similarly, for SHX:

$$\begin{aligned} {{\varepsilon }}_{{{\mathrm{SHX}} (1 -{\mathrm{N}})}} &= \frac{{{\dot{m}}_{\mathrm{g}} C_{\mathrm{p, g}} \left({{T}_{\mathrm{in}} - {T}_{\mathrm{out}} } \right)}}{{C}_{\min }\left( {T}_{\mathrm{in}} - {T}_{2} \right)}= \frac{{\left( {{\dot{m}}_{\mathrm{w,DH}} } \right){C}_{\mathrm{p,w}}\left( {T}_{3} - {T}_{2} \right)}}{{C}_{\min } \left({T}_{\mathrm{in}} - {T}_{2} \right)} \hfill \\ \xi &= \frac{{{\dot{m}}_{\mathrm{w,DH}} }}{{{\dot{m}}_{\mathrm{w,tot}} }} = \frac{{{\dot{m}}_{\mathrm{w,tot}} - {\dot{m}}_{\mathrm{w,DO}} }}{{{\dot{m}}_{\mathrm{w,tot}} }} \hfill \\ \end{aligned}$$
(2)

Qc, Qh, and Qmax are heat transfer rate to cold fluid, to hot fluid and (\({\dot{m}} \times {C}_{\mathrm{p}}\))min (min \({\dot{m}} \times {C}_{\mathrm{p}}\) for either cold or hot fluid), respectively. The coefficient ξ is the mass flow rate ratio of hot water in DH (for space heating) to the total water mass flow rate in the integrated system.

Hot seasons

Based on Fig. 2, engine jacket cooling water is used for providing domestic hot water in GHX (1 − N) and exhaust hot gases is applied for producing hot water for sending to the generator of absorption chiller for district cooling (DC).

The water mass flow rate passing through SHXs (\({\dot{m}}_{\mathrm{w,DH}}\)) and its temperature (\(T_{3^{\prime\prime}}\)) were obtained from Eq. (3) [28].

$$\varepsilon _{{{\text{SHX}}(1 - {\text{N}})}} = \frac{{Q_{{\text{h}}} }}{{Q_{{\max }} }} = \frac{{Q_{{\text{c}}} }}{{Q_{{\max }} }} = \frac{Q}{{C_{{\min }} \left( {T_{{{\text{h}}_{1} }} - T_{{{\text{c}}_{1} }} } \right)}} = \frac{{\dot{m}_{{\text{g}}} C_{{{\text{p, g}}}} \left( {T_{{{\text{in}}}} - T_{{{\text{out}}}} } \right)}}{{C_{{\min }} \left( {T_{{in}} - T_{{3^{{\prime }} }} } \right)}} = \frac{{\dot{m}_{{{\text{w,DH}}}} C_{{{\text{p,w}}}} \left( {T_{{4^{{\prime }} }} - T_{{3^{{\prime }} }} } \right)}}{{C_{{\min }} \left( {T_{{{\text{in}}}} - T_{{3^{{\prime }} }} } \right)}}$$
(3)

Fig. 2 shows that, the exit water from treatment plant (point 5′) enter GHX (N + 3) heat exchanger to recover heat from water flow which has received energy from engine jacket cooling water in GHX (1) to (N) for domestic hot water applications (Fig. 2-point 6′). Pressure drops are also considered in our system analysis.

System total energy efficiency

Based on Figs. 1 and 2, temperature and water mass flow rates are the same at the entrance/exit to/from gasket plate water–water heat exchangers GHX (1 to N) for hot and cold seasons. The deficit of heating load was provided by backup boilers.

The energy efficiency for cold seasons is computed from Eq. (4):

$$\eta_{{\rm{En},\,{\rm{cold}}}} = \left( {\frac{{\sum {\dot{E}_{\mathrm{n,out}} } }}{{\sum {\dot{E}_{\mathrm{n,in}} } }}} \right)_{\rm{win}} = \left( {\frac{\begin{aligned} \left( {\dot{W} - \dot{W}_{\mathrm{pumps}} } \right) + \dot{m}_{\mathrm{w,DH}} Cp_{\mathrm{w}} \left( {T_{3} - T_{1} } \right) \hfill \\ + \left( {1 - \xi } \right)\dot{m}_{\mathrm{w,tot}} Cp_{\mathrm{w}} \left( {T_{2} - T_{1} } \right) \hfill \\ \end{aligned} }{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV}}}} \right)_{\mathrm{cold}}$$
(4)

For hot seasons, Eq. (5) provides energy efficiency:

$$\begin{aligned} & \eta_{{\mathrm{En},\,{\mathrm{hot}}}} = \left( {\frac{{\sum {\dot{E}_{\mathrm{n,out}} } }}{{\sum {\dot{E}_{\mathrm{n,in}} } }}} \right)_{sum} \\ & \,\,\,=\left( {\frac{{\left( {\dot{W} - \dot{W}_{\mathrm{pumps}} } \right) + \dot{m}_{\mathrm{w,tot}} Cp_{\mathrm{w}} \left( {T_{{2^{\prime}}} - T_{{1^{\prime}}} } \right) + \dot{m}_{\mathrm{w,chiller}} Cp_{\mathrm{w}} \left( {T_{{4^{\prime\prime}}} - T_{{3^{\prime\prime}}} } \right)}}{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV}}}} \right)_{\mathrm{hot}} \\ \end{aligned}$$
(5)

Thus, for the whole system:

$$\eta_{\mathrm{En,tot}} = \frac{{\beta \left( {\sum {\dot{E}_{\mathrm{n,out}} } } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\sum {\dot{E}_{\mathrm{n,out}} } } \right)_{\mathrm{hot}} }}{{\beta \left( {\sum {\dot{E}_{\mathrm{n,in}} } } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\sum {\dot{E}_{\mathrm{n,in}} } } \right)_{\mathrm{hot}} }}$$
(6)

With inserting Eqs.(4) and (5) in Eq. (6), and after simplifying:

$$\begin{aligned} & \eta_{\mathrm{En,\,tot}} = \frac{{\dot{W} - \dot{W}_{\mathrm{pumps}} }}{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV}}} + \beta \left( {\frac{{\dot{m}_{\mathrm{w,DH}} Cp_{\mathrm{w}} \left( {T_{3} - T_{1} } \right) + \left( {1 - \alpha } \right)\dot{m}_{\mathrm{w,tot}} Cp_{\mathrm{w}} \left( {T_{2} - T_{1} } \right)}}{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV}}}} \right)_{\mathrm{cold}} \\ & \quad + \left( {1 - \beta } \right)\left( {\frac{{\dot{m}_{\mathrm{w,tot}} Cp_{\mathrm{w}} \left( {T_{{2^{\prime}}} - T_{{1^{\prime}}} } \right) + \dot{m}_{\mathrm{w,chiller}} Cp_{\mathrm{w}} \left( {T_{{4^{\prime\prime}}} - T_{{3^{\prime\prime}}} } \right)}}{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV}}}} \right)_{\mathrm{hot}} \\ \end{aligned}$$
(7)

In relations (4)–(7), \(\dot{W}\), \(\dot{m}_{\mathrm{f,PM}}\), \(\dot{m}_{\mathrm{w,DH}}\),\(\dot{m}_{\mathrm{w,tot}}\), and \(\dot{m}_{\mathrm{w,chiller}}\) are gas engine power output, fuel consumption mass flow rate, hot water mass flow rate in district heating cycle (Fig. 1, point 3), total warm water mass flow rate exiting from GHXs (1 − N), and hot water mass flow rate in cooling cycle (Fig. 1, point 3″). β is also the percentage of system operating period during cold seasons.

Heat exchanger heat transfer surface area

Water-gas shell and tube heat exchangers (SHX) and water–water gasket plate heat exchangers (GHX) are used in the proposed integrated system (Figs. 1 and 2). As mentioned in Section 5, the water pressure in hot water lines is increased to prevent two-phase flow production. In single phase heat exchangers, the heat transfer coefficient, α, and the pressure drop, ΔP, are estimated from Eqs. (1)–(4) mentioned in Table 1 for sell and tube heat exchangers and from Eqs. (5)–(6) for gasketed plate heat exchangers [30,31,32,33].

Table 1 One-phase heat transfer coefficients and pressure drop relations in water–gas shell and tube and water–water gasketed plate heat exchangers

The geometrical specifications of heat exchangers are listed in Table 2 [30,31,32,33]. Then, the heat transfer surface area for heat exchangers is obtained from the following standard relations.

Table 2 Geometrical parameters used in modeling of water–gas shell and tube and water–water gasketed plate heat exchangers based on heat transfer coefficient computed from equations listed in Table 1

Heat exchanger capacity (heat transfer rate) [30]:

$$\dot{Q} = UA_{\mathrm{s}} F'\Delta T_{\mathrm{LMTD}} = \left( {\dot{m}\,\Delta h} \right)_{wf} = \left\{ {\dot{m}\,C\,(T_{\mathrm{in}} - T_{\mathrm{out}} )} \right\}_{\rm{gas}}$$
(8)

Overall heat transfer coefficients [30]:

$$\frac{ 1}{{UA_{\mathrm{s}} }} = \frac{ 1}{{\alpha_{\rm{i}} A_{\rm{i}} }} + R_{f,i} + \frac{{\ln \left( {\frac{{D_{\rm o} }}{{D_{\rm{i}} }}} \right)}}{{ 2\pi k_{\mathrm{w}} L}} + R_{\rm f,o} + \frac{ 1}{{\alpha_{\rm o} A_{\rm o} }}$$
(9)

Log Mean Temperature Difference (LMTD) [30]:

$$\Delta T_{\mathrm{LMTD}} = \frac{{\Delta T_{\max } - \Delta T_{\min } }}{{\ln \left( {\frac{{\Delta T_{\max } }}{{\Delta T_{\min } }}} \right)}},\,\,A_{\mathrm{s}} = n_{\rm t} \pi D_{\rm h} L$$
(10)

In the above equations, U is overall heat transfer coefficient, F′ is flow arrangement correction factor, ∆TLMTD is log mean temperature difference, \(\dot{m}\,\)is the mass flow rate, Rf,i and Rf,o are fouling factors, and α is heat transfer coefficient, respectively.

By following the procedure mentioned in Fig. 3 for estimating heat transfer surface area for SHX and GHX heat exchangers, their corresponding cost of equipment are obtained.

Fig. 3
figure 3

Flowchart of energy modeling of the shell and tube as well as gasketed plate heat exchangers to compute the overall heat transfer coefficient and pressure drop

Exergy analysis

Exergy is the maximum useful available work that a system may provide when undergoing a process from an initial condition to a final condition (P0, T0), where P0 and T0 are atmospheric pressure and temperature. In a steady state process without electrical, magnetic, surface tension, and nuclear reaction effects, the total exergy of a system is associated with the random thermal motion, kinetic energy, potential energy, and chemical energy, relative to a reference state [34].

$$\dot{E}x = \dot{E}x^{PH} + \dot{E}x^{KN} + \dot{E}x^{PT} + \dot{E}x^{CH}$$
(11)

Variations in kinetic and potential exergy were assumed to be negligible in this paper.

The exergy balance equation for a control volume [34]:

$$\sum {\dot{E}x_{\mathrm{in}} } - \sum {\dot{E}x_{\mathrm{out}} } = \sum {\dot{E}x_{\mathrm{dest}} }$$
(12)
$$\dot{E}x_{\mathrm{dest}} = \dot{I} = \dot{E}x_{\mathrm{heat}} - \dot{E}x_{\mathrm{work}} + \dot{E}x_{\mathrm{mass,in}} - \dot{E}x_{\mathrm{mass,out}}$$
(13)
$$\dot{E}x_{\mathrm{heat}} = \sum {\left( {1 - \frac{{T_{0} }}{{T_{\mathrm{j}} }}} \right)\dot{Q}_{\mathrm{j}} }$$
(14)
$$\dot{E}x_{\mathrm{work}} = \dot{W}_{\mathrm{turb}}$$
(15)
$$\dot{E}x_{\mathrm{mass,in}} = \sum {\dot{m}_{\mathrm{in}} \zeta_{\mathrm{in}} }$$
(16)
$$\dot{E}x_{\mathrm{mass,out}} = \sum {\dot{m}_{\mathrm{out}} \zeta_{\mathrm{out}} }$$
(17)

The specific exergy is defined as:

$$\begin{aligned} &\zeta_{\mathrm{incom.}} = \left( {h - h_{0} } \right) - T_{0} \left( {s - s_{0} } \right) \hfill \\ &\zeta_{\mathrm{com.}} = C_{\rm p} \left( {T - T_{0} } \right) - T_{0} \left( {C_{\rm p} \ln \frac{T}{{T_{0} }} - R\ln \frac{P}{{P_{0} }}} \right) \hfill \\ \end{aligned}$$
(18)

In Eq. (18), h and s values for incompressible flow are obtained from REFPROP software, Version 9.11 which is developed for estimating thermodynamic properties of water and organic fluids. Thus, pressure and temperature at various points in the cycle are used as input to the REFPROP software. This software which is product of NIST Inc. provides the thermodynamic properties of various fluids with maximum 2% difference with actual values [35].

Then, the output values are inserted in the first equation of (18) for exergy computation. For compressible flows (exhaust hot gases) inside SHXs, the computed pressure and temperature which are obtained from conservation equations are inserted in the second equation of (18) for exergy estimation.

The exergy efficiency for cold seasons is:

$$\eta_{{\mathrm{Ex},\,{\mathrm{cold}}}} = \frac{{\sum {\dot{E}x_{\mathrm{out}} } }}{{\sum {\dot{E}x_{\mathrm{in}} } }} = \left( {\frac{{\dot{W} + \dot{m}_{\mathrm{w,DH}} \zeta_{3} + \left( {1 - \alpha } \right)\dot{m}_{\mathrm{w,tot}} \zeta_{2} }}{{\dot{m}_{\mathrm{f,PM}} \zeta_\mathrm{{f}} + \dot{m}_{\mathrm{w,tot}} \zeta_{1} + \dot{W}_{\mathrm{pumps}} }}} \right)_{\mathrm{cold}}$$
(19)

The first term in numerator is the prime mover power output, the second term is the exergy of hot water to be sent to DH cycle, and the third term is the exergy of warm water to be sent to domestic hot water cycle. The first term in denominator is the exergy rate of gas engine fuel consumption, the second term is the exergy of the returned water for reheating in GHX 1 − N (point 1), and the third term is pumping power consumption.

In Eq. (19),\(\zeta_{\mathrm{f}}\) is the specific exergy of fuel (natural gas in this case). With negligible physical exergy (due to close thermal conditions with ambient pressure and temperature),\(\zeta_{\mathrm{f}}\) is approximately equal to chemical exergy (LHV × σ where σ depends on the fuel composition, and is 1.04 ± 0.5% for natural gas) [36, 37].

The exergy efficiency for hot seasons is:

$$\eta_{\mathrm{Ex},\,\mathrm{hot}} = \frac{{\sum {\dot{E}x_{\mathrm{out}} } }}{{\sum {\dot{E}x_{\mathrm{in}} } }} = \left( {\frac{{\dot{W} + \dot{m}_{\mathrm{w,tot}} \zeta_{{2^{\prime}}} + \dot{m}_{\mathrm{w,chiller}} \zeta_{{43^{\prime\prime}}} }}{{\dot{m}_{\mathrm{f,PM}} \zeta_{\mathrm{f}} + \dot{m}_{\mathrm{w,tot}} \zeta_{{1^{\prime}}} + \dot{m}_{\mathrm{w,chiller}} \zeta_{{3^{\prime\prime}}} + \dot{W}_{\mathrm{pumps}} }}} \right)_{\mathrm{hot}}$$
(20)

The first term in numerator is the prime mover power output, the second term is the exergy of warm water at point (2′), and the third term is the exergy of hot water at point (4″). The first term in denominator is the prime mover input energy rate of fuel consumption, the second term is the exergy at point (1′), the third term is the exergy at point (3″), and the fourth term is pumping power consumption.

Thus, the total exergy efficiency for the whole system is:

$$\eta_{\mathrm{Ex,tot}} = \frac{{\beta \left( {\sum {\dot{E}x_{\mathrm{out}} } } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\sum {\dot{E}x_{\mathrm{out}} } } \right)_{\mathrm{hot}} }}{{\beta \left( {\sum {\dot{E}x_{\mathrm{in}} } } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\sum {\dot{E}x_{\mathrm{in}} } } \right)_{\mathrm{hot}} }}$$
(21)

With inserting Eqs. (19) and (20) in Eq. (21), then:

$$\begin{aligned} \eta_{\mathrm{Ex},\,\mathrm{tot}} = \hfill \\ \,\,\frac{{\dot{W} + \beta \left( {\dot{m}_{\mathrm{w,DH}} \zeta_{3} + \left( {1 - \alpha } \right)\dot{m}_{\mathrm{w,tot}} \zeta_{2} } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\dot{m}_{\mathrm{w,tot}} \zeta_{{2^{\prime}}} + \dot{m}_{\mathrm{w,chiller}} \zeta_{{4^{\prime\prime}}} } \right)_{\mathrm{hot}} }}{{\dot{m}_{\mathrm{f,PM}} \mathrm{LHV} + \dot{W}_{\mathrm{pumps}} + \beta \left( {\dot{m}_{\mathrm{w,tot}} \zeta_{1} } \right)_{\mathrm{cold}} + \left( {1 - \beta } \right)\left( {\dot{m}_{\mathrm{w,tot}} \zeta_{{1^{\prime}}} + \dot{m}_{\mathrm{w,chiller}} \zeta_{{3^{\prime\prime}}} } \right)_{\mathrm{hot}} }} \hfill \\ \end{aligned}$$
(22)

Environmental analysis

Pollution emission and control regulation, as well as technical documentation [38,39,40], express environmental pollutants of a prime mover including CO, CO2, and NOx, based on volume or mass concentration. Here, the concentration represents the amount of O2 in the exhaust gases, which accounts for about \(X_{{{\text{O}}{ 2} }}\) = 5% for gas engines.

The parameter λ as the pollutant mass per unit energy input (mg kWhLHV−1) is related to the concentration and LHV of the fuel using Eq. (23) [38]:

$$\lambda = \left( {K \times \gamma_{\mathrm{{x}}} } \right)\frac{21}{21 - X}\frac{3600}{\text{LHV}}$$
(23)

In the above relation, coefficient 21/(21 − X) converts the composition of exhaust gases to stoichiometric conditions. Also, the parameters K and γx represent the mass concentration (mg Nm−3) and the stoichiometric amount of exhaust gases per unit mass of inlet fuel (Nm3 kg−1), respectively.

If the fuel contains compounds C, H, N, S, and O, the parameter K for the stoichiometric combustion is calculated from the following equation:

$$\begin{aligned} {\text{C}}_{\rm c} {\text{H}}_{\rm h} {\text{S}}_{\mathrm{s}} {\text{N}}_{\mathrm{n}} {\text{O}}_{\rm o} + \left( {c + \frac{h}{4} + s - \frac{o}{2}} \right)\left( {{\text{O}}_{2} + 3.76{\text{N}}_{2} } \right) \to {\text{cCO}}_{2} + \frac{h}{2}{\text{H}}_{2} O + {\text{sSO}}_{2} \hfill \\ + \left[ {3.76\left( {c + \frac{h}{4} + s - \frac{o}{2}} \right) + \frac{n}{2}} \right]{\text{N}}_{2} \hfill \\ \end{aligned}$$
(24)
$$K = 22.414\left( {\frac{{4.76 \times x_{\rm C} }}{12} + \frac{{3.76 \times x_{\rm H} }}{4} + \frac{{4.76 \times x_{\rm S} }}{32} - \frac{{3.76 \times x_{\rm O} }}{32} + \frac{{1.0 \times x_{\rm N} }}{28}} \right)$$
(25)

So that xC, xH, xN, xS, and xO represent the mass fraction of fuel elements and the expression in brackets represents the kilomol of exhaust gas per kilogram of inlet fuel.

According to Eq. (23), the parameter λ relates the values of the pollutants to the input fuel energy. This method allows to compare different systems with different sizes that have the same fuel consumption. However, it does not consider the quality of conversion of input energy (fuel) into useful output energy (electrical and thermal). Therefore, the parameter δ (mg kWhe,t−1) is used as follows:

$$\delta = \frac{\lambda }{\eta }$$
(26)

In this relation, η represents the efficiency of converting fuel energy into useful electrical or thermal energy.

In an integrated system, factors such as electricity purchase from the grid (eme,buy), fuel consumption in backup boilers to supply deficit heat (emf,b), and fuel consumption in prime movers (emf,eng) lead to the production of environmental pollutants. It should be noted that in the conventional system, all the electricity required is purchased from the grid and all the heat required is provided by fuel consumption in the boiler.

$$\begin{aligned} {\text{em}}_{\mathrm{integ}} = \left( {{\text{em}}_{\mathrm{e,buy}} + {\text{em}}_{\mathrm{f,b}} + {\text{em}}_{\mathrm{f,eng}} } \right)_{\mathrm{integ}} \hfill \\ {\text{em}}_{\mathrm{trad}} = \left( {{\text{em}}_{\mathrm{e,buy}} + {\text{em}}_{\mathrm{f,b}} } \right)_{\mathrm{trad}} \hfill \\ \end{aligned}$$
(27)
$$\begin{aligned} \left( {{\text{em}}_{\mathrm{e,buy}} } \right)_{\mathrm{integ}} = E_{{\mathrm{buy},{\text{integ}}}} \times \left( {\delta_{\mathrm{e,CO}} + \delta_{{\mathrm{e,CO}_{2} }} + \delta_{\mathrm{e,NOx}} } \right)_{\mathrm{trad}} \hfill \\ \left( {{\text{em}}_{\mathrm{e,buy}} } \right)_{\mathrm{trad}} = E_{{\mathrm{buy},{\text{trad}}}} \times \left( {\delta_{\mathrm{e,CO}} + \delta_{{\mathrm{e,CO}_{2} }} + \delta_{\mathrm{e,NOx}} } \right)_{\mathrm{trad}} \hfill \\ \delta_{\rm{e}} = \left( {\frac{{\lambda_{\rm{e}} }}{{\eta_{\rm{e}} }}} \right)_{\mathrm{trad}} \hfill \\ \end{aligned}$$
(28)
$$\begin{aligned} \left( {{\text{em}}_{\mathrm{f,b}} } \right)_{\mathrm{integ}} = Q_{{\mathrm{b},{\text{integ}}}} \times \left( {\delta_{\mathrm{t,CO}} + \delta_{{\mathrm{t,CO}_{2} }} + \delta_{\mathrm{t,NOx}} } \right)_{\mathrm{trad}} \hfill \\ \left( {{\text{em}}_{\mathrm{f,b}} } \right)_{\mathrm{trad}} = Q_{\mathrm{b,trad}} \times \left( {\delta_{\mathrm{t,CO}} + \delta_{{\mathrm{t,CO}_{2} }} + \delta_{\mathrm{t,NOx}} } \right)_{\mathrm{trad}} \hfill \\ \delta_{\rm t} = \left( {\frac{{\lambda_{\rm t} }}{{\eta_{\rm t} }}} \right)_{\mathrm{trad}} \hfill \\ \end{aligned}$$
(29)
$$\left( {{\text{em}}_{\mathrm{f,eng}} } \right)_{\mathrm{integ}} = \left( {\dot{m}_{\mathrm{f,eng}} \times {\text{LHV}}} \right) \times \left( {\delta_{\mathrm{net,CO}} + \delta_{{\mathrm{net,CO}_{2} }} + \delta_{\rm{net,NOx}} } \right)_{\mathrm{integ}}$$
(30)

In the above equations, the parameters δe, δt, ηe,trad, ηt,trad, LHV, and \(\dot{m}_{\mathrm{f,eng}}\)indicate pollutant mass per electrical energy unit, pollutant mass per thermal energy unit, conventional system electrical efficiency (grid efficiency), conventional system thermal efficiency (boiler thermal efficiency), lower heating value of fuel and mass consumption rate of fuel in gas engine, respectively. Also, the parameter δnet represents the net pollutant mass in the integrated system and is defined as follows:

$$\left( {\delta_{\mathrm{net}} } \right)_{\mathrm{integ}} = \delta_{\mathrm{integ}} - \delta_{\mathrm{avd}} ,\,\,\,\delta_{\mathrm{integ}} = \left( {\frac{\lambda }{{\eta_{\rm{e}} }}} \right)_{\mathrm{integ}} ,\,\,\,\delta_{\mathrm{avd}} = \frac{{\lambda_{\mathrm{t,trad}} }}{{\eta_{\mathrm{t,trad}} }}\frac{{\eta_{{\mathrm{t},{\text{integ}}}} }}{{\eta_{{\mathrm{e},{\text{integ}}}} }}$$
(31)

In the above relation, the parameters ηe,integ and ηt,integ represent the electrical efficiency and the thermal efficiency of the integrated system, respectively. Also, the subscript avd represents the avoided emission due to electricity generation and heat recovery in the integrated system. In Table 3, the constant values of the parameters involved in integrated system environmental modeling are presented [41].

Table 3 Constant parameters in environmental modeling of integrated system [41]

Economic analysis

Equivalent uniform annual cost

Equivalent uniform annual cost (EUAC) is computed from Eq. (32). P is investment cost, n system lifetime, i interest rate and SV is salvage value. P with A/P factor and SV with A/F factor became annualized [42, 43]:

$${\text{EUAC}} = {\text{P}}\left( {{{\text{A}} \mathord{\left/ {\vphantom {{\text{A}} {\text{P}}}} \right. \kern-0pt} {\text{P}}} , {\text{i}}\% ,{\text{n}}} \right) - {\text{SV}}\left( {{{\text{A}} \mathord{\left/ {\vphantom {{\text{A}} {\text{F}}}} \right. \kern-0pt} {\text{F}}} , {\text{i}}\% ,{\text{n}}} \right)$$
(32)

where A/P and A/F are:

$$\left( {{{\text{A}} \mathord{\left/ {\vphantom {{\text{A}} {\text{P}}}} \right. \kern-0pt} {\text{P}}} , {\text{i\% ,n}}} \right) = \left[ {\frac{{{\text{i}}\left( {1 + {\text{i}}} \right)^{\text{n}} }}{{\left( {1 + {\text{i}}} \right)^{\text{n}} - 1}}} \right]$$
(33)
$$\left( {{{\text{A}} \mathord{\left/ {\vphantom {{\text{A}} {\text{F}}}} \right. \kern-0pt} {\text{F}}} , {\text{i\% ,n}}} \right) = \left[ {\frac{\text{i}}{{\left( {1 + {\text{i}}} \right)^{\text{n}} - 1}}} \right]$$
(34)

Variable operational cost method

When the price of equipment or other operating costs such as electricity, during system lifetime change within a time period (with rate of change, r) and if the interest rate is i during that time period [44].

If r > i, then:

$$\begin{aligned} P = \frac{c}{1 + i}\left( {{F \mathord{\left/ {\vphantom {F A}} \right. \kern-0pt} A},x\% ,n} \right) = \frac{c}{1 + i}\frac{1}{{\left( {{A \mathord{\left/ {\vphantom {A F}} \right. \kern-0pt} F},x\% ,n} \right)}} \hfill \\ 1 + x = \frac{1 + r}{1 + i} \hfill \\ \end{aligned}$$
(35)

where the denominator is given by Eq. (34).

If r < i, then:

$$\begin{aligned} P = \frac{c}{1 + r}\left( {{P \mathord{\left/ {\vphantom {P A}} \right. \kern-0pt} A},x\% ,n} \right) = \frac{c}{1 + r}\frac{1}{{\left( {{A \mathord{\left/ {\vphantom {A p}} \right. \kern-0pt} p},x\% ,n} \right)}} \hfill \\ \frac{1}{1 + x} = \frac{1 + r}{1 + i} \hfill \\ \end{aligned}$$
(36)

where the denominator of P is given by Equation (33). c in Eqs. (35) and (36) is the price of buying/selling electricity from/to the grid, the price of natural gas fuel consumption or the penalty cost for emissions just for the first year of the plant operation.

After computing new values for P, this value should be substituted in Eq. (32) for finding EUAC.

Cost index method

Cost index method [45] is used in this paper to update equipment costs from the year which is given in literature to the year 2019. The prices which are introduced in section 5 (constant input values in modeling and optimization) are reference prices.

$${{Z}}_{\mathrm{new}} = {{Z}}_{\mathrm{ref}} \frac{{{\text{CI}}_{\mathrm{new}} }}{{{\text{CI}}_{\mathrm{ref}} }}$$
(37)

Relative annual benefit

Relative Annual Benefit is defined here (Eq. 38) for considering investment cost, maintenance cost, operating cost, income from selling electricity to the grid (if there is any), buying electricity from the grid, and penalty cost due to emissions [46]. RAB shows the benefit of installation and operation of the integrated system relative to that for traditional system (buying electricity from the grid and burning fuel for providing heating load).

$${\text{RAB}} = {\text{TAB}}_{\mathrm{integ}} + {\text{TAC}}_{\mathrm{trad}}$$
(38)

TABInteg in the above relation is the total annual benefit of the integrated system which includes all incomes and costs (for buying electricity from the grid and for buying fuel for generation of electricity and heat by the integrated system). TACtrad also is the total annual costs of traditional system (for buying all required electrical load from the grid as well as buying and burning fuel for providing all required heating loads). Relation (38) describes that when the integrated system provides all electrical and heating load needs, TACtrad will not be paid anymore.

Thus, TABInteg in Eq. (38) can be described as:

$$\begin{aligned} {\text{TAB}}_{\mathrm{integ}} &= \sum\limits_{i = 1}^{{\text{T}}} {\left[ \begin{aligned} &E_{\mathrm{s,i}} \times \varphi_{\mathrm{e,s,i}} - E_{\mathrm{b,i}} \times \varphi_{\mathrm{e,b,i}} - \dot{m}_{\mathrm{f,i}} {{\text{LHV}}} \times \varphi_{{\mathrm{f,i}}} - \left( {{\text{em}}_{\mathrm{integ}} \times \psi_{{\mathrm{em}}} } \right)_{{\mathrm{CO}}} \hfill \\ &\quad - \left( {{\text{em}}_{\mathrm{integ}} \times \psi_{\mathrm{{em}}} } \right)_{{{\text{CO}}_{ 2} }} - \left( {{\text{em}}_{\mathrm{integ}} \times \psi_{{\mathrm{em}}} } \right)_{{\mathrm{NOx}}} \hfill \\ \end{aligned} \right] \times \tau_{\rm{i}} } \hfill \\ &\quad - \sum\limits_{{\mathrm{j}} = 1}^{\text{K}} {\left( {M + {\text{EUAC}}} \right)_{\mathrm{j}} \left( {\text{NC}} \right)_{\mathrm{j}} n_{\mathrm{j}} } \hfill \\ \end{aligned}$$
(39)

In relation (39), T is number of days per year (365), \(\tau_{\rm{i}}\) is number of hours in a day (24 h), NC is nominal capacity of equipment, EUAC is equivalent uniform annual cost for equipment, M is maintenance cost, LHV is fuel lower heating value, Es,i is the amount of excess electricity production sold to the grid (kW), Eb,i is the amount of electricity bought from the grid (kW), K is number of equipment, j and n are the type and number of equipment (including prime movers, pumps, boilers, absorption chiller, SHX, GHX), eminteg × ψem is the emission penalty cost (Eq. 27) where the integrated system is used (including CO, CO2, and NOx emissions for the amount of electricity bought from the grid and for the amount of fuel used for running prime movers), φe,b,i is the unit price of buying electricity from the grid, φe,s,i is the unit price of selling electricity to the grid and φf,i is the unit price of fuel.

TACtrad in Eq. (40) can also be described as:

$$\begin{aligned} {\text{TAC}}_{\mathrm{trad}} &= C_{\mathrm{tot,ele}} + C_{\mathrm{tot,heat}} - \left( {{\text{em}}_{\mathrm{trad}} \times \psi_{\mathrm{em}} } \right)_{\mathrm{CO}} \hfill \\ & \quad - \left( {{\text{em}}_{\mathrm{trad}} \times \psi_{\mathrm{em}} } \right)_{{{\mathrm{CO}}_{ 2} }} - \left( {{\text{em}}_{\mathrm{trad}} \times \psi_{\mathrm{em}} } \right)_{\mathrm{NOx}} \hfill \\ \end{aligned}$$
(40)

where Ctot,ele, Ctot,heat, and emtrad × ψem in Eq. (40) describe the cost of buying total electricity demand from the grid (Eq. 41), the cost of buying fuel for providing total heating load (Eq. 42), and the total emission penalty cost (for both total electricity bought from the grid and total fuel consumed for providing heating load) (Eq. 27).

$$C_{\mathrm{tot,ele}} = \sum\limits_{i = 1}^{T} {\left( {E_{\mathrm{dmn,i}} \times \varphi_{\mathrm{e,b,i}} } \right)} \tau_{\rm{i}}$$
(41)
$$C_{\mathrm{tot,heat}} = \sum\limits_{i = 1}^{T} {\left( {\frac{{\dot{m}_{\mathrm{f,i}} \times \mathrm{LHV} \times \varphi_{\mathrm{f,i}} }}{{\eta_{\mathrm{b}} }}} \right)} \tau_{\rm{i}} + \left( {M_{\mathrm{b}} + {\text{EUAC}}_{\mathrm{b}} } \right) \times {\text{NC}}_{{\mathrm{b}}}$$
(42)

ηb, Mb, EUACb, NCb, and \(\dot{m}_{\mathrm{f,i}}\)in Eq. (42) explain hot water boiler efficiency, boiler maintenance cost, boiler equivalent uniform annual cost, boiler capacity, and boiler fuel consumption mass flow rate.

From Eq. (38), one may draw this conclusion that, as TACtrad is always a positive value, thus when TABInteg < 0, then the integrated system just has advantage to traditional system if and only if when RAB > 0.

In this case, still the payback period should be computed (as described in below) to check whether this period is short enough or not.

Payback period

Equation (43) shows the definition for Net Present Worth (NPW) [47]:

$$\begin{aligned} NPW = - \Delta C_{\mathrm{in}} \,(\$ ) - \Delta C_{{\text{O}}\& {\text{M}}} \,(\$ {\text{year}}^{-1})\left( {{P \mathord{\left/ {\vphantom {P A}} \right. \kern-0pt} A},i\% ,p} \right) \hfill \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, + \Delta I\,(\$ {\text{year}}^{-1})\left( {{P \mathord{\left/ {\vphantom {P A}} \right. \kern-0pt} A},i\% ,p} \right) + \Delta S\,(\$ )\,\left( {{P \mathord{\left/ {\vphantom {P F}} \right. \kern-0pt} F},i\% ,p} \right) \hfill \\ \end{aligned}$$
(43)

ΔCin is the investment cost, ΔCO&M is annual operating and maintenance costs, ΔI is annual income, ΔS is salvage value and p is payback period.

Where

$$\left( {{P \mathord{\left/ {\vphantom {P A}} \right. \kern-0pt} A},i\% ,p} \right) = \left( {\frac{{(1 + i)^{\text{p}} - 1}}{{i\,(1 + i)^{\text{p}} }}} \right)$$
(44)
$$\,\left( {{P \mathord{\left/ {\vphantom {P F}} \right. \kern-0pt} F},i\% ,p} \right) = \left( {\frac{1}{{(1 + i)^{\text{p}} }}} \right)$$
(45)

By inserting NPW = 0, p, the payback period is computed.

Optimization

Objective functions

The values of design parameters in the proposed integrated system for a specific case study should be obtained through defining objective functions and by executing system optimization. Two objective functions that cover both economic and thermodynamics of system optimization are Exergy efficiency (\(\eta_{\mathrm{Ex,tot}}\)), and relative annual benefit (RAB). Energy analysis uses the first law of thermodynamics for specifying working conditions or thermodynamic states (pressures and temperatures) at various points of the integrated system. RAB actually is an economic parameter which is obtained from energy analysis (by estimating operating cost, fuel consumption and costs of buying, selling and generating electricity, heat transfer surface area, etc.). The system analysis by the second law of thermodynamics also changes the thermodynamic states at various system points. As the exergy analysis obtained from both the first and the second laws of thermodynamics considers the irreversibility and exergy destruction of processes and equipment. Thus, with choosing both RAB and exergy efficiency, the first and the second laws of thermodynamics are taken into account.

Design parameters (decision variables) and constraints

Design parameters (decision variables) are number and nominal power of gas engines, number and nominal capacity of boilers, as well as the effectiveness of water–gas (SHX)1−N and water–water (GHX)1−N+3 heat exchangers. Table 4 shows the range of variations of design parameters. It should be noted that nominal power of gas engines and the heating capacity of boilers are selected from available values in the market.

Table 4 Design parameters and their range of variations

Optimization method (Genetic Algorithm)

Genetic Algorithm (GA) method is applied for multi-objective optimization of the designed and proposed system. GA is a search method which is used for finding the exact or approximate solutions of the optimization problems. This algorithm is a special class of evolutionary algorithms, which have been inspired by evolutionary biology concepts such as inheritance, mutation, selection, and crossover [46].

As the appropriate values of tuning parameters for GA method should be selected, these parameters are briefly introduced here. Later in section 6, results and discussion, the values of tuning parameters are reported with which the convergence of GA would be guaranteed. The computational procedure in genetic algorithm includes the following steps [48]:

  1. 1.

    An initial population should be generated.

  2. 2.

    The fitness of each individual in the population should be evaluated.

  3. 3.

    Repeating the optimization process until a termination cause is achieved (reaching the ultimate iteration limit, time constraint, objective function constraint, getting uniform solutions in successive generations (occurrence of pause), time constraint of uniformity in generations and etc).

In the optimization process, a probability function for each element of the population is assigned. Then based on this function, the parents are selected (Table 5, selection). In the next step, by means of GA operators such as crossover (Table 5, crossover) and offsprings (Table 5, offspring) are obtained. Then, other GA operators such as mutation (Table 5, mutation) are used to create and improve population. Finally, the new created population replaced with primary one and the optimization process continued until a stopping condition (Table 5, stopping criteria) satisfied.

Table 5 Tuning parameters of genetic algorithm in multi-objective optimization

It should be noted that each of the GA operators such as selection, crossover, and mutation have functions with different fractional percentage and are selectable depending on the optimization problem. For example, in selecting parents, there are different functions such as Elitist, Roulette, Scaling and Tournament. In Tournament function, a subset of the attributes of a community was choosed and all members of this subset compete together. At the end, only one attribute is selected from each subset for production.

Decision making

Selection of an optimum point from Pareto front needs decision making. Linear programming technique for multidimensional analysis of preference (LINMAP) and technique for order preference by similarity to ideal solution (TOPSIS) decision-making methods [49, 50] are used in this paper due to robust techniques and uniqueness of reaching the final result (“Appendix”). However, before applying these methods, Pareto curve which shows all possible optimum point solutions should be drawn in terms of non-dimensional objective functions [49, 50]. Thus, Fuzzy method is applied to make objective functions non-dimensional with the following relations:

$$\begin{array}{ll} S_{\mathrm{ij}}^{\text{n}} = \frac{{S_{\mathrm{ij}} - \min \left( {S_{\mathrm{ij}} } \right)}}{{\max \left( {S_{\mathrm{ij}} } \right) - \min \left( {S_{\mathrm{ij}} } \right)}} &\,\,\,\,\,\,\,\,\,\,\,{\text{for}}\,{\text{maximizing}}\,{\text{objectives}} \hfill \\ S_{\mathrm{ij}}^{\text{n}} = \frac{{\max \left( {S_{\mathrm{ij}} } \right) - S_{\mathrm{ij}} }}{{\max \left( {S_{\mathrm{ij}} } \right) - \min \left( {S_{\mathrm{ij}} } \right)}} &\,\,\,\,\,\,\,\,\,\,\,{\text{for}}\,{\text{minimizing}}\,{\text{objectives}} \hfill \\ \end{array}$$
(46)

where \(S_{\mathrm{ij}}^{\text{n}}\) is the non-dimensional objective function. Also i, j, and n are points on Pareto curve, objective function, and normalized objective function.

Case study

Residential complex and its loads

Miarkola residential complex has 2656 units of 75 m2 (two bedrooms). This complex includes 82 blocks; each contains 10 floors (8 floors for residency and 2 floors for parkings) (Fig. 4) [51]. An integrated system is designed for this complex to provide required variable electrical, cooling and heating loads during a year.

Fig. 4
figure 4

The schematic view of Miarkola residential complex in Mazandaran Province [51]

Figure 5 shows the annual electrical load consumption which is estimated based on standards for home appliances and lightings [52].

Fig. 5
figure 5

Variations of electricity consumption of Miarkola residential complex during a year

For estimating heating and cooling loads, a typical unit was geometrically modeled in SketchUp 8.0 software and with Meteorological data for Mazandaran which is obtained from Meteonorm 7.0 software, with energy analysis performed by TRNSYS 17.0 software, annual heating and cooling loads are obtained. Figure 6 shows heating and cooling loads for four units (NE, NW, SE, SW) in a typical floor. From Fig. 6, it is observed that the cooling load is for days 140 to 285 (May 18 to October 11). In this time period, the space heating load is negligible.

Fig. 6
figure 6

Heating (a) and cooling (b) loads for four apartments in one floor of Miarkola residential complex

For domestic hot water, 6.44 kW is added to the above estimated space heating value.

Cycle specifications

It should be mentioned that for avoiding water vapor production in hot water lines (DH), the pressure is considered to be 11 bars (with 184.1 °C saturation temperature).

The returned water in DH cycle (point 1) and domestic warm water cycle (point 1′) are assumed to be about 30–35 °C.

Furthermore, parameter β was 67% for 4 months of cooling (and 8 months of heating).

Figure 2 for hot seasons shows that the hot water temperature at the exit of absorption chiller generator (point 3′) is about 80 °C which with 5 °C temperature drop at the entrance of SHX (point 3″), it reaches 75 °C. In this condition, the water temperature at GHX exit (point 2′) is about 50 °C. The mass flow rate of this hot fluid in GHX (N + 3) is estimated from energy balances in GHX (1) to GHX (N + 3).

Constant input values in modeling and optimization

Constant input values in modeling and optimizing of the integrated system for the mentioned residential complex, included the price of buying/selling electricity from/to the grid (\(\varphi_{\mathrm{e,b,i}}\), \(\varphi_{\mathrm{e,s,i}}\)) [53], fuel price (\(\varphi_{\mathrm{f,i}}\)) [54], CO, CO2 and NOx penalty costs [55,56,57], interest rate and lifetime of the integrated system which are listed in Table 6.

Table 6 Buying and selling prices of electricity and other constant values of parameters in ηEx,tot and RAB [53,54,55,56,57]

It should be mentioned that electricity buying price has three different tariffs during off peak (from 11:00 in night to 7:00 in morning), middle peak (from 7:00 in morning to 7:00 in evening), and on peak (from 7:00 in evening to 11:00 in night) hours.

Lower heating value (LHV) for natural gas is 47,804 kJ kg−1 (34,000 kJ m−3), the interest rate is 20%, and the system lifetime is 20 years. The salvage value at the end of system lifetime is 20% of initial cost, and the maintenance cost is estimated as 6% investment cost [29].

The equipment used in the studied integrated system is shown in Figs. 1 and 2. They are gas engines, heat exchangers SHX and GHX, boilers and chillers.

Gas engine nominal operating characteristics such as gas engine nominal power, thermal efficiency, exhaust gas mass flow rate, fuel consumption, temperature and mass flow rate of jacket cooling water as well as their investment cost are listed in Table 7 [29, 58, 59].

Table 7 Operating characteristics and investment costs for various gas engines [29, 58, 59]

The cost index ratio (CInew/CIref) is one for gas engines due to the fact that CInew = CIref = 541.7 at year 2019 [45].

The heating capacity and investment cost of boilers with burner are also listed in Table 8 [60]. For boilers, the cost index ratio CInew/CIref was 556.8/541.7 = 1.03 [45].

Table 8 Heating capacity and investment cost for various boilers (with burner) [60]

The updated investment cost of water–water gasket plate heat exchangers (GHX) and water–gas shell and tube heat exchangers (SHX) is obtained by fitting curves to the data which are given in their price list [45, 61, 62] with maximum 5% error. Figure 7 shows the updated prices of GHX and SHX heat exchangers versus their heat transfer surface area.

Fig. 7
figure 7

Costs of shell & tube and water–water gasketed plate heat exchangers in terms of their heat transfer surface area [45, 61, 62]

The time period for engine maintenance during a year is considered to be 2% of total annual hours (8760) which is equal to about 160 hours.

Variable cost of buying/selling electricity, fuel and emissions during system lifetime

Figure 8 shows an actual scenario in which the price of buying/selling electricity from/to the grid, fuel consumption as well as the penalty cost of emissions production change during the system lifetime. From Fig. 8, the growth of buying electricity from the grid 8%, selling electricity to the grid 6.5% [53], natural gas fuel 7% [54], and the penalty cost of emissions 9.33% [57, 63] was predicted.

Fig. 8
figure 8

Variations of buying/selling electricity from/to the grid [53], fuel cost [54] and emissions penalty [57, 63] during integrated system lifetime

It should be mentioned that the operating costs given in Table 6 are for the first year of the system economic analysis (c in relations 35 and 36).

Results and discussion

The modeling of our studied integrated system in four aspects of energy, exergy, economic, and environmental in both cold and hot seasons is performed as the first step for optimum selection and sizing of equipment in the integrated system by applying two-objective optimization method.

In Fig. 9, the flowchart for modeling (energy, exergy, economic, and environment) and optimizing of the integrated system using multi-objective Genetic Algorithm (GA) is shown.

Fig. 9
figure 9

Flowchart of modeling and optimizing the integrated system using two-objective Genetic Algorithm

Model verification

In the proposed integrated system, the gas engine as the prime mover, and the backup boiler are the main equipment. In this paper, the performance specifications of gas engines including temperature and mass rate of exhaust gases, temperature and mass flow rate of jacket cooling water, and mass flow rate of fuel consumption are extracted from references [58, 59]. Comparison of the results of these references with the information provided in reference [29] showed an acceptable error range, less than 2%.

Also, all the performance specifications of the backup boilers, including heat capacity, mass flow rate of fuel consumption and investment cost, have been extracted based on the information provided in reference [60].

Optimization results for the integrated system

The optimum values of design parameters including number and nominal power of gas engines, number and heating capacity of backup boilers and effectiveness of SHX and GHX had to be determined. Two objective functions in optimization are exergy efficiency (ηEx,tot), and relative annual benefit (RAB). The tuning parameters of GA are listed in Table 5 to guarantee the convergence of optimum values to a unique group of results.

Figure 10 shows Pareto front (curve) for the two above defined objectives (the RAB function is plotted along the X-axis, and the ηEx, tot function is plotted along the Y-axis). After making coordinates non-dimensional by fuzzy method, the selection of an optimum point from available points on Pareto front is performed by both LINMAP and TOPSIS methods. Similar obtained results show the correct procedure of finding this optimum point.

Fig. 10
figure 10

Pareto curve for two-objective optimization (ηEx,tot and RAB) of the integrated system for residential complex

Point A on Pareto curve (Fig. 10) shows the point with the maximum RAB value (about 3.61 × 107). Thus, for one objective (RAB) optimization, point A would be the ideal point for the maximum of RAB (however, at this point, the exergy efficiency is the minimum). Point B on Pareto curve (Fig. 10) shows the point with the maximum exergy efficiency value (45.08). Thus, for one objective (ηEx,tot) optimization, point B would be the ideal point for the maximum of ηEx,tot (however, at this point, RAB is the minimum). This shows conflicting between maximizing (RAB) and maximizing (ηEx,tot). Thus, by applying two-objective (RAB- ηEx,tot) optimization, one point (AB in Fig. 10 with RAB = 3.345 × 107 along the X-axis and ηEx,tot = 0.449 along the Y-axis) would be selected that compromises between two objective functions.

Table 9 shows the optimum values of design parameters and objective functions for the studied integrated system. Results show that 14 gas engines with nominal power 912 kW, 9 backup boilers with nominal capacity of 1450 kW and heat exchangers SHX and GHX with effectiveness values of 0.85 and 0.55, respectively, are selected. Engines and boilers can be located in one central or a few separate engine rooms.

Table 9 Optimum values of design parameters and objective functions for the integrated system

The values of objective functions at the optimum point are 44.9% for ηEx,tot, and 3.35 × 107 for RAB (Fig. 10).

Furthermore, the summary of results for system energy, exergy, environmental, and economic analyses at the optimum point are also shown in Table10. Results include inlet hot water temperature and mass flow rate to GHX (N + 1) for DH system in cold seasons (126.8°C, 28.1 kg s−1)cold (Fig. 1-point 3), inlet warm water temperature and mass flow rate to GHX (N + 3) for heating domestic warm water (or exiting from jacket cooling water) in cold and hot seasons (61.6 °C, 28.1 kg s−1) (Fig. 1-points 2 and Fig. 2-point 2′) and the mass flow rate of hot water flowing into generator of absorption chiller in hot seasons (118.25 kg s−1) (point 4″). Furthermore, other output parameters are the total investment cost (8.5 × 106 $), the total investment cost rate (1.74 × 106 $ year−1), maintenance cost (5.1 × 105 $ year−1), fuel cost for gas engines (2.36 × 106 $ year−1), backup boilers investment (4.5 × 105 $ year−1), and fuel consumption costs (1.0 × 106 $ year−1) in the integrated system as well as number of boilers, investment and fuel consumption costs in traditional system (28, 1.4 × 106 $, 3.11 × 106 $ year−1). Table 10 shows 2.46 × 107 m3 year−1 saving in fuel volume flow rate (68% reduction), 2.11 × 106 $ year−1 saving in boiler fuel cost, 1.95 × 105 $ year−1 reduction in boiler capital cost (67.8%), 4.55 × 108 kg year−1 saving in production of CO, CO2 and NOx emissions (87.5%) and 9.46 × 106 $ year−1 reduction in emissions cost of the integrated system in comparison with that for the traditional system. The integrated overall efficiency is about 74%. The payback period for the optimum integrated system with considering variable prices during the system lifetime is 1.6 years.

Table 10 Summary of results of energy, exergy, environmental, and economic analyses for the integrated system

With the integrated system during cold seasons, a noticeable portion of the required heating energy (for space heating/cooling and domestic hot water) is provided by heat recovery systems. This amount is about 20,262 kW (including 7618 kW recovered heat from Jacket cooling water and 12,644 kW from exit exhaust gases from engines) which is sent to DH system for space heating purpose. Moreover, in cold seasons, the deficit of heating energy for domestic hot water is provided by nine backup boilers (with 1450 kW nominal heating capacity, i.e., about 13,050 kW). It is interesting to note that in traditional system 28 boilers would be required.

During hot seasons, the heat recovery from engines (from both Jacket cooling water and exhaust) is very close to cold seasons due to the engines same operating conditions during a year. However, in hot seasons, the required heating energy for domestic hot water decreased (6870 kW) and for absorption chiller increased (14,980 kW).

Comparison of variable and constant operational cost

Comparison of results for variable and constant operational costs show that for constant price condition, RAB decreased from 3.35 × 107 to 2.24 × 107 $ year−1 (33.17% reduction). With focusing on relation (38) for RAB, it was found that in constant price condition, the total buying price of electricity from the grid, total selling price of electricity to the grid, total fuel consumption cost in gas engines and boilers, and the total emissions penalty cost changed from those for variable price condition (refer to Table11 for comparison). The following points maybe explained by results listed in Table 11:

Table 11 Comparison of variable and constant operational costs of buying/selling electricity, fuel and emissions penalty for the integrated and traditional systems
  1. (a)

    For traditional system with constant price condition, the boiler fuel consumption cost decreased in comparison with that for variable price condition. This resulted in reduction in Ctot,heat in relation (42), reduction in TACtrad in relation (40) and reduction in RAB in relation (38) for about 21.4%. Furthermore, in the integrated system due to reduction in boiler fuel consumption, TABinteg in Eq. 39 increased which resulted in increase in RAB for about 7% in comparison with variable cost condition. Thus, from two above falling and rising RAB values and with stronger effect of the first one, the net value of RAB showed total reduction in RAB is equal to 14.4%.

  2. (b)

    For the integrated system and with constant price condition, the fuel consumption cost of gas engines decreased which resulted in increasing TABinteg in Eq. 39, rising RAB in Eq. 38 for 29.5% in comparison with that for variable price condition.

  3. (c)

    For the traditional system and with constant price condition, the penalty cost of emissions for buying electricity from the grid and fuel consumption for providing heat in boilers decreased about 38.5% in comparison with that for variable cost condition. This resulted in falling emtrad × ψem, falling TACtrad in Eq. 40, and finally falling of RAB in Eq. 38.

    For the integrated system also the penalty cost of emissions production decreases which resulted in increase in TABinteg and increase in RAB for 38.7% in comparison with that for variable price condition.

  4. (d)

    In traditional system with constant price condition, the cost for buying electricity decreased for 33.4% in comparison with that for variable price condition. This deduced Ctot,ele in Eq. 41, deduced TACtrad in Eq. 40, and deduction of RAB in Eq. 38.

    In the integrated system decreasing in electricity buying cost always increases RAB.

  5. (e)

    In constant price condition, the income from selling electricity in the integrated system decreased for 27.6% in comparison with that for variable price condition. This decreased TABinteg in relation (39) and reduced RAB in Eq. 38.

The sum of all above points resulted in 33.2% decrease in RAB of constant prices in comparison with that for variable cost condition.

Results showed that for the integrated system the payback period increased from 1.6 years for variable price condition to about 2.67 years (40% rise) for constant price condition.

Sensitivity analysis

In this section, the effects of change in fuel (φf) and electricity (φe,s) prices on optimum values of design parameters are investigated. The results of this analysis can be used for predicting changes which might occur in the proposed integrated system with different prices at various locations.

Results in Table 12 show that with falling of fuel price, the optimum number of selected gas engines decreases and vice versa. The reason for this change is lower profit which could be accessible with heat recovery from gas engine jacket cooling water and exhaust. It should be declared that the reduction in boiler fuel consumption cost is about 78% and the reduction in fuel consumption cost of gas engines is about 16.2%. Thus, with decreasing the fuel price, the savings in boiler fuel consumption cost drops considerably.

Table 12 Sensitivity analysis of change in optimum values of design parameters with decrease/increase in fuel and selling electricity prices

Results of Table 12 show that with reducing the selling price of electricity to the grid, the optimum number of gas engines decreases and vice versa. This is due to decrease in income (and profit) from selling electricity to the grid.

Finally, with decreasing the number of gas engines, the number of backup boilers increases to provide the required heating energy during both cold and hot seasons and vice versa.

Results also showed that in our specific case study, the heat exchanger effectiveness which depends on water or gas mass flow rates and inlet or outlet temperatures did not change considerably with two economic fuel and electricity prices.

Conclusions

In this paper, a comprehensive design, modeling, and optimization procedure for selecting an optimum integrated system for a residential complex is performed. The studied integrated system is supposed to provide cooling, heating and power (with variable loads during a year) for the studied residential complex. The proposed designed cycles for cold and hot seasons are not found in the relevant literature.

In this paper, the optimal values of the objective functions (\(\eta_{\mathrm{Ex,tot}}\) and RAB), along with design parameters, are obtained by non-dimensioning Pareto front curve using fuzzy method and selecting final optimum point using LINMAP and TOPSIS methods.

The optimum selected integrated system with 14 gas engines (912 kW), 9 boilers (1450 kW), 74% overall efficiency, reduced 2.46 × 107 m3/year boilers fuel consumptions (68% reduction) with 2.11 × 106 $/year savings, as well as reduction of 87.5% CO, CO2 and NOx emissions (with corresponding penalty cost of 9.46 × 106 $/year) in comparison with that for traditional system (buying electricity from the grid and buying fuel for burning in boilers for providing required heating).

Sensitivity analysis of change in system design parameters with change in fuel and electricity prices is also investigated. This method could help designers to predict how the optimum results might change for locations with different fuel and electricity costs.

Appendix: Decision-making methods in multi-objective optimization

LINMAP decision-making method

The ideal point on the Pareto front curve is the point that each objective is optimized individually, regardless of considering other objective functions. Since in multiobjective optimization, there is no possibility of achieving optimal point of each objective separately, so, the ideal point is outside the Pareto curve. In the LINMAP method, after non-dimensionalization of all objective functions, the distance of each solution on the Pareto curve from the ideal point were computed with the following relation [49, 50]:

$${\text{Distance}}_{\rm{i}}^{ + } = \sqrt[ 2]{{\sum\limits_{j = 1}^{k} {\left( {S_{\mathrm{ij}} - S_{\mathrm{j}}^{\rm{ideal}} } \right)^{ 2} } }}$$
(1)

In Eq. (1), k and i refer to number of objectives and each solution on the Pareto curve, respectively. \(S_{\mathrm{j}}^{\mathrm{ideal}}\) is the ideal value of jth objective which is obtained by single-objective optimization. In the LINMAP method, the point with minimum distance from the ideal point is selected as the final optimum point (ifinal):

$$i_{\mathrm{final}} \equiv i \in \min \left( {{\text{Distance}}_{\rm{i}}^{ + } } \right)\,\,\,\,\,\,\,i = 1,\,2,\,\ldots,\,m$$
(2)

TOPSIS decision-making method

In TOPSIS method, beside the ideal point, a non-ideal point is also used to select the final optimum point. The non-ideal point is a point that objective functions have the worst values of their own. Therefore, in TOPSIS method, beside the minimum distance obtained by LINMAP method, the distance between each solution on the Pareto front curve with non-ideal point should also be computed [49, 50].

$${\text{Distance}}_{\rm{i}}^{ - } = \sqrt[ 2]{{\sum\limits_{j = 1}^{k} {\left( {S_{\mathrm{ij}} - S_{\mathrm{j}}^{\text{non-ideal}} } \right)^{ 2} } }}$$
(3)

Φi is also defined as the ratio of distance for each point on the Pareto curve from non-ideal point to sum of distances of that point from ideal and non-ideal points:

$$\varPhi_{\rm{i}} = \frac{{{\text{Distance}}_{\rm{i}}^{ - } }}{{{\text{Distance}}_{\rm{i}}^{ + } + {\text{Distance}}_{\rm{i}}^{ - } }}$$
(4)

In TOPSIS method, a point with maximum value of Φi is selected as the final optimum point:

$$i_{\mathrm{final}} \equiv i \in \max \left( {\varPhi_{\rm{i}} } \right)\,\,\,\,\,\,i = 1 , 2 ,\ldots , {m}$$
(5)