Voltecx is in beta. The macOS build comes first; Windows and Linux packages are still being tested.Beta. macOS comes first; Windows and Linux are still in testing. What's new
Documentation

Vector Angle (atan2) (atan2)

The angle of the alpha-beta vector, atan2(beta, alpha), wrapped to 0 ... 2*pi.

atan2

Component reference · 繁體中文

Group: Control · Kind: {"block":"atan2","kind":"control"}

When to use it

Use it to get the angle of a measured voltage or flux vector, for example a grid angle without a phase-locked loop or the rotor angle from an estimated flux. Use pll or srfPll when the signal is noisy or distorted, since this block follows every ripple at once.

Pins

Pin Domain Meaning
alpha signal Alpha component input, on the axis of phase a.
beta signal Beta component input, 90 degrees ahead of alpha.
theta signal Angle output in radians, from 0 up to (not including) 2*pi.

Model

The output is atan2(beta, alpha) moved into 0 ... 2pi by adding 2pi to a negative angle, the same wrap as the angle block, so it plugs into park and invPark. A zero vector gives 0. The block has direct feedthrough and no state.

Common mistakes

  • The angle jumps from just below 2*pi to 0 once per turn. Filtering it or taking its difference gives a spike at each wrap; differentiate the unwrapped angle or use the speed from a pll instead.
  • With amplitude-invariant clarke the angle of a balanced cosine set is the angle of phase a. A sine set (a = sin) is 90 degrees behind: subtract pi/2 or feed the cosine to get the frame park expects.

Datasheet and sources

There is no datasheet and no parameter.

Example

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


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