ANFIS-Based Peak Power Shaving / Curtailment in Microgrids Including PV Units and BESSs

One of the most crucial and economically-beneficial tasks for energy customers is peak load curtailment. On account of the fast response of renewable energy resources (RERs) such as photovoltaic (PV) units and battery energy storage system (BESS), this task is closer to be efficiently implemented. Depends on the customer peak load demand and energy characteristics, the feasibility of this strategy may vary. When adaptive neuro-fuzzy inference system (ANFIS) is exploited for forecasting, it can provide many benefits to address the above-mentioned issues and facilitate its easy implementation, with short calculating time and re-trainability. This paper introduces a data-driven forecasting method based on fuzzy logic (FL) for optimized peak load reduction. First, the amount of energy generated by PV is forecasted using ANFIS which conducts output trend, and then, the BESS capacity is calculated according to the forecasted results. The trend of the load power is then decomposed in Cartesian plane into two parts, namely left and right from load peak, for the sake of searching for equal BESS capacity. Network switching sequence over consumption is provided by a fuzzy logic controller (FLC) considering BESS capacity and PV energy output. Finally, to prove the effectiveness of the proposed ANFIS-based peak power shaving/curtailment method, offline digital time-domain simulations have been performed on a test microgrid system using the data gathered from a real-life practical test microgrid system in the MATLAB/Simulink environment and the results have been experimentally verified by testing on a practical microgrid system with real-life data obtained from smart meters and also, compared with several previously-reported methods.


Introduction
The concept of smart microgrids has emerged from high penetration of distributed generation (DG) and distributed/renewable energy resources (DERs/RERs) and energy storage systems (ESS) [1][2][3][4][5].A microgrid is a small-scale, low-voltage power grid in the low voltage designed to solve energy issues locally and enhance flexibility.These systems can function in either grid-connected or islanded (autonomous) modes of operation [5][6][7][8].The growth trend of RERs and rise of constant power costs brings new dimension of old problems exposing new ways.RERs, DERs and ESSs forces distribution network (DN) to be more flexible, faster, safer, and less expensive [9,10].On the other hand, customer of distribution system operator (DSO) tends to use all capabilities of RERs/DERs Energies 2018, 11, 2953 2 of 23 provides with minimum human involvement [11].Power peak shaving/curtailment is an old problem with new possible solutions.Micro-and smart grids tend to provide new algorithms for power peak shaving/curtailment such as game theory in role of locating and displacing load in DN [12].Some researchers have been conducted for integration of DERs into DN based on optimization tools and dynamic programming methods [13].Demand side management (DSM) of DNs, especially in micro-and smart grid applications, also need new materials for energy efficiency [14].
In addition, many new trends tend to increase peak load power on DN based on battery charging of plug-in hybrid electric vehicles (PHEVs) in charging stations [15,16].Peak shaving with DERs/RERs and BESS is one of the major issues in microgrid power management.Role of ESS in peak shaving of medium voltage direct current (MVDC) systems based on smart algorithms has been discussed in [17].Forecasting power demand or energy consumption is also essential which has been done before based on FL, artificial neural networks (ANNs), particle swarm optimization (PSO), and other computational intelligence technique [18][19][20].Fuzzy logic has also been used to manage available energy sources for peak power shaving/curtailment in a system composed of RERs and/or energy accumulations [21,22] Another topic that is being introduced through the introduction of renewable energy sources into the distribution network is energy self-sustainability and independence.The road to it is through sustainable transition from traditional DN to smart grid.Some of the studies have dealt with this issue, including an analysis of the electricity market using agents for forecasting fluctuation of energy price [23,24].Any sustained transition to the energy sector cannot be achieved without the participation of DERs/RERs with or without BESS.Said references include intelligent methods (AI) in the analysis of the search by buying energy when it is cheap.This action opens the market of energy sales when it is set to introduce DER/RER as a compulsory technical predisposition for a single market participant.The purpose of this paper is the technical part of energy self-sustainability.
The contribution of this paper is reflected in a structured and systematic approach to solving one of the actual problems in the distribution network: cutting the maximum load using the method of artificial intelligence.The aforementioned reports have mainly dealt with peak cutting methods over load deployment during the consumer curve, but this was mainly done without renewable energy sources in combination with the energy storage.The contribution of this paper is in the smart prediction of the available energy, using ANFIS, that will be generated, and the consumption that will take place with the inclusion of energy storage in the optimization of the distribution network load.The proposed hybrid method used in DN load optimization is multidisciplinary and with it entails a great computational complexity and close connection of inputs and outputs of different methods with measurements.
In this paper, a new method for load peak shaving/curtailment is proposed by combining essential components for optimizing peak power curtailment.This paper combines DERs/RERs with BESS connected to customer and microgrid that have been modeled and simulated in MATLAB/Simulink 2017a (Mathwork Inc., Natick, MA, USA) software environment and then, experimentally tested on a real-life practical test microgrid system.The proposed solution includes three parts: (1) Describing the proposed system configuration based on real-life existing examples in DSO networks; (2) Presenting the proposed methodology based on ANFIS to forecast energy generation and power-peak demand with dimensioned energy components of the system configuration and; (3) Exploiting FLC as a major part to determine optimal BESS usage for the sake of power peak shaving/curtailment.Finally, to show the effectiveness of the proposed method, offline digital time-domain simulation studies are performed in MATLAB/Simulink environment and after comparing the results with previously-reported methods, they are experimentally verified by testing on a practical micro grid system with real-life data obtained from smart meter.
The paper covers mentioned themes as follows: Section 2 describes the system configuration.Section 3 elaborates on the proposed peak shaving method due proposed methodology.Section 4 presents the ANFIS and its structure for forecasting application.Section 5 presents simulation results.
Energies 2018, 11, 2953 3 of 23 Section 6 presents experimental results regarding proposed method testing.Finally, conclusions and final remarks are provided in Section 7 to summarize all points.

System Configuration
As illustrated in Figure 1, the micro grid system mainly consists of: (1) DERs//RERs and ESSs; (2) DN and; (3) Electric energy customers consisting of various energy consumers.

System Configuration
As illustrated in Figure 1, the micro grid system mainly consists of: (1) DERs//RERs and ESSs, (2) DN and, (3) Electric energy customers consisting of various energy consumers.The goal of this study is: (1) minimize or ideally, deduct maximum power demand from customer's electricity bill, measured by energy and power meter and (2) Independent focusing of energy for power peak demand curtailment, considering other related technical issues.To accomplish the mentioned goals, many inputs shall be considered for successful obtaining of the output, so, there is a mandatory input for the energy consumed in one sample of 15-min.In same sample amount of generated energy from a Photovoltaic System (PVP) and also state of charge SoC of BESS.Based on the definition of these inputs, only one output is given from intelligent electronic device (IED) that is switching sequence of switch 1 and switch 2. Readings from smart meters (SM) cover two inputs: customer's energy consumption and power surge in sample of 15-min.The proposed algorithm uses the mentioned inputs is detailed in Section 3. Additional inputs are number of sample and season.They are collected automatically according to the date and time (hour) reading.Training of FLC is conducted according to these data and the inputs besides energy and power consumed.Training details of FLC and sampling are also discussed in Section 3.
In this study, the DER/RER unit is assumed to be a photovoltaic (PV) unit; however, this study can be performed based on any other type of DERs/RERs such as wind generation, thermal energy source, hydro plant, etc.There is the same situation for ESS, but the purpose of this paper is focused on BESS in role of ESS.The PV and BESS are installed on same site to give minimal or no voltage drop, and both are dimensioned as: where Cb is capacity of BESS in measure of kWh, and Ept is generated energy from DER/RER in form of PV system in measure of kWh.Equation (1) explains relation between daily generated energy from PV system and BESS storage capacity in 24 h.Equation ( 1) is the main relationship for dimensioning BESS and DER/RERs.When BESS is considered as ESS, the most important issue is SoC.The BESS The goal of this study is: (1) minimize or ideally, deduct maximum power demand from customer's electricity bill, measured by energy and power meter and (2) Independent focusing of energy for power peak demand curtailment, considering other related technical issues.To accomplish the mentioned goals, many inputs shall be considered for successful obtaining of the output, so, there is a mandatory input for the energy consumed in one sample of 15-min.In same sample amount of generated energy from a Photovoltaic System (PVP) and also state of charge SoC of BESS.Based on the definition of these inputs, only one output is given from intelligent electronic device (IED) that is switching sequence of switch 1 and switch 2. Readings from smart meters (SM) cover two inputs: customer's energy consumption and power surge in sample of 15-min.The proposed algorithm uses the mentioned inputs is detailed in Section 3. Additional inputs are number of sample and season.They are collected automatically according to the date and time (hour) reading.Training of FLC is conducted according to these data and the inputs besides energy and power consumed.Training details of FLC and sampling are also discussed in Section 3.
In this study, the DER/RER unit is assumed to be a photovoltaic (PV) unit; however, this study can be performed based on any other type of DERs/RERs such as wind generation, thermal energy source, hydro plant, etc.There is the same situation for ESS, but the purpose of this paper is focused on BESS in role of ESS.The PV and BESS are installed on same site to give minimal or no voltage drop, and both are dimensioned as: where C b is capacity of BESS in measure of kWh, and E pt is generated energy from DER/RER in form of PV system in measure of kWh.Equation (1) explains relation between daily generated energy from PV system and BESS storage capacity in 24 h.Equation ( 1) is the main relationship for dimensioning BESS and DER/RERs.When BESS is considered as ESS, the most important issue is SoC.The BESS can be modeled according to Figure 2 for one battery cell [25].BESS is a string of single batteries that are unified as one battery cell.SoC is to be taken from BESS model as (Figure 2) [25]: where C Cbi is battery capacity of particular cell in BESS string, SoC is the State of Charge of a battery cell.Equations ( 2) and (3) are extended (1) in a vector of quantity of battery cells in BESS.Also, where i = 1, 2, . . ., n.For simpler representation of BESS and its functionality in case study, C s and R s are taken minimal so impact of snubbed resistance of battery is high enough and battery engagement is fast enough.So, the SoC is defined as follows: where q b is the Charge stored in C b , q max is maximum charge that battery can hold, and C max is maximum charge drowned from battery.For effective management of BESS, SoC is basically the only required information.However, for dimensioning of BESS and calculating its SoC, C b is still required.BESS is assembled of batteries for gathering energy capacity large enough for daily PV generation on sunny days (Figure 3).
Energies 2018, 11, x FOR PEER REVIEW 4 of 25 can be modeled according to Figure 2 for one battery cell [25].BESS is a string of single batteries that are unified as one battery cell.SoC is to be taken from BESS model as (Figure 2) [25]: where CCbi is battery capacity of particular cell in BESS string, SoC is the State of Charge of a battery cell.Equations ( 2) and (3) are extended (1) in a vector of quantity of battery cells in BESS.Also, where i = 1, 2, …, n.For simpler representation of BESS and its functionality in case study, Cs and Rs are taken minimal so impact of snubbed resistance of battery is high enough and battery engagement is fast enough.So, the SoC is defined as follows: where qb is the Charge stored in Cb, qmax is maximum charge that battery can hold, and Cmax is maximum charge drowned from battery.For effective management of BESS, SoC is basically the only required information.However, for dimensioning of BESS and calculating its SoC, Cb is still required.BESS is assembled of batteries for gathering energy capacity large enough for daily PV generation on sunny days (Figure 3).can be modeled according to Figure 2 for one battery cell [25].BESS is a string of single batteries that are unified as one battery cell.SoC is to be taken from BESS model as (Figure 2) [25]: where CCbi is battery capacity of particular cell in BESS string, SoC is the State of Charge of a battery cell.Equations ( 2) and (3) are extended (1) in a vector of quantity of battery cells in BESS.Also, where i = 1, 2, …, n.For simpler representation of BESS and its functionality in case study, Cs and Rs are taken minimal so impact of snubbed resistance of battery is high enough and battery engagement is fast enough.So, the SoC is defined as follows: where qb is the Charge stored in Cb, qmax is maximum charge that battery can hold, and Cmax is maximum charge drowned from battery.For effective management of BESS, SoC is basically the only required information.However, for dimensioning of BESS and calculating its SoC, Cb is still required.BESS is assembled of batteries for gathering energy capacity large enough for daily PV generation on sunny days (Figure 3).In this way, the BESS will always be able to gather all generated electric energy and use it for over peak curtailment.PV is modeled based on available sun irradiance at installation site and power load peak demand based on smart meter data gathered from monthly readout.The PV output power is given by [26]: Considering that C and µ are constant factors in (5), we conclude that P t can be forecast based only on I PV,t and T PV,t .Figure 4 illustrates I-V and P-V characteristic from the PV designed for case study simulations.The DN is modeled as infinite bus that consists of infinite power and ESSs are ready for customer engagement at any time.Just like real-life practical case, the DN is always on and ready for usage from customer.In this paper, internal resistance of grid model is considered to be near zero so that this relation is focused: PV + BESS → Customer ↔ DN.Also, the customer is modeled as one 10 kW power demand.Various power consumers inside customer's house hold are presented by daily power demand curve presented in Figure 5 whose data has been gathered from energy and power meter between DN and customer.The placement of smart meter is presented on Figure 1.Sizing of PV and BESS has been done based on customer's power demand and energy consumption curve as shown in Figure 5.In this way, the BESS will always be able to gather all generated electric energy and use it for over peak curtailment.PV is modeled based on available sun irradiance at installation site and power load peak demand based on smart meter data gathered from monthly readout.The PV output power is given by [26]: 2 5 1000 Considering that C and µ are constant factors in (5), we conclude that Pt can be forecast based only on IPV,t and TPV,t.Figure 4 illustrates I-V and P-V characteristic from the PV designed for case study simulations.The DN is modeled as infinite bus that consists of infinite power and ESSs are ready for customer engagement at any time.Just like real-life practical case, the DN is always on and ready for usage from customer.In this paper, internal resistance of grid model is considered to be near zero so that this relation is focused: PV + BESS → Customer ↔ DN.Also, the customer is modeled as one 10 kW power demand.Various power consumers inside customer's house hold are presented by daily power demand curve presented in Figure 5 whose data has been gathered from energy and power meter between DN and customer.The placement of smart meter is presented on Figure 1.Sizing of PV and BESS has been done based on customer's power demand and energy consumption curve as shown in Figure 5.In this way, the BESS will always be able to gather all generated electric energy and use it for over peak curtailment.PV is modeled based on available sun irradiance at installation site and power load peak demand based on smart meter data gathered from monthly readout.The PV output power is given by [26]: 2 5 1000 Considering that C and µ are constant factors in (5), we conclude that Pt can be forecast based only on IPV,t and TPV,t.Figure 4 illustrates I-V and P-V characteristic from the PV designed for case study simulations.The DN is modeled as infinite bus that consists of infinite power and ESSs are ready for customer engagement at any time.Just like real-life practical case, the DN is always on and ready for usage from customer.In this paper, internal resistance of grid model is considered to be near zero so that this relation is focused: PV + BESS → Customer ↔ DN.Also, the customer is modeled as one 10 kW power demand.Various power consumers inside customer's house hold are presented by daily power demand curve presented in Figure 5 whose data has been gathered from energy and power meter between DN and customer.The placement of smart meter is presented on Figure 1.Sizing of PV and BESS has been done based on customer's power demand and energy consumption curve as shown in Figure 5.However, in these cases, some optimal sizing algorithms are beneficial [27].Based on the articles of the contract between DSO and customer, the maximum power reserved for customer is 10 kW.So, we have: where C can be much more or less; however, considering customers power peak, there is no need for over dimensioning RERs.There is the same story with BESS and C b can be higher than C.
The best guideline for dimensioning C b is PV energy generation during the longest day of the year.
According to customer's geographical location (Croatia, Zagreb), it is concluded that the longest day was 21 June 2017, with 15 h and 36 min of sunlight and maximum temperature of 30 • C. Based on this information, DN operator's database is searched for PV energy generation of 10 kW on the mentioned day and the output resulted from database is presented in Figure 6 that depicts PV generation curve on 21 June 2017.Basically, the PV can generate as much energy as the BESS is able to store.In reality, the longest day doesn't have to be necessarily the most productive day of PV, but it is good start for the first parameterization of PV capacity.Also in practice, a 10 kW customer rarely achieve higher power swell, but PV with 10 kWp installed capacity commonly achieves about 7 kW generated power peak.
Owing to this fact, the value of C in ( 6) is more than enough.Table 1 shows the energy generation of 10 Kw PV before and after the target day.Based on Figure 6 and Table 1, C b should be 54 kWh.There are some more productive days for PV; but, there is no need for over dimensioning BESS.If the PV takes the maximum sun irradiation, the BESS is ready to accumulate entire energy generation from PV which results in SoC ≤ 100%.In this way, the PV never over recharge the BESS, and BESS make most of accumulated energy on power peak curtailment.
Energies 2018, 11, x FOR PEER REVIEW 6 of 25 However, in these cases, some optimal sizing algorithms are beneficial [27].Based on the articles of the contract between DSO and customer, the maximum power reserved for customer is 10 kW.So, we have: where C can be much more or less; however, considering customers power peak, there is no need for over dimensioning RERs.There is the same story with BESS and Cb can be higher than C. The best guideline for dimensioning Cb is PV energy generation during the longest day of the year.According to customer's geographical location (Croatia, Zagreb), it is concluded that the longest day was 21 June 2017, with 15 h and 36 min of sunlight and maximum temperature of 30 °C.Based on this information, DN operator's database is searched for PV energy generation of 10 kW on the mentioned day and the output resulted from database is presented in Figure 6 that depicts PV generation curve on 21 June 2017.Basically, the PV can generate as much energy as the BESS is able to store.In reality, the longest day doesn't have to be necessarily the most productive day of PV, but it is good start for the first parameterization of PV capacity.Also in practice, a 10 kW customer rarely achieve higher power swell, but PV with 10 kWp installed capacity commonly achieves about 7 kW generated power peak.Owing to this fact, the value of C in ( 6) is more than enough.Table 1 shows the energy generation of 10 Kw PV before and after the target day.Based on Figure 6 and Table 1, Cb should be 54 kWh.There are some more productive days for PV; but, there is no need for over dimensioning BESS.If the PV takes the maximum sun irradiation, the BESS is ready to accumulate entire energy generation from PV which results in SoC ≤ 100%.In this way, the PV never over recharge the BESS, and BESS make most of accumulated energy on power peak curtailment.

Proposed Methodology
The proposed methodology for power peak demand reduction using ANFIS forecasting algorithm for estimation of energy generated by PV and BESS is illustrated in Figure 7.The proposed power peak curtailment algorithm includes the following steps:

Proposed Methodology
The proposed methodology for power peak demand reduction using ANFIS forecasting algorithm for estimation of energy generated by PV and BESS is illustrated in Figure 7.The proposed power peak curtailment algorithm includes the following steps:  In this paper, the ANFIS is used for forecasting of day-ahead PV power generation.On account of its flexibility and processing speed, the ANFIS method has been widely used as a method of forecasting [18,28].The first stage of the algorithm is defining input and output datasets.In this study, the input data for PV generation forecasting are temperature, solar irradiance, and present day generation curve.The most important part of data is present day generation curve, because the first two inputs can be same in different parts of the year and instead of global, ANFIS may provide local solution.Combination of the mentioned three information is unique for any PV system.The second part of input data is the quality of information.Based on [18,28], there is available daily temperature and sun irradiance but the resolution of these information should be discussed.For the present day generation curve, one info per day is enough for temperature and irradiance just for 15-min resolution.By using this method, the generalization of input data is avoided and therefore, mapping of input to output data is still achievable.The 15-min resolution is based on smart meter recording upon which DSO charges customers to draw power peak.For the second input, the measurement unit is kWh/m 2 /day.Based on the amount of the power radiated from sun, the PV is generating equivalent electricity power.This information is directly correlated if the PV module is stationary and with fixed latitude and array tilt.The sun irradiation is calculated based on Equations ( 7)-( 10): In this paper, the ANFIS is used for forecasting of day-ahead PV power generation.On account of its flexibility and processing speed, the ANFIS method has been widely used as a method of forecasting [18,28].The first stage of the algorithm is defining input and output datasets.In this study, the input data for PV generation forecasting are temperature, solar irradiance, and present day generation curve.The most important part of data is present day generation curve, because the first two inputs can be same in different parts of the year and instead of global, ANFIS may provide local solution.Combination of the mentioned three information is unique for any PV system.The second part of input data is the quality of information.Based on [18,28], there is available daily temperature and sun irradiance but the resolution of these information should be discussed.For the present day generation curve, one info per day is enough for temperature and irradiance just for 15-min resolution.By using this method, the generalization of input data is avoided and therefore, mapping of input to output data is still achievable.The 15-min resolution is based on smart meter recording upon which DSO charges customers to draw power peak.For the second input, the measurement unit is kWh/m 2 /day.Based on the amount of the power radiated from sun, the PV is generating equivalent electricity power.This information is directly correlated if the PV module is stationary and with fixed latitude and array tilt.The sun irradiation is calculated based on Equations ( 7)-( 10): Energies 2018, 11, 2953 AM = 1/cos(θ) (10) where ϕ, δ are geographical altitude and longitude angles, ID is direct component of sun irradiance, AM is air mass, and θ is PV position angle respect to sun.Due ( 7)-( 10) is calculated how much sunny hours each day PV system have for power generation and therefore BESS recharge with customer consumption.Based on sunrise and sunset, forecasting energy generation is much more accurate acquired from ANFIS.
Considering the linear relationship between temperature, sun irradiance, and daily generation given in ( 5), the probabilistic curve forecasting method is capable of adapting the input data to output samples [28].The PV generation curve in 15-min resolution is acquired from data collecting software installed for supervision (Figure 6).The energy consumption forecasting is solely based on temperature and the present day customer's consumption.The forecasting is left for ANFIS and according to our previous experiences, these inputs are temperature, and present day consumption curve.The present day consumption is acquired from smart meter installed between customer and DN (Figure 1).Based on the customer's agreement with DSO, the data access is available in 15-min resolution.The basic idea behind Step 3 is to convert the predicted peak load power curve from kW into kWh based on readout resolution and peak load point.The readout resolution is referenced to input data of peak load forecasting block, and its source is the smart meter between DN and customer (Figure 1).Based on the forecast load peak, the graphical representation for calculation of customer's peak energy is shown in Figure 8.
( ) where φ, δ are geographical altitude and longitude angles, ID is direct component of sun irradiance, AM is air mass, and θ is PV position angle respect to sun.Due ( 7), ( 8), ( 9) and ( 10) is calculated how much sunny hours each day PV system have for power generation and therefore BESS recharge with customer consumption.Based on sunrise and sunset, forecasting energy generation is much more accurate acquired from ANFIS.
Considering the linear relationship between temperature, sun irradiance, and daily generation given in ( 5), the probabilistic curve forecasting method is capable of adapting the input data to output samples [28].The PV generation curve in 15-min resolution is acquired from data collecting software installed for supervision (Figure 6).The energy consumption forecasting is solely based on temperature and the present day customer's consumption.The forecasting is left for ANFIS and according to our previous experiences, these inputs are temperature, and present day consumption curve.The present day consumption is acquired from smart meter installed between customer and DN (Figure 1).Based on the customer's agreement with DSO, the data access is available in 15-min resolution.The basic idea behind Step 3 is to convert the predicted peak load power curve from kW into kWh based on readout resolution and peak load point.The readout resolution is referenced to input data of peak load forecasting block, and its source is the smart meter between DN and customer (Figure 1).Based on the forecast load peak, the graphical representation for calculation of customer's peak energy is shown in Figure 8.  Also, we have: Equation ( 11) models the process Step 3 with time resolution of 15-min and ( 12) and ( 13) give the energy calculation based on peak load at the given time.The proposed strategy operates with two separate measured values from the smart meter: 15-min peak and 15-min energy.Converting peak Energies 2018, 11, 2953 9 of 23 demand to energy demand, from kW to kWh, is done by dividing kW with 4 to get kWh for that 15-min period.The steps n and k are 15-min step left and right from peak location on timeline.One iteration is (11) for every n − 1, k + 1 and each iteration is subjected to this question that is the C b equal to E customer , peak?If yes, then the boundaries of switching sequence changes are given as P peak−n , and P peak+k .Basically, as soon as the smart meter records P peak−n , the IED closes the switch between PV+BESS and customer and opens the switch between DN and customer.This switch state gives no power and energy to the smart meter to record because entire consumption is loaded on BESS.In this situation, the PV is still working as recharging source for BESS, the SoC is at the calculated state, and the BESS is energy source until the IED changes the switching state back at P peak+k .even if SoC > 0%.So, the BESS is not fully discharged and load peak is not recorded by DSO smart meter.P peak−n , and P peak+k are two MFs to FLC in role of IEDs.Using FL, as switching driving method, it may initiate switching at local load peak and not at global during real time recording.As can be observed from Figure 9, there is a noticeable trend for localized peaks and for global peaks.Many local peaks happen during the day, but the global maximum is around samples 30-50 along with 70-85.This makes one more input to FLC switching algorithm with two membership functions (MFs).The input of the sample number is usable if and only if the FLC knows which season of the year currently is: winter, spring, summer, or autumn.The need for these information comes from different possible global maxima (Figure 8).The global maximum location is located in the first MF for winter and summer, and the second MF for spring and autumn.This issue makes one additional input for FL switching algorithm with two MFs: one for winter and summer, and the second one for spring and autumn.The input values are left for forecasting the specific day load curve and therefore training of FLC.The fuzzy sets are defined by MF and rules so that the crisp values are processed into fuzzy values and then deffuzified.In this paper, triangular and trapezoid MFs are exploited.If there is a huge error in the output, is Gaussian, triangular or trapezoid MFs can be used.In this application, the output error is in acceptable range.The FLC have three inputs and one output whose MFs are defined as follows: The global maximum location is located in the first MF for winter and summer, and the second MF for spring and autumn.This issue makes one additional input for FL switching algorithm with two MFs: one for winter and summer, and the second one for spring and autumn.The input values are left for forecasting the specific day load curve and therefore training of FLC.The fuzzy sets are defined by MF and rules so that the crisp values are processed into fuzzy values and then deffuzified.In this paper, triangular and trapezoid MFs are exploited.If there is a huge error in the output, is Gaussian, triangular or trapezoid MFs can be used.In this application, the output error is in acceptable range.The FLC have three inputs and one output whose MFs are defined as follows: Energies 2018, 11, 2953 where a, b, c, d, and m are constant parameters of MFs.The boundaries of MF are given in the creating and training process of FLC.Initializing of rules is performed by optimizing the rule parameters such as boundaries location and number of MFs using expert knowledge.The output boundaries from ANFIS forecasted values have huge impact on timely switching through MFs.The boundaries are defined by constant parameters of ( 14)-( 15) and thus, it is crucial to have a valid forecasted curve.The defuzzification is done by using centroid method to cover all possible area solutions, which is defined by: where µ j , S j are fuzzy output set and disposition of output function

Case 1: Daily Power Demand Curve
The required data for power prediction modeling is acquired from smart meter by recording daily samples with 15-min resolution for a three years' period.In this paper, the ANFIS forecasting system has 2 inputs and 1 output.The inputs are measured power demand from smart meter with 15-min resolution and one daily value for temperature.For training purposes, the samples are taken for last 3 years at the same measurement place and for the same customer.In three years, the smart meter has recorded 105 120 samples of power demand with 15-min resolution.The training datasets consist of 100,000 and testing dataset of 5120 samples, respectively.The average error through 2 training epochs is around 1.39%.Three rules have been created and the defuzzification method is weighted as average based on the Sugeno-type model.The training parameters of ANFIS are provided in Table 2. Figures 10 and 11 shows the training results.By using the proposed ANFIS-based scheme, the system output shows smaller power demand than actual measured values.So, there will be some deviations in calculating needed energy for peak load.
For the training process of ANFIS is used bigger set of data for precision purposes.A data set including 5120 samples is used just to check overall error of trained ANFIS system.Particular values are based on 15 min readout from AMR/AMM system from the smart meters of the discussed customer.Data are taken from one date to another achieving 1000 data writings, and from there second data set for testing.Results with changing training and testing data sets are not considered in paper due to space limitations, but it affects overall error results significantly.If training data set covers one year of measurement (345.60 samples) ANFIS system is accurate enough to recognize sections, as presented in Figure 9 in manuscript.Error results are significantly worse if the training data set is smaller than one year.

Case 2: Daily PV Plant Energy Generation
In this case, as mentioned above, the acquired data for PV generation have been gathered from smart meter between DN and PV.The ANFIS has three inputs and one output.The inputs are

Case 2: Daily PV Plant Energy Generation
In this case, as mentioned above, the acquired data for PV generation have been gathered from smart meter between DN and PV.The ANFIS has three inputs and one output.The inputs are measured generated power from smart meter with 15-min resolution, daily sun irradiance, and daily temperature.The output is the next day daily power demand.For training purposes, these samples are obtained from the last one year at same measurement place for same PV plant without changing installation configuration.In one year, the available dataset includes 35,040 samples of power demand with 15-min resolution.The inputs for training consists of 30,000 samples, and 5040 samples have been used for testing.The average error through two training epochs is around 1.1%.The defuzzification method is weighted as average based on the Sugeno decision type.Based on the results, the calculated energy amount that is required for peak load is smaller than measured generated energy (Figure 12).are obtained from the last one year at same measurement place for same PV plant without changing installation configuration.In one year, the available dataset includes 35,040 samples of power demand with 15-min resolution.The inputs for training consists of 30,000 samples, and 5040 samples have been used for testing.The average error through two training epochs is around 1.1%.The defuzzification method is weighted as average based on the Sugeno decision type.Based on the results, the calculated energy amount that is required for peak load is smaller than measured generated energy (Figure 12).

Fuzzy Logic Controller
To control the switches, the IED is governed by FL-based algorithm which is trained according to the ANFIS output data.The FLC training data are obtained from load and generation, forecasted by ANFIS, the sample ordinal number from clock and the season from digital calendar.
The decision type is Mamdani and based on output MF, there is a small chance for output to be uncertain in term of switching sequences 1 or 2 which result in minimal amount of space for error, not switching when needed.The structure of the proposed FLC is illustrated in Figure 13.The input parameters for FLC are obtained by online measurement system so that the values taken by the devices are explained in Section 6.The FLC training is done in an offline procedure based on the outputs from ANFIS 1 and AFNIS 2 explained in Section 4.1.,and therefore, the switching is planned as day-ahead.

Fuzzy Logic Controller
To control the switches, the IED is governed by FL-based algorithm which is trained according to the ANFIS output data.The FLC training data are obtained from load and generation, forecasted by ANFIS, the sample ordinal number from clock and the season from digital calendar.
The decision type is Mamdani and based on output MF, there is a small chance for output to be uncertain in term of switching sequences 1 or 2 which result in minimal amount of space for error, not switching when needed.The structure of the proposed FLC is illustrated in Figure 13.The input parameters for FLC are obtained by online measurement system so that the values taken by the devices are explained in Section 6.The FLC training is done in an offline procedure based on the outputs from ANFIS 1 and AFNIS 2 explained in Section 4.1, and therefore, the switching is planned as day-ahead.

Simulation Results
In this section, to show the effectiveness of the proposed peak power shaving/curtailment method, the study system shown in Figure 1 (whose parameters are presented in Table 3) is modeled in MATLAB/Simulink environment for offline digital time-domain software simulations where different scenarios are considered.The FLC is a real-time component of the proposed solution according to operation on site and the ANFIS is conducted on measured data after the time period of one day.

Simulation Results
In this section, to show the effectiveness of the proposed peak power shaving/curtailment method, the study system shown in Figure 1 (whose parameters are in Table 3) is modeled in MATLAB/Simulink environment for offline digital time-domain software simulations where different scenarios are considered.The FLC is a real-time component of the proposed solution according to operation on site and the ANFIS is conducted on measured data after the time period of one day.

Case Study
As illustrated in Figure 1, the simulated system includes three parts: PV+BESS, customer, and DN.The generation capacity of PV plant is 10 kWp, customer have minimum 10 kW power demand, and the BESS has C P = 54 kWh.Simulation time is 10 s by steps of 0.1 s, to simulate the system in 96 samples.When simulation starts, the sun irradiation and temperature are guiding the PV to generate electrical energy independent to BESS or DN.The BESS is set to SoC = 1% and thus, the starting point for the energy needed for peak load is equal to the forecasted amount of generated energy.A variable load is simulated and set to follow the measured load curve from Figure 9 and the boundaries are set according to Table 4.The required boundaries for FLC training are gathered by analyzing Figure 14.The data presented in Table 4 and the forecasted power demand from Figure 14 are taken to create the FLC algorithm and then it will be uploaded to IED (Figures 1 and 13).After running simulations using real measured data, the obtained results are presented in Figure 15 and Table 4.   4 presents a clear insight about effectiveness of the proposed method for load peak reduction.Saving in power and energy are 2 kW and 118.50 kWh, respectively.Considering the scale of the modeled study system, this is a huge saving according to leased power.Simulation started with SoC = 1% for BESS, and thereafter, PV generates almost 60 kWh.Therefore, the SoC of BESS after peak reduction is 45.15% (24.38 kWh).This brings the entire model to new refreshed start position for the next day round with more capacity to count on.Figure 16 shows the steady SoC curve from BESS in the switching moment, compared to the BESS current flow and DN voltage.Table 4 presents a clear insight about effectiveness of the proposed method for load peak reduction.Saving in power and energy are 2 kW and 118.50 kWh, respectively.Considering the scale of the modeled study system, this is a huge saving according to leased power.Simulation started with SoC = 1% for BESS, and thereafter, PV generates almost 60 kWh.Therefore, the SoC of BESS after peak reduction is 45.15% (24.38 kWh).This brings the entire model to new refreshed start position for the    Based on the obtained simulation results, the BESS does not cause any threat from DSO for the voltage quality of the customer.This is due to passive and fast involvement of batteries in the voltage conditions of network-customer relationship.It also reveals that with right algorithm and dimensioned PV plant, the BESS can provide reasonable solutions for the peak power shaving/curtailment problem in particular cases.

Comparison with Other Reported Techniques
In this section, the simulation results for the proposed peak power curtailment method is compared with two reported techniques [29,30].To provide a fair comparison, all of the aggregated curves are reduced to 24 h, time period (Figures 17 and 18).The forecasted curves are not compared due to different obtained results between the proposed method and previously-reported techniques.Also, Table 5 presents the comparative results and Figures 17 and 18 illustrate the comparison of all methods for the reduced power and SoC curves.When the proposed method is compared with [29,30], we define an index to calculate the percentage of decrement in peak power that is defined as:  Based on the obtained simulation results, the BESS does not cause any threat from DSO for the voltage quality of the customer.This is due to passive and fast involvement of batteries in the voltage conditions of network-customer relationship.It also reveals that with right algorithm and dimensioned PV plant, the BESS can provide reasonable solutions for the peak power shaving/curtailment problem in particular cases.

Comparison with Other Reported Techniques
In this section, the simulation results for the proposed peak power curtailment method is compared with two reported techniques [29,30].To provide a fair comparison, all of the aggregated curves are reduced to 24 h, time period (Figures 17 and 18).The forecasted curves are not compared due to different obtained results between the proposed method and previously-reported techniques.Also, Table 5 presents the comparative results and Figures 17 and 18 illustrate the comparison of all methods for the reduced power and SoC curves.When the proposed method is compared with [29,30], we define an index to calculate the percentage of decrement in peak power that is defined as: J P = P max_old − P max_new P max_old (17) where P max_old is maximum load without the proposed method applied on system, and P max_new is maximum load using the proposed method applied on system.It can be obviously observed from the presented results that the proposed method has better performance for peak power curtailment (more than twice J P index) in contrast with the reported techniques [30,31].This superiority and inherent benefit is a consequence of using different technologies in one purpose and moreover, and taking the advantage of combining of ANFIS, FL, RERs and BESS in a new hybrid configuration.However, the optimization/optimal sizing of the system components is still an interesting field of investigation for researchers [27].

State of Charge [%]
Figure 18.Aggregated results from [30,31] and this paper regarding battery SoC.

Experimental Results
The proposed method has been experimentally tested on a real-life practical PV power plant (Figures 19) with added BESS whose parameters are presented in Tables 5 and 6.The PV plant consists of two PV strings that each have 10 panels connected with two separate maximum power point tracking (MPPT) inputs on inverters.The total number of PV panels is 40 which generates about 10 kW output power.An electrical cabinet is located under roof of the house visible from outside, where the inverters are also visibly located.The smart meter between the PV and DN is located near the house entrance, one floor down from the inverter position.In the cabinet, in addition to the smart meter, a line breaker is included that is suitable for remote control.Originally, the BESS has not been included in the installation of the PV plant.Thus, for experiment purposes, it is required to install ESS, two switches and IED (Figure 20).The Installation has been done between upper floor where the electrical cabinet and inverter have been installed, and down floor where the smart meter and line breaker have been included.The described disposition of components and PV plant are depicted in Figure 19.

State of Charge [%]
Figure 18.Aggregated results from [30,31] and this paper regarding battery SoC.

Experimental Results
The proposed method has been experimentally tested on a real-life practical PV power plant (Figures 19) with added BESS whose parameters are presented in Tables 5 and 6.The PV plant consists of two PV strings that each have 10 panels connected with two separate maximum power point tracking (MPPT) inputs on inverters.The total number of PV panels is 40 which generates about 10 kW output power.An electrical cabinet is located under roof of the house visible from outside, where the inverters are also visibly located.The smart meter between the PV and DN is located near the house entrance, one floor down from the inverter position.In the cabinet, in addition to the smart meter, a line breaker is included that is suitable for remote control.Originally, the BESS has not been included in the installation of the PV plant.Thus, for experiment purposes, it is required to install ESS, two switches and IED (Figure 20).The Installation has been done between upper floor where the electrical cabinet and inverter have been installed, and down floor where the smart meter and line breaker have been included.The described disposition of components and PV plant are depicted in Figure 19.Aggregated results from [30,31] and this paper regarding battery SoC.

Experimental Results
The proposed method has been experimentally tested on a real-life practical PV power plant (Figure 19) with added BESS whose parameters are presented in Tables 5 and 6.The PV plant consists of two PV strings that each have 10 panels connected with two separate maximum power point tracking (MPPT) inputs on inverters.The total number of PV panels is 40 which generates about 10 kW output power.An electrical cabinet is located under roof of the house visible from outside, where the inverters are also visibly located.The smart meter between the PV and DN is located near the house entrance, one floor down from the inverter position.In the cabinet, in addition to the smart meter, a line breaker is included that is suitable for remote control.Originally, the BESS has not been included in the installation of the PV plant.Thus, for experiment purposes, it is required to install ESS, two switches and IED (Figure 20).The Installation has been done between upper floor where the electrical cabinet and inverter have been installed, and down floor where the smart meter and line breaker have been included.The described disposition of components and PV plant are depicted in Figure 19.Details of the additional equipment acquired and installed are as follows: (1) BESS-APC SMART Uninterruptable Power Supply (UPS) DP 1000 (used for energy storage function): with 10 kW output power (Figure 18e).The available UPS had already installed DC/AC inverter.So, there was no need for additional equipment regarding battery management.UPS was made in year 2004 but the batteries were not saturated due to firm housing and storing.
(2) Line breakers-2xHAGER H3 160 (used for remote switching): The mentioned line breaker is under IEC 60947-2 standard for monitoring and secondary auxiliary for control (Figure 18f).
(3) IDE (Laptop HP 250 G6): For FLC role base and ANFIS forecasting system, Arduino UNO R3, current sensor, voltage sensor, ENC28J60 network module, ZYXEL 300 mbps Wi-Fi router for data acquisition, and line breaker remote controller (Figure 19).Details of the additional equipment acquired and installed are as follows: (1) BESS-APC SMART Uninterruptable Power Supply (UPS) DP 1000 (used for energy storage function): with 10 kW output power (Figure 18e).The available UPS had already installed DC/AC inverter.So, there was no need for additional equipment regarding battery management.UPS was made in year 2004 but the batteries were not saturated due to firm housing and storing.(2) Line breakers-2xHAGER H3 160 (used for remote switching): The mentioned line breaker is under IEC 60947-2 standard for monitoring and secondary auxiliary for control (Figure 18f).( 3) IDE (Laptop HP 250 G6): For FLC role base and ANFIS forecasting system, Arduino UNO R3, current sensor, voltage sensor, ENC28J60 network module, ZYXEL 300 mbps Wi-Fi router for data acquisition, and line breaker remote controller (Figure 19).Details of the additional equipment acquired and installed are as follows: (1) BESS-APC SMART Uninterruptable Power Supply (UPS) DP 1000 (used for energy storage function): with 10 kW output power (Figure 18e).The available UPS had already installed DC/AC inverter.So, there was no need for additional equipment regarding battery management.UPS was made in year 2004 but the batteries were not saturated due to firm housing and storing.
(2) Line breakers-2xHAGER H3 160 (used for remote switching): The mentioned line breaker is under IEC 60947-2 standard for monitoring and secondary auxiliary for control (Figure 18f).
(3) IDE (Laptop HP 250 G6): For FLC role base and ANFIS forecasting system, Arduino UNO R3, current sensor, voltage sensor, ENC28J60 network module, ZYXEL 300 mbps Wi-Fi router for data acquisition, and line breaker remote controller (Figure 19).For FLC design and ANFIS training, MATLAB 2017a software has been used and all decision calculations and Java programming/application has been developed in Eclipse LUNA 4.4.2.Java application, and laptop Wi-Fi has been used for listening IP address where Arduino UNO R3 was placing measured data.All mentioned components are installed according to single line diagram presented in Figure 21.For FLC design and ANFIS training, MATLAB 2017a software has been used and all decision calculations and Java programming/application has been developed in Eclipse LUNA 4.4.2.Java application, and laptop Wi-Fi has been used for listening IP address where Arduino UNO R3 was placing measured data.All mentioned components are installed according to single line diagram presented in Figure 21.The experiment has been run on 21 August 2017.According to the procedure presented in Section 5 where is similar case study is examined, all needed preparations have been done in the laboratory, including parameterization of IDE (communication, Arduino-line breaker, program loading into Arduino motherboard, Wi-Fi communication setup, ANFIS-based forecasted load and PV power generation for next day, and FLC setup according to forecasted data).After laboratory work, the setup has begun on field before starting on 21 August 2017, so, the input signals from current and voltage transformers (CT and VT) can be taken into consideration to control the line breaker.At the start of 21 August 2017, Arduino has started collecting data giving information to FLC that has been previously modelled in laptop via Wi-Fi, and gathering output data from FLC via Wi-Fi.Arduino controls the line breakers according to the signals given from FLC and the proposed method is realized.The forecasted results for experiment day are illustrated in Figure 22.From Figure 22, it can be clearly concluded that the generated power will not be sufficient for recharging the BESS after peak curtailment, if the BESS takes the entire energy demand on itself.So, some optimizations shall be done before conducting the experiment.For this experiment, the SoC of the BESS is 100% and the power generation should be enough for recharging part of the spent energy from BESS.The goal is to curtail the load peak, but not discharging the BESS to SoC = 0%.Instead, it is curtailing the peak load with equal energy to generated one.In this case, the SoC will be close to 99% at the end of day.The experimental results are provided in Table 7 and Figure 23.It can be observed from Table 7 that The experiment has been run on 21 August 2017.According to the procedure presented in Section 5 where is similar case study is examined, all needed preparations have been done in the laboratory, including parameterization of IDE (communication, Arduino-line breaker, program loading into Arduino motherboard, Wi-Fi communication setup, ANFIS-based forecasted load and PV power generation for next day, and FLC setup according to forecasted data).After laboratory work, the setup has begun on field before starting on 21 August 2017, so, the input signals from current and voltage transformers (CT and VT) can be taken into consideration to control the line breaker.At the start of 21 August 2017, Arduino has started collecting data giving information to FLC that has been previously modelled in laptop via Wi-Fi, and gathering output data from FLC via Wi-Fi.Arduino controls the line breakers according to the signals given from FLC and the proposed method is realized.The forecasted results for experiment day are illustrated in Figure 22.From Figure 22, it can be clearly concluded that the generated power will not be sufficient for recharging the BESS after peak curtailment, if the BESS takes the entire energy demand on itself.So, some optimizations shall be done before conducting the experiment.For this experiment, the SoC of the BESS is 100% and the power generation should be enough for recharging part of the spent energy from BESS.The goal is to curtail the load peak, but not discharging the BESS to SoC = 0%.Instead, it is curtailing the peak load with equal energy to generated one.In this case, the SoC will be close to 99% at the end of day.The experimental results are provided in Table 7 and Figure 23.It can be observed from Table 7 that the PV generated energy has completely recharged the BESS and even more energy is injected into DN.The customers' maximum power demand is under maximum battery capacity and therefore, the BESS is able to take load on itself releasing load from DN.Thus, the smart meter didn't record the load higher than 6.16 kW.There is more place for more detailed optimization of FLC for the sake of spending entire PV generated energy on consumer's load demand, instead of injecting it to DN. Anyway, the proposed method has proven to effectively manage the available stored energy for peak load curtailment in combination with PV plant.
Energies 2018, 11, x FOR PEER REVIEW 20 of 25 the PV generated energy has completely recharged the BESS and even more energy is injected into DN.The customers' maximum power demand is under maximum battery capacity and therefore, the BESS is able to take load on itself releasing load from DN.Thus, the smart meter didn't record the load higher than 6.16 kW.There is more place for more detailed optimization of FLC for the sake of spending entire PV generated energy on consumer's load demand, instead of injecting it to DN. Anyway, the proposed method has proven to effectively manage the available stored energy for peak load curtailment in combination with PV plant.the PV generated energy has completely recharged the BESS and even more energy is injected into DN.The customers' maximum power demand is under maximum battery capacity and therefore, the BESS is able to take load on itself releasing load from DN.Thus, the smart meter didn't record the load higher than 6.16 kW.There is more place for more detailed optimization of FLC for the sake of spending entire PV generated energy on consumer's load demand, instead of injecting it to DN. Anyway, the proposed method has proven to effectively manage the available stored energy for peak load curtailment in combination with PV plant.Table 8 presents the readout from the smart meter and customer measured consumption.Monitoring was conducted for 24 h on 21 August 2017 using the proposed method described in the previous sections.Overall results are summarized in Table 7. Collected data shows improvement in reduced engaged power in the sampled 24 h.Continuation of this peak curtailment setup is conditioned by constant calculation of sunlight and generated energy, SoC of BESS, and customer maximum power demand.These calculations are time consuming and computationally expensive.The sole purpose is to prove the proposed method's efficiency and that is achieved.

Conclusions
The interest in power peak management is always a popular topic and smart grid standards obligate power peak shaving/curtailment.The practicality of the optimization methods for forecasting and controlling DN is rapidly growing which brings its wide application.In this paper, we have proposed a new method based on ANFIS and fuzzy logic for power peak curtailment and smart power management using DERs/RERs and BESS.Simulation results revealed that the combination of different components offers a better solution.However, hybrid solutions have some limitations in the form of retraining ability, specific information requirements, and expert knowledge needed for its maintenance.The presented model was designed to easily extend to any type of DER/RER and BESS, customer or DN.It was observed that ANFIS and FLC are flexible components and easily adaptable to any new configuration situation.Also, by analyzing the results, comparing the proposed method with previously reported techniques, and performing experimental tests on a real-life practical distribution system, we conclude that the proposed method is effective and optimal for power peak curtailment.

Figure 1 .
Figure 1.The configuration, power and energy flow of the microgrid system.

Figure 1 .
Figure 1.The configuration, power and energy flow of the microgrid system.

Figure 3 .
Figure 3. SoC curve of BESS assembled used in case study.Figure 3. SoC curve of BESS assembled used in case study.

Figure 3 .
Figure 3. SoC curve of BESS assembled used in case study.Figure 3. SoC curve of BESS assembled used in case study.

Figure 4 .
Figure 4. PV I-V and P-V curve at 25 °C and different sun irradiance.

Figure 5 .
Figure 5. 10 kW customers daily power demand curve based on smart meter data.

Figure 4 .
Figure 4. PV I-V and P-V curve at 25 • C and different sun irradiance.

Figure 4 .
Figure 4. PV I-V and P-V curve at 25 °C and different sun irradiance.

Figure 5 .
Figure 5. 10 kW customers daily power demand curve based on smart meter data.Figure 5. 10 kW customers daily power demand curve based on smart meter data.

Figure 5 .
Figure 5. 10 kW customers daily power demand curve based on smart meter data.Figure 5. 10 kW customers daily power demand curve based on smart meter data.

( 1 ) 25 ( 1 )
Calculating SoC of BESS based on PV output forecasted from daily input data, and forecasted customer's daily consumption curve from which load peak is calculated.(2) Calculating the left and right energy consumption value from peak load with given parameters and calculation step, and summing both.(3) Comparing with BESS capacity based on SoC.If not equal, go to Step 2. (4) Giving switch boundaries for training input for FLC.Energies 2018, 11, x FOR PEER REVIEW 7 of Calculating SoC of BESS based on PV output forecasted from daily input data, and forecasted customer`s daily consumption curve from which load peak is calculated.(2) Calculating the left and right energy consumption value from peak load with given parameters and calculation step, and summing both.(3) Comparing with BESS capacity based on SoC.If not equal, go to Step 2. (4) Giving switch boundaries for training input for FLC.

Figure 7 .
Figure 7. Flowchart of the proposed algorithm.

Figure 7 .
Figure 7. Flowchart of the proposed algorithm.

Figure 8 .
Figure 8. Calculation of customer's energy around load peak by adding energy left and right from load peak location.

Figure 8 .
Figure 8. Calculation of customer's energy around load peak by adding energy left and right from load peak location.

Energies 2018 ,
11,  x FOR PEER REVIEW 9 of 25 separate measured values from the smart meter: 15-min peak and 15-min energy.Converting peak demand to energy demand, from kW to kWh, is done by dividing kW with 4 to get kWh for that 15min period.The steps n and k are 15-min step left and right from peak location on timeline.One iteration is(11) for every n − 1, k + 1 and each iteration is subjected to this question that is the Cb equal to Ecustomer, peak?If yes, then the boundaries of switching sequence changes are given as Ppeak−n, and Ppeak+k.Basically, as soon as the smart meter records Ppeak−n, the IED closes the switch between PV+BESS and customer and opens the switch between DN and customer.This switch state gives no power and energy to the smart meter to record because entire consumption is loaded on BESS.In this situation, the PV is still working as recharging source for BESS, the SoC is at the calculated state, and the BESS is energy source until the IED changes the switching state back at Ppeak+k. even if SoC > 0%.So, the BESS is not fully discharged and load peak is not recorded by DSO smart meter.Ppeak−n, and Ppeak+k are two MFs to FLC in role of IEDs.Using FL, as switching driving method, it may initiate switching at local load peak and not at global during real time recording.As can be observed from Figure9, there is a noticeable trend for localized peaks and for global peaks.Many local peaks happen during the day, but the global maximum is around samples 30-50 along with 70-85.This makes one more input to FLC switching algorithm with two membership functions (MFs).The input of the sample number is usable if and only if the FLC knows which season of the year currently is: winter, spring, summer, or autumn.The need for these information comes from different possible global maxima (Figure8).

Figure 9 .
Figure 9. Average load curve for all four seasons.

Figure 9 .
Figure 9. Average load curve for all four seasons.

Figure 10 .
Figure 10.(a) ANFIS forecast system architecture for power load forecast.(b) Surface for ANFIS's two inputs and one output, (c) ANFIS forecast system architecture for power generation forecast, (d) Surface for ANFIS's three inputs and one output.

Figure 11 .
Figure 11.Example customer (10 kW) forecasted for 1 day-ahead compared with measured data from a smart meter.Red: measured, blue: forecasted.

Figure 10 .Figure 10 .
Figure 10.(a) ANFIS forecast system architecture for power load forecast.(b) Surface for ANFIS's two inputs and one output, (c) ANFIS forecast system architecture for power generation forecast, (d) Surface for ANFIS's three inputs and one output.

Figure 11 .
Figure 11.Example customer (10 kW) forecasted for 1 day-ahead compared with measured data from a smart meter.Red: measured, blue: forecasted.

Figure 11 .
Figure 11.Example customer (10 kW) forecasted for 1 day-ahead compared with measured data from a smart meter.Red: measured, blue: forecasted.

Figure 12 .
Figure 12.Photovoltaic Plant (10 kW) power generation forecast for 1 day-ahead compared with measured data from a smart meter.Violet: measured, green: forecasted.

Figure 12 .
Figure 12.Photovoltaic Plant (10 kW) power generation forecast for 1 day-ahead compared with measured data from a smart meter.Violet: measured, green: forecasted.

Figure 13 .
Figure 13.FLC with inputs and output architecture.

Figure 13 .
Figure 13.FLC with inputs and output architecture.

Figure 14 .
Figure 14.Designed case study for defining boundaries and energy for load peak.

Figure 14 .
Figure 14.Designed case study for defining boundaries and energy for load peak.
with more capacity to count on.Figure16shows the steady SoC curve from BESS in the switching moment, compared to the BESS current flow and DN voltage.

Figure 14 .
Figure 14.Designed case study for defining boundaries and energy for load peak.

Figure 15 .
Figure 15.Obtained results from the smart meter after applying the proposed solution.

Figure 15 . 25 Figure 16 .
Figure 15.Obtained results from the smart meter after applying the proposed solution.Energies 2018, 11, x FOR PEER REVIEW 15 of 25

Figure 16 .
Figure 16.Current and SoC compared to DN voltage.

Figure 19 .
Figure 19.(a) PV plant on house, (b) electrical cabinet and inverter, (c) electrical cabinet for AC installation, (d) smart meter with line breaker, (e) smart UPS, and (f) line breaker.

Figure 19 .
Figure 19.(a) PV plant on house, (b) electrical cabinet and inverter, (c) electrical cabinet for AC installation, (d) smart meter with line breaker, (e) smart UPS, and (f) line breaker.

Figure 19 .
Figure 19.(a) PV plant on house, (b) electrical cabinet and inverter, (c) electrical cabinet for AC installation, (d) smart meter with line breaker, (e) smart UPS, and (f) line breaker.

Figure 20 .
Figure 20.The IED assembled with Arduino UNO R3 and additional components, and laboratory environment for ANFIS training and fuzzy controller design.

Figure 20 .
Figure 20.The IED assembled with Arduino UNO R3 and additional components, and laboratory environment for ANFIS training and fuzzy controller design.

Figure 21 .
Figure 21.Single line diagram of the experiment.

Figure 21 .
Figure 21.Single line diagram of the experiment.

Figure 22 .
Figure 22.Forecasted daily power generation and load for the experiment day.

Figure 23 .
Figure 23.Experiment results recorded from smart meter and consumer measurement via Arduino Uno.

Figure 22 .
Figure 22.Forecasted daily power generation and load for the experiment day.

Figure 22 .
Figure 22.Forecasted daily power generation and load for the experiment day.

Figure 23 .
Figure 23.Experiment results recorded from smart meter and consumer measurement via Arduino Uno.

Figure 23 .
Figure 23.Experiment results recorded from smart meter and consumer measurement via Arduino Uno.

Table 1 .
Energy Generation of 10 Kw PV before and after longest day in year.

Table 1 .
Energy Generation of 10 Kw PV before and after longest day in year.

Table 2 .
The Parameters of trained ANFISs.

Table 3 .
Parameters of the study system.

Table 3 .
Parameters of the study system.

Table 4 .
Calculated values and boundaries for FLC training according to Figure14.

Table 4 .
Calculated values and boundaries for FLC training according to Figure14.

Table 8 .
Readout from the smart meter after the method application at the customer.Used for decimals.