dq0_to_alphabetagamma

typhoon.test.transformations.dq0_to_alphabetagamma(signals, theta, alignment='d')

Implements dq0 to alpha-beta-gamma angle transform, also known as Park to Clarke angle transform.

Converts the direct, quadrature and zero component from the rotating reference frame into the alpha, beta and gamma component in the stationary reference frame. If the system is balanced, zero component in the rotating, as well as gamma component in stationary reference frame is equal to zero. According to alphabetagamma_to_dq0 function, here is also possible to chose the alignment - d- or q-axis:

  • d-axis alignment: d-axis is aligned with alpha-axis. The following equation perform this transformation:
    alpha = cos(theta) * d - sin(theta) * q
    beta = sin(theta) * d + cos(theta) * q
  • q-axis alignment: q-axis is aligned with alpha-axis. The equations look like this:
    alpha = sin(theta) * d + cos(theta) * q
    beta = -cos(theta) * d + sin(theta) * q
Parameters:
  • signals (pandas.DataFrame) – DataFrame with three columns, with each one representing direct, quadrature and zero component in rotating reference frame.

  • theta (pandas.Series) – the signal in time which represents the angle between two reference frames

  • alignment (string) – Selects the alignment between the reference frames. It can be ‘d’ or ‘q’

Returns:

result – DataFrame with three columns, one for every output signal. The labels to select columns are alpha, beta and gamma, respectively.

Return type:

pandas.DataFrame

Examples

>>> from typhoon.test.signals import pandas_sine
>>> from typhoon.test.transformations import dq0_to_alphabetagamma
>>> import numpy as np
>>> import pandas as pd
>>> t = np.linspace(0, 1, 10000)
>>> index = pd.TimedeltaIndex(t, unit='s')
>>> d = pd.Series(data=np.ones(10000), index=index) # constant signal with value 1
>>> q = pd.Series(data=np.zeros(10000), index=index) # constant signal with value 0
>>> zero = pd.Series(data=np.zeros(10000), index=index) # constant signal with value 0
>>> dq0_dataframe = pd.DataFrame(data={'d': d, 'q': q, 'zero': zero}, index=index)
>>> # create pandas.Series which represents dq reference frame angle
>>> t = np.arange(0, 1, 1e-4) # time axis for the angle
>>> index = pd.TimedeltaIndex(t, unit='s')
>>> angle = sawtooth(2 * np.pi * 50 * t) # create sawtooth signal from -1 to 1
>>> angle = (angle + 1) * np.pi # make sawtooth go from 0 to 2pi
>>> theta = pd.Series(data=angle, index=index)
>>> alpha_beta_frame = dq0_to_alphabetagamma(dq0_dataframe, theta, alignment='q')
>>> alpha = alpha_beta_frame['alpha']
>>> beta = alpha_beta_frame['beta']
>>> gamma = alpha_beta_frame['gamma']