Class SLNoiseStats.TSLNoiseStats
(Automated Syncronization with Documentation) |
(Automated Syncronization with Documentation) |
||
Line 67: | Line 67: | ||
exclude a single bin adjacent left and adjacent right of the | exclude a single bin adjacent left and adjacent right of the | ||
first harmonic, inside the event handler use code such as: | first harmonic, inside the event handler use code such as: | ||
+ | |||
+ | |||
+ | |||
+ | <b>Diagram:</b> | ||
+ | |||
+ | [[Image:SLNoiseStats_Preview.png]] | ||
Line 105: | Line 111: | ||
in the FFT output spectrum by setting them to the average | in the FFT output spectrum by setting them to the average | ||
amplitude of the signal. | amplitude of the signal. | ||
+ | |||
+ | |||
Note | Note | ||
This change has effect only for statistic calculations that | This change has effect only for statistic calculations that | ||
Line 113: | Line 121: | ||
=== Published === | === Published === | ||
+ | *[[Property SLNoiseStats.TSLNoiseStats.Normalization|Normalization]] - The normalization type for the FFT operation. | ||
*[[Property SLNoiseStats.TSLNoiseStats.BinMask|BinMask]] - Array of Count integers holding the values of bins to be masked from statistic calculations. | *[[Property SLNoiseStats.TSLNoiseStats.BinMask|BinMask]] - Array of Count integers holding the values of bins to be masked from statistic calculations. | ||
*[[Property SLNoiseStats.TSLNoiseStats.MinDataVal|MinDataVal]] - The minimal value expected in the data stream. | *[[Property SLNoiseStats.TSLNoiseStats.MinDataVal|MinDataVal]] - The minimal value expected in the data stream. |
Revision as of 20:30, 10 June 2013
This is a Beta Read Only version of this page. Please review and send recommendations to mitov@mitov.com. We will enable the editing as soon as we are happy with the overall Wiki site.
Package: SignalLabPkg
Unit: SLNoiseStats
Inherits: TSLFourierBase
Contents |
Syntax
Delphi:
type TSLNoiseStats = class( TSLFourierBase )
C++ Builder:
class TSLNoiseStats : public TSLFourierBase
Visual C++ (MFC):
class CTSLNoiseStats : public CTSLFourierBase
C# (.NET):
public ref class TSLNoiseStats : Mitov.SignalLab.FourierBase
Summary
Calculates the noise stats of a signal.
Description
TSLNoiseStats is a component that accepts either a real or complex input data stream containing a single fundamental frequency within a noisy signal, and analyzes the stream in order to calculate a number of useful statistics, including Signal-to-Noise ratio (SNR), Total Harmonic Distortion (THD), and Signal-to-Noise-and-Distortion (SINAD). The component achieves these calculations with the following sequential steps: 1) The input signal is normalized and an initial FFT is performed, 2) the fundamental frequency and its harmonics are located within the FFT output spectrum, 3) the various statistics are calculated, 4) a TSLNoiseStatsNotifyEvent is generated to supply the calculated statistics (in the form of a TSLNoiseStatResults object) to the client, and finally 5) the results of the initial FFT are made available on the OutpuPin and SpectrumOutputPin.
In addition to the above 5-step process, an event is provided to allow clients to mask (exclude) certain bins from the statistic calculations. For example, clients sometimes need to exclude skirt bins near the fundamental or harmonics. And because harmonic location occurs in step (2) above, and statistic calculations occur in step (3) above, bin exclusion needs to be specified midway through the algorithm. To allow this, a TSLBinMaskOpportunityEvent is generated just after step (2). To utilize this event, assign property OnBinMaskOpportunity to an event handler. Within the handler, clients have access to the fundamental and harmonic bin locations, and can call the TSLNoiseStats.BinMask.Add() method to add a bin number to exclude. For example, to exclude a single bin adjacent left and adjacent right of the first harmonic, inside the event handler use code such as:
Diagram:
Delphi Example:
SLNoiseStats1.BinMask.Clear(); // remove all existing masks SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] 1 ); SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] + 1 );
C++ Builder Example:
SLNoiseStats1->BinMask->Clear(); // remove all existing masks SLNoiseStats1->BinMask->Add( Harmonics->HarmonicBin[ 0 ] 1 ); SLNoiseStats1->BinMask->Add( Harmonics->HarmonicBin[ 0 ] + 1 );
Visual C++/MFC Example:
SLNoiseStats1.BinMask.Clear(); // remove all existing masks SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] 1 ); SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] + 1 );
Visual C# Example:
SLNoiseStats1.BinMask.Clear(); // remove all existing masks SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] 1 ); SLNoiseStats1.BinMask.Add( Harmonics.HarmonicBin[ 0 ] + 1 );
This code will change the amplitudes of these adjacent bins in the FFT output spectrum by setting them to the average amplitude of the signal.
Note
This change has effect only for statistic calculations that
follow the FFT there is no change in the actual FFT output
stream available on the OutputPin or SpectrumOutputPin.
Properties
Published
- Normalization - The normalization type for the FFT operation.
- BinMask - Array of Count integers holding the values of bins to be masked from statistic calculations.
- MinDataVal - The minimal value expected in the data stream.
- MaxDataVal - The maximal value expected in the data stream.
- WindowThreshold - Threshold for bins with (frequency-domain) window magnitudes.
- NumHarmonics - The NumHarmonics harmonic frequencies used in the calculation of SINAD and THD
- DCBinWidth - Size of a bin window (number of bins) to be treated as a single bin for the DC component of the signal.
- HarmonicBinWidth - Size of a bin window (number of bins) to be treated as a single bin for determining the fundamental and harmonic contributions.
- SynchronizeType - Type of thread buffer synchronization.
Public
- Masked - Array of Boolean, with each element corresponding to the initial FFT output bin.
- CompexData - Returns pointer to the processed FFT data.
- DataSize - Returns the size of the processed FFT data.
Events
- OnBinMaskOpportunity - Occurs after the initial FFT and location of the fundamental frequency and harmonics.
- OnStatsAvailable - Occurs after all TSLNoiseStats calculations are performed.
From TSLFourierBase
Properties
Published
- WindowType - Windowing function to be applied on the signal prior performing FFT.
- NumberTerms - Specifies the number of Cosine sum window function terms.
- Order - The order of the FFT.
- SamplingWindowStep - Step in samples when the next FFT will be applied.
- Synchronize - Specifies if the OnFrequencyResult event will be synchronized with the main thread.
Pins
- FrequencyOutputPin - Single Sample Real(double) data Highest Frequency Output Pin.
Events
- OnFrequencyResult - Occurs when highest amplitude frequency is detected.
From TSLFourierBaseComponent
Properties
Published
- Alpha - Adjustable parameter associated with some of the windowing equations.
- IgnoreDC - Ignores the DC component.
Pins
- InputPin - The Real(double) or Complex input pin of the FFT.
- OutputPin - The Complex output pin of the FFT.
- SpectrumOutputPin - The Real(double) spectrum output pin.