Development and Application of a Fuzzy Control System for a Lead-Acid Battery Bank Connected to a DC Microgrid

Mechatronics Engineering Department, Technological Institute of Celaya, Av. Tecnológico y G. Cubas, s/n, 38010 Celaya, GTO, Mexico Electronics Engineering Department, Technological Institute of Celaya, Av. Tecnológico y G. Cubas, s/n, 38010 Celaya, GTO, Mexico Department of Mechanical Engineering, Universidad de Guanajuato, 36885 Salamanca, GTO, Mexico Department of Engineering Sciences, Technological Institute of Celaya, Av. Tecnológico y G. Cubas, s/n, 38010 Celaya, GTO, Mexico


Introduction
Electrical energy plays an important role in our daily lives, due to the fact that it can be universally applied for conversion into other forms of energy, such as heat, lighting, and mechanical energy.However, its storage and, frequently, the process of transforming it into other forms of energy are complex.One example of systems that convert energy for storage is the electrochemical sources of energy known as batteries, which use chemical compounds as storage media, employing chemical reactions, and produce or store electrical energy [1].The most frequently used chemical compounds are lead-acid, nickel-cadmium, and ion-lithium, as well as molecular hydrogen and methanol in the case of fuel cells.Their main applications are in mobile electronic devices, electric automobiles, and direct current microgrids (DC-MGs).These applications require a system for controlling the charge and discharge of the battery, which ensures their efficiency, security, and reliability.
Dai et al. and Passino et al. [2,3] propose fuzzy control systems (FCSs), as they are useful for modeling the nonlinear behavior of battery charge and discharge as a result of temperature and current changes and the ageing process.Alternatively, control systems for battery charge and discharge using artificial neural networks to model the multivariable behavior of the battery bank have been reported [4][5][6][7].Although both control techniques are efficient and provide acceptable results, FCSs are more widely used due to the ease of their implementation; however, on some occasions, they require a greater amount of memory, which depends on the number of fuzzy rules and membership functions [8].
With regard to the use of FCS, [9,10] used an FCS for the rapid charging of nickel-cadmium batteries, with their results demonstrating that it is possible to completely charge the battery bank in a time period of 10 minutes with a 6 A current.Meanwhile, [11][12][13] propose the use of FCSs in DSPs to charge Li-ion batteries, obtaining more efficient and secure control systems with charging times ranging from 15 minutes [12] to 4.5 hours [13].
FCSs have been successfully used for charging and discharging batteries in electric vehicles.These vehicles use a fuel cell that functions as an electrical generator, with the energy generated delivered to the battery by means of a power converter, which, in turn, delivers the energy to the motor of the vehicle by means of another power converter.Li et al. [14] used a fuzzy controller that operates based on the charge level and voltage of the battery, producing the working status of the battery, which was compared with the state of charge (SoC) of the battery, in order to avoid overestimating the SoC of the battery and generating excessive discharge.The references [15,16] used an FCS to determine the point of operation of the power converter in an electrical vehicle.One of the most recently reported studies on the management of energy in electric vehicles used an adaptive FCS to determine the energy that is transferred to the battery [17].The control system was implemented using the Lab-VIEW software with the NI CompactRIO module and operates based on the SoC of the battery and the power required.
In the area of the design of energy management systems used in DC-MGs, FCSs have also been used for the control of energy in batteries.Chen et al. [18] designed an FCS that monitors the SoC of the battery and the level of power in the microgrid in order to define the current that is either injected into or extracted from the battery bank.
Sikkabut et al. [19] presented a small-scale experimental prototype of a DC-MG with a 60 V bus that uses a photovoltaic array of 800 W, a battery bank of between 11.6 Ah and 24 V, and a 100 F supercapacitor bank.This prototype uses a management system implemented in the card dSPACE DS1104 platform, which includes an FCS to stabilize the DC bus.This study presented the experimental results, obtaining 5% variations in the DC bus due to the load variations when connected to the bus.
The majority of studies presented the use of the SoC of the battery in order to manage the energy, with the SoC obtained by subtracting the charge flow out of the battery from the initial existing charge, obtaining a result which shows nonlinear behavior and which requires compensation for the effects of the temperature changes [20].
This paper presents the design and implementation of a control system based on fuzzy logic to control the charge and discharge states of a bank of lead-acid battery in a DC-MG.A Mamdani-type fuzzy control with two input variables and an output variable with five membership functions each was used in this study to control the three states of operating statuses of the battery bank.In order to achieve this, a general control system was designed to multiplex the states of control using the same fuzzy controller for each state, thus enabling the stabilization of the DC bus in adequate time periods with a decrease in the computational burden required for the implementation of the charge and discharge controller for the batteries.Furthermore, the SoC of the battery bank is not used as an input variable of the fuzzy controller as proposed in [14] and defined by the OCV-ampere-hour counting method; instead, the battery bank voltage and current are used as input variables, which are considered to generate the set of inference rules of the controller.Also, at each controller operating state, the technical characteristics for charging and discharging of the batteries provided by the manufacturer are considered, in order to extend the useful life of the battery bank.The controller was implemented using the LabVIEW virtual instrumentation software and the NI myRIO-1900 embedded design device.
The paper is organized as follows: Section 2 presents the description of the DC-MG system, Section 3 presents the different management systems used in the analysis, Section 4 presents the results obtained from the study, and finally, Section 5 concludes the paper.

Description of the DC-MG
The DC-MG was designed to use a maximum power level of 1 kW, with a DC bus of 190 V. Figure 1 presents the general diagram for the proposed DC-MG, which defines the energy flow between the different elements that comprise the system.The principal energy source for the DC-MG is two photovoltaic panels (PPs), each of which supplies a DC-DC converter with a capacity of 0.6 kW.Two photovoltaic panel simulators (PPSs) (Agilent-model E4360A) were used to simulate the behavior of the PPs.The second element that forms part of the proposed DC-MG is the bidirectional DC-AC converter, which enables the DC-MG to be interconnected to the grid allowing it to supply energy to the grid or take energy from it.The DC-MG has an energy storage system (ESS) composed of ten CALE-SOLAR batteries connected in a series, with each battery designed for deep-cycle applications comprising 12 V and a 115 Ah capacity.This bank is connected to the DC bus by means of a bidirectional DC-DC converter.Moreover, it has a bank of 0.230 F supercapacitors connected in parallel to the DC bus, with the objective of maintaining the voltage level of the DC bus during the connection or disconnection intervals of the DC-AC converter, the ESS, the PPs, and the loads.
The FCS proposed in this study is applied to the bidirectional DC-DC converter used to interconnect the bank of batteries with the DC bus of the DC-MG, the topology of which is shown in Figure 2.This converter comprises a buck converter and a boost converter connected in parallel.The converter's switches enable the change from one mode of operation to another, as the mode of operation depends directly on the switch used.This topology comprises an inductor (L), a capacitor (C), and two power transistor switchers (Q1 and Q2).
In order to evaluate the functionality of the DC-MG under different scenarios, loads with both linear and nonlinear characteristics were used.For a linear load, a 600 Ω

2
International Journal of Photoenergy resistive load bank was used, while two types of lamps and a laptop were used for nonlinear loads.The first group of lamps consists of seven commercial LED-type lamps of 23 W each, while the second group comprises four louvertype lamps with three 28 W T5 fluorescent lamps, each with a commercial electronic ballast, as well as a laptop that requires a maximum power level of 150 W. Nonlinear loads used at this supply voltage are able to operate correctly at 190 V DC, with the manufacturer's specifications indicating that their supply voltage is within the universal input voltage range of 100-264 V AC.

Management System
The management system proposed for the DC-MG uses controllers that operate in each of the elements of the DC-MG (PPs, ESS, and the interconnection system with the grid).The general management system (GMS) is described below, as well as the design of the control system for the charge and discharge of the battery bank.
3.1.General Management System.The principal objective of the general management system (GMS) of the DC-MG is to make maximum use of the energy generated by the PPs, supplying the energy necessary for the loads connected to the DC bus and injecting the remaining energy into the battery bank or the grid.This system uses the five modes of operation described below: (i) Mode I: the system startup mode, in which the PPs function in voltage control (VC) mode, while the ESS and the grid are disabled.
(ii) Mode II: the PPs work with the maximum power point tracking (MPPT) algorithm [20], while the 3 International Journal of Photoenergy converter for the ESS functions as a boost converter, supplying energy to the loads connected to the bus, while the grid is disabled.
(iii) Mode III: the PPs work with the MPPT algorithm, while the bidirectional DC-AC converter is used as a rectifier, taking energy from the grid and injecting it into the loads connected to the bus, while the ESS is disabled.In this operating mode, it is possible that energy is required from the grid in order to inject it into the ESS.
(iv) Mode IV: the PPs work with the MPPT algorithm, and the bidirectional DC-DC converter works as a buck, injecting energy into the ESS, while the grid is disabled.
(v) Mode V: the PPs work with the MPPT algorithm, while the bidirectional DC-AC converter works as an inverter for injecting energy into the grid, while the ESS is disabled.
The GMS always starts up in operation mode I and changes the operation mode depending on the voltage level of the bus, the power levels of the PPs, the battery bank, and the grid.

Control
System for the Battery Bank.For the control of the energy that is injected into or extracted from the bank of batteries, an FCS was designed and implemented based on the current and the voltage of the battery bank.This control system is divided into three states of operation that could work in modes II, III, and IV of the GMS.

State I (Battery Charge).
Energy is extracted from the PPs and injected into the battery bank, while the FCS operates based on the voltage level of the DC bus.If the voltage level increases, the energy injected into the battery bank increases, while, if the voltage level decreases, the energy injected into the battery bank decreases.Thus, the balance of the voltage level of the DC bus is maintained.Figure 3 shows the diagram for the general control used to control the bidirectional converter (buck topology).For this state of operation, the input variable Vin_1 corresponds to the difference between Vbus and the SP (Vin_1 = Vbus − SP), where the SP is equal to 190 V; the second input variable Vin_2 corresponds to the voltage variations occurring in the DC bus.The Duty output variable defines the variations that will occur in the duty cycle, variations which are integrated by means of the integral control action.The values for the variables A, B, and C were defined heuristically on testing the fuzzy controller online with the buck converter, in an effort to maintain the stability of the bus and eliminate the effects of the perturbations on the bus in the least time possible.In this state, A = 15, B = 1, and C = 1000.

State II (Battery Charge).
In this state of operation, further to using the energy generated by the PPs, the energy from the grid is used to charge the battery bank.To control the energy injected into the battery bank, the FCS works on the current (Ibat) injected into the bank.This current is defined by the power required by the bidirectional DC-AC converter before injecting energy into the battery bank, with the intention of not exceeding the maximum capacity of the converter designed to work at 1 kW.The control scheme is represented in Figure 3.For the state Vin_1 = SP − Ibat, Vin_2 corresponds to the variations in the current injected into the battery bank, while the Duty output variable generates the variations that are integrated in order to obtain the duty cycle of the converter operating in its buck topology.For this state, A = 10, B = 2, and C = 500.

State III (Battery Discharge).
In those circumstances where the energy generated by the PPs would not be sufficient to supply the energy required for the loads, the battery  The states of operation previously described are defined based on the following criteria for the operation of the battery bank: (1) the charge and discharge processes of the battery bank must always be concluded, (2) the continuous current charge process is completed once the battery bank attains a maximum voltage value of 135 V, (3) the continuous charge voltage process is completed when the current injected into the battery bank is less than 0.5 A, and (4) the discharge process is completed when the battery voltage is 100 V.
It should be noted that the bidirectional power converter used in the battery bank has a maximum capacity of 1 kW, for which reason the maximum current that can be extracted or injected into the bank is 10 A.

Multiplexed System.
The input and output variables for the FCS (Vin_1, Vin_2, and D) are multiplexed, and their selection is determined for each state of operation described in Section 3.2.The input variables are obtained by measuring both the voltage level of the DC bus and the current that is injected into the battery bank in order to obtain an Error signal and define Vin_1.The input variable Vin_2 is obtained by calculating the variations in the voltage of the DC bus and the current injected into the battery bank.The output signal is used as a signal for the power transistor switch that controls either the converter when it operates in its buck topology (injecting energy into the battery bank) or the power transistor switch that operates when the converter functions in its boost topology (extracting energy from the battery bank).This enables the use of an FCS to maintain the stability of the three states of operation of the ESS.
3.4.Fuzzy Controller.The structure of the fuzzy controller is shown in Figure 4.The fuzzy sets for the input and output variables are very negative (VN), negative (N), zero (Z), positive (P), and very positive (VP).
The triangular and trapezoidal membership functions are the most popular functions due to their ease of representation and the fact that they require less computer processing capacity, providing satisfactory results.For the proposed fuzzy controller, the input and output variables use two trapezoidal membership functions and three triangular membership functions (see Figure 5).The group of fuzzy rules was designed under the working principle of a fuzzy PD + I controller [18], which eliminates the error that exists between the variable measured and the desired value for the point of reference (set point), considering the variations in the variable measured.For example, if the "Error" input is very negative and the "DOut" input is very positive, then the "Duty" output is negative.Table 1 illustrates the 21 rules used to design the fuzzy controller.
The Mamdani-type fuzzy inference system is used for the defuzzification process, in which the centroid method is used to obtain the variation of the duty cycle (Duty) in the form of a numerical value based on a fuzzy output.The graph that relates the input variables to the output variable is shown in Figure 6.

Results
The experimental results obtained for the proposed FCS are presented below, using the LabVIEW virtual instrumentation software and the NI myRIO-1900 embedded design device.

State of Operation I.
The GMS directs energy to the battery bank when it is discharged or in the process of charging.Figure 7(a) shows the behavior of the voltage in the DC bus and the current that is injected into battery bank.In this case, the PPs generate 568 W, of which 116 W is supplied to the load connected to the bus and 452 W is injected into the battery bank.The time required for the transient response is 3 seconds.When the battery bank is totally charged, it is necessary that the PPs operate in VC mode and that the bidirectional converter is turned off.The behavior of the DC bus and the current that is injected into the battery bank during this change is illustrated in Figure 7(b).Undertaking these changes of state generates perturbations in the bus of up to 8 V, with a change established after 5 seconds.The charge process for the battery bank starting with the continuous current charge is presented below, considering a current level of 8.8 A, where the voltage of the bank increases over time until reaching 135 V.When the battery bank attains this voltage level, the control changes to constantvoltage mode, generating a decrease in the current that is injected into the batteries.It is considered that the battery bank is totally charged when the current injected into the bank is 500 mA.For these experiments, it was decided to inject a constant current of 8.8 A, due to the PPs' generation capacity and the fact that a 1 kW converter interconnects the DC-MG with the grid.Figure 8(a) illustrates the behavior of the voltage of the battery bank while the charge is conducted in constant-current mode and constant-voltage mode.The charge in constant-current mode has a duration of 8 hours, while the charge in constant-voltage mode was 8.5 hours.Figure 8(b) illustrates the behavior of the current in both modes.

State of Operation II.
In this state of operation, energy is extracted from the grid and is injected into the battery bank.Figure 9(a) illustrates the behavior of the DC bus and the current that is injected into the battery bank at the moment of activating the bidirectional converter for the battery bank in buck topology.When the current injected into the battery bank increases, there is a 2 V drop in the DC bus voltage.The time in which the FCS takes in injecting the 2 A into the battery bank is 20 seconds, a time 7 International Journal of Photoenergy period which does not destabilize the DC bus.When it is injecting energy into the battery bank and is totally charged, the current that is injected into the bank is cancelled.Figure 9(b) shows the behavior of the current injected into the battery bank and the DC bus at the moment of changing the mode of operation.

State of Operation III.
This state of operation uses the energy generated by the PPs and the energy from the battery bank for supplying the energy required for the loads connected to the DC bus.When the PPs do not generate energy, the battery bank supplies all the energy required by the loads.Figure 10 shows the behavior of the DC bus during the start-up of the converter in order to obtain a voltage level of 190 V.The start-up time for the battery bank is 9.6 seconds.Furthermore, Figure 10 illustrates the behavior of the current that is extracted from the battery bank.This image shows an excess current caused by the demands of the bank of supercapacitors.When the response passes to the stable state, the current injected by the converter is 0.647 A (the output current for the bidirectional converter).The output for the bidirectional converter is 190 V and 0.647 A, while the converter input (battery bank) has a voltage of 123 V and delivers a current of 1 A. The load connected to the bus is a resistive load of 123 W.
Once the FCS establishes the DC, tests are undertaken to ascertain the response of the system.Figure 11(a) shows the behavior of both the voltage of the bus and the current in the battery bank on connecting a 125 W LED lamp, while Figure 11(b) illustrates the behavior of both the voltage of the bus and the current in the battery bank on disconnecting the lamps.These images show that the drop and overshoot in the bus on connecting and disconnecting the load are lower than 4 V, which represents 2.1% of the desired value for the bus, and that, furthermore, the settling time for the system is 2 seconds.
Further to the tests undertaken with LED lamps, the behavior was tested using a laptop with a 150 W load. Figures 12(a) and 12(b) show the behavior of the connection and disconnection of the laptop.These images demonstrate that the dynamic energy consumption of the laptop generates neither overshoot nor drops in the voltage of the bus.However, the current signal presents variations due to the laptop's energy consumption.The settling time is 2 seconds.
The behavior of the system was also tested using fluorescent lamps with an energy requirement of 500 W. Figures 13(a) and 13(b) illustrate the behavior on connecting and disconnecting these lamps, an effect which generates a drop and an overshoot of 5 V, representing 2.6% of the desired voltage for the DC bus.The settling time that generates the connection and disconnection of the load is 3 seconds.
In the same state, if the energy generated by the PPs is lower than the energy required by the load connected to the bus, the voltage level of the bus will decrease.If the battery bank has energy, it will be used to supply the energy missing for the loads.Figure 14(a) presents the behavior of the DC bus at the moment that the bidirectional converter operates in voltage boost mode, taking energy from the battery bank and injecting it into the DC bus.During the change of mode of operation in the DC-MG, the bus suffers a 10 V drop in voltage (5.2% of the desired voltage).The same figure shows the behavior of the current provided by the battery bank.In order to undertake this change of mode, a fluorescent lamp requiring 375 W is connected, of which the PPs supply 240 W, while the remaining 135 W is supplied by the battery  International Journal of Photoenergy bank.Figure 14(b) presents the behavior of the DC bus and battery bank current on the disconnection of the fluorescent lamps.This disconnection generates an increase in the DC bus, in turn causing the deactivation of the bidirectional converter.These changes generate a 7.5 V overshoot in the bus that represents a 3.9% increase in the desired value for the bus.The settling time is 4 seconds.The discharge process for the battery bank is shown below, with the PPs and the grid disabled for this discharge, leaving the battery bank as the sole energy supply to the DC bus.The load that was connected requires 1 kW of power, while the DC bus uses a voltage level of 190 V. Figure 15(a) shows the behavior of the voltage of the battery bank, with an initial voltage of 121.2 V, which reduces over time, generating an increase in the current supplied by the bank due to the fact that it requires constant power for the load connected to the bus. Figure 15(b) presents the behavior of the current of the battery bank on discharge.The battery bank was discharged until the voltage fell to the level of 100 V, in order to avoid damaging the battery bank.Under An advantage of the fuzzy control system is the smooth current signal that is obtained from the battery bank, which directly affects in a positive manner the behavior of the DC bus.Table 2 shows that the fuzzy controller system provides a faster response and a higher overshoot than the classical PI controller.With respect to the DC bus voltage, Table 3 shows that the fuzzy controller provides a faster response, a lower  International Journal of Photoenergy error at a steady-state operation, and a lower overshoot than the classical PI controller.

Discussion and Conclusions
This study presents the experimental tests on the behavior of the DC bus of a DC-MG considering the charge and discharge of the battery bank.The experiments considered real loads connected to the DC bus, such as fluorescent lamps, LED lamps, and computers, with the objective of ascertaining the behavior of the DC-MG using an FCS applied to the storage system.Recent studies have designed classic control systems for the control of the charge and discharge of battery banks.Yu [21] designed an autonomous experimental system for a DC-MG with a 5 kW capacity, with experimental results showing the behavior of the charge of the battery bank in constantcurrent and constant-voltage modes.Analysis of the experimental results presented reveals that the current presents a high frequency loop with an approximate amplitude of 1.5 A in constant-current mode and 1 A in constant-voltage mode.The results presented in this study are centered on the DC-MG's different modes of operation, which operate in different elements.Furthermore, the high frequency loop for the proposed DC-MG's current and voltage curves is lower than that presented in [21].
In order to define whether the battery bank is operating in either charge or discharge mode, the power difference between the load connected to the DC-MG bus and energygenerating sources was considered.Chen et al. [18] used an FCS which took into account this difference and the SoC of the batteries in order to control their SoC and modify the current that is injected or extracted from the battery bank.The proposed FCS output generates a variation in the current that is injected into or extracted from the battery bank depending on the mode of operation.The experimental results show a high frequency loop in the current for the batteries of approximately 1.5 A, the same as that found in [21]; moreover, the behavior presents slight oscillations in the stable state; however, this type of oscillation softens with the use of the FCS proposed in this study.
The experimental tests of the prototype presented show that the behavior of the system when used with the fuzzy controller remains stable with the connection and disconnection of sources and loads in the DC-MG, maintaining a value of 190 V ± 5% for the bus.The stabilization times recorded during the perturbations generated are short, considering the response dynamic of the microgrid.These times depend on the capacitance of the DC bus and the FCS, with the bus connected to a bank of supercapacitors, which eliminates the peaks that generate the connections or disconnections of sources or loads.The speed of the response of the battery bank current depends on the stabilization time of the DC bus, for which reason the FCS enables a soft response in both the DC bus and the battery bank current.

Future Studies
After proving, experimentally, the correct functioning of the fuzzy controller for the control of the charge and discharge of the battery bank, the embedding of the fuzzy control system in an FPGA is proposed, with the objective of creating an economical control system.

Figure 5 :
Figure 5: Membership functions for the input and output variables.

Figure 6 :
Figure 6: Relationship between the input and output variables of the FCS.

Figure 7 :Figure 8 :Figure 9 :
Figure 7: (a) Battery bank charging in process and (b) battery bank charging turned off.

Figure 10 :
Figure 10: Behavior on starting-up the microgrid with the battery bank.

Figure 11 :
Figure 11: (a) Connection of 125 W LED lamps and (b) disconnection of 125 W LED lamps.

Figure 12 :
Figure 12: (a) Connection of the DC bus to the laptop and (b) disconnection of the DC bus from the laptop.

Figure 13 :
Figure 13: (a) Connection of 500 W fluorescent lamps and (b) disconnection of 500 W fluorescent lamps.

Figure 14 :
Figure 14: (a) Change of control mode for photovoltaic panels and the activation of the battery bank and (b) change of operational mode in the photovoltaic panels and battery bank.

Figure 15 :
Figure 15: (a) Behavior of the voltage of the battery bank in discharge mode and (b) behavior of the current of the battery bank in discharge mode.

Table 1 :
AND-type fuzzy rules.International Journal of Photoenergy

Table 2 :
Response parameters of the current extracted from the battery bank.

Table 3 :
Response parameters of the DC bus voltage.