Abstract

Title : Optimization methods and energy management in smart grids

The current electricity grids will experience a profound change in the coming years. The new generation is the SG which is characterized by information and communication layer enabling the communication between the different components of the grid. It needs to consider all sides of power grid, making it more intelligent and flexible. This notion is presented as an answer to changes in the electricity market, aiming to manage the increased demand while ensuring a better quality of service and more safety.

First, we present a MILP formulation to optimize the energy production and consumption systems in a smart home with an effective deployment of several DER. Then through the design of experiments with the Taguchi method, diverse scenarios are introduced by varying significant factors. Afterward, a heuristic technique is proposed to solve the problem of residential energy management by finding the global optimum solution for many consecutive days with significant reduction of execution time.

Second, an energy management model is proposed thanks to mathematical models to optimize the grid, renewable energy resources, battery and EVs are presented as well as for different type of thermal and electrical appliances. An exact solution method is implemented to reduce the electricity cost in a smart home and find out operation modes of different loads. Then a math-heuristic optimization algorithm is proposed to solve the problem with extended simulation time horizon.

Finally, we study a microgrid energy management problem which comprises multiple smart homes. Each of them owns renewable energy resources, one EV and smart appliances. The renewable energy resources inject the excess energy in the shared ESS. An optimized energy management model using MILP is proposed to reduce the total electricity cost in the microgrid.

Comparisons with conventional scenarios where each smart home has its individual small ESS without sharing energy with their neighbors are done to ensure that the proposed formulation is well efficient.

Keywords: Energy management system, mixed integer linear programming, smart grid, optimization, heuristic algorithm, distributed energy resources.

Résumé

Titre : Méthodes d'optimisation et de gestion de l'énergie dans les réseaux intelligents "Smart Grids"

Les réseaux électriques actuels connaîtront un profond changement dans les années à venir. La nouvelle génération est le SG ou le réseau électrique intelligent qui se caractérise par une couche d'information et de communication qui permet aux différents composants du réseau de communiquer. Il doit considérer tous les aspects du réseau électrique, le rendant plus intelligent et flexible. Cette notion est présentée comme une réponse à l'évolution du marché de l'électricité, visant à gérer l'augmentation de la demande tout en assurant une meilleure qualité de service et plus de sécurité.

Premièrement, nous présentons une formulation de programmation linéaire mixte en entier pour optimiser les systèmes de production et de consommation d'énergie dans une maison intelligente avec un déploiement efficace de plusieurs ressources énergétiques distribuées.

Ensuite, à travers la conception d'expériences avec la méthode de Taguchi, divers scénarios sont introduits en faisant varier des facteurs significatifs. Par la suite, une technique heuristique est proposée pour résoudre le problème de la gestion de l'énergie résidentielle en trouvant la solution optimale globale pendant plusieurs jours consécutifs avec une réduction significative du temps d'exécution.

----------------------------------------------------------------------29 1.2. Thesis Outline---------------------------------------------------------------------------------------------30
1 Introduction

Energy Context and Motivation

Electrical systems in most developed countries are undergoing important changes. These changes are the result of the liberalization of the electricity market and the increase of the implementation of renewable energies. The topology of the electrical system has not changed since its creation in the early 20th century. At that time, a centralized architecture was implemented: electricity being produced in power plants with very high power, transported between regions by very high voltage networks and distributed to consumers by low voltage networks. This centralized architecture was the one that best met the constraints of at that time; it also guaranteed rapid network development and good quality of supply. However, in recent years, this system has begun to be questioned in order to allow a broad liberalization of the electricity market and increase the share of electricity generators based on renewable energies while maintaining the quality of energy delivered to consumers. Furthermore, the environmental problems are today pregnant in the world of energy. On the one hand, fossil resource reserves are limited and, on the other hand, the use of these resources is responsible for a number of environmental consequences: local pollution or increased concentrations of greenhouse gases in the atmosphere inducing a global warming. As well as, the average temperature at the surface of the globe will rise between 2°C and 6°C by the end of the 21st century. In particular the electrical system must today evolve for to answer a set of emerging problems: aging of network infrastructures, new electrical uses, growth in demand, particularly in the peak period, the desire to deploy means of production depending on intermittent and/or decentralized renewable resources. On the strength of these different findings, new actors are positioning themselves in order to develop solutions to make the demand for electricity more flexible, to integrate increasingly intermittent renewable production by guaranteeing the reliability of the system, to implement large scale EVs, to store electricity, etc.

These issues, closely linked, have led to the emergence of the concept of SGs, in order to optimize the management of the electrical system. SGs result from the merging of the electrical networks and the telecommunications networks by the progressive integration of the new technologies of the information and the communication. This deployment allows the communication between the actors of the electricity network, the consumers, the decentralized production, the EVs and the different elements of the electrical infrastructure. The new controllability of the network allows the emergence of new advanced driving features that allow network managers to improve their operation, safety and reliability.

Thesis Outline

The rest of the thesis is organized as follows:

Chapter 2

This chapter presents some necessary background topics essential for the thesis. A literature review from conventional electrical grid to the SG is introduced. Subsequently, numerous optimization and programming techniques are presented that permit the right operation and control in the SG environment.

Chapter 3

Chapter 3 presents the first journal paper, published in IEEE Canadian Journal of Electrical and Computer Engineering (CJECE). In this chapter we present a MILP model to optimize the energy production and consumption systems in a smart home with an effective deployment of several DERs, such as the integration of renewable energy production (solar and wind) and battery storage systems as a DG with penetration of gridable vehicles, generally referred as V2G.

Different case studies are introduced by varying significant factors through the design of experiments with the Taguchi method. After that, a heuristic technique is proposed to solve the problem of residential energy management by finding the global optimum solution for many consecutive days with significant reduction of execution time of the scenarios.

Chapter 4

Chapter 4 presents the second journal paper, published in IEEE Transactions on Industry Applications (TIA). In this chapter, an energy management model is proposed and mathematical models for the grid, renewable energy resources, batteries and EVs are presented as well as for different type of thermal and electrical appliances. An exact solution method is implemented to reduce the electricity cost in a smart home and find out operation modes of different loads then a math-heuristic optimization algorithm based on MILP formulation is proposed to solve the problem with extended simulation time horizon.

Chapter 5

Chapter 5 presents the third journal paper, which has been submitted to IEEE Transactions on Energy Conversion (TEC). In this chapter, we consider a smart microgrid which comprises multiple smart homes each of them owned: renewable energy resources (one PV system and one micro-wind turbine), one EV and smart appliances. The renewable energy resources inject the excess energy in the shared ESS. Each smart home is interested to utilize the shared ESS to increase its return. The energy exchange between the smart homes in the considered microgrid is controlled by a RMGO. To ensure that the implemented energy management model using MILP is efficient in reducing the total electricity cost in the microgrid, we have compared it with a conventional scenario where each smart home has its individual small ESS without sharing energy with their neighbors. To perform a reasonable comparison, we ensure that the capacity of the shared ESS is equal to the sum of the capacity of all individual ESS.

Chapter 6

Finally, Chapter 6 summarizes the proposed works and provides recommendations for future research.

2

From Conventional Electrical Grid to the Smart Grid: Literature Review

Contents | Chapter 2 2.1. Operation of Electrical Grid----------------------------------------------------------------------------35 2.2. The Smart Grid Concept--------------------------------------------------------------------------------37 2.2.1. Demand Side Management-----------------------------------------------------------------39 2.2.2. Demand Response Program-----------------------------------------------------------------41 2.2.3. Renewable Energy Resources---------------------------------------------------------------43 2.2.4. Electric Vehicles--------------------------------------------------------------------------------45 2.2.5. Energy Storage System-----------------------------------------------------------------------46 2.2.6. Microgrid-----------------------------------------------------------------------------------------47 2.3. Optimization and Programming Techniques in Smart Grids----------------------------------49 2.4. Conclusion-------------------------------------------------------------------------------------------------51
2 From Conventional Electrical Grid to the Smart Grid: Literature Review

Operation of Electrical Grid

The electrical grid is the transport vector for electrical energy. It provides the connection between the production centers and millions of subscribers. The role of the electrical grid is to bring energy from the production power plants to the consumers while guaranteeing a very big robustness and the best possible efficiency and performance. The majority of losses on the grid are Joule losses due to resistivity of conductors reducing the resistivity of the conductors is very expensive, since it amounts of using conductors having a larger section or materials with a lower resistivity. The most interesting economically solution is to raise the level of the voltage. At the output of the power plants, high-voltage lines allow to transport significant power over long distances, then lines with lower and lower voltage levels carry energy to the final consumption points. Fig. 2.1 illustrates the conventional electrical power system.

The electrical grid is broken down into four subsystems associated with different voltage levels: production, transmission, distribution and consumption [L. Lasne, 2008]:

 Production:
The production of electrical energy consists of transforming convertible energies into electrical energy at medium voltage. All convertible energy can be divided into two main parts: on the one hand, non-renewable energy sources such as coal, fuel oil, fossil fuels and nuclear power, and on the other hand, renewable energy sources such as solar, wind, hydro, biomass and wave energy.



Transmission and distribution:

The transmission and distribution networks (T & D) transport the electrical energy from production points to consumers at very high, high and medium voltage. The energy is transported in the form of three-phase systems of (sinusoidal) voltages whose characteristics are: the frequency (50 Hz or 60 Hz), the normalized voltage levels and the couplings of the terminations (triangle or star).



Consumption:

The electrical consumers are divided into 4 main sectors [EPA, 2018]:

-Residential sector: it includes single-family homes and multi-family housing.

-Commercial sector: it includes government facilities, service-providing facilities and equipment and other public and private organizations.

-Industrial sector: it includes industries as manufacturing, mining, agriculture, and construction.

-Transportation sector: it consumes most of its energy by directly burning fossil fuels such as gasoline, diesel, and jet fuel. However, some vehicles use electricity from the electric power grid instead. These vehicles include battery-powered electric cars and plug-in hybrid electric cars that store power from the grid when they charge their batteries; various types of electric vans, trucks, and buses that do the same; and subway, electric rail, and trolley systems that are continuously connected to the electric power grid.

Fig. 2.1 Electric power system

The Smart Grid Concept

The depletion of fossil resources and the fight against greenhouse gas emissions lend urgency to the control of consumption and the diversification of energy sources. Therefore, renewable energy remains nowadays an important resource to consider in this context [START_REF] Melhem | [END_REF]. The demand for power is increasing dramatically in developed and developing countries. In 2030, an increase of 50% and 40% of energy consumption is expected in the US and Europe respectively. It is expected to triple in China and India and doubling globally [START_REF] Veolia | Veolia Environnement[END_REF]. This increase must be taken into account and the quality of service must be maintained. In addition, the availability of fuels can no longer be taken for granted facing the ever increasing demand for energy. Even if these resources were available, and peak oil is avoided, the long-term impact of carbon emissions from fossil fuels would damage the global climate [Ramchurn et al., 2012]. Beyond the challenges that affect the entire energy sector, the electricity sector is also facing new constraints: a need for renewal of network infrastructures, a desire to increase the means of decentralized and/or intermittent production and an increase in electrical demand, especially at peak periods. One of the ways to respond to these new constraints is to develop a smarter electrical system through SG technologies. According to the European Technology Platform Smart Grids (ETPSG), a SG is an electricity network that can intelligently integrate the actions of all users connected to itgenerators, consumers and those that do bothin order to efficiently deliver sustainable, economic and secure electricity supplies. In Europe, the so-called triple 20 objectives seek in particular to increase the share of renewable energies in final energy consumption so that in 2020 it reaches 20% [START_REF] Bouckaert | [END_REF]. However, some renewable generation sources may be intermittent (wind, solar, etc.) and may introduce new constraints on the networks if they are developed on a large scale. Following these findings, the Obama administration introduced in 2007 a law project aiming to modernize the infrastructures of the American electrical grid. This project aims to increase the use of digital control and information technologies, to develop a dynamic optimization of the demand-supply balance and the cybersecurity related to the operation of the network. It is intended to ensure demand management and control, increased integration of renewable energies, the increase of the units of decentralized production and storage, the deployment of smart meters, smart devices and customer services. The transition from the current power grid to the SG as given in Fig. 2.3, must be based primarily on progress on the previous main elements. To achieve this goal, the vision of the SG is built around key concepts that will be examined in the next subsections.

Demand Side Management

In particular, instead than production following electricity demand as is currently the case, the DSM concept states that consumers adjust their consumption to reduce the load of the electricity. Each utility desires to avoid additional expenses by installing extra capacity to meet the daily growing electricity demand. One way to achieve this objective is to utilize existing energy efficiently. Therefore, utilities implement DSM programs to manage the energy consumption of the consumers [START_REF] Masters | Masters GM[END_REF]. Thus the most important aims of DSM implementation are the reduction of the cost of electricity by managing energy consumption, environmental and social development, increasing the reliability and reducing the gird issues.

DSM programs contain diverse policies such as:

-Energy efficiency policy (it refers of using a less energy to offer similar or better level of service to the energy consumer in an economically efficient approach), -Demand response policy, -Consumers load management policy.

In the residential consumer load management policy, the utility intends to decrease the electricity consumption and to reduce the peak [START_REF] Ontario | Energy Conservation Committee Report and Recommendations, Reducing electricity consumption in houses[END_REF]. Diverse techniques of load shaping are shown in Fig. 2.4.

Fig. 2.4 DSM techniques

The six most used techniques of DSM are peak clipping, valley filling, load shifting, strategy conservation, strategic load growth and flexible load shape [START_REF] Macedo | Demand side management using artificial neural networks in a smart grid environment[END_REF].

 Peak clipping: load cutting, demand reduction in time for a heavy load. The duration of the peak can be reduced by DLC, shutdown of consumer equipment, or distributed generation.

 Valley filling: encourages off-peak consumption. Non-peak consumption periods are increased, which is particularly desirable because the cost of production is lower, decreasing the average price and improving the efficiency of the system. Various incentives, such as discounts, motivate certain consumers to change their habits.

 Load shifting: shifts the workload transfer period of greatest consumption (peak period to period of lower consumption) and moves tip out loads without changing the total consumption. This is also possible with distributed generation.

 Strategic conservation: decreases seasonal energy consumption mainly by increasing consumption efficiency and reducing energy waste. This program is quite comprehensive and includes incentives for technological change.

 Strategic load growth: controls the increase seasonal energy consumption. The dealership utilizes intelligent systems and processes, extra efficient equipment, and more competitive energy sources to attain their targets.

 Flexible load shape: a set of actions and integrated planning between the concessionary and the consumer, subject to the needs of the moment. This approach models consumer loads without affecting the actual security conditions, limiting the power and energy that the individual consumer can use at certain times by installing load-limiting devices.

Demand Response

The definition of DR as used by the U. S. Department of Energy in its February 2006 report to Congress and later adopted by the Federal Energy Regulatory Commission is stated as [START_REF] Aeic | Demand response measurement & verification[END_REF]: "Changes in electric usage by end-use customers from their normal consumption patterns in response to changes in the price of electricity over time, or to incentive payments designed to induce lower electricity use at time of high wholesale market prices or when system reliability is jeopardized." DR program is a very important element in SG. For many years, DR was just a peak clipping approach for specific hours of a year. Afterward, definition was modified as change in electricity usage of end-use consumers from their normal consumption pattern in response to changes in the price of electricity over the time [FERC, 2010]. In conventional electrical grid, consumers don't have the concept of energy efficiency of their loads and they don't obtain at all any motivation to modify in their consumption manner. In this case, the utility maintain balance between production and demand by the supervision on the production resources.

While in the DR, there are two main program s: incentive based program (IBP) and pricebased program (PBP) [START_REF] Aghaei | [END_REF]. IBP and PBP programs are again subdivided by the Federal Energy Regulatory Commission (FERC). In IBP, the clients obtain the financial incentive if they modify their consumption according to the conditions specified in the contract. Therefore, customers permit the utility to manage their loads during peak hours. IBP are divided into six types depending on their operation modes: DLC, interruptible/curtailable (I/C), demand bidding (DB), emergency DR (EDR), capacity market (CM), and ancillary services market (AS). In PBP, the clients modify their consumption in response to price change of electricity. Indirectly, the utility have an effect on the loads of the consumers using time varying pricing method. The

Renewable Energy Resources

The decentralized energy resources (DER), cover all low power systems producing electrical energy at low voltage levels. The term DER is opposed to the term "centralized production" that representing power plants connected to the transmission grid. The primary energy used by DERs is generally renewable and comes from energy sources: solar, wind, hydraulic, biomass, geothermal etc. The essential element of these kinds of energy resources is free and available. For about a decade, the development of wind and solar energy continues at a pace across the word.

Wind power is generated from air flow, using the turbine to convert mechanical to electrical energy. It transforms the energy of the kinetic from the wind, identified as wind energy, to automatic power known as the wind power. The small onshore wind farm is adapted for isolated locations. Producing electricity from micro-wind turbines is becoming increasingly frequent in utility companies [Business Green, 2011]. 90 countries all over the world are being used economically the wind power generation. China is the country that generates the largest wind energy in the world according to report of the Global Wind Energy Council. Table 2.1

illustrates the world ten countries wind energy capacity in 2016 [START_REF] Gwec | Global Wind Report Annual market updates[END_REF].

Electric Vehicles

The automotive sector is going through profound changes in the coming years where the EVs are an important factor to consider in the development of the future electricity grid, the SG.

In 2030, the automobile sector will have modifications compared to the one we know since the beginning of the 20th century: thermal vehicles, although still numerous, will use very little oil, and could even be restricted in the centers of large metropolises because of their local nuisances (pollution, noise). At the same time, the sector's economic model will be disrupted by the gradual disappearance of the ownership link between user and vehicle: rental and car-sharing could become more common.

This evolution is made unavoidable by three major factors [START_REF] Negre | [END_REF]:

 The energy crisis: the dependence of transport on oil poses economic problems (trade deficit)

and geopolitics (risks on oil supplies) that will only increase.

 The environmental crisis: the transport sector is one of the main contributors in terms of CO 2 emissions and it represents one quarter of our emissions, an increase of 22% since 1990.

 The crisis of the current economic model of the sector: it is based on a rapid renewal of vehicles, whose utility is questioned by customers today in times of crisis, and tomorrow for ecological reasons.

Although the EVs is not a new concept, prototypes have existed since the end of the 19th century, the progress made on batteries and autonomy, changing attitudes and political incentives have allowed the EV market to become more attractive. For the grid, EV can be perceived in two ways, as a load, or as a means of storing energy. In the first case, charging control consists of shifting the consumption of EVs over time, in order to limit power peaks on the grid, or to make recharge coincide with periods of high production of renewable energy resources. In the second case, it is a question of using the battery of EVs to absorb or supply energy according to the market prices, the availability of the RERs or the consumption of the individual. This is the concept of the "Vehicle to Grid (V2G)" [START_REF] Mercier | [END_REF].

Technical levels of recharging power for EVs exist, corresponding generally to the available power with circuit breakers of 16, 32 and 63 amperes [START_REF] Negre | [END_REF]:

-16 A single phase = 3 kVA, considered as "normal recharge";

-32 A three-phase = 22 kVA allowing "accelerated charging";

-63 A three-phase = 43 kVA allowing "fast charging".

The increase of the recharging power makes it possible to decrease in proportion the duration of recharging for an electric battery. Thus, for a battery of average capacity

Energy Storage System

The energy storage is an important tool for mitigating the temporal and often geographic differences between energy generation and consumption that can be particularly difficult to control when generation is provided by variable renewable sources such as solar and wind energy. Variable generation sources must typically be converted and conditioned using power electronics to serve a typical AC load either on the utility grid or in smaller, distributed networks [START_REF] Chakraborty | [END_REF]. Electricity storage is very valuable for adding flexibility to smart electric grids because it helps to deal with the variability and unpredictability of renewable resources. Electricity storage can be divided into bulk storage, which can output large amounts of power (multiple megawatts) over long periods of time (minutes to hours), and distributed storage that can output smaller amounts of energy (kilowatts to megawatts) over shorter periods of time (milliseconds to minutes) [START_REF] Irena | Smart grids and renewable[END_REF]. Some of the technologies that is used in distributed storage include lead acid batteries, lithium-ion batteries, some types of flow batteries, thermal storage, flywheels, super capacitors, and hydrogen storage. Distributed storage is largely still in a research and pilot project phase. Technologies are available, and some of them are reliable, but costs are still too high to allow for widespread deployment in larger electricity grids at a commercial level. However, costs are coming down, storage solutions are being integrated by renewable power suppliers at a household and commercial level, and distributed storage may play a significant role in the future electric grid. Lithium-ion batteries are receiving the most attention currently in terms of research and pilot projects. High cost and low life expectancy are the major factors preventing wider deployment; both cost and lifetime are gradually improving.

Lead acid batteries have been around the longest and are the most commercially mature and economical, with extensive use in off-grid power systems and grid backup systems. For the energy management of microgrids, which require energy storage technologies for low/medium scale electrical networks, the most used storage systems are based on batteries [Yoldas et al., 2017]. Battery storage system can be charged and discharged with limited current charge mode under constant power, constant load or constant current. In the development of the EMS proposed in this thesis, the selected method for charging and discharging the battery is constant power.

Microgrid

A microgrid is a local electrical network that (1) comprises power generation units, power consumption units, and a means of delivering power from the generation units to the consumption units, (2) may be connected to a larger utility power system, and (3) operates to balance the power supply and demand within the microgrid [Barnes, 2007]. The microgrids are defined by the European Technology Platform -Smart Grids (ETP-SG) as low and medium voltage networks comprising decentralized production units, storage systems and controllable loads (from a few hundred kW to a few MW installed capacity). Microgrids can therefore include all the functions previously presented (DR, EVs, etc.). They are connected to the network but can also be used in an isolated way in case of failure of the transport network. Once the problem is solved, the microgrid can be resynchronized [European Commission, 2009]. It is typically on the scale of a small town, neighborhood, military base, or university or commercial

Optimization and Programming Techniques in Smart Grids

In several fields of technology and science such as engineering, physical sciences, finances, a question is frequently presented: what is the most excellent way to attain a defined objective? For the electrical SG or the energy system, this interrogation can be expressed in the following points:

-Which production resources must be operated in a specific period and what must be the produced amount?

-What is the top interconnection between the considered systems?

-What is the greatest operating time of the scheduled home appliances?

-Etc.?

All these kind of difficulties can be solved by "optimization" of EMS in microgrids or SGs. In order to present a right operation and control of the considered systems in the SG, three kinds of approaches can be applied, ( 1) rule-based techniques, (2) optimization-based techniques and ( 3) hybrid techniques as shown in Fig. 2.9 [Silvente, 2015].

Optimization techniques for energy management in smart grids

Rule-based techniques Optimization-based techniques Hybrid techniques

Exact mathematical methods

Approximate methods

Nonlinear models

Linear models

Metaheuristics Heuristics Artificial intelligence

Mixed integer linear programming (MILP)

Integer linear programming (ILP) Linear programming (LP)

Nonconvex programming

Convex programming

Quadratic programming

Local search algorithms

Constructive algorithms

Population-based methods

Trajectory methods

Ruledbased

Agentbased

Expert systems

Fig. 2.9 Some optimization techniques

Firstly in the rule-based technique, the reference points are allocated according to the existing situation and defining some scenarios, usually by means of decision trees. This technique is adapted to the system conditions by providing feasible solutions but can't guarantee the best possible solution [START_REF] Hernandez | [END_REF]. Secondly, the optimization-based techniques intend to provide the best local or global solutions. Generally, the mathematical formulation of an optimization problem consists to maximize or minimize an objective function while satisfying all considered constraints related to the integrated components in the model [START_REF] Iqbal | [END_REF].

Depending on the complexity and the difficulty to solve the system problem, this technique can be addressed by means of exact or approximate methods. The approximate methods have an advantage that can simply manage the nonlinear constraints and objective functions while but cannot guarantee the quality of the obtained results because they generally employ random search methods [Chen, 2013]. Furthermore, the possibility to find the global solution decreases as soon as the size of the considered problem augments [Lin, 2012]. The exact mathematical methods generate an optimal solution when they are specified in a feasible region. There are two categories linear and non-linear model based on all implemented constraints and the objective functions. The linear models are divided in three types: LP, integer programming and MILP, according to the variables if they are real, integer, or both variable types, correspondingly.

Thirdly, the hybrid techniques can join several methods so that to benefit of their characteristics.

In this thesis, we have chosen, the MILP for the modeling of the energy management problem because it generally permits to employ the characteristics of the integrated DER with employing integer variables and binary variables to make a decision on the operation status of the production systems, battery storage system, EVs and smart appliances in smart homes of the microgrid. Furthermore to solve the optimization problem of extended optimization time horizon in the electric SG environment, we have used two techniques, the MILP and the greedy method (constructive algorithm) to obtain a hybrid technique which can reach the global near optimal solution. The proposed math-heuristic algorithm generates a local optimal solution every last simulation period in order to get the global near optimal solution in an acceptable computing time. Previous works and researches that aimed to design various optimization and computational intelligence techniques in a SG environment is described in the related works part of each chapter.

Conclusion

This chapter presents some necessary background topics essential for the thesis. A literature review from conventional electrical grid to the SG is introduced. The different subsystems of the conventional electrical grid is described as well as the challenges that affect the entire energy sector and the facing new constraints that drive to the transition of a new network infrastructures. The SG concept is presented with their subsets such as bulk generation, power grid, customer / prosumer and the communication and security. Afterwards the main elements that allow the transition from the current power grid to the SG are described. Firstly with the DSM and DR, followed by the renewable energy resources, then the EVs and ESS, and to finish with the microgrid which is a local electrical network. Subsequently, several optimization and programming techniques are presented that permit the right operation and control of the considered systems in the SG. The next chapter presents an integration of the DER in the smart gird in an urban context where a MILP is proposed to optimize the energy production and consumption systems.

Optimal Residential Energy Management

Considering Distributed Energy Resources

Contents | Chapter 3

3.1. Introduction-----------------------------------------------------------------------------------------------55 3.2. Related Works--------------------------------------------------------------------------------------------56 3.3. Residential Energy Management Architecture---------------------------------------------------58 3.4. Problem Formulation for the Exact Solution Method------------------------------------------59 3.4.1. Objective Function-----------------------------------------------------------------------------62 3.4.2. Constraints--------------------------------------------------------------------------------------63 3.5. Design of Experiments----------------------------------------------------------------------------------67 3.5.1. Taguchi Method--------------------------------------------------------------------------------67 3.5.2. Factors Variation Study-----------------------------------------------------------------------68 3.6. Simulation Results---------------------------------------------------------------------------------------68 3.6.1. Input Data---------------------------------------------------------------------------------------69 3.6.2. Case Studies-------------------------------------------------------------------------------------71 3.7. Proposed Math-heuristic Algorithm----------------------------------------------------------------73 3.8. Experimental Results for Extended Time Horizon-----------------------------------------------75 3.9. Conclusion-------------------------------------------------------------------------------------------------78

Optimal Residential Energy Management

Considering Distributed Energy Resources

Introduction

Chapter 2 is devoted to the transaction from conventional electric grids to the SG. All the production and consumption systems considered in this thesis are presented in the literature review. Therefore, the current electricity grids are set to experience a profound change in the coming years; the new generation is the SG which is characterized by information and communication layer making different components of grid communicating. It needs to consider all sides of power grid, making it more intelligent and flexible. This notion is presented as an answer to changes in the electricity market, aiming to manage the increased demand while ensuring a better quality of service and more safety.

This chapter presents an integration of the DER in the smart gird in an urban context. The analysis takes into account the integration of renewable energy production, battery storage and gridable vehicles. Consequently, a MILP is proposed to optimize the energy production and consumption systems as well as the charging and discharging time of EV among a residential consumer. Besides, several case studies are presented by varying significant factors through design of experiments with Taguchi method. After that, a heuristic algorithm is proposed to solve the problem. Results find the global optimum solution for many consecutive days with important reduction of execution time.

The main contributions of this chapter are presented as follows:

 Developing a robust MILP model with production and consumption systems for an energy management in a residential consumer.

 Proposing an algorithm based on heuristic technique with significant reduction of execution time for consecutive days simulation, which is considered important in real-time application while sustaining the global optimum solution.

 Presenting experimental execution of the proposed system by varying significant factors through design of experiments with the Taguchi method, which reduces the number of tests indicating several advantages of the model while maintaining a high precision level.

The rest of this chapter is organized as follows. In part 2, a literature review of some developed EMS is presented. The architecture of the considered residential energy management is described in part 3. In part 4, the problem formulation is introduced as a MILP model. In part 5, the design of experiments with Taguchi method is presented. Simulation results with several case studies are done in part 6. In part 7, we proposed a heuristic algorithm for solving the problem. In part 8, we provide simulation results for extended time horizon and finally in part 9

we take some significant conclusions from this chapter.

Related Works

Following a literature review, numerous researchers have developed several optimization models to solve the energy management problem in SG specially related to residential customers.

A scheduling problem of building energy supplies is considered by [Guan et al., 2010], the testing results showed that can achieve a significant energy cost savings but only considering 24 h optimization period. [START_REF] Elham | [END_REF] proposed an automatic and optimal residential energy consumption scheduling technique as mixed integer nonlinear programming that aims to minimize the overall cost of electricity and natural gas in a building. The scheduling of electrical and thermal appliances has been reached but it didn't consider the wind system generation and V2G which play an essential role in smart home, because V2G can be used to store the energy and generate it back later when needed. To reduce the electricity bill and the emission of CO 2 , a load management system with integration of non-renewable and renewable energy sources was presented by [Ramchurn et al., 2011]. In [Sousa et al., 2012], they have considered an energy resource scheduling for SG considering the intensive use of distributed generation and gridable vehicles but with a time horizon of 48 h. In [START_REF][END_REF], a smart EMS is proposed to coordinate the power production of distributed generation sources and ESS for a microgrid where obtained forecasting model was able to predict hourly power generation, with the missing of integrating of EVs in the model which their charging and discharging process have an important impact and affect the results. An optimize energy management model was proposed by [Tazvinga et al., 2015], including diesel generators, PV system, and battery but intended for off-grid application. Two proposed applications are envisaged in [Roche et al., 2012], the first one is a unique gas turbine power plant system that can capable of handling a large penetration of intermittent generation. The second application proposed a DSM program targeted at residential customers with several load categories that includes PHEV charging rescheduling and DLC for AC and EWH units, but do not consider the V2G capability of PHEV. As well [Soares et al., 2013] was applied an evolution of traditional particle swarm optimization to the problem of energy resources management in SG to obtain a scheduling solution considering a 24 period interval. In [Amini et al., 2012], an evaluation of the effect of tariff-based programs on the behavior of PHEV owners is presented but without considering renewable energy resources as electricity production systems. In [START_REF] Amini | [END_REF], plug-in EVs owner behavior model is introduced to analyze the technical aspects their placement including reliability features of distribution network but without focusing on their economic optimization. An EV management system is presented by [Zakariazadeh et al., 2014], responsible for scheduling of EVs in smart distribution system without identifying in the other part what types of Distributed Generator (DG) used in this system.

In [Amini et al., 2015], a two stages MILP is implemented to minimize the residential electricity cost by shifting load demand but for just day-ahead scheduling simulation. [START_REF] Pedrasa | [END_REF] considered a particle swarm optimization to solve optimization problem where the determination of the value of coordination among DER was obtained but with a time horizon of 24 h. A DR algorithm for customers in SG is proposed in [START_REF] Kamyab | [END_REF] to maximize the utility company's profit and customer's payoff but excluding to consider consumers comfort level. A convex programming DR optimization framework for the automatic load management of various household appliances in a smart home is proposed by [Tsui et al., 2012], without handling multiple household scenarios. In [Keshtkar et al., 2015], a fuzzy logic approach using wireless sensors for residential load reduction is applied with focusing only on HVAC systems. A smart home EMS based on wireless network with Bluetooth low energy is proposed by [Collotta et al., 2015], where reducing of peak demand and increasing comfort level of consumers have been achieved without considering energy production management. In [Bozchalui et al., 2012], a novel mathematical model for major household demand is developed with many objective functions but with missing to introduce the wind turbine system. Moreover, there were few studies conducted using robust optimization methods to tackle an optimal energy management in the residential load for consecutive days.

Residential Energy Management Architecture

Taking into account sustainable development and the crisis of energy, renewable energy production becomes an important factor in the electricity generation system. In the proposed system, we suggest to integrate the residential PV system and micro-wind turbine as renewable energy system beside the conventional power plant due to the top combination between these two sources (Fig. 3.1).

Fig. 3.1 Energy production and consumption systems

The PV system and the micro-wind turbine system complement each other since the peak operating times of the PV is in the day while for the wind is at night and also in a different time of the year. Moreover, it must add battery as storage system due to the double process; if the total power output of the production is higher than the energy demand, batteries are able to charge then can feed power in the discharge phase. In the other side, it is recommended to focus primarily on residential consumers because they are the most significant sector of our electricity consumption. By managing this sector, we can achieve an important decrease in the overall energy consumption. In addition, we suggest an intensive penetration of the EV. The V2G can reduce the CO 2 emissions in the transportation sector; as well it charges during off-peak hours and provides power to the grid during peak hours that can be significant on the peak reduction.

Thus, the structure for residential consumer in our proposed system is divided in three main parts as shown in Table 3.1.

Problem Formulation for the Exact Solution Method

In this part, we present the mathematical model of the integrated DER of our studied system. The energy management problem is modeled as a MILP along the horizon T with t time steps. The time slot is considered one hour, thus each day will be 24 slots.

Objective Function

The objective function model of the adopted system is formulated as follow:

Constraints

The constraint is a mathematical expression that imposes a limit or restriction to the variables of the problem. All the constraints and conditions of the considered system are presented in the following equations.

Fig. 3.3 Generation and demand balance

The equation (3.2) guarantees the power balance between production and consumption systems in the power grid. The sum of the loads demand at the residential consumer must be equal to the sum of the power produced by the renewable energy systems, purchased electricity from the main grid and the discharging power from the EV and the battery storage system. This equality (Fig. 3.3) is guaranteed when t ∈ 𝑇 𝑠𝑡𝑎𝑦 (𝑇 𝑠𝑡𝑎𝑦 = period when EV stays at home). Otherwise the EV power must be eliminated from the equation because in this study, we considered that there is no charging process when the EV is away from home.

2. Conventional power system (Grid):

0 ≤ 𝑃 𝐺𝑟𝑖𝑑 𝑡 ≤ 𝑃 𝐺𝑟𝑖𝑑 𝑚𝑎𝑥 (𝑡) 3.3
The equation (3.3) designs the limit of the power imported from the main grid. Where 𝑃 𝐺𝑟𝑖𝑑 𝑡 must not exceed the amount of 𝑃 𝐺𝑟𝑖𝑑 𝑚𝑎𝑥 (𝑡).

3.

Photovoltaic system:

0 ≤ 𝑃 𝑃𝑉 (𝑡) ≤ 𝑃 𝑃𝑉 𝑚𝑎𝑥 (𝑡) 3.4 𝑃 𝑃𝑉 𝑡 ≤ 𝐴 𝑃𝑉 × 𝜌 × 𝑆𝐼(𝑡) 3.5
The limit of the produced power from the PV system is presented in equation (3.4), where 𝑃 𝑃𝑉 (𝑡) must be less than 𝑃 𝑃𝑉 𝑚𝑎𝑥 𝑡 the maximum allowed PV power in t. Equation (3.5) represents the model of the output power generated from the PV system in t.

4.

Wind system:

0 ≤ 𝑃 𝑊 (𝑡) ≤ 𝑃 𝑊 𝑚𝑎𝑥 (𝑡) 3.6 𝑃 𝑊 𝑡 = 0 𝑖𝑓 𝑣 𝑓 < 𝑣 𝑐𝑖 𝑎𝑛𝑑 𝑣 𝑓 > 𝑣 𝑐𝑜 𝑃 𝑊 𝑡 = 𝑃 𝑟𝑎𝑡𝑒𝑑 𝑖𝑓 𝑣 𝑟 ≤ 𝑣 𝑓 ≤ 𝑣 𝑐𝑜 𝑃 𝑊 𝑡 = 𝑃 𝑟𝑎𝑡𝑒𝑑 × 𝑣 𝑓 -𝑣 𝑐𝑖 𝑣 𝑟 -𝑣 𝑐𝑖 𝑖𝑓 𝑣 𝑐𝑖 ≤ 𝑣 𝑓 ≤ 𝑣 𝑟 3.7
The limit of the produced power from the wind system is described in equation (3.6), where 𝑃 𝑊 𝑚𝑎𝑥 𝑡 should not exceed the maximum allowed wind power 𝑃 𝑊 𝑚𝑎𝑥 𝑡 . While equation (3.7) presents the output power depending from the value of the forecasted wind speed (Fig. 3.4). The equations (3.8) & (3.9) design the limit of the allowed charging and discharging. The charging power of the battery at period t must be less than the specified 𝑃 𝐵 𝐶𝑚𝑎𝑥 and the discharging power should not exceed the specified 𝑃 𝐵 𝐷𝑚𝑎𝑥 . Equation (3.10) presents the sum of the variables 𝑌 𝑡 and 𝑍(𝑡) that aims to block the charging and discharging process at the same period. The electricity stored in the battery at period greater than 1 is expressed in equation (3.11). As well as, the electricity stored at the initial state of the battery is presented in equation (3.12). Also the state of charge of the battery is limited between a minimum value and 1 as expressed in equation (3.13). Lastly equation (3.14) described the limitation of the maximum amount of battery charging where it should not exceed the nominal capacity of the battery.

6. Electric vehicle:

The limit of allowed charging:

𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗 ≤ 𝑃 𝐸𝑉 𝐶𝑚𝑎𝑥 𝑗 × 𝑊 𝑡, 𝑗 ∀ 𝑡 ∈ 𝑇 𝑠𝑡𝑎𝑦 𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗 = 0 ∀ 𝑡 ∉ 𝑇 𝑠𝑡𝑎𝑦 3.15
The limit of allowed discharging and EV travel demand:

𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, 𝑗 ≤ 𝑃 𝐸𝑉 𝐷𝑚𝑎𝑥 𝑗 × 𝑋 𝑡, 𝑗 ∀ 𝑡 ∈ [1, … , 𝑇] 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, 𝑗 × 𝑑𝑡 = 𝐷 𝐸𝑉𝑑𝑟𝑖𝑣 𝑡, 𝑗 ∀ 𝑡 ∉ 𝑇 𝑠𝑡𝑎𝑦 3.16
Forbidden the charging and discharging simultaneously:

𝑊 𝑡, 𝑗 + 𝑋 𝑡, 𝑗 ≤ 1 3.17

Electricity stored in the EV battery at t > 1: The equations (3.22)-( 3.24) are intended to prevent the purchasing from the grid and the injection into the grid at the same period.

𝑁𝑜𝑚 𝐸𝑉 𝑗 × 𝑆𝑂𝐶 𝐸𝑉 𝑡, 𝑗 = 𝑁𝑜𝑚 𝐸𝑉 𝑗 × 𝑆𝑂𝐶 𝐸𝑉 𝑡 -

Design of Experiments

Taguchi Method

Within the theory of optimization, an experiment is a series of tests in which the input variables are changed according to a given rule in order to identify the reasons for the changes in the output response. The design of experiments or experimental design is the plan of any work that aims to illustrate the variation of factors under conditions that can reflect the variation. In this chapter, we used the Taguchi method to improve our table of case studies. The Taguchi method was developed by Genichi Taguchi in Japan to improve the implementation of off-line total quality control. This method is related to finding the best values of the controllable factors to make the problem less sensitive to the variations in uncontrollable factors [Cavazzuti, 2013]. It

Factors Variation Study

In this study, we considered three factors that affect the result of the objective function and the execution time of the test. The first factor is the residential energy consumption curve (F1), then the number of EVs (F2) and the solar irradiance (F3). Table 3.2 shows the number of levels of the factors. When factors have the same number of levels, the Taguchi table is noted as

LT (nC),
where n is the number of factor levels, C is the number of columns, and T is the number of lines. The model is given as follows:

𝑦 = 𝑙 + 𝐹 1 + 𝐹 2 + 𝐹 3 3.22
Where 𝑙 is the total average of the answers 𝑦. After the calculation of the degree model d M which is equal to the sum of (n i -1) of all factors, we calculate the lowest common multiple (LCM)

between the multiplication of factor levels of the pair of elements in the model (F 1 F 2 , F 1 F 3 , and

F 2 F 3 ).
To determine the number of lines T, two conditions must be satisfied 𝑇 = 𝑘 × 𝐿𝐶𝑀, 𝑘 ≥ 1 𝑎𝑛𝑑 𝑇 ≥ × 𝐷 𝑀 . In this model, 𝐷 𝑀 = 6 and 𝐿𝐶𝑀 = 9; to reduce the number of tests at the same time as maintaining a high precision level, we select k =1. Therefore, 𝑇 = 9 and the table of Taguchi corresponding to the model is L 9 (3 4 ) which is shown in Tables 3.5-3.7. According to this method, the number of tests was decreased from 81 to 27 tests with reduction of 66% of the execution time to obtain the best results.

Simulation Results

The studied residential system can meet its energy consumption (load or/and charging battery storage or/and charging EV battery) from the main power grid or/and the PV system or/and the wind system or /and the battery storage (discharge mode) or/and the EV battery (discharge mode if it's available). If there is a surplus power from all these systems, the excess energy can be sold to the grid (this study allow the buy/store/sell operation of the electrical power).

Input Data

The mainly input parameters of the studied system are given in Table 3. and 20 h. The maximum power grid generated in period t is selected of 5 kW. 𝐶 𝑃𝑉 𝑡 , 𝐶 𝑊 𝑡 , 𝐶 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡 and 𝐶 𝐵 𝐷𝑖𝑠𝑐 ℎ 𝑡 are set to 0.01 €/kWh as maintenance cost [START_REF] Zhang | Efficient energy consumption and operation management in a smart building with microgrid[END_REF]. The cost of the sold electricity is 0.29 €/kWh and the cost of power generated by the grid is defined in Table 3.4 [Zakariazadeh et al., 2015]. Wind speed (m/s)

Case Studies

The simulations of the implemented energy management model are performed in this part. The modeling is done by GNU Mathematical Programming Language (GMPL) and the solving is executed using GUROBI optimizer, running on a computer with Windows 7 Ultimate 64 bits operating system, processor Intel® Core™ i3-2350M 2.30 GHz and 4 GB of randomaccess memory RAM.

In the following case studies, we have considered different residential energy consumption {low, average, and high}, variant number of EV {0, 1, 2}, and different solar irradiance {low, average, and high}. Table 3.5 presents the simulation time horizon of 24 hours, the obtained results "y" or the minimized objective function f(cost) for each factors combination, furthermore the computing time of each test. This scenario shows that the increasing of EV into electrical grid has positive effects if there is an appropriate energy management with satisfying some constraints according the case study. We can analyze that in the periods when EVs is parked at home with a SOC approximately high and their discharging electricity price is lower than the electricity price bought from the grid, the EVs discharge their energy by benefiting from the electrical energy previously stored as indicated in the periods {6, 21, 22 and 24}. Therefore, we can deduce that all the demand of the residential consumer, including home appliances load, battery storage charge and EVs charge is covered with an optimized energy management between the production sources due the implemented MILP model by taking into account different mathematical constraints.

Proposed Math-heuristic Algorithm

Optimization in the electrical SG environment is a complex operation due to the fluctuation in energy demand and the uncertainty in the power production, particularly due to large penetration of renewable energy systems like solar and wind. The majority of the existing configuration approaches have first and foremost focused on the question of solving optimally the energy management problems in SGs. The math-heuristic algorithm is an algorithmic model that creates the locally optimal solution at each stage by following the problem solving heuristic, in order to find the global optimal solution of the considered problem in an acceptable and short execution time. Consequently when the classical methods are too slow or fail to find any accurate solution, heuristic methods can solve the problem more quickly and find an approximate result.

The proposed math-heuristic method aims to obtain with a short execution time, an optimized scheduling of energy production and consumption systems for residential consumer with an effective deployment of renewable energy sources such as PV and wind systems with battery storage and considering the penetration of V2G. Fig. 3.9 illustrates the schematic diagram of the proposed method which the center module is the home EMS which includes all the system constraints such as power grid balance, generation limits, charging and discharging limits and the state of charge limits. The input data is presented in the left such as load demand, generation information, EV requirements, number of vehicles presented, production cost and selling cost. As well, the output results of the optimized energy management are located at the bottom. The proposed algorithm has been implemented using Python programming language. In this study and for the cases that we simulate consecutive days, the problem is decomposed thru simulation time horizon.

Following steps are accomplished based on the following framework:

Step 1: Determination of the simulation time horizon.

Step 2: Daily load forecast.

Step 3: Determination of the number of EV's.

Step 4: Solar irradiation forecast.

Step 5: Receiving the generation and selling cost.

Step 6: Generating outputs for the first day.

Step 7: Scheduling of energy production systems.

Step 8: Scheduling of charging/discharging of EV and battery.

Step 9: Adding continuous variables as model inputs for the following day.

Step 10: Generation of the approximately global optimal solution of the system. Fig. 3.9 Math-heuristic technique design for consecutive days

Experimental Results for Extended Time Horizon

In this part, we have also executed many scenarios according to factors combination of Taguchi method, with considering different residential energy consumption {low, average, and high}, variant number of EV {0, 1, 2}, and different solar irradiance {low, average, and high}.

Tables 3.6-3.7 present simulation results for extended time horizon of 96 and 168 hours, respectively. The MILP and the proposed math-heuristic algorithm results are presented in addition to their computing time. As well, the results for 96 and 168 hours time horizon show that the best solution is obtained for the combination between the low level of 𝐹 1 , high level of 𝐹 2 and high level of 𝐹 3 . In the table 3.5

for the test nº 3, the gap between the optimal solution (MILP, -59.365) and the approximately solution (Heuristic, -58.875) is 0.8 %, and the computing time is decreased from 167.08 sec to 0.19 sec. In the table 3.6 for the test nº 3, the gap between the optimal solution (MILP, -100.503)

and the approximately solution (Heuristic, -99.577) is 0.9 %, and the computing time is decreased from 8 min and 9 sec to 0.19 sec. The negative value of y means that the consumer gains from the power sold to the grid after covering its energy consumption. Then, when the classic methods are too slow or fail in some cases to find the accurate solution, the implemented heuristic method solves the problem more quickly and finds an acceptable approximate result. hours time horizon respectively. All the production and consumption systems are scheduled in a manner to satisfy all the constraints of the grid balance, conventional power system, renewable energy productions, battery storage and electrical vehicles.

Conclusion

In this chapter we have studied a residential energy management problem in SG environment with integration of renewable energy resources, electrical battery storage and gridable vehicles that can provide power to the grid by discharging the battery. We have focused primarily on the residential consumers because they are the most significant sector of our electricity consumption. By managing this sector, we can achieve an important decrease in the overall energy demand. We have suggested integrating the residential PV system and micro-wind turbine beside the conventional power plant due to the top combination between these two sources.

We have proposed two methods of resolution. We have first proposed a robust MILP model to optimize the energy production and consumption systems as exact solution methods. Then, we have developed an algorithm based on math-heuristic technique to reduce the computing time and to minimize the electricity cost of the consumer. Three case studies based on 24, 96 and 168 hours time horizon are presented, by varying significant factors through design of experiments with Taguchi method while satisfying all constraints according to the case studies. All the demand of the residential consumer, including home appliances load, battery storage charge and EVs charge is covered with an optimized energy management between the production sources.

Results show the global optimum solution for many consecutive days with important reduction of execution time and by achieving a significant energy cost savings of the considered scenarios.

The next chapter aims to propose an optimized energy management model with considering different type of thermal and electrical appliances in a smart home.

Electrical and Thermal Load

Management in Smart Home Architecture 4 Electrical and Thermal Load Management in

Smart Home Architecture `

Introduction

The continually growing of energy demand and the emission of greenhouse gas became an issue of important concern in the world. In addition, flat rate of the electricity cost does not motivate the consumer to schedule and manage its energy consumption. The residential EMS is an essential factor in the SG environment, which allows the implementation of DR program among the residential consumers to manage their power usage. After the improvement in the residential area connection, the resident has the possibility to schedule his production and consumption systems by himself aiming to reduce the global electricity cost during the next day.

In this chapter, an energy management model is proposed by considering both generation and consumption parts. Mathematical models for the grid, renewable energy resources, batteries, and EVs are presented, as well as for different type of thermal and electrical appliances such as AC, water heater, vacuum cleaner, and others. We have implemented an exact solution method to solve the objective constrained problem that aims to minimize the electricity cost in a smart home and find out operation modes of different loads with organizing between the considered production systems. Furthermore, a math-heuristic optimization algorithm is proposed to solve the problem with extended simulation time horizon.

The original contributions of this chapter are listed as follows:

 Implementing an exact solution method to minimize the electricity cost in a smart home by scheduling and controlling production systems and both thermal and electrical loads with taking into consideration of some desired appliances temperature predefined by consumers.

 Proposing a math-heuristic optimization algorithm based on MILP formulation, which considers diverse constraints, to solve the problem with an extended simulation time horizon.

 Performing of various simulations with different scenarios to indicate the significant reduction of the electricity cost and to prove the effectiveness of the implementation of the proposed optimization algorithm.

The organization of the remainder of this chapter is organized as follows. In part 2, the related works for the smart home energy management is presented. In part 3, the modeling approach of the studied smart home is described. The problem formulation with all the constraints related to each considered system is developed in part 4. In part 5, experimental and computational results are discussed. Part 6 discusses the proposed math-heuristic optimization algorithm based on MILP formulation that solves the problem with an extended simulation time horizon. In part 7, simulation results for one single day and for consecutive day are presented.

Evaluation of the performance of the proposed optimization algorithm is presented in part 8 and finally conclusion is given in part 9.

Related Works

Several studies have conducted optimization techniques to solve the smart home energy management problem. An employment of load aggregation in electrical power system for residential users is proposed by [START_REF] Saleh | [END_REF], throughout normal and abnormal conditions.

In [Zakariazadeh et al., 2014], a stochastic multiobjective model for environmental and economical operational scheduling is proposed to manage energy and reserve in a smart distribution system. A time-of-use-based bottom-up model is presented by [Bizzozero et al., 2016], for residential demand with considering the existence of many individuals in the residence, their performance and the associated utilize of electrical appliances. An electricity demand control algorithm is implemented in [Gelazanskas et al., 2014], using real time pricing with flexibility to allow the consumers to control the load according to their need. In [Qian et al., 2013], a RTP scheme is proposed to reduce the peak load by DR program in electrical SG, and on the retailer side an algorithm based on simulated annealing is implemented to reduce the electricity cost of the costumers and to maximize the utility profit. In [Zhao et al., 2013], a general architecture of EMS in a home area network is introduced, and with real-time electricity price and consumers preferences, a power scheduling in the home is presented by using GA to solve optimization problem. A high resolution model for home energy demand is developed by [START_REF] Richardson | Domestic electricity use: A high-resolution energy demand model[END_REF], that is based upon an arrangement of different active occupancy and daily activity profiles that show how customer pass its time in performing several activities. A novel residential energy management algorithm is proposed in [Xu et al., 2015], based on heuristic dynamic programming.

In [START_REF] Castillo-Cagigal | [END_REF], an electrical DSM system in a realistic solar house is described to improve the efficiency of the electrical grid and to execute a new regulation level in the local electric behavior. A residential EMS is proposed in [START_REF] Anvari-Moghddam | [END_REF], to improve the energy efficiency of consumption in a distinctive smart micro-grid with taking into account the reducing of electricity cost as well as user comfort preferences. A MILP model is developed by [Zhang et al., 2016], to control the energy consumption in smart home using a microgrid system where the objectives intend to reduce the CO2 emissions and the total energy cost. In [START_REF] Bracco | [END_REF], an EMS is proposed to optimize the operation in a Smart Polygeneration Microgrid in order to minimize the overall production cost. An efficient algorithm has been implemented and presented to perform the optimal dispatching of low voltage microgrids. An optimization algorithm is proposed by [Bendato et al., 2017] that divides the studied problem into two sub problems. First it dictates the active power production of the dispatchable units to minimize the economic objective function, and then it accounts for the satisfaction of the Distribution System Operator requirements. Some of these studies did not consider several renewable energy resources with sometimes missing the management of energy production.

Others did not integrate Evs with V2G capability that has a significant function in smart homes.

Then, the implementation of an optimization algorithm for many consecutive days and not only for just a day-ahead simulation is missed in the most of literature review. And limited studies have been presented an EMS for smart home with scheduling and controlling different type of thermal and electrical appliances together.

Modeling Approach of Smart Home

With the large employment of electrical smart appliances beside the integration of communication and information technology, the home becomes more and more smart.

Mathematical Modeling

The residential 88cheduleing problem in the smart home is presented as a MILP model along the horizon T with t time steps. The time slot is proposed to be one hour, therefore each day will be 24 slots. The associated constraints are presented in the following equations.

Objective Function

The objective function of the system is formulated as follows and it intends to minimize the day-ahead electricity bill of the residential consumer: Almost all consumers care about their electricity bills and tend to reduce them. The total cost covers operation and maintenance cost of the PV system, wind system, battery storage system and EV battery; along with purchased electricity from the grid with adding the revenue from selling electricity back to the grid. During the time horizon T, the optimized minimum cost for the smart home is calculated while satisfying all the considered constraint presented in the next part.

Constraints

All the considered constraints for the system are presented in the following equations.

Electrical controllable loads:

The operation time of the electrical appliances:

𝑉 𝑖, 𝑡 = 0 𝑡 𝑖𝑓 𝑡 < 𝑇 𝑠𝑡𝑎𝑟𝑡 (𝑖) 𝑎𝑛𝑑 𝑡 > 𝑇 𝑓𝑖𝑛𝑖𝑠 ℎ (𝑖) 𝑉 𝑖, 𝑡 = 𝑇 𝑡𝑟𝑒𝑎𝑡 𝑖 𝑡 𝑖𝑓 𝑡 ≥ 𝑇 𝑠𝑡𝑎𝑟𝑡 𝑖 𝑎𝑛𝑑 𝑡 ≤ 𝑇 𝑓𝑖𝑛𝑖𝑠 ℎ 𝑖 4.2
The equation (4.2) guarantees that the electrical appliances can operate only within their preferred time windows between earliest starting time and latest finishing time (𝑇 𝑠𝑡𝑎𝑟𝑡 𝑖 and 𝑇 𝑓𝑖𝑛𝑖𝑠 ℎ 𝑖 ).

These appliances can be rescheduled according to the price variations and the customer preferences where it is necessary to set operation time interval.

Thermal controllable load:

The operation model of the AC in cooling mode:

𝑇 𝑖𝑛𝑠 𝑡 = 𝜖 × 𝑇 𝑖𝑛𝑠 𝑡 -1 + 1 -𝜖 × 𝑇 𝑜𝑢𝑡 𝑡 - 𝜇 × 𝐵 𝑎𝑐 𝑐 𝑡 × 𝑃 𝑎𝑐 𝐴 4.3
The operation model of the AC in heating mode:

𝑇 𝑖𝑛𝑠 𝑡 = 𝜖 × 𝑇 𝑖𝑛𝑠 𝑡 -1 + 1 -𝜖 × 𝑇 𝑜𝑢𝑡 𝑡 + 𝜇 × 𝐵 𝑎𝑐 ℎ 𝑡 × 𝑃 𝑎𝑐 𝐴 4.4
Forbidden the activation and deactivation simultaneously:

𝐵 𝑎𝑐 𝑐 𝑡 + 𝐵 𝑎𝑐 ℎ 𝑡 ≤ 1 4.5
Limitation of the inside temperature between desired bound:

𝑇 𝑖𝑛𝑠 min _𝑑𝑒𝑠 𝑡 ≤ 𝑇 𝑖𝑛𝑠 𝑡 ≤ 𝑇 𝑖𝑛𝑠 max _𝑑𝑒𝑠 𝑡 4.6
State to activate the AC in cooling mode:

𝐵 𝑎𝑐 𝑐 𝑡 = 0 𝑖𝑓 𝑇 𝑖𝑛𝑠 0 < 𝑇 𝑖𝑛𝑠 min _𝑑𝑒𝑠 1 1 𝑖𝑓 𝑇 𝑖𝑛𝑠 0 > 𝑇 𝑖𝑛𝑠 max _𝑑𝑒𝑠 1 4.7
State to activate the AC in heating mode:

𝐵 𝑎𝑐 ℎ 𝑡 = 1 𝑖𝑓 𝑇 𝑖𝑛𝑠 0 < 𝑇 𝑖𝑛𝑠 min _𝑑𝑒𝑠 1 0 𝑖𝑓 𝑇 𝑖𝑛𝑠 0 > 𝑇 𝑖𝑛𝑠 max _𝑑𝑒𝑠 1 4.8
Time window that AC can operate in cooling mode:

𝐵 𝑎𝑐 𝑐 𝑡 = 0 𝑜𝑟 1 𝑖𝑓 𝑡 ∈ 𝑇 𝐶 0 𝑖𝑓 𝑡 ∉ 𝑇 𝐶 4.9
Time window that AC can operate in heating mode:

𝐵 𝑎𝑐 ℎ 𝑡 = 0 𝑜𝑟 1 𝑖𝑓 𝑡 ∈ 𝑇 𝐻 0 𝑖𝑓 𝑡 ∉ 𝑇 𝐻 4.10
The variation of the indoor temperature for the AC is determined in equations (4.3) and (4.4). The equation (4.5) guarantees that the AC do not operates in cooling and heating mode at the same time. The indoor temperature must be limited between the desired lower and upper temperatures set by the customer in (4.6). In (4.7) and (4.8), the AC will turn on at t = 0 if the indoor temperature is less or more than the predefined lower or upper limit. The equation (4.9) and (4.10)

determine the time window when the AC can run in cooling and heating mode where the customer indicate the 𝑇 𝐶 and 𝑇 𝐻 settings.

The operation model of the refrigerator:

𝑇 𝑟𝑒𝑓 𝑡 = 𝑇 𝑟𝑒𝑓 𝑡 -1 + 𝑑𝑡 𝛽 𝑟𝑒𝑓 ×
𝐵 𝑟𝑒𝑓 (𝑡) = 1 𝑖𝑓 𝑇 𝑟𝑒𝑓 0 > 𝑇 𝑟𝑒𝑓 max _𝑑𝑒𝑠 1 0 𝑖𝑓 𝑇 𝑟𝑒𝑓 0 < 𝑇 𝑟𝑒𝑓 min _𝑑𝑒𝑠 1 4.13
The equation (4.11) determines the operation model of the refrigerator where (4.12) maintains the inside temperature within a specified range according to the customer preference. In (4.13), the refrigerator will turn on at t = 0 if the indoor temperature is more than the predefined upper limit.

The operation model of the EWH:

𝐶 𝑒𝑤 ℎ × 𝑇 𝑒𝑤 ℎ 𝑡 -𝑇 𝑒𝑤 ℎ 𝑡-1 𝑑𝑡 = -1 𝑅 𝑒𝑤 ℎ × 𝑇 𝑒𝑤 ℎ 𝑡 -𝑇 𝑖𝑛𝑠 𝑡 + 𝐵 𝑒𝑤 ℎ (𝑡) × 𝑃 𝑒𝑤 ℎ -𝑐 𝑝 × 𝑞 × 𝑇 𝑒𝑤 ℎ max _𝑑𝑒𝑠 𝑡 -𝑇 𝑒𝑤 ℎ cold 4.14
Limitation of the water temperature between desired bound:

𝑇 𝑒𝑤 ℎ min _𝑑𝑒𝑠 𝑡 ≤ 𝑇 𝑒𝑤 ℎ 𝑡 ≤ 𝑇 𝑒𝑤 ℎ max _𝑑𝑒𝑠 𝑡 4.15
State to activate the EWH:

𝐵 𝑒𝑤 ℎ (𝑡) = 0 𝑖𝑓 𝑇 𝑒𝑤 ℎ 0 > 𝑇 𝑒𝑤 ℎ max _𝑑𝑒𝑠 1 1 𝑖𝑓 𝑇 𝑒𝑤 ℎ 0 < 𝑇 𝑒𝑤 ℎ min _𝑑𝑒𝑠 1 4.16
The modeling of the EWH is presented in equation ( 4.14) where we can determine the water temperature. Equation (4.15) maintains the inside temperature of the EWH within the predefined range. In (4.16), the EWH will turn on at t = 0 if the water temperature is less than the specified lower limit.

Gird power balance:

The power grid balance between consumption and production: Every time interval t, the balance between consumption and production systems should be guarantee in equation (4.17). The electricity demand is the sum of all the power consumption of the ECL and the TCL plus the charging power of the EV batteries and battery storage system.

𝑃
This demand is supplied from the purchased electricity from the grid, PV and wind generators, discharging power from EV batteries and battery storage system, minus the electricity sold to the grid.

𝑀 𝑡 + 𝑋 𝑡, 𝑗 ≤ 1 4.18

𝑀 𝑡 + 𝑍 𝑡 ≤ 1 4.19
The equations (4.18) and (4.19) do not allow the discharging of the battery storage system or the EV battery into the grid.

The equations (3.3) to (3.24) already mentioned in the chapter 3 are considered in this model.

These equations present the constraints for the conventional power system (the Grid), PV system, wind system, battery and EV.

Experimental and Computational Results

Input Data

The simulations of the implemented smart home energy management model are performed in this section. The modeling is done by GNU Mathematical Programming Language (GMPL) and the solving is executed using GUROBI optimizer, running on a computer with Windows 7 Ultimate 64 bits operating system, processor Intel Core i3-2350M 2.30 GHz and 4

GB of random-access memory RAM. The mainly simulation parameters in the system are given in Table 3.3 in chapter 3.The electricity cost sold to the grid is 0.10 €/kWh and the purchased electricity cost is adopted from [Zakariazadeh et al., 2015]. The preferred user temperature is adopted as following : from 3 to 8 C for the refrigerator , from 55 to 60 C for the EWH and from 20 to 23 C for the indoor room temperature. And all parameters related to the ECL and TCL are shown in Table 4.1, such as earliest starting time, latest finishing time, power consumption and duration of the operation which are used in real case studies.

Case Studies

Different scenarios are performed to indicate the significant reduction of the electricity cost and to prove the efficiency and the robustness of the proposed home energy management model. Initially, we have conducted five case studies given in Table 4.2 with a simulation time horizon T of 24 hours.

Case study 1: it is the basic scenario and it consists of one residential costumer that can purchase the electricity just from the grid.

Case study 2: case study 1 in addition to the DR program by shifting some ECL to the periods with low price.

Case study 3: case study 1 plus the integration of the PV system, wind turbine system, battery storage system and Evs.

Case study 4: case study 3 plus the consideration of the DR program by shifting some ECL to the periods with low price.

Case study 5: case study 4 in addition to the DR program with TCL that can maintain some predefined temperature at the desired range.

 x x x x x 2  x  x x x 3   x x   4    x   5      

Results

The results of the exact solution method that aims to minimize the electricity cost in a smart home and find out operation modes of different loads with organizing between the considered production systems are given in Table 4.3 and exposed in Fig. 4.2-4.6. We can notice that the cost is reduced between case study 1 and 2, from 1008.56 to 642.03 € cents, due to the integration of the DR program by means of ECL where the appliances are scheduled within their preferred time windows between earliest starting time and latest finishing time according to the price variations to obtain the minimum cost. In case study 3, with considering solar and wind system, battery storage system and V2G, the expenditure again is reduced to 34.45 € cents, and the customer profit from the surplus power by injection into the grid 18.57 kW. In case study 4, when also the ECL is considered, the cost is decreased to -39.42 € cents and the power injected into the grid is 26.66 kW. Finally, in case study 5, where the TCL is considered, an important decrease of the cost is achieved and it reached -106.89 € cents. Moreover, the minimum purchased power from the grid is obtained about 36.28 kW as well as the maximum sold power of 29.52 kW. We noticed in all the studied cases that the computing time is short but it increase in the last scenario where the controlling and scheduling of all systems is included. As well as, the scheduling of the charging and discharging mode over 24 periods of the two Evs integrated in the system is given in Fig. 4.9, where they have positive effects in considered smart home. In this case, the charging of the Evs battery is happened in the early morning periods from 2 to 5. In the periods 7, 21, 22 and 23 the Evs have been used as generators for the energy resource scheduling where the discharge peak power is happened in periods 23.

Proposed Math-heuristic Algorithm

A LP technique is formulated to minimize or maximize an objective function that is formulated to analyze the performance of the solution. It is an exact technique, once solved, it guarantee that the result is the optimal solution. Numerous methods based on meta-heuristic techniques can be used but don't guarantee the optimal solution.

Due to the uncertainty of the power production mainly the large integration of RER and due to the variation of energy demand, a complexity in the optimization process of electrical SG is presented. To reach the global optimal solution, we have used two techniques, the MILP and the greedy method to obtain a hybrid technique, the math-heuristic algorithm, which can solve the optimization problem of extended optimization time horizon in the electric SG environment. The proposed math-heuristic algorithm generates a local optimal solution every last simulation period in order to get the global optimal solution in an acceptable computing time. The flowchart of the proposed algorithm to solve the energy management in a smart home is given in Fig. 4.10. The general steps intended to solve the objective constrained problem that aims to minimize the electricity cost in a smart home and find out operation modes of different loads with organizing between the considered productions systems are described as follows:

Step 1: Define of the input data such as simulation time horizon T.

Step 2: Select the number of home appliances I and their scheduling parameters.

Step 3: Select the number of Evs.

Step 4: Get the solar irradiation and wind speed forecasting.

Step 5: Obtain the electricity price imported from the grid and sold to the utility.

Step 6: Generate the input data for the first simulation day.

Step 7: Generate the optimal solution of the objective function for the first day.

Step 8: Manage the different production systems like the grid, solar system and wind system.

Step 9: Schedule the ECL following their earliest starting time, latest finishing time and the duration of the operation.

Step 10: Control the TCL following the desired appliances temperature predefined by the consumer.

Step 11: Schedule the charging and discharging of battery and Evs.

Step 12: Transmit many variables as continuous inputs data to the next simulation day like state of charge of the battery storage system, state of charge of Evs battery, inside room temperature, EWH water temperature and refrigerator temperature.

Step 13: Generate the global optimal solution of the considered problem for the defined simulation time horizon.

The proposed math-heuristic algorithm which solves the optimization problem of extended optimization time horizon is implemented with the Python programming language.

Step1 Select simulation time horizon T

Is time horizon

= one day?

Step 2 Select number of home appliances I

Step 3 Select number of electric vehicles N

Step 5 Get the electricity prices

Step 4 Get the renewable energy forecasting data

Step 6 Generate all input data for the first day

Step 8 Schedule of the production systems

Step 9 Schedule of the electrical controllable loads

Step 10 Control of thermal controllable loads

Step 11 Schedule the charging and discharging of battery storage system and EVs

Generate the optimal solution

Feasible?

Solve MILP formulation

Regeneration

Step 7 Generate the objective function f (cost)

Simulate next time horizon

Is time horizon = T ?

Step

Simulation Results for Consecutive Day

A simulation time horizon for consecutive day is performed where we have executed the same energy management model of the scenario 5 when all the systems are considered for 24,48,72,96,120,144 and 168 hours respectively. The MILP or the exact solution and the mathheuristic optimization algorithm, are compared in the Table 4.4 for minimizing the electricity cost and the computing time. We observe that only in the simulation time horizon of 24 and 48 hours, we have obtained the optimal solution with the MILP and a suitable computing time of 16.23 and 49.39 seconds respectively. While in the other scenarios a near optimal solution is found where the simulation is stopped to 600 seconds. Conversely, when we have applied the math-heuristic algorithm, the solution of the problematic formulation is obtained and most of results in the different applied time horizon are close to the solution obtained with MILP. The computing time is extremely reduced in all scenarios and especially in the 72 hours simulation time where the reduction reaches 94 % from 600 sec to 35.18 sec. The minimum gap is obtained in the 48 hours time horizon with -4.60 % where the optimal solution value with the MILP is -99.93 € cents while the solution of the math-heuristic algorithm is -95.33 € cents. The negative value of the objective function indicates that the costumer benefits from the excess energy by selling to the utility. Fig. 4.11 shows the energy management of all considered resources for the 48 hours time horizon where all the production and consumption system are scheduled with satisfying all the implemented constraints. As a result, we can deduce that when the exact method is unsuccessful to get the optimal solution, the proposed math-heuristic algorithm can solve it with a minimum executing time and with a reasonable tolerance.

Simulation with different Cost Curve

To check the performance and the robustness of the proposed math-heuristic algorithm, we have tested it and evaluated it following different curves of purchased cost as given in Fig. 4.12. We have chosen randomly five curves; each of them is simulated with all time horizons: 48, 72, 96, 120, 144 and 168 h where results are presented in Table 4.5.

- solution got with simulation of consecutive days in all case studies is near to the optimal solution obtained with the exact method. Furthermore the computing time is decreased strongly and this reduction is significant in real-time application.

Conclusion

A novel EMS for smart home is proposed in this chapter with the consideration of both generation and consumption systems. This model is capable to schedule the renewable energy resources with the grid in the production part, and then control and manage the operation of all considered electrical and thermal appliances, battery and EVs. Moreover, to reduce the electricity cost of the consumer in a smart home for consecutive day, a robust optimization algorithm is implemented to solve this problem for extended simulation time horizon. A comparison between the MILP model and the math-heuristic optimization algorithm is made to demonstrate the effectiveness of the proposed model. Simulation results illustrate that the best solution is obtained in case study 5, where the TCL is considered that can adjust the temperature of the refrigerator, EWH and the room in order to minimize the energy consumption with maintaining a minimum comfort level of the costumer. Furthermore, the results show that the proposed optimization algorithm can obtain a near optimal solution with strongly decreases for the computing time. The next chapter tends to evolve the implemented model by considering several smart homes to adapt a microgrid EMS.

Optimal Operation and Energy Management

Model in Microgrid

Introduction

The world population has increased significantly over the last 20 years. According to the US energy information administration (EIA), the total world energy consumption will increase 28% between 2015 and 2040. Therefore, to cover the future energy demand, an investment in new power plants such as renewable sources must take place. The power grid undergo a main revolutionize by adding of microgrids. The advantages of using microgrids consist of increasing reliability, generating revenue, reducing carbon emissions and encouraging economic growth.

Furthermore, smart home appliances, energy efficiency and load management were used to undertake the raise of electricity consumption. In Microgrid, the ESS is a fundamental part to remove the fluctuating output yield of sustainable power source generators. Though, introducing huge number of ESSs for individual smart homes might not be basically implementable, because the high investment expenditure and the limitation of the space.

In this chapter, we consider a smart microgrid which comprises multiple smart homes each of them owned: renewable energy resources (one PV system and one micro-wind turbine), one EV and smart appliances. The renewable energy resources inject the excess energy in the shared ESS. Each smart home is interested to utilize the shared ESS to increase its return. The energy exchange between the smart homes in the considered microgrid is controlled by a RMGO. To ensure that the implemented energy management model using MILP is efficient in reducing the total electricity cost in the microgrid, we have compared it with a conventional scenario where each smart home has its individual small ESS without sharing energy with their neighbors. To perform a reasonable comparison, we ensure that the capacity of the shared ESS is equal to the sum of the capacity of all individual ESS. We have performed different scenarios by varying the number of smart homes in the microgrid, the purchasing electricity cost from the gird and the initial capacity of the ESS. We have conducted that the introducing of the shared ESS can highly decrease the total electricity bill versus smart homes with individual storage without energy sharing.

This chapter has the listed of three contributions:

 Designing a general microgrid energy management model, including shared ESS.

 Implementing an exact solution method using MILP to minimize the global electricity bill in the microgrid with implementation of DR program.

 Leading a novel methodology to evaluate the benefits of integrating a shared ESS in a microgrid in terms of decreasing cost.

The organization of the rest of this chapter is structured as follows. Part 2 presents the related researches for the optimization and energy management in the microgrid. Part 3 describes the considered microgrid system model. In part 4, the proposed energy management model with all the related constraints using MILP is developed. In part 5, simulation results for a microgrid with 3 smart homes are presented. Part 6 presents the analysis and results of different case studies to prove and check the performance and the efficiency of the proposed algorithm. And finally part 7 concludes the chapter.

Related Works

The microgrid can be distinct as multiple smart homes were including smart appliances as loads, local renewable resources such as small PV systems and/or micro-wind turbines and individual or shared ESS running as a single controllable system. Numerous researches have carry out of optimization and energy management in microgrids to optimize the global expenditure of electricity. These works utilize different methods to reach their objectives. For example, in [Chen et al., 2012] a proposed DR task categorization and two optimization methods were applied to load aggregators, which would represent a set of residential houses within a community. Study [Liu et al., 2017] proposed a chance-constrained optimization problem for the optimal scheduling in mirogrids and solved by MILP to minimize the total operating cost. In [START_REF] Li | [END_REF], a combined sizing and energy management methodology is proposed and formulated as a leaderfollower problem. A parametric programming based approach for energy management in microgrid is presented in [Umeozor et al., 2016], where the operational planning problem is solved which including energy sources such solar PV, wind turbine and battery ESS, in addition to a household load demand. In [Maulik et al., 2017], an economic dispatch problem of a microgrid is presented and solved with four diverse optimization techniques to minimize the fuel cost of the considered distributed generation presented in the model. To attain multi-agent resource allocation in a distributed system in a microgrid, an algorithm with the least amount of information exchange between the customers is proposed in [Dimitrov et al., 2016]. An optimization mathematical model is presented in [START_REF] Lazaroiu | [END_REF], for microgrid gridconnected and in islanding operations in order to minimize the global microgrid expenditure to cover the load demand. In [START_REF] Silvente | [END_REF], a mixed-integer linear programming mathematical model is proposed to minimize the operational cost of the microgrid and to adjust the energy and heat availability profiles resulting from the employ of renewable energy resources and heat demands and flexible energy. The [Tenfen et al., 2015] has proposed a mathematical model used for the energy management problem in a microgrid by means of a MILP approach.

The purpose is to determine a generation and a controllable load demand strategy that minimizes the operation cost subject technical constraints. A cost minimization problem is presented in [Wang et al., 2015], to schedule the energy generation intelligently in a microgird integrated with combined heat and power generators and unstable renewable energy resources. In [Choi et al., 2018], a control structure and three types of the power sharing methods intended for a multiple battery energy storages system is considered. As well, an algorithm for energy sharing is proposed to share out the output power evenly according to the available energy of each battery.

An energy storage sharing strategy is presented in [START_REF][END_REF] that allow the distribution company and the clients to manage the allocated energy storage. The problem is formulated as a bi-level mathematical model where the first level try to find the optimal distribution of energy storage and the second level seeks to minimize the electricity purchase costs. The most of these researches, don't consider an optimized energy management model for a shared ESS in a microgrid with a set of smart homes having renewable energy resources and EVs with controlling and scheduling diverse type of electrical and thermal household appliances and taking into account of some desired appliances temperature to maintain a minimum comfort level of customers.

Microgrid Model

In each SH has a rooftop PV system and micro-wind turbine plus one electrical vehicle that are capable to collect energy from. In addition, it is connected to the main grid and to a shared ESS (battery). In general, all smart homes in the microgrid can received the power from any sources.

The energy exchange between the smart homes is controlled by a RMGO. The RMGO controls the microgrid, manages smart homes consumption, and distributes the shared energy storage. SH are connected to the main grid to make safe their energy consumption throughout period when renewable energy production is unavailable, when the ESS is empty or when the energy existing in the ESS is not scheduled. Furthermore, we apply a set of time slot T as an optimization time interval, indexed by t, t ∈ T ∈ {1, 2, ..., T}, with T = 24 indicating the optimization time horizon

Mathematical Modeling

The energy management problem in the microgrid is modeled as MILP in order to minimize the day-ahead energy cost of all consumers by scheduling the smart home appliances power consumption and the energy drawn from the shared ESS. The objective function and all the constraints related to the implemented systems are presented as following.

Objective Function

The objective function intends to minimize the global electricity cost of the set of smart homes including in the microgrid. It is formulated as:

min 𝑓 𝑐𝑜𝑠𝑡 = 𝑃 𝐺𝑟𝑖𝑑 𝑡, ℎ × 𝑑𝑡 × 𝐶 𝐺𝑟𝑖𝑑 𝑡 + 𝑃 𝑃𝑉 𝑡, ℎ × 𝑑𝑡 × 𝐶 𝑃𝑉 + 𝑃 𝑊 𝑡, ℎ × 𝑑𝑡 × 𝐶 𝑊 + 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ × 𝑑𝑡 × 𝐶 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ + 𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 𝑡 × 𝑑𝑡 × 𝐶 𝐸𝑆𝑆 𝐷𝑖𝑠𝑐 ℎ - (5.1) 𝑇 𝑡=1 𝐻 ℎ=1
It is to highlight that the minimization of the objective function means that the consumers in the microgrid profit from the local installed renewable energy sources as well as from the power presented in the shared ESS.

Constraints

All the constraints of the systems in the proposed mathematical model that impose restrictions to the variables of the problem are presented below. The power balance must be guaranteed in each smart home in the microgrid between production and loads. Every time interval t, the home balance must be guaranteed in equation ( 5.2). The home electricity load is the sum of all the power consumption of the ECL and the TCL plus the charging power of the EV battery and ESS. The home loads are covered from the purchased electricity from the grid, PV and wind generation, discharging power from EV battery and the ESS.

2. Energy storage system balance:

𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 𝑡 -𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 𝑡 = 𝑃 𝐸𝑆𝑆 𝐶ℎ 𝑡, ℎ -𝑃 𝐸𝑆𝑆 𝐷𝑖𝑠ℎ 𝑡, ℎ ℎ 5.3
The ESS global balance must be guaranteed and it is demonstrated in Fig. 5.3. As we can see, the sum of the power charging minus the power discharging of each smart home must be equal to the total charged power of the ESS minus the total discharge power from the ESS.

3.

Global balance:

𝑃 𝐺𝑟𝑖𝑑 𝑡, ℎ + 𝑃 𝐸𝑆𝑆 𝐶ℎ 𝑡, ℎ -𝑃 𝐸𝑆𝑆 𝐷𝑖𝑠ℎ 𝑡, ℎ ℎ = 𝑃 𝐺𝑟𝑖𝑑 𝑀 𝑡 + 𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 𝑡 -𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 𝑡 5.4
The exchange of the power between smart homes, the main grid and the shared ESS must be satisfied. The equation (5.4) guarantee the global balance in the considered microgrid where the sum of the imported power from the main grid of each smart home plus the power charged minus the power discharged also in each smart home of the ESS is equal the total purchased power of the microgrid plus the total charging minus the total discharging power of the ESS. The operation model of the AC in cooling mode:

𝑇 𝑖𝑛𝑠 𝑡, ℎ = 𝜖 × 𝑇 𝑖𝑛𝑠 𝑡 -1, ℎ + 1 -𝜖 × 𝑇 𝑜𝑢𝑡 𝑡 - 𝜇 × 𝐵 𝑎𝑐 𝑐 𝑡, ℎ × 𝑃 𝑎𝑐 𝐴 5.6
The operation model of the AC in heating mode:

𝑇 𝑖𝑛𝑠 𝑡, ℎ = 𝜖 × 𝑇 𝑖𝑛𝑠 𝑡 - The bound of the amount power imported from the grid: 0 ≤ 𝑃 𝐺𝑟𝑖𝑑 𝑡, ℎ ≤ 𝑃 𝐺𝑟𝑖𝑑 𝑚𝑎𝑥 5.20 7. Photovoltaic system:

The limit of the power generated by PV system:

0 ≤ 𝑃 𝑃𝑉 𝑡, ℎ ≤ 𝑃 𝑃𝑉 𝑚𝑎𝑥 5.21
The generated output power from photovoltaic system:

𝑃 𝑃𝑉 𝑡, ℎ ≤ 𝐴 𝑃𝑉 × 𝜌 × 𝑆𝐼(𝑡) 5.22

8. Wind turbine system:

The limit of the power generated by wind system: 0 ≤ 𝑃 𝑊 𝑡, ℎ ≤ 𝑃 𝑊 𝑚𝑎𝑥

5.23

The generated output power from wind system: The above described EMS is shown in Fig. 5.4 where the flowchart of the algorithm is detailed by steps for one day simulation.

𝑃 𝑊 𝑡, ℎ = 0 𝑖𝑓 𝑣 𝑓 <
Step1 Obtain microgrid information on number of smart homes, smart home load, initial state of charge of ESS, day-ahead electricity price, renewable energy forecasting data

Step 2 Power flow among the grid, shared ESS, renewable energy resources, electric vehicles is decided by the EMS according to the optimized objective function

Step 3 Check all constraints for all considered systems t = 24

Step 6 t = t + 1 Update microgrid input information

Results

A case study of a microgrid with 3 smart homes is evaluated where two scenarios is performed to check the optimization of the objective function that intend to minimize the total energy cost of the microgrid. that the integration of a shared storage system in a microgrid comprise by a multiple smart homes is more profitable than an individual battery for each smart home because the consumers can benefit by sharing the energy with their neighbors.

Analysis and Results of different Case Studies

To check and prove the performance of the proposed energy management algorithm, we have varied different factors that may have effects in the obtained results. The following presented case studies are performed:

-Variation of the number of smart homes.

-Variation of purchased electricity cost from the main grid.

-Variation of the initial capacity of ESS.

Case 1 for Variation in Number of Smart Homes

To ensure that the good quality results obtained in the last case study will not be able to change with different size of a microgrid; we have varied the number of smart homes in the microgrid between 6 and 9. The results are shown in Table 5.5. remarked that for the scenario with 9 smart homes the solution is near to the optimal because it is more complex than the other scenario. The purchased power from the main grid is decreased from 41.08 kW to 30.99 kW with 6 SHS and from 65.60 kW to 46.48 kW with 9 SHs. We can conclude that even if we expand the microgrid until 9 SHs, a decreasing in the overall cost will be realized.

Case 2 for Variation in Purchasing Electricity cost

To make sure of the performance of the proposed energy management algorithm while different purchased electricity cost from the main grid may be used, we have selected randomly € cents between individual and shared ESS respectively. And the purchased power from the main grid is decreased from 70.87 kW to 51.89 kW about 27%. We can note that there are some of results with individual ESS is near to the optimal and they are not exact solutions. These results

is not mentioned with star (*) and they have a computing time of 1200 seconds. Thereby, we can also conclude that even when we vary the purchasing cost from main grid, due to the RTP per example that vary hour-to-hour and are given from general market prices, the effectiveness of the proposed algorithm model is well proved and ensured

Case 3 for Variation of Initial ESS Capacity

To observe what the effect on the results when we vary the initial state of charge level of the ESS, we have simulated different scenarios with different initial SOC of the ESS. The microgrid is the same as case study in paragraph 5.5.2 with 3 smart homes and an individual ESS of 10 kWh or a shared ESS of 30 kWh. We have changed the 𝑆𝑂𝐶 𝐸𝑆𝑆 𝑖𝑛𝑡 between 50% and 100% and the results are shown in Table 5.7. We observe that the reduction of the total electricity cost in the microgrid is decreased from 27%

to 16% when we initiate with 50% and 100% SOC of ESS respectively. This implies that when we have a less initial level in the ESS, the consumers in the microgrid can arrange themselves with shared power more than when they have an individual ESS. The SOC level for the scenarios with 50%, 60%, 80% and 100% initial SOC during time simulation of one day is exposed in Fig. 5.6. However, even with 100% initial SOC, the reduction of 16% is significant between individual and shared ESS.

Conclusion

In this chapter, an energy management model is proposed that allows the implementation of DR program in a smart microgrid which comprises multiple smart homes with renewable energy resources, different smart appliances, EVs and a shared ESS. The energy exchange between the smart homes in the microgrid is controlled by a RMGO. We proposed an exact solution method using MILP to solve the objective constrained problem that intend to minimize the total electricity bill of all consumers. To ensure that the implemented energy management model is efficient, we have compared it with a conventional scenario where each smart home has its individual small ESS without sharing energy with their neighbors. Different scenarios were performed by varying both the number of smart homes in the microgrid, the purchasing electricity cost from the main gird and the initial SOC of the ESS. Simulation results demonstrate that a cost reduction up to 27% between shared ESS and individual ESS was achieved. In the next chapter, we summarize the different studied systems in this thesis, in addition, we present the next future works.

6.1. Conclusion-----------------------------------------------------------------------------------------------141 6.2. Future Works--------------------------------------------------------------------------------------------142

6 General Conclusion and Future Works

Conclusion

This thesis has implemented appropriate energy management models and resolution approaches for the operation of smart homes and microgrids in the context of SG. We studied many problems in the optimal control and scheduling for the smart homes with taking into consideration the financial incentive for consumers. The main objective of the proposed EMS is

Future Works

In this thesis, we have studied numerous problems for the energy management, control and scheduling in smart home and microgrid, and there is several potential directions to extend our future research in this field. The aspects that may be considered in the future are listed as follows.

Further experiments could introduce a stochastic mathematical planning model because the intermittent nature of RESs brings several challenges such introducing significant operational variability and uncertainty in the system. As well, we can consider additional constraints to the energy management problem in order to generate a more complex system. The modeling of large-scale problem with consideration of multi-microgrid systems by joining local and centralized EMS can be studied.

Moreover, the objective function could be modified with studying systems with multiobjective functions while considering the environmental, economic and consumer comfort restrictions. As well as, considering large renewable energy power plants with massive number of smart homes; moreover, studying the communication infrastructure used to communicate between the central controller and the considered micro-sources.

Fig. 2 . 2

 22 Fig. 2.2 Conceptual model of a smart grid [NIST, 2009]

Fig. 2 . 3

 23 Fig. 2.3 IEEE version of the conventional power grid vs smart grid

  costumers benefit and minimize their electricity cost from this program by reducing their consumption during high price time because they have the right to control their loads. Utilities motivate the consumer to join in PBT using different pricing program such as time-of-use pricing (TOU), RTP, and critical peak pricing (CPP). Fig. 2.5 illustrates the classification of the different DR programs.

Fig. 2 . 5

 25 Fig. 2.5 Classification of demand response programs

  (for example 25 kWh / ~ 160 km of autonomy), the complete recharge of the battery has a theoretical duration of approximately 8 hours for normal recharging (3 kVA) to about 30 minutes for fast charging (43 kVA). The architecture of an EV is presented in Fig. 2.7.

Fig. 2 . 7

 27 Fig. 2.7 Electric vehicle architecture

  Fig. 2.8 Microgrid model

Fig. 3 . 2

 32 Fig. 3.2 Minimization of global cost

  defines two types of factors: control factors and noise factors. An inner design constructed over the control factors finds optimum settings. An outer design over the noise factors looks at how the response behaves for a wide range of noise conditions. The experiment is performed on all combinations of the inner and outer design runs. A performance statistic is calculated across the outer runs for each inner run[SAS Institute, 2009]. The Taguchi method simplifies the experimental protocol in order to highlight the factor effects on the response. It stands out by the considerable reduction of the number of tests whilst maintaining a high precision level.

3 .

 3 We chose them as input data because these values are used by many research references and also in real cases. The different curves of residential energy consumption are shown in Fig.3.5, the low load is 16.1 kWh, average load is 28 kWh and the high load is 64.7 kWh[START_REF] Henry | [END_REF]. The different curves of average hourly solar irradiance are shown in Fig.3.6 from ''Meteonorme 6.1'' at a latitude = 33.8 ° N with considering different periods of the year (January, April and July), where the low irradiation is 1.74 kW/m 2 , average irradiation is 4.84 kW/m 2 and the high irradiation is 8.23 kW/m 2 . The forecasted wind speed from[Arif et al., 2013], has an average daily speed of 5.1 m/s (Fig.3.7). The EV demand for driving is 2 kW on the following periods: 8, 9, 12, 15, 18, 19,

Fig. 3 . 5 Fig. 3 . 6 Fig. 3 . 7

 353637 Fig. 3.5 Daily residential energy consumption

Fig. 3 . 8

 38 Fig. 3.8 Energy resource management for one day 𝐹 1 = 1, 𝐹 2 = 3 and 𝐹 3 = 3

Fig. 3 . 3 Fig. 3 .

 333 Fig. 3.10 Energy resource management for four days 𝐹 1 = 1, 𝐹 2 = 3 and 𝐹 3 = 3

Fig. 3 .

 3 Fig. 3.10 and 3.11 illustrate the energy resource management for the best scenarios of 96 and 168

  Actually, smart appliances are used instead of conventional home appliances with communication interface and automatic management for more control. One of the significant concepts other than the two-way information and power flow among the customers and the utility in SGs is the energy efficiency by improving the production and load management. SG considers supporting the large employment of DER such as generators, renewable energy systems and energy storage devices coupled with DR program. Smart home appears as small model in SG where smart appliances are used to improve the load management with their communication interface. On the other hand, the smart home includes a large number of electrical appliances. The most of the devices can be scheduled without affecting the comfort of the consumer at the same time as reducing electricity bill. The objective of the DR program in smart home is to give the opportunity and the motivation for consumers to participate in the energy market by shifting and reducing the electricity consumption. The main purpose of the proposed optimization algorithm in this chapter is to minimize the energy cost of the consumers for day-ahead and extended simulation time horizon by controlling some loads with taking into consideration of predefined appliances temperature and by shifting to the periods with low price tariff. In the considered smart home model, smart appliances are divided in two major categories:  ECL such as cooker hood, vacuum cleaner, washing machine, etc.  TCL loads such as REF, AC and EWH.All parameters related to the ECL and TCL are considered, such as earliest starting time, latest finishing time, power consumption and duration of the operation. Each appliance can operate between its earliest starting time and latest finishing time. Moreover, the management of energy production systems is also considered. We have integrated beside to the conventional power plant, a residential PV system and a micro-wind turbine. As well, electric battery and two Evs are considered. The proposed smart home model is given in Fig.4.1.

Fig. 4 . 1

 41 Fig. 4.1 Smart home architecture

Fig. 4 . 2 1 Fig. 4 . 3 FigFig. 4 . 5 Fig. 4 . 6 Fig. 4 . 7

 42143454647 Fig. 4.2 Energy resource management for case study 1

Fig. 4 . 8 5 Fig. 4 . 9

 48549 Fig. 4.8 Desired temperatures of TCL of case study 5

Fig. 4 . 10

 410 Fig. 4.10 Flowchart of math-heuristic technique process for consecutive days

Fig

  Fig. 4.11 Energy management for 48 hours time horizon

and t = 1

 1 hour indicating the time slot duration, to minimize the total day-ahead energy cost of the costumers in the microgrid. Weather forecasting gives 24 hours wind speed and solar irradiation data. The studied microgrids are given in Fig. 5.1 and 5.2. The conventional scenario where each smart home has its individual ESS without sharing energy with their neighbors is presented in Fig. 5.1. While Fig. 5.2 shows the microgrid with the shared ESS. Because the energy demand in the residential area is able to fluctuate significantly between different societies, we have considered in our simulations diverse category of smart homes which differ in energy demand profile and number of home appliances used. The chosen categories are listed in

Fig. 5 . 1

 51 Fig. 5.1 Microgrid with individual ESS

Fig. 5 . 3 5 5.

 535 Fig. 5.3 Energy storage system balance

Fig. 5 . 4

 54 Fig. 5.4 Flowchart of the energy management system algorithm

Fig. 5 . 5

 55 Fig. 5.5 Curves of purchased electricity cost

Scenario 1 :

 1 microgrid that includes 3 smart homes with individual ESS. Scenario 2: microgrid that includes 3 smart homes with shared ESS. In this simulation, the 3 smart homes in the considered microgrid have different energy demand profile and different number of used home appliances. The purchasing electricity cost curve used is that in black of the Fig. 5.5. The smart homes have different category as mentioned in

  four different curves (A, B, C & D), each of them are simulated with 3, 6 and 9 smart homes in the microgrid. The considered curves of the purchased electricity cost are shown in Fig. 5.5. And the results of this simulation are shown in Table 5.6.

Fig. 5 . 6

 56 Fig. 5.6 Shared ESS with different initial SOC level

  to minimize the total electricity cost of the clients. The smart home is equipped with different systems such as renewable energy resources, thermal and electrical loads, battery-base ESS and EVs in additional to the main electric grid. Each of them is presented by mathematical models with satisfying several related constraints. Furthermore, optimization algorithms are implemented and modeled in a linear way. As well as different scenarios and simulations are applied to check and prove the effectiveness and robustness of the optimized energy management model. In the first studied problem, a robust MILP model is proposed to optimize the energy production and consumption systems in a residential consumer. Thus, an algorithm based on heuristic technique is implemented to reduce the computing time and to minimize the electricity cost of the consumer. Three case studies based on 24-, 96-, and 168-h time horizon are presented and results show the global optimum solution for many consecutive days with important reduction of execution time and by achieving a significant energy cost savings. In the second studied problem, a comparison between the MILP model and the math-heuristic optimization algorithm is made to demonstrate the effectiveness of the proposed model in a smart home energy management. Simulation results illustrate that the best solution is obtained where the TCL is considered that can adjust the temperature of the refrigerator, EWH and the room in order to minimize the energy consumption with maintaining a minimum comfort level of the costumer. Furthermore, the results show that the proposed optimization algorithm can obtain a near optimal solution with strongly decreases for the computing time. In the third studied problem, we proposed an energy management model in a smart microgrid which comprises multiple SHs to minimize the total electricity bill of all consumers. Different scenarios are performed by varying the number of SHs in the microgrid, the purchasing electricity cost from the main gird and the initial SOC of the ESS where simulation results demonstrated an important reduction between shared ESS and individual ESS.

  Tank thermal capacity of electric water heater [kWh/˚C]  𝐶 𝐺𝑟𝑖𝑑 𝑡 Cost of power generated by the grid in t [€/kWh]  𝐶 𝑃𝑉 𝑡 Generation and maintenance cost of photovoltaic system in t [€/kWh] 𝑆𝑂𝐶 𝐸𝑉 (𝑡, 𝑗) State of charge of the electric vehicle battery j in t [%]  𝑆𝑂𝐶 𝐸𝑆𝑆 (𝑡) State of charge of the energy storage system in t [%]  𝑆𝑂𝐶 𝐸𝑉 (𝑡, ℎ) State of charge of the electric vehicle battery in t for home h [%] State of the air conditioning in t for home h (1 = turn on in cooling mode) State of the air conditioning in t for home h (1 = turn on in heating mode)  𝐵 𝑒𝑤 ℎ 𝑡, ℎ State of the electric water heater in t for home h (1 = turn on)  𝐵 𝑟𝑒𝑓 𝑡, ℎ State of the refrigerator in t for home h (1 = turn on)

		 𝑃 𝐵 𝐷𝑚𝑎𝑥  𝑇 𝑟𝑒𝑓 min _𝑑𝑒𝑠 𝑡	Maximum allowed power discharge of battery [kW] Lower desired limit of refrigerator temperature in t [˚C]
		 𝑃 𝐸𝑆𝑆 𝐶𝑚𝑎𝑥  𝑇 𝑟𝑒𝑓 max _𝑑𝑒𝑠 𝑡  𝐵 𝑎𝑐 𝑐 𝑡, ℎ	Maximum allowed power charge of energy storage system [kW] Upper desired limit of refrigerator temperature in t [˚C]
	Nomenclature  𝐶 𝑊 𝑡 Generation and maintenance cost of wind system in t [€/kWh]  𝐶 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡 Maintenance cost of electric vehicle in t [€/kWh]  𝐶 𝐵 Maintenance cost of battery storage in t [€/kWh]  𝑃 𝑟𝑎𝑡𝑒𝑑 Rated power of the wind system [kW]  𝑣 𝑐𝑜 Cut-off speed of the wind turbine [m/s]  𝑇 𝑒𝑤 ℎ 𝑡 Water temperature of electric water heater in t [˚C] 𝐷𝑖𝑠𝑐 ℎ 𝑡  𝑃 𝐸𝑆𝑆 𝐷𝑚𝑎𝑥 Maximum allowed power discharge of energy storage system [kW]  𝑃 𝐸𝑉 Maximum allowed power charge of electric vehicle battery j [kW]  𝑃 𝐸𝑉 Maximum allowed power discharge of electric vehicle battery j [kW]  𝑣 𝑐𝑖 Cut-in speed of the wind turbine [m/s]  𝑇 𝑖𝑛𝑠 𝑡, ℎ Inside room temperature in t for home h [˚C] 𝐷𝑚𝑎𝑥 𝑗  𝑣 𝑟 Rated speed of the wind turbine [m/s]  𝑇 𝑖𝑛𝑠 𝑡 Inside room temperature in t [˚C] 𝐶𝑚𝑎𝑥 𝑗  𝑣 𝑓 Forecasted wind speed [m/s]  𝐵 𝑎𝑐 ℎ 𝑡, ℎ
	Notations  𝐶 𝑆𝑒𝑙𝑙 𝑡  𝑐 𝑝  𝑃 𝑒𝑤 ℎ  𝑃 𝑟𝑒𝑓 Variables  𝑇 𝑒𝑤 ℎ 𝑡, ℎ  𝑇 𝑟𝑒𝑓 𝑡 Abbreviations	Cost of electricity sold to the grid in t [€/kWh] Specific heat constant for water of electric water heater [kW] Power consumption of the electric water heater [kW] Power consumption of the refrigerator [kW] Water temperature of electric water heater in t for home h [˚C] Refrigerator temperature in t [˚C]
	 𝐷 𝑎𝑝𝑝𝑙 𝑖  𝜌  𝐷 𝑡ℎ 𝑡  𝑇 𝑟𝑒𝑓 𝑡, ℎ Air conditioning Constant power consumption of appliance i [kW] Efficiency of photovoltaic system [%] Power consumption of thermal controllable loads in t [kW] Refrigerator temperature in t for home h [˚C] Sets  T Set of optimization time interval [h]  𝑞 Hot water flow of electric water heater [m 3 /s] DER AC Distributed energy resources
	 T stay  𝑅 𝑒𝑤 ℎ Binary Variables DLC Direct load control Thermal resistance of tank walls of electric water heater [˚C/kW] Set of period when electric vehicles stays at home [h]  J  𝑆𝐼(𝑡) Solar irradiation in t [kW/m 2 ]  𝑌 𝑡 DR Demand response State of the battery in t (1 = charging) Set of electric vehicles  I  𝑒 𝑐 Charging coefficient factor [%] DSM Demand side management  𝑆𝑂𝐶 𝐵 Set of home appliances  H  𝑒 𝑑 ELC Electrical controllable load Discharging coefficient factor [%] Set of smart homes  𝜖 System inertia [%] EMS Energy management system
	Indices  t  𝜇 ESS EV  𝑁 𝐸𝑉 EWH	Index of time intervals Energy storage system Coefficient of performance of the air conditioning Electric vehicle Total number of electric vehicles Electric water heater
	GA	 j  𝑁 𝑆𝐻	Index of electric vehicles Total number of smart homes Genetic algorithm
	 i  𝑁𝑜𝑚 𝐸𝑆𝑆 GMPL GNU mathematical programming language Index of home appliances ESS nominal capacity [kWh]
	LP	 h  𝑁𝑜𝑚 𝐸𝑆𝑆 𝑖𝑛𝑡 Linear programming Index of smart homes Initial capacity off energy storage system [kWh]
	 𝑁𝑜𝑚 𝐵 MIP	Battery nominal capacity [kWh] Mixed-integer programming
	Functions  𝑁𝑜𝑚 𝐵 𝑖𝑛𝑡  𝑃 𝐵 𝐷𝑖𝑠𝑐 ℎ 𝑡 MILP Mixed-integer linear programming Initial battery capacity [kWh] Discharge power from battery in t [kW]
	 f  𝑁𝑜𝑚 𝐸𝑉 (𝑗)  𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗 NLP Nonlinear programming Objective function of the optimization problem Nominal capacity of electric vehicle battery j [kWh] Power charge by electric vehicle j in t [kW]
	 𝑁𝑜𝑚 𝐸𝑉 𝑖𝑛𝑡 𝑗  𝑃 𝐸𝑉 𝐶ℎ 𝑡, ℎ  𝑅 𝑡 PHEV Plug-in hybrid electric vehicle Initial capacity of electric vehicle battery j [kWh] Power charge by electric vehicle in t for home h [kW] State of the energy storage system in t for microgrid (1 = charging)
	PV	Parameters  𝑃 𝑎𝑐  𝑇 𝑖𝑛𝑠 min _𝑑𝑒𝑠 𝑡  𝑃 𝐵 𝐶ℎ 𝑡  𝑍(𝑡, ℎ) Photovoltaic Power consumption of the air conditioning [kW] Lower desired limit of inside room temperature in t [˚C] Power charge battery storage in t [kW] State of the energy storage system in t for home h (1 = discharging)
	 𝐴  𝐴 𝑃𝑉  𝑃 𝐺𝑟𝑖𝑑 𝑚𝑎𝑥  𝑃 𝑃𝑉 𝑚𝑎𝑥  𝑃 𝑊 max _𝑑𝑒𝑠 𝑡  𝑃 𝐸𝑆𝑆 𝐶ℎ 𝑡, ℎ  𝑆(𝑡) RMGO Residential microgrid optimizer Thermal conductivity of the construction [kW/˚C] Area of photovoltaic system [m 2 ] Maximum imported power from the gird [kW] Maximum allowed photovoltaic power [kW] Upper desired limit of inside room temperature in t [˚C] Power charge by energy storage system in t for home h [kW] State of the energy storage system in t for microgrid (1 = discharging)  𝑇 𝑖𝑛𝑠 min _𝑑𝑒𝑠 𝑡 Lower desired temperature limit of electric water heater in t [˚C]  𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 𝑡 Power charge by energy storage system in t for microgrid [kW]  𝑊(𝑡, ℎ) State of the electric vehicle battery j in t for home h (1 = charging) RTP Real-time pricing  𝑇 𝑒𝑤 ℎ TCL Thermal controllable load
	SG		Smart grid
	V2G	Vehicle-to-grid

 𝛼 𝑟𝑒𝑓 Effect of the ON and OFF states on the refrigerator temperature [˚C]  𝛽 𝑟𝑒𝑓 Activity probability effect on the refrigerator temperature [˚C]  𝐶 𝑒𝑤 ℎ  𝐷 𝑎𝑝𝑝𝑙 𝑖, ℎ Constant power consumption of appliance i home h [kW]  𝐷 𝑡 Load demand in t [kW]  𝐷 𝐸𝑉𝑑𝑟𝑖𝑣 𝑡, 𝑗 Driving electricity demand of electric vehicle j in t [kW] 𝑚𝑎𝑥 Maximum allowed wind power [kW]  𝑃 𝐵 𝐶𝑚𝑎𝑥 Maximum allowed power charge of battery [kW] 𝑚𝑖𝑛 Minimum state of charge of battery storage [%]  𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 𝑗 Minimum state of charge of electric vehicle battery [%]  𝑆𝑂𝐶 𝐸𝑆𝑆 𝑚𝑖𝑛 Minimum state of charge of energy storage system [%]  𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 𝑗 Minimum state of charge of electric vehicle battery [%]  𝛾 𝑟𝑒𝑓 Thermal leakage of refrigerator [˚C]  𝑇 𝑠𝑡𝑎𝑟𝑡 𝑖 Earliest starting time of appliance i [h]  𝑇 𝑓𝑖𝑛𝑖𝑠 ℎ 𝑖 Latest finishing time of appliance i [h]  𝑇 𝑡𝑟𝑒𝑎𝑡 𝑖 Operation time of appliance i [h]  𝑇 𝑠𝑡𝑎𝑟𝑡 𝑖, ℎ Earliest starting time of appliance i home h [h]  𝑇 𝑓𝑖𝑛𝑖𝑠 ℎ 𝑖, ℎ Latest finishing time of appliance i home h [h]  𝑇 𝑡𝑟𝑒𝑎𝑡 𝑖, ℎ Operation time of appliance i home h [h]  𝑇 𝑜𝑢𝑡 𝑡 Outside temperature in t [˚C]  𝑇 𝑒𝑤 ℎ max _𝑑𝑒𝑠 𝑡 Upper desired temperature limit of electric water heater in t [˚C]  𝑇 𝑒𝑤 ℎ cold Temperature of the entrance water into the electric water heater [˚C]  𝐷 𝑡ℎ 𝑡, ℎ Power consumption of thermal controllable loads in t for home h [kW]  𝑃 𝐺𝑟𝑖𝑑 𝑡 Power imported from the grid in period t [kW]  𝑃 𝐺𝑟𝑖𝑑 𝑡, ℎ Power imported from the grid in period t for home h [kW]  𝑃 𝐺𝑟𝑖𝑑 𝑀 𝑡 Power imported from the grid in period t for microgrid [kW]  𝑃 𝑃𝑉 𝑡 Power generated by the photovoltaic system in t [kW]  𝑃 𝑃𝑉 𝑡, ℎ Power generated by the photovoltaic system in t for home h [kW]  𝑃 𝑊 𝑡 Power generated by the wind system in t [kW]  𝑃 𝑊 𝑡, ℎ Power generated by the wind system in t for home h [kW]  𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, 𝑗 Discharge power from electric vehicle j in t [kW]  𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ Discharge power from electric vehicle in t for home h [kW]  𝑃 𝐸𝑆𝑆 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ Discharge power from energy storage system in t for home h [kW]  𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 𝑡 Discharge power from energy storage system in t for microgrid [kW]  𝑃 𝑖𝑛𝑗𝑒𝑐𝑡 𝑡 Amount of power selling to the grid in t [kW]  𝑆𝑂𝐶 𝐵 (𝑡) State of charge of the battery in t [%]   𝑍(𝑡) State of the battery in t (1 = discharging)  𝑊(𝑡, 𝑗) State of the electric vehicle battery j in t (1 = charging)  𝑋(𝑡, 𝑗) State of the electric vehicle battery j in t (1 = discharging)  𝑀 𝑡 State of the injection into the grid in t  𝑁 𝑡 State of the gird production in t  𝑉(𝑡, 𝑖) State of starting of appliance i in t (1 = appliance i starts)  𝐵 𝑎𝑐 𝑐 𝑡 State of the air conditioning in t (1 = turn on in cooling mode)  𝐵 𝑎𝑐 ℎ 𝑡 State of the air conditioning in t (1 = turn on in heating mode)  𝐵 𝑒𝑤 ℎ 𝑡 State of the electric water heater in t (1 = turn on)  𝐵 𝑟𝑒𝑓 𝑡 State of the refrigerator in t (1 = turn on)  𝑌 𝑡, ℎ State of the energy storage system in t for home h (1 = charging)  𝑋(𝑡, ℎ) State of the electric vehicle battery j in t for home h (1 = discharging)  𝑁 𝑡, ℎ State of the gird production in t for home h  𝑉(𝑡, 𝑖, ℎ) State of starting of appliance i home h in t (1 = appliance i starts)

Table 2 .1 Top 10 wind energy cumulative capacity Country Wind capacity (MW) % Share

 2

	PR China	168,732	34.7
	United States	82,184	16.9
	Germany	50,018	10.3
	India	28,700	5.9
	Spain	23,074	4.7
	United Kingdom	14,543	3.0
	France	12,066	2.5
	Canada	11,900	2.4
	Brazil	10,740	2.2
	Italy	9,257	1.9
	Rest of the world	75,576	15.5
	Total TOP 10	411,214	84.5
	World Total	486,790	100

Table 3 . 1

 31 Main elements of the proposed residential structure

	Energy production element	Energy consumption element	Prosumer element
	Conventional power plant		Battery storage system (supplier and consumer)
			EV
	Residential PV system	Residential consumer	Energy supplier during the
			discharging phase
			EV
	Micro-wind turbine		Energy consumer during the
			charging phase

  𝑃 𝐺𝑟𝑖𝑑 𝑡 + 𝑃 𝑃𝑉 𝑡 + 𝑃 𝑊 𝑡 + 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, 𝑗

		𝑁 𝐸𝑉
			+ 𝑃 𝐵 𝐷𝑖𝑠𝑐 ℎ 𝑡
		𝑗
	𝑁 𝐸𝑉
	= 𝐷 𝑡 +	𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗	+ 𝑃 𝐵 𝐶ℎ 𝑡 + 𝑃 𝑖𝑛𝑗𝑒𝑐𝑡 𝑡	3.2
	𝑗

1. Grid power balance:

  The equations(3.15) & (3.16) present the limit of the allowed charging and discharging of the EV battery. The charging and discharging power of the EV at period t should not exceed the specified 𝑃 𝐸𝑉 𝐶𝑚𝑎𝑥 𝑗 and𝑃 𝐸𝑉 𝐷𝑚𝑎𝑥 𝑗 , respectively. Equation (3.17) forbidden the charging and discharging simultaneously with the sum of the binary variables 𝑊 𝑡, 𝑗 and 𝑍 𝑡, 𝑗 must be less or equal than 1. Equation(3.18) designs the amount of electricity stored in the EV battery at period greater than 1. The electricity stored at the initial state of the EV battery is presented in equation(3.19). In addition the state of charge of the EV battery is limited between the 𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 (𝑗) and the maximum value 1 which here represents the 100% of the charge of the battery where the battery is fully charged, as presented in equation(3.20). And finally equation (3.21) expressed the EV battery charge limit where it must be less than the nominal EV battery capacity.

	𝑃 𝑖𝑛𝑗𝑒𝑐𝑡 𝑡 ≤ 𝑃 𝑖𝑛𝑗𝑒𝑐𝑡 𝑚𝑎𝑥 × 𝑀 𝑡		3.22
	𝑃 𝐺𝑟𝑖𝑑 𝑡 ≤ 𝑃 𝐺𝑟𝑖𝑑 𝑚𝑎𝑥 (𝑡) × 𝑁 𝑡		3.23
	𝑀 𝑡 + 𝑁 𝑡 ≤ 1			3.24
					1, 𝑗
		+	𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗 × 𝑑𝑡 𝑒 𝑐	-𝑒 𝑑 × 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, 𝑗 × 𝑑𝑡	3.18
	Initial state of EV battery:
	𝑁𝑜𝑚 𝐸𝑉 𝑗 × 𝑆𝑂𝐶 𝐸𝑉 1, 𝑗
		= 𝑁𝑜𝑚 𝐸𝑉 𝑖𝑛𝑡 𝑗 +	𝑃 𝐸𝑉 𝐶ℎ 1, 𝑗 × 𝑑𝑡 𝑒 𝑐	-𝑒 𝑑 × 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 1, 𝑗 × 𝑑𝑡	3.19
	Limit of state of charge of EV battery:
	𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 (𝑗) ≤ 𝑆𝑂𝐶 𝐸𝑉 𝑡, 𝑗 ≤ 1		3.20
	Maximum EV battery charge limit:
	𝑃 𝐸𝑉 𝐶ℎ 𝑡, 𝑗 × 𝑑𝑡 𝑒 𝑐	+ 𝑁𝑜𝑚 𝐸𝑉 (𝑗) × 𝑆𝑂𝐶 𝐸𝑉 𝑡 -1, 𝑗 ≤ 𝑁𝑜𝑚 𝐸𝑉 𝑗	3.21

Table 3 .2

 3 Number of factors levels

	Level	F 1	Factor F 2	F 3
	1	Low	0	Low
	2	Average	1	Average
	3	High	2	High

Table 3 .3 Input data

 3

	Parameters	Values	Unit
	Photovoltaic system [Tascikaraoglu et al., 2014]
	𝑃 𝑃𝑉 𝑚𝑎𝑥	3.5	kW
	𝜌	18.6	%
	𝐴 𝑃𝑉	25	m 2
	Wind turbine system [Zakariazadeh et al., 2015]
	𝑃 𝑊 𝑚𝑎𝑥	2.4	kW
	𝑃 𝑟𝑎𝑡𝑒𝑑	2.1	kW
	𝑣 𝑐𝑖	4	m/s
	𝑣 𝑐𝑜	25	m/s
	𝑣 𝑟	14	m/s
		Battery storage system [Fuselli et al., 2013]
	𝑃 𝐵 𝐶𝑚𝑎𝑥 , 𝑃 𝐵 𝐷𝑚𝑎𝑥	1	kW
	𝑁𝑜𝑚 𝐵	10	kWh
	𝑁𝑜𝑚 𝐵 𝑖𝑛𝑡	6	kWh
	𝑆𝑂𝐶 𝐵 𝑚𝑖𝑛	20	%
	𝑒 𝑐 , 𝑒 𝑑	95	%
		Electric vehicle [Zhang, 2013]
	𝑃 𝐸𝑉 𝐶𝑚𝑎𝑥 𝑗 , 𝑃 𝐸𝑉 𝐷𝑚𝑎𝑥 𝑗	3.3	kW
	𝑁𝑜𝑚 𝐸𝑉 (𝑗)	24	kWh
	𝑁𝑜𝑚 𝐸𝑉 𝑖𝑛𝑡 𝑗	16	kWh
	𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 𝑗	20	%

Table 3 .4 Hourly electricity price

 3

	t	1	2	3	4	5	6
	€/kWh	0.033	0.027	0.020	0.017	0.017	0.029
	t	7	8	9	10	11	12
	€/kWh	0.033	0.054	0.215	0.572	0.572	0.572
	t	13	14	15	16	17	18
	€/kWh	0.215	0.572	0.286	0.279	0.086	0.059
	t	19	20	21	22	23	24
	€/kWh	0.050	0.061	0.181	0.077	0.043	0.037

Table 3 . 5

 35 Test results during one day (24 h)Now we can write the model given before with the calculated coefficients from test results.𝑦 = 𝑙 + 𝑎 1 , 𝑎 2 , 𝑎 3 𝐹 1 + 𝑏 1 , 𝑏 2 , 𝑏 3 𝐹 2 + 𝑐 1 , 𝑐 2 , 𝑐 3 𝐹 3 3.23The coefficient 𝑎 1 is calculated using the following formula where 𝑚 1 (𝐹 1 ) is the average result when 𝐹 1 is low.Therefore, according to the above equation, the minimum value of 𝑓 𝑐𝑜𝑠𝑡 function is reached with the low level of 𝐹 1 , high level of 𝐹 2 and high level of 𝐹 3 . Fig.3.8 illustrates the residential energy management for this scenario (test Nº 3) considering the grid, the renewable energy sources, battery storage and EVs.

			According to Taguchi table L 9 (3 4 )
	Nº of tests	F 1	Factor level F 2	F 3	𝒚	Computing time (sec)
	1	1	1	1	-6.039	0.06
	2	1	2	2	-13.818	0.15
	3	1	3	3	-18.226	0.18
	4	2	1	2	-4.568	0.05
	5	2	2	3	-14.432	0.11
	6	2	3	1	-9.525	0.25
	7	3	1	3	-5.283	0.05
	8	3	2	1	-1.300	0.12
	9	3	3	2	-5.827	0.22

Table 3 . 6

 36 Test results during four days (96 h)

					According to Taguchi table L 9 (3 4 )
	Nº of tests	Factor level	𝒚			Computing time
		F 1 F 2 F 3	MILP	Heuristic	Gap	MILP (s) Heuristic (s)
	1	1	1	1	-24.158	-22.719	0.063	5.09	0.06
	2	1	2	2	-49.329	-48.255	0.022	54.94	0.12
	3	1	3	3	-59.365	-58.875	0.008	167.08	0.19
	4	2	1	2	-32.943	-31.587	0.043	7.40	0.08
	5	2	2	3	-51.666	-51.545	0.002	9.28	0.12
	6	2	3	1	-24.403	-23.905	0.021	8.71	0.15
	7	3	1	3	-21.132	-19.935	0.060	0.27	0.06
	8	3	2	1	-0.231	1.174	-1.197	0.66	0.06
	9	3	3	2	-9.190	-8.741	-0.049	28.71	0.19
	As noticed, due to the proposed heuristic algorithm, the computing time of all tests

combination is highly decreased with providing an acceptable solution very near to the optimal result.

Table 3 . 7

 37 Test results during seven days (168 h)

					According to Taguchi table L 9 (3 4 )
	Nº of tests	Factor level	𝒚			Computing time
		F 1 F 2 F 3	MILP	Heuristic	Gap	MILP (s) Heuristic (s)
	1	1	1	1	-42.276	-39.396	0.073	137.67	0.06
	2	1	2	2	-84.839	-82.944	0.023	>3600	0.10
	3	1	3	3	-100.503	-99.577	0.009	489.09	0.19
	4	2	1	2	-57.651	-54.933	0.049	93.12	0.08
	5	2	2	3	-88.900	-88.476	0.005	>3600	0.12
	6	2	3	1	-39.281	-38.468	0.021	169.78	0.14
	7	3	1	3	-36.981	-34.587	0.069	0.56	0.04
	8	3	2	1	0.838	3.832	-0.781	29.26	0.05
	9	3	3	2	-12.357	-11.655	-0.057	1607.41	0.16

  𝑃 𝑟𝑒𝑓 -𝛼 𝑟𝑒𝑓 × 𝐵 𝑟𝑒𝑓 (𝑡) + 𝛾 𝑟𝑒𝑓 4.11

	Limitation of the Ref temperature between desired bound:
	𝑇 𝑟𝑒𝑓 min _𝑑𝑒𝑠 𝑡 ≤ 𝑇 𝑟𝑒𝑓 𝑡 ≤ 𝑇 𝑟𝑒𝑓 max _𝑑𝑒𝑠 𝑡	4.12
	State to activate the refrigerator:

Table 4 . 1

 41 Electrical home appliances specifications

		Appliances	Type	Power (kW)	Duration (h)	Earliest starting time(h)	Latest finishing time (h)	Time window (h)
	1	Dish washer	ECL	1.7	1	8		9
	2	Washing machine	ECL	1.8	2	8		4
	3	Dryer	ECL	2.5	1	12		6
	4	Refrigerator	TCL	0.175	24	0		24
	5	Oven	ECL	2.5	2	14		5
	6	Cooker hood	ECL	0.2	1	16		3
	7	Microwave	ECL	1.7	1	6	9	3
	8	Water heater	TCL	1.7	2	0		24
	9	TV	ECL	0.3	5	19		5
	10	Laptop	ECL	0.1	3	13		11
	11	Desktop	ECL	0.3	5	13		11
	12	Vacuum cleaner	ECL	2	1	6		14
	13	Sensors	ECL	0.01	24	0		24
	14	Radio player	ECL	0.2	1	6	8	2
	15	AC	TCL	1.15	12	12		12
	16	Iron	ECL	2.7	2	4		16
	17	Illumination	ECL	0.5	5	19		5
	18	Occasional loads	ECL	3	5	0		24

Table 4 .2

 4 Case studies for single day

	Case studies	Production system Grid RER	DR program ECL TCL	Battery	V2G
	1

Table 4 . 3

 43 Simulation result for single day

	Case study	Cost (€ cents)	Purchased power (kW)	Sold power (kW)	Computing time (sec)
	1	1008.56*	64.70	-	0.31
	2	642.03*	64.70	-	0.52
	3	34.45*	36.78	18.57	0.31
	4	-39.42*	45.33	26.66	0.47
	5	-106.89*	36.28	29.52	16.23

Table 4 .4

 4 Simulation result for consecutive day

			𝒇(𝒄𝒐𝒔𝒕)		Computing time
	Case study	Time horizon	MILP (€ cents)	Math-Heuristic (€ cents)	Gap (%)	MILP (sec)	Math-Heuristic (sec)
		24	-106.89*	-	-	16.23	-
		48	-99.93*	-95.33	-4.60	49.39	26.64
		72	-90.17	-83.76	-7.11	600	35.18
	5	96	-66.54	-63.41	-4.70	600	70.83
		120	-43.70	-40.72	-6.82	600	79.52
		144	-22.91	-20.89	-8.82	600	88.31
		168	3.86	4.74	22.84	600	175.74

Table 4 . 5

 45 Simulation result for different cost curveFor a 144 hours simulation time horizon, the average of different results obtained with MILP is 1030.08 € cents while with the math-heuristic it is 1069.20 € cents with a gap of 3.80 %. The computing time is decreased 82 % from 321.06 to 59.16 sec. And finally for the 168 hours simulation time horizon, the average of different results obtained with MILP is 1250.76 € cents while the solution of the math-heuristic is 1301.45 € cents with a gap of 4.05 %. The computing time is decreased 92 % from 600 to 47.09 sec. These results show that our proposed mathheuristic algorithm is efficient and adaptive with factor variation because the global optimal

		8
		7
		6
		5
		4
	(kW)	2 3
	Power	1
		1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47
			Time (hour)
		P_pv	P_wind	Batt_disch
		EV1_disch	EV2_disch	P_injected
		P_grid	Load + Batt and EV charge

  this study, we considered a general smart microgrid which consists of a set of smart homes H, indexed by h, h ∈ H ∈ {1, 2, …, H}. Each smart home is equipped with a set of smart home appliances I, indexed by i, i ∈ I ∈ {1, 2, …, I}. The set of home appliances I is divided in two main types: ECL such as vacuum cleaner, cooker hood; and TCL loads such as EWH, AC and REF. All parameters of the ECL and TCL are adopted from Table 4.2, such as power consumption, duration of the operation, earliest starting time and latest finishing time. Moreover,

Table 5 .

 5

1.

Table 5 . 1

 51 Different category of smart homes

	Category	Occupancy	Energy demand	Numbers of appliances
	A	One adult	Low	9
	B	Two adults	Medium	15
	C	Two adults with children	High	18

  𝑣 𝑐𝑖 𝑎𝑛𝑑 𝑣 𝑓 > 𝑣 𝑐𝑜 𝑃 𝑊 𝑡, ℎ = 𝑃 𝑟𝑎𝑡𝑒𝑑 𝑖𝑓 𝑣 𝑟 ≤ 𝑣 𝑓 ≤ 𝑣 𝑐𝑜

	State of charge limit of the ESS: State of charge limit of EV battery:
	𝑆𝑂𝐶 𝐸𝑆𝑆 𝑚𝑖𝑛 ≤ 𝑆𝑂𝐶 𝐸𝑆𝑆 𝑡 ≤ 1 𝑆𝑂𝐶 𝐸𝑉 𝑚𝑖𝑛 ≤ 𝑆𝑂𝐶 𝐸𝑉 𝑡, ℎ ≤ 1		5.30 5.37
	Maximum ESS charge limit: Maximum EV battery charge limit:
	𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 𝑡 × 𝑑𝑡 𝑒 𝑐 𝑃 𝐸𝑉 𝐶ℎ 𝑡, ℎ × 𝑑𝑡 𝑒 𝑐	+ 𝑁𝑜𝑚 𝐸𝑆𝑆 × 𝑆𝑂𝐶 𝐸𝑆𝑆 𝑡 -1 ≤ 𝑁𝑜𝑚 𝐸𝑆𝑆 + 𝑁𝑜𝑚 𝐸𝑉 × 𝑆𝑂𝐶 𝐸𝑉 𝑡 -1, ℎ ≤ 𝑁𝑜𝑚 𝐸𝑉	5.31 5.38
	𝑃 𝑊 𝑡, ℎ = 𝑃 𝑟𝑎𝑡𝑒𝑑 × 10. Electric vehicles: 𝑣 𝑓 -𝑣 𝑐𝑖 𝑣 𝑟 -𝑣 𝑐𝑖 The limit of permitted charging power: 𝑖𝑓 𝑣 𝑐𝑖 ≤ 𝑣 𝑓 ≤ 𝑣 𝑟	5.24
	9. Energy storage system: The limit of allowed charging power: 𝑃 𝐸𝑉 𝐶ℎ 𝑡, ℎ ≤ 𝑃 𝐸𝑉 𝐶𝑚𝑎𝑥 × 𝑊 𝑡, ℎ 𝑃 𝐸𝑉 𝐶ℎ 𝑡, ℎ = 0		∀ 𝑡 ∈ 𝑇 𝑠𝑡𝑎𝑦 ∀ 𝑡 ∉ 𝑇 𝑠𝑡𝑎𝑦	5.32
	𝑃 𝐸𝑆𝑆 𝐶ℎ 𝑡, ℎ ≤ 𝑃 𝐸𝑆𝑆 𝐶𝑚𝑎𝑥 × 𝑌 𝑡, ℎ The limit of permissible discharging power and travel demand of EV:	5.25
	The limit of allowed discharging power: 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ ≤ 𝑃 𝐸𝑉 𝐷𝑚𝑎𝑥 × 𝑋 𝑡, ℎ 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ × 𝑑𝑡 = 𝐷 𝐸𝑉𝑑𝑟𝑖𝑣 𝑡	∀ 𝑡 ∈ [1, … , 𝑇] ∀ 𝑡 ∉ 𝑇 𝑠𝑡𝑎𝑦	5.33
	𝑃 𝐸𝑆𝑆 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ ≤ 𝑃 𝐸𝑆𝑆 𝐷𝑚𝑎𝑥 × 𝑍 𝑡, ℎ Forbidden the charging/discharging simultaneously:	5.26
	Forbidden the charging/discharging simultaneously: 𝑊 𝑡, ℎ + 𝑋 𝑡, ℎ ≤ 1	5.34
	𝑌 𝑡, ℎ + 𝑍 𝑡, ℎ ≤ 1 Stored power in the EV battery at t > 1:		5.27
	Power stored in the ESS at t > 1: 𝑁𝑜𝑚 𝐸𝑉 × 𝑆𝑂𝐶 𝐸𝑉 𝑡, ℎ
	𝑁𝑜𝑚 𝐸𝑆𝑆 × 𝑆𝑂𝐶 𝐸𝑆𝑆 𝑡 = 𝑁𝑜𝑚 𝐸𝑉 × 𝑆𝑂𝐶 𝐸𝑉 𝑡 -1, ℎ
		= 𝑁𝑜𝑚 𝐸𝑆𝑆 × 𝑆𝑂𝐶 𝐸𝑆𝑆 𝑡 -1 + 𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 𝑡 × 𝑑𝑡 𝑒 𝑐 -𝑒 𝑑 × 𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 𝑡 × 𝑑𝑡 + 𝑃 𝐸𝑉 𝐶ℎ 𝑡, ℎ × 𝑑𝑡 𝑒 𝑐 -𝑒 𝑑 × 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 𝑡, ℎ × 𝑑𝑡	5.28 5.35
	Initial state of EV battery:
	Initial state of the ESS: 𝑁𝑜𝑚 𝐸𝑆𝑆 × 𝑆𝑂𝐶 𝐸𝑆𝑆 1 = 𝑁𝑜𝑚 𝐸𝑆𝑆 𝑖𝑛𝑡 + 𝑁𝑜𝑚 𝐸𝑉 × 𝑆𝑂𝐶 𝐸𝑉 1, ℎ = 𝑁𝑜𝑚 𝐸𝑉 𝑖𝑛𝑡 +	𝑃 𝐸𝑆𝑆 𝑀𝐶ℎ 1 × 𝑑𝑡 𝑒 𝑐 𝑃 𝐸𝑉 𝐶ℎ 1, ℎ × 𝑑𝑡 -𝑒 𝑑 × 𝑃 𝐸𝑆𝑆 𝑀𝐷𝑖𝑠𝑐 ℎ 1 × 𝑑𝑡 𝑒 𝑐 -𝑒 𝑑 × 𝑃 𝐸𝑉 𝐷𝑖𝑠𝑐 ℎ 1, ℎ × 𝑑𝑡	5.29 5.36

Table 5 . 3

 53 Different purchased electricity cost

		t	1	2	3	4	5	6	7	8	9	10	12
	Cost	¢/kWh t	38 13	37 14	36 15	37 16	36 17	37 18	39 19	44 20	48 21	47 22	43 24
		¢/kWh	44	44	46	47	49	50	50	41	40	37	38
		t	1	2	3	4	5	6	7	8	9	10	12
	Cost	¢/kWh 13.3 26.7	5	9.7	8.7 21.9 33.3 9.4 23.5 45.2 48.2 54.2
	A	t	13	14	15	16	17	18	19	20	21	22	24
		¢/kWh 12.5 19.2 26.6 28.9 5.6	8.9	15 16.1 12.1 12.7 2.3	7.7
		t	1	2	3	4	5	6	7	8	9	10	12
	Cost	¢/kWh	13	5.4	10	1.7	5.7 11.9 10.3 4.4 20.5 44.2 31.2 47.2
	B	t	13	14	15	16	17	18	19	20	21	22	24
		¢/kWh 14.5 47.2 18.6 37.9 9.6	6.9	11 16.1 11.1 14.7 3.3	5.7
		t	1	2	3	4	5	6	7	8	9	10	12
	Cost	¢/kWh	20	35	35	26	26	30	30	25	25	25	32
	C	t	13	14	15	16	17	18	19	20	21	22	24
		¢/kWh	33	36	36	40	40	40	40	35	35	20	25
		t	1	2	3	4	5	6	7	8	9	10	12
	Cost	¢/kWh	45	35	35	35	27
	D

Table 5 .

 5 1. In the scenario 1 where we have a microgrid with individual ESS, this implies that each smart home have its own battery with a capacity of 10 kWh. While in the scenario 2 of the shared ESS, we have one battery with a capacity of 30 kWh. The simulation is performed with a reasonable comparison while considering the capacity of the shared ESS is equal to the sum of the capacity of all individual ESS. The results of this case study are shown inTable 5.4.

Table 5 .4

 5 Results for microgrid with 3 smart homesWe can observe that the total electricity cost of the 3 smart homes in the microgrid is reduced by 27% between individual and shared ESS from 1105.52 € cents to 811.49 € cents. As well as the purchased power from the main grid is decreased from 24.54 kW to 16.26 kW. Furthermore, the smart homes in the shared ESS scenario have profited from the discharge of the battery (30.13 kW) more than the first scenario (27.01 kW) as well as from the renewable energy generation which is about 126.15 kW instead of 114.74 kW. The two obtained solutions are optimal results and is solved with an acceptable computing time, 58.47 sec for the first scenario while for the second one it is a little superior about 180.68 sec. Consequently we can conclude

	Microgrid system model
	Individual ESS	Shared ESS

Table 5 . 5

 55 Results of variation of microgrid sizeWe can note that the total electricity cost of the 6 and 9 smart homes in the microgrid is reduced by 20% and 23% receptivity between individual ESS and shared ESS. For 6 SHs with individual ESS the cost is 1903.53 € cents while with shared ESS is 1528.05 € cents. For 9 SHs with individual ESS the cost is 3009.02 € cents while with shared ESS is 2303.18 € cents. Plus, we

			Microgrid system model
			Indiv.	Shared	Indiv.	Shared
			ESS	ESS	ESS	ESS
	Number of smart homes	6		9
	Initial ESS capacity (kWh)	10/home	60	10/home	90
	Total cost (€ cents/day)	1903.53*	1528.05*	3009.02	2303.18
	Savings cost in %	-	20%	-	23%
	Computing time (sec)	106.12	231.85	1200	1200
	𝑃 𝐺𝑟𝑖𝑑 𝑀	𝑡 (kW)	41.08	30.99	65.60	46.48
	ESS charge (kW)	27.70	25.01	43.56	42.77
	ESS discharge (kW)	49.64	46.66	76.69	75.82
	RE generation (kW)	229.47	238.56	344.21	363.12

Table 5 . 6

 56 Results of variation of purchasing electricity costFor the scenario with 3 SHs, the average total cost for the different curves in the microgird with individual ESS is 514.27 € cents while for shared ESS is 417.99 € cents. A cost reduction of 19 % is done. As well as the purchased power from the main grid is decreased from 26.53 kW to 18.95 kW which is implies 29%. For microgrid with 6 SHs, the average total cost with individual ESS is 921.36 € cents while with shared ESS is 791.44 € cents with 14% reduction. Also the purchased power from the main grid is decreased 23% from 44.34 kW to 34.21 kW. For the scenario where we have 9 SHs, a decreasing of 17% is achieved from 1435.63 € cents to 1197.80

	Nº of smart homes	Curve	Initial ESS capacity (kWh)	Total cost (€ cents/ day)	Computing time (sec)	𝑃 𝐺𝑟𝑖𝑑 𝑀 (kW) 𝑡	ESS charge (kW)	ESS discharge (kW)	RE generation (kW)
		A		295.74*	2.54	26.02	7.75	18.06	114.74
	3	B	10/home	273.36*	5.11	29.68	4.64	14.61	111.36
		C	(indiv.)	687.60*	123.28	25.20	15.68	26.84	114.73
		D		800.37*	7.22	25.20	15.22	26.34	114.74
	Average			514.27	34.54	26.53	10.82	21.46	113.89
		A		269.32*	63.71	18.58	14.47	25.51	121.49
	3	B C	30 (shared)	261.54* 528.02*	15.68 197.53	24.53 16.36	8.40 18.74	18.78 30.23	116.11 125.97
		D		613.11*	69.16	16.32	18.59	30.08	126.06
	Average			417.99	86.52	18.95	15.05	26.15	122.41
		A		551.69*	76.51	43.80	18.09	38.99	229.47
	6	B C	10/home (indiv.)	522.19* 1204.55	44.77 1200	50.08 41.77	12.23 27.94	32.50 49.91	222.73 222.47
		D		1407.01	1200	41.72	27.57	49.50	222.47
	Average			921.36	630.32	44.34	21.46	42.72	224.29
		A		511.84*	110.95	31.48	24.17	45.73	238.23
	6	B C	60 (shared)	503.99* 988.94*	86.11 315.54	43.37 30.99	12.77 25.01	33.09 46.66	227.37 238.56
		D		1160.99*	195.04	30.99	25.01	46.66	238.56
	Average			791.44	176.91	34.21	21.74	43.04	235.68
		A		847.43*	69.62	69.83	25.84	57.05	344.21
	9	B C	10/home (indiv.)	795.55* 1892.15	53.27 1200	79.75 66.97	16.87 43.62	47.11 76.75	334.09 344.20
		D		2207.38	1200	66.92	42.80	75.84	344.21
	Average			1435.63	630.72	70.87	32.28	64.19	344.18
		A		778.70*	934.36	46.68	42.35	75.34	362.64
	9	B C	90 (shared)	765.58* 1494.48* 1043.88 497.98	67.88 46.49	21.29 42.45	52.02 75.46	343.48 362.96
		D		1752.45*	977.68	46.49	42.48	75.49	362.96
	Average			1197.80	863.45	51.89	37.14	69.58	358.01

Table 5 . 7

 57 Results of variation of initial SOC level of ESS

			Initial SOC level of ESS
		50%	60%	80%	100%
	Total cost (€ cents/day) "Individual ESS"	1105.52*	1068.32*	994.35*	922.56*
	Computing time (sec)	58.47	203.59	100.75	127.24
	Total cost (€ cents/day) "Shared ESS"	811.49*	781.79*	765.46*	759.96*
	Computing time (sec)	180.68	79.64	47.06	36.22
	Savings cost in %	27%	26%	23%	16%

Acknowledgments

First and foremost, I would like to thank God for the whole thing.

Then, I would like to thank my thesis director, Dr. Olivier GRUNDER, and my co-supervisors Prof. Nazih MOUBAYED and Dr. Zakaria HAMMOUDAN for the trust they have given me by agreeing to supervise this doctoral work as well as for their multiple tips throughout these years of thesis.

I warmly thank the General Director of the Industrial Research Institute "IRI" in Lebanon, Dr.

Bassam FRENN, who is committed to help me during this period by allowing me to use the resources of the institute aiming to accomplish and succeed my PhD work.

I express my thanks to members of the jury, Prof. Manuela SECHILARIU and Dr. Ahmed NAIT-SIDI-MOH for having accepted to be the reviewers of this thesis. My thanks go also to the examiner, Prof. Ahmad EL RAFHI, it was a great pleasure of being part of this jury. I would like also to thank my colleagues in Nanomédecine, imagerie, thérapeutique laboratory, and University of Technology of Belfort-Montbéliard, for the good working atmosphere but also for the many good times spent together and especially to everyone that encouraged me during my stay.

Big thanks to my fiancee and future wife Carmen and to my family for their encouragement, their support and their sacrifices. Without them, this work would never have been possible.

Finally, I would like to thank you, readers of this thesis. Enjoy reading!

Preface

The research presented in this PhD. thesis, has been prepared at the Nanomédecine, imagerie, thérapeutique laboratory, Engineering Sciences and Microtechnologies Doctoral School (SPIM), University of Burgundy -Franche-Comté, UTBM, from April 2015 to May 2018.

List of Publications

This thesis arising 6 international publications that are listed below:

Input Data

The simulation results are presented in this part in order to test the effectiveness of the proposed EMS algorithm. The MILP is also modeled by GNU Mathematical Programming Language (GMPL) and is solved by GUROBI optimizer, running on a computer with Windows 7

Ultimate 64 bits operating system, processor Intel® Core™ i3-2350M 2.30 GHz and 4 GB of random-access memory RAM. The principal values of the simulation parameters in the proposed model are provided in