# abc to dq Transform (`abc2dq`)

> Turns three phase quantities into rotating d and q components in one block.

![abc2dq](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/abc2dq.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/control/abc2dq/)

**Group:** Control · **Kind:** `{"block":"abc2dq","kind":"control"}`

## When to use it

Use it on the measured phase currents in a field-oriented control loop. Use Clarke Transform and Park Transform separately if you also need alpha and beta.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `a` | signal | Phase a input |
| `b` | signal | Phase b input |
| `c` | signal | Phase c input |
| `theta` | signal | Frame angle in radians, electrical |
| `d` | signal | Direct-axis component output |
| `q` | signal | Quadrature-axis component, 90 degrees ahead of d |
| `zero` | signal | Zero-sequence output, (a + b + c)/3; it does not rotate with the frame. |

## Model

The block applies `clarke` (`alpha = (2*a - b - c)/3`, `beta = (b - c)/sqrt(3)`) and then `park` (`d = alpha*cos(theta) + beta*sin(theta)`, `q = -alpha*sin(theta) + beta*cos(theta)`). A balanced cosine set at the angle theta gives `d = A` and `q = 0`. The zero sequence `(a + b + c)/3` comes out on `zero`. Power is `1.5*(vd*id + vq*iq)`.

## Common mistakes

- The currents must flow into the machine, with the same sign convention as the machine model. A reversed ammeter makes iq negative and the speed loop drives the wrong way, so check the sign of the first torque step.
- theta must be the electrical angle in radians. The mechanical angle on a multi-pole machine makes the frame too slow, and an open theta reads 0.
- The measured currents carry switching ripple. A digital drive reads them once per period, so put a Sample and Hold at the carrier period, or a filter, in front when the ripple disturbs the current loop.

Problems rules: `pin.unconnected`

## Datasheet and sources

No datasheet applies. The a, b and c inputs come from three ammeters in A, and theta from a position sensor (its elec output) or from an Angle Generator.

## Example

Open the example with the command `file.openExample` and the name `demo:abc2dq`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
