Fuzzy Control for Smart PV-Battery System Management to Stabilize Grid Voltage of 22 kV Distribution System in Thailand

This paper presents a fuzzy logic based algorithm developed to bring smart functionality to an ordinary PV-battery system in order to maintain the grid voltage stability of the 22 kV distribution system in Thailand. This research focuses on minimizing grid voltage fluctuations by converting a typical PV system into a smart PV-battery system (SPVs-BSS). A SPVs-BSS will be able to control the electrical power from a PV system to maintain the grid voltage in case of unexpected events or emergencies. Grid support functions such as a variable reactive power control and active power control will be discussed, leading to strategies for charging and discharging the battery system in response to the status of grid voltage. Fuzzy Logic was used to develop this control algorithm, which is named the Voltage Stability Fuzzy Logic Algorithm (VSFL Algorithm). The methodology of this research consists of three parts. First, testing the grid inverter operated on grid support functions. Second, the VSFL algorithm was developed to manage both the grid inverter and the battery system. Third, a SPVs-BSS equipped with the VSFL algorithm was simulated by using DIgsilent PowerFactory software. Results showed that the SPVs-BSS equipped with the VSFL Algorithm successfully maintained grid voltage in target range.


Introduction
Nowadays the use of renewable energy in Thailand has grown significantly due to electrical demand and electrical market competition.Solar energy has great potential in Thailand.Photovoltaic (PV) power generation in Thailand is growing at a rapid rate, in part because in 2007 the government created an incentive in the form of an Adder (8 baht/kWh) for PV power plants.That Adder was followed by a Feed-In Tariff (6.5 baht/kWh) [1].The government is providing incentives not only large scale solar power plants but also for small scale PV rooftop systems of 1-10 kW capacity, which are spreading all over Thailand.In 2018, the total capacity of PV systems in Thailand is greater than 3 GW [2] as shown in Figure 1.PV systems can generally be divided into two groups: ground installations and rooftop units.The systems are connected to the grid at distribution level (22 kV or Lower) or transmission level (115 kV) [3].Normally traditional distribution networks are designed with one-way power flow from a point of high voltage (or medium voltage) to a point of low voltage but in the new concept of modernized distribution networks (Smart Grids), the voltage at the end of the load can be greater than the feeder supply voltage [4][5][6][7][8][9].This characteristic of the feeder is due to the impact of grid connected PV systems.The increasing number of PV systems connected to Low Voltage Distribution Systems (LVDS) has some negative impacts on LVDS such as lower power quality (Voltage variations, frequency variations, harmonics distortion, etc.) and less power control (Power factor, Power fluctuation) [10][11][12][13][14][15][16].If the PV generation is greater than the local demand at the point of common coupling (PCC), the excess power from PV inverters may produce reverse power flow in the feeder, which would have a negative impact on the LVDS.Grid voltage rise is the major problem when electricity is fed back to the grid by PV systems.According to the interconnection code of PEA, the acceptable range of voltage in the distribution is ±10% of nominal voltage [17].80% of PV systems are connected to the LVDS.Voltage rise is major problem of this extensive integration of PV systems.Many countries have experienced problems from having a high share of PV systems integrated to LVDS.The problem has occurred notably in those countries, which promoted electricity production from renewable sources and then enhanced their installation capacity to Giga-Watt level for examples, Germany, Australia, Italy, Spain Switzerland, Belgium, China and Japan [18][19][20][21][22][23][24].Without proper, prompt solutions for these problems, electricity production from renewable sources will not succeed.In light of that problem, the current study seeks to mitigate voltage fluctuation caused by high PV system penetration by converting a typical PV system into a smart PV system.The concept of a smart PV system in this research refers to a battery storage system being integrated with a PV system and improvement of the inverter's ability to maintain grid voltage stability [25,26].Having a control algorithm also important for a smart PV system and therefore this research will develop a control algorithm using Fuzzy Logic.Fuzzy logic is an effort to represent the human reasoning methods.It can control a complicated system that would be hard or problematic to control by any others method.Fuzzy control algorithm is popularly used to apply throughout many aspects for modern electrical system.The purpose of the algorithm development in this research is to maintain the distribution voltage into the desired range (0.96 p.u.-1.06 p.u.).The typical 22 kV distribution system integrated with a typical 8 MW PV power plant in the northeast of Thailand also has the problem on voltage rise when a high amount of active power production from the PV system fed to the distribution system.This case will be studied in order to find the robust solution for maintaining the distribution voltage into the target range by controlling two entities, the battery power management and inverter power management.The operation of a smart PV system equipped with a control algorithm will be studied for distribution voltage stability.A smart PV system empowered with a proper algorithm is a solution to reach the Thailand target of 6000 MW PV capacity installation in 2036.This characteristic of the feeder is due to the impact of grid connected PV systems.The increasing number of PV systems connected to Low Voltage Distribution Systems (LVDS) has some negative impacts on LVDS such as lower power quality (Voltage variations, frequency variations, harmonics distortion, etc.) and less power control (Power factor, Power fluctuation) [10][11][12][13][14][15][16].If the PV generation is greater than the local demand at the point of common coupling (PCC), the excess power from PV inverters may produce reverse power flow in the feeder, which would have a negative impact on the LVDS.Grid voltage rise is the major problem when electricity is fed back to the grid by PV systems.According to the interconnection code of PEA, the acceptable range of voltage in the distribution is ±10% of nominal voltage [17].80% of PV systems are connected to the LVDS.Voltage rise is major problem of this extensive integration of PV systems.Many countries have experienced problems from having a high share of PV systems integrated to LVDS.The problem has occurred notably in those countries, which promoted electricity production from renewable sources and then enhanced their installation capacity to Giga-Watt level for examples, Germany, Australia, Italy, Spain Switzerland, Belgium, China and Japan [18][19][20][21][22][23][24].Without proper, prompt solutions for these problems, electricity production from renewable sources will not succeed.In light of that problem, the current study seeks to mitigate voltage fluctuation caused by high PV system penetration by converting a typical PV system into a smart PV system.The concept of a smart PV system in this research refers to a battery storage system being integrated with a PV system and improvement of the inverter's ability to maintain grid voltage stability [25,26].Having a control algorithm also important for a smart PV system and therefore this research will develop a control algorithm using Fuzzy Logic.Fuzzy logic is an effort to represent the human reasoning methods.It can control a complicated system that would be hard or problematic to control by any others method.Fuzzy control algorithm is popularly used to apply throughout many aspects for modern electrical system.The purpose of the algorithm development in this research is to maintain the distribution voltage into the desired range (0.96 p.u.-1.06 p.u.).The typical 22 kV distribution system integrated with a typical 8 MW PV power plant in the northeast of Thailand also has the problem on voltage rise when a high amount of active power production from the PV system fed to the distribution system.This case will be studied in order to find the robust solution for maintaining the distribution voltage into the target range by controlling two entities, the battery power management and inverter power management.The operation of a smart PV system equipped with a control algorithm will be studied for distribution voltage stability.A smart PV system empowered with a proper algorithm is a solution to reach the Thailand target of 6000 MW PV capacity installation in 2036.

Research Methodology
The research methodology in this research can be divided into three steps.First, the grid inverter was tested in electrical laboratory at the School of Renewable Energy Technology (SERT) at Naresuan University.The grid inverter is tested for its grid support functions (active and reactive power control), while the BESS is tested for its charge/discharge impacts.The results of these tests show that both components have the ability to affect grid voltage stability in the various expected ways and have the potential to be used and managed in combination to maintain overall grid voltage stability.Next an algorithm, called the VSFL Algorithm, is developed to manage these various capabilities of the grid inverter and battery storage system of a smart PV system in combination, using fuzzy logic.Finally, the VSFL Algorithm is tested by using DIgsilent PowerFactory software (research license of Naresuan University, School of Renewable Energy Technology, Thailand) to run two simulations.The first test simulates a typical PV system connected to a 22 kV distribution system and the second test simulates a smart PV system operating with the VSFL Algorithm, also connected to a 22 kV distribution system.
The aim of running the two simulations is to confirm whether the algorithm, by managing the added a BESS, will indeed be able to maintain grid voltage stability.All these steps of the research methodology are shown in Figure 2.

Research Methodology
The research methodology in this research can be divided into three steps.First, the grid inverter was tested in electrical laboratory at the School of Renewable Energy Technology (SERT) at Naresuan University.The grid inverter is tested for its grid support functions (active and reactive power control), while the BESS is tested for its charge/discharge impacts.The results of these tests show that both components have the ability to affect grid voltage stability in the various expected ways and have the potential to be used and managed in combination to maintain overall grid voltage stability.Next an algorithm, called the VSFL Algorithm, is developed to manage these various capabilities of the grid inverter and battery storage system of a smart PV system in combination, using fuzzy logic.Finally, the VSFL Algorithm is tested by using DIgsilent PowerFactory software (research license of Naresuan University, School of Renewable Energy Technology, Thailand) to run two simulations.The first test simulates a typical PV system connected to a 22 kV distribution system and the second test simulates a smart PV system operating with the VSFL Algorithm, also connected to a 22 kV distribution system.
The aim of running the two simulations is to confirm whether the algorithm, by managing the added a BESS, will indeed be able to maintain grid voltage stability.All these steps of the research methodology are shown in Figure 2.

Test the Grid Inverter for Grid Support Functions
Grid inverter capability was tested in electrical laboratory on grid support functions and safety function to understand the process of maintaining the distribution voltage into the acceptable range.The main components of SERT's electrical laboratory consisted of, regenerative grid simulator, battery storage, RLC electronic load and measurement system as shown in Figure 3.

Test the Grid Inverter for Grid Support Functions
Grid inverter capability was tested in electrical laboratory on grid support functions and safety function to understand the process of maintaining the distribution voltage into the acceptable range.The main components of SERT's electrical laboratory consisted of, regenerative grid simulator, battery storage, RLC electronic load and measurement system as shown in Figure 3.The electrical laboratory can simulate the parameters in order to simulate real grid environments and conditions.The regenerative grid simulator can create a need for rigorous regulation testing to standard such IEEE 1547, IEC 610003-15 and IEC 62116.The grid simulator allows users to vary relevant parameters such as phase angle, voltage amplitude, voltage drops in either single or three phase modes.Moreover, unbalanced three phase conditions can easily be simulated.The function of grid support of inverter will be tested and simulated in this laboratory.

Voltage Rise Caused by PV System
As described in the introduction, main problem of high penetration PV system integrated within the distribution system is voltage rise, it may over than over limit of the country requirement.For clearly understand a simplified two-bus system integrated with a PV system is presented in Figure 4. Consideration,  ℎ and  ℎ are the Thevenin impedance and the Thevenin Voltage.Where,   and   are the net feed current and net apparent power, respectively.  is the PV feed in current and   is the load current. is real power and  is reactive power.  is the voltage at point of common coupling (PCC).The net feed-in current (  ) can be calculated as Equation (1) [27].
=   −   = (     ) = (  −   ℎ ) (2) The voltage at PCC can be calculated as Equation (3).The electrical laboratory can simulate the parameters in order to simulate real grid environments and conditions.The regenerative grid simulator can create a need for rigorous regulation testing to standard such IEEE 1547, IEC 610003-15 and IEC 62116.The grid simulator allows users to vary relevant parameters such as phase angle, voltage amplitude, voltage drops in either single or three phase modes.Moreover, unbalanced three phase conditions can easily be simulated.The function of grid support of inverter will be tested and simulated in this laboratory.

Voltage Rise Caused by PV System
As described in the introduction, main problem of high penetration PV system integrated within the distribution system is voltage rise, it may over than over limit of the country requirement.For clearly understand a simplified two-bus system integrated with a PV system is presented in Figure 4.The electrical laboratory can simulate the parameters in order to simulate real grid environments and conditions.The regenerative grid simulator can create a need for rigorous regulation testing to standard such IEEE 1547, IEC 610003-15 and IEC 62116.The grid simulator allows users to vary relevant parameters such as phase angle, voltage amplitude, voltage drops in either single or three phase modes.Moreover, unbalanced three phase conditions can easily be simulated.The function of grid support of inverter will be tested and simulated in this laboratory.

Voltage Rise Caused by PV System
As described in the introduction, main problem of high penetration PV system integrated within the distribution system is voltage rise, it may over than over limit of the country requirement.For clearly understand a simplified two-bus system integrated with a PV system is presented in Figure 4. Consideration,  ℎ and  ℎ are the Thevenin impedance and the Thevenin Voltage.Where,   and   are the net feed current and net apparent power, respectively.  is the PV feed in current and   is the load current. is real power and  is reactive power.  is the voltage at point of common coupling (PCC).The net feed-in current (  ) can be calculated as Equation (1) [27].
=   −   = (     ) = (  −   ℎ ) (2) The voltage at PCC can be calculated as Equation (3).Consideration, Z th and U th are the Thevenin impedance and the Thevenin Voltage.Where, I n f and S n f are the net feed current and net apparent power, respectively.I PV is the PV feed in current and I L is the load current.P is real power and Q is reactive power.U PCC is the voltage at point of common coupling (PCC).The net feed-in current (I n f ) can be calculated as Equation (1) [27].
The voltage at PCC can be calculated as Equation (3).
Suppose that Z th = R th + jx th the U PCC can be written as Equation (4).Where, R th is resistance and X th is reactance.
= U Re + jU Im (5) where U Re and U Im are the real and imaginary parts of U PCC , respectively.The voltage magnitude can be calculated as Equation (6).
Therefore, the approximate voltage magnitude at PCC can be simplified as the Equation ( 7) [27].

Test Results of Grid Inverter
Grid support functions of grid inverter in this research was mainly focused on reactive and active power control depending on grid voltage as follow.

Reactive Power Control
Reactive power control is a commonly chosen tool for maintaining the distribution voltage within an acceptable range.When the distribution voltage is in a dangerous range (i.e., above or below the acceptable range of 0.9 Vn-1.10 Vn), the grid inverter and battery inverter have the ability to activate reactive power (either lagging or leading) to manipulate the grid voltage.Activating lagging reactive power will lower critically high grid voltage and activating leading reactive power will raise critically low grid voltage [28,29].The ability to control reactive power for the purpose of stabilizing voltage is an important resource and tool for network operators.Consequently, Thailand's Provincial Electricity Authority's (PEA) Power Network System Interconnection Code of 2016 (PEA grid code 2016) requires all PV systems to be able to supply not only active power but also reactive power to the distribution system.Specifically, the PEA grid code 2016 mandates the reactive power capabilities of PV system inverters depending on their electrical capacity.Inverters with a capacity of 500 kW or higher are required to be able to adjust their power factor (PF) between 0.90 lagging and 0.90 leading, while inverters with a capacity lower than 500 kW are required to be able to adjust their PF between 0.95 lagging and 0.95 leading.Given the PEA grid code 2016, the reactive power capabilities of grid inverters should be a dependable resource to network operators for maintaining the grid voltage within the acceptable range.For this reason, ability of grid inverter and battery pcs were tested in SERT's electrical laboratory according to reactive power control.The test results of the grid inverter and battery pcs on grid support function, reactive power control for maintaining the grid voltage are described below.The test results of reactive power control of grid inverter and battery PCS can be seen in Figure 5.
Figure 6 shows the operation of grid inverter on grid support function, when grid voltage was higher than normal voltage so bus voltage can be decreased by absorbing the reactive power.On the other hand, grid inverter and battery pcs provides the reactive power support in case of grid voltage is lower than the normal voltage (1 p.u. of Vn is 350 V) so the grid voltage can be increased.According to the Beginning of the test (Figure 6), grid voltage setting at the grid simulator was lower than Vn at 0.90 Vn, during this situation the grid inverter operated at the PF 0.90 lagging to inject reactive power for supporting and increasing the grid voltage to 0.95 Vn.At the middle of the test, the setting voltage same as nominal grid voltage, the grid inverter operated at the PF 1.At the end of the test, the grid voltage setting is higher than normal voltage at 1.09 Vn, this situation the inverter operates at PF 0.90 leading to absorb the reactive power.The behavior of the grid inverter during the test was the reactive power control depend on the grid voltage or a variable reactive power depending on the voltage Q (U) in PEA grid code 2016.

Active Power Control
Active power control depending on the grid voltage in this research, aims to control the power output of the grid inverter and battery PCS for maintaining gird voltage at the acceptable range of PEA requirements.The active power control is necessary for the grid operator in case of emergency such as grid voltage is higher than upper limit because of over active power fed to the grid.This case

Active Power Control
Active power control depending on the grid voltage in this research, aims to control the power output of the grid inverter and battery PCS for maintaining gird voltage at the acceptable range of PEA requirements.The active power control is necessary for the grid operator in case of emergency such as grid voltage is higher than upper limit because of over active power fed to the grid.This case

Active Power Control
Active power control depending on the grid voltage in this research, aims to control the power output of the grid inverter and battery PCS for maintaining gird voltage at the acceptable range of PEA requirements.The active power control is necessary for the grid operator in case of emergency such as grid voltage is higher than upper limit because of over active power fed to the grid.This case the grid inverter can automatically decrease the active power for keeping the grid voltage stability.According to PEA grid code 2016, the grid inverter requires to limit the active power from 1 p.u. to 0 p.u. with responsible time less than one minute per steps.

Algorithm Development
According to the problem of voltage rise due to over active power, which is produced from the PV system as mention in the introduction.After testing of grid connected inverter and analyzing advantages and disadvantages of both components, an algorithm operating with fuzzy logic, the VSFL Algorithm, was developed to greatly increase control of the grid inverter and battery storage system for grid voltage stability.Fuzzy Logic method (FLm), a flexible and powerful tool with much potential for electrical power systems, is similar to human beings' feelings and decision making processes.Fuzzy Logic control is a range to point or range-to-range control.Fuzzy Logic techniques is applied throughout many purposes [30][31][32].Fuzzy logic implementations involve three essential steps: the first is Fuzzification, this process to convert crisp values to fuzzy data using membership functions (MF), second is Inference process, to process MF within sets of rules or laws to develop the fuzzy output and third is Defuzzification [33], to determine the correct output.The output of FLm is derived from Fuzzifications of both input and output using the associated membership functions.The steps of algorithm are follows, Fuzzifications, Inference process and Defuzzification as shown in Figure 7.According to PEA grid code 2016, the grid inverter requires to limit the active power from 1 p.u. to 0 p.u. with responsible time less than one minute per steps.

Algorithm Development
According to the problem of voltage rise due to over active power, which is produced from the PV system as mention in the introduction.After testing of grid connected inverter and analyzing advantages and disadvantages of both components, an algorithm operating with fuzzy logic, the VSFL Algorithm, was developed to greatly increase control of the grid inverter and battery storage system for grid voltage stability.Fuzzy Logic method (FLm), a flexible and powerful tool with much potential for electrical power systems, is similar to human beings' feelings and decision making processes.Fuzzy Logic control is a range to point or range-to-range control.Fuzzy Logic techniques is applied throughout many purposes [30][31][32].Fuzzy logic implementations involve three essential steps: the first is Fuzzification, this process to convert crisp values to fuzzy data using membership functions (MF), second is Inference process, to process MF within sets of rules or laws to develop the fuzzy output and third is Defuzzification [33], to determine the correct output.The output of FLm is derived from Fuzzifications of both input and output using the associated membership functions.The steps of algorithm are follows, Fuzzifications, Inference process and Defuzzification as shown in Figure 7.The VSFL Algorithm is mainly focusing on maintaining the grid voltage of 22 kV distribution system into the target range (1.06 p.u.-0.96 p.u. of voltage).In the present situation, the distribution voltage is not in the desired range 0.96 p.u. (21.12 kV) to 1.06 p.u. (23.32 kV) when high amount of active power is fed to the distribution system or high load power consumption occur.A smart PVbattery system equipped with the VSFC Algorithm will operate for maintaining the grid voltage into the target range or close to the normal voltage (22 kV, 1.0 p.u.) as follow two steps, the first is battery power management and second is grid inverter power management.The VSFL Algorithm enables to maintain the grid voltage as shown in Figure 8.
The control sequence of the VSFL Algorithm starts with battery power management, later on the electrical power from a smart PV system will be managed by the grid inverter, in case of voltage is not in target range as follow.The VSFL Algorithm is mainly focusing on maintaining the grid voltage of 22 kV distribution system into the target range (1.06 p.u.-0.96 p.u. of voltage).In the present situation, the distribution voltage is not in the desired range 0.96 p.u. (21.12 kV) to 1.06 p.u. (23.32 kV) when high amount of active power is fed to the distribution system or high load power consumption occur.A smart PV-battery system equipped with the VSFC Algorithm will operate for maintaining the grid voltage into the target range or close to the normal voltage (22 kV, 1.0 p.u.) as follow two steps, the first is battery power management and second is grid inverter power management.The VSFL Algorithm enables to maintain the grid voltage as shown in Figure 8.
The control sequence of the VSFL Algorithm starts with battery power management, later on the electrical power from a smart PV system will be managed by the grid inverter, in case of voltage is not in target range as follow.

Battery Storage System Energy Management
BSSEM is very important for a grid modernization to provide many of pragmatisms such as load leveling, peak shaving, peak shifting and frequency and voltage stability control.BSSEM in this research mainly focused on grid voltage stability in 22 kV distribution system.In case of grid voltage at PCC is out of target ranges (0.96 p.u.-1.06 p.u. for this research), a smart PV system ordered the battery storage system (BSS) to maintain the grid voltage into acceptable ranges by charge and discharge electrical power of BSS.When the grid voltage is over, a smart PV system enabled BSS to absorb an electrical power by charging to the BSS.The objective function of this process to decrease the active power in the distribution system result to decrease the distribution voltage.The VSFC Algorithm enables to control the BSS in a smart PV system by charging and discharging strategies.

Grid Inverter Power Management
In case of the gird voltage value is out of the target range (0.96 p.u.-1.06 p.u. for this research) and battery storage system is not able to operate when battery already full capacity or battery already reach the minimum SOC.If the grid voltage value still out of the target range, the grid inverter of a smart PV system will operate on grid support functions, reactive power control and active power control to maintain the grid voltage stability of distribution system.Generally, if the grid voltage is over than over limit of target range, grid inverter is able to absorb the reactive power in the distribution system, purpose to decrease the grid voltage.On the other hand, in case of under voltage, the grid inverter will operate to inject the reactive power to the grid, purpose to increase the grid voltage in distribution system.In the worst case, even the grid inverter operates on reactive power control but the grid voltage value is still out of range.

Battery Storage System Energy Management
BSSEM is very important for a grid modernization to provide many of pragmatisms such as load leveling, peak shaving, peak shifting and frequency and voltage stability control.BSSEM in this research mainly focused on grid voltage stability in 22 kV distribution system.In case of grid voltage at PCC is out of target ranges (0.96 p.u.-1.06 p.u. for this research), a smart PV system ordered the battery storage system (BSS) to maintain the grid voltage into acceptable ranges by charge and discharge electrical power of BSS.When the grid voltage is over, a smart PV system enabled BSS to absorb an electrical power by charging to the BSS.The objective function of this process to decrease the active power in the distribution system result to decrease the distribution voltage.The VSFC Algorithm enables to control the BSS in a smart PV system by charging and discharging strategies.

Grid Inverter Power Management
In case of the gird voltage value is out of the target range (0.96 p.u.-1.06 p.u. for this research) and battery storage system is not able to operate when battery already full capacity or battery already reach the minimum SOC.If the grid voltage value still out of the target range, the grid inverter of a smart PV system will operate on grid support functions, reactive power control and active power control to maintain the grid voltage stability of distribution system.Generally, if the grid voltage is over than over limit of target range, grid inverter is able to absorb the reactive power in the distribution system, purpose to decrease the grid voltage.On the other hand, in case of under voltage, the grid inverter will operate to inject the reactive power to the grid, purpose to increase the grid voltage in distribution system.In the worst case, even the grid inverter operates on reactive power control but the grid voltage value is still out of range.

Fuzzifications of Input and Output Parameters
Fuzzification process is to convert crisp values to fuzzy data, each input and output parameters are converted to membership function (MF) as follow.
Figure 9a illustrates the membership function of PV power production (Ppv) which is classified into ranges of MF; low, medium and high based on power production in percentage of capacity at any instance of time as described in Table 1. Figure 9a illustrates the membership function of PV power production (Ppv) which is classified into ranges of MF; low, medium and high based on power production in percentage of capacity at any instance of time as described in Table 1.  Figure 9b illustrates the membership function of battery state of charge (SOC) which is classified into ranges of MF; low, medium, high and max based on energy contain in the battery in percentage at any instance of time as described in Table 2. Figure 9c illustrates the membership function of distribution voltage (Vg) at the point of common coupling (PCC) which is classified in to ranges of MF, under, medium and over in power units (p.u.) at any instance of time as described in Table 3. Figure 9d illustrates the membership function of battery power management, which is classified into ranges of MF; heavy-charge, charge, maintain, discharge and heavy-discharge at any instance of time as described in Table 4. Figure 9e illustrates the membership function grid inverter power management which is classified into ranges of MF; very-low, low, normal, high and vary-high at any instance of time as described in Table 5.

Fuzzy Inference
The fuzzy inference is the process that combination of membership functions with the rule base, knowledge and control rules for refining the fuzzy output.The control rules of fuzzy inference were considered as the knowledge of expert persons.A IF-THEN rule is applied to described linguistic variants and fuzzy sets to meditate a fuzzy output.The VSFL Algorithm fuzzy inference consisted of battery power management and grid inverter power management as shown in Tables 6 and 7.

Defuzzification
The Defuzzification process converts fuzzy output to a crisp output.The crisp output can be number or digital output, which is used to enable for controlling the equipment.This research used the Centroid Method as showed in Equation (8).
When D crisp output is the decision output for batter power management and inverter power management.µ C (Z) is the degree of output membership function.Z is the output variable of membership function.
The outputs by Defuzzification process of the VSFL Algorithm can be separated into two entities; the first is battery power management and second is inverter power management as shown in Figure 10.

Simulation of 22 kV Distribution with a Smart PV System
To verify the operation of a smart PV system equipped with the VSFL Algorithm for grid voltage stability, the typical 22 kV distribution system in Thailand was modified to the 22 kV distribution test system connected with a smart PV system.The simulation can be divided into two parts; the first is 22 kV distribution test system connected with an 8 MW typical PV system and second is a distribution test system connected with a smart PV system equipped with the VSFL Algorithm.The voltage profiles of main busbar (MBB) will be simulated by DIgSILENT PowerFactory software V. 15.1 (research license of Naresuan University, School of Renewable Energy Technology, Thailand).The modified 10 busbars of 22 kV distribution test system in this research is presented in Figure 11.The 22 kV distribution test system was modified from a distribution system that is already use in the northeast of Thailand.The feeder which is connected with an 8 MW typical PV system will be

Simulation of 22 kV Distribution with a Smart PV System
To verify the operation of a smart PV system equipped with the VSFL Algorithm for grid voltage stability, the typical 22 kV distribution system in Thailand was modified to the 22 kV distribution test system connected with a smart PV system.The simulation can be divided into two parts; the first is 22 kV distribution test system connected with an 8 MW typical PV system and second is a distribution test system connected with a smart PV system equipped with the VSFL Algorithm.The voltage profiles of main busbar (MBB) will be simulated by DIgSILENT PowerFactory software V. 15.1 (research license of Naresuan University, School of Renewable Energy Technology, Thailand).The modified 10 busbars of 22 kV distribution test system in this research is presented in Figure 11.

Simulation of 22 kV Distribution with a Smart PV System
To verify the operation of a smart PV system equipped with the VSFL Algorithm for grid voltage stability, the typical 22 kV distribution system in Thailand was modified to the 22 kV distribution test system connected with a smart PV system.The simulation can be divided into two parts; the first is 22 kV distribution test system connected with an 8 MW typical PV system and second is a distribution test system connected with a smart PV system equipped with the VSFL Algorithm.The voltage profiles of main busbar (MBB) will be simulated by DIgSILENT PowerFactory software V. 15.1 (research license of Naresuan University, School of Renewable Energy Technology, Thailand).The modified 10 busbars of 22 kV distribution test system in this research is presented in Figure 11.The 22 kV distribution test system was modified from a distribution system that is already use in the northeast of Thailand.The feeder which is connected with an 8 MW typical PV system will be The 22 kV distribution test system was modified from a distribution system that is already use in the northeast of Thailand.The feeder which is connected with an 8 MW typical PV system will be used

Results and Discussion
Here are the results for the two test simulations that were run, the first simulating a typical PV system connected to a 22 kV distribution and the second simulating a smart PV system operating with the VSFL Algorithm, also connected to a 22 kV distribution system.

Simulation of a Typical PV System Connected to a 22 kV Distribution
Generally, the voltage in the profile of a distribution system decreases the further the voltage source is from the location of the load.This voltage drop occurs in the distribution system because the electric current travels though passive elements (such as wires, conductors, the load itself, etc.) that create resistance, dragging on the voltage and decreasing it.Figure 13 shows voltage profiles for ten cases resulting from the first simulation (i.e., typical PV, no VSFL Algorithm).All these profiles in Figure 13 are for the distribution system running without PV power production, and the 10 cases represent variations in load from minimum (case 10) to maximum (case 2).

Results and Discussion
Here are the results for the two test simulations that were run, the first simulating a typical PV system connected to a 22 kV distribution and the second simulating a smart PV system operating with the VSFL Algorithm, also connected to a 22 kV distribution system.

Simulation of a Typical PV System Connected to a 22 kV Distribution
Generally, the voltage in the profile of a distribution system decreases the further the voltage source is from the location of the load.This voltage drop occurs in the distribution system because the electric current travels though passive elements (such as wires, conductors, the load itself, etc.) that create resistance, dragging on the voltage and decreasing it.Figure 13 shows voltage profiles for ten cases resulting from the first simulation (i.e., typical PV, no VSFL Algorithm).All these profiles in Figure 13 are for the distribution system running without PV power production, and the 10 cases represent variations in load from minimum (case 10) to maximum (case 2). Figure 13 shows the voltage profile in the typical distribution system.One can clearly see that in Case 1 the voltage dropped in proportion to increasing distance from the substation to each more distant busbar, with the lowest voltage seen at the final busbar (MBB10).The voltage at the MBB10 is 0.91 p.u. Strictly speaking, this value is acceptable; however, it barely meets the minimum requirement of the Thailand grid code.To improve the overall voltage profile, a capacitor was installed at busbar number 8 (MBB08).After installing the capacitor, the voltage profile improves to arrive in the target range (0.96 p.u. to 1.06 p.u.) The resulting values with capacitor range from 0.96 p.u. to 1.03 p.u., depending on the load capacity.This improved the voltage profile can be seen in case 3 to case 10 in Figure 13.
Next, operation of this same 22 kV distribution system was simulated except with a typical PV system (8 MW PV system connected to busbar number 9).The resulting voltage profile is shown in Figure 14.  Figure 13 shows the voltage profile in the typical distribution system.One can clearly see that in Case 1 the voltage dropped in proportion to increasing distance from the substation to each more distant busbar, with the lowest voltage seen at the final busbar (MBB10).The voltage at the MBB10 is 0.91 p.u. Strictly speaking, this value is acceptable; however, it barely meets the minimum requirement of the Thailand grid code.To improve the overall voltage profile, a capacitor was installed at busbar number 8 (MBB08).After installing the capacitor, the voltage profile improves to arrive in the target range (0.96 p.u. to 1.06 p.u.) The resulting values with capacitor range from 0.96 p.u. to 1.03 p.u., depending on the load capacity.This improved the voltage profile can be seen in case 3 to case 10 in Figure 13.
Next, operation of this same 22 kV distribution system was simulated except with a typical PV system (8 MW PV system connected to busbar number 9).The resulting voltage profile is shown in Figure 14.The simulation results in Figure 14 indicate that the voltage profile can rise drastically when a large amount of active power is fed from the PV system to the distribution system.The acceptable range of grid voltage prescribed in PEA grid code 2016 in Thailand is from 0.90 p.u. to 1.10 p.u. Figure 14 shows how even in the case of low load power consumption, a high amount of active power production from the PV system fed to the distribution system will still cause the voltage to rise over the limit.In case of no or low active power feed to the grid, busbar voltage was in acceptable range between 0.96 p.u. and 1.06 p.u.On the other hand, if the PV system generates high among of active power fed to the distribution system, the grid voltage is higher than 1.10 p.u. which is over than the limit of over voltage of Thailand.This situation may affect to distribution outage or PV system have to disconnect from the distribution system.

Simulation Results of Distribution Test System Integrated with a Smart PV System
According to previous discussion above, the imbalance between electrical power generation and power demand can have a negative impact on the quality of electricity in the distribution system.Particularly, PV system which is fluctuated power production, it depends on the solar irradiation.The major problem is grid voltage rise due to high amount of active power that is fed from PV system.
In this research focused to develop algorithm so call VSFL Algorithm for a smart PV system.The difference between typical PV system and a smart PV system in this research can be described that a smart PV system consists of battery storage system (3 MW/2 MW h) and increase the inverter capability to enable maintaining the distribution voltage stability.Not only add more components to a smart PV system but also developed the VSFL Algorithm for maintaining the distribution voltage into the target range (between 0.96 p.u. and 1.06 p.u.only for this research).The voltage profiles of the distribution test system were simulated by DIgsilent PowerFactory software in the case of the operation of a smart PV system equipped with VSFL Algorithm as shown in Figure 15.The simulation results in Figure 14 indicate that the voltage profile can rise drastically when a large amount of active power is fed from the PV system to the distribution system.The acceptable range of grid voltage prescribed in PEA grid code 2016 in Thailand is from 0.90 p.u. to 1.10 p.u. Figure 14 shows how even in the case of low load power consumption, a high amount of active power production from the PV system fed to the distribution system will still cause the voltage to rise over the limit.In case of no or low active power feed to the grid, busbar voltage was in acceptable range between 0.96 p.u. and 1.06 p.u.On the other hand, if the PV system generates high among of active power fed to the distribution system, the grid voltage is higher than 1.10 p.u. which is over than the limit of over voltage of Thailand.This situation may affect to distribution outage or PV system have to disconnect from the distribution system.

Simulation Results of Distribution Test System Integrated with a Smart PV System
According to previous discussion above, the imbalance between electrical power generation and power demand can have a negative impact on the quality of electricity in the distribution system.Particularly, PV system which is fluctuated power production, it depends on the solar irradiation.The major problem is grid voltage rise due to high amount of active power that is fed from PV system.
In this research focused to develop algorithm so call VSFL Algorithm for a smart PV system.The difference between typical PV system and a smart PV system in this research can be described that a smart PV system consists of battery storage system (3 MW/2 MW h) and increase the inverter capability to enable maintaining the distribution voltage stability.Not only add more components to a smart PV system but also developed the VSFL Algorithm for maintaining the distribution voltage into the target range (between 0.96 p.u. and 1.06 p.u.only for this research).The voltage profiles of the distribution test system were simulated by DIgsilent PowerFactory software in the case of the operation of a smart PV system equipped with VSFL Algorithm as shown in Figure 15. Figure 15 shows the simulation results by DIgsilant PowerFactory in the case of maximum power production from the PV system and low load consumption (Case 9).Case 9 was the worst case study in this research, over voltage due to high electricity power production from PV system which was injected into the distribution test system.According to the simulation, the distribution voltage at the MBB07 to MBB10 was over than over voltage limit of Thailand.For the case 9, if a distribution test system integrated with a smart PV system equipped with the VSFL Algorithm, it enabled to maintain the grid voltage into the target range (0.96 p.u.-1.06 p.u.) by two entities; The first entity was to manage the power production from PV system by charging electricity into the battery system, which was determined by the SOC value of the battery.After electricity was managed by the VSFL Algorithm to charge the battery system but the grid voltage at the PCC is not within the target range.A VSFL Algorithm will order the inverter to adjust the PF to maintain the grid voltage so call reactive power control.The scope of PF adjustment in this research was in rang of 0.90 lagging and 0.90 leading.From the result of simulation in case of over voltage, a smart PV system operated with the VSFL Algorithm enables to maintain the distribution voltage (MBB01 to MBB10) into the desired range.
Figure 16 shows the simulation results by DIgsilant PowerFactory in the case of no power production from the PV system with maximum load consumption (Case 1).Case 1 (load power consumption is maximum at 6 MW total capacity and no PV power production) was the worst case study for under voltage due to maximum electricity power consumption (6 MW) in the 22 kV distribution test system.Distribution voltage at the MBB06 to MBB10 was at very low voltage (0.91 p.u. of voltage at the MBB08 to MBB10).The grid voltage was out of the target range so a smart PV Figure 15 shows the simulation results by DIgsilant PowerFactory in the case of maximum power production from the PV system and low load consumption (Case 9).Case 9 was the worst case study in this research, over voltage due to high electricity power production from PV system which was injected into the distribution test system.According to the simulation, the distribution voltage at the MBB07 to MBB10 was over than over voltage limit of Thailand.For the case 9, if a distribution test system integrated with a smart PV system equipped with the VSFL Algorithm, it enabled to maintain the grid voltage into the target range (0.96 p.u.-1.06 p.u.) by two entities; The first entity was to manage the power production from PV system by charging electricity into the battery system, which was determined by the SOC value of the battery.After electricity was managed by the VSFL Algorithm to charge the battery system but the grid voltage at the PCC is not within the target range.A VSFL Algorithm will order the inverter to adjust the PF to maintain the grid voltage so call reactive power control.The scope of PF adjustment in this research was in rang of 0.90 lagging and 0.90 leading.From the result of simulation in case of over voltage, a smart PV system operated with the VSFL Algorithm enables to maintain the distribution voltage (MBB01 to MBB10) into the desired range.
Figure 16 shows the simulation results by DIgsilant PowerFactory in the case of no power production from the PV system with maximum load consumption (Case 1).Case 1 (load power consumption is maximum at 6 MW total capacity and no PV power production) was the worst case study for under voltage due to maximum electricity power consumption (6 MW) in the 22 kV distribution test system.Distribution voltage at the MBB06 to MBB10 was at very low voltage (0.91 p.u. of voltage at the MBB08 to MBB10).The grid voltage was out of the target range so a smart PV system equipped with the VSFL Algorithm operated to increase the grid voltage into the target range.To increase the distribution voltage into the target range, the VSFL Algorithm ordered a battery storage system to discharge electricity into the load within the distribution system.After operated the system resulted to distribution voltage form the MBB02 to MBB10 was increasing into the desired range.A smart PV system operated with the VSFL Algorithm can significantly enable to maintenance of the distribution voltage as presented in Figure 16.system equipped with the VSFL Algorithm operated to increase the grid voltage into the target range.
To increase the distribution voltage into the target range, the VSFL Algorithm ordered a battery storage system to discharge electricity into the load within the distribution system.After operated the system resulted to distribution voltage form the MBB02 to MBB10 was increasing into the desired range.A smart PV system operated with the VSFL Algorithm can significantly enable to maintenance of the distribution voltage as presented in Figure 16.Operated VSVF Algorithm (case4) is a smart PV system operation as 0 MW electricity power discharge from BSS when SOC is 0.3, no PV power production and 6 MW load power; Operated VSVF Algorithm (case5) is a smart PV system operate as 0.2 MW electricity power discharge from BSS when SOC is 0.4, no PV power production and 6 MW load power; Operated VSVF Algorithm (case6) is a smart PV system operate as 1.3 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case7) is a smart PV system operation as 2.4 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case8) is a smart PV system operation as 2.8 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power.

Conclusions
This paper discussed a concept of improving the typical PV system to a smart PV system for maintaining grid voltage stability.The concept of a smart PV system is that the battery storage system was assumed to integrate with a typical PV system and increase the grid inverter ability, increasing more capability for maintaining the distribution voltage into the target range (0.96 p.u. to 1.06 p.u. of voltage).This research started from test the grid inverter in an electrical laboratory on grid support functions, active and reactive power control depending on the grid voltage.The results of the test showed that the inverter management enabled to maintenance of the grid voltage stability.After analyzed the test results, the control algorithm was developed for a smart PV system by using the fuzzy logic method so called the VSFL Algorithm.To verify the operation of a smart PV system operated with the VSFL Algorithm so the existing 22 kV distribution system was connected with an 8 MW typical PV system in the northeast of Thailand, it was modified for voltage profile simulation by DIgsilent PowerFactory.Finally, the results of this research indicated that a smart PV system equipped with the VSFL Algorithm enabled to maintain of the distribution voltage into the target range by managing the battery storage system and grid inverter power management.Especially, in  Operated VSVF Algorithm (case4) is a smart PV system operation as 0 MW electricity power discharge from BSS when SOC is 0.3, no PV power production and 6 MW load power; Operated VSVF Algorithm (case5) is a smart PV system operate as 0.2 MW electricity power discharge from BSS when SOC is 0.4, no PV power production and 6 MW load power; Operated VSVF Algorithm (case6) is a smart PV system operate as 1.3 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case7) is a smart PV system operation as 2.4 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case8) is a smart PV system operation as 2.8 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power.

Conclusions
This paper discussed a concept of improving the typical PV system to a smart PV system for maintaining grid voltage stability.The concept of a smart PV system is that the battery storage system was assumed to integrate with a typical PV system and increase the grid inverter ability, increasing more capability for maintaining the distribution voltage into the target range (0.96 p.u. to 1.06 p.u. of voltage).This research started from test the grid inverter in an electrical laboratory on grid support functions, active and reactive power control depending on the grid voltage.The results of the test showed that the inverter management enabled to maintenance of the grid voltage stability.After analyzed the test results, the control algorithm was developed for a smart PV system by using the fuzzy logic method so called the VSFL Algorithm.To verify the operation of a smart PV system operated with the VSFL Algorithm so the existing 22 kV distribution system was connected with an 8 MW typical PV system in the northeast of Thailand, it was modified for voltage profile simulation by DIgsilent PowerFactory.Finally, the results of this research indicated that a smart PV system equipped with the VSFL Algorithm enabled to maintain of the distribution voltage into the target range by managing the battery storage system and grid inverter power management.Especially, in the case of over voltage due to a high amount of active power from the PV system fed to the grid, the VSFL Algorithm can significantly maintain the grid voltage into the target range.To improve the typical PV systems by adapting to a smart PV system is a solution to solve the problem of voltage fluctuation, which is effected by high penetration PV system.

Figure 1 .
Figure 1.PV system installation in Thailand.

Figure 1 .
Figure 1.PV system installation in Thailand.

Figure 4 .
Figure 4. Thevenin equivalent of a typical PV system integrated to distribution system.

Figure 4 .
Figure 4. Thevenin equivalent of a typical PV system integrated to distribution system.

Figure 4 .
Figure 4. Thevenin equivalent of a typical PV system integrated to distribution system.

Energies 2018 ,
11, x FOR PEER REVIEW 6 of 19 power control depend on the grid voltage or a variable reactive power depending on the voltage Q (U) in PEA grid code 2016.

Figure 5 .
Figure 5. Relationship between active power (P) and reactive power (Q) of grid inverter operation.

Figure 6 .
Figure 6.To maintain the grid voltage by reactive power control of grid inverter.(V_A is grid voltage phase A, V_B is grid voltage phase B, V_C is grid voltage phase C, V_grid setting is voltage setting by grid simulator, P_Inv is power output of grid inverter and PF is power factor of inverter).

Figure 5 .
Figure 5. Relationship between active power (P) and reactive power (Q) of grid inverter operation.

Figure 6 .
Figure 6.To maintain the grid voltage by reactive power control of grid inverter.(V_A is grid voltage phase A, V_B is grid voltage phase B, V_C is grid voltage phase C, V_grid setting is voltage setting by grid simulator, P_Inv is power output of grid inverter and PF is power factor of inverter).

Figure 8 .
Figure 8.The VSFL Algorithm for grid voltage stability.

Energies 2018 , 19 5. 3 .Figure 9 .
Figure 9. Membership function of inputs and outputs parameters.(a) is the membership function of PV power production; (b) is the membership function of Battery state of charge; (c) is the membership function of grid voltage at point of common coupling; (d) is membership function of battery storage system operation; (e) is membership function of grid inverter operation.

Figure 9 .
Figure 9. Membership function of inputs and outputs parameters.(a) is the membership function of PV power production; (b) is the membership function of Battery state of charge; (c) is the membership function of grid voltage at point of common coupling; (d) is membership function of battery storage system operation; (e) is membership function of grid inverter operation.

Figure 10 .
Figure 10.Defuzzification of the VSFL Algorithm.((a) Is Defuzzification output of inverter power management and (b) is Defuzzification output of battery power management).

Figure 10 .
Figure 10.Defuzzification of the VSFL Algorithm.((a) Is Defuzzification output of inverter power management and (b) is Defuzzification output of battery power management).

Figure 10 .
Figure 10.Defuzzification of the VSFL Algorithm.((a) Is Defuzzification output of inverter power management and (b) is Defuzzification output of battery power management).

Figure 13 .
Figure 13.Voltage profile of the distribution system without PV power production.

Figure 13 .
Figure 13.Voltage profile of the distribution system without PV power production.

Figure 14 .
Figure 14.Voltage profile of the distribution system with PV power production.(For example, Case1(0PV) means Case Study 1 with 0 MW of PV power production).

Figure 14 .
Figure 14.Voltage profile of the distribution system with PV power production.(For example, Case1(0PV) means Case Study 1 with 0 MW of PV power production).

Figure 16 .
Figure16.Distribution voltage profile when operation a smart PV system with the VSFL Algorithm.Operated VSVF Algorithm (case4) is a smart PV system operation as 0 MW electricity power discharge from BSS when SOC is 0.3, no PV power production and 6 MW load power; Operated VSVF Algorithm (case5) is a smart PV system operate as 0.2 MW electricity power discharge from BSS when SOC is 0.4, no PV power production and 6 MW load power; Operated VSVF Algorithm (case6) is a smart PV system operate as 1.3 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case7) is a smart PV system operation as 2.4 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case8) is a smart PV system operation as 2.8 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power.

Figure 16 .
Figure16.Distribution voltage profile when operation a smart PV system with the VSFL Algorithm.Operated VSVF Algorithm (case4) is a smart PV system operation as 0 MW electricity power discharge from BSS when SOC is 0.3, no PV power production and 6 MW load power; Operated VSVF Algorithm (case5) is a smart PV system operate as 0.2 MW electricity power discharge from BSS when SOC is 0.4, no PV power production and 6 MW load power; Operated VSVF Algorithm (case6) is a smart PV system operate as 1.3 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case7) is a smart PV system operation as 2.4 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power; Operated VSVF Algorithm (case8) is a smart PV system operation as 2.8 MW electricity power discharge from BSS when SOC is 0.5, no PV power production and 6 MW load power.

Table 1 .
Range and degree of membership function of PV power output.

Table 2 .
Range and degree of membership function of battery state of charge.

Table 3 .
Range and degree of membership function of distribution voltage at PCC.

Table 4 .
Range and degree of membership function of battery power management.

Table 5 .
Range and degree of membership function of inverter power management.

Table 6 .
Fuzzy inference of inverter power management for grid voltage stability.

Table 7 .
Fuzzy inference of battery power management for grid voltage stability.

Operate VS-FL Algorithm (case3) is
a smart PV system operate as 1.8 MW electricity power charge to BSS when SOC is 0.3 and Grid Inverter operated at the PF 0.92 in case of PV power production equals 8 MW).