A New Approach for Grid-Connected Hybrid Renewable Energy System Sizing Considering Harmonic Contents of Smart Home Appliances

: Even renewable energy sources provide several advantages, especially from an environmental point of view, where the world has faced great challenges in the last few decades; several negative issues also exist regarding the integration of renewable resources-based power production units in electric power systems. One of the main problems related to pivotal renewable energy resources such as solar, wind, etc., is their stochastic and uncontrollable nature in terms of power production. Therefore, this stochasticity in the supply side of the power system may pose many challenges for system operators. This issue is also problematic for smaller applications where the stochastic production by a main resource, such as a roof-top photovoltaic system, and load demand may not match perfectly at each time instant and therefore should be compensated by additional resources such as battery-based energy storage systems. Herein, the economic considerations to ensure minimum costs for such a hybrid system design are vital so as to increase the penetration of such systems. Therefore, the optimal sizing and planning of hybrid systems have recently gained increasing importance to enhance power system operation in the context of the smart grid paradigm. From a di ﬀ erent perspective, harmonics are one of the most important power quality problems in system operations caused by widespread integration of power electronic loads with non-linear characteristics that should be considered. Thus, a new approach for grid-connected hybrid renewable energy system sizing is provided. In order to determine optimal capacities for photovoltaic (PV) and energy storage system (ESS) units for covering residential consumer demand, a mixed integer linear programming (MILP)-based formulation is presented. The main objective is minimizing total costs of the system consisting of investment, capital and maintenance cost functions. A daily power curve is created accurately with real measurements of non-linear loads considering harmonic contents of smart home appliances in Yildiz Technical University, Istanbul, Turkey. In addition, real radiation and temperature values are used in PV production as well as dynamic pricing schemes for realistic evaluations. Moreover, optimal sizing results are compared for both the harmonic-based power curve and rated power curve in terms of satisfying objective function.


Motivation and Background
In the last few decades, the energy demands of the modern world have extraordinarily increased due to technological innovations, rapid urbanization, and growing population [1]. As a natural consequence, power-electronic-based electrical equipments have started to be utilized more widely on the demand side [2]. The great achievements of semiconductor technology have captured the electronic industry and dominated the market of household appliances. However, all these paved the way for rising concerns about power quality issues in the distribution system due to the non-linear voltage-current characteristics of these appliances [3]. Therefore, it would not be wrong to mark that utility engineers will encounter harmonic problems more than in the past considering this widespread integration. Several domestic loads such as TV, laptop, printer, computer, light-emitting diodes (LEDs), washing machine, dishwasher, etc., have substantial impacts on the harmonic distortion level in the residential scale [4]. In order to quantify the potential effect on power system operation, the index of total harmonic distortion (THD) is defined as "The ratio of the rms of the high order harmonic components to the rms value of the fundamental quantity, represented as a percentage of the fundamental" [5,6]. According to the Institute of Electrical and Electronics Engineers (IEEE) 519-2014 [7], the voltage THD should be less than or equal to a 5% limit in the point of common coupling measurements from 120 V to 69 kV. Therefore, the harmonic contents of residential loads have to be monitored with digital technology thanks to the smart grid paradigm, and power quality requirements should be controlled in terms of satisfying the standards or not.
From the other perspective, renewable-based energy sources (RESs), such as photovoltaic (PV), have gained increasing interest worldwide and provide great opportunities in terms of covering residential end-users' power consumption. Integrating these units paves the way for reducing grid dependence, gas emissions, and losses, thus improving the voltage profile and decreasing investment/operation costs [8][9][10]. Therefore, massive deployment has been performed for every type of end-user thanks to noteworthy attempts from the government and industrial stakeholders. However, the stochastic nature of RESs can cause significant operational problems [11] in the electrical network that should be dealt with. Energy storage systems play an important role considering this issue in terms of aiding to provide a supply-demand balance and also reduce grid dependence. Load fluctuations as well as power variations have been evaluated comprehensively from the power system planner's perspective and optimal sizing strategies have been proposed in order to provide economical system design. It is important to emphasize that utilizing all the aforementioned benefits strongly depends on how to optimally determine the installation capacities of the system components. Non-optimization based modeling may result in higher investment costs as well as power losses.
Among them, Sedighi et al. presented a method for optimal sizing and siting of distributed generation units for the purpose of improving voltage profile and reducing losses as well as THD in distribution networks. Load flows as well as harmonic calculations were taken into consideration in this scheme in which the PSO algorithm was used as a solution technique [20]. Similar to this study [12], the heuristic PSO technique was used in a study by Amanifar and Golshan in [21] to solve optimal distributed generation allocation and sizing problems aiming to minimize investment costs and power losses. A multi-objective distributed generation locating and sizing problem was constructed in a study by Lu et al. in [22] considering the active power loss, harmonic distortion, voltage quality, and voltage sags. Monte Carlo simulation was conducted for fault analysis in order to evaluate the economic losses of the distribution system. Mohanty and Kelapure proposed a methodology for allocating the PV sources in a distribution feeder keeping the voltage THD within permissible limits according to the IEEE-519 standard [24]. Apart from addressing power quality issues, the protection coordination scheme was also taken into account by Rahmani et al. in [12] while providing the optimum distributed generation sizing. The performance analysis was carried out on an IEEE radial test system and comprehensive evaluations were presented in terms of voltage profile, THD, and power losses.
Combining energy management strategy with optimum hybrid system sizing was presented in a study by Feroldi and Zumoffen in [13] for the purpose of providing loss of power supply probability requirements with the lowest cost. Historical long-term climate and demand data were used in a genetic algorithm-based methodology to testify the impacts of different weather conditions on system design. Hosseinalizadeh et al. developed a techno-economically optimized hybrid system modeling consisting of a wind turbine, PV, a fuel cell, and energy storage system. In this scheme, solar radiation and average wind velocity were considered for investigating different combined RES architectures under diverse sizing scenarios [25].
From the other perspective, an artificial intelligence-based optimization model was presented in a study by Zhou et al. in [14] for both optimum sizing of hybrid PV-wind system and optimum resource allocation based on load demand. It was aimed to decrease high initial and operation costs of the system with proper management strategies and effective modeling techniques. Paliwal et al. presented an approach for an integrated hybrid power system comprising PV-wind-diesel and ESS aimed at determining the optimal mix of mentioned resources by achieving techno-socio-economic criterion.
The developed planning formulation was tested under different combined configurations in order to evaluate the reliability needs considering RES uncertainties [15]. For more detailed information about artificial intelligence based-approaches, the studies [16][17][18][19] can be also examined.
Askarzadeh developed a novel discrete chaotic harmony search-based simulated annealing algorithm to design an integrated PV-wind-ESS hybrid system optimally in terms of minimizing total annual cost while satisfying the constraints [16]. Escobar et al. proposed an analytical model-based sizing approach for a hybrid PV-wind-hydrogen energy conversion system based on real weather data in order to analyze its feasibility and efficiency [23].
The vast majority of studies have also been carried out to investigate the harmonic contents of household appliances and their impacts on system operation. Among them, Neha et al. carried out an experimental analysis for measuring the parameters of THD, displacement power factor (DPF), and transient current of several pieces of equipment by using a multi-function meter in India [33]. Roy and Mather grouped the domestic appliances as lighting, power electronics, resistive, motor, and aggregated loads for establishing a complete bottom-up model to assess voltage stability, harmonics, voltage sag, swells, and unbalance conditions [34]. Also, the load current characteristics were studied in [34]. Harmonic analysis was conducted by Kit et al. in [35] in which the parameters were measured for a desktop computer, fluorescent luminaries, and compact fluorescent lamps and voltage harmonic distortion impacts on current harmonics were also investigated. Grasselli et al. monitored the time-varying harmonic behavior of non-linear residential loads such as a printer, photocopier, cell phone battery charger, and compact fluorescent lamp [36]. Characterization methodology was proposed in [37] for modeling the loads based on their harmonic series composition. Munir et al. in [38], investigated the potential of using PV interface inverters to reduce the effect of harmonics from households. A model for house load and distributed production was created and the model was confirmed by simulations. Egan et al. proposed a model to determine energy consumption with high accuracy for typical Irish dwellings in [39]. However, the effect of harmonic was not taken into consideration in this study. Habib et al. proposed a model to improve the reliability of the power system during a power failure of a shared PV system in [40]. One-year data for the PV system and 10 home consumers for loads were considered. It has been seen that the common use of the PV system makes more profit than the individual use.
These aforementioned references with many other studies not referred here have provided valuable contributions to the literature on the optimal sizing strategies of hybrid systems from different points of view. Various methods, solution techniques, and modeling frameworks have been presented for achieving different objectives. Nevertheless, it is important to emphasize that most of the reported techniques for optimal sizing of hybrid systems assume sinusoidal operating conditions which do not take the voltage and current harmonics of the demand side into consideration.

Content, Contributions, and Organization of the Study
In this paper, a mixed integer linear programming (MILP)-based mathematical modeling concept is proposed to find the optimal size of PV and ESS units for covering grid-connected smart home consumption in an economic fashion. The real measurement is performed for residential appliances considering the harmonic components caused by non-linear loads and afterwards the power consumption curve is obtained accurately. The cost function consisting of capital, investment, and maintenance of PV/ESS, is aimed to be minimized after the optimization procedure, thus satisfying the system's operational constraints. A dynamic pricing scheme is also incorporated into the methodology to determine energy transactions between home and utility grid. To the best knowledge of the Authors, this study attempts to be the first in terms of covering sizing, harmonic impact, dynamic pricing schemes implementation, and real measurements based on gathered data utilization facts in a single study within the existing literature.
The organization of the paper is prepared as follows: Section 2 gives the mathematical background of the proposed optimization problem which is based on MILP with detailed explanations. Section 3 shows the simulation results and the conclusions with possible future studies discussed in Section 4.

An Overview of the Presented Structure
The structure of the proposed model is given in Figure 1. In this structure, the smart home has PV and a battery hybrid system. The PV and battery hybrid system both supply energy to the smart home, and even can inject energy to the grid. The smart home can supply energy from the PV system and the battery, and can also buy energy from the grid. The appliances in the smart home consume harmonic loads. In the case of harmonics, more power should be supplied to the load, and this situation changes the system size and operation.

Content, Contributions, and Organization of the Study
In this paper, a mixed integer linear programming (MILP)-based mathematical modeling concept is proposed to find the optimal size of PV and ESS units for covering grid-connected smart home consumption in an economic fashion. The real measurement is performed for residential appliances considering the harmonic components caused by non-linear loads and afterwards the power consumption curve is obtained accurately. The cost function consisting of capital, investment, and maintenance of PV/ESS, is aimed to be minimized after the optimization procedure, thus satisfying the system's operational constraints. A dynamic pricing scheme is also incorporated into the methodology to determine energy transactions between home and utility grid. To the best knowledge of the Authors, this study attempts to be the first in terms of covering sizing, harmonic impact, dynamic pricing schemes implementation, and real measurements based on gathered data utilization facts in a single study within the existing literature.
The organization of the paper is prepared as follows: Section 3 gives the mathematical background of the proposed optimization problem which is based on MILP with detailed explanations. Section 4 shows the simulation results and the conclusions with possible future studies discussed in Section 5.

An Overview of the Presented Structure
The structure of the proposed model is given in Figure 1. In this structure, the smart home has PV and a battery hybrid system. The PV and battery hybrid system both supply energy to the smart home, and even can inject energy to the grid. The smart home can supply energy from the PV system and the battery, and can also buy energy from the grid. The appliances in the smart home consume harmonic loads. In the case of harmonics, more power should be supplied to the load, and this situation changes the system size and operation.

Mathematical Formulation
In this study, MILP model of a smart home containing PV and battery hybrid system is presented. It is aimed to maximize the net present value of the profit obtained by a concept containing a PV-battery hybrid system. In addition, economically optimum PV and battery sizes are calculated in this manner. Herein, the profit is acquired by subtracting the expenses from the income with the objective function given below aiming to maximize the net present value of the profit between incomes and the costs.

Economic-Based Formulation
The aim of the problem stated in this study is to maximize total profit and is obtained by subtracting expenses from incomes. The objective function is defined in Equation (1). The aim is to maximize total profit and is obtained by subtracting expenses from incomes.
Equation (2) refers to the balance of power at each time t. Herein, the sum of the power bought from the grid, the power used from the PV, and the power used from the battery is equal to the sum of the power consumed on the loads, the power stored in the battery, and power sold to the grid. P grid,buy t In Equation (3), the power produced in the PV system is equal to the sum of the power consumed in the system and sold to the grid. n PV refers to the number of 1 kW PV system.
In addition, Equation (4) expresses that n PV , which is the number of PVs of 1 kW, is less than the maximum number of PVs that is predetermined.
The power discharged from the battery is either sold to the grid or consumed on loads. This value must also be multiplied by the discharge efficiency. This is described in Equation (5).
R disch bat and R ch bat in Equations (6) and (7) indicate the maximum power at which the battery is discharged and charged for a 1 kWh unit, respectively. These expressions are multiplied by n bat to determine the power limits for the battery size.
As stated in Equation (8), the maximum value is assigned to the number of PV panels with n max bat to determine the solution constraints of the optimization problem.
Equation (9) calculates the energy level of the battery at each time t. According to this equation, the energy level at time t is obtained by power at the time (t − 1) with collection by the discharge power of the battery or by subtracting the charge power in this interval ((t − 1) to t). Herein, η ch bat is given as the charging efficiency of the battery.
In Equations (10)- (12), the state of energy (SoE) of battery at the initial time, the maximum energy level of battery, and the minimum energy level of battery are defined respectively.
Since the battery cannot be charged and discharged at the same time, the u bat t binary decision variable is defined to prevent this situation. This condition is provided by Equations (13) and (14). Herein, N is defined as a sufficiently big positive number.
The limits of the maximum power that can be withdrawn from the grid and sold to the grid are easily indicated in the Equations (15) and (16), respectively. This is important in terms of grid capacity as the withdrawal of energy from the grid and the sale of energy to the grid cannot be materialized at the same time, therefore u grid t binary decision variable is defined for this situation.
The total power injected into the grid is equal to the sum of the power supplied by the PV and the battery. This is described in Equation (17).
In the case of using PV and battery hybrid system, the change in total electricity cost is explained in Equation (18). P grid,buy t shows the power bought from the grid. P grid,sold t represents the power sold to the grid. Furthermore, λ buy t and λ sell t are the unit prices for buying and selling, respectively. The prices vary per hour as The calculation of the cost difference between the situations where the PV and battery hybrid system is considered and the neglected is realized in Equation (19).
The total value of cash incomes and outflows during the project lifetime (generally considered as 20 years) is calculated respectively in Equations (20) and (21). As was mentioned above, the loads in the smart home caused harmonics and the relevant harmonic model is given below. The instantaneous values for voltage and current are given in Equation (22) and (23), respectively. v n and i n are the instantaneous voltage and current of the n. harmonic. Furthermore, w 1 represents the angular frequency for the fundamental component. Lastly, θ n and δ n are phase angles of n voltage and current harmonics.
The instantaneous active power expression is given in Equation (24). Herein, the active power is obtained by multiplying the current and voltage with the same frequency. Similarly, the reactive power expression is also expressed in Equation (25).
The effective values of current and voltage are given in Equations (26) and (27), respectively. Herein, the effective value is obtained by taking the square root of the sum of the squares of the fundamental component and other harmonic components.
The apparent power can be obtained from active, reactive, and distortion power types as follows: where D distortion power is used to define inactive power for current and voltage at different frequencies.

Test and Results
The proposed MILP model is tested in the General Algebraic Modeling System (GAMS) v.24.1.3 with the objective of minimizing total cost. The commercial solver CPLEX v.12 by IBM [41] is used as a solution technique to provide optimal sizing of PV and ESS units by taking into consideration the harmonic current and voltage contents of smart home appliances.

Input Data
Almost every piece of equipment found in a typical Turkish household is available in the smart home laboratory at Yildiz Technical University as indicated in Table 1. The rated powers and normal operating conditions have different characteristics that should be considered. Therefore, the household power consumption curve is provided based on real measurement data including harmonics (up to 50th) as shown in Figure 2. It is assumed that the household consists of a four-person family, where one of the parents working has this daily load profile. The 24 h demand power is extended for obtaining 8760 h for making yearly analysis. During this period, the load varies to include summer, winter, and other seasons.   All appliances are monitored with a professional Fluke Analyzer and the harmonic currents, voltages, THD, and active, reactive and apparent powers are obtained accurately to avoid modeling errors. The Fluke Analyzer can measure and record these values at a desired interval which was selected as three seconds. The power quality measurement of the appliances was experimentally conducted, and real power curve of the smart household was obtained based on the measurements. A representative system establishment for only one appliance can be seen in Figure 3. Some representative appliances are demonstrated with graphs for the sake of clarity for the reader. Figure  4 shows the frequency spectrum of an alternative current (AC) of a washing machine in which the fundamental value is accepted as 100%. It is evidently clear that h 3 and h 5 are most profound components in the working conditions that cause extra power losses similar to PC desktop-oriented measurements depicted in Figure 5. However, the laptop has different harmonic contents in which h 3 , h 7 , and h 13 are the dominant values as shown in Figure 6. All appliances are monitored with a professional Fluke Analyzer and the harmonic currents, voltages, THD, and active, reactive and apparent powers are obtained accurately to avoid modeling errors. The Fluke Analyzer can measure and record these values at a desired interval which was selected as three seconds. The power quality measurement of the appliances was experimentally conducted, and real power curve of the smart household was obtained based on the measurements. A representative system establishment for only one appliance can be seen in Figure 3. Some representative appliances are demonstrated with graphs for the sake of clarity for the reader. Figure 4 shows the frequency spectrum of an alternative current (AC) of a washing machine in which the fundamental value is accepted as 100%. It is evidently clear that h 3            In order to obtain optimal PV sizing for covering the mentioned demand, real-time measured hourly average power generation data are utilized in the system which was normalized to 1 kW base value in 2013 as shown in Figure 7. Further, 1 kW was accepted as the base power production for PV unit and was multiplied with n PV to find optimal sizing capacity of the system design considering harmonic load, ESS capacity, and grid power transaction under dynamic pricing. On the other hand, it is assumed that the initial SoE of ESS and deep-discharging limit are 0.5 and 0.25 of the relevant maximum battery energy storage capacity, respectively. The charging and discharging efficiencies are also considered as 0.95. When on-site generation is capable of meeting the household demand, the available energy can also be sold to the grid or charge the ESS according to the objective function. A dynamic pricing scheme has an important impact on these axioms due to profit maximization-based optimization model. The buying prices and variation can be seen in Figure  8 based on real-time measurements from the smart meter of a residential end-user [42]. Since the sizing values are determined for a 20-year period, the pricing data is repeated to obtain 8760 h yearly data as similar to the demand curve. In order to obtain optimal PV sizing for covering the mentioned demand, real-time measured hourly average power generation data are utilized in the system which was normalized to 1 kW base value in 2013 as shown in Figure 7. Further, 1 kW was accepted as the base power production for PV unit and was multiplied with n PV to find optimal sizing capacity of the system design considering harmonic load, ESS capacity, and grid power transaction under dynamic pricing. In order to obtain optimal PV sizing for covering the mentioned demand, real-time measured hourly average power generation data are utilized in the system which was normalized to 1 kW base value in 2013 as shown in Figure 7. Further, 1 kW was accepted as the base power production for PV unit and was multiplied with n PV to find optimal sizing capacity of the system design considering harmonic load, ESS capacity, and grid power transaction under dynamic pricing. On the other hand, it is assumed that the initial SoE of ESS and deep-discharging limit are 0.5 and 0.25 of the relevant maximum battery energy storage capacity, respectively. The charging and discharging efficiencies are also considered as 0.95. When on-site generation is capable of meeting the household demand, the available energy can also be sold to the grid or charge the ESS according to the objective function. A dynamic pricing scheme has an important impact on these axioms due to profit maximization-based optimization model. The buying prices and variation can be seen in Figure  8 based on real-time measurements from the smart meter of a residential end-user [42]. Since the sizing values are determined for a 20-year period, the pricing data is repeated to obtain 8760 h yearly data as similar to the demand curve. On the other hand, it is assumed that the initial SoE of ESS and deep-discharging limit are 0.5 and 0.25 of the relevant maximum battery energy storage capacity, respectively. The charging and discharging efficiencies are also considered as 0.95. When on-site generation is capable of meeting the household demand, the available energy can also be sold to the grid or charge the ESS according to the objective function. A dynamic pricing scheme has an important impact on these axioms due to profit maximization-based optimization model. The buying prices and variation can be seen in Figure 8 based on real-time measurements from the smart meter of a residential end-user [42]. Since the sizing values are determined for a 20-year period, the pricing data is repeated to obtain 8760 h yearly data as similar to the demand curve. The input parameters for PV and ESS, as well as economic rates are indicated in Table 2. The costs of capital, replacement, and maintenance can be changed easily when integrating the system for making sensitivity analysis. The optimal sizing results strongly depend on these values. It should be marked that the sizes of PV and ESS are restricted with upper limits of 5 kW and 4 kWh, respectively. However, the flexible scheme enables these inputs to be changed and applies a bigger system for more comprehensive evaluations. Also, the project lifetime is considered as 20 years in which PV is assumed not to need replacement whilst ESS is changed in every 10 years. This is because it is stated by the manufacturers that the PV system has a lifetime of 20 years. For the battery, this value appears to be 10 years in the technical data generally. Therefore, in this study, it was accepted that the lifetime for PV and battery is 20 and 10 years, respectively. However, it is only an input for the proposed structure. The value can be modified as 3, 5, or 7 years if desired in this flexible architecture. What is important in this study is to explain the mathematical background behind the system and show how the decision-making algorithm is working properly. Normally, the harmonic currents and voltages are measured in 3 s time granularity, which is convenient to the relevant standards. However, these relatively small intervals would cause a high computation burden while making a plan for 20 years (project time). Therefore, time granularity is selected as an hour for the optimal sizing procedure.

Simulation Results
In order to investigate the effectiveness of the proposed MILP-based algorithm, two representative results are compared from different points of view. For the sake of a clearer representation, sample cases for Summer and Winter (May 16, 2013 and January 1, 2013) are both analyzed to evaluate operational behavior of optimization strategies. The input parameters for PV and ESS, as well as economic rates are indicated in Table 2. The costs of capital, replacement, and maintenance can be changed easily when integrating the system for making sensitivity analysis. The optimal sizing results strongly depend on these values. It should be marked that the sizes of PV and ESS are restricted with upper limits of 5 kW and 4 kWh, respectively. However, the flexible scheme enables these inputs to be changed and applies a bigger system for more comprehensive evaluations. Also, the project lifetime is considered as 20 years in which PV is assumed not to need replacement whilst ESS is changed in every 10 years. This is because it is stated by the manufacturers that the PV system has a lifetime of 20 years. For the battery, this value appears to be 10 years in the technical data generally. Therefore, in this study, it was accepted that the lifetime for PV and battery is 20 and 10 years, respectively. However, it is only an input for the proposed structure. The value can be modified as 3, 5, or 7 years if desired in this flexible architecture. What is important in this study is to explain the mathematical background behind the system and show how the decision-making algorithm is working properly. Normally, the harmonic currents and voltages are measured in 3 s time granularity, which is convenient to the relevant standards. However, these relatively small intervals would cause a high computation burden while making a plan for 20 years (project time). Therefore, time granularity is selected as an hour for the optimal sizing procedure.

Simulation Results
In order to investigate the effectiveness of the proposed MILP-based algorithm, two representative results are compared from different points of view. For the sake of a clearer representation, sample cases for Summer and Winter (May 16, 2013 and January 1, 2013) are both analyzed to evaluate operational behavior of optimization strategies.
The power balance of the hybrid system comprising of the power drawn from the grid (buy), the power injected to the grid (sell), battery charging and using values, PV-used power, and electricity demand of end-user are depicted in Figures 9 and 10 for winter and summer days, respectively. At the beginning of the evaluated period, it is seen that the injected power to the grid has increased and reached the maximum value during 01:00 and 02:00 for the winter case. The SoE of the battery is 4 kWh (initial SOE) and it is utilized in selling power as well as covering demand. However, the demand should be provided by only a grid due to low SOE and low buying electricity prices in summer cases as shown in Figure 10.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 12 of 18 The power balance of the hybrid system comprising of the power drawn from the grid (buy), the power injected to the grid (sell), battery charging and using values, PV-used power, and electricity demand of end-user are depicted in Figures 9 and 10 for winter and summer days, respectively. At the beginning of the evaluated period, it is seen that the injected power to the grid has increased and reached the maximum value during 01:00 and 02:00 for the winter case. The SoE of the battery is 4 kWh (initial SOE) and it is utilized in selling power as well as covering demand. However, the demand should be provided by only a grid due to low SOE and low buying electricity prices in summer cases as shown in Figure 10.  At 03:00 and 05:00, the charging power of the battery increases for both case studies due to lower demand and relatively low electricity prices. The power consumption rises at 17:00-20:00, which is to be covered by one of the optimally sized sources for decreasing the total costs. As also seen in The power balance of the hybrid system comprising of the power drawn from the grid (buy), the power injected to the grid (sell), battery charging and using values, PV-used power, and electricity demand of end-user are depicted in Figures 9 and 10 for winter and summer days, respectively. At the beginning of the evaluated period, it is seen that the injected power to the grid has increased and reached the maximum value during 01:00 and 02:00 for the winter case. The SoE of the battery is 4 kWh (initial SOE) and it is utilized in selling power as well as covering demand. However, the demand should be provided by only a grid due to low SOE and low buying electricity prices in summer cases as shown in Figure 10.  At 03:00 and 05:00, the charging power of the battery increases for both case studies due to lower demand and relatively low electricity prices. The power consumption rises at 17:00-20:00, which is to be covered by one of the optimally sized sources for decreasing the total costs. As also seen in At 03:00 and 05:00, the charging power of the battery increases for both case studies due to lower demand and relatively low electricity prices. The power consumption rises at 17:00-20:00, which is to be covered by one of the optimally sized sources for decreasing the total costs. As also seen in Figure 11, the battery presents a good opportunity leading to the possibility of charging at low-priced periods and discharging at peak-demand periods. Therefore, it can be indicated that the existence of a battery in the hybrid system provides operational flexibility and the charging/discharging periods of this dynamic component are determined by the developed algorithm considering objective function maximization. Figure 11, the battery presents a good opportunity leading to the possibility of charging at low-priced periods and discharging at peak-demand periods. Therefore, it can be indicated that the existence of a battery in the hybrid system provides operational flexibility and the charging/discharging periods of this dynamic component are determined by the developed algorithm considering objective function maximization. Figure 11. Battery charging and discharging power along with state of energy variation for sample winter case.
The PV power production begins at nearly 08:00, reaches its maximum value (0.16 kW) at 12:00 and finishes at 18:00 for the winter case as illustrated in Figure 12. It is evidently clear that the amount of PV production is not enough for even supplying of the load consumption and as a result injecting power to the grid is zero. On the other hand, the summer case starts earlier than the winter case at 07:00, reaches nearly 0.8 kW value at 14:00 and ends at 21:00 as shown in Figure 13. The battery discharging is utilized to meet the high power consumption at 11:00 without transferring power from the grid due to relatively higher prices. Therefore, the algorithm gives a signal to utilize distributed generation instead of the grid after an economical decision-making process.  The PV power production begins at nearly 08:00, reaches its maximum value (0.16 kW) at 12:00 and finishes at 18:00 for the winter case as illustrated in Figure 12. It is evidently clear that the amount of PV production is not enough for even supplying of the load consumption and as a result injecting power to the grid is zero. On the other hand, the summer case starts earlier than the winter case at 07:00, reaches nearly 0.8 kW value at 14:00 and ends at 21:00 as shown in Figure 13. The battery discharging is utilized to meet the high power consumption at 11:00 without transferring power from the grid due to relatively higher prices. Therefore, the algorithm gives a signal to utilize distributed generation instead of the grid after an economical decision-making process.
Appl. Sci. 2019, 9, x FOR PEER REVIEW 13 of 18 Figure 11, the battery presents a good opportunity leading to the possibility of charging at low-priced periods and discharging at peak-demand periods. Therefore, it can be indicated that the existence of a battery in the hybrid system provides operational flexibility and the charging/discharging periods of this dynamic component are determined by the developed algorithm considering objective function maximization. Figure 11. Battery charging and discharging power along with state of energy variation for sample winter case.
The PV power production begins at nearly 08:00, reaches its maximum value (0.16 kW) at 12:00 and finishes at 18:00 for the winter case as illustrated in Figure 12. It is evidently clear that the amount of PV production is not enough for even supplying of the load consumption and as a result injecting power to the grid is zero. On the other hand, the summer case starts earlier than the winter case at 07:00, reaches nearly 0.8 kW value at 14:00 and ends at 21:00 as shown in Figure 13. The battery discharging is utilized to meet the high power consumption at 11:00 without transferring power from the grid due to relatively higher prices. Therefore, the algorithm gives a signal to utilize distributed generation instead of the grid after an economical decision-making process.  During the period from 12:00 to 16:00, even though a certain part of the demanded power can be matched with battery apart from PV, the system decides to use the energy of battery even after 17:00 as the buying prices are becoming higher in peak a period that makes sense to explain this condition. However, it is not right to say the same things for the summer case. Within these periods, high power generation supplies the demand and charges the battery as well as injects available power to the grid.
The ever-increasing power consumption of a smart home especially for 17:00, 19:00, and 20:00 causes discharging power to increase for the purpose of decreasing transferred power from the grid due to high electricity prices. It is strongly encouraged to utilize distributed generation as much as possible instead of utility grid. In the winter case, the charged battery (at 03:00 and 05:00) is discharged and SOE decreases at the depth-of discharge level (1kWh). After 21:00, PV output power becomes zero and battery does not have enough energy to be discharged. Therefore, the demand is covered only by the grid. In order to simplify interpretation of the results for the considered winter and summer, Figures 14 and 15 are depicted to clearly show the decomposition of the injected power.  During the period from 12:00 to 16:00, even though a certain part of the demanded power can be matched with battery apart from PV, the system decides to use the energy of battery even after 17:00 as the buying prices are becoming higher in peak a period that makes sense to explain this condition. However, it is not right to say the same things for the summer case. Within these periods, high power generation supplies the demand and charges the battery as well as injects available power to the grid.
The ever-increasing power consumption of a smart home especially for 17:00, 19:00, and 20:00 causes discharging power to increase for the purpose of decreasing transferred power from the grid due to high electricity prices. It is strongly encouraged to utilize distributed generation as much as possible instead of utility grid. In the winter case, the charged battery (at 03:00 and 05:00) is discharged and SOE decreases at the depth-of discharge level (1kWh). After 21:00, PV output power becomes zero and battery does not have enough energy to be discharged. Therefore, the demand is covered only by the grid. In order to simplify interpretation of the results for the considered winter and summer, Figures 14 and 15 are depicted to clearly show the decomposition of the injected power. During the period from 12:00 to 16:00, even though a certain part of the demanded power can be matched with battery apart from PV, the system decides to use the energy of battery even after 17:00 as the buying prices are becoming higher in peak a period that makes sense to explain this condition. However, it is not right to say the same things for the summer case. Within these periods, high power generation supplies the demand and charges the battery as well as injects available power to the grid.
The ever-increasing power consumption of a smart home especially for 17:00, 19:00, and 20:00 causes discharging power to increase for the purpose of decreasing transferred power from the grid due to high electricity prices. It is strongly encouraged to utilize distributed generation as much as possible instead of utility grid. In the winter case, the charged battery (at 03:00 and 05:00) is discharged and SOE decreases at the depth-of discharge level (1kWh). After 21:00, PV output power becomes zero and battery does not have enough energy to be discharged. Therefore, the demand is covered only by the grid. In order to simplify interpretation of the results for the considered winter and summer, Figures 14 and 15 are depicted to clearly show the decomposition of the injected power.  From the economical evaluation perspective, the proposed scheme decides the requirement of 4 kWh battery storage system and 0.81 kW PV unit. After optimal sizing strategy, is obtained as $1338.379 while is $1171.741. Total profit of the system is $166.6377 when considering harmonic contents of voltage and current based on real measurements.
In order to investigate harmonic impacts on optimal configuration planning, the power curve of the smart home is created without harmonic components. After simulation results, $1320.501, $1155.049, and $165.4518 is achieved for , , and total profit of the hybrid system, respectively. The relevant results are given in Table 3. On the other hand, 0.79 kW PV and 4 kWh battery storage capacity is obtained after simulation results when harmonics are beyond the scope. As a result, it is not wrong to mark that harmonics do not have great effects on sizing strategies especially for one residential end-user. However, as the number of considered households increase, this impact may be far more obvious. Especially if the developed framework can be applied to industrial and commercial end-users which have densely non-linear loads, the impact of sizing can be significantly obvious. Harmonic loads cause the harmonic currents to be drawn from the grid. For this reason, the actual value of current and voltage are rising which increases injected power from the upstream grid. Increased total load requires increasing the sizing of distributed system components. As a result, PV and battery sizes increase comparing both harmonic-based load case study and non-harmonic-based situation. According to the results, it can be concluded that there is no great impact on cost values for two conditions due to only taking one household into account.

Conclusions and Discussion
In this study, a MILP model was proposed for sizing a PV and battery hybrid system for a grid connected smart home. Compared to the other existing studies in the area, the harmonic load situation was taken into account in this study and the optimum size of PV and battery was determined for this situation. It should be underlined once again that the study was realized under real power, current, voltage, and harmonics of smart home appliances in Yildiz Technical University, Istanbul, Turkey. Several case studies based on real measurements for the hybrid system and the loads were conducted to assess the impacts of the proposed methodology. The appliance level From the economical evaluation perspective, the proposed scheme decides the requirement of 4 kWh battery storage system and 0.81 kW PV unit. After optimal sizing strategy, V income present is obtained as $1338.379 while V outcome present is $1171.741. Total profit of the system is $166.6377 when considering harmonic contents of voltage and current based on real measurements.
In order to investigate harmonic impacts on optimal configuration planning, the power curve of the smart home is created without harmonic components. After simulation results, $1320.501, $1155.049, and $165.4518 is achieved for V income present , V outcome present , and total profit of the hybrid system, respectively. The relevant results are given in Table 3. On the other hand, 0.79 kW PV and 4 kWh battery storage capacity is obtained after simulation results when harmonics are beyond the scope. As a result, it is not wrong to mark that harmonics do not have great effects on sizing strategies especially for one residential end-user. However, as the number of considered households increase, this impact may be far more obvious. Especially if the developed framework can be applied to industrial and commercial end-users which have densely non-linear loads, the impact of sizing can be significantly obvious. Harmonic loads cause the harmonic currents to be drawn from the grid. For this reason, the actual value of current and voltage are rising which increases injected power from the upstream grid. Increased total load requires increasing the sizing of distributed system components. As a result, PV and battery sizes increase comparing both harmonic-based load case study and non-harmonic-based situation. According to the results, it can be concluded that there is no great impact on cost values for two conditions due to only taking one household into account.

Conclusions and Discussion
In this study, a MILP model was proposed for sizing a PV and battery hybrid system for a grid connected smart home. Compared to the other existing studies in the area, the harmonic load situation was taken into account in this study and the optimum size of PV and battery was determined for this situation. It should be underlined once again that the study was realized under real power, current, voltage, and harmonics of smart home appliances in Yildiz Technical University, Istanbul, Turkey. Several case studies based on real measurements for the hybrid system and the loads were conducted to assess the impacts of the proposed methodology. The appliance level harmonic components were considered to have a bottom-up approach for the cumulative impacts of non-linear loads based harmonic components.
The impacts of harmonic were found to be at lower levels for an assessment based on just a single household. However, the increase of the number of households and especially consideration of different end-user types such as commercial and industrial with high levels of non-linear loads will show far more clearly the impacts of harmonic components on sizing purposes. Herein, this study can be a starting point for the relevant literature to consider harmonic components within such studies and the smart home-based residential case can here be assumed just as an example for more dominant industrial and commercial load-based sizing studies.
Therefore, in addition to the proposed work, the consideration of different end-user types, the consideration of harmonic filtering benefit and cost, and the load shifting possibility via an energy management system can be listed as possible future directions of the study both for the Authors of this work and other researchers in the area.