An Executive Guide to Magic Sinewaves

An Executive Guide to Magic Sinewaves

Loading
Loading Social Plug-ins...
Language: English
Save to myLibrary Download PDF
Go to Page # Page of 9
 
Author: Don Lancaster (Fellow) | Visits: 2998 | Page Views: 3025
Domain:  High Tech Category: IT Subcategory: Energy efficiency 
Upload Date:
Short URL: https://www.wesrch.com/electronics/pdfEL11TZUFUXJDF
Loading
Loading...



px *        px *

* Default width and height in pixels. Change it to your required dimensions.

 
Contents:
Magic Sinewaves: An Executive Summary
Don Lancaster Synergetics, Box 809, Thatcher, AZ 85552 copyright c2006 as GuruGram #65. http://www.tinaja.com don@tinaja.com (928) 428-4073

igitally derived power sinewaves are crucial to solar synchronous pv inverters, industrial motor drives, power quality conditioners, and hybrid vehicles. Major goals of such digital sinewave generation including offering the maximum possible efficiency by using the fewest of simplest possible switching transitions; offering the lowest possible distortion by zeroing out a maximum number of low harmonics that impact power quality, whine, vibration, and circulating currents; and by using all digital techniques that are extremely low end microprocessor and/or microcontroller friendly. Some recent and highly unexpected solutions to a new class of mathematical functions have led to a group of magic sinewaves that have the remarkable property of using the fewest possible number of energy-robbing switching transitions to precisely zero out the maximum possible number of low order harmonics. All in an all-digital and highly microcomputer manner. Key advantages of magic sinewaves include...
� ANY chosen number of low harmonics can in theory be forced to zero. Or, under real-world quantization, can get reduced to astonishing low (-65db or less) levels. � The ABSOLUTE MINIMUM number of efficiency-robbing switching transitions are needed to force the MAXIMUM number of zeroed low harmonics. � Switching losses are further reduced by HALF-BRIDGE, rather than full bridge switching. � Variations can provide full THREE PHASE COMPATIBILITY while still zeroing a useful number of low harmonics. � Implementation is TOTALLY DIGITAL and fully compatible with economical low-end microprocessors. � Modest storage needs combine with PRECISE CONTROL of both amplitude and frequency.

D

-- 65 . 1 --

And here are the present magic sinewave limitations...
� As with any digital sinewave generation, filtering is required to separate the sharp edge artifacts from the fundamental. Such artifacts are remarkably high in frequency in a typical magic sinewave implementation. � The first two UNCONTROLLED harmonics can be quite large but NEVER exceed the fundamental amplitude. � Present implementations limit magic sinewaves to power line frequencies, possibly up to 400 Hertz. � While a wide frequency range can be accommodated, the response does NOT extend down to dc. � Unusual programming techniques are required as each and every microprocessor clock cycle is critical. As many as 44,000 or more microprocessor instructions may be needed per power line cycle. � Present implementations best separate the frequency setting from the actual magic sinewave generation.

In some implementations, each pulse edge zeros one odd harmonic, and thus guarantees the minimum switching energy losses for the maximum number of zeroed harmonics. While many hundreds (or even many thousands) of harmonics may be zeroed, an ever increasing number of pulse edges is required to do so. With a corresponding drop in efficiency and program complexity. Evaluiation devices currently under development zero out all harmonics up to the 44th.

Magic Sinewave Appearance
Here is what a typical seven pulse per quadrant magic sinewave might look like...

This can be viewed as a highly specialized form of PWM pulse width modulation. One that has far fewer transitions than normal for significantly higher switching
-- 65 . 2 --

efficiency. And one that uses half bridge rather than full bridge switching for a further 2X efficiency gain. For n pulses per quadrant, we can see a 4n carrier that is precisely phase locked to an initial zero phase reference. The carrier is further 100 percent modulated in that a zero amplitude results in a zero pulse width. As the output amplitude increases, the individual pulses also increase in an exacting and highly specific (but not quite proportional) manner. This "magic" waveform has two rather remarkable properties...
� The first non zero harmonic is at a frequency of 4n + 1. ALL INTERMEDIATE HARMONICS ARE ZERO. � Most pulse edges (indirectly) zero an odd harmonic. GIVING THE HIGHEST POSSIBLE SWITCHING EFFICIENCY.

In this waveform, there will be no even harmonics because of symmetry considerations. Most pulse edge can be thought of as zeroing out one odd harmonic. For seven pulses per quadrant, there are thirteen pulse edges that (working in concert) zero out harmonics 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, and 27. Plus a final pulse edge that indirectly (and again working in concert) sets the fundamental amplitude. Real world quantizations will increase the true zero harmonics to very low values. For 8-bit compatible systems, the intermediate harmonics can normally all remain well below -65 decibels compared to the fundamental. Here is a typical pre-quantized spectrum...
1.0 0.8 ( best efficiency n = 28 a = 0.97 )

AMPLITUDE

0.6 0.4 0.2 0.0 11 13 15 17 19 21 23 25 27 29 31 33 35 1 3 5 7 9

All Intermediate Harmonics are ZERO!!!

HARMONIC NUMBER

For n pulses per quadrant, all intermediate harmonics up to 4n are zero. The first two uncontrolled harmonics are fairly large and must be suitably filtered.
-- 65 . 3 --

These first two significant harmonics range upward from approximately one-third the fundamental near unity amplitude. On down to nearly matching the amplitude height for near zero fundamental amplitudes. Unlike conventional PWM, the undesirable frequencies never exceed the sought after fundamental. Proper system design will require low pass filtering of these higher order harmonics. Compared to other digital sinewave generation methods, these unwanted harmonics are quite high in frequency and thus should be fairly easy to deal with. As before, real world quantization will increase the zero intermediate odd harmonics to finite but acceptably low real values.

Magic Sinewave Math
An understanding of Fourier Series is essential to grasp the Magic Sinewave concept. The classic Fourier Series works well for analysis and avoids windowing and similar problems associated with newer FFT Fast Fourier methods. Classic analysis is acceptably fast for harmonic zeroing well into the hundreds. Any single pulse will make this Fourier contribution...

cos (1*p1s) - cos (1*p1e) = ampl * pi/4
And its harmonic j contribution will be...

cos (j*p1s) - cos (j*p1e) = ampl * pi/4j
From which we can write the Magic Sinewave Equations needed for a seven pulse per quadrant, twenty eight pulse total waveform...

cos ( 1*p1s ) - cos ( 1*p1e ) + ... + cos ( 1*p7s ) - cos ( 1*p7e ) = ampl * pi/4 cos ( 3*p1s ) - cos ( 3*p1e ) + ... + cos ( 3*p7s ) - cos ( 3*p7e ) = 0 cos ( 5*p1s ) - cos ( 5*p1e ) + ... + cos ( 5*p7s ) - cos ( 5*p7e ) = 0 cos ( 7*p1s ) - cos ( 7*p1e ) + ... + cos ( 7*p7s ) - cos ( 7*p7e ) = 0 cos ( 9*p1s ) - cos ( 9*p1e ) + ... + cos ( 9*p7s ) - cos ( 9*p7e ) = 0 cos (11*p1s) - cos (11*p1e) + ... + cos (11*p7s) - cos (11*p7e) = 0 cos (13*p1s) - cos (13*p1e) + ... + cos (13*p7s) - cos (13*p7e) = 0 cos (15*p1s) - cos (15*p1e) + ... + cos (15*p7s) - cos (15*p7e) = 0 cos (17*p1s) - cos (17*p1e) + ... + cos (17*p7s) - cos (17*p7e) = 0 cos (19*p1s) - cos (19*p1e) + ... + cos (19*p7s) - cos (19*p7e) = 0 cos (21*p1s) - cos (21*p1e) + ... + cos (21*p7s) - cos (21*p7e) = 0 cos (23*p1s) - cos (23*p1e) + ... + cos (23*p7s) - cos (23*p7e) = 0 cos (25*p1s) - cos (25*p1e) + ... + cos (25*p7s) - cos (25*p7e) = 0 cos (27*p1s) - cos (27*p1e) + ... + cos (27*p7s) - cos (27*p7e) = 0

-- 65 . 4 --

At first glance, these equations seem daunting, but they really are just requesting a desired fundamental combined with forced zeroing of the first 28 harmonics. Until some recent considerable serendipity requiring exceptionally tedious brute force methods ( involving over a decade of research ), there was not the slightest hint that any solutions at all existed for the above equations. Let alone ones highly useful for power quality and energy efficiency. Hence the believed uniqueness and originality of the Magic Sinewave approach. I presently believe that no closed form method of solving the above equations is currently known. Nor is any likely to even exist. Instead, an iterative standard tool related to Newton's Method can be used. One that otherwise is crudely known as "shake the box". Solution proceeds by making a good guess as to the desired result and then by slightly moving one pulse edge to seek minimum total energy in odd harmonics 3-27. Additional pulse edges are then slightly moved, again seeking minimums. The process is repeated with progressively smaller edge adjustments until some acceptable results are found. A "good guess" can be based on scaling a previously obtained nearby amplitude result. Because of the iterations, achieving forced zeros of all harmonics may leave a minor amplitude error. This is corrected by slightly adjusting your requested amplitude and recalculating. For instance, if you are after amplitude 0.400 and get a 0.396 result, you next ask for amplitude 0.404. This process normally rapidly converges. The above equations can be shown to be related to Chebycheff Polynomials. Further analysis of which leads to some profoundly "bare metal" power equations. But, sadly, does not seem to simplify the iterative calculations needed for solution. These fundamental power equations very strongly suggest that...
No simple closed form solution to Magic Sinewave equations is likely to exist. No more efficient solution is likely to exist for a given number of zeroed low harmonics.

Other sets of Magic Sinewave equations lead to different solutions. Our above equations are an example of Best Efficiency magic sinewaves. Another solution set of interest leads to three phase compatible or "delta friendly" magic sinewaves. These meet some exacting needs of three phase power systems while still zeroing out a respectable number of low harmonics. These delta friendly versions also have advantages of requiring less memory storage and calculating significantly faster.
-- 65 . 5 --

A group of highly sophisticated JavaScript Magic Sinewave calculators are now available and have been posted to http://www.tinaja.com/magsn01.asp With solutions presently offered as high as 384 zeroed low harmonics. A solution set for the above equations would be...

Pulse Positions in Degrees p1s: p1e: p2s: p2e: p3s: p3e: p4s: p4e: p5s: p5e: p6s: p6e: p7s: p7e:

Target Amplitude: 0.970000000 Target Power: 0.9409 Fundamental Amplitude: THD 2-28 h03: h05: h07: h09: h11: h13: h15: h17: h19: h21: h23: h25:

10.24045703622 12.37453450377 20.53940226898 24.75285471101 30.95837849073 37.14383081926 41.56706542527 49.57368364472 52.45588082770 62.12795009229 63.77803849250 75.13315213749 75.93480958918 89.76625289081

0.97000000
percent.

is 0.00000006128 h27: h29: h31: h33: h35: h37: h39: h41: h43: h45: h47: h49:

0.000000000070 -0.00000000013 -0.00000000011 -0.00000000022 0.00000000044 -0.00000000024 -0.00000000002 -0.00000000022 -0.00000000021 -0.00000000004 -0.00000000032 -0.00000000014

-0.00000000009 -0.28097991216 -0.15202976905 0.20474366480 0.17750740386 0.04412815271 0.00660309293 -0.00078946014 0.00211106203 -0.00342276346 0.00562585661 -0.00924395093

The slight nonzero residues shown are caused by seeking out a solution that is only eight decimal places deep. Additional calculation depth should yield true zero distortion results.

Real-World Quantization
It is important to note that extreme precision is required in both the analysis and generation of magic sinewaves. As noted above, even restricting analysis to eight decimal places will produce some minor non-zero errors. This problem is severely compounded when translated to many real-world devices using 8-bit microprocessors. Primarily due to quantization or roundoff errors.

-- 65 . 6 --

Time delays and pulse widths accurate to around twelve bits appear to be needed to guarantee "zero" harmonic rejection values that are -65 decibels or more below the fundamental. Some sneaky tricks are required to produce this precision level in an 8-bit microprocessor environment. For instance, it is possible to split a time delay into two elements. A calculated component that is proportional to amplitude and a residue component that can be found through table lookup. Depending upon specific need, the calculated component might be directly or inversely proportional to amplitude and may or may not be threshold truncated. The net result is one method of obtaining 12-bit precision in an 8-bit environment. The time resolution of the microcomputer also causes quantizations. As a result, very high clocking frequencies will usually be involved. A 60 Hertz power sinewave might require an instruction rate of 2.5 megahertz and something around 42,000 executed instructions per power line cycle. In the case of a PIC or similar microprocessor with a 4X clock, about a ten megahertz clock frequency may be needed for a 60 Hertz sinewave. For this reason, magic sinewaves are often limited to power line and low audio frequencies. A further quantization improvement in precision can result from selecting some
nearby magic sinewave, rather than a supposedly optimal one. This is possible because quantization tends to produce a dripping stalactite type of result. By

investigating a few hundred thousand or more nearby magic sinewaves per amplitude, one or more results can typically be found that are often two to ten decibels lower in harmonic distortion than the initial cut. Here is a "group portrait" that shows this effect...
0.15 % distortion 2-22 0.10 % 0.05 % 0.00 % 0.52 0.53 amplitude 0.54

Firmware Considerations
While low end applications pretty much demand a PIC or similar microprocessor, use of wider bus devices or even DSP digital signal processing techniques may prove of advantage for higher end development. Because of the exacting requirements of Magic Sinewaves, some ultra precise and non-mainstream programming techniques will usually prove of value. Timing and precision requirements can often end up unusually strict.
-- 65 . 7 --

Before firmware development can even begin, four time intensive tasks are required. First, each and every desired amplitude needs carefully analyzed using the JavaScript Calculators and generating a list of pulse positions and widths. Suitable calculators are available at http://www.tinaja.com/magsn01.asp. Second, several tens of thousands to several hundred thousand "nearby" solutions should be explored by intentional jitter techniques. This will typically result in candidate amplitudes that have reduced distortion of two to ten decibels. It is very important to keep frequency and amplitude independent during the exploration of alternatives. Third, the frequency and amplitude values should be sent to a Fourier Analysis software simulation program that can verify that each and every amplitude does in fact offer acceptable low intermediate harmonics. Finally, the verified values need converted into combinations of calculated ramps and residue delay values. Only after these tasks are complete can the actual programming begin. Firmware guidelines have been published as http://www.tinaja.com/glib/mspicpro.pdf. Generation of magic sinewaves seems simple enough as all that is involved is repeatedly outputting port patterns followed by precision delays. Our first guideline is by far the most crucial...
Magic Sinewave timing must be exceptionally precise and perfectly equalized for useful low harmonic rejection!

Each and every path through the code must take precisely the specified amount of time. No more, no less. Thus, some highly unusual programming skills and techniques will almost certainly be required. For instance, it appears best to outsource the actual frequency generation, by varying the microprocessor clock at some high multiple of the desired power line output frequency. Use of "bare metal" machine language programming is almost certainly a must. Compiling from a higher level language is virtually certain to cause timing and jitter problems. As we have already seen, there are various tricks that can be used to allow an 8-bit microprocessor to provide 12-bit accuracy. Some of which involve splitting time delays into two or more tasks. The luxury of extensive subroutines may not be permitted at code "pinch points". Thus linear coding will often be the most appropriate solution. Time shifting or "pipelining" of certain routines may be required to fit the available intervals. As might precaching of certain data values. Here is an example of an earlier three phase magic sinewave generator...
-- 65 . 8 --

10 MHz per 60 Hz input clock ref Delta "A" complement step down ~ OR ~ 0-100 amp bit 0 step up ~ OR ~ 0-100 amp bit 1 slew down ~ OR ~ 0-100 amp bit 2 slew up ~ OR ~ 0-100 amp bit 3 high ~ OR ~ 0-100 amp bit 4 high ~ OR ~ 0-100 amp bit 5 high ~ OR ~ 0-100 amp bit 6
18 17 16 15

+5V
NC
14 13 12 11 10

Delta "B" complement Delta "C" complement Delta "A" true output Delta "B" true output Delta "C" true output Zero degrees sync

IN1 IN0 XIN IN6 +5V DA DB DC NC

MS28D-05X
IN2 IN3 IN4 IN5 GND DA DB DC SYNC
1 2 3 4 5 6 7 8 9

This was an earlier prototype delta friendly design. It has been simulation verified and is presently still undergoing full speed bench verification tests and real-world harmonic analysis. The thinking was to provide a dual mode input capability. There are seven binary input lines. Inputs that are coded 0 through 100 will immediately cause the chip to output that amplitude. By holding the three most significant input bits high, the device converts into four pushbutton operation of step down, step up, slew down, and slew up. While this design easily fits a 2K memory space, use of 4K or 8K devices are more appropriate for higher harmonic rejection needs. In general, a best efficiency magic sinewave needs 2n 8-bit values stored per amplitude, while a delta friendly needs only n. Where n is the number of pulses per quadrant. The majority of space in typical magic sinewave firmware is taken up by the amplitude table lookups. While a hundred linear spaced amplitudes (plus zero) are the norm, any reasonable number of amplitudes can be provided. Amplitudes can also be constant power, nonlinear for load compensation and equalization, or even random for candle and flame effects.
Magic sinewaves are also possible on extremely small microcontrollers provided

only a very few amplitudes are required.

For Additional Assistance
Visit the many Magic Sinewave files at http://www.tinaja.com/magsn01.asp. Or else email don@tinaja.com. Or call (928) 428-4073.

-- 65 . 9 --