Harmonic Analysis

GX-TXT DEV112 P011-bis

Identify the fundamental and the harmonics of a signal and compare amplitudes, phases and distortion indices.

GX-TXT P011-bis · module 1.2.0. Harmonic Analysis searches for components around the multiples of a fundamental in a linear amplitude spectrum. It publishes frequencies, relative amplitudes, plots and the harmonic distortion computed on the resolved orders.

Generate the signal and compute the FFT

  1. From Session → New Session → Generate Session choose the Generator harmonic_analysis and create a Standalone Session. In Datasets open harmonic.source.
  2. Enable FFT Spectrum & Error Analysis. Bind primary.time_s and primary.distorted_V. To get the spectrum of the example choose full_record, window rectangular and DC removal mean. Clear Data Selection and Temporal Set if already assigned. Run the FFT from Run. FFT procedure and parameter choice.
  3. Enable harmonic.source.spectrum, open Preview, Metadata and Open Dataset → Canonical table. Use frequency_Hz and the linear value amplitude in V. magnitude_dBc already uses a logarithmic relative scale.
Generator for the Harmonic Analysis example Session.
Generator for the Harmonic Analysis example Session.
FFT table with frequency in Hz and linear amplitude in V.
FFT table with frequency in Hz and linear amplitude in V.

Configure the detection

In Configuration → Modules → Analysis & Services search for Harmonic Analysis, check Health and enable it with Enable module. In Analysis open the tab and tick Run / recalculate now. In Dataset sources assign harmonic.source.spectrum to primary. + Add source adds an alias and Remove releases a source. In Variable bindings choose primary.frequency_Hz for Frequency and primary.amplitude for Amplitude spectrum. auto lets the program resolve the role from the available metadata.

Fundamental detection
auto_peak searches for the maximum in the admitted region. explicit locates the fundamental near the given frequency.
Explicit fundamental frequency
Comes into play with explicit. Use 100 Hz to replicate the second example.
Highest harmonic order
Highest order number searched. With 5, the default, the fundamental and the harmonics up to the fifth are considered. With 3 it stops at the third.
Local harmonic search half-width [bins]
Half-width of the local search in bins around the expected multiple. The default is 2. In the explicit example use 1. Overlapping windows can select the same bin.
Low-frequency bins excluded from automatic fundamental search
Number of initial bins to exclude from the automatic search. The value 1 discards the DC component of the example FFT.
Harmonic result Dataset ID
harmonic_analysis.result is the default ID. Set harmonic_analysis.explicit to keep the explicit test alongside.
Explicit detection at 100 Hz, third order, one-bin local search and a dedicated output ID.
Explicit detection at 100 Hz, third order, one-bin local search and a dedicated output ID.

Compare the components and the distortion

In Run update the plan and start the selective analysis. In Results read harmonic_analysis_report.txt. Open the Dataset in Preview, Metadata and Canonical table. The columns are order, expected and detected frequencies, error in Hz, amplitude, dBc level and percentage of the fundamental.

The automatic case found 100 Hz and 1 V. The second and third harmonics measure about 0.1 V and 0.05 V. The root-sum-square of the tracked harmonics relative to the fundamental is 11.4017543% up to order 5 and 11.1803399% up to order 3. The set of orders and the FFT normalization affect the measurement.

Metadata of the Dataset published by the automatic test.
Metadata of the Dataset published by the automatic test.

Open and present the plots

In Plots select 01_harmonic_levels_dbc for the relative levels, 02_harmonic_levels_percent for the percentages or 03_harmonic_levels_linear for the amplitudes. The persistent variants appear as rows Plot p…. Select a row Plot p… of type plot.dataset to change the title. Choose Presentation → Title and labels…, customize the title, save and use Render → Rerender. Graph → Open PNG 1:1 opens the full-size rendering.

Plots list with the three harmonic views and the Session variants.
Plots list with the three harmonic views and the Session variants.
Native plot with the title Armoniche in dBc con riferimento a 100 Hz, after regeneration.
Native plot with the title Armoniche in dBc con riferimento a 100 Hz, after regeneration.