# Coordinate Transformation

The following amplitude invariant coordinate transformations are incorporated in this module. All of them are general purpose. This means, that they can be used to either transform voltages, currents, or any other applicable unit. Transformations for multiphase systems do exist as well.

## Three phase systems

### Variables structs

These structs are needed to hand over the input values and get the output values of the functions.

struct uz_3ph_abc_t

Struct for the variables of a three-phase-System.

Public Members

float a

Amplitude of the a phase (U)

float b

Amplitude of the b phase (V)

float c

Amplitude of the c phase (W)

struct uz_3ph_dq_t

Struct for the variables of a dq0-System.

Public Members

float d

Amplitude of the direct axis component

float q

Amplitude of the quadrature axis component

float zero

Amplitude of the zero component

struct uz_3ph_alphabeta_t

Struct for the variables of a alpha-beta-gamma-System.

Public Members

float alpha

Amplitude of the alpha component

float beta

Amplitude of the beta component

float gamma

Amplitude of the gamma component

### Transformation functions

#### abc to dq0 transformation

Struct for the natural variables of a six-phase system.

Calculates the dq0-components from the abc-Phases

Parameters
• input – uz_3ph_abc_t struct

Returns

uz_3ph_dq_t Outputs the calculated dq0-components

This uses the Park transformation to transform a three-phase (abc) signal to a dq0 rotating reference frame. X is a placeholder and can be replaced by either V, I, or any other applicable unit. The d-Axis has to be aligned with the A-phase.

$\begin{split}\begin{bmatrix} X_d \\ X_q \\ X_0 \\ \end{bmatrix} = \frac{2}{3} \begin{bmatrix} cos{(\theta_{el})} & cos{(\theta_{el}-\frac{2\pi}{3})} & cos{(\theta_{el}-\frac{4\pi}{3})} \\ -sin{(\theta_{el})} & -sin{(\theta_{el}-\frac{2\pi}{3})} & -sin{(\theta_{el}-\frac{4\pi}{3})} \\ \frac{1}{2} & \frac{1}{2} & \frac{1}{2}\\ \end{bmatrix} \begin{bmatrix} X_a \\ X_b \\ X_c \\ \end{bmatrix}\end{split}$

#### dq0 to abc transformation

Calculates the abc-phases from the dq0-components

Parameters
• input – uz_3ph_dq_t struct

Returns

uz_3ph_abc_t Outputs the calculated abc-phases

This uses the inverse Park transformation to transform a dq0 rotating reference frame to a three-phase (abc) signal. X is a placeholder and can be replaced by either V, I, or any other applicable unit. The d-Axis has to be aligned with the A-phase.

$\begin{split}\begin{bmatrix} X_a \\ X_b \\ X_c \\ \end{bmatrix} = \begin{bmatrix} cos{(\theta_{el})} & -sin{(\theta_{el})} & 1 \\ cos{(\theta_{el}-\frac{2\pi}{3})} & -sin{(\theta_{el}-\frac{2\pi}{3})} & 1\\ cos{(\theta_{el}-\frac{4\pi}{3})} & -sin{(\theta_{el}-\frac{4\pi}{3})} & 1\\ \end{bmatrix} \begin{bmatrix} X_d \\ X_q \\ X_0 \\ \end{bmatrix}\end{split}$

#### abc to αβγ transformation

uz_3ph_alphabeta_t uz_transformation_3ph_abc_to_alphabeta(uz_3ph_abc_t input)

Calculates the alpha-beta-gamma-components from the abc-phases.

Parameters
• input – uz_3ph_abc_t struct

Returns

uz_3ph_alphabeta_t Outputs the calculated alpha-beta-gamma-components

The Clarke transformation converts the time-domain components of a three-phase system in an abc reference frame to components in a stationary $$\alpha\beta\gamma$$ reference frame. X is a placeholder and can be replaced by either V, I, or any other applicable unit.

$\begin{split}\begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{\gamma} \\ \end{bmatrix} = \frac{2}{3} \begin{bmatrix} 1 & -\frac{1}{2} & -\frac{1}{2} \\ 0 & \frac{\sqrt{3}}{2} & -\frac{\sqrt{3}}{2} \\ \frac{1}{2} & \frac{1}{2} & \frac{1}{2} \\ \end{bmatrix} \begin{bmatrix} X_a \\ X_b \\ X_c \\ \end{bmatrix}\end{split}$

#### αβγ to abc transformation

uz_3ph_abc_t uz_transformation_3ph_alphabeta_to_abc(uz_3ph_alphabeta_t input)

Calculates the abc-phases from the alpha-beta-gamma-components.

Parameters
• input – uz_3ph_alphabeta_t struct

Returns

uz_3ph_abc_t Outputs the calculated abc-phases

The inverse Clarke transformation converts the components in a stationary $$\alpha\beta\gamma$$ reference frame to the time-domain components of a three-phase system in an abc reference frame. X is a placeholder and can be replaced by either V, I, or any other applicable unit.

$\begin{split}\begin{bmatrix} X_a \\ X_b \\ X_c \\ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 1 \\ -\frac{1}{2} & \frac{\sqrt{3}}{2} & 1 \\ -\frac{1}{2} & -\frac{\sqrt{3}}{2} & 1 \\ \end{bmatrix} \begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{\gamma} \\ \end{bmatrix}\end{split}$

#### αβγ to dq0 transformation

Calculates the dq0-components from the alpha-beta-gamma-components.

Parameters
• input – uz_3ph_alphabeta_t struct

Returns

uz_dq_t outputs the calculated dq-components

This function converts the stationary $$\alpha\beta\gamma$$ reference frame components into the dq0 rotating reference frame. X is a placeholder and can be replaced by either V, I, or any other applicable unit. The d-Axis has to be aligned with the A-phase.

$\begin{split}\begin{bmatrix} X_{d} \\ X_{q} \\ X_{0} \end{bmatrix} = \begin{bmatrix} cos(\theta_{el}) & sin(\theta_{el}) & 0\\ -sin(\theta_{el}) & cos(\theta_{el}) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{\gamma} \end{bmatrix} \\\end{split}$

#### dq0 to αβγ transformation

Calculates the alpha-beta components from the dq-components.

Parameters
• input – uz_3ph_dq_t struct

Returns

uz_3ph_alphabeta_t outputs the calculated alpha-beta-gamma-components

This function converts the dq0 rotating reference frame components into the stationary αβγ reference frame. X is a placeholder and can be replaced by either V, I, or any other applicable unit. The d-Axis has to be aligned with the A-phase.

$\begin{split}\begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{\gamma} \end{bmatrix} = \begin{bmatrix} cos(\theta_{el}) & -sin(\theta_{el}) & 0\\ sin(\theta_{el}) & cos(\theta_{el}) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} X_{d} \\ X_{q} \\ X_{0} \end{bmatrix} \\\end{split}$

## Multiphase systems

### structs for ninephase VSD transformation

struct uz_9ph_abc_t

Struct for the natural variables of a nine-phase system.

Public Members

float a1

Amplitude of the a1 phase

float b1

Amplitude of the b1 phase

float c1

Amplitude of the c1 phase

float a2

Amplitude of the a2 phase

float b2

Amplitude of the b2 phase

float c2

Amplitude of the c2 phase

float a3

Amplitude of the a3 phase

float b3

Amplitude of the b3 phase

float c3

Amplitude of the c3 phase

struct uz_9ph_alphabeta_t

Struct for the variables of an alpha-beta nine-phase system.

Public Members

float alpha

Amplitude of the alpha component

float beta

Amplitude of the beta component

float z1

Amplitude of the z1 component

float z2

Amplitude of the z2 component

float x1

Amplitude of the x1 component

float y1

Amplitude of the y1 component

float x2

Amplitude of the x2 component

float y2

Amplitude of the y2 component

float z3

Amplitude of the z3 component

Naming of the subspaces according to .

### Functions for ninephase VSD systems transformation

#### 9ph-abc to 9ph-αβγ transformation

uz_9ph_alphabeta_t uz_transformation_9ph_abc_to_alphabeta(uz_9ph_abc_t input)

Calculates the alpha-beta-gamma-components from the nine phase abc-phases.

Parameters
• input – uz_9ph_abc_t

Returns

uz_9ph_alphabeta_t Outputs the calculated stationary reference frame components

The ninephase VSD transformation works like the following equations show:

$\begin{split}\begin{bmatrix} C \end{bmatrix}= \frac{2}{9} \begin{bmatrix} cos(1\cdot 0\cdot\frac{\pi}{9}) & cos(1\cdot 6\cdot\frac{\pi}{9}) & cos(1\cdot 12\cdot\frac{\pi}{9}) & cos(1\cdot 1\cdot\frac{\pi}{9}) & cos(1\cdot 7\cdot\frac{\pi}{9}) & cos(1\cdot 13\cdot\frac{\pi}{9}) & cos(1\cdot 2\cdot\frac{\pi}{9}) & cos(1\cdot 8\cdot\frac{\pi}{9}) & cos(1\cdot 14\cdot\frac{\pi}{9}) &\\ sin(1\cdot 0\cdot\frac{\pi}{9}) & sin(1\cdot 6\cdot\frac{\pi}{9}) & sin(1\cdot 12\cdot\frac{\pi}{9}) & sin(1\cdot 1\cdot\frac{\pi}{9}) & sin(1\cdot 7\cdot\frac{\pi}{9}) & sin(1\cdot 13\cdot\frac{\pi}{9}) & sin(1\cdot 2\cdot\frac{\pi}{9}) & sin(1\cdot 8\cdot\frac{\pi}{9}) & sin(1\cdot 14\cdot\frac{\pi}{9}) \\ cos(3\cdot 0\cdot\frac{\pi}{9}) & cos(3\cdot 6\cdot\frac{\pi}{9}) & cos(3\cdot 12\cdot\frac{\pi}{9}) & cos(3\cdot 1\cdot\frac{\pi}{9}) & cos(3\cdot 7\cdot\frac{\pi}{9}) & cos(3\cdot 13\cdot\frac{\pi}{9}) & cos(3\cdot 2\cdot\frac{\pi}{9}) & cos(3\cdot 8\cdot\frac{\pi}{9}) & cos(3\cdot 14\cdot\frac{\pi}{9}) \\ sin(3\cdot 0\cdot\frac{\pi}{9}) & sin(3\cdot 6\cdot\frac{\pi}{9}) & sin(3\cdot 12\cdot\frac{\pi}{9}) & sin(3\cdot 1\cdot\frac{\pi}{9}) & sin(3\cdot 7\cdot\frac{\pi}{9}) & sin(3\cdot 13\cdot\frac{\pi}{9}) & sin(3\cdot 2\cdot\frac{\pi}{9}) & sin(3\cdot 8\cdot\frac{\pi}{9}) & sin(3\cdot 14\cdot\frac{\pi}{9}) \\ cos(5\cdot 0\cdot\frac{\pi}{9}) & cos(5\cdot 6\cdot\frac{\pi}{9}) & cos(5\cdot 12\cdot\frac{\pi}{9}) & cos(5\cdot 1\cdot\frac{\pi}{9}) & cos(5\cdot 7\cdot\frac{\pi}{9}) & cos(5\cdot 13\cdot\frac{\pi}{9}) & cos(5\cdot 2\cdot\frac{\pi}{9}) & cos(5\cdot 8\cdot\frac{\pi}{9}) & cos(5\cdot 14\cdot\frac{\pi}{9}) \\ sin(5\cdot 0\cdot\frac{\pi}{9}) & sin(5\cdot 6\cdot\frac{\pi}{9}) & sin(5\cdot 12\cdot\frac{\pi}{9}) & sin(5\cdot 1\cdot\frac{\pi}{9}) & sin(5\cdot 7\cdot\frac{\pi}{9}) & sin(5\cdot 13\cdot\frac{\pi}{9}) & sin(5\cdot 2\cdot\frac{\pi}{9}) & sin(5\cdot 8\cdot\frac{\pi}{9}) & sin(5\cdot 14\cdot\frac{\pi}{9}) \\ cos(7\cdot 0\cdot\frac{\pi}{9}) & cos(7\cdot 6\cdot\frac{\pi}{9}) & cos(7\cdot 12\cdot\frac{\pi}{9}) & cos(7\cdot 1\cdot\frac{\pi}{9}) & cos(7\cdot 7\cdot\frac{\pi}{9}) & cos(7\cdot 13\cdot\frac{\pi}{9}) & cos(7\cdot 2\cdot\frac{\pi}{9}) & cos(7\cdot 8\cdot\frac{\pi}{9}) & cos(7\cdot 14\cdot\frac{\pi}{9}) \\ sin(7\cdot 0\cdot\frac{\pi}{9}) & sin(7\cdot 6\cdot\frac{\pi}{9}) & sin(7\cdot 12\cdot\frac{\pi}{9}) & sin(7\cdot 1\cdot\frac{\pi}{9}) & sin(7\cdot 7\cdot\frac{\pi}{9}) & sin(7\cdot 13\cdot\frac{\pi}{9}) & sin(7\cdot 2\cdot\frac{\pi}{9}) & sin(7\cdot 8\cdot\frac{\pi}{9}) & sin(7\cdot 14\cdot\frac{\pi}{9}) \\ \frac{1}{2} & \frac{1}{2} & \frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} & -\frac{1}{2} & \frac{1}{2} & \frac{1}{2} & \frac{1}{2} \\ \end{bmatrix}\end{split}$
$\begin{split}\begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{o_1} \\ X_{o_2} \\ X_{x_1} \\ X_{y_1} \\ X_{x_2} \\ X_{y_2} \\ X_{zero} \end{bmatrix} = \begin{bmatrix} C \end{bmatrix}\cdot\begin{bmatrix} X_{a_1} \\ X_{b_1} \\ X_{c_1} \\ X_{a_2} \\ X_{b_2} \\ X_{c_2} \\ X_{a_3} \\ X_{b_3} \\ X_{c_3} \end{bmatrix}\end{split}$

Transformation matrix according to .

#### 9ph-alpha-beta-gamma to 9ph-abc transformation

uz_9ph_abc_t uz_transformation_9ph_alphabeta_to_abc(uz_9ph_alphabeta_t input)

Calculates the abc-phases from the stationary reference frame components.

Parameters
• input – uz_9ph_alphabeta_t struct

Returns

uz_9ph_abc_t Outputs the calculated abc-phases

The inverse transformation uses the inverse of the before shown matrix.

$\begin{split}\begin{bmatrix} X_{a_1} \\ X_{b_1} \\ X_{c_1} \\ X_{a_2} \\ X_{b_2} \\ X_{c_2} \\ X_{a_3} \\ X_{b_3} \\ X_{c_3} \end{bmatrix} = \begin{bmatrix} C \end{bmatrix}^{-1}\cdot\begin{bmatrix} X_{\alpha} \\ X_{\beta} \\ X_{o_1} \\ X_{o_2} \\ X_{x_1} \\ X_{y_1} \\ X_{x_2} \\ X_{y_2} \\ X_{zero} \end{bmatrix}\end{split}$

### Example usage of the ninephase transformation

The existing functions offer the possibility to convert ninephase asymmetrical systems into a stationary reference frame (αβ). Afterward, the Park transformation can be applied to transform them into the rotating reference frame. The inverse transformations are also available. To use the ninephase transformation, one must create a struct for the natural phase domain values.

Listing 39 Declarations
// declare necessary structs and variables
uz_9ph_abc_t natural_values = {0};             // holds the natural values
uz_9ph_alphabeta_t stationary_values = {0};    // holds the stationary reference frame values
uz_3ph_alphabeta_t alphabeta = {0};            // used to give only alpha and beta to the Park transformation
uz_3ph_dq_t rotating_dq = {0};                 // holds the results of the Park transformation
float d_current = 0.0f;                        // example variable, used to process the dq values in the following code
float q_current = 0.0f;                        // example variable, used to process the dq values in the following code
float theta_el = 0.0f;                         // electric rotor angle

...

// assert example values
natural_values.a1 =  1.0f;                     // example value for phase a1, store your real values here
natural_values.b1 = -0.5f;
//...
natural_values.c3 = -0.5f;


The struct can then be given to the transformation function which will return a struct containing the transformed values in the stationary reference frame.

Listing 40 VSD transformation
stationary_values = uz_transformation_9ph_abc_to_alphabeta(natural_values);


As it is common to transform only the $$\alpha\beta$$ components to the rotating reference frame, those two must be written into the threephase uz_3ph_alphabeta_t struct and be given to the dq transformation function. As commonly known, the electrical angle is also necessary. The dq and values can then be read from the struct. The inverse transformation follows the same principle.

Listing 41 Park transformation
alphabeta.alpha = stationary_values.alpha;
alphabeta.beta = stationary_values.beta;
rotating_dq = uz_ab_to_dq_transformation(alphabeta,theta_el);
d_current = rotating_dq.d;
q_current = rotating_dq.q;


When adding a new transformation for systems with different amounts of phases one must know if the principle of the existing VSD transformation can be used. If this is the case, go through the following steps:

1. Copy the functions uz_9ph_clarke_transformation, uz_transformation_9ph_alphabeta_to_abc and uz_9ph_arraymul and rename them accordingly (e.g. uz_6ph_arraymul).

2. Create the structs uz_alphabeta_9ph_t and uz_abc_9ph_t for the newly added phase system.

3. In uz_9ph_arraymul adapt the expected array dimensions and limit of the for-loop to your amount of phases (everywhere where there is a 9).

4. Do the same with the Clarke transformation functions and change the structs to your newly created ones. For the VSD transformation, the Matlab script (see below) can be used.

5. Adapt the input/output writing accordingly.

To use the Matlab script that outputs the VSD matrix in C code, the variable “n” must be changed to the target amount of phases. The placeholder “VSD_MATRIX” should be replaced with the Matlab variable that holds the VSD matrix (e.g. from your workspace). The factor for amplitude invariance will be multiplied afterward so the user should not apply it to your VSD matrix by himself. The creation of a transformation matrix with this method was presented in .

Listing 42 Matlab script
%% VSD matrix
n = 9;
z = single(2/n*VSD_MATRIX);
invz = inv(z);

%% print code for normal matrix
fprintf('\nTransformation Matrix:\n');
printcode(z,n);

%% print code for inverse matrix
fprintf('\nInverse Transformation Matrix:\n');
printcode(invz,n);

%% function printcode function declare: print c code for matrix to 2D array
function printcode(matrix,phases)
fprintf('float vsd_mat[%d][%d] = \n{\n',phases,phases);
for y = (0:(phases-1))
fprintf('    { ');
for x = (0:(phases-1))
fprintf('%.7ff',matrix(y+1,x+1));
if x<(phases-1)
fprintf(', ');
end
end
if y<(phases-1)
fprintf(' },\n');
else
fprintf(' }\n');
end
end
fprintf('};\n');
end


#### Sources

1
1. Zoric, M. Jones and E. Levi, “Vector space decomposition algorithm for asymmetrical multiphase machines,” 2017 International Symposium on Power Electronics (Ee), 2017, pp. 1-6, doi: 10.1109/PEE.2017.8171682.

2
1. Zabaleta, “Permament Magnet Multiphase Machine Modeling and Control for MV Wind Energy Applications”, Dissertation, Liverpool John Moores University, 2018, doi: 10.24377/LJMU.t.00008818.

3
1. Rockhill and T. A. Lipo, “A generalized transformation methodology for polyphase electric machines and networks,” 2015 IEEE International Electric Machines & Drives Conference (IEMDC), 2015, pp. 27-34, doi: 10.1109/IEMDC.2015.7409032.

4
1. Rockhill and T. A. Lipo, “A simplified model of a nine phase synchronous machine using vector space decomposition,” 2009 IEEE Power Electronics and Machines in Wind Applications, 2009, pp. 1-5, doi: 10.1109/PEMWA.2009.5208335.