alphabetagamma_to_dq0¶
- typhoon.test.transformations.alphabetagamma_to_dq0(signals, theta, alignment='d')¶
Implements the alpha-beta-gamma to dq0 transformation, also known as Clarke to Park angle transform.
The Clarke to Park Angle Transform block converts the alpha, beta, and zero components in a stationary reference frame to direct, quadrature, and zero components in a rotating reference frame. For balanced three-phase systems, zero component is equal to zero. There are two possible forms, as alpha-axis of stationary reference frame can be aligned with q- or d-axis of the rotating reference frame. These methods are implemented by following equations:
- alpha-axis and d-axis are aligned:
d = cos(theta) * alpha + sin(theta) * b
q = -sin(theta) * alpha + cos(theta) * b
zero = gamma
- alpha-axis and q-axis are aligned:
d = sin(theta) * a - cos(theta) * b
q = cos(theta) * a + sin(theta) * b
zero = gamma
Variable theta represents the angle between two reference frames; it is measured between alpha-axis of alpha-beta reference frame, and the axis from d-q reference frame which is initially aligned with alpha.
- Parameters:
signals (pandas.DataFrame) – DataFrame with three columns, one for alpha, beta and gamma signal.
theta (pandas.Series) – The angle in time between the two reference frames; it is measured between alpha-axis of alpha-beta reference frame, and the axis from d-q reference frame which is initially aligned with alpha.
alignment (string) – It has two valid values: ‘d’ or ‘q’. That is the way to chose which axis in rotating reference frame is initially aligned with alpha-axis from stationary reference frame.
- Returns:
result – DataFrame with three columns, one for every output signal. The labels to select columns are d, q and zero, respectively.
- Return type:
pandas.DataFrame
Examples
>>> from typhoon.test.signals import pandas_sine >>> from typhoon.test.transformations import alphabetagamma_to_dq0 >>> from scipy.signal import sawtooth >>> import numpy as np >>> import pandas as pd >>> alpha = pandas_sine(frequency=50) # sine with amplitude 1 and phase 0 >>> beta = pandas_sine(frequency=50, phase=-90) # sine with amplitude 1 and phase -90 >>> gamma = pandas_sine(frequency=50, amplitude=0) # constant with zeros
>>> # 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 = pd.DataFrame(data={"alpha":alpha, "beta":beta, "gamma":gamma}, index=alpha.index) >>> dq0_frame = alphabetagamma_to_dq0(alpha_beta_frame, theta, alignment='q') >>> d = dq0_frame["d"] >>> q = dq0_frame["q"] >>> zero = dq0_frame["zero"]