Abstract

The excessive use of nonlinear load causes electric current harmonics that ultimately downgrades the electrical power quality. If a failure exists due to internal integration of a power system in any one of the internal networks, it causes uncomplimentary consequences to the entire power system’s performance. This paper proposed a hybrid shunt active harmonic power filter (HSAHPF) design to reduce harmonic pollution. A digital controller HIL simulator has been modeled using a three-phase voltage source inverter to test the efficiency of HSAHPF and the performance of control algorithms. Moreover, the instantaneous active and reactive current theory (Id − Iq) and instantaneous active and reactive power theory (Pq0) control algorithms are implemented for the reference current generation in HSAHPF, resulting in reduced harmonic distortions, power factor improvement for a balanced nonlinear load. The control algorithms are further employed in Arduino MEGA to keep the factor of cost-effectiveness. The simulation of the proposed design has been developed in Simulink. The validation and testing of HSAHPF using controller HIL simulation prove the control algorithms’ ability to run in a portable embedded device. The statistical analysis of the proposed system response provides a minimum total harmonic distortion (THD) of 2.38 from 31.74 that lies in IEEE 519-1992 harmonic standards with an improved stability time of 0.04 s. The experimental verification and provided results of the HIL approach validate the proposed design. Significant mitigation of harmonics can be observed, consequently enhancing the power quality with power factor near unity.

The delivery of quality power through power systems is a global business, and it has remained a focal point for industry professionals and researchers during the last few decades. The use of nonlinear load in industries increases harmonic pollution and downgrades the electric power quality. The network failure occurs due to the power system’s internal integration that causes uncomplimentary consequences to the entire system. In recent years, electric current harmonics and their mitigation are hot topics in industries. The excessive nonlinear load reduces the equipment life and degrades the electric power quality. In Pakistan, industries are using power factor (pf) improvement devices to improve power quality. For attaining this purpose, capacitors are used instead of reactors, which introduce odd harmonics and resonance into the power system. In addition, the nonlinear loads draw current, which is not flawlessly sinusoidal as the current waveform diverges from a sine wave; hence, the distortions in voltage waveforms are created. The harmonics are responsible for electronics miss-timings, increased heating effect in electrical equipment, overheating power transformers, capacitor overloads, and losses in distribution lines [1, 2].

There are numerous filtering techniques for harmonics mitigation proposed in the existing literature, that is, passive power filter (PPF), active power filter (APF), and hybrid power filter (HPF). The PPF technique has been used to provide a low-impedance path to harmonics of different frequencies and diminishes their effect using tuned capacitors, reactors, and resistors. These are low cost, but the major disadvantage of using the PPF is producing resonance in the power system [3]. Moreover, APF is used where the voltage sag and swell with spikes are present. Their major drawback is a high operating cost and limitation for low rating load in industries [4, 5]. A combination of PPF and APF into a single device (known as a hybrid filter) is used where both current and voltage harmonics show degeneration in the power system’s performance. They are further divided into two types: shunt hybrid and series hybrid filters. Total load current passes through series hybrid filter, enhancing the power losses as they are directly proportional to the current (P = I2R). The shunt hybrid filters are preferred due to their durability, performance consistency, and low power losses [6]. For the deployment of APF and HPF, several control strategies, such as selective harmonic elimination-based pulse width modulation (SHE-PWM), fast Fourier transformation technique (FFT), recursive discrete Fourier transformation (RDFT), Pq0, direct testing and calculating (DTC) methods, that is, Id − Iq [7, 8], notch filter, generalized integral, sine wave multiplication, adaptive filter, synchronous detection algorithm, artificial neural network (ANN), adaptive linear neuron (ADALINE), wavelet transformation (WT), particle swarm optimization (PSO), and genetic algorithm (GA) techniques have been presented in the literature [9, 10]. Developing a practical and real-time system has a significant task. An appropriate control algorithm is implemented using the digital signal processor for the applied control engineering (dSPACE) board as an archetype, based on the DS1104 microcontroller. Various techniques were used to develop real-time simulation platforms for the designing, analyzing, and testing power systems, and their practical applications were discussed. The major components of a real-time digital system (RTDS) used in engineering industries and academia were deliberated for summarizing its significant features for a better understanding of relevant techniques [11, 12].

A shunt hybrid compensator centered on the synchronous rotating reference frame (SRRF) control algorithm in the direct quadrature (Dq) axis is designed and fabricated in HIL to improve the steady-state power factor and at the supply side to ensure the dynamic harmonic compensation. Performance analysis is done through MATLAB simulations for varying loads, while THD at the supply side and current harmonics reduction were also confirmed [13]. Moreover, a photovoltaic (PV)-incorporated SAPF has been designed and implemented in MATLAB/Simulink to improve the power quality to generate clean electrical power. Various control techniques, such as ANN, fuzzy logic control technique (FLC), an adaptive neuro-fuzzy-based inference system (ANFIS)-based controller maximum power point tracking (MPPT) to extract maximum power from PV-integrated SAPF, with SRRF-based control algorithm for reference current extraction are executed and validated with strong computational engine OPAL-RT 4510 based on field programmable gate array (FPGA) for real-time testing. The performance evaluation and comparison of various control algorithms (for balanced and unbalanced load) based on THD, losses, voltage drop, and pf have been presented along with optimized cost analysis by Kumar and Bansal [14] and Asif et al. [15].

Furthermore, SAPF is implemented using adaptive frequency-based reference compensation current as control topology and is verified with HIL by Chen et al. [16]. In addition, to investigate the experimental efficiency of HIL-based power electronics devices and applications, a single-phase transformer-less hybrid series active filter (THSeAF) has been implemented based on a duo-neutral point clammed (D-NPC) converter for discussing the power quality at the distribution level. The HIL benchmark presented a five-level D-NPC-THSeAF in Javadi et al.’s study [17] using the OPAL-RT simulator for the electrical system. Moreover, the controller has been implemented on dSPACE as an interface. This work also presents real-time testing and is validated using the HIL technique [17]. The particle swarm grey wolf optimization (PSO-GWO) and fractional-order proportion-integral-derivative (FOPID) control techniques have been implemented for power quality enhancement, and the parameters of the FOPID controller are tuned by the PSO-GWO algorithm [18].

To connect a run-time simulator with a hands-on embedded controller, it receives an analog signal from the RT-Box simulator that executes it to generate gate signals to send back to the simulator for proper switching. Both are interconnected with launch-pad interfacing [19]. A real-time simulator introduced by RTDS technologies has been employed to perform a two-level simulation (three-phase VSI with parallel connection of a single tuned passive filter). Moreover, it has been implemented and tested in HIL while the control algorithm has been executed in the hardware [20]. Dq current control technique for generating reference current using a modified phase-locked loop (PLL) approach is simulated in Simulink, to handle the double frequency components of nonsinusoidal voltages. The proportional-integral (PI) controller has been used in the DC-voltage loop. A testbed prototype for verification of SHAPF is also built on the dSPACE1104 controller for real-time execution [21].

SHAPF is designed and simulated in Simulink for multiple harmonics mitigation using an innovative controller. The verification of the electronic control strategy of SHAPF was experimentally done on a digital signal processor (DSP)-based microcontroller unit [22]. Pq0 theory is implemented to extract reference currents and all the three phases for balanced and unbalanced nonlinear load, and to obtain the switching angles and gate pulses for controlling the VSI switches, hysteresis current controller is employed in MATLAB/Simulink. The target of these studies is to design and implement a power filter that can minimize the harmonics within the specified range of IEEE standards [23]. Multiple fuzzy membership functions, that is, triangular, Gaussian, and trapezoidal, are used with SAPF for improved power quality and eradicating uncertainties from the system using (Id − Iq and Pq0) control strategy. The real-time testing of results has been validated through hardware implementation on OPAL-RT. Comparing different membership functions with FLC using the same control strategy is also done [24]. The latest method for restraining unwanted distortions for determining the STPF compensator value in a non-sinusoidal power system using nonlinearity current index (NLCI) has been suggested and implemented in the proposed paper [25].

The existing literature presents various APF design and control techniques for harmonics mitigation, reactive power compensation, and power quality improvement. The majority of previous efforts aimed to verify the power quality using run-time simulators for balanced three-phase systems. However, to the best of our knowledge, the proposed methodology for HSAHPF development through embedded system and simulation interface (Simulink) is a novel implementation. Moreover, the proposed system also demonstrates the ability of control algorithms to run in a portable embedded device. Furthermore, this work aims to develop an HIL simulator framework for monitoring and verifying three-phase HSAHPF to detect harmonics in the system and mitigate their effect on power quality improvement. The main objectives of the proposed technique are listed as follows:(i)Development of controller HIL simulations that facilitate the integration of embedded system (Arduino) into the simulation interface (Simulink).(ii)Implementation of control algorithms based on Pq0 and Id − Iq with hysteresis control topology (in outer loop) and PI controller (in inner loop) using controller HIL testing method.(iii)Comparative analysis of both techniques in the HIL controller.

A controller HIL technique has been implemented by interfacing Simulink with an external controller board (Arduino) and transforming Pq0 and Id − Iq control techniques into programmed control codes for HSAHPF to generate the reference currents for harmonics mitigation. Controller HIL is a productive platform in academics and practical conditions to minimize the cost, risk, and duration. The key benefit of HIL controller’s implementation is that the complete system (including power and control circuits) can be verified without accurate power transfer. Thus, it becomes a secure and reliable testing approach for power systems. The block diagram of the overall proposed technique is depicted in Figure 1.

The block diagram of SHAHPF in Figure 1 illustrates that Vsa, Vsb, and Vsc are the voltages across all the phases, Ila, Ilb, and Ilc are the load currents across three phases, Ica, Icb, and Icc are the filter currents, and Vdc is the capacitor voltage. To reduce the power rating for conventional 3 legs and 6 IGBTs of APF, a single tuned passive harmonic power filter tuned for fifth-order harmonics was implemented in Simulink. At the same time, the targeted part for HIL is the control strategy implemented in APF. The primary purpose of HIL testing is to generate the C language code for reference currents according to the aforementioned control algorithms that are equal in magnitude but opposite with 180° phase-shifted current signals. It is used to overcome the effect of distorted harmonic waveform which is implemented in microcontroller. Moreover, a detailed comparative analysis of Simulink and HIL controller-based techniques on THD and efficiency is performed.

The rest of the sections in this paper are organized as follows: Section 2 presents the power circuit topology of HSAHPF and the fundamentals of HIL implementation, conventional control techniques for hybrid filters, design parameters for power circuits, and proposed control algorithms along with their implemented model in Simulink and HIL controller. In Section 3, controller HIL simulations and results are presented that contribute to the discussion of theoretical and experimental results verified through HIL simulations. In Section 4, a comparative analysis of both proposed and conventional techniques is discussed based on THD and HIL-implemented control algorithms’ effectiveness. Finally, Section 5 encapsulates the findings and substantial contributions of this research work.

2. Materials and Methods

We have proposed a design of HSAHPF filter to minimize the harmonics from electric current and hence, enhance the electric power quality. A digital controller HIL simulation-based technique is implemented for power quality improvement and THD reduction. Moreover, different controlled methods are implemented along with Arduino MEGA to keep the factor of cost-effectiveness. The following subsections provide the details of implementation.

2.1. Power Circuit Configuration of HSAHPF

The power circuit of HSAHPF is designed in Simulink combined with a single tuned PPF in series with APF (Figure 2). The PPF in HSAHPF contains a single tuned RL circuit used for low-order load current harmonics compensation, that is, third and fifth order. It also compensates reactive power components due to highly nonlinear load. For low-voltage distribution systems and grounded transmissions, the neutral wire current is commonly used. The source current (Isabc) is mainly comprised of the load current (ILoabc) and the compensating current (Icabc) to avoid the harmonics distortion of PPF.

Furthermore, APF mainly consists of a DC-link capacitor bank and a VSI. The central part of HSAHPF is VSI that produces the reference current in coordination with a voltage regulator to compensate harmonics. Hence, the switching losses are reduced effectively using the proposed configuration of HSAHPF. The voltage rating of APF is also minimized due to its low DC reference voltage constraint through the avoidance of both series and parallel resonance. In this paper, HSAHPF has been implemented with two different models and control techniques in Simulink. The power circuit remains modeled inside the Simulink with the control algorithms employed in microcontroller for monitoring and verification.

2.2. Conventional Control Methods

The performance of the HSAHPF is like an open circuit for the harmonics introduced by the switching devices. An assumption has been made that any set of arbitrarily chosen reference currents can be drawn by the compensator behaving like a controlled current source to introduce a simple design of the HSAHPF. The basic idea for the harmonic current compensation using a parallel-connected filter is illustrated in Figure 3. The PPF is tuned for a specific harmonic frequency based on reactive power compensation. The prominent harmonic in the system is under observation as the source current, including the load current and the compensating current to evade the harmonic propagation raised by the resonance of the PPF. The continuous harmonic damping can also be provided throughout the power line using an HSAHPF. The energy storage element that is a capacitor for VSI must be large enough that should not allow the system to experience significant voltage variations. The converter will surely lose its controllability if the DC voltage gets lower in magnitude than AC voltage.

2.2.1. Instantaneous Active and Reactive Power Theory (Pq0)

Time-domain defines the set of instantaneous powers on that the Pq0 theory is based. It is equally valid in both transient and steady states because it can be applied to the 3 − ∅ and three-wire or four-wire system without any modifications or restrictions. The aforementioned theory is very systemized and versatile regarding the controller design for the power electronics-based power filters. The two significant transformations involved in this theory are as follows: (1) the transformation of power system current and voltage from domain to domain and (2) the transformation of domain voltage and current into active and reactive powers.

(1) Clarke transformation includes the conversion of three-phase instantaneous currents and voltages from phases to coordinates. Clarke transformation for both current and voltages for power invariance case are under observation in equations (1) and (2) [26]:

(2) Similarly, inverse Clarke transformation for both current and voltages can be observed in equations (3) and (4) and can be verified from details explained by Balasubramanian et al. and Jawad and Iqbal [13, 27].

Clarke and its inverse transformation both have the attribute of invariance of power. In a three-phase system, this characteristic is preferred when the primary target is the inspection of instantaneous power. Applying the transformation of instantaneous voltage and current from 3 − ∅ to axes, the real power , imaginary power , and zero sequence power are defined in equation (5), which is also mentioned by Kumar and Mikkili [24].

The inverse of the earlier transformation will be observed in equation (6).where

(3) Applications of Clarke transformation: Clarke transformation assumes symmetry in a three-phase circuit, so Clarke’s simple application does not produce matrices’ diagonalization. In Bellan’s study [28], a time-domain analysis due to line switching in a three-phase system is presented based on mathematical modeling. Clarke transformation is applied across each triplet of phase voltages and currents that deal with the asymmetry in three-phase systems. A few of its applications are as follows:(i)They are used in brilliant for maximum likelihood frequency estimation.(ii)They are used for wide frequency range applications.(iii)They are used for estimating the frequency of three-phase balanced and unbalanced power systems.(iv)They are used for three-phase adaptive frequency measurement.(v)They are used for transient analysis of three-phase single line-to-ground faults.

The Pq0 theory does not contradict the frequency domain conventional theory, but it is complement in the time domain. Its ability to thoroughly analyze a three-phase system and run-time calculations of all the powers and currents is an attractive topology. All the undesirable currents can be discovered and removed simultaneously, improving system efficiency [26]. In a power system suffering the presence of current harmonics, all the currents with undesirable frequencies in the system can be eliminated by introducing the currents with the same amplitude but phase-shifted of the undesirable current waveforms, making the system current sinusoidal.

2.2.2. Instantaneous Active and Reactive Current Theory (Id − Iq)

Filter currents are obtained from the nonlinear load’s instantaneous active and reactive current components Ild and Ilq, which are then fed to a vector rotation block that is rotated over an angle θ to match the frame Ild and Ilq, using the Park transformation. The quantities described in Id − Iq coordinates are fixed (constant) for a constant amplitude signal. Id − Iq gives the advantage to design controllers for low-frequency tracking (since the quantities are described as DC quantities in this frame):where ,

Each current component (Id − Iq) has an average value or DC component and an oscillating value or AC component because Id − Iq theory gives the advantage to design a controller for low-frequency tracking. The control technique’s mathematical modeling is attached in Appendix B and verified by Kumar and Mikkili [24].

The first-order harmonic current of the positive sequence that comprises an average current component can be changed to DC quantities. All higher-order harmonic currents with the first harmonic of the negative array of current will be shifted to non-DC quantities, inducing a frequency shift in the spectrum constituting oscillatory components. The average currents are mitigated by Butterworth filter, and the currents that will be compensated are and . So, the compensation currents can be calculated using equations (11) and (12):where

The leading advantage of implementing this technique is that the PLL is no more compulsory to find phase angle θ, as it can be directly calculated from the fundamental voltages; therefore, it also makes this frequency-independent by avoiding the PLL [29].

2.3. Designed Parameters and Proposed Control Techniques

The effectiveness of the proposed HSAHPF using various control algorithms to mitigate current harmonics due to the presence of nonlinear loads has been assessed through simulation software using MATLAB/Simulink. A 10 kVA, 220 V, HSAHPF has been implemented at 50 Hz fundamental frequency to improve power quality. With the boom of embedded systems and the enlargement of microcontrollers, Arduino becomes a significant way to substantiate the control algorithms to test three-phase HSAHPF. The description, specifications, and parameters of the system under study are given in Table 1. These parameters are taken from Jawad and Iqbal’s study [27], and the designed steps are also mentioned in Appendix A that helped us to decide the order of filter.

Table 1 presents the amount of the first 20 harmonics for . For HSAHPF, to reduce the power rating of the APF, losses, and cost, the fifth-order harmonic is eradicated through PPF technique. All the remaining harmonics are diminished by the APF except the third. The load current flow can be restricted into PPF, and it functions as a harmonic isolator in the device between the source and loads. Figure 3 represents the source current harmonics without implementing the filter.

Overall, 33.84% THD for is observed from Figure 3. It is outside the range set by international standards to achieve IEEE 519-1992 for current harmonics. Moreover, the has a THD of 0.017% that already exists within the optimal harmonics range; thus, no further enhancement has been required in ; however, there is an imperative need to improve the as the THD should lie within the standard range.

Figure 4 represents the source current harmonics waveform in a three-phase system without implementing HSAHPF. It can be observed from Figure 4 that due to the presence of nonlinear load, the source current is not sinusoidal, and it also contains spikes due to capacitor charging (attached with the VSI).

Figure 5 depicts the source voltages using a three-phase system without the implementation of HSAHPF. As the attached nonlinear load across all the three phases is balanced, the obtained source voltages are sinusoidal. It can be observed that the source voltages do not contain any harmonics; hence, they are not contributing any significant role in polluting the power system. The primary goal is to remove the source current harmonics and lower the THD. Simulink is a MATLAB-based graphical programming environment for system modeling, simulation, evaluation, and analyzing multidomain dynamical systems. It has been used to design and simulate the plant/system before implementing the hardware model. The conversion blocks have been removed, and serial communication has been established to build the HIL because serial communication is the most reliable mode of communication. The Arduino environment’s built-in serial monitor is used to communicate with an Arduino board attached to the computer via USB and interface cable to enable serial communication through the software’s serial monitor window (IDE). The button selects the same baud rate used in the call to begin () their synchronization. Once the Simulink is set up for serial communication, the Arduino is set up to establish serial communication. The number of variables being sent by the Simulink is initialized.

Similarly, the variables that are required to be sent back are initialized. The data are transmitted in the form of unit 8 bytes. Other operations, such as PID control and filters, are also implemented using user-defined functions and Arduino libraries. The flow for the control theories was followed as they were implemented in the original Simulink files after uploading the code to Arduino. The setup was run and calibrated, and sampling time was adjusted accordingly.

2.3.1. Simulink-Based Implementation of Pq0 Control Technique

Initially, Pq0-based HSAHPF was implemented in Simulink using a three-phase, four-wire that contains four functional blocks.(i)The ‘DC’ voltage regulator.(ii)Calculation of instantaneous powers.(iii)Selection of power for compensation.(iv)Calculation of reference currents.

The excessive part of real power is regulated by the DC voltage regulator to maintain the voltage of the capacitor close to the reference DC-link voltage . The DC capacitors ( and ) shown in Figure 2 plays a significant role in the Pq0 control technique, will go on discharging only, instead of charging if is not drawn continuously from the power circuit in this PWM control-based converter to supply the losses caused by switching operation. The second block contains the selection of power of the nonlinear load to be compensated with a low-pass filter and the influence of the DC-voltage regulator. This control block takes and as inputs. The zero sequence active power , reactive power , and active power is calculated after the application of transformations on the and as illustrated in Figure 6, is subtracted from the real power output of the low-pass filter fed to the inverse Pq0 block and the compensating reactive power to give the final output. The fourth-order low-pass filter is more suitable for the separation of active power into average and oscillating parts .

The third block calculates the reference currents using the instantaneous compensating powers, and the phase voltages as inputs. The power circuit for the active filter part consists of a center split VSI that consists of 6 MOSFETs with freewheeling diodes. The MOSFETs are used for switching purposes as they can operate at the high switching frequency, fast switching response, and low-voltage drop across them. The performance of this VSI with a combination of hysteresis controller and PWM behaves like a controlled current source.

The Simulink model shown in Figure 7 implements Pq0 theory as a control technique using three-phase, four-wire HSAHPF according to the earlier explanation. The system response using Pq0 control technique and results will be explained later in Section 3.

2.3.2. Hardware-in-the-Loop-Based Pq0 Implementation

High-power and high-voltage systems are demanding, difficult, expensive, and dangerous to evaluate the controller for its testing. The invention of digital simulations and laboratory equipment helps design and test such complex systems, but this was not far enough because they cannot keep up with the pace of real-time processes. Due to the computational burden, the system’s calculations were not fast enough to provide output requiring signals at fixed intervals. The calculation time needed for the system is much greater than the necessary time, so these high-speed calculations can be attained using HIL simulations. The integration of the actual hardware controller with the simulation network gives multiple advantages for the designed system’s run-time testing. Power HIL is an indirect approach representing real-time, real-world operations and applications to certify the stable and accurate closed-loop simulations; however, it is an expensive and complex approach that involves real power transfer [30]. That is why, controller HIL is implemented in the proposed work, and to set up the HIL, the conversion blocks were removed, and serial communication was established. The overall setup is depicted in Figure 8, representing run-time monitoring and implementation of the proposed system.

2.3.3. Simulink-Based Implementation of Id − Iq Control Technique

The entire method of reference current generation using Id − Iq control topology is explained in Figure 9. It includes HSAHPF implemented in Simulink using a three-phase, three-wire system that contains three functional blocks.(i)The DC voltage regulator using a PI controller.(ii)The calculation of instantaneous current components using Clarke and Park transformation.(iii)Calculation of reference currents using a hysteresis controller.

The hysteresis current controller was developed to generate the switching pulses to control VSI switches by comparing the real current to the reference current. The control scheme gives the switching pattern of active filter switches to maintain the real injected current within a desired hysteresis band. Thus, the considered hysteresis band in this work is (−313 to 313). The switching frequency of hysteresis current control (HCC) strategy depends mainly on how efficiently the current changes from upper limit to lower limit of hysteresis band and vice versa. Thus, the switching frequency varies with the obtained current waveform rather than a constant value throughout the switching operation of MOSFETS.

The park transformation is used to eliminate the DC components in nonlinear Id, and Iq load currents passed through an eighth-order Butterworth filter instead of the high-pass filters implemented in previous works. It provides an advantage in the minimization of fluctuations, and filters give the ideal response. The eighth-order Butterworth filter used in the harmonics installation circuit has a cut-off frequency of nearly 1 rad/sec, due to which a high transient response and a slight phase shift in harmonics can be attained. A PI controller is used to keep the capacitor’s voltage (Vdc) relative to a DC-link reference voltage (Vref). This approach’s benefit is that angle “θ” can be measured directly from the primary voltages. Moreover, an excessive amount of synchronization problems can be avoided in the presence of unbalanced and nonsinusoidal mains voltage conditions. The implemented Simulink model is shown in Figure 10.

2.3.4. Hardware-in-the-Loop-Based Id − Iq Implementation

For creating the hardware-in-the-loop structure, the Simulink is set up for serial communication. The Arduino MEGA is used to establish serial communication. Although serial communication is reliable to a great extent, it is limited by several factors. One of the main factors is the sampling time. The sampling time is one of the key elements that govern the speed of the simulation. Since the maximum data rate for Arduino is limited to 115,200, the simulation cannot progress at a very high pace; therefore, the full simulation speed is limited to a multiple of the time required to send data, compute it, and receive the data back.

In this technique, all the functional blocks, that is, DC-link voltage regulator, control algorithm of Id − Iq are implemented in Arduino. At the same time, hysteresis controller remains implemented in Simulink for obtaining more efficient results. Initially, the primary voltages and current measurements are sent as input to the serial send. To send multiple values, an MUX is used, then a zero-order hold to add some hold on between the values. Then the data are converted into same data type and then sent as a single data type. The output is converted to a double on the receiving side then forwarded to a DEMUX (Figure 11).

2.4. Workflow Model of Controller HIL Testing Method

In the development process of HSAHPF, control algorithms were initially implemented in MATLAB/Simulink, and simulations are performed to observe the power behavior of the power simulator under various operating conditions. For the testing and verification of the hybrid power filter, the control algorithms were coded in IDE of Arduino that verifies the compatibility of Simulink with Arduino and validation of the power system using Arduino as controller HIL. This overall workflow model of the controller HIL simulator is depicted in Figure 12.

3. Controller HIL Simulations and Results

With the expansion of microcontrollers, portable microcontroller becomes an imperative way of verifying the control algorithms. The HIL structure comprises of actual hardware controller that interrelates with the remaining simulated system; it becomes controller hardware-in-the-loop (CHIL). This research’s primary objective was to implement both control algorithms in a controller HIL simulation setup, analyze their performance, and compare the results. In this controller HIL simulation technique, the control algorithms are programmed inside the IDE of Arduino, and after successful execution, the implemented C language code is uploaded to the Arduino. The setup is executed and calibrated. The sampling time is adjusted as the accuracy is highly sacrificed by increasing data rate and decreasing the number of samples. Therefore, the data rate and the number of samples were optimized to reduce the inaccuracy and improve efficiency. As the HSAHPF remains implemented in Simulink, the controller takes signals from Simulink and processes them inside Arduino using both the control algorithms to generate reference current signal and then referred to the simulator for proper switching and harmonics mitigation. A prototype of the implemented model is shown in Figure 13 that represents the HIL implementation of high-power, three-phase HSAHPF in Simulink with controller HIL simulation for the monitoring and verification of the system.

3.1. Hardware-in-the-Loop Operation and Modeling

An Arduino application as a controller HIL platform for controlling a virtual plant (power electronics converter) implemented in the Simulink environment is presented in this paper. Although implemented control algorithms are not innovative, as the development of control methods for hybrid power filters is not the paper’s aim, Arduino MEGA is chosen for the operation and monitoring of the system. The Tic Toc function in MATLAB is used for computing and monitoring the time for receiving data from Arduino. The data are exchanged synchronously and asynchronously.

In Simulink, Tic Toc functions are used to compute the time for receiving data from Arduino. The waveform of data receiving is obtained from the status scope, and for obtaining the time, the seconds data function is used. The scope shows the data receiving waveform while the seconds function depicts the time taken to receive the data. Figure 14 illustrates the run-time implementation of the Pq0 control technique in Simulink, representing the overall receiving time of data in Simulink from Arduino.

Six variables are sent from Arduino to Simulink and immediately back to monitor the overall time for this operation. All the simulations are run in nonblocking mode to obtain the waveforms of receiving time for data. From Figure 14, it can be observed that the total data receiving time in Simulink from Arduino is 0.2764 sec. Figure 15 represents the run-time data obtained in the Pq0 control algorithm implemented in Arduino and the switching pulses to MOSFETS. The following graphs represent the amplitude versus time of the received signal in which Arduino sends the data to Simulink.

The I/O’s of the external hardware controller connect with the system inside a simulator. The controller takes the simulator’s feedback signal and processes it inside the controller to produce the required output and then sent back to the model implemented inside the simulator.

The data receiving time and its receiving status in the case of Id − Iq control algorithm implemented in Arduino and executed in Simulink can be observed in Figure 16. It depicts the receiving time of a single sample from Arduino in Simulink to be 0.00011 sec, while the total receiving time for data is 0.1938 sec for the Id − Iq control technique in Simulink. Initially, the calculation of sending and receiving time will be observed in Arduino. Starting within the setup pins are initialized as output so that they can be used to display waveforms. The built-in function micro () is used, and the current time is measured, and then it is subtracted from the last time to get the time taken to send, receive, and the overall execution time. Next, the assigned digital pins, high and low, are used when the data are received and sent. The digital pins will provide the waveforms, and the time of data sending and receiving is calculated and displayed in Simulink. Figure 17 depicts the amplitude versus time graph representing the reliable waveform for received data time in Simulink and the switching pulses to MOSFETS.

3.2. Pq0 Control Technique Implemented in Simulink

The following results will be obtained when both the power circuit of HSAHPF using three-phase, four-wire and control techniques have been implemented in Simulink. The source current waveform becomes sinusoidal with 3.14% THD at 50 Hz fundamental frequency as depicted in Figure 18, showing the contribution of the first 20 harmonics in the system. The overall system responses are as follows:

Figure 19(a) represents the source current harmonics when the Pq0 control technique is implemented in Simulink. It can be observed that the waveform becomes sinusoidal without distortions after achieving its stability time of 0.06 s that effectively compensates for the harmonic distortion under balanced loading conditions present in the supply current. Figure 19(b) represents the source voltage harmonics that are purely sinusoidal due to the balanced load. Figure 19(c) represents the load current waveform, where it is observed that due to the nonlinear load attached with the system, the obtained current is not purely sinusoidal due to the presence of harmonics. It also contains positive and negative spikes due to the charging and discharging of the capacitor. The nonlinear load is continuously attached to the system, so there is no need to eliminate load current harmonics. The harmonics always travel from the nonlinear load side to the source side; they are mitigated at the PCC source side to achieve good-quality power.

The current after passing through a passive filter as a result of harmonic current detection using the Pq0 control theory is shown in Figure 9(d). For diminishing the neutral wire current, reduction in harmonics plays a significant role in reducing the neutral wire current from 12 A to 0.9 A. When the Pq0 control technique is implemented for a balanced load in Simulink, the neutral wire current for the load and source side is depicted in Figure 19(e), reducing the neutral wire current towards the source side. The voltage regulator is regulated using the PI controller to minimize the switching losses of the VSI; thus, it charges the DC capacitors on discharging. Initially, the regulator’s behavior is unstable, but at 0.06 s, it becomes stable, as shown in Figure 19(f), which concludes that HSAHPF has maintained the DC-link voltage constant.

3.3. Pq0 Control Algorithm Implemented in Arduino

When the power circuit of three-phase four-wire HSAHPF is implemented in Simulink, the Pq0 control algorithm is programmed in the Arduino MEGA 2560 using hardware-in-the-loop simulation. The simulation results of source current, source voltage, load current, filter current, neutral wire current, and DC-link voltage are shown below, as the implemented Pq0 control algorithm in Simulink. The sinusoidal waveforms for source current and voltages of the system with Pq0 control algorithm implemented in Arduino MEGA-based HSAHPF are shown in Figures 20(a) and 20(c), respectively. Figure 20(b) represents the load current waveform using Arduino-based Pq0 control technique that is nonsinusoidal containing positive and negative peaks for charging and discharging of the capacitors.

The system’s obtained sinusoidal waveforms for source current (Isabc) and voltages (Vsabc) with Pq0 control algorithm implemented in Arduino MEGA, based on HSAHPF are shown earlier. It can be observed from these waveforms that harmonics are eliminated, and the source current does not contain any distortions and spikes after achieving its stability time. The filter current obtained using the Arduino-based Pq0 control algorithm in Figure 20(d) depicts that the waveform still contains distortions due to the impedance of a single tuned passive filter. It was dependent on the inductance, capacitance, and resistance of the attached nonlinear load. The difference in neutral wire current for load and source side is depicted in Figure 20(e) which clearly shows the reduction of current for neutral wire towards the source side. The voltage regulator is regulated using a PI controller in the inner control loop to reduce the inverter’s switching losses. Initially, it contains continuous fluctuations, but it becomes stable at 0.06 s, as shown in Figure 20(f). Due to the limitation, the Id − Iq control technique is implemented that provides sinusoidal filter current.

3.4. System Response Using the Id − Iq Control-Based HSAHPF Implemented in Simulink

The following results have been obtained when the power circuit using three-phase, three-wire HSAHPF and control techniques have been implemented in Simulink. Figure 21 represents the occurrence of even and odd-order harmonics after Id − Iq implementation and shows the contribution of the first 20 harmonics in the system to be mitigated accordingly.

When the Id − Iq control technique is implemented in Simulink, the source current becomes sinusoidal with 2.01% THD at 50 Hz fundamental frequency, as depicted by Figure 21. The results also show that Id − Iq can compensate harmonics and reactive power components, thus enhancing the power factor as it works in a rotating reference frame. Due to the presence of a balanced three-phase nonlinear load, and as the voltage harmonics are controlled by maintaining the source impedance, there are no distortions in source voltage waveforms.

From Figure 22(a), the transient response of source current can be observed. Initially, it contains oscillations, and then the system becomes stable after 0.1 s. Figure 22(b) represents the load current in the case of a three-phase, three-wire system when the attached load is a single rectifier across all three phases instead of a combination of three single-phase rectifiers. The filter current obtained through this technique is nearly sinusoidal but contains overshoot till achieving its stability time and can be seen in Figure 22(c). The sinusoidal waveform for source voltage of the system, when the Id − Iq control technique is implemented in Simulink-based HSAHPF is shown in Figure 22(d). The voltage regulator is controlled using a PI controller to reduce the inverter’s switching losses and charge the DC capacitors when discharged. From the results in Figure 22(e), it is observed that the stability time of the regulator is further improved to 0.03 s using this technique that is better than the stability time achieved in the case of the Pq0 control algorithm.

3.5. System Response Using the Id − Iq Control-Based HSAHPF Implemented in Arduino

Once the power circuit of three-phase, three-wire HSAHPF is implemented in Simulink, the control algorithms are programmed in Arduino, so the overall system acts as HIL. Actual power transfer would not happen in this method. The power system will be shown as a virtual system within the simulator; therefore, extrinsic hardware controller exchanging I/O’s of the controller with the structure modeled in Simulink. Results and simulations are shown below that are similar to the overall system implemented in Simulink. The obtained source current in Figure 23(a) and source voltages in Figure 23(d) become sinusoidal after achieving their stability time. The load current in Figure 23(b) is nonsinusoidal that is the main cause of harmonics in the system. The obtained filter current is sinusoidal that also verifies the performance of the implemented technique and can be observed in Figure 22(c).

The achieved filter current across all three phases using Arduino-based Id − Iq is sinusoidal and balanced, representing the passive filter’s good compensation performance. Figures 23(a) to 23(e) depict that the Id − Iq control technique has more efficient results with improved THD; thus, it verifies that the controller HIL simulation ensures reliability and quality. The obtained results confirm that the controller HIL simulation is an efficient testing and monitoring technique that can send and receive data via serial communication without losing information by adjusting the data rate and the number of samples.

4. Results Discussion and Comparative Analysis

The compensation performance of HSAHPF is verified through the harmonic spectrum of , shown in Figure 13, and it is detected that THD of of three-phase, four-wire HSAHPF system, on the whole, is found to be 3.12% in case of Simulink-based implementation and 3.44% in case of Arduino-based implementation that lies in the required range set by the international standards to meet IEEE 519-1992 for current harmonics. While initially, it was found to be 35.84 when no control technique was applied. After implementing HSAHPF using the Pq0 control algorithm based on the HIL technique, the achieved stability time of source current is 0.05 s, and it can be observed in Figures 24(a) and 24(b).

Overall, the compensation performance of HSAHPF is verified, as the harmonic spectrum of is presented below figures, and it is detected that THD of of three-phase, three-wire HSAHPF system, on the whole, is found to be 2.01% in case of Simulink-based control technique and 2.38% in case of Arduino-based control algorithm that is reduced from 31.76 that also meet IEEE 519-1992 for current harmonics and can be observed in Figures 25(a) and 25(b).

The stability time of source current is further improved to 0.04 s using this technique. Conventional power systems and real-time simulating tools, such as RTDS and Opal-RT, are inadequate because of low switching frequency and high cost. Arduino, an open-source electronics platform, is an innovative technique that contains the coded control algorithm in its open-source Arduino software (IDE). It plays an essential role as a test platform when interfaced with Simulink/MATLAB. Both control algorithms are programmed in C language using Arduino with IDE as development software to verify HSAHPF. It proves to be cost-effective, portable, and ideal testing equipment. For ascertaining the actual application and effectiveness of the proposed control algorithms, Arduino is used as an external hardware controller to verify the performance of HSAHPF. The comparative analysis is shown in Table 2 in terms of THD, stability time, power factor, and sampling time (accuracy).

It is verified that the proposed HSAHPF can restore the actual sinusoidal current and voltages by upholding the voltage regulator’s stability time to 0.06 s in the case of Pq0 control technique 0.04 s in the case of the Id − Iq control algorithm. The attained power factor in Id − Iq’s case is unity, and THD is 2.01, which is more efficient than Pq0. In Id − Iq, angle can directly be calculated from fundamental voltages, so this technique is frequency-independent due to that many synchronization problems can be tackled easily. Moreover, using controller HIL algorithms, the performance of the HSAHPF is also improved when the sampling time is enhanced; thus, the computational burden of the proposed controller can be handled with existing technology. It is achieved by adjusting the baud rate of Arduino and the number of receiving bits per second. Still, in the case of complex algorithms and mathematical models, the accuracy may be compromised if the stored information contains more bits as the processing speed of Arduino is limited. The waveform of the attained power factor (approximately unity) can be observed in Figure 26.

The findings from our work are significant, but still few limitations of the presented study are, Pq0 and Id − Iq perform better until the supply voltage is in ideal and balanced load condition. If the nature of the attached nonlinear load is unbalanced, the PI controller in Pq0 and Id − Iq do not respond rapidly compared to balanced load conditions. The neural network-based predictive control schemes and the fuzzy logic algorithms provide a fast and accurate dynamic response for a nonlinear system containing uncertain information or unbalanced load. Therefore, optimal control techniques will be more suitable for high switching frequency and real-time testing monitoring conditions. However, implemented prototype model will provide the capability to use Simulink for testing and monitoring the HSAHPF with an external hardware controller using HIL simulations. A real-time application-based hardware system can be implemented using various efficient portable controllers, such as Raspberry pi and FPGA with more computational power.

5. Conclusion

In this paper, a hybrid shunt active harmonic power filter (HSAHPF) has been implemented to reduce harmonic pollution and enhance the power quality. Moreover, a controller HIL simulator has been implemented for verification and monitoring a high-power, three-phase power system based on THD bearing nonlinear load. A techno-economical controller HIL-based HSAHPF with some appropriate control techniques to overcome the power issues has been presented in this paper. The power circuit of HSAHPF is designed and simulated in Simulink, and the control algorithms for reference current generation are implemented in Arduino MEGA for testing of the external controller using HIL simulation, in which the controller processes analog signals for producing gating signal, then for proper switching action, they will be sent back to simulator. The advantages of executed controller HIL over traditional hardware-based HIL systems or laboratory prototypes are summarized in the following points.(i)The effects of phase delays due to sensors have been presented.(ii)The effects of phase delays are provided due to measurement circuits.(iii)The phase delays caused by reference current generation waveform in laboratory prototype-implemented controller and system losses are eliminated.(iv)It is less risky, economical, and portable, with a short development period for testing and validating power systems.

It can be observed from the presented results that the THD for Pq0 implemented in Simulink and Arduino are 3.12% and 3.44%. On the contrary, THD for Id − Iq implemented in Simulink and Arduino are 2.01% and 2.38%, respectively. Therefore, from the comparative analysis, it can be inferred that has more efficient results with a minimum THD, improved stability time, and a power factor nearer to unity. The observed statistics lie within the range of IEEE 519-1992 recommended harmonic standards. Conclusively, the implemented HIL controller operates closely in run-time conditions and provides multiple advantages, such as a reliable testing environment, repeatable and automated test conditions, and firm advancement in technology without actual hardware and power transfer. The real-time application-based hardware systems can be implemented in the future using various efficient portable controllers, that is, Raspberry Pi, FPGA, SDM, and Atmel AVR aided with more computational power and efficient performance.

Appendix

A. Passive Power Filter Design Components

The PPF in the HSAHPF contains a single tuned RL circuit. For calculating and designing inductor and resistor regarding the elimination of specific order harmonics, it will use the following equations:where is the phase voltage, is the reactive power of load, h represents the order of harmonics for that PPF needed to be tuned, and Q is the quality factor chosen between the range of 30 to 50.

Voltage Regulator Design

The voltage is mainly linked with the charging and discharging of the capacitors to give the specific value of DC voltage to VSI to generate an expected waveform for harmonics current. It comprises of PI controller, and its value is determined using the following relation:where m = 1; modulation index.

Thus, after mathematical calculation, the value of VDC is 622 V.

B. Supplementary Material

B.1. Reference Current Calculation/Pq0 Block

B.2. Reference Current Calculation/Inverse Pq0 Block

B.3. PLL Mathematical Parameters

B.4. Reference Current Calculation/ Block Calculations

B.5. Reference Current Calculation/Inverse Block Calculations

B.6. Hysteresis Block

Data Availability

No data were used to support this study.

Conflicts of Interest

The authors have no conflicts of interest.