Class SLNoiseStats.TSLNoiseStats

From Mitov Wiki Doc
Revision as of 00:24, 22 November 2011 by David Alm (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

BIGSLNoiseStats.gif SLNoiseStats.gif NETSLNoiseStats.gif

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:


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

Public

Events

From TSLFourierBase

Properties

Published

Pins

Events

From TSLFourierBaseComponent

Properties

Published

Pins

From TSLBasicThreadedFilter

Properties

Published

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox