signal_frequency_SOGI_pll

typhoon.test.signals.control.signal_frequency_SOGI_pll(input, initial_amp, frequency, initial_angle=0, max_freq_var=10, pll_filter_params=None)

Measures the frequency of the signal using a SOGI PLL algorithm.

Parameters:
  • input (pandas.Series with timedelta index values) – Input signal to be measured.

  • initial_amp (int, float) – Initial value of the signal amplitude

  • frequency (int, float) – Value of frequency to be achieved

  • initial_angle (int, float) – Initial value of the signal phase

  • max_freq_var (int, float) – Frequency (in Hz) used to saturate the PI Controller

  • pll_filter_params (Nonetype, dict) –

    This dictionary contains the projected gain of the PLL and the cutoff frequency of the filters. If those values are not defined, the Default values will be used The dict keys that can be set are:

    • ”sogi_gain” (int, float. Default: 0.4) - SOGI Algorithm Gain

    • ”kp_pll” (int, float. Default: 4.81e3) - PLL controller proportional gain

    • ”ki_pll” (int, float. Default: 1.84e4) - PLL controller integral gain

    • ”kd_pll” (int, float. Default: -5.19) - PLL controller derivative gain

    • ”lp_cut_off_filter_d” (int, float. Default: 20) - Cut-off frequency (in Hz) of the output filters of d coordinate

    • ”lp_cut_off_filter_w” (int, float. Default: 100) - Cut-off frequency (in Hz) of the output filters of angular frequency (w)

    • ”lp_cut_off_filter_f” (int, float. Default: 10) - Cut-off frequency (in Hz) of the output filters of frequency

Returns:

result – The Dataframe contains dq coordinates (d and q), the frequency measured (f), the angle (wt), and the sinusoidal output (sin_wt).

Return type:

pandas.Dataframe

Examples

>>> from typhoon.test.signals.control import signal_frequency_SOGI_pll
>>> from typhoon.test.signals import pandas_sine, assert_is_constant
>>>
>>> amp = 311
>>> freq_initial = 55
>>> freq = 60
>>>
>>> signal = pandas_sine(amp, freq, 100/freq, 0)
>>>
>>> df = signal_frequency_SOGI_pll(signal, amp, freq_initial)

You can set None, one, or all parameters of the PLL project:

>>> df = signal_frequency_SOGI_pll(signal, amp, freq_initial, pll_filter_params={"lp_cut_off_filter_f": 15})

The data are available in each column of the dataframe df:

>>> frequency = df["f"]
>>> d_coordinate = df["d"]
>>> q_coordinate = df["q"]
>>> wt = df["wt"]  # Angle
>>> sin_wt = df["sin_wt"]  # sine of angle (sin(angle))

If desired, assert_is_constant can be included in the test procedure as follows:

>>> def test_pll():
>>>     # ...
>>>
>>>     ref_value = freq
>>>
>>>     tol = .5
>>>     tol_t = 250e-3
>>>
>>>     assert_is_constant(df["f"], (ref_value - tol, ref_value + tol), during=(tol_t, df.index[-1]), strictness=tol)