Next Article in Journal
Elbows of Internal Resistance Rise Curves in Li-Ion Cells
Next Article in Special Issue
Stability Analysis of Shunt Active Power Filter with Predictive Closed-Loop Control of Supply Current
Previous Article in Journal
A Back-of-Queue Model of a Signal-Controlled Intersection Approach Developed Based on Analysis of Vehicle Driver Behavior
Previous Article in Special Issue
Active Filter Reference Calculations Based on Customers’ Current Harmonic Emissions
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

On Adaptive Moving Average Algorithms for the Application of the Conservative Power Theory in Systems with Variable Frequency

by
Daniel dos Santos Mota
1,* and
Elisabetta Tedeschi
1,2
1
Department of Electric Power Engineering, Norwegian University of Science and Technology, 7034 Trondheim, Norway
2
Department of Industrial Engineering, University of Trento, 38123 Trento, Italy
*
Author to whom correspondence should be addressed.
Energies 2021, 14(4), 1201; https://doi.org/10.3390/en14041201
Submission received: 20 January 2021 / Revised: 11 February 2021 / Accepted: 12 February 2021 / Published: 23 February 2021
(This article belongs to the Special Issue Active Power Filters and Power Quality)

Abstract

:
The Conservative Power Theory (CPT) emerged in recent decades as a theoretical framework for coping with harmonically distorted and unbalanced electric networks of ac power systems with a high participation of converter interfaced loads and generation. The CPT measurements are intrinsically linked to moving averages (MA) over one period of the grid. If the CPT is to be used in a low-inertia isolated-grid scenario, which is subjected to frequency variations, adaptive moving averages (AMA) are necessary. This paper reviews an efficient way of computing MAs and turns it into an adaptive one. It shows that an easily available variable time delay block, from MATLAB, causes steady-state errors in the measurements when the grid frequency varies. A new variable time delay block is, thus, proposed. Nonetheless, natural pulsations in the instantaneous power slip through MAs when the discrete moving average window does not fit perfectly the continuously varying period of the grid. A method consisting of weighing two MAs is reviewed and a new and effective hybrid AMA is proposed. The CPT transducers with the different choices of AMAs are compared via computer simulations of a single-phase voltage source feeding either a linear or a nonlinear load.

1. Introduction

In the emerging smart-grid scenario, characterized by a growing number of converter interfaced renewable energy sources, energy storage systems, and smart load management enabled by sensors ubiquity and increased communication capabilities, the need for a theoretical framework capable of coping with distorted and unbalanced electric network was experienced. The Conservative Power Theory (CPT), first proposed in [1], emerged in recent decades as a potential framework as it aims to retain a clear physical meaning for all the different power and current terms it defines, which facilitates its use for driving compensation systems in different applications [2,3,4].
The initial formulation of the CPT [1,5] was subsequently revised [6,7] to cope with variable frequency systems. While the ongoing debate [8] on specific CPT quantities, such as the reactive energy, is beyond the scope of this paper, the revision provided by [6,7] highlights the importance of correctly characterizing electrical systems that feature a relevant penetration of power electronic converter interfaced loads and are prone to variations in their electrical frequency.
The motivation of this paper stems precisely from the application of the CPT on offshore isolated oil and gas platforms. Such platforms commonly feature a high penetration of converter interfaced loads. Furthermore, due to the presence of large motors with variable operation, these grids are prone to variations in their electrical frequency. In particular, this paper aims at contributing towards the practical use of the CPT in industrial applications by:
  • highlighting how inappropriate implementations of adaptive moving average (AMA) filters can impair the calculation of the basic electrical quantities underpinning the CPT, namely the active power, reactive energy, and active, reactive, and void currents;
  • proposing a new variable time delay (VTD) algorithm to be used within an AMA that corrects steady-state errors introduced by a commonly available VTD;
  • proposing a new hybrid implementation of an AMA that reduces oscillations in the measurements due to discretization errors and removes small transients caused by a continuously variable frequency.
Even though the CPT applied to isolated ac grids with variable frequency is used as backdrop, the discussions and new methods proposed in this article show higher generality, as they are applicable to multiple other fields which employ AMAs.

2. CPT Measurements and Moving Averages

The CPT as presented in [7] defines a series of electrical quantities calculated via internal products. When expressed in terms of generic periodic variables x ( t ) and y ( t ) , these internal products take the form of
x ( t ) , y ( t ) = 1 T t T t x ( τ ) y ( τ ) d τ ,
where T is the fundamental period of both variables. Equation (1) calculates a moving average (MA) of the value of x times y over the last period T.
Let a single-phase electrical circuit be fed by an ac voltage source. The instantaneous power consumed by the circuit is equal to
p ( t ) = u ( t ) i ( t ) ,
where u ( t ) and i ( t ) are the instantaneous voltage and current supplied to the circuit. If u is sinusoidal and the electrical system is linear, the waveform of p is also sinusoidal but with twice the frequency of u. The dc-level of the sinusoidal p depends on the phase shift between u and i. From the perspective of the thermal design of electrical components, it makes little sense to evaluate heat dissipation on the time scale of the instantaneous power, i.e., twice the grid frequency. A more useful measurement is, instead, the average of p over the last period T. This measurement is called active power and is applicable to sinusoidal and nonsinusoidal cases, as well as to linear and nonlinear circuits.
The CPT defines the active power p ¯ ( t ) as
p ¯ ( t ) = u ( t ) , i ( t ) .
Notice the use of the internal product from Equation (1). The active power p ¯ ( t ) is, therefore, a MA of the instantaneous power with a moving average window (MAW) equal to T. To calculate p ¯ ( t ) , one needs to know the electrical system’s frequency.
The CPT defines also a quantity for a periodic distorted condition named reactive energy, w ¯ in Equation (4). This quantity does not use directly the voltage u. It uses, instead, an unbiased integral of the voltage calculated with Equation (5), which is equal to the integral of the voltage from instant zero to t, see Equation (6), minus the MA of this same integral between times t T and t.
w ¯ ( t ) = u ( t ) , i ( t )
u ( t ) = u ( t ) 1 T t T t u ( τ ) d τ
u ( t ) = 0 t u ( t ) d t
The more commonly known reactive power is defined by the CPT as
q ¯ ( t ) = u ( t ) , u ( t ) u ( t ) , u ( t ) w ¯ ( t ) .
For a sinusoidal u ( t ) , Equation (7) can be simplified to
q ¯ ( t ) = ω w ¯ ( t ) ,
where ω = 2 π / T . As the computer simulation test setup in Section 8 features only an ideal sinusoidal voltage source, the simplified Equation (8) is going to be used throughout the paper for calculating the reactive power.
When it comes to power quality and compensation, the CPT defines an active ( i a ), a reactive ( i r ) , and a void current ( i v ), which are shown below:
i a ( t ) = p ¯ ( t ) u ( t ) , u ( t ) u ( t ) = p ¯ ( t ) u ( t ) 2 u ( t ) ,
i r ( t ) = w ¯ ( t ) u ( t ) , u ( t ) u ( t ) = w ¯ ( t ) u ( t ) 2 u ( t ) ,
i v ( t ) = i ( t ) i a ( t ) i r ( t ) .
Notice that the internal product of a variable by itself is also called the norm squared ( . 2 ) of this variable.

3. Moving Averages in the Discrete Time Domain

All CPT measurements shown previously are defined in the continuous time domain. However, a real implementation of a CPT transducer would most certainly run in an electronic microprocessor with a fixed sampling frequency f s and fixed sampling time T s = 1 / f s . In this paper, the time in the discrete domain is represented by an ever-increasing index k. Moreover, the terms time, sample, or cycle k referring to an instant k T s are interchangeably employed. Furthermore, the operator that fetches the value of a variable at the r th previous cycle is denoted by z r .
The MAs in the CPT measurements need to be calculated in the discrete time domain. One inefficient way of doing this is by a series of sums:
x ¯ ( k ) = 1 N r = 0 N 1 x ( k ) z r ,
where x ( k ) represent a generic variable and x ¯ ( k ) its MA and N is the number of samples acquired in one period T of the grid. If one expands Equation (12), multiplies it by 1 z 1 1 z 1 , and rearranges the numerator, the result is
x ¯ ( k ) = x ( k ) N z 0 + + z N + 1 z 1 + + z N 1 z 1 .
Most of the terms in Equation (13) can be canceled, yielding Equation (14) [9] (p. 394). Figure 1 shows one possible block diagram representation of Equation (14) adapted from [10]. It is important to remark that even though computationally efficient, Equation (14) still demands the last N samples of x to be stored in memory.
x ¯ ( k ) = x ( k ) N 1 z N 1 z 1

4. Adaptive Moving Averages

The diagram in Figure 1 is divided by a dotted line. To the right of this line there is an accumulator. The summation block to the left of the dotted line sends x a c c = x ( k ) / N for accumulation, notice the positive sign, whereas x d e c = x ( k N ) / N is sent for decumulation. All values x ( k ) / N are accumulated at the instant k and must be decumulated at a later instant k + N . This is a key principle into designing an AMA block.
To build an AMA from the diagram in Figure 1, one needs to turn the constant MAW N into a variable one
n ( k ) = f s f ( k ) ,
where f s is the sampling frequency with which the CPT is processed and f ( k ) is the measured fundamental frequency of the electrical grid. However, the discrete delay N in z N must be an integer. A natural choice is to round n ( k ) to the closest integer
n r ( k ) = round n ( k ) .
To maintain consistency, n r replaces N in both gain 1 / N and discrete delay z N in Figure 1.
A key element for calculating the AMA is the VTD block ( z n r ) which is typically implemented with a circular buffer. See [9] for more information on hardware realizations and circular buffers. The length of the buffer, named N b , needs to be large enough to store all samples of x / n r during the longest periods of the grid, i.e., when the frequency is at its minimum. Two pointers control the insertion of data into the buffer and the retrieval of information from the buffer:
  • j points to where the current x / n r is to be stored; it is purposefully named j for avoiding the confusion with the current i;
  • r points to the slot from which the old value of x / n r is to be retrieved.
In this paper, two strategies for handling the pointers will be analyzed. The first one uses a readily available VTD from [11] which introduces steady-state errors into the CPT measurements when the grid frequency changes. The second one, proposed by this paper, does not introduce steady-state errors.

4.1. Lossy Variable Time Delay Block

The insertion pointer of the VTD from [11] marches continuously forward through the circular buffer one step per cycle time T s . The value of j is calculated by the remainder of the division (mod) of the time k by N b , see Equation (17). The old content of the slot pointed by j is replaced by the new value. The retrieval pointer r lags one MAW number of slots behind j, see Equation (18). The old value is retrieved from the slot pointed by r. The buffer slot is left intact after retrieval.
j ( k ) = k mod N b
r ( k ) = ( k n r ( k ) ) mod N b
The retrieval pointer is forced to skip slots, stay put, or jump backwards whenever the MAW changes as r is pulled n r slots behind j. If the grid frequency increases, n r decreases, and old values of x / n r are skipped. The opposite happens when the grid frequency decreases, n r increases, the retrieval pointer jumps backwards, and old values of x / n r are retrieved twice.
Figure 2 shows one instance of a skipped decumulation and one of a double decumulation. From time k = 140 to k = 141 , the grid frequency decreases causing the MAW to increase. The retrieval pointer remains at slot 10 causing a double decumulation. From time k = 141 to k = 142 , the dual problem happens. The grid frequency increases, n r decreases, and slot 11 is skipped.
It is important to recall Figure 1. When a value x / n r enters the accumulator of the MA, it must be decumulated n r cycles later. If this value is not decumulated or is sent twice for decumulation, the accumulator will bear a steady-state error. Due to the missed and double decumulations caused by the VTD from [11], it is called in this paper the lossy variable time delay (LVTD).

4.2. Conservative Variable Time Delay Block

A new VTD is proposed in this section. The retrieval pointer r of this new block is the one continuously moving forward whereas the insertion pointer j is pushed n r slots ahead of r. It is the insertion pointer, not the retrieval, that is forced to jump or stay put whenever the MAW is updated. The other necessary changes are: (1) sum to the content of the slot when inserting and (2) set the slot to zero after retrieval. The new insertion and retrieval pointers behave according to Equations (19) and (20).
j ( k ) = ( k + n r ( k ) ) mod N b
r ( k ) = k mod N b
Every value entering this new VTD is ensured to be decumulated only once even when the grid frequency decreases. No values are lost either when the frequency increases. For this reason, the new block is named conservative variable time delay (CVTD).

5. CPT Measurements in the Discrete Time Domain

Two VTDs for performing AMAs were presented in the previous sections. It is now convenient to represent the calculation of the CPT electrical quantities in the discrete time domain. Figure 3 shows a block diagram of the active power and active current measurements given by Equations (3) and (9). One AMA is used for p ¯ and another one is used for u 2 . The active current i a depends on both AMAs.
Figure 4 shows the block diagram representation of the measurement of the reactive energy, reactive power, and the reactive current given by Equations (4), (8) and (10). The reactive energy depends on u from Equation (5) which in turn depends on u from Equation (6). The trapezoidal approximation is chosen for calculating u :
u ( k ) = T s ( z + 1 ) 2 ( z 1 ) u ( k ) .
This approximation provides a better accuracy than the forward and backward rectangular methods [12]. Nevertheless, the analysis of different choices of discrete integration and their effects on u , w ¯ , q ¯ , i r , and i v are considered beyond the scope of this paper.
Cascaded AMAs are needed for calculating w ¯ , q ¯ , i r , and i v . The consequences of this can be seen in Section 9.1.1. It is important to recall that the reactive power shown in Figure 4 is obtained from the simplified Equation (8). In other words, it is valid for sinusoidal voltages. The reactive energy and current, on the other hand, are valid for distorted voltages as well. Furthermore, the angular frequency is calculated from the measured grid frequency, i.e., ω ( k ) = 2 π f ( k ) .

6. Weighted Adaptive Moving Average

The processing and memory requirements for a CPT transducer built with either LVTDs or CVTDs are similar. Furthermore, as it is shown in Section 9, the poor performance of the transducer with LVTDs discourages their use. However, both CPT transducers with LVTDs and CVTDs let through a noticeable parcel of the pulsations in u i and u i when the grid frequency varies continuously.
The AMAs behave as filters removing oscillations with a frequency equal to or a multiple of 1 / ( n r T s ) [13] (p. 341). When the period of the grid T is not equal to n r T s , the AMAs do not block completely the fundamental frequency 1 / T and its harmonics [14]. To mitigate this problem, a weighting of MAs proposed by [15] can be used. This method calculates two MAs and is named weighted adaptive moving average (WAMA) in this paper.
The output of the WAMA, x ¯ w ( k ) in Equation (22), is composed by the weighted sum of two AMAs. The first one, x ¯ c ( k ) , uses a window equal to the value of n ( k ) rounded up to the closest integer as shown by Equation (23). The second one, x ¯ f ( k ) , rounds the window down to the closest integer as shown by Equation (24). The terms ceiling is used for rounding up and floor for rounding down.
x ¯ w ( k ) = n ( k ) n f ( k ) x ¯ c ( k ) + 1 n ( k ) + n f ( k ) x ¯ f ( k )
n c ( k ) = ceiling f s f ( k )
n f ( k ) = floor f s f ( k )
It is important to remark that a CPT measurement transducer for a single-phase circuit uses five AMAs, see Figure 3 and Figure 4, which may be a burden for real applications. However, in addition to other functions, modern microprocessors are capable of handling the CPT computational demands for single-phase and for three-phase four-legged converters as seen in the experimental results obtained by [16,17]. A WAMA uses twice as much memory than a single AMA. Nevertheless, this is not considered a critical barrier for implementing the WAMA in a CPT transducer.

7. Hybrid Adaptive Moving Average

As it will be shown in Section 9, the CPT transducer built with WAMAs reduces the oscillations due to unmatched n r T s and T. However, it still features unwanted transients whenever the MAW is updated. It is interesting to notice that when the grid frequency varies in a continuous way, n c and n f are not updated at the same time as n r . Thus, this article proposes a hybrid adaptive moving average (HAMA) that exploits this fact. The following strategy is employed:
  • three internal AMAs: x ¯ r with rounded window from Equation (16), x ¯ c with ceiling window from Equation (23), and x ¯ f with floor window from Equation (24);
  • the block usually outputs: x ¯ w from Equation (22),
  • but at the cycle in which n c changes and for n c ( k ) cycles after that, the hybrid block outputs: x ¯ r .
It is important to remark that the HAMA demands 50% more memory than the WAMA.

8. Materials and Methods

The effects of the LVTD and CVTD in the measurements of a CPT transducer are analyzed in this paper with the help of computer simulations. The comparisons between a single AMA with rounded MAW, a WAMA, and a HAMA are also performed with simulations. To do that, a single-phase ideal sinusoidal voltage source feeding a relatively simple load is chosen. The load is composed of ideal components: one resistor R, one inductance L, and one diode in series with a resistor R d . Figure 5 shows the test model.
The instantaneous value of the source voltage in Figure 5 is calculated with the cosine of 2 π f t with the frequency in Hz and the time in s . This is done on purpose so the simulation can start with initial conditions set to zero and, still, result in zero steady-state dc-level at i L . It is important to mention that changes in the sinusoidal profile of u can induce a dc-level in i L . Furthermore, as u is sinusoidal, a dc-level in i L is reflected as a dc-level in the void current after the CPT decomposes i.
The analysis is performed with two load scenarios. The first one is resistive and inductive (RL), i.e., the resistance R d in Figure 5 is disconnected. The second scenario features a diode bridge (DB), the resistance R and the inductance L are disconnected. Those two simple scenarios were chosen so the effects of the different choices of AMAs in the reactive and void currents can be highlighted. The tests are composed of simple disturbances applied to the frequency f in Figure 5 while the system is in steady state. Errors introduced in the void current are highlighted in the RL-scenario as i v is expected to be zero before the disturbances. Conversely, errors in i r are highlighted in the DB-scenario. The computer simulation data is shown in Table 1 and the expected steady-state measurements are found in Table 2.
The CPT algorithm is simulated in the discrete time domain with a fixed cycle time T s and sampling frequency f s = 1 / T s . At the beginning of each processing cycle, the source’s voltage, current, and frequency are sampled simultaneously. There is no delay nor noise in the measurements. The sampled values are hold constant throughout one complete calculation of the transducer’s algorithm, as usual in microprocessor implementations. Intentional variable sampling times, unintentional variations of the main software cycle time, or non-simultaneous sampling of the voltage and current are beyond the scope of this paper.

9. Results

This section is subdivided into two. Firstly, a subsection comparing the effects of single AMAs with rounded MAWs using either LVTDs or CVTDs. Secondly, a comparison between single AMAs with rounded MAWs versus WAMAs versus HAMAs.

9.1. LVTD versus CVTD

Two CPT transducers using either LVTDs or CVTDs with rounded MAWs are compared in this subsection. The results of three tests are shown and commented: first, negative steps at the grid frequency for the RL-scenario; second, positive steps for the DB-scenario; and third, a continuously varying frequency for both load scenarios.

9.1.1. Negative Steps for the RL-Load

The sampling frequency of the transducers is 20 k Hz , see Table 1, which results in 400 samples per period of the source voltage. The negative step is precisely calculated to increase the MAWs from 400 to 404. Figure 6 shows the results of two negative steps applied at slightly different times. The measurements with LVTDs are in red. The measurements with CVTDs are in blue.
Frequency, MAW, and source voltage and current: in Figure 6a, the step is applied at the peak of the source voltage, t = 0.1 s . In Figure 6b, the step in the frequency is applied 2.5 m s after the peak of the voltage. The MAWs are updated immediately to 404 when the frequency changes.
Active power: should be constant at 0.5 W irrespective of the frequency step. The retrieval pointers in the LVTDs jump back and go twice over four slots after the MAW increases from 400 to 404. The values in these slots are decumulated twice introducing a steady-state error in the active power. The error is on the range of 1% of a full scale of 1 W in Figure 6a,b. The CVTDs do not cause double decumulations. After the transient period of 20 m s , the CVTDs auto correct the active power measurement back to 0.5 W . Both measurements with LVTDs and CVTDs feature a transient. After the MAW changes from 400 to 404, the MAs have to decumulate old values of x / 400 while accumulating new values of x / 404 for one period of the grid, this is the cause of the transient.
Reactive power: should increase after the frequency decreases. The measurement with CVTDs settles at the expected value after a transient of 40 m s . Notice that the transient lasts for two periods of the grid as the reactive power measurement depends on two cascaded AMAs. The steady-state errors introduced by the LVTDs depend on which slots of the circular buffers are decumulated twice. This effect is noticeable when comparing the reactive power in red in Figure 6a,b. For the step at the crest of the source voltage, the error is barely noticeable, whereas it is approximately 1% of a full scale of 1 Var for the step at t = 0.1025 s .
Active current: is expected to be sinusoidal and in phase with the source voltage. The errors introduced in the calculation of the active power by the LVTDs affect the active current. However, neither the transients nor the steady-state measurement errors are noticeable at the scale the curves are shown.
Reactive current: is expected to be sinusoidal lagging the source voltage by 90 degrees. As with the case of the active current, neither the effects of the transients nor the steady-state errors in the reactive power are noticeable in the reactive current curves.
Void current: also experiences a two-period transient due to the cascaded AMAs in the reactive energy. It is expected to be zero for the step at the crest of the source voltage. Figure 6a shows that the CPT transducer with CVTDs reacts as expected. However, the transducer with the LVTDs features a small oscillation around zero. The step at instant t = 0.1025 s introduces a dc-level in i L (refer to Figure 5). This is reflected as a dc-level in the void current. The measurement with CVTDs behave as expected in Figure 6b. However, the measurement with LVTDs oscillates noticeably with 50 Hz .

9.1.2. Positive Steps for the DB-Load

The positive steps applied are precisely calculated to decrease the MAWs from 400 to 396. Figure 7 shows the results of two positive steps applied at slightly different times for the DB-scenario. The measurements with LVTDs are in red. The measurements with CVTDs are in blue.
Frequency, MAW, and source voltage and current: in Figure 7a, the step is applied at the peak of the source voltage, t = 0.1 s . In Figure 7b, the step in the frequency is applied 2.5 m s after the peak of the voltage. The MAWs are updated immediately at the instants the frequency changes. Notice that the source current (magenta) is zero during the negative semi-cycle of the source voltage (green).
Active power: should be constant at 0.5 W irrespective of the frequency step. The retrieval pointers in the LVTDs jump over four slots when the MAW drops from 400 to 396. The values in these slots are not decumulated introducing a steady-state error in the active power. The error is on the range of 2% of a full scale of 1 W for the step at t = 0.1 s . It is, however, approximately 1% for the step at t = 0.1025 s . The measurements with CVTDs are auto corrected when the transient ends.
Reactive power: should be zero irrespective of the frequency step. The transient after the step lasts for two periods due to the cascaded AMAs. The measurements with CVTDs settle at the expected value after the transients. The steady-state errors introduced by LVTDs depend on which slots of the circular buffers are skipped. The error is barely noticeable in Figure 7a; however it is close to 0.5% of a full scale of 1 Var in Figure 7b.
Active current: neither the transients nor the steady-state measurement differences are noticeable in the curves at the scale shown.
Reactive current: is expected to be zero irrespective of the frequency variation. The error in the reactive current with LVTDs in Figure 7a is barely noticeable. This is a consequence of the small error in the reactive power for the step at instant t = 0.1 s . On the other hand, the reactive current measured with LVTDs features a clear 50 Hz oscillation in Figure 7b. The measurements with CVTDs behave as expected.
Void current: the differences between the measurements from the CPT transducers with LVTDs and CVTDs are barely noticeable during the transient between t = 0.1 s and t = 0.14 s .

9.1.3. Continuously Varying Frequency for Both Load Scenarios

The steps used previously were purposefully calculated so the new value of n r T s would be equal to the new period T. However, a more realistic test considers a continuous variation of the grid frequency, i.e., non-integer values of n ( k ) from Equation (15). Figure 8 shows simulated measurements of two CPT transducers with either LVTDs (in red) or CVTDs (in blue) when the frequency of the voltage source varies in a sinusoidal form.
Frequency and MAW: a sinusoidal disturbance with amplitude of 0.5 Hz and frequency 2 / 3 Hz is summed to the rated value of the source frequency at instant t = 0.1 s . The ideal value of the MAW n is shown in black. It goes down when the frequency increases and up when the frequency decreases. The rounded value of the MAW n r is shown in cyan.
Active power: should be constant at 0.5 W irrespective of the frequency changes. The randomness of the steady-state errors introduced by the LVTDs is especially noticeable in the DB-load scenario. Some changes in n r affect the active power measurement, some do not. The active power measured with the CVTDs does not feature noticeable steady-state errors. Nevertheless, the measurements with both LVTDs and CVTDs show transients lasting for 20 m s after the MAW changes. Furthermore, a small 100 Hz oscillation is detected in the active power when n r differs from n in Figure 8a. Moreover, a 50 Hz pulsation is present in Figure 8b. Those are the natural pulsations of the instantaneous power, Equation (2), passing through the AMAs as previously commented in Section 6.
Reactive power: in the RL-scenario, the reactive power should vary inversely proportionally to the frequency. The measurement with CVTDs behaves as expected. However, the steady-state errors introduced by the LVTDs are clearly seen. In the DB-scenario, the reactive power should be zero irrespective of the frequency. The transducer with CVTDs behaves as expected, but the one with LVTDs does not.
Active current: the effects of the steady-state errors and transients are not large enough to be noticed in the active current in neither scenarios.
Reactive current: in the RL-scenario, the steady-state errors introduced in the reactive power do not cause noticeable errors in the reactive current. However, in the DB-scenario, they do.
Void current: in the DB-scenario, the steady-state errors introduced in the reactive power do not cause noticeable errors in the void current. However, in the RL-scenario, they do.

9.2. Single AMAs with Rounded MAWs versus WAMAs versus HAMA

Due to the poor performance seen in Section 9.1, LVTDs are not featured from here on. All results of the computer simulations shown from this point on were obtained with CPT transducers using exclusively CVTDs. For the sake of brevity, only the tests with a continuously variable grid frequency are presented.

9.2.1. Single AMA with Rounded MAW versus WAMAs

A disturbance with 0.5 Hz of amplitude and a frequency of 2 / 3 Hz is applied to the source voltage’s frequency at instant t = 0.1 s for both RL and DB-scenarios. Figure 9 shows a detail from 0.45 to 0.90 s of the computer simulations. The measurements of the CPT transducer with single CVTDs with rounded MAWs are shown in red. The measurements with WAMAs are shown in blue.
Frequency and MAW: the frequency is at its peak at instant t = 0.45 s . The ideal value of the MAW n is shown in black; it increases as the frequency drops. The ceiling ( n c in magenta) and the floor ( n f in green) values of the MAW are updated simultaneously when n crosses an integer value. Notice that the rounded value of the MAW ( n r in cyan) does not change at the same time as n c and n f do.
Active power: the RL-scenario is shown in Figure 9a. The amplitude of the oscillations in the active power measured with single AMAs increases steadily as n drifts apart from n r after t = 0.45 s . Just before t = 0.60 s , n r is updated. This causes a 20 m s transient in the red curve. Subsequently, the amplitude of the oscillations decreases and reaches a minimum when n is closest to n r . The measurement with WAMAs features smaller oscillations up to instant t = 0.65 s , when n c and n f change. However, the transients with WAMAs are worse than the ones with single AMAs. In the DB-scenario, the pulsating instantaneous power (not shown) is nonsinusoidal. It peaks at the positive semi-cycle of the source’s voltage and is zero during the negative semi-cycle. A parcel of those pulses slips through the single AMAs with rounded MAWs. The WAMAs, instead, are better at filtering the pulses.
Reactive power: similarly to the active power measurement, the WAMAs are better at filtering the pulsating instantaneous value of w = u i ( t ) than the single AMAs. However, WAMAs feature worse transients when the MAW is updated.
Active current: the oscillations and transients are not noticeable in the curves at the scale shown.
Reactive current: in the RL-scenario, the differences between the measurements with single AMAs and WAMAs are not noticeable. The reactive current is expected to be zero in the DB-scenario. It is, therefore, easier to zoom in and show the differences. Up to instant t = 0.65 s , the transducer with WAMAs performs better. Furthermore, similarly to the active power curves, the transients caused by the changes in n c and n f are worse in the CPT with WAMAs than the ones caused by the changes in n r for single AMAs.
Void current: in the DB-scenario in Figure 9b, the differences between the measurements with single ama and WAMAs are not noticeable. The void current is expected to be zero in the RL-scenario in Figure 9a. Up to instant t = 0.65 s , the transducer with WAMAs performs better. However, the transients caused by the changes in n c and n f are worse in the CPT with WAMAs than the ones caused by the changes in n r for single AMAs.

9.2.2. WAMA versus HAMA

In Figure 9, the transients of the single AMAs with rounded MAWs do not happen at the same time as the transients of the WAMAs. This inspired the creation of the HAMA which combines the output of a single AMA with rounded MAW and the output of one WAMA. It is worth mentioning, though, that this comes at the cost of extra memory.
Figure 10 shows the results of the computer simulations comparing the measurements of two CPT transducers. The transducer with WAMAs is shown in red. The one with HAMAs is shown in blue.
Frequency and MAW: the disturbance at the frequency of the voltage source starts at t = 0.1 s . The frequency of the disturbance is 2 / 3 Hz . The ideal value of the MAW n is shown in black; it reacts instantaneously to the changes in the frequency. The ceiling ( n c in magenta) and the floor ( n f in green) values of the MAW are updated simultaneously when n crosses an integer value.
Active power: a HAMA incorporates one single AMA with rounded MAW and one WAMA. By choosing to output x ¯ r for one period of the grid after n c and n f change, refer to Section 7, the HAMAs remove the transients observed in the active power measured with WAMAs.
Reactive power: similarly to the active power measurement, the HAMAs remove the unwanted transient from the measurements with WAMAs. It is interesting to remark that the strategy of switching x ¯ w by x ¯ r for only one period of the grid, see Section 7, works well despite the two-period transients in the reactive power measurements caused by cascaded AMAs.
Active current: the oscillations and transients in the active current are not noticeable at the scale the curves are presented.
Reactive current: in the RL-scenario, the differences between the measurements with WAMAs and HAMAs are not noticeable. The reactive current is expected to be zero in the DB-scenario. It is, therefore, easier to zoom in and highlight the differences between WAMAs and HAMAs. The measurement with HAMAs does not feature the transients observed in the measurement with WAMAs.
Void current: the void current is expected to be zero in the RL-scenario. The HAMAs effectively remove the transients observed in the measurement with WAMAs. In the DB-scenario, the differences between the measurements with WAMAs and HAMAs are not noticeable.

10. Conclusions

In the modern smart-grid scenario characterized by an increasing participation of renewable energy sources, energy storage devices, and smart load management systems, the CPT emerged as a theoretical framework for coping with harmonically distorted and unbalanced electric networks. Isolated grids with reduced inertia, microgrids included, may experience large frequency variations. The application of the CPT for the compensation of harmonic distortions and unbalances in such grids is predicated on the appropriate measurement of the CPT’s basic electrical quantities. Those measurements, which are intrinsically linked to AMAs, need to be correct not only in steady state, but during unexpected excursions of the grid frequency as well.
A computational efficient way of calculating MAs is briefly reviewed with a discussion on how to turn it into an adaptive one in Section 4. The concepts of accumulation and decumulation are presented emphasizing their importance in the calculation of a correct AMA. Moreover, an AMA needs a VTD block. Two different ways of implementing a VTD are presented in Section 4.1 and Section 4.2, the LVTD and the CVTD, respectively. Two CPT transducers based on AMAs with either LVTDs or CVTDs are tested through computer simulations in Section 9.1 with the following results.
  • The LVTD, which is readily available from [11], introduces noticeable steady-state errors in the active and reactive power measurements when the frequency changes and the MAW is updated. Furthermore, errors in the reactive current are noticeable for the case of a nonlinear load, whereas errors in the void current are noticeable for the case of a linear load.
  • The CVTD, which is proposed in this paper, is easily programmable and demands the same amount of memory as the LVTD. The CVTD auto corrects the measurements after changes to the MAW. However, similarly to the LVTD, it causes transients lasting one grid period in the active power and active current measurements after changes to the MAW. The transients in the measurements of the reactive power and the reactive and void currents last for two grid periods.
Both CPT transducers built with either LVTDs or CVTDs let through a noticeable parcel of the instantaneous pulsations in p = u i and w = u i when the ideal value of the MAW is different from the rounded one. This comes from the impossibility of matching perfectly the integer n r , Equation (16), with the continuously varying real number n, Equation (15). Nevertheless, the main conclusion from the results of Section 9.1 is: the readily available LVTD should not be used in AMAs built as in Figure 1, the newly proposed CVTD should be used instead.
A weighting of MAs proposed by [15] for tackling the problems related to rounding the MAW is briefly reviewed in Section 6. This method is named WAMA in this paper. An improvement of the WAMA is proposed in Section 7 and is called HAMA. Three CPT transducers based on single AMAs with rounded MAWs, on WAMAs, and on HAMAs are compared via computer simulations in Section 9.2. The results are summarized below.
  • The WAMA is better than a single AMA with rounded MAW at filtering the pulsations in p = u i and w = u i as shown in Section 9.2.1. However, the WAMA features noticeable transients when the ceiling and floor values of the MAW are updated. The amplitude of those transients is larger than both the oscillations and the transients observed in the measurements with single AMAs with rounded MAWs. This, summed to its extra demand in memory, places the WAMA behind the single AMA with rounded MAW in a ranking of best AMA methods for implementing the CPT in systems with variable frequency.
  • The HAMAs efficiently remove the transients observed in the measurements with WAMAs as shown in Section 9.2.2. This comes at a cost of 50% more memory usage when compared to WAMAs. Despite that, the HAMA ranks best among the AMA methods analyzed in this paper.
Table 3 compares three single-phase CPT transducers built according to Figure 3 and Figure 4, running with a sampling frequency as defined in Table 1, and using either single AMAs with rounded MAWs, WAMAs, or HAMAs. It is worth stressing that due to the poor performance of the AMAs with LVTDs, only CVTDs were employed in the transducers shown in Table 3.
The frequency measurement was assumed to be instantaneous and without noise throughout the whole paper. The MAWs were, thus, updated instantaneously. In a future research, the authors wish to investigate the effects of nonideal frequency measurements in the performance of the CPT transducers with different choices of AMAs.
Even though the CPT applied to isolated ac grids with variable frequency was used as backdrop, the authors believe that the discussions and new methods proposed in this article show higher generality and are applicable to other fields which employ AMAs.

Author Contributions

Conceptualization, D.d.S.M. and E.T.; methodology, D.d.S.M.; software, D.d.S.M.; validation, D.d.S.M.; formal analysis, D.d.S.M.; investigation, D.d.S.M.; resources, E.T.; data curation, D.d.S.M.; writing—original draft preparation, D.d.S.M.; writing—review and editing, D.d.S.M. and E.T.; visualization, D.d.S.M.; supervision, E.T.; project administration, E.T.; funding acquisition, E.T. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Research Council of Norway through the PETROSENTER scheme, under the “Research Centre for Low-Emission Technology for Petroleum Activities on the Norwegian Continental Shelf” (LowEmission), grant number 296207.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are openly available at doi:10.5281/zenodo.4555392.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

AMAadaptive moving average
CPTConservative Power Theory
CVTDconservative variable time delay
DBdiode bridge
HAMAhybrid adaptive moving average
LVTDlossy variable time delay
MAmoving average
MAWmoving average window
RLresistive and inductive
VTDvariable time delay
WAMAweighted adaptive moving average

References

  1. Tenti, P.; Mattavelli, P. A Time-Domain Approach to Power Term Definitions under Non-Sinusoidal Conditions. L’Energia Elettr. 2004, 81, 75–84. [Google Scholar]
  2. Busarello, T.D.C.; Pomilio, J.A.; Simões, M.G. Passive Filter Aided by Shunt Compensators Based on the Conservative Power Theory. IEEE Trans. Ind. Appl. 2016, 52, 3340–3347. [Google Scholar] [CrossRef]
  3. Mortezaei, A.; Simões, M.G.; Busarello, T.D.C.; Marafão, F.P.; Al-Durra, A. Grid-Connected Symmetrical Cascaded Multilevel Converter for Power Quality Improvement. IEEE Trans. Ind. Appl. 2018, 54, 2792–2805. [Google Scholar] [CrossRef] [Green Version]
  4. Alonso, A.M.S.; Paredes, H.K.M.; Filho, J.A.O.; Bonaldo, J.P.; Brandão, D.I.; Marafão, F.P. Selective Power Conditioning in Two-Phase Three-Wire Systems Based on the Conservative Power Theory. In Proceedings of the 2019 IEEE Industry Applications Society Annual Meeting, Baltimore, MD, USA, 29 September–3 October 2019; pp. 1–6. [Google Scholar] [CrossRef] [Green Version]
  5. Tedeschi, E.; Tenti, P. Cooperative design and control of distributed harmonic and reactive compensators. In Proceedings of the 2008 International School on Nonsinusoidal Currents and Compensation, Lagow, Poland, 10–13 June 2008; pp. 1–6. [Google Scholar] [CrossRef]
  6. Tenti, P.; Mattavelli, P.; Morales Paredes, H.K. Conservative Power Theory, sequence components and accountability in smart grids. In Proceedings of the 2010 International School on Nonsinusoidal Currents and Compensation, Lagow, Poland, 5–18 June 2010; pp. 37–45. [Google Scholar] [CrossRef]
  7. Tenti, P.; Paredes, H.K.M.; Mattavelli, P. Conservative Power Theory, a Framework to Approach Control and Accountability Issues in Smart Microgrids. IEEE Trans. Power Electron. 2011, 26, 664–673. [Google Scholar] [CrossRef]
  8. Czarnecki, L.S. Critical comments on the Conservative Power Theory (CPT). In Proceedings of the 2015 International School on Nonsinusoidal Currents and Compensation (ISNCC), Lagow, Poland, 15–18 June 2015; pp. 1–7. [Google Scholar] [CrossRef]
  9. Orfanidis, S.J. Introduction to Signal Processing; Prentice Hall, Inc.: Upper Saddle River, NJ, USA, 1996; ISBN 0-13-209172-0. [Google Scholar]
  10. Golestan, S.; Ramezani, M.; Guerrero, J.M.; Freijedo, F.D.; Monfared, M. Moving Average Filter Based Phase-Locked Loops: Performance Analysis and Design Guidelines. IEEE Trans. Power Electron. 2014, 29, 2750–2763. [Google Scholar] [CrossRef] [Green Version]
  11. MathWorks Documentation Archive—Matlab Simulink R2018a—Delay Input Signal by Fixed or Variable Sample Periods. Available online: https://mathworks.com/help/releases/R2018a/simulink/slref/delay.html?searchHighlight=delay&s_tid=doc_srchtitle (accessed on 23 October 2020).
  12. Comanescu, M. Influence of the discretization method on the integration accuracy of observers with continuous feedback. In Proceedings of the 2011 IEEE International Symposium on Industrial Electronics, Gdansk, Poland, 27–30 June 2011; pp. 625–630. [Google Scholar] [CrossRef]
  13. Lyons, R.G. Understanding Digital Signal Processing; Prentice Hall PTR: Upper Saddle River, NJ, USA, 2001; ISBN 0-201-63467-8. [Google Scholar]
  14. Ama, N.; Destro, R.; Komatsu, W.; Kassab, F.; Matakas, L. PLL performance under frequency fluctuation-compliance with standards for distributed generation connected to the grid. In Proceedings of the 2013 IEEE PES Conference on Innovative Smart Grid Technologies (ISGT Latin America), Sao Paulo, Brazil, 15–17 April 2013; pp. 1–6. [Google Scholar] [CrossRef]
  15. Svensson, J.; Bongiorno, M.; Sannino, A. Practical Implementation of Delayed Signal Cancellation Method for Phase-Sequence Separation. IEEE Trans. Power Deliv. 2007, 22, 18–26. [Google Scholar] [CrossRef]
  16. Bonaldo, J.P.; Paredes, H.K.M.; Pomilio, J.A. Control of Single-Phase Power Converters Connected to Low-Voltage Distorted Power Systems With Variable Compensation Objectives. IEEE Trans. Power Electron. 2016, 31, 2039–2052. [Google Scholar] [CrossRef] [Green Version]
  17. Brandao, D.I.; Guillardi, H.; Morales-Paredes, H.K.; Marafão, F.P.; Pomilio, J.A. Optimized Compensation of Unwanted Current Terms by AC Power Converters Under Generic Voltage Conditions. IEEE Trans. Ind. Electron. 2016, 63, 7743–7753. [Google Scholar] [CrossRef] [Green Version]
Figure 1. A MA block built from Equation (14), adapted from [10].
Figure 1. A MA block built from Equation (14), adapted from [10].
Energies 14 01201 g001
Figure 2. Inner workings of a LVTD. A double decumulation happens at k = 141 due to a frequency decrease. A missed decumulation happens at k = 142 due to a frequency increase. The circular buffer length is N b = 50 .
Figure 2. Inner workings of a LVTD. A double decumulation happens at k = 141 due to a frequency decrease. A missed decumulation happens at k = 142 due to a frequency increase. The circular buffer length is N b = 50 .
Energies 14 01201 g002
Figure 3. Block diagram representation of the CPT’s active measurements in the discrete time domain.
Figure 3. Block diagram representation of the CPT’s active measurements in the discrete time domain.
Energies 14 01201 g003
Figure 4. Block diagram representation of the CPT’s reactive measurements in the discrete time domain.
Figure 4. Block diagram representation of the CPT’s reactive measurements in the discrete time domain.
Energies 14 01201 g004
Figure 5. Computer simulation model for testing the CPT transducer with different AMAs.
Figure 5. Computer simulation model for testing the CPT transducer with different AMAs.
Energies 14 01201 g005
Figure 6. Negative steps applied at different instants to the frequency of the source voltage for the RL-load scenario
Figure 6. Negative steps applied at different instants to the frequency of the source voltage for the RL-load scenario
Energies 14 01201 g006
Figure 7. Positive steps applied at different instants to the frequency of the source voltage for the DB-load scenario.
Figure 7. Positive steps applied at different instants to the frequency of the source voltage for the DB-load scenario.
Energies 14 01201 g007
Figure 8. Continuous variation of the source frequency. LVTD in red versus CVTD in blue
Figure 8. Continuous variation of the source frequency. LVTD in red versus CVTD in blue
Energies 14 01201 g008
Figure 9. Single AMA with rounded MAW in red versus WAMA in blue
Figure 9. Single AMA with rounded MAW in red versus WAMA in blue
Energies 14 01201 g009
Figure 10. WAMA in red versus HAMA in blue
Figure 10. WAMA in red versus HAMA in blue
Energies 14 01201 g010
Table 1. Computer simulation data for the rl-load and db-load scenarios.
Table 1. Computer simulation data for the rl-load and db-load scenarios.
rl-Load Scenariodb-Load Scenario
Source voltage amplitude U 2 V 2 V
Source frequency f (pre-disturbance) 50 Hz 50 Hz
Load resistance R 2 Ω disconnected
Load inductance L 6.3662 m H disconnected
db-load resistance R d disconnected 1 Ω
Transducer sampling frequency f s 20 k Hz 20 k Hz
Table 2. Expected pre-disturbance steady-state measurements for the rl-load and db-load scenarios.
Table 2. Expected pre-disturbance steady-state measurements for the rl-load and db-load scenarios.
RL-Load ScenarioDB-Load Scenario
Active power p ¯ 0.5 W 0.5 W
Reactive power q ¯ 0.5 Var 0 Var
Active current i a (min to max) 0.5 2 to 0.5 2 A 0.5 2 to 0.5 2 A
Reactive current i r (min to max) 0.5 2 to 0.5 2 A 0 A
Void current i v (min to max) 0 A 0 to 0.5 2 A
Table 3. Assessment of three CPT transducers using either single AMAs with rounded MAWs, WAMAs, or HAMAs.
Table 3. Assessment of three CPT transducers using either single AMAs with rounded MAWs, WAMAs, or HAMAs.
CriteriaSingle AMAsWAMAsHAMAs
Blocking natural pulsations of p and wworstgoodbest
Transients when updating the MAWsbadworstbest
Memory usagebestbadworst
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Mota, D.d.S.; Tedeschi, E. On Adaptive Moving Average Algorithms for the Application of the Conservative Power Theory in Systems with Variable Frequency. Energies 2021, 14, 1201. https://doi.org/10.3390/en14041201

AMA Style

Mota DdS, Tedeschi E. On Adaptive Moving Average Algorithms for the Application of the Conservative Power Theory in Systems with Variable Frequency. Energies. 2021; 14(4):1201. https://doi.org/10.3390/en14041201

Chicago/Turabian Style

Mota, Daniel dos Santos, and Elisabetta Tedeschi. 2021. "On Adaptive Moving Average Algorithms for the Application of the Conservative Power Theory in Systems with Variable Frequency" Energies 14, no. 4: 1201. https://doi.org/10.3390/en14041201

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop