Optimal Operation of a Grid-Connected Hybrid Renewable Energy System for Residential Applications

The results of a study on incorporating solar-thermal collectors into a hybrid renewable energy system are reported. A photovoltaic–wind turbine–fuel cell–solar-thermal collector system is designed and an economic model is introduced for supplying the residential thermal and electrical loads via the grid-connected hybrid system. Since determining the optimal operation of a hybrid system such as a combined heat and power system constitutes a complex optimization problem requiring a sophisticated optimization method, a modified heuristic approach-based particle swarm optimization is proposed for solving the optimization problem. The results are compared with those obtained by an efficient metaheuristic optimization method, namely a genetic algorithm, in terms of accuracy and run time. The results show that, using the grid-connected hybrid combined heat and power system, among the cases considered, decreases the total cost of the system. The results also demonstrate that the reductions in daily cost relative to the base case by the modified particle swarm optimization algorithm for Cases 1–4 are 5.01%, 25.59%, 19.42%, and 22.19%, respectively. Finally, Case 2 is the most cost-effective and reliable. Moreover, the modified particle swarm optimization algorithm leads to better results than the genetic algorithm.


Introduction
Global residential energy consumption has increased in recent years and is expected to increase further in the future [1].The domestic and commercial sectors account for almost 30% of energy consumption globally [2].
Renewable sources of energy such as wind and solar energy have attracted growing attention recently as alternatives supply options for residential energy requirements [3], even though such renewable energy systems operate intermittently.An on-grid, hybrid, renewable energy-based combined heat and power (CHP) system, in which useful heat and electricity are generated simultaneously, can be used to mitigate this challenge and enhance reliability.The hybrid renewable energy-based CHP system considered here incorporates solar photovoltaic (PV), solar-thermal collector, wind turbine (WT) and hydrogen energy technologies.
Integration options for CHP and renewable energy have been reviewed [4], and optimization studies have been carried out for hybrid renewable energy systems comprised of various energy sources and technologies [5].For example, studies have been published on hybrid renewable energy systems [6] involving two main energy technologies, such as solar-fuel cell systems [7], solar-biofuel systems [8], solar-battery systems [9], solar-thermal-PV systems [10], solar micro-generation systems [11], PV-wind systems connected to the electrical grid [12], solar-wind systems for remote regions [13], and wind-fuel cell systems [14].Results have also been reported for hybrid renewable energy systems involving three primary energy technologies.Examples include PV-wind-hydro-battery systems [15]; PV, wind and storage integration on small islands [16]; wind-PV-battery systems [17]; wind-photovoltaic energy storage and transmission hybrid power systems [18]; grid-connected photovoltaic-wind-biomass power systems [19]; solar-diesel-battery systems [20]; solar-fuel cell-battery systems [21]; solar-wind-battery systems [22]; wind-solar-natural gas [23]; solar-wind-fuel cell systems [24]; solar-wind-diesel-battery systems [25]; and solar-wind-desalination systems [26].For comparative purposes, it is noted that hybrid energy systems driven by fossil fuels have also been examined, such as fuel cell-gas turbine systems [27].
CHP systems are continually being advanced and applied to various regions.For instance, hybrid energy systems incorporating CHP, solar and battery components have been simulated and technically assessed for three areas in the U.S. [9].For Malaysia, a hybrid solar-diesel system for buildings designed for zero load rejection was optimized [28], and the viability was assessed of meeting a hospital's energy loads with a cogeneration system incorporating a fuel cell and battery as well as grid-connected PV [21].That system was designed and techno-economically assessed using the software package HOMER (Hybrid Optimization of Multiple Energy Resources).A hybrid renewable power system for an island in South Korea was also optimized using HOMER [29].
Other investigations have focused on design and operation.For example, the design of a grid-connected solar and wind energy system was optimized and the hybrid system was assessed techno-economically using life cycle costs [30].Operation strategies were contrasted for satisfying residential energy needs via CHP driven by biomass and natural gas, considering systems comprised of fuel cells, batteries and PV [31].A tubular type of solid oxide fuel cell was shown to be able to cogenerate [32].
Some recent investigations have focused on sizing and capacity.For instance, a CHP system in a micro-grid was optimally sized using mixed integer linear programming with experimental electric and heat utilization data [33].The optimal capacities were determined of a CHP system and a boiler for cost effectively meeting building thermal and electrical demands [34].A genetic algorithm (GA) has been used for optimally sizing an electric generating system with pumped storage [35], while an iterative optimization method was developed for the capacities of components in a hybrid PV-wind-battery system for power generation [36].
Heuristic algorithms are powerful optimization tools based on artificial intelligence that have attracted considerable interest as solvers for complex optimization problems.A study of the literature reveals that some heuristic algorithms and software have been applied to various facets of hybrid systems, such as genetic algorithm [37], multi-objective evolutionary algorithms with genetic algorithms [38], particle swarm optimization [39], multi-objective optimization with particle swarm optimization [40], simulated annealing [41], distributed optimization algorithm [42], tabu search [43], bee algorithm [44], honey bee mating optimization [45], and HOMER [46,47].It is also found that the PSO algorithm is recognized as one of the most promising heuristic algorithms [48,49], largely because it outperforms other approaches in terms of accuracy.Additionally, the PSO algorithm exhibits high efficiency and fast convergence, as well simplicity in concept and ease of implementation.
Despite the investigations of hybrid renewable energy systems, techno-economic analysis and optimization tools for grid-connected, hybrid solar-wind-fuel cell combined heat and power systems with solar-thermal collectors are not available and needed.In this study, therefore, an optimization approach is developed for a grid-connected hybrid system for residential application, incorporating a solar-wind-fuel cell combined heat and power system integrated with solar-thermal collectors.The optimization approach uses economic parameters for system components.The electrical power production is determined by minimizing cost, the objective function, while accounting for electrical and thermal power tariffs for purchasing and selling.To incent the purchase of electricity from the hybrid system by the grid, purchasing tariffs are considered to exceed selling tariffs for electricity.However, due to its lower price, thermal energy is sold locally to neighbors rather than to the grid.In addition, the output power values of the PV and WT systems and solar-thermal collector are treated as negative energy loads for the hybrid system, so they are added to the residential load.
In this optimization approach, we consider the costs of electrical power exchange with the grid, supplying energy, the solar-thermal collector, wind power production, solar power generation, heat recovery from the fuel cell, and maintenance.We also propose a modified particle swarm optimization algorithm for the optimization of the grid-connected hybrid solar/wind/fuel cell CHP system with a solar-thermal collector and consider residential uses in the city of Khorasan province, Iran.The results using this approach are compared with those obtained by an efficient metaheuristic optimization method, namely, a genetic algorithm [14], in terms of accuracy and run time.Four cases are considered to determine the optimum combination in terms of lowest cost for the residential load.In Case 1, heat recovery from the fuel cell power plant (FCPP) is not considered, and the residential load is supplied by the electrical grid.Heat recovery from the FCPP is considered in Case 2. In Cases 3 and 4, only the local grid and the FCPP supply the residential load, but the solar collector is not considered in Case 3 and is considered in Case 4.
This article extends the work reported in the literature notably, by presenting several important innovations.Most significantly, an optimization approach is developed for a grid-connected hybrid system for residential applications, incorporating a solar-wind-fuel cell combined heat and power system integrated with solar-thermal collectors.In addition, our study addresses the optimization problem of a hybrid system for a high-energy consuming residential sector, in a realistic manner accounting for technical details of the hybrid system.Furthermore, the modeling and costing of the grid-connected hybrid solar/wind/fuel cell CHP system with a solar-thermal collector is investigated for residential uses in the city of Iran for several scenarios.Particular focus is placed on assessing the potential reduction in the overall cost of the installation under different scenarios.Finally, a new version of the particle swarm optimization algorithm is introduced and used to optimize the grid-connected hybrid system.The results using this approach are compared with those obtained by a genetic algorithm in terms of accuracy and run time.

Modeling System Components
The hybrid renewable energy system proposed in this paper is illustrated in Figure 1.The modeling of its primary components is described in this section.

Photovoltaic System
The output electrical power from PV panels P PV at time t is given by [50]: where Here, A PV denotes the PV area, η PV the efficiency of the PV panels, R t the solar radiation on a tilted plane module, η pc the power conditioning efficiency, η r the reference module efficiency, T air the ambient air temperature, T re f the cell temperature at the reference conditions, NOCT the nominal cell operating temperature, and N T the photovoltaic panel efficiency temperature coefficient.The characteristics of the solar panel are listed in Table 1 [48,51,52].

Solar-Thermal Collector
The output thermal power from solar-thermal collector P SC at time t is given by [53]: where Here, A SC denotes the solar-thermal collector area, η SC the efficiency of the solar-thermal collector, η RSC the reference solar-thermal collector efficiency, T SC the solar-thermal collector temperature, and a 1 and a 2 the loss coefficients.The characteristics of the solar-thermal collector are listed in Table 2.

Wind Turbine
The output electrical power from wind turbine (XCO2/1 kW) P WT at time t is given by [52,54,55]: Here, P r denotes the wind generator rated power (1 kW here), and V wind speed.In addition, V i , V o , and V r , respectively, are the cut-in (set to 2.5 m/s), cut-out (set to 24 m/s) and rated (set to 11 m/s) linear speeds of the wind turbine.The maintenance cost of the wind turbine (C WT MC ) is 0.02 $/kWh [48,56].

Fuel Cell
A proton exchange membrane (PEM) fuel cell is utilized in this study.The FCPP produces as much thermal as electrical energy [57,58].PEM fuel cells have various advantages that make them preferred relative to other fuel cells and permit them to be used in hybrid energy systems [59][60][61][62].A sound strategy is necessary for management of excess electrical and/or thermal energy.Heat recovery from the stack is not considered for a PEM FCPP due to the low operating temperature.but is considered for the reformer since it operates at relatively a high temperature (360 • C).In this study, the thermal energy load includes space heating and domestic hot water heating, which adds to the PEM FCPP electrical energy loads.The thermal energy recovered from the FCPP supplies the thermal energy load and, if necessary, is provided using of solar collector and natural gas.The part load ratio (PLR) is employed to determine the efficiency as well as the thermal to electrical ratio [57,63].The PLR can be written as follows: For PLR i ≥ 0.05 where η i is the fuel cell electrical efficiency and r TE,i is the thermal to electrical ratio at interval i.Details about PEMFCs are provided elsewhere [48,[59][60][61][62]. Table 3 provides the technical specifications of the fuel cell system [14,48].

Objective Function
We consider here the hybrid renewable energy system in Figure 1.In this paper, the model in [14,48,59,61,62] is extended to include wind turbine, solar collector, and photovoltaic costs and revenues, so as to examine whether it is feasible to add wind turbines, solar PV panels and fuel cells to the local electrical grid serving a residential building in Iran.System operating costs can often be reduced through the utilization of such a hybrid renewable energy system and by connecting to the local electrical grid.Two common metaheuristic approaches are used in the optimization.By minimizing system operating and maintenance costs, the output power of the fuel cell is optimized, effectively optimizing the performance of the energy system.The algorithms therefore utilize the local electrical grid for periods of low tariffs and the fuel cell for periods of high tariffs.Note that we focus in the present study only on optimizing the operating and maintenance costs of the energy system, considering several scenarios.revenues, so as to examine whether it is feasible to add wind turbines, solar PV panels and fuel cells to the local electrical grid serving a residential building in Iran.System operating costs can often be reduced through the utilization of such a hybrid renewable energy system and by connecting to the local electrical grid.Two common metaheuristic approaches are used in the optimization.By minimizing system operating and maintenance costs, the output power of the fuel cell is optimized, effectively optimizing the performance of the energy system.The algorithms therefore utilize the local electrical grid for periods of low tariffs and the fuel cell for periods of high tariffs.Note that we focus in the present study only on optimizing the operating and maintenance costs of the energy system, considering several scenarios.The objective function for the hybrid renewable energy system is economic.Specifically, the fuel cell is optimized by minimizing the system cost and maximizing the overall system income, causing the algorithms to utilize the fuel cell to satisfy the load when tariffs are high and the local grid when tariffs are low.Extensive information on fuel cell economics is available [59,61,64,65].The function that is minimized, subject to the constraints outlined later, follows:

Minimize ( )
It is seen that the objective function (in US$ day −1 ) for the optimization in essence minimizes the overall operation cost and maximizes the overall system income.
The constraints applied in the optimization include a limited number of fuel cell plant start and stop cycles, the given rated capacity of the fuel cell plant, a limit on the ramp rate, and minimum up and down time limits.These constraints can be expressed as follows [14,48]: Here, PMin and PMax, respectively, denote the lower and upper power generating limits (in kW); T on and T off , respectively, denote the fuel cell on and off times; ΔPu and ΔPd, respectively, denote the ramp rate upper lower limits; and MDT and MUT, respectively, denote the minimum down-time and up-time.In addition, U is the on-off status for the fuel cell, with U = 1 denoting on and U = 0 denoting off.The objective function for the hybrid renewable energy system is economic.Specifically, the fuel cell is optimized by minimizing the system cost and maximizing the overall system income, causing the algorithms to utilize the fuel cell to satisfy the load when tariffs are high and the local grid when tariffs are low.Extensive information on fuel cell economics is available [59,61,64,65].The function that is minimized, subject to the constraints outlined later, follows: It is seen that the objective function (in US$ day −1 ) for the optimization in essence minimizes the overall operation cost and maximizes the overall system income.
The constraints applied in the optimization include a limited number of fuel cell plant start and stop cycles, the given rated capacity of the fuel cell plant, a limit on the ramp rate, and minimum up and down time limits.These constraints can be expressed as follows [14,48]: Here, P Min and P Max , respectively, denote the lower and upper power generating limits (in kW); T on and T off , respectively, denote the fuel cell on and off times; ∆P u and ∆P d , respectively, denote the ramp rate upper lower limits; and MDT and MUT, respectively, denote the minimum down-time and up-time.In addition, U is the on-off status for the fuel cell, with U = 1 denoting on and U = 0 denoting off.
Parameters considered in the case study and their values are given in Table 4 [14,48,66,67].The monetary units used in this table and elsewhere in the paper are 2013 US dollars.Figure 2 shows the operating strategy employed by the hybrid system.
Parameters considered in the case study and their values are given in Table 4 [14,48,66,67].The monetary units used in this table and elsewhere in the paper are 2013 US dollars.Figure 2 shows the operating strategy employed by the hybrid system.

Cost of System
The system cost is comprised of the sum of the costs of fuel, purchased electricity, start-up and maintenance, and gas (for the heating load).
The daily cost of purchasing electricity from the grid can be written as follows: where T denotes the time interval duration (in 0.1 h).In addition, for interval i, c el,pi denotes the electricity purchase cost from the local grid (see values in Figure 3), L el,i denotes the electrical load, P PV,i denotes the PV electricity generation, P WT,i denotes the wind turbine electricity generation, and P FC,i denotes the fuel cell plant electrical power generation.

Cost of System
The system cost is comprised of the sum of the costs of fuel, purchased electricity, start-up and maintenance, and gas (for the heating load).
The daily cost of purchasing electricity from the grid can be written as follows: ) where T denotes the time interval duration (in 0.1 h).In addition, for interval i,  The daily fuel cost can be expressed as [48]: where f c denotes the natural gas price, i η denotes the fuel cell electrical efficiency, and Pa denotes the power of auxiliary devices.
The start-up cost can be written for the hybrid system as [14] sup (1 ) Here, α denotes the hot start-up costs, β denotes the cold start-up costs, toff denotes the time the FCPP is off, and τ denotes the time constant for FC cooling.
The daily operation and maintenance cost (CO&M) for the main components of the hybrid system can be expressed as: where CM.C denotes the maintenance cost of the hybrid energy system.The daily fuel cost can be expressed as [48]: where c f denotes the natural gas price, η i denotes the fuel cell electrical efficiency, and P a denotes the power of auxiliary devices.
The start-up cost can be written for the hybrid system as [14] Here, α denotes the hot start-up costs, β denotes the cold start-up costs, t off denotes the time the FCPP is off, and τ denotes the time constant for FC cooling.
The daily operation and maintenance cost (C O&M ) for the main components of the hybrid system can be expressed as: where C M.C denotes the maintenance cost of the hybrid energy system.
The daily gas cost is can be written as follows: Here, c n2 denotes the fuel price for the residential load, L th,i denotes the thermal load at interval i, and P th,i denotes the heat recovery from FCPP for interval i.

System Income
Revenues from selling surplus electricity and thermal energy make up the system income.Surplus electricity is available for sale to the local grid when electrical output from the hybrid energy system exceeds electrical demand.The daily income can be written from selling surplus electrical energy as: and from selling surplus thermal energy as Here, c el,si denotes the selling electricity price (see Figure 3).

Metaheuristic Optimization Approaches
Minimization of the total cost is usually important for energy systems, including the hybrid renewable energy system considered here.One approach for minimizing the total system cost is modified particle swarm optimization (PSO).The results from this approach are compared with those from a genetic algorithm, an efficient metaheuristic optimization method [14].Such population-based heuristic optimization approaches emulate animal behavior and natural selection.Various factors affect the optimization algorithm's performance significantly.For particle swarm optimization, the factors include population size and the number of iterations for every particle.For the GA, the factors include population size and the number of iterations for every chromosome.There exist 240 variables over a 24 h period, for the six-minute time intervals used here.Every particle has 240 features in PSO, and each chromosome is separated into 240 genes in GA.Consequently the particle in PSO is analogous to the chromosome (population member) in GA.

Original Particle Swarm Optimization
The original approach for particle swarm optimization is founded on movements of birds and fish as well as their behaviors [68][69][70].The calculations involved in PSO are straightforward relative to those for other methods, and the steps in standard PSO are provided in Figure 4.The updating for particles involves the following steps: where v k i denotes the component in dimension d of the ith particle velocity for iteration k and x k i the component in dimension d of the ith particle position for iteration k.In addition, p best denotes the best position achieved yet by particle i and g best the best position found by neighbors of particle i.Furthermore, w denotes the inertia weight, r 1 .and r 2 denote random factors between 0 and 1 and c 1 and c 2 denote learning factors that control the importance of the best solution ever found by ith particle and the best solution found by the population, respectively.The values of c 1 and c 2 are both fixed at 2, and the value of w is fixed at unity.Additional details on this algorithm are available elsewhere [51,69].
Sustainability 2017, 9, 1314 10 of 20 are both fixed at 2, and the value of w is fixed at unity.Additional details on this algorithm are available elsewhere [51,69].

Modified Particle Swarm Optimization
A variant of PSO with the speed clamping effect avoids the phenomenon of "swarm explosion" [51], which is needed since, without a limit on the maximum velocities of particles, a simple one-dimensional analysis of the swarm dynamic shows that the particle velocity can grow without limit while the particle oscillating around an optimum increases its distance from the optimum in each iteration.Additional studies demonstrated that this approach was inadequate to properly control particle velocities.Compared to evolutionary optimization [71], PSO rapidly identifies the region of the optimum but has difficulty adjusting the velocity to lower values to perform a fine search of the area.To achieve this aim, the particle swarm optimization algorithm with a constriction factor can be used, in which the updating pattern of each particle velocity proceeds as follows: ( ) ( ) where

Modified Particle Swarm Optimization
A variant of PSO with the speed clamping effect avoids the phenomenon of "swarm explosion" [51], which is needed since, without a limit on the maximum velocities of particles, a simple one-dimensional analysis of the swarm dynamic shows that the particle velocity can grow without limit while the particle oscillating around an optimum increases its distance from the optimum in each iteration.Additional studies demonstrated that this approach was inadequate to properly control particle velocities.Compared to evolutionary optimization [71], PSO rapidly identifies the region of the optimum but has difficulty adjusting the velocity to lower values to perform a fine search of the area.To achieve this aim, the particle swarm optimization algorithm with a constriction factor can be used, in which the updating pattern of each particle velocity proceeds as follows: where Here, C 1 and C 2 denote cognitive and social parameters, respectively, which affect the algorithm's convergence speed and ability to locate the optimum.However, different values may prove suitable for different problems, so these parameters can be expressed as [72]: where CF = Here, ph i and CF denote coefficient of contraction and constriction factor respectively, and ph i1 and ph i2 are positive numbers, set at 2.05.

Results and Discussions
The study uses annual measured solar insolation, air temperature, and wind speed data for Khorasan province, Iran (latitude = 36.35• N, longitude = 56.83• E, and altitude = 912 m above sea level) [73], which are shown in Figure 5. Here,

1
C and 2 C denote cognitive and social parameters, respectively, which affect the algorithm's convergence speed and ability to locate the optimum.However, different values may prove suitable for different problems, so these parameters can be expressed as [72]: where ( ) Here, i ph and CF denote coefficient of contraction and constriction factor respectively, and ph are positive numbers, set at 2.05.

Results and Discussions
The study uses annual measured solar insolation, air temperature, and wind speed data for Khorasan province, Iran (latitude = 36.35°N, longitude = 56.83°E, and altitude = 912 m above sea level) [73], which are shown in Figure 5.

Methodology
The optimization methodology proposed here is implemented in MATLAB.Average daily residential thermal and electrical loads are shown in Figure 6, for periods of 0.1 h (6 min) [14,48].Annual domestic hot water heating and winter space heating make up the thermal load.Four supply cases for the residential electrical and thermal loads are considered, in order to choose the optimum combination of technologies for the hybrid renewable energy system based on lowest cost.The residential loads (electrical and thermal) are met by the electrical grid and natural gas heating in the base case (i.e., without a hybrid energy system employed), by the hybrid energy system and the electrical grid in Cases 1 and 2, and by the solar-thermal collector, fuel cell, and electrical grid in Case 3 and Case 4. The daily electrical and thermal energy supply cost in the base case is $5.71.
Each algorithm is independently run 20 times.Table 5 lists the results obtained by the algorithms for all cases considered.Note that component capital costs are not accounted for.Table 5 provides the maximum, minimum and mean of fitness function values for the runs (Max., Min. and Mean, respectively), the standard deviation for each of those values (STD), and the simulation time indexes (ST).Based on the Min.values in Table 5, Table 6 lists the daily system cost and income for all cases.For example, in Case 2, the relative error between the Min.index of MPSO and GA, 100 , is 14%.The performance is more beneficial with MPSO than GA, in terms of other indexes, including Mean, Max., STD and ST index.In Case 3, the relative error between the Min.index of MPSO and GA is 0.20%, and between the Max.index of MPSO and GA is 0.07%.

Methodology
The optimization methodology proposed here is implemented in MATLAB.Average daily residential thermal and electrical loads are shown in Figure 6, for periods of 0.1 h (6 min) [14,48].Annual domestic hot water heating and winter space heating make up the thermal load.Four supply cases for the residential electrical and thermal loads are considered, in order to choose the optimum combination of technologies for the hybrid renewable energy system based on lowest cost.The residential loads (electrical and thermal) are met by the electrical grid and natural gas heating in the base case (i.e., without a hybrid energy system employed), by the hybrid energy system and the electrical grid in Cases 1 and 2, and by the solar-thermal collector, fuel cell, and electrical grid in Case 3 and Case 4. The daily electrical and thermal energy supply cost in the base case is $5.71.
Each algorithm is independently run 20 times.Table 5 lists the results obtained by the algorithms for all cases considered.Note that component capital costs are not accounted for.Table 5 provides the maximum, minimum and mean of fitness function values for the runs (Max., Min. and Mean, respectively), the standard deviation for each of those values (STD), and the simulation time indexes (ST).Based on the Min.values in Table 5, Table 6 lists the daily system cost and income for all cases.For example, in Case 2, the relative error between the Min.index of MPSO and GA, Min MPSO −Min GA Min MPSO × 100, is 14%.The performance is more beneficial with MPSO than GA, in terms of other indexes, including Mean, Max., STD and ST index.In Case 3, the relative error between the Min.index of MPSO and GA is 0.20%, and between the Max.index of MPSO and GA is 0.07%.

Methodology
The optimization methodology proposed here is implemented in MATLAB.Average daily residential thermal and electrical loads are shown in Figure 6, for periods of 0.1 h (6 min) [14,48].Annual domestic hot water heating and winter space heating make up the thermal load.Four supply cases for the residential electrical and thermal loads are considered, in order to choose the optimum combination of technologies for the hybrid renewable energy system based on lowest cost.The residential loads (electrical and thermal) are met by the electrical grid and natural gas heating in the base case (i.e., without a hybrid energy system employed), by the hybrid energy system and the electrical grid in Cases 1 and 2, and by the solar-thermal collector, fuel cell, and electrical grid in Case 3 and Case 4. The daily electrical and thermal energy supply cost in the base case is $5.71.
Each algorithm is independently run 20 times.Table 5 lists the results obtained by the algorithms for all cases considered.Note that component capital costs are not accounted for.Table 5 provides the maximum, minimum and mean of fitness function values for the runs (Max., Min. and Mean, respectively), the standard deviation for each of those values (STD), and the simulation time indexes (ST).Based on the Min.values in Table 5, Table 6 lists the daily system cost and income for all cases.For example, in Case 2, the relative error between the Min.index of MPSO and GA, 100 , is 14%.The performance is more beneficial with MPSO than GA, in terms of other indexes, including Mean, Max., STD and ST index.In Case 3, the relative error between the Min.index of MPSO and GA is 0.20%, and between the Max.index of MPSO and GA is 0.07%.

Cases
In Case 1, where the local grid and a hybrid energy system supply the electrical load while the thermal energy load is supplied with natural gas but heat recovery from fuel cell and solar-thermal collector is not considered, the minimum daily cost to supply electrical and thermal energy (Min.index) is $5.408, as found by the GA.The reduction in daily cost relative to base case is $0.302, which translates to a saving of $111 per year.However, the Min.index obtained with the MPSO is $5.424.In addition, the electricity and gas purchase costs are $1.621 and $2.455 respectively with the MPSO, while the electricity selling income is $0.012.
In case 2, heat recovery from the FC is used.If the heat recovery exceeds the thermal load the surplus is sold to neighbors to lower the system cost.If the thermal load exceeds the heat recovery, natural gas is used to make up the shortfall.In this case, the Min.index which has been found by MPSO algorithm ($4.249) is less than that found by the GA ($4.255).In addition, the performance of the algorithms can be ranked as MPSO followed by GA in this case, based on the Min., Max., Mean, and ST indexes.It is seen in the optimized system that, on a daily basis, the electricity selling income is $0.252, the thermal selling income is $0.104, and the reduction in cost relative to base case is $1.461.Optimal daily values of the electricity and gas purchase costs are seen to be $0.388 and $0.915, respectively, and the reduction in electricity purchase cost and gas purchase cost, relative to first case, are $1.233 and $1.54, respectively.As a result, this case is more beneficial than the previous strategy.
Figure 7 illustrates the electrical generation and electrical loads obtained with the modified particle swarm optimization algorithm.The electrical trade with the electrical grid is shown for the modified particle swarm optimization algorithm in Figure 8.The system is observed to purchase energy during periods of low tariffs, and to sell energy during periods of high tariffs (especially when there are high thermal loads).
Figure 9 illustrates the heat recovery rate and the thermal load obtained with the modified particle swarm optimization algorithm.The system is observed to meet the thermal load at the low thermal load periods, i.e., at time 80-180 (08:00-18:00).However, for periods of low tariffs, the system satisfies the electrical and thermal energy loads respectively using the electrical grid and natural gas.
Comparing the first and second cases illustrates that recovering thermal energy from the FCPP leads to lower costs and higher savings relative to meeting the thermal load with gas, i.e., heating with gas has a higher total cost than heating via heat recovery.Cases 1 and 2 thereby demonstrate the effect of heat load on optimal FCPP operation.
In Case 3, the electrical load is met by the electrical grid and the fuel cell power plant with FCPP heat recovery.The minimal daily cost of system (Min.index) is $4.601, as obtained with the MPSO.Based on the other indexes the ranking of the algorithms is MPSO and GA In this case, the reduction in daily cost relative to base case is $1.109, while the electricity selling income is $0.143 and the thermal selling income is $0.033 and the electricity and gas purchase costs are $0.421and$0.947, respectively.
In Case 4, the electrical load is met by the fuel cell power plant, with FCPP heat recovery, the solar-thermal collector, and the electrical grid.It is observed that the minimal daily cost of system (Min.index) is $4.443, as obtained with the MPSO.It is seen that, in the optimized system, the electricity selling income is $0.142, the thermal selling income is $0.134, and the reduction in daily cost relative to base case is $1.267, and the increase in thermal selling income, relative to Case 3, is $0.11.Optimal daily values of the electricity and gas purchase costs are found to be $0.440 and $0.894, respectively, and the reduction in gas purchase cost, relative to Case 3, is $0.022.Consequently, this case is more beneficial than the third case.Finally, it is observed that the hybrid energy system having multiple energy sources outperforms the systems with single energy sources.Figure 10 shows the convergence process of the modified particle swarm optimization algorithm for one of the runs of Cases 1-4.In Figure 10, the best total cost is plotted vs. iteration number.The reduction in the total cost during the iterations can be seen.Comparing the first and second cases illustrates that recovering thermal energy from the FCPP leads to lower costs and higher savings relative to meeting the thermal load with gas, i.e., heating with gas has a higher total cost than heating via heat recovery.Cases 1 and 2 thereby demonstrate the effect of heat load on optimal FCPP operation.
In Case 3, the electrical load is met by the electrical grid and the fuel cell power plant with FCPP heat recovery.The minimal daily cost of system (Min.index) is $4.601, as obtained with the MPSO.Based on the other indexes the ranking of the algorithms is MPSO and GA In this case, the reduction in daily cost relative to base case is $1.109, while the electricity selling income is $0.143 and the thermal selling income is $0.033 and the electricity and gas purchase costs are $0.421and$0.947, respectively.
In Case 4, the electrical load is met by the fuel cell power plant, with FCPP heat recovery, the solar-thermal collector, and the electrical grid.It is observed that the minimal daily cost of system (Min.index) is $4.443, as obtained with the MPSO.It is seen that, in the optimized system, the electricity selling income is $0.142, the thermal selling income is $0.134, and the reduction in daily cost relative to base case is $1.267, and the increase in thermal selling income, relative to Case 3, is $0.11.Optimal daily values of the electricity and gas purchase costs are found to be $0.440 and $0.894, respectively, and the reduction in gas purchase cost, relative to Case 3, is $0.022.Consequently, this case is more beneficial than the third case.Finally, it is observed that the hybrid energy system having multiple energy sources outperforms the systems with single energy sources.Figure 10 shows the convergence process of the modified particle swarm optimization algorithm for one of the runs of Cases 1-4.In Figure 10, the best total cost is plotted vs. iteration number.The reduction in the total cost during the iterations can be seen.Comparing the first and second cases illustrates that recovering thermal energy from the FCPP leads to lower costs and higher savings relative to meeting the thermal load with gas, i.e., heating with gas has a higher total cost than heating via heat recovery.Cases 1 and 2 thereby demonstrate the effect of heat load on optimal FCPP operation.
In Case 3, the electrical load is met by the electrical grid and the fuel cell power plant with FCPP heat recovery.The minimal daily cost of system (Min.index) is $4.601, as obtained with the MPSO.Based on the other indexes the ranking of the algorithms is MPSO and GA In this case, the reduction in daily cost relative to base case is $1.109, while the electricity selling income is $0.143 and the thermal selling income is $0.033 and the electricity and gas purchase costs are $0.421and$0.947, respectively.
In Case 4, the electrical load is met by the fuel cell power plant, with FCPP heat recovery, the solar-thermal collector, and the electrical grid.It is observed that the minimal daily cost of system (Min.index) is $4.443, as obtained with the MPSO.It is seen that, in the optimized system, the electricity selling income is $0.142, the thermal selling income is $0.134, and the reduction in daily cost relative to base case is $1.267, and the increase in thermal selling income, relative to Case 3, is $0.11.Optimal daily values of the electricity and gas purchase costs are found to be $0.440 and $0.894, respectively, and the reduction in gas purchase cost, relative to Case 3, is $0.022.Consequently, this case is more beneficial than the third case.Finally, it is observed that the hybrid energy system having multiple energy sources outperforms the systems with single energy sources.Figure 10 shows the convergence process of the modified particle swarm optimization algorithm for one of the runs of Cases 1-4.In Figure 10, the best total cost is plotted vs. iteration number.The reduction in the total cost during the iterations can be seen.

Conclusions
The optimal operation cost of grid-connected hybrid energy systems to supply both electricity and heat to a residential application is determined.For this study, a photovoltaic-wind turbine-fuel cell-solar-thermal collector is designed and an economic model is introduced to supply of residential thermal and electrical loads via a grid-connected hybrid system.A modified particle swarm optimization is proposed for solving the optimization problem.The results are compared with those obtained by a genetic algorithm in terms of accuracy and run time.The photovoltaicwind turbine-fuel cell-solar-thermal collector system is designed to meet the full demand and four possible cases are considered and assessed.The simulation results showed that hybrid energy systems are more cost effective than the simple energy systems with one energy input, suggesting that hybrid energy system are superior options.The results also demonstrate that the reduction in daily cost relative to the base case via the modified particle swarm optimization algorithm for Cases 1-4 are 5.01%, 25.59%, 19.42%, and 22.19%, respectively.Based on the minimum of the objective function values, the suggested cases can be listed in rank order as follows: Case 2, Case 4, Case 3, and Case 1.Moreover, the results for Case 2 exhibit a better overall demand (electricity and heat) supply

Conclusions
The optimal operation cost of grid-connected hybrid energy systems to supply both electricity and heat to a residential application is determined.For this study, a photovoltaic-wind turbine-fuel cell-solar-thermal collector is designed and an economic model is introduced to supply of residential thermal and electrical loads via a grid-connected hybrid system.A modified particle swarm optimization is proposed for solving the optimization problem.The results are compared with those obtained by a genetic algorithm in terms of accuracy and run time.The photovoltaicwind turbine-fuel cell-solar-thermal collector system is designed to meet the full demand and four possible cases are considered and assessed.The simulation results showed that hybrid energy systems are more cost effective than the simple energy systems with one energy input, suggesting that hybrid energy system are superior options.The results also demonstrate that the reduction in daily cost relative to the base case via the modified particle swarm optimization algorithm for Cases 1-4 are 5.01%, 25.59%, 19.42%, and 22.19%, respectively.Based on the minimum of the objective function values, the suggested cases can be listed in rank order as follows: Case 2, Case 4, Case 3, and Case 1.Moreover, the results for Case 2 exhibit a better overall demand (electricity and heat) supply

Conclusions
The optimal operation cost of grid-connected hybrid energy systems to supply both electricity and heat to a residential application is determined.For this study, a photovoltaic-wind turbine-fuel cell-solar-thermal collector is designed and an economic model is introduced to supply of residential thermal and electrical loads via a grid-connected hybrid system.A modified particle swarm optimization is proposed for solving the optimization problem.The results are compared with those obtained by a genetic algorithm in terms of accuracy and run time.The photovoltaic-wind turbine-fuel cell-solar-thermal collector system is designed to meet the full demand and four possible cases are considered and assessed.The simulation results showed that hybrid energy systems are more cost effective than the simple energy systems with one energy input, suggesting that hybrid energy system are superior options.The results also demonstrate that the reduction in daily cost relative to the base case via the modified particle swarm optimization algorithm for Cases 1-4 are 5.01%, 25.59%, 19.42%, and 22.19%, respectively.Based on the minimum of the objective function values, the suggested cases can be listed in rank order as follows: Case 2, Case 4, Case 3, and Case 1.Moreover, the results for Case 2 exhibit a better overall demand (electricity and heat) supply than the first case due to its operational advantage.In addition, a comparison of Cases 3 and 4 demonstrates that adding a solar-thermal collector is an effective strategy, and a comparison of Cases 1 and 2 demonstrates that adding solar and wind energy is an effective strategy Of the cases considered, the Case 2 is the most cost-effective and reliable.The performance of the modified particle swarm optimization method appears to be advantageous to that of the genetic algorithm.
Author Contributions: A.M. developed the model development process and analyzed the final simplified model presented in this paper under the guidance of F.P. and M.R.All authors have read and approved the final manuscript.

Conflicts of Interest:
The authors declare no conflict of interest.

Figure 1 .
Figure 1.Block diagram of the proposed hybrid energy system.

Figure 1 .
Figure 1.Block diagram of the proposed hybrid energy system.

Figure 2 .
Figure 2. Operating strategy of the proposed system.
purchase cost from the local grid (see values in Figure3), , el i L denotes the electrical load, , PV i P denotes the PV electricity generation, , WT i P denotes the wind turbine electricity generation, and , FC i P denotes the fuel cell plant electrical power generation.

Figure 3 .
Figure 3. Temporal variation of price for electricity exchange (buying and selling) with the local electrical grid.

Figure 3 .
Figure 3. Temporal variation of price for electricity exchange (buying and selling) with the local electrical grid.

Figure 4 .
Figure 4. Steps in standard particle swarm optimization implementation.

Figure 4 .
Figure 4. Steps in standard particle swarm optimization implementation.

Figure 6 .Figure 5 .
Figure 6.Temporal variation of thermal and electrical energy demands.

Figure 6 .
Figure 6.Temporal variation of thermal and electrical energy demands.

Figure 6 .
Figure 6.Temporal variation of thermal and electrical energy demands.

Figure 7 .
Figure 7. Fuel cell power plant generation of modified particle swarm optimization in case 2.

Figure 8 .
Figure 8. Electrical power trade with electrical grid of modified particle swarm optimization in Case 2.

Figure 7 .
Figure 7. Fuel cell power plant generation of modified particle swarm optimization in case 2.

Figure 7 .
Figure 7. Fuel cell power plant generation of modified particle swarm optimization in case 2.

Figure 8 .
Figure 8. Electrical power trade with electrical grid of modified particle swarm optimization in Case 2.

Figure 8 .
Figure 8. Electrical power trade with electrical grid of modified particle swarm optimization in Case 2.

Figure 9 .
Figure 9. Heat recovery from Fuel cell power plant and thermal energy load of modified particle swarm optimization in Case 2.

Figure 10 .
Figure 10.Reduction of total cost during iterations of modified particle swarm optimization for Cases 1-4.

Figure 9 . 20 Figure 9 .
Figure 9. Heat recovery from Fuel cell power plant and thermal energy load of modified particle swarm optimization in Case 2.

Figure 10 .
Figure 10.Reduction of total cost during iterations of modified particle swarm optimization for Cases 1-4.

Figure 10 .
Figure 10.Reduction of total cost during iterations of modified particle swarm optimization for Cases 1-4.

Table 1 .
Technical parameters of the PV panel.

Table 2 .
Technical parameters of the solar-thermal collector.

Table 3 .
Technical specifications of the fuel cell.

Table 4 .
Parameters for the fuel cell plant and heuristic algorithms.
CFigure 2. Operating strategy of the proposed system.

Table 4 .
Parameters for the fuel cell plant and heuristic algorithms.

Table 5 .
Results from algorithms over 20 runs for all cases and corresponding statistics.

Table 6 .
Daily system cost and income of (in $) for all cases.