Harmonic Analyzer

Description of the Harmonic Analyzer component in Schematic Editor, which calculates amplitude, phase and frequency for the specified harmonics.

Component Icon

Figure 1. Harmonic analyzer icon

Description

The Harmonic Analyzer block calculates amplitude, phase and frequency for the specified harmonic.

The frequency of the fundamental harmonic can be a fixed value defined as property value, or it can be fed to the component through f1 input.

The real and imaginary part of the phasor, for a specified harmonic, are calculated using Discrete Fourier Transform coefficients:

A h _ r e a l = 2 N n = 0 N 2 A n cos 2 π h n N
A h _ i m a g = 2 N n = 0 N 2 - A n sin 2 π h n N

where h and N represent the order of the specified harmonic and the number of samples, respectively. The number of samples is calculated as the ratio between the period of the signal and the execution rate.

The amplitude and phase outputs can be obtained easily after that:

A h = A h _ r e a l 2 + A h _ i m a g 2
A h = a t a n 2 ( A h _ i m a g ,   A h _ r e a l )

The frequency value of the harmonic is simply calculated based on the fundamental frequency, and the harmonic order:

f = ffund * h.

Ports

  • In (in)
    • Input signal.
      • Supported types: real
      • Vector support: no
  • f1 (in)
    • Frequency of the fundamental harmonic of the input signal. This port is visible only if the Fundamental frequency source property value is set to External.
      • Supported types: real
      • Vector support: no
  • |u| (out)
    • Amplitude of the input signal.
      • Supported types: real
      • Vector support: yes
        • The output dimension depends on the Harmonic order value. If this property is set as a list, the output will be a vector with an order equal to the order of the list set in this property
  • ∠u (out)
    • Phase of the input signal.
      • Supported types: real
      • Vector support: yes
        • The output dimension depends on the Harmonic order value. If this property is set as a list, the output will be a vector with an order equal to the order of the list set in this property
  • f (out)
    • Frequency value of the harmonic.
      • Supported types: real
      • Vector support: yes
        • The output dimension depends on the Harmonic order value. If this property is set as a list, the output will be a vector with an order equal to the order of the list set in this property.
  • θ
    • Reference angle for the calculated phase value of the input signal. This output can be used in order to recreate the input signal using only the harmonics chosen in the Harmonic order property (see Signal recreation example).
      • Supported types: real
      • Vector support: yes
        • The output dimension depends on the Harmonic order value. If this property is set as a list, the output will be a vector with an order equal to the order of the list set in this property.

Properties

  • Fundamental frequency source
    • Choose between an Internal and an External frequency source. If the former is chosen, the fundamental harmonic frequency is a constant value of the Frequency property. If the latter is chosen, the fundamental harmonic frequency is fed externally through the f1 port.
  • Frequency
    • Type in the frequency of the fundamental harmonic. This property is visible only if the Fundamental frequency source value is set to Internal.
  • Harmonic order
    • Type in the harmonics order value, or a list of values that should be measured.
  • Angle unit
    • Choose if the angle outputs (∠u and θ) are calculated in degrees or radians.
  • Execution rate
    • Type in the desired signal processing execution rate. This value must be compatible with other signal processing components of the same circuit: the value must be a multiple of the fastest execution rate in the circuit. There can be up to four different execution rates, but they must all be multiple of the basic simulation timestep. To specify the execution rate, you can use either decimal (e.g. 0.001) or exponential values (e.g. 1e-3) in seconds. Alternatively, you can type in ‘inherit’ in which case the component will be assigned execution rate based on the execution rate of the components it is receiving input from.

      The input signal is sampled with this execution rate. Results of the Harmonic analyzer will be more precise if the period of the fundamental harmonic of the signal is divisible by this execution rate (the ratio is an integer number).

Signal recreation example

This section will demonstrate how the Harmonic Analyzer component can be used to extract the exact waveforms of certain harmonics of an input signal. The schematic diagram that can provide this functionality is shown in Figure 2.

Figure 2. Harmonic extraction schematic diagram

Input signal voltage is measured and provided to the Single Phase PLL component in order to acquire the fundamental frequency of the signal. Through HIL SCADA third and fifth harmonics are included in input signal. The first Harmonic Analyzer component, named Harmonic Analyzer1, is configured to extract the first, the third and the fifth harmonic, whereas the second one, named Harmonic Analyzer2, is configured to extract only the fundamental harmonic. With both of these components, the harmonic angle is added to the reference angle in order to acquire the input value for the sine calculation. Sine values are multiplied by the amplitude value. In case of vectorized signals, the Sum block sums the vector elements in order to recreate the chosen harmonics of the input signal.

Figure 3 shows the waveforms of signals of interest. It can be seen that recreation is correct in the first case in which all of the present harmonics are chosen for extraction. Meanwhile, V_fundamental is the waveform of the fundamental harmonic only, since the corresponding Harmonic Analyzer component is configured to extract only the fundamental frequency harmonic.

Figure 3. Signal recreation and fundamental harmonic extraction waveforms