FPGA-Based Single-Phase PV Inverter Using Unipolar and Bipolar SPWM Control Techniques

 Investigation of FPGA-based SPWM generator as a control mechanism for a PV/Battery full-bridge inverter  The unipolar SPWM technique produces less harmonic distortion than the Bipolar method, with THD 45% lower  The system implementation of SPWM Pulse generation has been validated on Xilinx Spartan 6 FPGA (XC6SLX45) board using VHDL code. The study presents circuitry modeling and methodology to integrate solar photovoltaic (PV) energy with grid (AC) sources to supplement household appliances during a power cut-off or restricted supply period and alternating charge deep cycle batteries. This paper discusses an FPGA-based Sinusoidal Pulse Width Modulation (SPWM) generator as a control mechanism for a PV/Battery full-bridge inverter. The inverter's efficacy is expressed as the Total Harmonic Distortion (THD) ratio, which must be as low as possible. Various schemes are proposed to reduce THD to generate a more sinusoidal output wave. SPWM is mostly used in industrial inverters. Two SPWM techniques, Bipolar and unipolar, are compared under a variety of Modulation Index (MI) conditions and Carrier Frequency (fc) to analyze the best performance of the full-bridge inverter with less (THD) and smoother output sinewave. The present paper discusses the results of a simulation for a single-phase full-bridge inverter employing bipolar and unipolar SPWM techniques. The output waveform demonstrates that the Unipolar SPWM technique produces less Total harmonic Distortion than the Bipolar method, with THD 45% lower. ISE 14.7 and Matlab 2019 are used to present, simulate SPWM generating code, and implement the design on a field-programmable gate array (FPGA), which acts as a controller for the Mosfet gates in the full-bridge inverter to constitute a sine wave without changing any hardware configuration in the circuit design. The system implementation of SPWM Pulse generation has been validated on Xilinx Spartan 6 FPGA (XC6SLX45) board using VHDL code. The final test on the system design for the SPWM generation program, after synthesis and compilation were finalized and verified on a prototype system. A R T I C L E I N F O Handling editor: Ivan A. Hashim


Introduction
Solar energy is seen as one of the cleanest, most abundant renewable sources of energy for the future of power generation. Furthermore, with the rapid growth of the populace in urban, suburban, and provincial sectors, the essential requirement of alternative electrical energy is continuously growing.
An inverter is a type of electrical equipment that converts a Direct Current source (DC) from (PV panel or Battery) to an alternating current source (AC). Inverters can be configured in half bridge or full bridge topologies, depending upon the design of the power electronic switches. The full-bridge structure is shown in Figure 1, which consists of two sections, each equipped with two Mosfet switches. The center points of the sections are linked throughout the transformer that supplies power to the load. The gates are controlled by PWM signals through a Xilinx FPGA board.
This paper compares the performance of Unipolar and Bipolar SPWM switching systems using Matlab-Simulink simulations on an H-bridge single-phase inverter. The modulation index (MI) and its varying effects on the resulting inverter output's THD content are investigated. Compared to a bipolar inverter to a unipolar inverter, the output presents a more precise sinusoidal waveform with reduced Total Harmonic Distortion (THD). A unipolar PWM-triggered inverter produces the best sinusoidal output signal [1]. It is noted that Full bridge Unipolar SPWM is more efficient, has lower switching losses, and 387 lower Total Harmonic Distortion (THD). Hence, it enhances power quality and simplifies the filtering process, giving a smoother sinusoidal output waveform than the bipolar inverter [2].

Related Works
SPWM modulation control techniques in inverter systems have gained increasing attention for their low cost and less hardware complexity. Many studies have documented in connection with single-phase, three-phase PV inverters using SPWM control techniques and some previous studies that discussed Total Harmonic Distortion of the output current and voltage of the FPGA-based inverter. Baroi, Samanta, and Banerjee examined many types of inverters and their output waveforms, including square wave and SPWM inverters. The outputs of the SPWM inverter are analyzed using the Fast Fourier Transform (FFT) technique. Also, Variation in THD is presented as a function of Modulating Index and Carrier Frequency. The research demonstrates that as the Modulating Index increases, the THD decreases. As a result, this conclusion may be applied in the hardware design of Sinusoidal PWM inverters with the benefit of reduced THD [3].
Bajpayee et al. compared the FFT performance of three distinct inverting designs triggered using sinusoidal pulse width modulation (SPWM). FFT analysis is used to analyze SPWM-based Unipolar and Bipolar inverter topologies. It is observed that the sinusoidal performance of bipolar inverters employing SPWM is superior to that of other comparable switches. The primary objective is to deal with high voltage applications. Isolated-Gate Bipolar Transistor (IGBT) is ideal because of its increased speed and capacity [4]. Alhamrouni et al. had offered a single-phase PV inverter with a sinusoidal pulse width modulation (SPWM) and a low pass filter linked between the inverter and the grid-connected utility to reduce harmonics generated by renewable energy sources. To adjust the magnitude and frequency of the output voltage, both unipolar and bipolar switching schemes are used. Matlab/Simulink is used to simulate the suggested methodology. Through analysis of the simulation results, it was determined that in comparison to the bipolar switching system, the unipolar switching method generates a more sinusoidal and smooth output waveform with less harmonic distortion. However, bipolar switching provides a lower power grade than unipolar switching [5].
Hassaine and Bengourina designed a grid-connected solar system. The main objective is to control the quantity of electricity generated by the solar generator, injected into the grid by the inverter, increasing the photovoltaic system's efficiency. The quality of electricity fed into the grid and the converter system's performance is dependent on the inverter's current regulation. For a solar system connected to the grid, a control method based on Digital Pulse-Width Modulation (DSPWM) is proposed to synchronize a sinusoidal output current with the grid voltage and modify the power factor. This control is based on a bipolar PWM controlled single-phase inverter with a lineal current control. This controller is programmed digitally using VHDL and executed on a Field-Programmable Gate Array FPGA. Digital current control demonstrates the suggested SPWM method's capabilities and simplicity of digital implementation. This method can significantly increase the power quality for the outputs of grid-connected photovoltaic inverters while also lowering the equipment costs associated with these systems [6].
Sarker, Datta, and Debnath [7] suggested a sinusoidal pulse width modulation FPGA-based generator design with configurable modulation index, high frequency, high-resolution digital that meets the requirements for MI adjustment, and high-frequency switching in voltage-source inverter systems. The MI is regulated using a mathematically optimized FPGA architecture by varying the duty-cycle values of the pulses generated by the SPWM in response to the measurements at the inverter output. The laboratory setup was utilized to conduct simulations and tests to demonstrate the proposed FPGA-based architecture fundamentally capability of regulating the MI modulation index value of the SPWM generation for a Voltage-Source Inverter (VSI) application under a variety of input and load conditions. Additionally, the suggested design consumes the fewest FPGA resources, consumes the least power, and has the lowest THD of all previously proposed SPWM methods under consideration. Therefore, the SPWM architecture is the optimal choice for grid-connected inverter applications and variable MI applications due to its superior performance in terms of harmonic distortion, resolution, and power consumption [7].

Methodology
The proposed system design Figure 2 shows the proposed system design consisting of three inputs (Grid, PV, and battery), an FPGA, full-bridge inverter, and dc to ac rectifier. Three input sources are, PV, Grid, and Battery, are selected according to a priority sequence, which is given by FPGA. The SPWM signals are generated by the Xilinx Spartan 6 FPGA (XC6SLX45) board connected to the driver circuit during PV and battery-working time. When there is electricity from Grid, the system will feed the power directly to the load and charge the battery by a full-bridge AC/DC rectifier. The driver circuit consists of 4 ICs which amplifies the output signals to 15 VDC. The outputs of the driver circuit are connected to the Mosfets' gate terminals. A 12 to 220 AC transformer was connected to the mid legs of the Mosfets. A low pass filter provides a clean sine wave signal then filters the inverter's output. Figure 3 shows the flow chart of the system. The priority is given to the AC grid, PV solar, and Battery, respectively. When there is electricity from the Grid, it feeds the house and charges the battery. Otherwise, the system chooses PV when it has sufficient power or Battery to be sent to the inverter's DC source. The FPGA board connected to the driver circuit 388 generates the SPWM signals. This driver circuit consists of 4 TLP250 opto-coupler that amplify and control the FPGA signal to a specific range of 15-volt DC and protect the FPGA board from any short circuit. Then the outputs from the driver circuit are connected to the gate terminal. The inverter's output is then filtered to provide a pure and smooth sine wave signal.

Theoretical Foundation Sinusoidal Pulse Width Modulation (SPWM)
Sinusoidal Pulse Width Modulation is the most often utilized technique for voltage source inverters in industrial applications (SPWM). The width of the pulses is varied in proportion to the amplitude of a reference signal measured at the pulse's center. When a reference sinusoidal waveform frequency (fr) is compared to a triangular carrier waveform (fc), switching signals are generated. The reference frequency signal (fr) controls the modulation index ratio (ma) by defining the inverter output frequency, peak amplitude, and modulation index. The switching or carrier frequency generates the pulses in every half-cycle. The SPWM inverter operates with a steady DC input and generates sinusoidal waveforms at a specified frequency. For H-bridge inverters, two SPWM methods are available: bipolar and unipolar switching methods. SPWM generation in Bipolar and Unipolar methods is illustrated in Figure 4. The modulation index (Ma) is often referred to as the amplitude-modulation ratio, which is represented in equation (1) The resultant high-frequency harmonics of the SPWM signal are then filtered using a low pass filter, resulting in a highpower and low-frequency sinusoidal waveform Vo at the dc/ac inverter's output terminals. The following equation (3) calculates the amplitude of the output voltage [9].

. . 3
Where: : Dc input voltage of the dc/ac inverter.

Switching strategies
The input data is analyzed mathematically. The intersection of the reference signal and carrier signal creates PWM pulses with periods ranging from n to ßn in each pulse, as seen in Figure 5.
Each pulse's width at the start and end of each half cycle of the reference signal has the same scale. For example, in the reference signal's positive half cycle, the pulse's width (t1) equals the pulse width (tn) of the previous pulse in the positive half. The period (T) of the reference input frequency (fr) can be calculated in (4). Equations (5) and (6) are used to calculate the switching Angles (αn to ßn) for the beginning and the end of each pulse, respectively, where equation (7) defines the width for each pulse [8]. Where: T: Time, fr: Reference input frequency, α and ß : Switching angles for the beginning and the end of each pulse, respectively.

Xilinx Field-Programmable Gate Array (FPGA)
FPGA is a Field Programmable Gate Array, a part of Programmable Logic Device (PLD) that includes thousands of logic gates. Several of them are connected to make a Programmable Logic Block (CLB). A CLB simplifies the design of high-level circuits. SRAM or ROM provides software linkages between logic gates, enabling the planned circuit to be changed without altering the hardware. Continuous operation, decreased hardware requirements, easy and quick circuit modification, the relatively low cost for sophisticated circuits, and rapid prototyping make it the best choice for prototyping an application with a customized integrated circuit. Figure 6 shows the Xilinx Spartan 6 FPGA (XC6SLX45) board used in this proposed design.
The clock divider in FPGA divides the 50 MHz clock frequency to get the desired 50 Hz of output sinewave with a desired number of pulses according to the carrier frequency in equation (8). The frequency distribution to calculate the FPGA scale number can be obtained by equation (9) Figures 7 and 8 show the simulation of the SPWM techniques, Bipolar and Unipolar, respectively [10]. The switching angles of the desired pulse width modulation (PWM) for each Mosfet gate are concluded from these Matlab simulations. Table 1 shows the data obtained for switching angles from Matlab simulation. The switching data for a Bipolar SPWM was obtained for a 4 kHz switching frequency with a modulation index =1. The data are used in the VHDL programming of the FPGA board to acquire the PWM signals, which controls the gate of the Mosfets.

Simulation Results and Analyses
This project includes two forms of software simulation: circuit simulation using Matlab Simulink (2019) and SPWM pulse generating for the Xilinx FPGA Spartan 6 board using the ISE 14.7 software. The SPWM generator and single-phase fullbridge inverter are designed using Matlab Simulink simulations. The simulation findings are imported into ISE 14.7 and are a reference for designing the hardware component. ISE 14.7 software from Xilinx is used to generate the SPWM in a VHDL (The Very High-Speed Integrated Circuit Hardware Description Language). This simulation process is essential since the ISE 14.7 software's SPWM generating pulse is utilized as the SPWM generator to control the full-bridge inverter circuit. The final generated VHDL code is implemented to Xilinx Spartan 6 FPGA (XC6SLX45) board. All the related waveforms from the simulation are obtained and measured.    Figures 9 and 10 show the %THD analysis with fc=4 kHz, MI=1. Figures 11 and 12 show the %THD analysis with a modulation index of MI=0.9 respectively for both unipolar and bipolar methods, and the results are recorded in Table 2.

Total Harmonic Distortion (THD) comparison in Matlab
Programming of the Field Programmable Gate Array (FPGA) After simulation, a VHDL code, which represents the recorded data from Matlab, is generated and implemented to an FPGA board through a USB cable by ISE 14.7 software, shown in Figure 13.
After implementation, the design summary is represented in Figure 14, which shows how many memory slices were used from the total slices available in the FPGA.
The hardware design is constructed, and the VHDL code implementation is accomplished successfully. The hardware design consists of Spartan 6 FPGA (XC6SLX45), an opto-coupler gate driver circuit, a full-bridge inverter circuit, and a sufficient low-pass filter. Figure 15 demonstrates the entire proposed design hardware. Figure 16 shows the output sinusoidal wave illustration with an oscilloscope.

Conclusion
The sinusoidal output waveform at the load with 220 VAC and 50 HZ frequency shows that the design of the FPGA-based SPWM PV inverter system has been successful with two SPWM techniques (unipolar and bipolar). The inverter's output voltage is required to be sinusoidal and configurable in amplitude and frequency, which were represented in the system design 395 by changing the Modulation Index and varying the switching frequency. This paper compared Unipolar and Bipolar SPWM methods with varied modulation indices. The obtained results show that the unipolar scheme has an advantage of a lower percentage of Total Harmonic Distortion (THD) compared to bipolar. According to the Matlab simulation and experimental output data, a unipolar inverter with a sufficient low pass filter circuit produces a more smooth sinusoidal output waveform with lower Total Harmonic Distortion (THD) than a bipolar inverter, with less than (45%). Using an FPGA in the system makes the hardware design simpler and less complex for its high-speed switching up to (MHz) and high resolution. Such a feature allows for flexible adjustment of the planned circuit without modifying the system's hardware, resulting in less hardware easier and faster circuit modification.