Power, and the part that does no work

The ramp the triangle cannot see

A frequency that moves during a cycle-summing converter's window is two errors, not one: a mean period that is wrong, and a ramp across the window while the mean is right. The weights that cure the first part company on the second. A ramp of 0.4% across eight periods reads a sine 19.9 ppm wrong through the plain sum — D/(8πN), falling with the window — and 19.9 ppm through the triangle, the same curve with its sign reversed, because the plain sum's error comes from its two ends and the triangle's from the one corner between them, where a ramp's phase is largest. The Hann weight reads it 0.235 ppm and falls as N⁻³. On a frequency that rises and falls back the triangle is twice as wrong as no weight at all. And a converter that takes its period from the window before sits, through a triangle, on a floor of r/(8π) set by the drift rate alone, which no window length moves.

Assumes: What a meter multiplies by · The bandwidth noise sees

The window that forgives the period took a converter that reads a waveform’s root-mean-square by summing its square over whole periods, gave it a period that was slightly wrong, and weighted the window down to zero at its ends so that the extra sliver of period counted at almost nothing. It found two kinds of cure. The triangle changed the order of the error: a period 1.3 per cent long read a sine 0.6 per cent wrong through the plain sum and 79 parts per million through a triangle, and halving the mistake quartered the triangle’s error. The Hann weight kept first order but fell with the number of periods summed. Both were measured on a period that was wrong and steady.

A real supply does not hold still while it is being measured. The mains wanders by tenths of a hertz over seconds and by more after a large load is switched; a generator under a governor hunts; a motor drive’s output frequency is commanded to ramp. Over a window of ten periods such a frequency is not merely wrong, it is wrong by a different amount at the window’s start and its end, and the question that essay left open was whether the taper that forgives a steady error also forgives a moving one. The answer is that it depends on the weight, and on the shape of the motion, and the weight that did best on the steady case is the one that does nothing at all for the commonest kind of drift.

Two errors in one drift

Any frequency history across a window can be split into two parts. One is its mean over the window, which either matches the period the converter assumed or does not; that part is exactly the steady error already measured, and every result about it carries over. The other is the motion about the mean — the part that leaves the window holding the right number of cycles in total but crowds them at one end and spreads them at the other.

The second part is new, and it is the subject here. To isolate it the measurements below give the sine a frequency that is right on average and moves across the window in one of three ways: a ramp, linear from a little low at the start to a little high at the end; a bow, high at both ends and low in the middle; and for comparison the steady offset of the earlier essay. Each is applied to a unit-RMS sine whose phase is the exact integral of its frequency, so nothing is interpolated, and its square is summed through four weights — rectangle, triangle, Hann and four-term Blackman–Harris — over NN assumed periods, with the worst over every starting phase taken.

A ramp that is right on average

The ramp comes first, because it is what a slowly drifting supply looks like over any short window: whatever the frequency is doing over minutes, over a fifth of a second it is very nearly moving in a straight line.

A frequency ramping 0.4% across the window, right on average: the triangle reads it exactly as the plain sum does, 19.9 ppm at eight periodsIntegrated over each weighted window, the worst over every starting phase. A sine whose frequency ramps linearly through the window by 0.4% of the assumed one, so that its mean period over the window is exactly the period assumed. The worst error in its root-mean-square, against the number of periods summed, for four weights. The rectangle reads it D/(8πN) wrong: 79.6 ppm at two periods, 4.97 ppm at thirty-two. The triangle lies on the rectangle's line to a few per cent at every count. The Hann window falls as the −3.05 power, 16.6 ppm at two periods and 0.0292 ppm at sixteen; Blackman–Harris is below 2.87 ppm from two. The weight that cured a steady error by its ends does nothing for a ramp, whose error is not at the ends.10p100p1n10n100n1µ10µ100µ1m10m10periods summed, Nworst error in the sine's reading (fraction)rectangle19.9 ppm at N = 8triangle19.9 ppm at N = 8Hann0.235 ppm at N = 8Blackman–Harris0.0116 ppm at N = 8every weighted window, every starta ramp, right on average
Fig. 1 The worst error in a sine’s RMS summed over N periods, its frequency ramping 0.4% across the window and right on average, against N, for four weights. The rectangle and the triangle lie on one line, 79.6 ppm at two periods falling to 4.97 ppm at thirty-two; the Hann weight falls as N−3N^{-3} from 16.6 ppm; Blackman–Harris is below 2.87 ppm from two.

With the frequency ramping by 0.4 per cent across the window, eight periods read the sine 19.9 ppm wrong through the plain sum. That is a far smaller error than the steady case gives for a comparable mistake — a steady 0.4 per cent is 0.2 per cent of error, a hundred times more — and it is not flat in the number of periods: it falls as one over NN, from 79.6 ppm at two periods to 4.97 at thirty-two. The law is exact enough to state. The plain sum reads a centred ramp of total size DD wrong by

ϵrect=D8πN,\epsilon_{\text{rect}} = \frac{D}{8\pi N},

which the figure’s line follows to a few parts in a hundred.

The triangle’s line is the rectangle’s. Not near it — on it, at every count from two to thirty-two, to the same few per cent. The weight that made a steady error second order and seventy-five times smaller does nothing whatever for a ramp. The Hann weight, by contrast, is better here than it was on the steady case: it falls as N−3.05N^{-3.05}, from 16.6 ppm at two periods to 0.235 at eight and 0.029 at sixteen. Blackman–Harris is smaller again, below 3 ppm everywhere from two periods. The slider on the figure at the head of the page moves the ramp from 0.1 to 1.6 per cent and every curve moves with it in proportion: the ramp’s error is first order in its size for every weight, the triangle included.

Where each error lives

The reason is a matter of where along the window each error is made, and it can be drawn. A frequency that differs from the assumed one puts a phase error ψ\psi on the sine, which grows as the integral of the frequency’s mistake. The weighted error is then, to first order, that phase error multiplied by the weight and integrated against the square’s own oscillation at twice the signal frequency.

A steady error lives at the window's end and a ramp's in its middle — which is where the triangle has its corner. computed by solving, not by drawing. The phase a wrong frequency puts on the sine, ψ, multiplied by each weight, across the window from its start to its end. Above, a frequency steadily wrong: ψ grows in proportion to the distance along the window, so the product ends at full height under the rectangle and at zero under every taper. Below, a frequency ramping through the window and right on average: ψ is a parabola, zero at both ends and largest in the middle. Every product here ends at zero, so the end is no longer where the error is; the rectangle's product still meets its ends at a slope, and the triangle's has a corner at the middle, where its weight peaks and the ramp's phase is largest. The Hann product is smooth everywhere. The weighted error is the product integrated against the square's own oscillation, and a smooth product integrated that way cancels; what is left is set by its ends and its corners. Each panel is scaled to its own largest value.
Fig. 2 The phase error a wrong frequency puts on the sine, times each weight, across the window. Above, a steady error: the product ends at full height under the rectangle and at zero under every taper. Below, a ramp right on average: every product ends at zero, the rectangle’s meets its ends at a slope, and the triangle’s has a corner in the middle.

An integral of a smooth function against a fast sinusoid is very nearly zero. Over each period the oscillation’s positive and negative halves see nearly the same value of the function and cancel; what survives is set by the places where the function is not smooth — its ends, where it stops abruptly, and any corner, where its slope jumps. That is the whole of the error, and the figure shows where each case keeps it.

For a steady error the phase grows in proportion to the distance along the window, so it is largest at the end. Under the rectangle the product stops at full height — a step, the most abrupt ending a function can have — and the error is large and does not fall with NN. Under every taper the product ends at zero; under the triangle it ends at zero with a slope that is itself proportional to the error, which is the second order. That is the earlier essay’s result read from the picture.

For a ramp the phase error is a parabola. The cycles are crowded at one end and spread at the other, but the total is right, so the phase error is zero at both ends and largest in the middle, where it reaches −DN/8-DN/8 of a cycle. Every product now ends at zero and the end is no longer where the error is. The rectangle’s product reaches its ends with a slope, which is a weaker discontinuity than a step and gives an error that falls as 1/N1/N. The Hann product is smooth everywhere, which is why its error falls so steeply. And the triangle’s product, which ends at zero with zero slope, has a corner in the middle: the triangle’s own peak, where its slope jumps from rising to falling, sits exactly where the ramp’s phase error is largest.

The corner and the two ends

The two discontinuities can be priced, and they come out equal. The parabola meets each end of the window at a slope of D/2D/2 — the frequency’s mistake there, half the ramp — and integrating the product against the oscillation turns each end’s slope into a term in the summed square, so the plain sum’s two ends together put D/(4π)D/(4\pi) into it. That is divided by the sum of the rectangle’s weights, NN. The triangle’s slope changes by 4/N4/N at its peak, from +2/N+2/N to −2/N-2/N, and the phase error there is −DN/8-DN/8, so the product’s slope jumps by (4/N)(DN/8)=D/2(4/N)(DN/8) = D/2 — the slope of one end, not two — and the corner puts D/(8π)D/(8\pi) into the summed square. But the triangle’s weights sum to only N/2N/2. Half the term over half the weight is the same quotient: D/(4πN)D/(4\pi N) in the mean square for both, and half that, D/(8πN)D/(8\pi N), in the root.

That is a coincidence of the shape and not a general law, and it matters to say which. The parabola’s value at its middle and its slope at its ends are tied together by its being a parabola, and the triangle’s peak happens to sit at the one point where that value is largest. A weight with its peak elsewhere, or a frequency history whose phase error peaks elsewhere, would break the tie.

The terms that do not tie are the smooth parts of each product, which contribute at the next order, 1/N21/N^2. They are why the triangle’s line departs from the rectangle’s by a few per cent at two periods and by less as NN grows.

The triangle turned over

If the two errors come from different places and only happen to be the same size, they need not have the same sign — and they do not.

Over eight periods of a ramp, the rectangle's reading swings ±19.9 ppm with the starting phase and the triangle's is the same curve upside down. Integrated over each weighted window. The error in a sine's reading over eight periods, its frequency ramping 0.4% across the window and right on average, against where in the waveform the window starts, for four weights. The rectangle swings ±19.9 ppm; the triangle draws the same curve with its sign reversed, to within 0.505 ppm at every phase; the Hann window swings ±0.235 ppm and Blackman–Harris ±0.0116 ppm. The triangle does not merely tie the rectangle's worst case: it reads the ramp as the same function of phase, turned over, because the rectangle's error comes from its two ends and the triangle's from the one corner between them.
Fig. 3 The error in a sine’s reading over eight periods, its frequency ramping 0.4% across the window, against where the window starts, for four weights. The rectangle swings ±19.9 ppm; the triangle draws the same curve with its sign reversed, to within 0.5 ppm; Hann swings ±0.235 ppm and Blackman–Harris ±0.012 ppm.

Against the window’s starting phase, the rectangle’s reading swings ±19.9 ppm and the triangle’s draws the same curve upside down, to within half a part per million at every phase. Where the plain sum reads the ramp high, the triangle reads it low by the same amount. The rectangle’s error is made at the window’s edges, a whole number of periods apart, and the triangle’s at its centre, half that number from each; on the square’s oscillation, which runs at twice the signal frequency, the centre and the edges are in step, and the two discontinuities have opposite sense — the parabola’s slope leaving zero at the ends, the triangle’s slope turning over in the middle.

The sign has a use the size does not. Half a rectangle’s reading and half a triangle’s, each normalised by its own weights, would cancel the ramp’s first-order error exactly — a tent standing on a pedestal. But that weight has full height at its ends, so it brings back the steady error’s step, and it is no cure for a drift that has both parts. It is the same reading taken from the other side, and it means that a triangle cannot be argued for on a supply that ramps: what it buys on the steady part of a drift it neither buys nor costs on the moving part, which then dominates. The Hann weight’s swing is a hundredth of either, and its phase curve has the same shape at a far smaller size.

Three histories of one excursion

A ramp is the commonest motion over a short window but not the only one. A supply hunting under a governor, or a frequency recovering after a step, can be high at both ends of a window and low in the middle, or the reverse. The fair comparison holds the size of the excursion fixed and changes its history.

A frequency never more than 0.2% off, eight periods: the triangle wins a steady error, ties a ramp and loses a bow. Integrated over each weighted window, the worst over every starting phase. The worst error in a sine's reading over eight periods for three histories of a frequency that is never more than 0.2% from the one assumed: steady at that offset, ramping from −ε to +ε, and bowing so that it is ε high at both ends and right on average. Steady: rectangle 994 ppm, triangle 1.98 ppm, Hann 3.88 ppm, Blackman–Harris 0.104 ppm. Ramp: 19.9 ppm, 19.9 ppm, 0.235 ppm, 0.0116 ppm. Bow: 1.18 ppm, 2.37 ppm, 0.0278 ppm, 0.00136 ppm — the triangle 2.01 times the plain sum's error. The Hann window is better than the plain sum on all three and Blackman–Harris better again; the triangle's ranking depends on which history the frequency had. Log scale.
Fig. 4 The worst error over eight periods for a frequency never more than 0.2% from the one assumed, in three histories: steady at the offset, ramping from −0.2% to +0.2%, and bowing so that it is 0.2% high at both ends and right on average. The triangle is 500 times better than the plain sum on the steady case, equal on the ramp, and 2.01 times worse on the bow.

With the frequency never more than 0.2 per cent from the assumed one and eight periods summed, the three histories rank the weights three different ways. Held steady at the offset, the plain sum reads the sine 994 ppm wrong and the triangle 1.98 ppm, five hundred times better. Ramped from one side of the assumed frequency to the other, both read it 19.9 ppm wrong. Bowed — high at both ends, low in the middle, right on average — the plain sum reads it 1.18 ppm wrong and the triangle 2.37 ppm: the triangle doubles the error of using no weight at all.

The Hann weight is better than the plain sum on all three, at 3.88, 0.235 and 0.028 ppm, and Blackman–Harris is better than the Hann weight on all three. Neither of the smooth tapers has a history on which it loses to the rectangle. The triangle’s ranking depends entirely on which history the frequency happened to have during the window, which no converter knows in advance.

Why the bow favours the plain sum

The bow is the one history on which the rectangle does unusually well, and the reason is the same picture. A frequency that is equally high at both ends gives a phase error that meets both ends of the window at the same slope, in the same direction. The rectangle’s two end contributions, which for the ramp added, now cancel: one is the slope arriving, the other the slope leaving, and with equal slopes they are equal and opposite. What remains of the plain sum’s error is the next order, falling as 1/N21/N^2, which is why it is so small.

The triangle has no ends to cancel, because its product starts and finishes at zero with zero slope. Its corner sits in the middle, where the bow’s phase error happens to pass through zero, so the corner contributes nothing either. What is left for the triangle is the second-order term from the curvature of its product, which is the same order as the rectangle’s residue and happens to be twice the size. A rectangle that has its errors cancel between its two ends beats a triangle that has no first-order error to cancel.

The practical reading is that the triangle’s virtue was always about one thing: a steady error, whose phase grows to its largest exactly where the triangle’s weight goes to zero. Every motion about the mean puts its phase error somewhere else, and the triangle’s corner is a liability wherever that is.

A converter one window behind

A converter that expects its period to drift does not leave it fixed; it measures it. The simplest arrangement takes as the period for each window the mean period it measured over the window before. On a frequency ramping at a steady rate that converter is always one window behind: its assumed period is wrong by the change over one window, and the frequency also ramps by the same amount across the window being summed. Both parts of the drift are then present at once, and both grow with the window.

A converter one window behind a frequency ramping 4×10⁻⁵ a period: the plain sum gets worse with N, the triangle stops at a floor, the Hann window keeps falling. Integrated over each weighted window, the worst over every starting phase. A converter that takes as its period the mean period it measured over the window before, reading a sine whose frequency ramps steadily by 0.00004 of itself every period. It is then one window behind — the period it assumes is wrong by rN on average — and the frequency also ramps by rN across the window it is summing. The plain sum reads it rN/2 wrong, so a longer window is worse: 40 ppm at two periods, 632 ppm at thirty-two. The triangle's steady error is second order and negligible, and its ramp error is D/(8πN) with D = rN, so it sits on a floor of r/(8π), 1.59 ppm, at every window. The Hann window falls as the −1.02 power and passes under that floor at 4 periods; Blackman–Harris is below 0.0937 ppm throughout.
Fig. 5 A converter taking its period from the window before, reading a sine whose frequency ramps by 4×10⁻⁵ of itself every period. The plain sum’s error grows with the window, 40 ppm at two periods and 632 at thirty-two; the triangle sits on a floor of 1.59 ppm at every window; the Hann weight falls as 1/N and passes under that floor at four periods.

With the frequency ramping by r=4×10−5r = 4\times10^{-5} of itself every period, the plain sum reads the sine rN/2rN/2 wrong — 40 ppm at two periods, 160 at eight, 632 at thirty-two — and a longer window is worse, because the converter falls further behind. The steady part of the error is the earlier essay’s δ/2\delta/2 with δ=rN\delta = rN, and it overwhelms the ramp’s.

The triangle disposes of the steady part, since its error there is second order and tiny, and is left with the ramp’s, D/(8πN)D/(8\pi N) with D=rND = rN. The window cancels: the triangle sits on a floor of

ϵtri=r8π=1.59 ppm,\epsilon_{\text{tri}} = \frac{r}{8\pi} = 1.59\ \text{ppm},

the same at two periods as at sixteen. The Hann weight’s steady error falls as the inverse square of the window and grows as δ=rN\delta = rN, so its total falls as 1/N1/N — fitted, −1.02-1.02 — from 2.67 ppm at two periods to 0.626 at eight. It passes under the triangle’s floor at four periods and keeps going. Blackman–Harris is below 0.1 ppm everywhere.

The floor that belongs to the rate

That floor is worth a moment, because it is an unusual kind of result. It contains no window length and no weight parameter: a tracking converter with a triangular weight reads a steadily drifting sine wrong by r/(8π)r/(8\pi) whatever it does, and the only way below it is to change the weight. It is the same shape of statement as the plain sum’s δ/2\delta/2 in the cycle a converter has to know, which also contained no window length and was also removable only by changing what the window does at its ends — here, at its middle.

At other rates every curve moves in proportion to the rate, except at the longest windows, where the plain sum’s rN/2rN/2 grows large enough that the sliver reaches a sizeable part of a period and its error stops growing: at ten times the rate it is 0.30 per cent at sixteen periods and 0.13 at thirty-two, where proportion would have made it 0.63. The triangle’s floor moves exactly with the rate.

The grid, worked

A frequency that wanders measured an oscillator whose frequency walks randomly; a grid’s frequency mostly does the opposite over a reading, moving smoothly in one direction. A rate of change of frequency of 0.1 Hz per second is ordinary on a large interconnected grid during a disturbance, and 1 Hz per second is the figure protection relays are set against on smaller systems. At 50 Hz a period is 20 ms, so 0.1 Hz per second is a change of 0.002 Hz per period, or 4×10−54\times10^{-5} of the frequency: the default rate on the figure.

A tracking converter summing ten periods — a fifth of a second, a common choice — reads the waveform about 200 ppm wrong through a plain sum, 1.6 ppm through a triangle and half a part per million through a Hann weight. At ten times the rate the plain sum is two parts in a thousand wrong and the triangle 16 ppm; the Hann weight is around 6 ppm at eight periods. For a revenue meter whose class is half a per cent none of these matters, and the waveform-shape errors that what a meter multiplies by found in an averaging meter are larger by orders. For a calibrator or a power analyser quoting a few parts per million it decides the weight: the triangle’s floor is above the instrument’s own resolution at the higher rate, and the Hann weight’s error is not.

A meter that does not track at all, and assumes the nominal 20 ms, sees the drift as a steady error that grows over seconds; that is the earlier essay’s case, where the triangle wins while the offset is small. A designer choosing a weight for a converter that tracks should therefore prefer the Hann weight, and one choosing for a converter that does not should prefer the triangle only if the frequency is known never to ramp while a reading is taken — which is rarely a promise anybody can make.

What a designer should take

Split a drifting frequency into its mean over the window and its motion about that mean, and price them separately. The mean is the steady error, δ/2\delta/2 through a plain sum and second order through a triangle. The motion is a first-order error for every weight here, D/(8πN)D/(8\pi N) through the plain sum for a ramp of size DD.

Do not choose the triangle for a ramp. It reads a ramp as the plain sum does, with the sign reversed, and a bow twice as badly. Its advantage is real only on the steady part, and a converter that tracks its period has very little steady part left.

Choose a smooth taper when the frequency moves. The Hann weight’s ramp error falls as the cube of the window, and on a tracking converter its total error falls as one over the window while the triangle’s stops at r/(8π)r/(8\pi). Its price, as before, is noise: a reading of a noisy signal through a Hann weight scatters 1.5\sqrt{1.5} times as widely as through the plain sum, which the order of the null, not the number of them priced for cascaded means in the same currency, and which the filter an average is reads as the width of the weight’s own transform.

How the drift was put into the window

Each sine has unit root-mean-square, so its square is 1−cos⁡2ϕ1 - \cos 2\phi with the phase ϕ\phi the exact integral of the frequency’s history across the window — a quadratic for a ramp and a cubic for a bow — and nothing is interpolated between samples. The weighted mean square is integrated by the midpoint rule at four hundred points an assumed period, compared with the true mean square of one, and the worst is taken over seventy-two starting phases (forty-eight for the tracking converter, at two hundred points a period). Slopes are least-squares fits of the logarithms. Each history is scaled so that its mean frequency over the window is exactly the stated one: a ramp is linear about the mean, a bow a parabola with zero mean. The equality of the rectangle’s and triangle’s ramp errors, the D/(8πN)D/(8\pi N) law and the r/(8π)r/(8\pi) floor are each checked against the integration to a few per cent rather than read off the curves.

What it leaves out

Noise and signal together. Every reading here is a clean sine. A sine plus noise pays the weight’s noise bandwidth on the noise and its period error on the sine, and the signal-to-noise ratio at which the Hann weight’s extra scatter outweighs what it saves on a drift is unmeasured — the noise a true-RMS meter reads low and the bandwidth a bin is not have the two halves of the arithmetic.

Waveforms other than a sine. A distorted waveform’s square has lines at every harmonic, and a drift moves each by a different amount. The ramp’s D/(8πN)D/(8\pi N) comes from the square’s single line at twice the frequency; a current with a large third harmonic would add a term at six times, with a smaller coefficient, and the ranking should survive, but it has not been drawn.

Faster motion. Every history here is smooth over the window. A frequency that steps inside a window — after a load is switched, or a generator trips — has a phase error with a corner of its own wherever the step happens, and the weight’s value at that instant would decide the error. That is closer to the averager problem than to this one.

Still open: the weight that follows the period, the step inside the window, and the noise that decides it

A weight stretched to the measured period. A converter that measures each period as it goes can place its weight on the cycles it actually sees rather than on assumed ones, so that the window holds a whole number of true periods and its zeros stay on the square’s lines. On a ramp that removes the steady part exactly; whether it also removes the motion, and what the period measurement’s own noise costs it, would say whether tracking inside the window is worth more than tracking between windows.

A step inside the window. A frequency that jumps partway through a reading gives a phase error with a corner where the jump falls. Under a smooth weight that corner is weighted by the weight’s value there, so the error depends on where in the window the step lands; the worst place, and how much a taper reduces it compared with the plain sum, is a measurement on the same integration.

Where noise overtakes the drift. Through a Hann weight the drift’s error is a few tenths of a part per million and the noise’s scatter is 22 per cent larger than the plain sum’s. On a waveform with a stated signal-to-noise ratio there is a window length at which the two are equal, and below it the plain sum, with its larger drift error and smaller scatter, is the better converter. Finding that length would put the choice of weight on a single number for a given supply.

Part 6 on rms and average

One argument about Rms and average, and one of 6 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

AveragingMeasurement errorModel rangeSample rateTrue-rms