Buildings are the main energy consumers across the world, especially in urban communities. Building smartization, or the smartification of housing, therefore, is a major step towards energy grid smartization too. By controlling the energy consumption of lighting, heating, and cooling systems, energy consumption can be optimized. All or some part of the energy consumed in future smart buildings must be supplied by renewable energy sources (RES), which mitigates environmental impacts and reduces peak demand for electrical energy. In this paper, a new optimization algorithm is applied to solve the optimal energy consumption problem by considering the electric vehicles and demand response in smart homes. In this way, large power stations that work with fossil fuels will no longer be developed. The current study modeled and evaluated the performance of a smart house in the presence of electric vehicles (EVs) with bidirectional power exchangeability with the power grid, an energy storage system (ESS), and solar panels. Additionally, the solar RES and ESS for predicting solar-generated power prediction uncertainty have been considered in this work. Different case studies, including the sales of electrical energy resulting from PV panels’ generated power to the power grid, time-variable loads such as washing machines, and different demand response (DR) strategies based on energy price variations were taken into account to assess the economic and technical effects of EVs, BESS, and solar panels. The proposed model was simulated in MATLAB. A hybrid particle swarm optimization (PSO) and gravitational search (GS) algorithm were utilized for optimization. Scenario generation and reduction were performed via LHS and backward methods, respectively. Obtained results demonstrate that the proposed model minimizes the energy supply cost by considering the stochastic time of use (STOU) loads, EV, ESS, and PV system. Based on the results, the proposed model markedly reduced the electricity costs of the smart house.

Most industrial and developing countries have recently paid attention to energy loss prevention in residential buildings. This issue has found more significance with the rising demands for oil and oil-generated energy. The need for new residential, administrative, educational, and other buildings and the tendency to use new equipment has increased energy consumption in this sector. The global energy loss statistics show that wasteful energy consumption is higher in residential and commercial buildings than in other sectors. Currently, almost 40% of the total energy consumed worldwide belongs to the residential and commercial sectors [

In the DR process, end-users change their consumption pattern in response to electricity price variations at different times. In other words, they manage and program their consumption. To motivate the end-users to manage their consumption then, incentives are offered to them in addition to reducing their electricity costs [

Less time for the charging model is presented in [

The imprecise prediction of RES-generated power would certainly lead to non-optimal HEM (energy storage programming, EV charge/discharge management, energy sales/purchase to/from the grid, appliance on/off programming, etc.). Non-optimal energy management and programming also increase household electricity costs, thereby limiting the advantages of home smartization. Therefore, stochastic programming and considering the uncertainties lead to better programming. Moreover, by using the risk criterion, considerable variations in-home energy supply costs in different scenarios can be managed so that the consumer does not face great variations in costs and the expected costs can be reduced.

None of the reviewed papers have comprehensively proposed an energy supply cost-restrained linear model for smart HEM by considering EV charge/discharge programming, DR program, solar RES, and ESS for predicting solar-generated power prediction uncertainty. Therefore, the present paper aims to propose a model to consider the factors mentioned above. So, the contributions of this paper can be summarized as follows:

Solving the optimal energy consumption problem by considering the electric vehicles and demand response in smart homes.

Application of hybrid gravitational search and particle swarm optimization algorithm for solving the mentioned problem.

Considering the solar RES and ESS for predicting solar-generated power prediction uncertainty.

In smart houses, residential buildings are combined with smart technologies to promote safety, electricity consumption optimization and users’ welfare. Users in these houses can control and monitor the HEMS and smart appliances from a distance; in other words, HEMS is a distant monitoring system using distance communication technology. This system includes hardware and software that allow users to effectively manage their electricity consumption by controlling the time of using smart appliances.

A smart house must be equipped with a HEMS, which consists of hardware and software, e.g., smart meters. Smart meters receive and dispatch signals to electricity supply companies. Electricity supply companies transfer price signals to smart meters through the data network. Then, smart meters dispatch the price signals to energy management controllers (EMC) and send users’ feedback to the companies. An EMC is the core of HEMS. Through sensors installed in appliances, EMC allows users to connect to smart appliances by using smartphone apps [

A smart HEMS aims to minimize the daily energy consumption costs by meeting all the system constraints. The total cost is defined as the difference between the cost of the energy purchased from the grid and the revenues resulting from selling energy to the grids (

where

where

In any electric system, the balance between the generated and consumed power must hold as follows [

Generated power comprises the power purchased from the grid, solar power, EV discharge power, and ESS power. Consumed power comprises constant load demands, EV charge power, ESS charge and shiftable loads’ consumed power. This constraint must hold for all the intervals and scenarios.

With the increased penetration of RES in electricity grids and the transformation of inactive distribution networks into active ones, it is essential to aggregate these resources to promote participation and visibility and to create a proper mediator between these sources and the electricity grid. The battery energy storage system (BESS) is an accessible resource greatly contributing to peak shaving, usable voltage quality, and active force adjustment capacity

The minimum and maximum battery charge and discharge constraints are presented below:

The battery cannot simultaneously be charged and discharged. This constraint is formulated below:

The dynamic model of battery energy is calculated via:

EVs utilize a battery with considerable capacity; therefore, the EV model is assumed to be similar to the battery model. The mathematical modeling of EVs resembles that of the ESS system with the difference that EVs are in the parking lot at certain and limited times, while the BESS constantly participates in the HEM program. Moreover, as the homeowner also owns the EV and the optimization program is solved for the next 24 h, the EV owner almost precisely knows the daily EV use in the next 24 h. Therefore, the uncertainty in predicting the time of EV’s presence in the parking lot is not taken into account [

Constraints on EV modeling are described below:

In

The power generated by solar panels supplies the internal needs of the building; if there is surplus power, it can be sold to the upstream grid:

Based on

A smart building is connected to the upstream grid via a feeder with thermal constraints. Therefore, the power purchased from/sold to the upstream grid should not exceed the feeder’s thermal limit or the value mentioned in the contract.

Based on Constraints

To better model the household appliances, they are classified based on the method of usage into three groups: flexible loads, appliances with the stochastic time of use (STOU), and weather-related loads (WRLs). Flexible loads have a predictable and routine time of use (TOU) and follow a specific behavioral pattern, e.g., washing machines, dishwashers, and electric water boilers. The TOU of loads with the stochastic TOU depends on unpredictable factors and conditions and does not follow a specific behavior pattern, e.g., televisions, computers, and lighting.

Weather-related loads are a type of inflexible loads with weather-related consumption. Simply put, weather parameter determines the consumption of these loads, e.g., refrigerators, ventilation systems, and water heaters.

The following method is adopted in this study to model the consumption pattern of flexible loads. First, any flexible appliance is defined as Euj. Then, the appliance is assumed to consume the energy of Uj every time it is turned on. We also assume this flexible appliance consumes this amount of energy within [Aj, Bj] and is plugged in. In this interval, Aj stands for the time of plug-in and Bj for the time of plug-out. Based on these assumptions and determining the nature of the defined parameters, the flexible loads are modeled as follows:

For each flexible appliance, we define minimum and maximum hourly energy consumptions, specified as

The flexible loads are chosen for the day-ahead DR program in this project include a washing machine, a dishwasher and an EV.

Solar energy can be used for important and beneficial applications as a clean energy, accessible everywhere and to everyone. The main characteristics of solar cells include their independence from the global electricity grid or fuels, their bio-friendliness, and their lack of noise pollution. These systems do not take much space, are easily installed, and can be adapted to the systems used within buildings. The main advantage of PV systems is that their power can be consumed in far-away regions. In the regions that lie outside the reach of the grid, the use of PV systems can be more cost-effective than electricity branching. Concerning the inherent variability of solar energy and the uncertainty in its power generation, the Beta probability distribution function (PDF) is used to predict the solar power:

LHS is a group sampling method. Since the Weibull distribution function of each stochastic variable is known, sampling stratification is performed with the sampling delay average to ensure the integrity of sampling data and increase the volume of data. The Weibull distribution should be classified into several parts for each uncertain parameter. Herein, the LHS method is adopted for scenario generation, as presented below [

Step 1: Determining the number of scenarios and then dividing the probability distribution of each uncertain parameter into N;

Step 2: Selecting the mean value from the probabilistic distance

Step 3: Calculating the values of the sample of wind speed, solar irradiation, electricity price and electric charge based on the inverse cumulative distribution function;

Backward scenario reduction is a positive method for reducing the number of scenarios. This technique provides a set of scenarios to estimate their primary set.

Considering _{s} scenarios with the probability, probabilities, and

Step 1: Take S as the primary set of scenarios and DS as the set of scenarios that should be eliminated. The primary DS is zero. Calculate the distance of all the scenario pairs:

Step 2: For any scenario k,

Step 3: Calculate

Step 4:

Step 5: Repeat Steps 2–4 to eliminate the intended number.

In the DR process, end-users change their consumption pattern in response to electricity price variations at different times. In other words, they manage and program their consumption. To motivate the end-users to manage their consumption then, incentives are offered to them in addition to reducing their electricity costs. All these processes promote grid confidence during faults. This definition shows that DR programs mainly aid power systems during peak hours. They motivate the consumers to re-program their consumption patterns. These programs have recently become very popular in modern electric power systems [

As noted before, DR can include the incentives to motivate end-users to manage their electricity consumption during faults in the system and gird. As explained below, DR programs confer numerous advantages for the power grid, electricity retailers, and consumers. DR programs can reduce the peak load to average peak ratio (PAR), thereby preventing unnecessary investments in generation, transfer, and distribution systems and reducing electricity costs. In peak hours, the grid must use generation units with high greenhouse gas emissions to supply electricity because power stations with less greenhouse gas emissions are working at full capacity. Therefore, DR programs can decrease greenhouse gas emissions by reducing peak demand. When certain events occur in the grid, DR programs mitigate the pressure on the power system through direct load control and emergency load reduction to prevent global outage and load disconnection. DR programs can, therefore, promote grid confidence. Moreover, in DR programs, the strong dependence of electricity retailer market prices on wholesale market prices leads to more efficient use of resources in electric power systems. DR programs are attractive to consumers due to their numerous benefits. These programs provide economic benefits and continuous electricity supply (outage prevention). Therefore, consumer benefits can be divided into two economic and confidence-related categories. Due to the increased price of fossil fuels and electricity in recent years, consumers use DR programs to plan, shift and transfer their consumption to other times, thereby benefiting from the economic profit of these programs. Moreover, DR programs mitigate the outage and continuous electricity supply by reducing consumption when events occur in the grid or during peak hours. In the present study, the DR program aimed to level the load curve by shifting loads from peak intervals to non-peak or moderate-load hours, thereby reducing operation costs [

In TOU-based DR programs, the operator shifts part of the load to other intervals as formulated below:

Technical constraints of the DR program are examined below. Note that no load is reduced or increased; the loads are shifted from peak intervals to intermediate- or low-load intervals. At the time of system operation, the relationship between increasing and decreasing loads are defined as:

The following equation expresses that the increasing load must be smaller than a percentage of the baseline load:

Based on the following equations, the percentage of load decrease and increase must be smaller than a certain value:

The proposed method is a combination of PSO and GS algorithms to solve the posed problem. The PSO process, coupled with the GS algorithm, tries to resolve the problems mentioned in the

where

After executing the GS algorithm, the clustering must be evaluated based on the criteria to calculate the particle fitness (in the PSO algorithm). Appropriate evaluation criteria consider the distance between the data in the cluster and the cluster center and between the two clusters. Since the proposed method aims to find the minimum, we must invert the evaluation criteria, the higher values of which indicate better clustering quality. A simple solution adopted in this paper is multiplying the evaluation criterion result by −1 to demonstrate particle fitness. After evaluation, the velocity of each particle is achieved by using the PSO algorithm updating equation:

where

After finding the new position of each particle, the next round of the algorithm is executed.

Particles are designed such that the number of clusters can also be obtained. Each particle has two parts. In the first part (selector), each element indicates whether the center of the corresponding cluster will appear as a cluster in the solution. For instance, the particle shown in

In this example, if the value of each selector element is >0.5, the center of the corresponding cluster will be involved in clustering; otherwise, that cluster center will not be used. In this example, 0 particles cluster the data into three clusters. A piece of data may not belong to any cluster center; in this case, when using the GS algorithm, these cluster centers are removed to improve cluster centers. This is simply done by setting the value of the cluster selector to 0.

A combination or hybridization involves combining two or more different things, which results in better results than their individual states. The GA and PSO algorithms have similar properties. Both have an initial random population and a certain amount of competency to assess the population. Therefore, combining these two methods can create an efficient hybrid algorithm.

In this section, we introduce the structure of the combined gravitational search algorithm and particle community.

In this section, we introduce the structure of the combined gravitational search algorithm and particle community.

The algorithm has the following steps:

The initial population is randomly generated.

The cluster centers are extracted in each particle.

Data clustering is performed such that each piece of data belongs to a cluster center.

The force applied to each cluster center is calculated based on the distance between the data of that cluster and the cluster center.

The cluster center is displaced based on Equation 0.

Go to Step 4 if there is any change in the cluster center.

Updated centers’ coordinates are placed in the particle.

Fitness is calculated based on an internal criterion.

Gbest of all the particles and Pbest for each particle are selected.

The position of each particle is updated based on

Go to Step 2 if none of the exit conditions is met.

Extract the cluster centers’ coordinates from the best particle and take them to the output as the clusters’ centers.

To evaluate the overall effects of different appliances on the consumer’s electricity bill, the proposed model for HEM is simulated in MATLAB and the results are discussed here. The data of STOU loads and non-shiftable appliances are presented in

Equipment | Nominal power (W) | Working period (h) |
---|---|---|

STOU loads | ||

Washing machine | 1400 | 1 |

Dishwasher | 1320 | 0.5 |

Non-shiftable TOU loads | ||

Refrigerator | 1200 | 24 |

Hairdryer | 1800 | 0.5 |

Telephone number | 5 | 24 |

Television | 83 | 6.5 |

Computer | 150 | 2.15 |

A/C | 1140 | 7.15 |

Lighting | 100 | 6.15 |

Oven | 2400 | 0.5 |

Hood | 225 | 0.5 |

Iron | 2400 | 0.5 |

Kettle | 2000 | 0.5 |

Parameter | Value | Unit | Parameter | Value | Unit |
---|---|---|---|---|---|

%95 | 8 | kWh | |||

%95 | 16 | kWh | |||

3/3 | kWh | 4/8 | kWh | ||

3/3 | kWh | ||||

%95 | 1/5 | kWh | |||

%95 | 3 | kWh | |||

0/6 | kWh | 0/75 | kWh | ||

0/6 | kWh |

It is assumed that the EV exits the parking lot at 7 a.m. and returns at 6 p.m. When the EV is leaving the parking lot, its battery must be charged to maximum capacity to prepare the EV for the trip. The distribution company determines the electricity purchasing price from the upstream grid. This price can be defined as different values in time blocks. Herein, the energy purchasing price is assumed hourly and based on

To predict the solar power, 100 scenarios were generated and then reduced to 10 to increase the computational speed and reduce the computation time. The scenarios for solar power prediction and the occurrence probability of each are presented in

Scenario | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|

Probability | 0.1 | 0.09 | 0.08 | 0.12 | 0.07 |

Scenario | 6 | 7 | 8 | 9 | 10 |

Probability | 0.09 | 0.14 | 0.04 | 0.18 | 0.09 |

Four states are assumed to evaluate the economic effects of using the equipment in the smart building. In all four states, the DR strategy is based on price, and the EV is in the parking lot from 6 p.m. to 7 a.m. the next day.

The first state: PV systems and ESS are not used.

The second state: A PV system with a generation power capacity of 500 W is used. It can sell the generated energy to the upstream grid and consume it for household uses.

The third state: In addition to the EV and PV system, an ESS with the capacity of 3 kWh is included.

The fourth state: By considering the uncertainty in solar power prediction, the smart house programming problem is stochastically programmed. In this state, by considering the CVAR, the values of

In the first state (DR program and EV included in the HEMS), the power exchanged with the grid is displayed in

The EV charge/discharge performance and the STOU loads are given in

Based on

The energy supply cost is 157.58 cents in the first state. In the second state (PV system with 3 kWh capacity installed on the roof), variations in exchanged power with the grid are displayed in

In

In this case, the EV charge/discharge performance and the STOU loads are similar to the first state. When the energy price is minimum, the EV is charged to maximum; when the energy price is high, the EV is discharged as much as possible for internal use. The energy supply cost for the second state is 108.58 cents which are reduced compared to the first state due to using the PV system.

Results of the third state (EV, PV system, and ESS with 3 kWh capacity) are given in

The power exchanged with the gird is displayed in

Scenario | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|

Cost | 108.234 | 108.4 | 107.695 | 107.312 | 108.351 |

Scenario | 6 | 7 | 8 | 9 | 10 |

Cost | 108.211 | 108.234 | 109.612 | 108.754 | 107.456 |

The energy supply cost in the four stages is compared in

State | 1 | 2 | 3 | 4 |
---|---|---|---|---|

Energy supply cost | 158.12 | 107.21 | 109.125 | 105.418 |

The sensitivity of the expected cost of energy supply and the CVAR risk criterion to the beta parameter change for the fourth case, where the uncertainty in the prediction of solar power is considered, is shown in

According to

In this section, the proposed optimization algorithm is compared with other optimization methods. To cover the fair comparison condition, the benchmark function with the same parameters and area has been considered as presented in

Function | Range | Proposed | IABC | ABC | PSO | ||
---|---|---|---|---|---|---|---|

−600 ≤ _{i} |
50 | Mean | 0 | 0 | 0.587 | 0.009 | |

SD | 0 | - | - | - | |||

−5.12 ≤ _{i} |
50 | Mean | 0 | 5.03e−8 | 461.29 | 63.521 | |

SD | 0 | - | - | - | |||

−50 ≤ _{i} |
50 | Mean | 0 | 2.56e−14 | 1.09e6 | 25.222 | |

SD | 0 | - | - | - | |||

−0.5 ≤ _{i} |
50 | Mean | 0 | 0 | 0 | 0.007 | |

SD | 0 | - | - | - |

Most of the industrial and developing countries have recently paid attention to energy loss prevention in residential buildings. This issue has found more significance with the rising demands for oil and oil-generated energy. The need for new residential, administrative, educational, and other buildings, as well as the tendency to use the new equipment, have increased energy consumption in this sector. The global energy loss statistics show that wasteful energy consumption is higher in residential and commercial buildings than in other sectors. The current study proposed a model for home energy management to minimize the energy supply cost by considering STOU loads, EV with

Time

Loads with the ability to move activity time

Scenario

^{ESS}

Storage charge

^{EV}

Vehicle charge

^{ESS}

Storage charge rate

^{EV}

Vehicle charge rate

^{ESS}

Storage discharge

^{EV}

Vehicle discharge

^{ESS}

Storage discharge rate

^{EV}

Vehicle discharge rate

_{1}

High limit of input power from the network

_{2}

High power limit given to the network

_{t}

^{other}

Power consumption of non-removable loads at time t

_{t}

^{PV, pro}

Solar energy produced at time t

^{ESS, ini}

Primary energy storage

^{ESS, max}

Maximum energy storage

^{ESS, mini}

Minimum storage energy

^{EV, ini}

The initial energy of the car

^{EV, max}

Maximum energy consumption

^{EV, min}

Minimum car energy

Planning time period

_{t}

^{buy}

The purchase price of electricity from the network at time t

_{t}

^{sell}

The selling price of electricity to the grid at time t

_{ts}

^{ESS, ch}

Battery charging power at time t and scenario s

_{ts}

^{ESS, dis}

Battery discharge power at time t and scenario s

_{ts}

^{ESS}

Battery power at time t and scenario s

_{ts}

^{EV, ch}

Vehicle charging power at time t and scenario s

_{ts}

^{EV, dis}

Vehicle discharge power at time t and scenario s

_{ts}

^{grid}

Power received from the network at time t and scenario s

_{ts}

^{PV}

Solar power generated by solar panels at time t and scenario s

_{ts}

^{PV, Used}

Solar power used for home consumption at time t and scenario s

_{ts}

^{sold}

Power sold to the grid at time t and scenario s

_{tms}

^{sh}

Movable load power of mm in time t and scenario s

_{m}

^{sh, rated}

The nominal power of the movable load m mm

_{m}

Removable load operating time m

_{ts}

^{ESS}

Storage energy level at time t and scenario s

_{ts}

^{EV}

Vehicle battery energy level at time t and scenario s

_{1}

Maximum allowable power received from the network

_{2}

Maximum allowable power sold to the grid

Ratio of car charge level when leaving home

_{t}

^{ESS}

A binary variable that is one means that the energy storage system is charged at time t

_{t}

^{EV}

A binary variable that is one means that the car battery is charged at time t

_{t}

^{EV}

A binary number that is one means the presence of an electric car in the house at time t

_{t}

^{grid}

A binary variable whose being one means receiving power from the network at time t

_{mt}

^{sh}

A binary variable whose being one means that the movable load of m is clear at time t

_{mt}

^{sh}

A binary variable whose uniqueness means launching the movable load of mm at time t

The building’s daily energy consumption cost

The probability of occurrence of the

The programming interval

The weight coefficient for the risk criterion

Recourse variables to calculate the risk criterion

State of charge

Maximum and minimum battery charge and discharge

Charging efficiency

Discharging efficiency