At last, we reach the finale of this series covering signal processing in the density domain and how it is a powerful tool for implementing a variety of linear and nonlinear functions cheaper than using traditional methods (see http://electronicdesign.com/author/2016/DaveVanEss.aspx).
The first four parts explained the benefits of signal density processing and the different types of modulators and filters, both analog and digital. In review, a modulator converts an analog or digital signal into a density stream, while a filter converts a digital stream into an analog or digital signal.
Density is a logic level single bit stream. The density is the percentage that the digital stream is high. Given a density value (d) and logic high and low reference values (RefHigh and RefLow), it is possible to determine the value it represents using:
So now on to some interesting circuits.
Addition And Subtraction
Density signals can be added by multiplexing two input streams into a single output stream (see “Signal Processing In The Density Domain (Part II)” at www.electronicdesign.com). While not exactly addition as in (A + B), it is an average: ½(A + B). This factor of two guarantees that the density value stays within its 0% to 100% range (Fig. 1).
Stereo audio signals often are sent as the sum and difference of the left and right channels. This allows for a monophonic system by only using the “sum” channel. The top multiplexer is used to average the two streams, resulting in only the left channel: (½(L + R) + ½(L – R) = L). The bottom multiplexer has its “difference” density input inverted. This inversion causes a polarity flip.
When these two streams are averaged, the resulting density is only the right channel: (½(L + R) + –½(L – R) = R). This technique works best if each modulator is clocked at the sample rate (fs) and the multipliers operate at double this sample rate (2fs).
This example uses density filters, making this system a dual analog-to-digital converter (ADC) channel separator. Analog filters could have been used instead to make an analog channel separator block. Density addition can be used to add signals together and remove an unwanted offset error.
Density signals with bipolar reference values (RefHigh = –RefLow) can be multiplied by mixing the two density streams with an XNOR gate (see “Part II,” again). Figure 2 shows an example of density multiplication via an inexpensive white goods power meter.
Power conservation has become an important value to consumers, especially when they can know a product’s actual power consumption. For this design, the digital filter is a single-order SINC filter with a 10-sample/s output rate. This effectively averages six waves of 60-Hz power or five waves of 50-Hz power. (For more on SINC filters, see “Signal Processing In The Density Domain (Part IV)” at www.electronicdesign.com.)
The mains voltage and current are conditioned to have an acceptable range to the modulators. When the voltage input is fed into both modulators, the filter outputs the mean of the voltage squared. When the current input is fed into both modulators, the filter outputs the mean of the current squared. When the voltage input is fed into one modulator and the current input is fed into the other, the filter outputs the average power.
It is important that the two modulators are operated at different frequencies or are different types, such as pulse-width modulation (PWM) and delta-sigma modulation (DSM). If the same signal is fed into two exact modulators, both outputs would always be high or low and the XNOR product would always be high. Figure 3 shows a simulation of this system.
The inputs for this system have been normalized to have a ±1 input. Looking at the inputs, it is apparent that the voltage leads the current and that this is a very inductive load. (Remember ELI the ICE man! Voltage leads current for an inductor while current leads voltage for a capacitor.)
The voltage is 90% of full scale while the current is only 60%. Current has the greater resolution requirement with normal operation being from 100 mA to 10 A. The voltage rarely fluctuates more the 10% from its standard value.
Note that the voltage density is mostly high at the voltage peak, mostly low at the valley, and 50% at the zero crossing. The voltage squared density is mostly high at both the peak and valley. This should give you a clue that the squaring was done correctly. The current densities have the same relationships.
Filtering the data results in the mean voltage squared value being 0.405 with a calculated rms value of 0.636 (0.9/√2). The mean current squared value is 0.180 with a calculated rms value of 0.424. The apparent power (VRMS · IRMS) calculates out to 0.270. Filtering the mean (actual) power data results in a value of 0.234.
This makes for an 87% power factor (PF = real power/apparent power) and 30° phase angle (cos–1(PF)). The data confirms there is a 30° phase difference. However, this does not tell you if it is a capacitive or inductive load, which is best determined with synchronous detection.
Synchronous detection is used to measure the amplitude of a signal as well as its phase referenced to another signal of the same frequency. “Synchronous Detection Plays A Role In Better Analog Design,” available at www.electronicdesign.com, discusses this concept in detail.
This function exploits the fact that a single-order delta signal modulator’s density stream has the highest possible frequency possible. It is:
For a positive input (density ≥50%), the output is guaranteed to only be low for a single sample at a time, and for a negative input the output is guaranteed to only be high for a single sample at a time.
For a modulator with an input normalized to ±1, an input of 0.5 will generate a density stream having a density of 75% consisting of a periodic stream of a single low followed by three highs. Conversely, an input of –0.5 will have a density of 25% consisting of a periodic stream of a single high followed by three lows. In both cases, the frequency of these streams will be one-quarter of the modulator sample clock.
Measuring the frequency of the modulator’s density stream, relative to its sample clock, will tell you the input signal’s amplitude, just not its polarity. Measuring the frequency of a modulator density stream of the positive half of a sinusoid, then, will have the same frequency as measuring it over the negative half.
The important parameter now is the output frequency relative to the sample clock (fOut/fs). Equation 3 shows the absolute value as a function of this relative frequency.
As a result, measuring the relative frequency over a defined time provides you with the average of the absolute value of the input signal. An alternative to measuring the frequency is to build a simple digital function to perform this rectification. For absolute value, design a function with an output that’s low only when the output of the modulator is low and the previous modulator output was high.
Conversely, for negative absolute value, design a function with an output that is high only when the output of the modulator is low and previous modulator output was high. Either of these filters can be built with a couple of flip-flops and a bit of logic.
Figure 4 shows that an absolute value function can be achieved by measuring the relative frequency or by rectifying and measuring density. Figure 5 shows the data obtained from this system simulation.
The inputs for this system have been normalized to have a ±1 input. The input is a full-scale sinusoid. Its density has the typical peak valley characteristics shown earlier. This should start looking familiar.
Examination of the density shows that there are 93 raising edges over 512 clock samples for a relative frequency (fOut/fs) of 18.16%. Knowing the relative frequency, the absolute value (1 – 2fOut/fs) is 0.637, which is 2/π, the average value for a rectified sinusoid.
The ABS function’s density is mostly high at both the input’s peak and valley and never goes below 50%. When filtered, the measured density is 81.84% and its calculated value (2d – 1) is 0.637.
The –ABS function’s density is mostly low at both the input’s peak and valley and never goes above than 50%. When filtered, the measured density is 18.16% and its calculated value is –0.637. If an analog filter is used instead of a digital filter, you can construct an absolute value analog block.
Signal processing in the density domain allows for the standard linear functions but also some nonlinear ones. For example, mix a density stream with a delayed copy of itself and you have frequency shift key (FSK) demodulation. An analog absolute value block and analog square block, coupled with an op amp, can be used to make a square-root block. Reconfigure it a bit and you have an A/B analog block.
These are just a few examples of what is possible with density domain signal processing. The possibilities are endless once you start to think in the density domain. You may not yet be comfortable working with these concepts, but with practice they can be powerful tools to help you develop new design implementations. Like any tool, however, it takes time and effort to master but the results can be impressive. I look forward to seeing what interesting applications you create.