Control of Single-Phase Power Converters Connected to Low-Voltage Distorted Power Systems With Variable Compensation Objectives

This paper presents a flexible control technique for power electronics converters, which can function as an active power filter, as a local power supply interface, or perform both functions simultaneously. Thus, it can compensate for current disturbances while simultaneously injecting active power into the electrical grid, transforming the power converter into a multifunctional device. The main objective is to use all the capacity available in the electronic power converter to maximize the benefits when it is installed in the electricity grid. This objective is achieved by using the orthogonal current decomposition of the conservative power theory. Each current component is weighted by compensation coefficients (ki), which are adjusted instantaneously and independently, in any percentage, by means of load conformity factors ( λi), thus providing online flexibility with respect to the objectives of compensation and injection of active power. Finally, simulated and experimental results are presented to validate the effectiveness and performance of the proposed approach.

Abstract-This paper presents a flexible control technique for power electronics converters, which can function as an active power filter, as a local power supply interface, or perform both functions simultaneously.Thus, it can compensate for current disturbances while simultaneously injecting active power into the electrical grid, transforming the power converter into a multifunctional device.The main objective is to use all the capacity available in the electronic power converter to maximize the benefits when it is installed in the electricity grid.This objective is achieved by using the orthogonal current decomposition of the conservative power theory.Each current component is weighted by compensation coefficients (k i ), which are adjusted instantaneously and independently, in any percentage, by means of load conformity factors (λ i ), thus providing online flexibility with respect to the objectives of compensation and injection of active power.Finally, simulated and experimental results are presented to validate the effectiveness and performance of the proposed approach.Index Terms-Active power filter, conservative power theory (CPT), distributed generation, flexible control, load conformity factors, power quality (PQ), renewable energy sources.

I. INTRODUCTION
M ICROGRIDS can generally be defined as low-voltage networks with distributed generators (photovoltaic generation, wind power, microturbines, fuel cells, etc.) together with storage devices and dispersed loads, operating alone or cooperatively with the electricity grid.Most distributed generators can be connected via a power electronics interface (PEI).One of the objectives of research on PEIs is to improve their reliability and reduce their costs [1]- [6].Economic feasibility can be achieved not only with cheaper devices but also by offering additional functionalities.Optimization of the overall performance of the electrical grid is one of the most important aspects for the viability of distributed generation systems.Currently, power electronics converters (PEC) are responsible for the in-terface between distributed generators and the electricity grid and are increasingly used to perform various functions, such as injecting power into the grid and minimizing disturbances related to power quality (PQ).Thus, for example, in [7]- [9], PEC is used to inject active and reactive power.Power injection and harmonics current compensation are performed in [10]- [13], and in order to compensate the reactive power and harmonics current simultaneously, PEC control strategies are proposed in [14]- [17].On the other hand, in [18], the multifunctional PEC helps supporting voltage level at the point of common coupling (PCC).
Besides the well-known use of multifunctional converters, due to the continuous increase in intermittent renewable energy source (RES), the capacity available in the PEC during active power injection may be inadequate or insufficient to address PQ problems at the PCC.For example, the behavior of a photovoltaic system, the most common RES in low-voltage microgrid environments, not only depends on the time of operation but is also intermittent and unpredictable.
Although the ideal solution is to compensate for all unwanted components of the current, it is often necessary to compensate only a percentage or a specific unwanted component of current, owing mainly to the PEC's capacity constraint.In most cases, a PEC is used to compensate for any current disturbances [19], a specific subset of harmonics [20]- [23], or simply a subset of unwanted components of current [24], and generally, reference currents are not adjustable online.Moreover, the objectives of compensation may vary over time, because the behavior of loads is also unpredictable and intermittent.Thus, to achieve maximum benefits and use the maximum capability of PECs requires suitable strategies to generate reference signals for compensation.
A possible approach to deal with RES and load unpredictable behavior is to use the equivalent susceptance of PEC to suit variations of these unpredictable elements [25].In this case, if the sum of currents necessary to inject power into the grid and compensating disturbances becomes larger than the maximum output capacity of the PEC, the current reference for compensation purpose could be limited through the susceptance limitation.In [26], the analytic hierarchy process theory is used to determine two coefficients which optimally control the compensation level of harmonics and reactive content of an ordinary load since the PEC capacity is enough to compensate such disturbances and inject the power generated by RES.In [27], it is shown a multifunctional PEC with current references generated using PQ theory.It can be demonstrated that the control strategy of a single-phase PEC based on the PQ theory is strongly dependent on the performance of the built-up in-quadrature system.The virtual system will thus introduce delays and may also trigger the system stability.
In this regard, the main goal of this paper is to use a set of load conformity factor, which are based on the orthogonal currents decomposition described by the conservative power theory (CPT) [28], as a flexible approach to define a multifunctional use for PECs with variable compensation objectives.Furthermore, in contrast with previous works, the proposed approach allows a straight relationship among the PQ indices and the compensation coefficients.So, the proposed control strategy is able to compensate individually or partially different performance indices such as: power factor, displacement factor, and harmonic distortion (THD), and also inject into the grid the power generated by local renewable or nonrenewable sources.The reference generator is very flexible and allows selective reduction of load disturbing effects, in any percentage, to meet whichever utility or consumer [local energy source (LES)] criteria.Furthermore, additions to the flexibility and selectivity, the proposed method differs from others existing solutions for the fact that it does not require the use of reference transformation systems as in [11] and [27], linear transformations such as the Discrete Fourier Transform [12], synchronization algorithms [29]- [30].These conventional approaches may present nontrivial power control errors, slow dynamic response, or inaccuracies under voltage distortion.
The main parameter and the modeling of the system used in this paper are shown in Section II.The conformity factors that play a central role in the proposed approach are present in Section III.Then, the flexible control strategy proposed to generating the current references is explained in Section IV.Finally, Sections V and VI bring simulation and experimental, which confirm the validation and feasibility of the strategy and the conclusion is presented in Section VI.

II. MODELING AND CONTROL OF PEC
When a PEC, which was primarily designed to act as PEI interfacing a RES with grid utility [31]- [32], is operated as a multifunctional device, the PQ constraints at the PCC can be strictly reinforced and/or maintained within the limits of the standards without additional hardware costs.This is due to the physical structure of the PEC is not altered, requiring changes only in the control system and generation of references for compensation.The possibility of the PEI contributing to the improvement of PQ indicators at the connection point of the PEC is particularly important in small-scale distributed generation systems, where the ac bus is not strong [33], the loads are predominantly nonlinear, and the intermittency of distributed energy sources is evident.Furthermore, the line impedance is relevant and the grid voltage may be nonsinusoidal voltage.
The proposed method does not require synchronization algorithms; hence, the dynamic response and steady-state performance are related only to the design of current and voltage controllers.In this work, a PI controller is used to control the dc bus voltage and current control is based on another harmonic   resonant controller plus a proportional resonant controller [34].Furthermore, a higher order LCL filter was used due to its ability to minimize the amount of current ripple injected into the electricity grid [35], thus preventing high-frequency components from contaminating the voltage at the PCC.Fig. 1 shows an overview of the grid-tied PEC discussed in this work with main parameters shown in Table I.The reason this structure was chosen is the fact that single-phase PECs are the most common topologies for connecting small-scale distributed power generation units to the electricity grid, especially when it comes to photovoltaic panel-based sources.Finally, a remote control interface for the PEC is developed to validate the efficiency, the performance of the flexible control, and the online monitoring of the PEC.The block diagram of current control loop is shown in Fig. 2, where K inv is the inverter gain and K IS is current sensor gain.
The LCL filter is damped using an active approach based in the current through the capacitor as depicted in [36].The damped system is used to design the current controller, which is where h is the harmonic order, ω o is the fundamental frequency of the grid, and K C , K I P R , and ω c P R are the proportional gain, integral gain, and resonant controller bandwidth, respectively.The value of K I P R is chosen aiming to produce a high gain in harmonic frequencies, and ω c P R must be kept small so as to increase the selectivity of the compensator.The current controller is designed to achieve phase margin of 45°and gain margin of 6 dB with bandwidth of 1 kHz.The resonant peaks are adjusted on the odd harmonics, from the first until the 15th harmonic, to enforce a high gain at these frequencies.Table II depicts the values of the current controller.A low-bandwidth PI compensator is used to control the dc bus voltage [37].The proportional gain is given by K P DC and the integral gain is given by K I DC .The bandwidth of the dc voltage controller is 6 Hz and phase margin of 70°.

III. POWER FACTOR DECOMPOSITION CONSIDERING POWER INJECTION
The CPT proposed in [28] is defined in the time domain and can be applied to single-and multiphase systems, with or without sinusoidal waveforms, balanced or not, of period T and angular frequency ω = 2π/T .When applied to single-phase systems, the CPT allows the decomposition of the current flowing through an element into three orthogonal current components: active current (i a ), reactive current (i r ), and void current (i v ), which are related to a specific characteristic of the load (power consumption, energy storage, and nonlinearities).In terms of power, the current decomposition (RMS values, I a , I r , and I v ) multiplied by the RMS voltage value, results in active power (P ), reactive power (Q), and void power (D).Unlike active power (active current), all the other power (current) components characterize nonideal aspect of load performance.
Thus, in order to characterize the different aspects of the operation of a load at the PCC that affects the overall power factor, based on the power or current components that are calculated using the orthogonal decomposition of current introduced by CPT, various indices of conformity are proposed in [38].In this paper, the indices introduced in [38] are reformulated in order to show relations with the well-known PQ indexes like THD I , displacement factor, etc.For the sake of simplicity, these indices are defined as conformity factors.
Moreover, the reformulated indices are able to take into account the multifunctional behavior of the PEC, since these new indices are developed also considering the balance between RES injection of power into the grid and power absorption by the local loads.In other words, when the PEC operates as shunt active filter (SAF) and power electronic interface (PEI) (i.e., injecting active power and compensating disturbances), the active power/current injected into the grid modifies the power factor and conformity factors when measured on the grid side.
In this situation, if the power generated by the LES is greater than the power demanded by the load, the excess is injected into the grid.On the other hand, if the power generated by the LES is less than the power demanded by the load, the grid had supplied power in order to meet the load demand.Therefore, a portion of nonactive power/current related to load disturbances is supplied by the grid.In this case, the PEC operates as PEI, injecting the energy available from the LES and also operates as SAF compensating part of the load disturbances.Thus, in both situations, the active current that flows in the grid side (i Ga ), including the power injection, can be calculated by where the current component related to the active power demanded by the local load is given by i a and i DG ref is the current injected into the grid to transfer the energy available in the LES.Therefore, the new CPT conformity factors are described in the following paragraphs considering the grid's point of view.

A. Global Conformity Factor
The global conformity factor is the power factor (λ * ) observed in the grid side considering that the grid supplies all the nonactive power (Q and D) demanded by the load where P G is the active power injected in or absorbed from the grid.The nonactive powers Q and D express, respectively, the reactive power and the void power (related to the harmonics) demanded by the local load.Similarly, in current terms, I Ga is the RMS value of the active current flowing through the grid (absorbed or injected) and the RMS values of the reactive and void current components demanded by the load are I r and I v , respectively.Finally, I na is the RMS value of the nonactive current which flows due to the local load and I G is the RMS value of the grid current (considering active and nonactive currents).

B. Distortion Factor
Because void current (i v ) is related to the harmonic currents generated by the nonlinear loads, this current could be the representation in the time domain of the total harmonic distortion (THD) of current (nonlinearities).Therefore, the RMS value of the void current could be used to calculate the distortion index, which would be equivalent to the THD in nonsinusoidal conditions.Thus, the distortion factor (λ * D ) in the grid side is defined as Note that λ * D disappears only if the void current are reduced to zero (i v = 0).Only in the case of sinusoidal voltages can λ * D be associated with the traditional THD of current, by the relation ( As can be seen, for levels of up to 30% of THD of current, the distortion factor is practically equal to the THD of current, i.e., λ * D ∼ = THD I .

C. Reactivity Factor
Similarly, the traditional displacement factor cos φ used in the analysis of sinusoidal signals (voltage and current) can also be generalized for nonsinusoidal voltage and current signals also considering the bidirectional power flow into the grid.Thus, the reactivity factor is defined as It should be noted that, irrespective of the voltage and current signal waveforms, λ * Q indicates the phase displacement between voltages and currents caused by energy storage elements (inductors and capacitors) or even by nonlinear loads.Note that λ * Q becomes unitary only if the reactive current is reduced to zero (i r = 0).The reactivity factor is directly related with the displacement factor only when the voltage and current signals are perfectly sinusoidal Finally, by means of (3), ( 4), and ( 6), it can be demonstrated that Note that the preceding equation is unitary only if the load is purely resistive, regardless of the input voltage.Thus, the presence of any other type of disturbance (lag, harmonic distortion or both) affects the power factor, and for the condition of sinusoidal voltage, the power factor is Under ideal operation, the distortion factor (λ * D ) is zero, similarly to the THD, since it expresses the absence of nonlinearities whereas the reactivity factor (λ * Q ) and power factor (λ * ) result unitary, similarly to the traditional displacement factor, since it express the circuit efficiency.It is important to underline that the CPT load factors defined in (3)-( 9) are different from those defined in [38].Thus, the factors defined in the present paper are much more appropriate in terms of PQ analysis, whereas in [38], for ideal condition, all factors would result unitary.

IV. PROPOSED FLEXIBLE CONTROL STRATEGY WITH VARIABLE COMPENSATION OBJECTIVES
Based on the new load conformity factors defined in the preceding section, this section presents a technique for the flexible control of single-phase PECs, which can be connected to sinusoidal or distorted low-voltage distribution grids.In addition, the loads connected at the PCC may be linear or nonlinear.Thus, the reference current generated by the flexible strategy should compensate (partially or totally) for different disturbances and also inject active power into the grid.Hence, the reference current is generated to improve the current waveform throughout the grid, according to the thresholds prescribed by PQ standards, or to obtain specific results as a function of the capability of the PEC which is not being used to inject active power into the grid.

A. Generation of Reference Current for LES
The active power (P LES ) generated by the LES can be calculated as (10).The current reference i DG ref given by ( 11) is used to transfer the power P LES from PEC's dc side to the grid side.The waveform of the active current injected into the grid shows the same waveform of the PCC voltage.This characteristic allows obtaining unitary power factor even in non-sinusoidal conditions.Note that the equivalent conductance G DG defines the amplitude of the reference current.Thus, G DG dictates the amount of power injected and it is calculated by ( 12) In general, the waveform i DG ref can be defined using the instantaneous voltage at the PCC or its fundamental component, representing resistive current or sinusoidal current injection, respectively.Under certain voltage conditions, these two strategies may produce different results.

B. Flexible Generation of Reference Current to Compensate for Disturbances
The secondary goal of the multifunctional converter is to improve the PQ at the PCC.Therefore, the current references that compensate the disturbances introduced by the local load are given by ( 13) or (14), where i ref v and i ref r allow the independent compensation of the component related to harmonics and the component related to reactive current, respectively.The current reference i ref na is an alternative to i ref v and i ref r , which allows the compensation of the nonactive current as a whole.It is worth to note that The coefficients k v , k r , and k na are associated with each current component.These compensation coefficients may vary from 0 to 1.The total compensation of a specific disturbance is achieved by making k v = 0 or k r = 0. On the other hand, k na = 0 corresponds to the total compensation of all the disturbances, because in this case, the reference compensation is equal to the current component that concentrates all the disturbances, i.e., i ref na = i na .
When the compensation coefficients are different from zero (k v = 0 or k r = 0 and k na = 0), the remaining currents (uncompensated) and their RMS values are given by ( 15) and ( 16) Since i * Gv , i * Gr , and i * G na represent the uncompensated current, i.e., the current that would flow throughout the grid after a partial compensation of any of the disturbances, it is possible to calculate the resulting conformity factors ( 17)- (19).
Thus, the new conformity factors (desired), which would result at the grid side after disturbances compensation, can be calculated based on uncompensated currents as It should be noted that, due to the property of orthogonality between the components of current, each load conformity factor can be adjusted independently, in any percentage, thus providing flexibility with respect to the objectives of compensation, i.e., improvement of the PQ.
The relationship among the uncompensated currents, the desired conformity factors at the grid side, and the actual conformity factors results in the compensation coefficients, which are described in the following paragraphs.
1) Distortion factor compensation: Based on (4), (15a), and ( 17), the compensation coefficient of the distortion factor results in Thus, for a given (desired) value of the distortion factor (λ GD n ) that meets, for example, a specific PQ standard, the value of k v is easily obtained by (20).The range of λ GD n values may vary between 0 and λ * D .It is worth to remember that λ * D represents the distortion factor considering power injection without compensation of disturbances.Therefore, by substituting (20) into (13a), one can calculate the reference current that allows for partial or total compensation of the distortion factor, which is related to the load current harmonics.Note that when the desired value of λ GD n is zero (λ GD n = 0), the corresponding compensation coefficient is also zero (k v = 0).In this case, the reference current for the PEC is identical to the void current drawn by the load (i ref v = i v ).This means that the PEC compensates the entire distortion factor, resulting in sinusoidal current at the PCC.
2) Reactivity factor compensation: Based on ( 6), (15b), and (18), the compensation coefficient of the reactivity factor is given by Similarly, given a specific (desired) value for the reactivity factor, λ GQ n that meets the standard, for example, λ GQ n = 0.92, the coefficient to reach this value is In this case, the range of values of λ GQ n is comprised between λ * Q and 1.Hence, using ( 21) and (13b), the reference current can be defined for the PEC that ensures partial or total compensation of the reactivity factor.Note that when λ GQ n is set to 1 (λ GQ n = 1), the coefficient k r is zero (k r = 0).In this case, the reference current for the PEC is equal to the reactive current (i ref r = i r ).This means that the PEC compensates for the entire reactivity factor, so the current is in phase with the voltage at the PCC.
3) Power factor compensation: Similarly to the preceding analysis, the compensation coefficient for the power factor is given by Thus, using ( 22) and ( 14), the reference current for the PEC can also be adjusted, which leads to partial or total compensation of the power factor.Note that for λ G n = 1, its coefficient is zero (k na = 0).In this case, the reference current is equal to the nonactive current (i ref na = i na ).This means that the PEC compensates all load disturbances, resulting in a current on the grid side, in phase, and with the same waveform as the voltage at the PCC, exactly as in the case of a resistive load.

C. Integration of Current References
To provide a flexible online control strategy, the reference signal containing any percentage of the undesired orthogonal components of current, in (13a and 13b) or (14), is expressed as a function of the different compensation coefficients, as in (23) or (24).Thus, the new strategy is defined for adaptive compensation (online), which enables flexible extraction of unwanted components of current, i.e., it allows one to select the type of disturbance and the percentage of compensation to be applied.In fact, there are two possible strategies, the first sets the disturbances apart according to (23) and the second one focuses on the overall compensation of the disturbances according to (24).Both the strategies can lead to the same improvement of PQ at the PCC.However, the strategy based on ( 23) is more flexible because it allows for the adjustment of each type of disturbance The general current reference for disturbances compensation and energy injection is shown in the functional block diagram of the Fig. 3.This proposed flexible control structure with variable compensation objectives is applied to the system shown in Fig. 1.The desired values of the conformity factors (λ GD n , λ GQ n , and λ G n ) are adjusted online by the supervisory flexible control system to generate the internal reference current (i ref ).Initially, all the orthogonal components of current absorbed at the PCC are determined according to CPT.The load disturbances represented by the load conformity factors (λ * Q , λ * D , and λ * ) are then used along with the desired conformity factors in the grid side (λ GD n , λ GQ n , and λ G n ) to generate the values of the compensation coefficients k r , k v , and k na .Thus, the new reference signals can ensure, for example, suitable limits of load conformity factors at the PCC, as well as extraction of the maximum remaining capability of the PEC during the injection of active power in the electric grid.
The reference current i * g required to keep the dc bus voltage constant is generated by multiplying the voltage normalized at the PCC by the peak current, i GP , coming from the dc voltage regulator.Therefore, the PEC synthesizes a current, i inv ref , which is the sum of current to be injected, i D G ref , from the current i * g , and from the unwanted current of the load to be compensated, i comp ref , as shown in (25).Finally, the current i inv ref is directed to the current controller of the PEC.It is worth to note that the control laws as well as the current decomposition and factors calculation (shown in Fig. 3) are executed at a sample rate of 26 kHz, i.e., twice the switching frequency of the power converter (13 kHz).On the other hand, the RMS values of the current components (I v , I r , and I Ga ) and the conformity factors (λ * , λ * D , and λ * Q ) are calculated once per cycle

V. SIMULATION RESULTS
In order to validate the proposed flexible control strategy for the PEC, the circuit shown in Fig. 1 was simulated using PSIM software.The circuit is composed of a linear load (shunt inductor) to generate reactive power and a single-phase rectifier to generate nonlinearities (harmonic currents).A multifunctional PEC was used to demonstrate the flexibility of the proposed control strategy.The RMS value of the nominal voltage of the power supply is 127 V, with 3% of fifth harmonic.
The purpose of this simulation is to demonstrate the effectiveness of the flexible strategy to reach preestablished values of distortion factor and reactivity factor, aiming, for example, to comply with the thresholds specified by PQ standards.In this regard, the PEC should operate as a multifunctional device, i.e., operating as SAF and PEI simultaneously.In this simulation, the LES generates 650 W. For simplicity, and mainly to verify the accuracy of the flexible control, the PEC is represented by an ideal controlled current source.The dynamics of the system's operation is described with respect to voltage, current, current components, and load conformity factors on the grid side.Thus, the reference for the conformity factors, which should be adjusted online by the control center to achieve different compensation objectives, is applied according to the following sequence of commands: 1) t < 0.5 s, without any type of compensation; 2) 0.5 s < t < 0.65 s, partial compensation of the distortion factor by setting the desired value for the distortion factor (λ GD n = 0.3); 3) 0.65 s < t < 0.8 s is added to the compensation of the remaining distortion factor, i.e. total compensation of the distortion factor (λ GD n = 0); 4) 0.8 s < t < 0.95 s is added to the compensation of a percentage of the reactivity factor with λ GQ n = 0.8 and keeping λ GD n = 0; 5) t > 0.95 s is added to the compensation of the remaining reactivity factor, i.e., total compensation of load disturbances (i.e., λ GD n = 0 and λ GQ n = 1), resulting in a unitary power factor.Figs. 4 and 5 depict the dynamic response of the PEC to the different compensation objectives described earlier herein.
1) PEC injecting energy without any compensation (t < 0.5 s): Initially, according to Fig. 4, the PEC is only injecting energy generated by LES and the current at the PCC is highly distorted due to the nonlinear load (rectifier), presenting a considerable lag in relation to the voltage owing to the linear load (shunt inductor).Fig. 5 shows the behavior of the power factor, distortion, and reactivity factors.Initially, the measured distortion factor is high (λ GD = 0.483) due to current harmonics, while the measured reactivity factor is low (λ GQ = 0.399) because of the reactive power, resulting in a very low power factor.This can also be confirmed by the high values of the reactive (i Gr ) and residual (i Gv ) components of current in Fig. 4.Moreover, the voltage is slightly distorted.Thus, because there is no compensation of any disturbances, all the compensation coefficients are equal to unity (k r = k v = 1).
2) PEC injecting energy and compensating only the harmonics (0.5 s < t > 0.8 s): The PEC was set to reach specific distortion factor values while leaving the reactivity factor unchanged.Thus, the control center at t = 0.5 s changes the distortion factor reference (λ GD n = 0.3) resulting in a compensation coefficient k v = 0.445.Finally, at t = 0.65 s, the distortion factor is switched to (λ GD n = 0) which changes k v from 0.445 to 0. Since the objective is only to compensate the current harmonics, the reactivity coefficient k r is kept unitary, i.e., there is no reactive power compensation.Fig. 5 shows the behavior of the distortion factor on the grid side.As expected, the first intervention of the PEC reduces the distortion factor from 0.483 to 0.3, after which (t > 0.65 s) compensates for the remaining harmonic currents, resulting in zero distortion factor (λ GD = 0).On the other hand, Fig. 4 shows the behavior of the void current (i Gv ), note that at k v = 0.445, the harmonic current (i Gv ) is partially compensated, and at k v = 0, it is totally compensated.However, the reactivity factor (the lag between voltage and current) remains unchanged from its initial condition, since the reactive power was not compensated.
3) PEC injecting energy and compensating harmonics plus reactive currents (t > 0.8 s): In this case, the control center keeps the value of the harmonic compensation coefficient equal to the previous case (k v = 0) i.e., total compensation of harmonics), and at t = 0.8 s, the control center changes the compensation coefficient k r from 1 to 0.697 and, finally, at t = 0.95 s, from 0.697 to 0. Fig. 5 shows the behavior of the reactivity factor on the grid side.As expected, the reactivity factor increases from 0.399 to 0.8, and then, at t = 0.95 s, this factor is totally compensated (λ GQ = 1), thus resulting in unitary power factor λ G = 1.
Finally, in Fig. 4, note that in the fourth interval, the reactive currents are partially compensated, resulting in a decrease in the lag between voltage and current and in the amplitude of reactive current (i Gr ).In the last interval, all the unwanted portions (i.e., reactive current, i Gr , and void current, i Gv ) are compensated, resulting in sinusoidal current, which is in opposite phase with the voltage at the PCC.

VI. EXPERIMENTAL RESULTS
A single-phase multifunctional PEC prototype was implemented and tested for the experimental validation of the proposed online flexible control.The functional block diagram in Fig. 1 illustrates the single-phase circuit of the system, Table I describes its parameters and Table II depicts the parameters of current and voltage controllers.
The digital control, decomposition of current, calculation of load conformity factors, and online configuration of flexible control were implemented using a dual-core processor.The first core is a Texas Instruments TMS320F28335 floating-point digital signal processor (DSP) that runs at 150 MHz and features a 12-bit digital-to-analog converter.The second core is a 32-bit ARM Cortex M4 processor that runs at 75 MHz.The two cores are connected through a shared RAM memory.Fig. 6 shows an overview of the hardware architecture.The power hardware consists of a single-phase inverter and a dc current source, which is based on boost topology (dc-dc converter) with current control.Both the inverter and the boost converter are implemented using Semikron SKM 50-GB IGBTs.The IGBTs are switched at a frequency of 13 kHz and at 300 V in the dc bus.
In ARM, core runs the DSP management program, which supervise the operation of the PEC and communicates with a remote control center where the PEC can be turned ON or OFF, its operation modes changed, the desired conformity factors for  In summary, the remote center sends commands to the program running on the ARM processor (TCP request), which passes on these commands to the DSP using the memory buffer shared by the two cores.If the center requests data, such as the dc bus voltage of the converter or the power supplied by the inverter, the ARM processor collects this information and responds to the control center (TCP response), which then displays this data on the program's main screen.Fig. 7 shows the main screen of the control center and online monitoring, which is programmed in Java language.The control center and monitoring were designed to control multiple PECs, simply by configuring the IP address of the converter to be controlled.However, only one PEC will be used in this work.
As can be seen in Fig. 7, the PEC can be configured to use feedback current from the grid or load current, control the current, select the portion or portions of load current to be compensated (selective disturbance compensation), and adjust the load conformity factors (flexible online compensation), for example, that meet the minimum requirements of power factor, harmonic distortion, etc., of a specific standard.Moreover, it can also be used to adjust any percentage of compensation of the load conformity factors, i.e., reactivity factor, distortion factor or a combination of the two.Finally, the status field is used to display errors in converter operation or in communication between the remote control interface and the processor.
For the experimental results, we will begin by analyzing a single-phase system containing only the nonlinear load and, then, a single-phase system containing two loads, shunt inductor (linear load), and nonlinear load.Since the goal is the multifunctional use of the PEC, the dynamics of the flexible online control is analyzed in the two modes of operation: PEC operating only as an SAF and operating simultaneously as an SAF and a PEI.For purposes of compensation, the flexible online compensation of the conformity factors (λ * Q and λ * D ) and the power factor (λ * ) will be considered to ensure that the PEC always works at its nominal capability.
For the first situation, the control center was set up for the PEC to work as an SAF to compensate all the disturbances.In order to achieve this goal, the desired power factor for the grid side is set up to λ G n = 1.Fig. 8(a) shows the waveforms of the grid voltage (v PCC ), grid current (i G ), load current (i L ), and PEC current (i F ), considering only the nonlinear load.Note that grid current distortion is high (THD I = 82%).Moreover, due to the impact of the nonlinear load on the line impedance and the harmonic content of the grid itself, voltage distortion is considerable (THD V = 9.5%).
Note that, as expected, the PEC fully compensates the load disturbances as shown in Fig. 8(b).The compensated currents are practically sinusoidal (THD I = 6.3%) and are in phase with the voltage, as in the case of a purely resistive load (λ G = 0.9985 ≈ λ G n = 1).Furthermore, note that the voltage disturbances were also minimized (THD V = 3.2%), since most of the voltage distortion at the PCC was imposed by the nonlinear load.In this case, the value of the compensation coefficient adjusted by the control center is null (k na = 0), i.e., total compensation.
In Fig. 8(a), the lag between voltage and load current (reactive) is minimal.Thus, to demonstrate the flexible characteristics of the strategy proposed in Section IV, the analyses in the next sections will be performed considering both the loads illustrated in Fig. 1, i.e., nonlinear load and linear load (shunt inductor).

A. Flexible Compensation Based on the Conformity Factors (λ *
Q and λ * D ) In this case, the PEC works only as an SAF.The reference signal, which is adjusted online by the control center, follows the same sequence of commands used to obtain the simulation results.Figs. 9 and 10 show the waveforms of the voltage, grid current, load current, and PEC current, as well as the dynamic response of the PEC acting as an SAF with the various compensation objectives.
1) Without Compensation: As shown in Fig. 9(a), the load current is highly distorted and shows a considerable lag in relation to voltage.This is also confirmed by the high values of the portions of reactive (i Gr ) and residual (i Gv ) current, shown in Fig. 9(d).Moreover, note that the input voltage is distorted.Thus, because there is no compensation of any disturbances, the control center keeps unaltered all the reference conformity factors.
2) Harmonics Compensation: In this case, the control center first adjusts the reference current to compensate for only a percentage of harmonic current distortion (λ GD n = 0.1) and, after a time interval, should compensate all the current harmonics (λ GD n = 0).Because the objective is only to compensate for the current harmonics, the reactivity factor is kept equal to the original condition, i.e., without compensation of reactive currents.Fig. 9(b) shows that the current distortion has been partially compensated, as expected.Fig. 9(c) shows that the remaining harmonic currents were totally compensated, resulting in practically sinusoidal grid current (i G ), i.e., null distortion factor (λ D = 0).However, the lag between voltage and current remains the same as in the initial condition shown in Fig. 9(a), because the load reactive currents were not compensated.On the other hand, Fig. 9(e) and (f) depicts the behavior of grid current decomposition, indicating that the reactive current (i Gr ) suffer no changes, unlike the residual current (i Gv ), which is partially compensated in the first stage [see Fig. 9(e)], and totally compensated in the second stage [see Fig. 9(f)], where i Gv = 0.It is worth to observe that the voltage distortion is compensated in proportion to the compensation of the distortion factor (λ D ).
3) Compensation of Harmonics and Reactive Current: The control center maintains the total compensation of the distor-  tion factor (λ GD n = 0, i.e., total compensation of harmonics) and begins the partial compensation of reactive currents, since λ GQ n is incremented from 0 to 0.92, as shown in Fig. 10(a).Finally, after a time interval, the control center adjusts the reference current to compensate for any load disturbances, i.e., total compensation (λ GD n = 0 and λ GQ n = 1) as shown in Fig. 10(b).In Fig. 10(a), note that the reactive currents are partially compensated, as expected, thereby decreasing the lag between grid current (i G ) and PCC voltage (v PCC ).This is also confirmed by the decrease in the amplitude of reactive current (i Gr ) shown in Fig. 10(c).Finally, Fig. 10(b) shows the total compensation of load disturbances, resulting in sinusoidal current in phase with the voltage on the grid side (λ G = 1).In this case, as can be seen in Fig. 10(d), the reactive and residual currents were fully compensated, thus becoming null (i Gr = i Gv = 0).

B. Flexible Compensation Based on the General Power Factor (λ * )
In this case, the PEC works as an SAF and PEI.Figs.11  and 12 show the waveforms of the voltage, grid current, load current, and PEC current.
1) PEC Operating Only as SAF: In this operating mode, the PEC operates only as an SAF to compensate the power factor, without injecting active power into the grid.To this end, the control center adjusts the compensation coefficient (k na ) to produce reference currents for two different situations.In the first situation, there is total compensation of current disturbances.In the second situation, the compensation is partial.In short, the reference power factor (λ G n ) varies from 1 to 0.95.Fig. 11 shows the voltage, grid current, and PEC current with the PEC turned on and operating only as an SAF.Note that, in the first stage of compensation [see Fig. 11(a)], the PEC compensates all the load disturbances.The compensated currents are almost sinusoidal (THD I = 4.5%) and are in phase with the voltage, as in the case of a purely resistive load (λ G = 0.9983 ≈ λ G n = 1).In addition, note that voltage disturbances are also minimized (THD V = 2.9%), since most of the voltage distortion at the PCC was imposed by the load.In this case, the value of the desired power factor adjusted by the control center is λ G n = 1, resulting in compensation coefficient k na = 0, i.e., total compensation.

TABLE III PEC OPERATING ONLY AS SAF λ G n λ G T H D I [%] T H D V [%]
Situation I [Fig.11(a In Fig. 11(b), note that, for partial compensation, unlike the first stage of compensation, the current distortion increases (THD I = 9.6%), as does the lag in relation to voltage.This is due to the change in the parameter k na from 0 to 0.1392.The power factor obtained in the partial compensation stage is approximately equal to that of the reference, adjusted by the control center (λ G ≈ 0.95 = λ G n ).In this case, the increment in the value of current distortion causes the voltage distortion to increase slightly (THD V = 3.2%).Table III summarizes PEC performance data.
2) Simultaneous Operation as PEI and SAF: When the current source (I DC ) is turned ON in the dc bus, the PEC begins to operate as a multifunctional converter, i.e., injecting power from the local source into the grid and compensating unwanted load currents.In this scenario, the current source injects 2.3 A into the dc bus, supplying a total power of 650 W. In this case, the control center maintains the compensation strategy for the two situations (λ G n = 1 and λ G n = 0.95).From Fig. 12 and Table IV, one can see that the injection of active power does not affect the performance of the PEC in the flexible compensation strategy.Fig. 12(a) is obtained considering the PEC Situation I [Fig.12(a It is possible, therefore, not only to inject active current (active power) into the grid but also to achieve partial compensation of unwanted load currents with a good performance of the PEC.Moreover, depending on the power capacity available in the PEC, the control center can adjust the compensation coefficient online to avoid exceeding the capacity of the PEC.Hence, the power processed by the PEC will always be lower than its nominal power rating, contributing to the safety and extending the service life of the PEC.
This fact is illustrated in Fig. 13, which shows that, after the compensation coefficient k na is adjusted from 1 to 0.1392, the apparent power of the PEC decreases, causing it to operate within its nominal capacity.The active power and apparent power of the load are 350 W and 600 VA, respectively.
A load step was imposed to evaluate the system's dynamic response.Fig. 14(a) shows the dc bus voltage, grid current, and current at output of PEC.At (1), the current source I DC is connected to the dc bus injecting 2.3 A. At (2), a load step is applied, since the nonlinear load is disconnected from the PCC.Finally, at (3), the nonlinear load is reconnected to the PCC.Fig. 14(b) shows details of the waveforms.Note that, despite the relatively slow dynamic response of the dc bus voltage, the response of the reference generation system and the current controllers is faster, leading to convergence of the current compensation system.
Finally, to evaluate the reference generator and designed current controller under a step change in the harmonic content, the inductive load (L B ) shown in Fig. 1 was switching OFF and the result is shown in Fig. 15.The dynamic behavior is dominated  by the current reference generator and by the fast current controller.The waveform of the grid current (i G ) is kept almost as before the harmonic step.In fact, the THD I of the grid current suffer a small change, varying from 4.5% to 6.3%.The increasing THD I is caused by harmonics that are not compensated due the limited bandwidth of the current controller.In addition, the harmonic content of the grid itself, voltage distortion is 3.2%.

VII. CONCLUSION
This paper presented a general approach for the multifunctional use of a PEC operating on distorted low voltage power systems (smart microgrids).The control strategy with variable compensation objectives allows for the effective utilization of the full capacity of the converter and of the energy resources, when the PEC operates simultaneously as an active filter and as an interface with the grid utility.The approach uses the CPT to define the reference signals through the use of orthogonal components of current and modified load conformity factors.In addition, this paper shows that the CPT offers an interesting platform for analyzing power phenomena and PQ problems in smart microgrids, where voltage distortions can be considerable.
The application of the CPT to achieve specific compensation objectives was also discussed, demonstrating that the theory is applicable to all types of operation (SAF and PEI) and can serve as the basis for the cooperative control of PECs distributed in smart microgrids.
The control approach was tested experimentally and by means of simulation, demonstrating its effectiveness in a scenario of practical interest.It was shown that, even when the PEC is used in a multifunctional manner, i.e., injecting power into the grid while simultaneously compensating PQ disturbances, it is possible to obtain a virtually unitary power factor and low distortions of voltage at the PCC and of current in the grid, respecting national and international standards and recommendations, such as IEC 61000-3-2 and IEEE 519.

Fig. 3 .
Fig. 3. Functional block diagram of the proposed control system with variable compensation objectives.

Fig. 4 .
Fig. 4. Dynamic response of the proposed flexible control for different compensation objectives.Waveforms of voltage, v P C C (t)/10, grid current i G (t), grid active current i G a (t), grid reactive current i G r (t), grid void current i G v (t), and PEC current i F (t).

Fig. 8 .
Fig. 8. Experimental result of the PEC operating as an SAF: (a) without compensation, and (b) with compensation of nonactive current (i n a ) with respect to the power factor, λ G n = 1.

Fig. 9 .
Fig. 9. Experimental results of the PEC operating as an SAF with different compensation objectives.(a) Without compensation.(b) Partial compensation of distortion factor, λ G D n = 0.1.(c) Full compensation of distortion factor, λ G D n = 0. (d)-(f) show the grid current (i G ) decomposition for (a)-(c), respectively.The scale of currents is 10 A/div, while the voltage scale is 200 V/div.

Fig. 10 .
Fig. 10.Experimental results of the PEC operating as an SAF with (a) full compensation of the distortion factor λ G D n = 0 and partial compensation of the reactivity factor, λ G Q n = 0.92 and (b) full compensation of distortion factor, λ G D n = 0 and reactivity factor, λ G Q n = 1.(c) and (d) show the grid current (i G ) decomposition for (a) and (b), respectively.

Fig. 11 .
Fig. 11.Experimental results of the PEC operating as a SAF and performing compensation of nonactive current (i G a ) with reference power factor (λ G n ) altered from 1 (a) to 0.95 (b).(Top) Voltage (v P C C ) and grid current (i G ). (Bottom) Voltage (v P C C ) and PEC current (i F ).

Fig. 12 .
Fig. 12. PEC injecting power into the grid (PEI) and applying compensation (SAF) of nonactive current (i G a ) with reference power factor (λ G n ) altered from 1 (a) to 0.95 (b).(Top) Grid voltage (v P C C ) and current (i G ). (Bottom) PEC voltage (v P C C ) and current (i F ).

Fig. 13 .
Fig. 13.Variation of apparent power of the grid and the converter, with reference power factor (λ G n ) changing from 1 to 0.95.

Fig. 14 .
Fig. 14.Dynamic behavior of the DC bus for PEC operating as FAP and DGI simultaneously: (a) I D C turned ON (1), nonlinear load switched OFF (2), and nonlinear load switched ON (3).(b) Details of waveforms.

Fig. 15 .
Fig. 15.Transient response of grid current for PEC operating only as APF considering a step in the harmonic content.
Control of Single-Phase Power Converters Connected to Low-Voltage Distorted Power Systems With Variable Compensation Objectives Jakson Paulo Bonaldo, Helmo K. Morales Paredes, Member, IEEE, and José Antenor Pomilio, Senior Member, IEEE

TABLE I PARAMETERS
OF THE ELECTRICAL SYSTEM

TABLE IV PEC
OPERATING AS PEI AND SAF