Abstract
The demand for electric vehicles continues to grow, as evidenced by global sales of electric vehicles reaching 2.2 million in 2019 and more than doubling to 6.6 million in 2021. The rapid growth of renewable energies and electric vehicles (EVs) necessitates the use of microgrids, which are a promising solution to the problem of integrating large-scale renewables and EVs into the electric power system. Besides, the essential policy support provided by the government is an increase in the availability of public charging infrastructure for EVs. This research employs a fast-charging configuration of an off-board charger with DC energy transfer. Implementation of DC energy transfer for vehicle-to-grid and grid-to-vehicle technology in a microgrid due to DC charging’s unrestricted charger-rated power and rapid power transfer. However, the integration of EVs in the Microgrid system creates some operational challenges, which in this research are power quality issues such as harmonics in power systems that affect both utilities and consumers. The design models using the PI controller and the fuzzy controller based on MATLAB software are simulated to determine the control system’s effectiveness. These simulations assess the control system’s performance, and both approaches help improve the system’s performance power quality by minimizing the system’s total harmonic distortion (THD). According to the results, the fuzzy logic controller exceeded the traditional PI controller as demonstrated by minimizing the THD and also in terms of improving the waveform quality which achieved high accuracy with good performance. This research also utilized the fuzzy logic controller to control the power transfer between EVs and the microgrid, which differs from other research work, to achieve high system efficiency for the benefit of consumers.
1. Introduction
The energy crisis is an ongoing social issue caused by the foreseeable end of the oil, gas, and coal cycle, which has resulted in a significant increase in greenhouse gases. Many scientists have raised their voices in recent years to warn about climate change, which is primarily caused by the use of oil and coal to generate energy. Furthermore, global energy consumption is increasing, which may lead to a shortage of fossil fuels in the coming decades. As a result, the availability of reserves is a major source of concern, and the demand for alternative energy generation continues to rise, causing microgrid technology to gain popularity [1]. A microgrid is a small subsystem of the power system that can operate in two modes: islanding mode and grid-connected mode. The microgrid was linked to energy storage, load, and generation systems. During grid-connected mode, the microgrid, on the other hand, will be treated as a controllable load [2]. Generation systems in the Microgrid configuration use renewable energy sources to meet the demand for electrical energy, which is emerging as a solution to the issue of electrical energy deficit. The deployment of microgrid systems has many benefits for both the consumer and the power utility provider. Integrating the microgrid into the grid can enhance the efficiency of the network, reduce emissions, and reduce the costs to be incurred by the consumers.
Electric vehicles that are used as energy storage are generally recommended for intermittent sources because renewable energy generation is affected by weather and climate conditions. The possibility to extend the idea of using EVs as energy storage to renewable energy sources and microgrid is high since EVs are parked 22 hours a day at work or home; the microgrid can incorporate EVs as an energy storage unit. EVs can consume and store energy while also generating power for the grid when parked and connected to the electrical grid [3]. As EVs grow and the transition is accelerated, charging units should become more prevalent, and charging times of electric vehicles should be reduced. Charge time reduction is an important issue that will hasten the transition. However, this will increase the load on the power system, so the most fundamental goals for EVs are to reduce charging time and improve power quality on the grid [4].
The US Department of Energy has classified EV charging into three levels, as stated in [5]. For the charge power rating of less than 5 kW, it is a standard EV charging known as level 1 charging, while level 2 charging has a charge power rating ranging from 5 kW to 50 kW. Moreover, it is implemented in this research for a power rating greater than 50 kW, known as superfast charging or level 3 charging [6]. Most superfast-charging (level 3) concepts are recognized by using an off-board charger outside the EV. Levels 1 and 2 charging require an onboard converter that allows AC energy to transfer and convert to DC energy. The superfast-charging concept based on DC energy transfer is recommended in this case because it reduces charging time to optimal conditions while providing high charging power ratings (90 kW, 200/450 V, 20–30 minutes), making it more appropriate for implementation than the other two levels of AC charging concepts. A control system is also required because most battery chargers operate as nonlinear loads. These loads resulted in an unbalanced distribution system, which caused power quality issues, affecting the consumer [7]. As a result, two effective control algorithms for G2V–V2G technology in microgrids are being developed in the proposed charging station based on the fast-charging concept (DC energy transfer). Both proposed control algorithms are evaluated in order to improve system performance and power quality while minimizing total harmonic distortion (THD) [8].
2. Literature Review
2.1. Existing PI Controller
In industry, a proportional plus integral controller, also known as a PI controller, is commonly used as a control loop feedback mechanism. The controller is divided into proportional (P) type and integral (I) type. The P-type controller’s function is to minimize system error by observing significant changes in output due to high proportional gain for small changes in error, which leads to an unstable system [9, 10]. The proportional output can be calculated as shown in the following equation:where = proportional output, = proportional gain, and = error.
Furthermore, the integral controller is working to accumulate all previous errors. The magnitude and duration of the error are factors in the integral controller. Then, all of the instantaneous errors are integrated and multiplied by an integral gain. The integral term is added to the proportional term, which causes the process to proceed rapidly to the set point and eliminates steady-state error, which occurs only due to proportional action [9, 11]. The integral action can be calculated as shown in the following equation:where = integral output, = integral gain, and = error.
As a result, PI-control correlates the controller output to the error and its integral. This PI-control behaviour is mathematically illustrated in the following equation:where = the output of the controller, = the controller gain, = the integral time, = error, and = the controller’s initial value.
The PI controller has the advantage of constantly calculating the error value by comparing the measured variable to the desired set point. The PI controller is becoming increasingly popular because it provides the designer with numerous options, such as the possibility of dynamic changes in the system, which may assist the designer, as well as its simple structure, which is widely used in many applications [9, 12]. However, according to [12, 13], the desired performance is unattainable due to the nonlinear system and the difficulty in determining the maximum gain value for the given control system. In such cases, using intelligent controllers such as the fuzzy logic controller is inevitable.
2.2. Proposed Fuzzy Logic Controller
The fuzzy logic controller, proposed by L. Zadeh in 1965, is widely used because an expert system operator can create the experience, knowledge, intuition, and control strategy as a knowledge base. Experts define fuzzy logic as a set of rules that cannot be mathematically defined or described as the action of a complex system. The control operations are simple and are carried out using verbal rules based on knowledge and experience [14]. As a result, fuzzy logic controllers are gaining popularity in a variety of fields, including designing and production techniques, decision-making, nonlinear approaches, and data analysis. When the system encounters dynamic changes, the conventional PI controller is replaced by a Mamdani fuzzy logic controller to achieve high accuracy and good performance. The fuzzy logic control system consists of one output with two inputs. The error, which is the difference between the reference and measure values, is the first input, and the change in error is the second [15]. Defuzzification is the process of obtaining a single number from the output of the aggregated fuzzy set. It is used to transfer fuzzy inference results into a crisp output. In other words, defuzzification is realized by a decision-making algorithm that selects the best crisp value based on a fuzzy set.
The following are the primary characteristics of a fuzzy logic controller:(1)Seven fuzzy sets have been chosen for one output and two inputs(2)A triangular membership function was chosen(3)Fuzzification employs a continuous universe of discourse(4)Mamdani min operator implication(5)Defuzzification is based on the centroid method
3. Proposed Methodology
This research has two proposed approaches. The first approach is to integrate the V2G and G2V technology in a microgrid using a fast-charging concept. The relevant works by other researchers should be analyzed to understand the idea of the microgrid and the components involved in the microgrid, and the essential part is the energy storage system of the microgrid. Energy storage of the system is the combination of EVs that will connect to the DC bus of the charging station through the off-board charger. The microgrid should be designed taking into account the weather data suitable for the efficient operation of the renewable energy sources that act as generation sources in the system. The proposed charging station configuration based on the fast-charging concept is modelled using MATLAB/Simulink. It is easier to use as a combination of computation, visualization, and programming. The Simulink model should be analyzed and tested to improve system performance and power quality while minimizing total harmonic distortion (THD). If the Simulink model works well, some EVs are combined as one energy storage system and connected to the proposed charging station configuration based on the fast-charging concept as shown in Figure 1.

After combining EVs as one battery storage system, the second approach is to control the charging and discharging of EV batteries, and an inverter should be followed. Control systems in EV batteries and inverters are significant because the power electronic interface’s control system will enable bidirectional power transfer between EVs and the microgrid. To begin, the available technologies for developing control algorithms for off-board chargers and inverters should be reviewed and modelled to determine the technology’s efficiency. In control systems, two controllers are used subsequently for evaluation, which is applicable for two algorithms. The first control algorithm is a constant current control strategy implemented for controlling discharging and charging of EV batteries. The second algorithm is a cascade control in the synchronous reference frame proposed for the inverter controller. If the system performs well, the proposed charging station configuration based on the fast-charging concept will be tested to allow high-power bidirectional charging for EVs via off-board chargers and improve the power quality in terms of total harmonic distortion (THD) of the system Figure 2.

3.1. Research Type
In this research, simulation-based experimentation is used. MATLAB/Simulink is used to design the proposed charging station configuration based on the fast-charging concept. The Simulink design includes subsystems of EV batteries connected to the charger’s fundamental building block, comprising a bidirectional DC-DC converter. A DC bus connects these four EV subsystems to a grid-tied inverter. Before reaching the grid, the inverter’s terminals are connected to the LCL filter, and the filter is connected to the transformer. The system’s performance can be evaluated. Control systems for off-board chargers and grid-connected inverters will be developed using two algorithms: for off-board chargers, a constant current strategy is implemented for controlling discharging and charging of EV batteries. A cascade control in the synchronous reference frame is proposed for the inverter controller. This is to ensure high-power bidirectional charging for EVs via off-board chargers and improve the system’s power quality in terms of total harmonic distortion (THD).
3.2. Research Design
This research simulation only focuses on the proposed fast-charging charging station configuration, which includes four subsystems of EV batteries connected to the charger’s fundamental building block, consisting of a bidirectional DC-DC converter. A DC bus connects these four EV subsystems to a grid-connected inverter, and the terminals of the inverter are connected to the LCL filter, which is connected to the transformer. The components involved in the charging station’s development are illustrated in Figure 3.

3.2.1. Design of an Off-Board Charger
Due to their essential features, off-board chargers are commonly used for fast charging concepts. It typically comprises higher kilowatt (kW) transfer and efficient battery management systems. The battery management system includes managing battery heating, communicating with building or home, grid energy management systems, demand charges, and weight removal from the vehicle [16]. The higher the energy transfer rate, the more electric vehicle supply equipment (EVSE) is required. The off-board charger is enclosed in an EVSE. The off-board charger’s fundamental building block, a buck-boost converter, is linked to the EV batteries. Figure 4 depicts the off-board charger’s bidirectional DC-DC converter configuration, which consists of two switches known as switch and switch, which are involved in charging and discharging control of the EV battery.

3.2.2. Three-Phase Grid Inverter with Filter
The proposed system is based on a three-phase grid inverter equipped with a filter known as an LCL filter. The grid inverter’s ability to convert DC voltage to three-phase AC voltage is determined by the suitability of the electric utility grid. The grid-connected inverter must always match the grid phase and maintain a slightly higher output voltage than the grid voltage. The switch diodes allow the current to flow backwards (Figure 3). Furthermore, by connecting the inverter’s output terminals to the LCL filter, current harmonics are reduced, resulting in pure sinusoidal voltage and current.
3.3. Research Process
The research procedure is organized, initiating the discharging and charging of EV batteries and then shifting on to inverter control, which explains both control algorithm processes.
3.3.1. Control of Charging and Discharging within the Off-Board Charger
This research employs two controllers, first using a PI controller, followed by a fuzzy logic controller with a constant current algorithm to be implemented within the off-board charger to control the charging and discharging of EV batteries. The controlling process of discharging and charging off-chargers involves two main components as shown in Figure 2, which are the off-board charger’s bidirectional DC-DC converter configuration that consists of two switches known as switch and switch. The switch, also known as a buck converter, regulates the charging mode. When the switch is closed and the buck mode operation is activated, the charging of an EV battery is allowed. A buck converter operates to step-down voltage from input voltage () to the required voltage of the battery (). At first, there is no flow of current in the circuit when and switches are opened. When the switch is closed, the current flows through the switch and inductor. During this time, the inductor stores energy in the form of a magnetic field. To complete the circuit, the current flows through the inductor and diode of the switch when switch is opened. The battery voltage can be calculated using the following equation [17]:where = EV battery voltage, = DC bus voltage or input voltage, and D = duty ratio of the upper switch.
Furthermore, the switch regulates the discharging mode, also known as the boost converter. When the switch is closed, the boost mode of operation is activated, allowing the discharging of an EV battery, which increases the to a specified . A short circuit occurs when the switch is closed, and current flows through the switch and back to the source [18]. The inductor’s polarity is reversed during this process. The energy stored in the inductor is released, and current flows continuously through the inductor, completing its circuit via the diode and the capacitor. If the value capacitor is large enough for a constant the DC voltage can be calculated using the following equation [17]:where = DC bus voltage or input voltage, = EV battery voltage, and = duty ratio of the lower switch.
PI controller with a constant current algorithm to control the charging and discharging of EV batteries within the off-board charger is as shown in Figure 5, whereas Figure 6 shows the same control algorithm implemented but with a different controller, a fuzzy logic controller [19].


3.3.2. Controlling Mechanisms for Control of Charging and Discharging within the Off-Board Charger
The charging and discharging processes within the off-board charger are controlled by both controllers using identical controlling mechanisms. To identify the polarity of the current signal, the controller first compares the I (battery-reference) to zero as shown in Figure 7.

When the current signal is positive, the discharging mode is selected; when it is negative, the charging mode is selected. The difference between reference and measured currents after choosing a mode is used to generate the / switching pulses via a PI controller/fuzzy logic controller. will be disabled during the charging process, while will be disabled during the discharging process as shown in Figure 8.

3.3.3. PI Controller/Fuzzy Logic Controller-Based Cascade Control Algorithm for Inverter
Figures 9 and 10 show a cascade control algorithm for inverter controllers implemented by four PI/fuzzy logic controllers in a nested loop. This control structure is made up of four loops. The two outer loops control the voltage, while the two inner loops control the current. The outer loop of the d-outer axis controls the DC bus voltage, while the inner loop controls the active AC current. Similarly, the q-axis inner current loop modifies the reactive current, allowing the q-axis outer current loop to control the magnitude of the ac voltage. The decoupling terms L and feedforward voltage signals are introduced to improve performance during transients.


4. Result Analysis
The proposed charging station configuration is adapted from [17], and the parameter values set within the components are shown in Table 1. Four EV battery subsystems are implemented in this research. Each subsystem consists of an EV battery connected to bidirectional DC-DC converters that form an off-board charger. A DC bus connects the four EV battery subsystems to a grid-connected inverter, which is then coupled to an LCL filter, a step-up transformer, and finally to the utility grid. The EV1 and EV2 subsystems are used for the V2G and G2V operations, and the results of simulation using the PI controller and simulation using the fuzzy logic controller are shown in the figures below. Figures 11and12 show the battery parameters for EV1 in V2G operation, while Figures 13 and 14 show the battery parameters for EV2 in G2V operation.




4.1. Simulation Using PI Controller
Simulation using PT controller is shown in this section.
4.2. Simulation Using Fuzzy Logic Controller
Figures 11 and 12 show that the SOC and voltage of the battery decrease from 1 to 4 seconds for both PI and fuzzy controller algorithms, demonstrating that the vehicle feeds power to the grid (V2G operation). Besides, at 4 seconds and above, as shown in Figures 13 and 14, the SOC and voltage of the increase as it gains power from the grid (G2V operation). Figures 15 and 16 depict the active power contribution of system components for both the PI controller and the fuzzy logic controller. To satisfy the power transferred by the EV, the power grid changes its polarity from negative to positive. In the first 4 seconds, the grid-rated power is approximately −40 kW, indicating that the EV supplies power to the grid. After 4 seconds, the grid-rated power is estimated to be 30 kW, implying that grid-supplied power is used to charge the EV. These results show the V2G-G2V operation. Furthermore, the system is in optimal power balance because the net power at PCC is constant at zero. As shown in Figures 17 and 18, the inverter regulates the DC bus voltage for measured voltage and the reference voltage, both at 1,500 V, and Figures 19 and 20 show the current that the grid inverter controller has monitored. Figures 21 and 22 show that during G2V operation (after 4 seconds), the grid current and voltage are in phase at PCC, whereas for Figures 23 and 24, during V2G operation, the grid current and voltage are not in phase, with a 180° difference.










5. Comparative Performance Analysis
The impact of total harmonic distortion (THD) on the injected grid current can be used to evaluate the effectiveness of both controllers, as shown in the figures below. The total harmonic distortion (THD) of the grid-injected current for the PI controller is 2.34%, while the THD of the grid-injected current for the fuzzy logic controller is 0.04%. The LCL filter’s design reduces both THDs, which helps reduce the harmonics of current absorbed by the inverter. However, the fact that the percentage of THD for the fuzzy logic controller is lower than for the PI controller indicates that the distribution system’s efficiency is higher than when using PI controller, which results in a unity power factor. Figures 15 and 16 depict the active power profiles of the system’s components for PI control and fuzzy control, respectively. It was discovered that the waveform active power profile for fuzzy control became more stable and achieved high accuracy with good performance. The fuzzy logic controller clearly outperforms the PI controller in terms of minimizing THD as shown in Figures 25 and 26; the fuzzy logic controller has a lower DC voltage spike than the PI controller, as shown in Figures 17 and 18. This is supported by [20], whereas fuzzy logic controllers may have some drawbacks in some cases because fuzzy logic is an approximation of experienced rules, and the system’s efficiency is low because they primarily work on inaccurate inputs, causing some rules to be mismatched and noncoherent with the system. THD of grid-injected current between PI controller and fuzzy logic controller is as shown in Figure 27. This has an impact on the accuracy of fuzzy output, so performance degradation is to be expected. Table 2 summarizes the results for both controllers, the PI controller and the fuzzy logic controller.



According to the results, the traditional controller employing the PI controller supported by [17, 21, 22] is simple to build and produces great results, but additional controllers that allow more accurate control of the variables involved must be developed. As a result, this study compares the performance of a fuzzy controller to that of a regular PI controller. The results reveal that fuzzy logic minimization of THD outperforms the PI controller. Furthermore, the waveform quality is steadier than when using a PI controller despite the fact that the reference voltage and measured voltage of the DC bus for fuzzy logic control spike more than the PI controller. The efficiency of a fuzzy system is improved if membership functions are optimized using any optimization algorithm. According to the literature, there has been relatively little work done on the control aspect of EVs and the Microgrid using the fuzzy logic controller in terms of controlled techniques for charging or discharging EVs energy to the Microgrid. Control of energy flow between EVs and the microgrid has been demonstrated in this research using fuzzy logic controllers, primarily to reduce THD and improve system waveform quality in order to achieve high system efficiency for the benefit of consumers.
6. Conclusion
V2G and G2V integrations can charge or inject power into the grid when parked and connected to the grid. The implementation concept necessitates an efficient power transaction and a substantial exchange of information. EVs will be treated as controllable loads and combined with renewable energy via an off-board charger enclosed in an EVSE capable of supporting V2G and G2V methods. The fuzzy logic controller outperformed the PI controller in terms of waveform quality, likely unity power factor, and THD as low as 0.04%, as opposed to 2.34% for the PI controller and allowing for efficient power transfer between both modes (V2G and G2V). As a result, this research successfully demonstrated the use of fuzzy logic controllers to control the energy flow between electric vehicles (EVs) and the microgrid, with the goal of reducing total harmonic distortion (THD) and improving system waveform quality to achieve high system efficiency for the benefit of consumers although facing limitation in terms of reducing the voltage spike of the DC bus. The control aspect of the power transfer between EVs and the microgrid using the fuzzy logic controller make this research differ from other research works and optimization of the fuzzy logic controller to improve the voltage spike in DC bus is suggested for future research.
Data Availability
The required data can be obtained from the corresponding author upon an email request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
This research was funded by the University Research Grant (3/2022/06) and supported by the Centre for Research of Innovation and Sustainable Development (CRISD) of the University of Technology Sarawak, Malaysia.