Angle

ANGLE #

Brief #

The angle component owns the commutation angle and the synchronous electrical speed sent to hv0 (hv0.pos, hv0.vel), for every motor type.

Sources (src) #

  • 0 feedback: pos = pos_fb, vel = vel_fb. A pure pass-through, used by the PMSM templates (pos_fb = vel2.pos_out or pmsm_ttc0.pos_out, vel_fb = vel2.vel).
  • 1 feedback plus slip: pos = pos_m * polecount + integral of slip, vel = vel_m * polecount + slip. Indirect field orientation for an induction motor on an encoder: pos_m is the mechanical rotor angle, vel_m the mechanical rotor speed, slip comes from acim_flux. The angle is built from the encoder, not from vel_m, so the lag of a speed estimate during a ramp does not show up as a lower slip.
  • 2 observer: pos = pos_obs, vel = vel_obs.
  • 3 open loop: vel = vel_cmd (electrical), pos integrates it. V/f and I/f.

Switching into an integrating source (1, 3) starts from the current angle, so the switch itself does not move the field. Switching into 0 or 2 takes the source’s angle as is; a sequencer that switches onto the observer is expected to do it once the observer has locked.

vel is what the F3 current loop wants for its decoupling and what it extrapolates the angle with.

It runs in the F4 rt (5 kHz); the F3 extrapolates pos with vel every PWM period between packets, so at a high electrical frequency vel must be right for a smooth angle.

Pins #

NameDescription
srcparameter, 0 feedback, 1 feedback + slip, 2 observer, 3 open loop
polecountparameter, pole pairs, used by src 1
pos_fbinput, src 0, electrical angle [rad]
vel_fbinput, src 0, electrical speed [rad/s]
pos_minput, src 1, mechanical rotor angle [rad]
vel_minput, src 1, mechanical rotor speed [rad/s]
slipinput, src 1, slip [rad/s electrical]
pos_obsinput, src 2, electrical angle [rad]
vel_obsinput, src 2, electrical speed [rad/s]
vel_cmdinput, src 3, electrical speed [rad/s]
posoutput, commutation angle [rad], to hv0.pos
veloutput, synchronous electrical speed [rad/s], to hv0.vel

References #

Source: .c File