Risk-Averse Home Energy Management System

Transformation of conventional energy systems into smart grids enables the integration of residential buildings with distributed generations, electro-thermal storages and demand response policies. Further, it improves the household comfort level and helps to preserve the ecological system. Keeping in view the techno-financial impact of residential energy management, optimal handling of residential customers may prove meaningful for peak load reduction, valley filling, and energy conservation. In this regard, this paper devises a residential energy management system (EMS) to optimally schedule appliances, energy sources and electro-thermal storage for reduction of consumption cost and greenhouse (GHG) emissions. Building integrates national grid, natural gas network and solar energy as input carriers, whereas, electricity, heat and cooling as output carriers. To resolve the risk of loss of load, conditional value at risk (CVaR) has been incorporated in the objective function. Comparison demonstrates that under risk-averse approach, energy retaining capability of electric vehicle and thermal energy storage increases by 28.56% and 53.34%, respectively. This stored energy acts as a reserve during absence of solar irradiance and outages on electric and natural gas networks. Moreover, to make EMS more efficient in tracking optimum solutions with faster convergence speed, a hybrid algorithm has been devised by concatenating the modified flower pollination algorithm with mixed-integer linear programming. The proposed algorithm has been validated by comparing its results with the Salp Swarm Algorithm, Grasshopper Optimization Algorithm, Polar Bear Algorithm, Coyote Optimization and Two Cored Flower Pollination Algorithm (FPA). Results manifest that the cost, GHG emissions and execution time drop by 8.98%, 10.81% and 35.064%, respectively.


I. INTRODUCTION
Energy systems face problems such as increasing energy prices, energy deficit, network overloading, environmental issues, cybersecurity breach, etc [1]. To resolve these problems, there are multiple options in the conventional grid paradigm such as capacity enhancement of power generation, transmission and distribution infrastructure and renewable energy integration. In contrast, the smart energy grid offers distributed generators (DGs) and demand response (DR) strategies to address these problems [2]. Small scale renewable energy DGs connected to the distribution system may reduce network overloading, generation-demand gap, energy cost, fossil fuel depletion rate and global warming effects due to a decrease in greenhouse gas (GHG) emissions [3].
Among various concepts of smart grid, energy management system (EMS) may play a vital role in decreasing The associate editor coordinating the review of this manuscript and approving it for publication was Salvatore Favuzza . energy consumption cost and emission by optimally dispatching the building components [4]. These components consist of input energy carriers (electricity, natural gas (NG) and solar photovoltaic (PV) power), storages and loads. Customer premises/building represents an energy system node and may be treated as microgrids (µG) [5]. Smart energy distribution system can be considered as a collection of such µGs engaged in bilateral energy trade to benefit both customer and national grid.
Recently, several metaheuristic algorithms have been devised to solve different optimization problems for instance, Salp Swarm Algorithm   [6], Grasshopper Optimization Algorithm   [7], Polar Bear Algorithm (Dawid Połap 2017) [8], Coyote Optimization ( Juliano Pierezan and Leandro dos Santos Coelho 2018) [9], and Two Cored Flower Pollination Algorithm (FPA) (Raza 2020) [10]. Devised hybrid modified FPA-Mix-integer linear programming (MILP) algorithm has been compared with these latest algorithms in terms of energy consumption costs, GHG VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ emissions, and executions time for the devised energy management control in a residential µG. The literature review of these algorithms are as: Khan et al. developed an energy scheduling technique to optimize the cost and peak to average ratio (PAR) of smart home by using Salp Swarm Algorithm (SSA) [11]. Barik and Das made attempts to achieve the active power management for renewable resources present in isolated µG in MATLAB using SSA [12]. Fathy et al. presented an optimal EMS to minimize the total hydrogen consumption and fuel cell (FC) degradation using SSA by considering DER constraints [13]. Rezk et al. proposed a novel methodology to minimize the operating cost and network losses of a building using SSA [14]. Sambaiah and Jayabarathi used SSA to optimally allocate distributed energy resources (DERs) and capacitor banks to attain technical, economic, and environmental benefits [15].
Tan et al. applied a bio-inspired Grasshopper Optimization Algorithm (GOA) to determine the optimum size of hybrid autonomous µG to maximize the demand-supply reliability and cost minimization [16]. Khitab et al. developed an efficient EMS for appliance scheduling in an office building using GOA to reduce PAR, cost, and emissions [17]. Hussain et al. proposed a demand-side management strategy to optimally schedule the load units in an industrial building using GOA to minimize cost and PAR and maximize user comfort [18]. Hatata et al. proposed a state-of-the-art, precise, consistent and fast under-frequency load management system based on GOA to minimize the load shedding and execution time in addition to maximize the lowest swing frequency [19]. Roy proposed a mathematical optimization framework by hybridization of Particle Swarm Optimization (PSO), Neural Network and GOA to minimize fuel cost, emissions, operating and maintenance costs [20]. Gampa et al. proposed a two-stage GOA approach to calculate the optimum size of a diesel engine, shunt capacitor, and EVs charging-discharging station to reduce power factor, voltage deviation, and real power loss. Results showed that performance improvement and convergence time of the proposed GOA were better as compared to PSO and Genetic Algorithm (GA) [21].
Ahmad et al. applied Polar Bear Algorithm (PBA) to solve 3, 5, and 6-unit economic dispatch problems including transmission losses and valve point effect to reduce fuel cost and convergence time [22]. Książek et al. proposed a technique for a heating plant to maximize its efficiency at the lowest possible cost at different weather conditions using PBA [23].
Al-Dhaifallah et al. proposed an optimized EMS to reduce hydrogen consumption, energy cost, emission and maximize the durability of energy sources using a recent and powerful metaheuristic optimization technique known as Coyote Optimization Algorithm (COA) [24]. Chin and Salam applied COA to extract the parameters of single and two diode solar PV cells/modules [25]. Maidl et al. applied COA for the optimized operation of a heavy-duty gas turbine to reduce the fuel consumption, emissions under physical constraints.
Güvenç and Kaymaz applied COA for the economic dispatch integrated with thermal and wind power generators to reduce cost and convergence time as compared to other metaheuristic techniques [26].
Raza et al. proposed a risk-averse two cored energy management system using an energy hub approach to minimize energy cost, emissions and network load variation [10].
In addition to the recent algorithms, many energy management approaches have been adopted in last few years to optimize energy consumption cost and emissions in residential sector.
For example, Hussain et al. proposed an efficient home EMS for single as well as multiple homes based on genetic harmony search algorithm to minimize electricity cost, PAR, and maximize user comfort. The optimization problem is solved in MATLAB. The energy cost and PAR are reduced by 46.19%, 56.04% and 38.32%, 50.08% for single and multihomes, respectively [27] Thomas et al. proposed a framework using the MILP-based model for optimal operations of an EMS in a smart building using renewable energy resources (RERs), battery energy storage (BES) system, and plugin electric vehicles (PHEVs) under stochastic and deterministic approaches. The problem was solved using CPLEX optimizer in GAMS [28]. Shareef et al. reviewed on HEMS considering residential DR to consider load demand, smart meter, automated load-shedding, scheduling, lighting control, occupancy sensing, remote access, plugin load control and intelligent controllers [29]. Farmani et al. devised an EMS for residential µG to deals with deterministic and stochastic cases to minimize the net energy cost [30]. Iqbal et al. proposed a grid-connected HEMS for a domestic µG to minimize cost and load deviation along with comfort maximization. The optimization problem was solved using GA, binary PSO, wind-driven optimization (WDO) and grey wolf optimization (GWO) and three new hybrid techniques were proposed by hybridizing GA, binary PSO, WDO and GWO in MATLAB. Results revealed that the proposed techniques reduced energy cost and PAR by 35.02% and 35.60%, respectively [31].
Mehrjerdi and Rakhshani proposed a method to optimally charge-discharge the EVs to eliminate the renewable energy intermittency in a 33 bus IEEE network. The proposed problem was solved in GAMS using non-linear stochastic programming to properly charge and discharge the EVs to avoid degradation [32]. Shakeri et al. implemented a HEMS architecture along with a control algorithm to monitor and control the home appliances. The time of use pricing technique was used to minimize the energy consumption cost. Results demonstrated that approximately up to 15% of electricity use was reduced as compared to usual consumption [33]. Nge et al. proposed an optimized EMS to maximize the revenue using Lagrange Multipliers by forecasting solar PV generation and the results were compared with the brute-force dynamic programming approach [34]. Ma and Ma proposed an EMS to forecast the power generation as well as load demand using the multi-agent system for a µG. The pro-posed architecture consisted of three layers, external, prediction and operational layer. The details of the various EMS algorithms were also described [35]. Afrakhte and Bayat proposed a stable and reliable EMS strategy to solve network and economic problems in a µG considering BES and PHEVs. The optimization problem was solved in the targeted search shuffled complex algorithm in MATLAB using a variable weighted multi-objective function. Results demonstrated that the CPU time with the proposed technique decreased significantly as compared with the results solved through GAMS [36]. Seifi et al. proposed an EMS for a residential building using grey wolf and shark smell algorithms to converge to the global minima. The simulation was performed in MAT-LAB. Results showed that cost reduced by 20% and stability increased by 18%, respectively [37]. Chamandoust et al. modeled an energy scheduling problem for HEMS to minimize cost, emissions and load deviation. Epsilon-constraint method was used to deal with uncertain behavior of RERs using stochastic approach. Result showed that the cost, emissions and loss of load expectation reduced by 50,034.71 $, 87,220.08 kg and 21.96 MW, respectively [38]. Moghaddam et al. proposed an EMS for a residential building to optimally control and monitor RERs and controllable loads using a multi-agent approach. These multiple agents communicated with each other and coordinated with DGs, storages and DR schemes to minimize system operational cost and maximize user comfort [39]. Anvari et al. proposed a multi-objective optimization framework for a residential EMS to fulfill the objectives such as energy consumption cost reduction, improve user comfort, optimal schedule home appliances and manage supply-demand gap. Simulations were performed in MATLAB. The µG architecture considered heat and electricity generation sources, load scheduling potentials, heat transfer and thermal dynamics [40]. Monsef et al. proposed a thermal-electrical load scheduling model for a residential building to satisfy user comfort and energy cost objectives. Mixed-integer nonlinear programming was used to model RERs, storages and domestic load. The architecture controlled the home appliances and provided a platform for the customers to manage their load profile according to their desires [41]. Sameti and Haghighat proposed a mathematical strategy for the optimal combination of cooling and heating supply chain to save annual cost and emission simultaneously. Mixed-integer linear programming was used to determine the optimal flow and storage using the least-annualized-cost approach in GAMS. Results showed that 67% of emissions reduction was achieved by using the proposed strategy [42]. Sameti and Haghighat identified the net-zero energy district among various optimal solutions to integrate electrical and thermal energy storage using the MILP method in GAMS. The proposed strategy optimized energy generation cost, associated size, used technologies and optimal operating strategy. The best solution for cost and emissions objectives were presented as a set of Pareto optimal solutions [43].

A. CONTRIBUTIONS
Main contributions of this paper are summarized as: 1. Proposed an efficient home energy management system to dispatch building loads, storages and sources. 2. Transformed risk-neutral (without CVaR) control into a risk-averse control. 3. Devised a solution methodology by hybridizing modified FPA and MILP algorithms to track improved results in less amount of time. 4. Compared proposed modified FPA-MILP solution technique with Salp Swarm Algorithm, Grasshopper Algorithm, Polar Bear approach, Coyote Optimization and Two Cored FPA for validation purpose. The rest of the paper is organized as: in Section-II system architecture and system modeling; in Section-III, proposed solution methodology; in Section-IV, experimental results and case studies; and in Section-V, draw the conclusion. Fig. 1 shows the layered process of EMS. Building owner accesses EMS control through the first layer termed as user layer by feeding comfort data and appliance preferences. Database layer saves this data and feeds to the optimization layer containing EMS core. Optimization layer generates an optimal dispatch signal to schedule building appliances, energy sources, and storages residing in the service layer. Communication layer acts as a wireless or wired link between optimization and service layers. Fig. 2 shows the proposed smart home EMS for a residential building. Home EMS unit receives data from customer, weather server and utility server about comfort, irradiance as well as temperature and tariff data, respectively, for generation of optimal dispatch signal. Building contains lights as a curtailable load, iron, washing machine, dryer, dishwasher and pool pump as shiftable appliances, PHEVs,   thermal energy storage, CCHP. Electricity from national grid, NG and solar energy are integrated as input carriers whereas electricity, heat, and cooling are taken as outputs. Energy management system core aims to reduce energy consumption cost and emissions. Further as may be witnessed that EMS communicates with utility and customer for monitoring and control purposes.

B. SYSTEM MODELING 1) BUILDING OWNED GENERATION SOURCES
The building-owned energy generation sources are solar PV panel and combined cooling, heating and power unit (CCHP) units. The models are described below: a: PHOTOVOLTAIC PANELS Solar energy proves beneficial for both customer and utility by reducing energy consumption cost and network load, respectively. Moreover, it reduces the threat of global warming effects of fossil fuels. The output power from the solar PV panel installed in the i th home is described as follows [44]: where i, P sr,i (t) , η sr,i , S i , I (t) and T ext (t) are the number of homes, output power (kW), efficiency of solar cell array (%), array area (m 2 ), solar irradiance (kW/m 2 ) and the outdoor temperature ( • C), respectively.
For modeling purpose, one year (2013) hourly solar data of Islamabad, Pakistan, is used to calculate the parameters of probability density function of normal distribution. Later on, the Latin hypercube sampling technique [45] was applied to generate 5000 scenarios over 24 hours. To deduce the computational burden, the samples were deduced to 50, using k-means method [46].
Expression for normal distribution is given as below [47]: where µ, σ are mean and deviation of normal distribution.

b: COMBINED COOLING AND HEATING POWER SYSTEM
Combined cooling, heating and power unit as tri-generation technology can be used in homes with the ratting of 5 kW or below. Typically, CCHP uses NG and heat is captured with a heat recovery unit (HRU) to use in absorption chiller for room cooling purpose and water heating. Utilization of waste heat increases the energy efficiency of the building. The relationship between the CCHP output power (P chp,i ) and heat generated (H chp,i ) is as [44]: where η th,i and η e,i are the CCHP thermal as well as electrical efficiencies (%), respectively. Fuel input (F chp,i ) and electric power output can be expressed as [44]: where β is the conversion factor for kWh to m 3 , respectively. The operational constraints on CCHP power (kW) can be expressed as [44]: where P min chp,i and P max chp,i are minimum and maximum output power (kW) limits, respectively.
The operational constraints on CCHP produced heat is given as [44]: where H min chp,i and H max chp,i are the minimum and maximum limits on the CCHP produced heat (kWh), respectively.
The ramp rate limits can be expressed as [44]: where ramp i is the ramp rate in terms of heat produced.
In actual practice, the fossil fuel supply network such as the NG may or may not be in an outage state. In this paper, the effects of random outages of the NG network on total µG energy consumption cost and the GHG emissions are investigated. Uncertain NG presence is modeled using Monte Carlo simulations. Two generate random network outages, two state Markov Chain process is used [48] in a two-state model, probability density functions representing duration of operation and repair state are assumed to be exponential [49]. Mean time to repair (MTTR) and mean time to failure data (MTTF) is available in ''NERC generator availability data system''.
The conditional probabilities for network availability state are defined as [49]: To represent the presence and absence of the NG network, a series of different states was obtained by putting values of µ i as MTTR and λ i as MTTF in above conditional probabilities. t is the current moment and t o is next moment of time in hours.
The ''0'' represents the unavailability and ''1'' represents the presence of the NG network. To achieve this purpose, 5000 scenarios [49] are generated and reduced to 50. The sum of occurrence probabilities of 50 scenarios is 1.

2) RESPONSIVE LOAD
Responsive load is divided into two categories termed as curtailable loads such as lights and shiftable appliances like washing machine, dryer, iron, pool pump, and dishwasher. All other appliances, such as stoves, TVs, toasters, laptops, ovens, fridges, and computers, are categorized as critical load.

a: SHIFTABLE LOADS
The optimizer shifts appliances from peak to off-peak hours for cost reduction, with required operational time to complete a task. Washing machine, dishwasher, dryer, pool pump, and iron are considered as shiftable loads.. ''Expressions (13)(14)(15)(16)(17)(18) represent the appliances' ON/OFF status, the appliance cannot be up and down at the same time, remains OFF outside the customer specified time interval, maximum run hours, minimum up time for the completion of operation and dryer will operate after washing machine ends up, respectively.'' where MHR, MUT , α i,j , β i,j , on i,j (t) , up i,j (t) and down i,j (t) are maximum run hours, minimum uptime, operation beginning time, operation ending time, ON/OFF state and up and down states of appliances at time t, respectively, for j th appliance of i th building.

b: CURTAILABLE LOAD
Light requirements depend on time. During day time, presence of sunlight reduces appliance generated illumination, however, night hours require increased lighting load. The mathematical model in equation (19) takes external illumination into account to reduce the lighting load. Moreover, curtailment factor has been introduced with a value of 1 in peak hours and 0 in off-peak hours [50].
''where IL in,i (t) , ρ (t) , IL out (t) and IL req (t) are internal/appliance generated illumination (per unit), linear function of electricity price termed as curtailment factor, outer and required illuminations (per unit) at time t, respectively''. Curtailment factor is equal to 1 during peak and mid-peak hours and 0 in off-peak hours. Required and external illumination data can be found in [28].

c: FLEXIBLE THERMAL LOAD
Heat generated from CCHP is used for room cooling and for water heating. Water temperature is given below [51]: ''where T ws,i (t) , V cold,i (t) , T cw,i , V i and H ws,i (t) , C w are water storage temperature ( • C), the volume of entering cold water (liters), temperature of entering cold water ( • C), total water storage volume (liters), heat (kWh) injected for water heating at time t and specific heat capacity of water (kWh/ • C), respectively''. Room temperature is given as [51]: , H air,i (t) , R, and C air are the internal room temperature ( • C), heat (kWh) required to maintain air temperature, thermal resistance of building shell ( • C/kW), and specific heat capacity of air (kWh/ • C), respectively''. Water and room temperature constraints are given below [51]: ''where T min ws,i , T max ws,i , T min in,i and T max in,i are the minimum and maximum water storage as well as room temperatures ( • C), respectively''.
(IV) PLUG-IN HYBRID ELECTRIC VEHICLE The PHEV acts as mobile battery storage. It charges in low tariff hours and discharges in peak hours of the electric grid. The presence of PHEVs in bilateral energy transaction mode helps in peak shaving of the network. Equation for PHEV is given as [44]: ''where E phev,i (t) , P ch,phev,i (t) , P dch,phev,i , t, η G2V ,i and η V 2G,i are energy in the PHEV battery (kWh) at time t, battery charging and discharging power (kW) at time t, duration of charging/discharging (h), grid to vehicle charging efficiency (%) and vehicle to grid discharging efficiency (%), respectively''.
PHEV battery charger constraints are as given as [44]: ''where P ch,phev,i (t) , P dch,phev,i (t) and P max charger,i are battery charging power (kW) at time t and vehicle battery charger rating (kW), respectively''.
Upper and lower limits of state of charge [44]: ''where SOC max,i and SOC min,i are the upper and lower limits on the SOC (%), respectively''. Energy to be stored and available in an electric vehicle is given as [44]: ''where P ch,phev,i (t) , P dch,phev,i (t) , Cap i and E phev,i (t) are vehicle battery charging and discharging power (kW) at time t, capacity of vehicle battery (kW) and energy level in a battery (kWh) at time t, respectively''.

3) ELECTRICAL BALANCES
The expression without DR strategies like load shifting, curtailment, and flexible thermal load is described as follows [44]: ''where P grid (t) , D total (t) , P li,i and P EC (t) are the power fed to or taken from the outer grid (kW), total load (kW), the wattage of lighting load (kW) and power fed to the electric chiller (EC) in (kW) at time t, respectively''. The expression with DR strategies is in shown below [44]: ''where D crit,i (t) , O i,j (t) and P i,j are critical load (kW), binary variable representing ON/OFF status of j th shiftable appliance in i th home at time t and wattage of shiftable appliances (kW), respectively.''

4) THERMAL BALANCES
The heat balance after CCHP is given as [44]: ''where H chp,i (t), H ws,i (t), H AC,i (t), H in,i (t), η in,i , H dr,i (t) and η dr,i are heat generated by the CCHP (kWh), heat fed to water storage (kWh), heat fed to the AC (kWh), heat injected into the thermal energy storage (TES) (kWh), injection efficiency (%), heat is drawn out of the TES (kWh) and drawing efficiency (%), respectively''. The energy balance for room cooling is given as [44]: , COP EC,i and H air,i (t) are coefficient of performance of the AC (%), electric energy fed to EC (kWh), coefficient of performance of EC (%) and total energy for maintaining air temperature (kWh), respectively''. The ratio of electric energy fed to the EC to total energy for maintaining air temperature is taken as an optimizable feature [44]: The expression for the cost under deterministic and riskneutral control is given below [44]: For the risk-averse strategy, CVaR is added to the objective function. The proposed expression for the cost is: ''where F NG,i , PRC NG (t) , P net,i (t) , PRC TOU , ω and CVAR are the NG (m 3 /h) fed to the µG at time t, the NG price (cents), power fed to or taken from the outer grid (kW), time of use (TOU) price of electricity (cents), scaling factor for resilience and conditional value at risk, respectively''. The expression for emissions under deterministic and risk-neutral is given as [44]: The proposed expression for emission under risk-averse mode is given as: are emission rates (kg/h) for grid electricity and gaseous fuel, respectively''.
The CVaR can be represented as [39]: where β is the confidence level, p is the number of scenarios and α is the value at risk. The linear constrained optimization problem has been solved through MFPA-MILP, using MATLAB ver. R2018a on Pavilion dv6 hp Core i7 laptop with 2.0 GHz processor and 8GB of RAM.

III. PROPOSED SOLUTION METHODOLOGY
Deterministic solution techniques are widely used for problem-solving [10]. These techniques are capable of tracking optimum solution, however, fail with an increase in problem size [52]. On the other hand, evolutionary techniques do not ensure optimum solution and take large execution time, however, successfully solve large-sized complex problems [52]. Authors in [5] compared PSO, cuckoo search, electromagnetism like algorithm, artificial bee colony with FPA and found that it outperforms all others in tracking global solution with less execution time, robustness and rapid convergence [53]. Keeping this in view, FPA may prove an efficient solution strategy for the artificial intelligence-oriented community. To further improve search capability, reduce exe-  Architectural viewpoint of proposed hybrid EMS is shown in Fig. 4.
Mathematical expressions for operators are provided in this section. Expression of global flight is given as: The value of Levy flight size L (λ) is: Mathematically local pollination can be described as follows: Random walk may be obtained by combining local and global flight expressions as: 91786 VOLUME 8, 2020   where w 1 and w 2 are scalar dynamic adaptive weights. These weights are defined as follows: Flow chart of the complete study is given in Fig. 5. Optimizer receives all input parameters to optimally dispatch all sources, storage, and appliances.

A. VALIDATION OF PROPOSED HYBRID MFPA-MILP
Proposed solution technique is validated using Rastrigin's function as it is multi-model with poor explorative capability. Function is evaluated using rang [−6.18, +6.18]. Mathematical expression of this function is taken from [52]. The parameter setting of proposed algorithm and other five algorithms are illustrated in Table 1. Comparison of results has been shown in Table 2. Result shows that proposed hybrid MFPA-MILP algorithm outperforms, compared to FPA, modifies FPA, BAT algorithm, firefly algorithm, GA and Simulated annealing.

IV. RESULTS AND CASE STUDIES
In order to test the performance of MFPA-MILP, it is applied to the proposed framework. In addition to this, the performance of MFPA-MILP is compared with the following metaheuristic algorithms: Salp Swarm Algorithm, Grasshopper Algorithm, Polar Bear Algorithm, Coyote Optimization, and Two Cored FPA. The parameter settings of MFPA-MILP can be seen in Table 3, the number of search agents is set to 100 and the maximum number of iterations is set to 500. For other controlling parameters of each algorithm, the values in the latest version [8]- [10], [54], [55] are used to ensure the best performance and tabulated in Table 1. The parameters of appliances, sources, load, solar irradiance data, and tariff data are taken from ref [10]. Table 4 discusses case studies. Case-1 considers existing state of power system with customer turning ON/OFF appliances at his/her own choice and without curtailment in lighting load. This case does not take DR policies and TES into account. Temperature of room and water is controlled by heat led control. Under such thermal control, water and room temperatures are strictly maintained at 70 • C and 22 • C. In case-2, DR programs like load shifting flexible thermal  load, load curtailment and dumb charging are considered. Energy management system control shifts dishwasher, dryer, washing machine, pool pump and iron from peak to off peak hours for energy cost reduction. Flexible thermal load control in contrast to heat led control allows the room and water temperature to vary between customer specified windows. The water and room temperature variation limits are 60 • C to 80 • C and 21 • C to 25 • C. Moreover, lighting load curtails by 20% during peak and mid-peak hours. In case-3 smart PHEV and TES are incorporated. In smart operational mode PHEV charges from 12 am to 8 am during off peak hours to 6.68 kW, goes out from 8 am till 4 pm. As PHEV arrives back home, it discharges in the building from 4 pm till 12 am. Case-4 considered all the attributes of case-3 and considered both cost and emission simultaneously.

A. SIMULATION RESULTS UNDER DETERMINISTIC CONDITIONS
As may be observed in Table 5 that in case-1, the output of CCHP unit reduces, consequently lowering revenue and   power sold. Such dynamics occur due to sharp temperature control. This case shows that due to fine control of temperature, the cost rises with a decrease in revenue. Moreover, the absence of DR scheme plays an important role in rise in energy cost. Another noteworthy point is that cost of home-  1 is high with low revenue compared to home-2, due to dumb presence of PHEV in the former building.
Case-2 takes into account DR programs like load shifting flexible thermal load, load curtailment and dumb charging are considered. Allowed range for temperature variation is 60 • C to 80 • C and 21 • C to 25 • C for water and room, respectively. Table 5 shows that CCHP output increases compared to case-1 with the reduction in cost and increase in power sold and revenue. Increase in CCHP output and sold power is due to the inclusion of flexible thermal load. Allowed temperature fluctuation enables CCHP unit to generate more power. Cost reduction is due to load shifting and curtailment in the lighting load.
Case-3 incorporates TES and smart PHEV. It includes TES in both buildings and intelligent PHEV in home-1. Table 5 shows that cost reduces compared to cases 1 and 2. Moreover, reduction in power purchase, increase in revenue, sold power and output of CCHP are observed. Results show that presence of smart electrical and thermal energy storage serves customer interest.
Case-4 takes all the attributes of case-3 addressing energy cost and emission minimization using Pareto front sets [56]. This case addresses both energy cost and emission by considering environmental concerns. Table 5 shows a decrease in power purchase for reduced emissions. This decrease is due to high emission rate of energy purchase from national grid than for energy generated from NG. Likewise, sold power also reduces.  Table 5) is provided with conventional FPA. Results of conventional FPA are provided in Table 6 [10]. Comparison shows that the proposed algorithm is capable of tacking global optimum better than conventional FPA in all four cases cost reduces. Table 7 displays that proposed algorithm exe-     Table 8 proving the improved global optimum tacking capability of the devised algorithm. Fig. 6 shows the elapsed time using conventional FPA and MFPA-MILP with recent metaheuristic techniques. Fig. 7 shows the comparison analysis (case-4, home-1) of the cost calculated from conventional FPA and proposed MILP-MFPA with other recent metaheuristic algorithms. Comparison of emission (case-4, home-1) calculated from conventional FPA and proposed algorithm with a recent algorithm can be seen in Fig. 8.  In this subsection, 5000 random solar irradiance scenarios are generated and reduced to 50. Among 50 scenarios, 5 th (with the lowest occurrence probability of 0.923%) and 10 th (with the highest occurrence probability of 60%) are selected for validation purposes. Another worth consideration aspect is that simple performing Monte Carlo simulation for the generation of solar irradiation values at each time steps may result in unrealistic scenarios. Therefore, validation of predicted solar irradiance values is required. Predicted data having a  dimension of 5000 × 24 was derived from actual data with dimensions of 365 × 24 for the year 2013, Islamabad, Pakistan. Mean and standard deviation computed on an hourly basis for actual and predicted matrices are as shown in Fig. 10. Moreover, the percentage difference between actual and predicted data regarding their means and standard deviations was computed and shown in Fig. 11. The deviation between actual and predicted data for each hour is not more than 5%, which validates that the predicted values are close to reality.
Results after the application of scenario 5 are presented in Table 9. As devised control does not contain CVaR in the objective function, therefore, it is termed as risk-neutral. Case studies in Table 9 show that cost in all four cases increases compared to Table 5     12.62 kW (under stochastic conditions). Likewise, CCHP output and purchasing power increase. However, sold power and revenue decrease. Application of scenario 10 shows that due to increasing in solar power from 15.88 kW to 17.93 kW, the cost, purchased power and CCHP output decrease with a rise in sold power and revenue as can be seen in Table 10.         Results under scenario 5 with risk aversion characteristics are shown in Table 11. As may be witnessed that by the addition of CVaR, the cost in all cases increases a bit in comparison to the cost in Table 9. However, Table 12 compares the energy storage in PHEV and TES under the risk-neutral and riskaverse modes. As may be observed that although cost in risk-averse mode increases, the energy retaining capability of PHEV and TES increases compared to that in risk-neutral mode by 28.56% and 53.34%, respectively for confidence level 0.90. This stored energy serves as a reliable reserve during the hours of low solar irradiance or carrier outages to avoid loss of load. Fig.s 12-17 show building load, optimal electrical dispatch, optimal thermal dispatch, water and room temperatures, state of charge and Pareto optimal sets with uncertain solar irradiance for case-4, home-1. Similarly, Fig.s  18-22 show building load, optimal electrical dispatch, optimal thermal dispatch, water, and room temperatures and Pareto optimal sets with uncertain solar irradiance for case-4, home-2.  Figs. 23-24 show that energy stored in PHEV battery and TES under risk-averse mode is greater than the risk-neutral mode.

V. CONCLUSIONS
This paper devises building energy management modules to reduce energy costs and emissions. Residential building contains CCHP, solar PV panel, electric chiller, absorption chiller, PHEV, shiftable load, curtailable load, and critical demand. Combined cooling and heating power plant generated heat is used for room cooling and water hearing purpose. Case 1 represents the existing state of the power system. Case 2 includes DR programs such as shiftable load, curtailable load, and flexible thermal load. In response to this, results show that energy cost reduces. Case 3 includes smart PHEV and thermal energy storage. Inclusion of energy storage reduces cost, purchased power, emission along with a rise in CCHP output power and revenue. Case 4 is bi-objective simultaneously reducing energy cost and emission. Building EMS is first solved under deterministic conditions. However, later on, solved with the stochastic presence of solar irradiance. Simulation under probabilistic solar irradiance shows that energy cost and emission depend on the occurrence probability of suitable or unsuitable scenarios. To overcome the loss of load against low solar energy during bad weather, CVAR is added to the objective function. The inclusion of CVAR increases cost a bit with improved energy retaining capability of PHEV and TES. To devise an improved algorithm with better tracking speed, improved efficiency and capability to reach global optimum, MILP and modified FPA are concatenated together. Results prove that the proposed algorithm proves superior to Salp Swarm Algorithm, Grasshopper Algorithm, Polar Bear Algorithm, Coyote Optimization and Two Cored FPA. Future work intends to propose building connected to a central district heating system for bidirectional flow of heat.