Simple Current controller
The desired d- and q-component of the space phasor current in rotor fixed coordinate system are given by inputs id and iq.
Using the given rotor position (input phi), the actual three-phase currents are measured and transformed to the d-q coordinate system.
Two PI controllers determine the necessary d- and q- voltages, which are transformed back to three-phase (output y[3]).
They can be used to feed a voltage source which in turn feeds a permanent magnet synchronous machine.
Inputs d and q can be given either as peak values (useRMS=false) or as RMS (useRMS=true).
The correction by factor √2 is done automatically.
The measured currents iActual[m] are assumed to be instantaneous values.
Note: No care is taken for current or voltage limiting, as well as for field weakening.