PMSM model assumptions and numerical verification

Start with the complete sampled drive loop, including the effective delay, two-level inverter and PMSM feedback path. Then compare two controllers: one models the delay and one does not. Hover any controller block to see its role and live numeric value. Values follow the machine you last used in the design studio.

inspect speed

The complete drive loop · what is actually simulated

Start here before comparing the controllers. Both designs drive the same sampled-data plant: current references enter a digital controller, the command passes through the real actuation delay and inverter, the PMSM currents evolve, and sampled currents return at the next control update.

average-value inverter model
Current sensors + Clarke/Park transform The phase currents are represented by sampled \(\mathbf i_{dq}[k]\) and returned to the controller at fs = ….
Where is \(T_d\)?

The \(z^{-1}\) block stores the voltage command, so the plant receives \(\mathbf u[k-1]\) during the next update. \(T_d\) is the physical time from current and angle sampling until that voltage becomes effective. In the exact dq plant it appears in the voltage-vector angle

\[\phi=\phi_{\mathrm{fw}}-\omega_eT_d.\]

It is therefore not a second hidden sample delay: it describes the orientation and timing of the applied voltage inside the sample interval.

Ts = … Td = … Tsw = …
Textbook IMC PI

PI feedback + ωL̂ decoupling. The gains are designed from a continuous-time model and the delay is ignored during tuning. The physical delay is still present when the controller is tested against the plant.

\[\mathbf u^{\star}=K_p\mathbf e+K_i\int\mathbf e\,dt+\omega_e J\hat L\mathbf i.\]
Delay-aware discrete design

Reference feedforward + current feedback + integral action + delayed-voltage feedback. The previous command u[k−1] is a controller state, so the design places poles with the actuation delay already included.

\[\mathbf u[k]=K_t\mathbf r[k]+\boldsymbol\xi[k]-K_1\mathbf i[k]-K_2\mathbf u[k-1].\]
One control interval
kTssample currents and rotor angle
computecontroller forms \(\mathbf u^{\star}[k]\)
after TdPWM/inverter voltage becomes effective
(k+1)Tsnext sampled current

Block diagrams · hover any block

Textbook IMC PI — delay ignored

Hover or tap a block to see its role and live value at the inspected speed.

How its gains are designed
Delay-aware discrete design

Hover or tap a block to see its role and live value at the inspected speed.

How its gains are designed

Same true plant on the right of both diagrams — the only difference is what the designer chose to model. The delay-aware structure has one extra feedback path (\(K_2\), on the delayed voltage): that single block is what keeps the poles inside the unit circle at speed. Convince yourself in the design studio.

Method & verification

Sampling frequency versus switching frequency

The sampling frequency \(f_s\) is the rate at which the phase currents and rotor angle are sampled and the current controller is executed. The switching frequency \(f_{sw}\) is the carrier rate of the three-phase two-level inverter.

\[ T_s=\frac{1}{f_s},\qquad T_{sw}=\frac{1}{f_{sw}}. \]

The two frequencies are often equal, but they do not have to be. This release uses an average-value inverter model. Therefore \(f_{sw}\) is stored as part of the system definition, while PWM ripple is not injected into the current waveform or pole calculation.

The continuous-time PMSM current plant

\(R_s\) is the stator phase resistance represented in the dq equations. \(L_d\) and \(L_q\) are the d- and q-axis inductances. With \(\mathbf i_{dq}=[i_d\;i_q]^T\) and \(\mathbf u_{dq}=[u_d\;u_q]^T\), the electrical model is

\[ \dot{\mathbf i}_{dq}=A_c(\omega_e)\mathbf i_{dq}+B_c\mathbf u_{dq}+\mathbf d_{\mathrm{emf}}, \] \[ A_c(\omega_e)= \begin{bmatrix} -\dfrac{R_s}{L_d} & \dfrac{\omega_eL_q}{L_d}\\[7pt] -\dfrac{\omega_eL_d}{L_q} & -\dfrac{R_s}{L_q} \end{bmatrix},\qquad B_c= \begin{bmatrix} \dfrac{1}{L_d} & 0\\[7pt] 0 & \dfrac{1}{L_q} \end{bmatrix}, \] \[ \mathbf d_{\mathrm{emf}}= \begin{bmatrix}0\\-\dfrac{\omega_e\psi_f}{L_q}\end{bmatrix}. \]

The back-EMF is an affine disturbance. At a fixed operating point it changes the equilibrium voltage, but it does not change the eigenvalues of the linear current-state model.

Inverter, delay and exact discretization

The exact zero-order-hold state transition is

\[ A_d=e^{A_cT_s}. \]

The voltage is held in the stator frame while the dq frame rotates. LoopForge obtains the exact input matrix from the upper-right block of a Van Loan exponential:

\[ \exp\!\left( \begin{bmatrix} A_c & B_c\\ 0 & -\omega_eJ \end{bmatrix}T_s \right) = \begin{bmatrix} A_d & \Xi\\ 0 & e^{-\omega_eJT_s} \end{bmatrix},\qquad J=\begin{bmatrix}0&-1\\1&0\end{bmatrix}. \] \[ B_d=\Xi e^{J\phi},\qquad \phi=\phi_{\mathrm{fw}}-\omega_eT_d. \]

Separately, both closed-loop structures contain the explicit delayed-voltage state

\[ \mathbf u[k-1]=z^{-1}\mathbf u[k]. \]

The firmware angle advance is calculated from the estimated delay. Therefore an error in \(\hat T_d\) creates a residual dq-angle error that grows with electrical speed.

Delay-aware synthesis

The applied voltage from the previous update is augmented as a state:

\[ \mathbf x_a[k]= \begin{bmatrix} \mathbf i[k]\\ \mathbf u[k-1] \end{bmatrix}. \] \[ \mathbf u[k]=K_t\mathbf r[k]+\boldsymbol\xi[k]-K_1\mathbf i[k]-K_2\mathbf u[k-1], \] \[ \boldsymbol\xi[k+1]=\boldsymbol\xi[k]+K_i\bigl(\mathbf r[k]-\mathbf i[k]\bigr). \]

The desired per-axis response is parameterized by

\[ H(z)=\frac{1-\beta}{z(z-\beta)},\qquad \beta=e^{-\alpha_{cc}T_s}, \] \[ \alpha_{cc}\leq\frac{\tfrac{\pi}{2}-PM_{\mathrm{req}}}{T_\rho}. \]

The gains are computed in closed form using direct discrete-time pole placement in the style of Hinkkanen et al., IEEE Transactions on Industry Applications, 2016.

The IMC PI baseline

The comparison controller uses the continuous-time IMC rules

\[ K_p=\alpha\hat L,\qquad K_i=\alpha\hat R_s,\qquad \alpha=\frac{\ln 9}{t_r}, \]

with \(\omega_e\hat L\) decoupling and a forward-Euler integrator. The physical delay remains in the true plant, but it is ignored while the PI gains are designed.

Stability is measured using the spectral radius of the six-state closed loop:

\[ \rho(A_{cl})=\max_j\left|\lambda_j(A_{cl})\right|, \qquad \rho(A_{cl})<1\;\Longleftrightarrow\;\text{discrete-time stability}. \]

Verification

Every engine release is checked by an independent Python/scipy implementation that recomputes the discretization, gains, closed-loop eigenvalues, DC tracking and stability sweeps. Discretization and gains agree to approximately \(10^{-9}\) or better, and eigenvalues to approximately \(10^{-7}\). The verification is included in verify/.

Simulation boundary

Included in the present simulation
  • \(R_s\), \(L_d\), \(L_q\), saliency and dq cross-coupling
  • exact ZOH discretization and stator-frame voltage hold
  • sampled current control, the \(z^{-1}\) voltage state and the \(T_d\) angle effect
  • parameter/delay mismatch, speed sweeps, poles and linear step responses
Not yet included
  • individual IGBT/MOSFET switching pulses and PWM ripple
  • DC-link saturation, dead time, device voltage drops and nonlinear current limiting
  • magnetic saturation, temperature drift, sensor noise and quantization
  • mechanical dynamics, torque loop, field weakening and MTPA logic
Questions or corrections

Discuss a public technical topic

A short, non-confidential email about the model, mathematics or educational simulation is welcome.