Lecture 2

Unified AC Machine Modeling via Active Flux

用 Active Flux(有效磁链)概念统一建模感应电机与永磁电机
A single set of ODEs for IM, PMSM, IPMSM, and SynRM

Introduction / 引言

传统上,感应电机(IM)和永磁同步电机(PMSM)使用不同的数学模型来描述。Active Flux(有效磁链)的概念提供了一种统一的视角:定义一个新的磁链状态变量 $\psi_\text{AF}$(代码中记作 KA),使得所有交流电机的转矩方程、电压方程和机械动力学方程共享相同的数学结构。

Traditionally, IM and PMSM require separate mathematical models. The active flux concept unifies them: by defining a single flux state variable $\psi_\text{AF}$ (denoted KA in code), all AC machine types share the same ODE structure. The only difference is in the parameters.

核心思想 / Key Insight: Active flux 是与转子d轴始终对齐的磁链分量,其幅值不受q轴电流影响。对于所有交流电机,电磁转矩可统一表示为 $T_\text{em} = \tfrac{3}{2} n_\text{pp} \cdot \psi_\text{AF} \cdot i_Q$。

Active flux 的定义(definition of active flux):

$$\psi_\text{AF} = \psi_d - L_q \, i_D = (L_d - L_q) \, i_D + \psi_\text{PM}$$
(1)

其中 $\psi_d$ 是 d 轴总磁链,$L_q$ 是 q 轴电感,$\psi_\text{PM}$ 是永磁体磁链(代码中记为 KE)。这个定义对所有交流电机类型都成立——区别仅在于参数取值。

The Unified dq-Frame Model / 统一dq坐标模型

统一模型使用 5 个状态变量(5 state variables):

$$\mathbf{x} = \begin{bmatrix} \theta_\text{mech} \\ \omega_\text{mech} \\ \psi_\text{AF} \\ i_D \\ i_Q \end{bmatrix}$$
(2)
StateSymbol说明 / Description
$x_0$$\theta_\text{mech}$机械转子位置角 / Mechanical rotor angle
$x_1$$\omega_\text{mech}$机械转子角速度 / Mechanical rotor speed
$x_2$$\psi_\text{AF}$ (KA)Active flux / 有效磁链
$x_3$$i_D$d 轴定子电流 / d-axis stator current
$x_4$$i_Q$q 轴定子电流 / q-axis stator current

2.1 Voltage Equations / 电压方程

在 dq 旋转坐标系下,定子电压方程为:

$$u_D = R_s \, i_D + \frac{d\psi_\text{AF}}{dt} + L_q \frac{di_D}{dt} - \omega_\text{syn} L_q \, i_Q$$
(3a)
$$u_Q = R_s \, i_Q + L_q \frac{di_Q}{dt} + \omega_\text{syn} \psi_\text{AF}$$
(3b)

其中 $R_s$ 是定子电阻,$\omega_\text{syn}$ 是同步角速度(synchronous angular velocity),$L_q$ 是 q 轴电感。

从电压方程 (3) 可以解出电流微分方程(rearranged for simulation):

$$\frac{di_D}{dt} = \frac{1}{L_q}\left(u_D - R_s i_D + \omega_\text{syn} L_q i_Q - \frac{d\psi_\text{AF}}{dt}\right)$$
(4a)
$$\frac{di_Q}{dt} = \frac{1}{L_q}\left(u_Q - R_s i_Q - \omega_\text{syn} \psi_\text{AF}\right)$$
(4b)
注意 / Note: 方程 (4a) 中包含 $d\psi_\text{AF}/dt$,其具体形式取决于电机类型(PMSM vs IM),这是统一模型中唯一需要分支处理的地方。

2.2 Active Flux Dynamics / 有效磁链动力学

对于 PMSM($R_\text{req} = 0$):永磁体磁链 $\psi_\text{PM}$ 恒定,因此:

$$\frac{d\psi_\text{AF}}{dt} = (L_d - L_q)\frac{di_D}{dt} \quad \text{(PMSM)}$$
(5a)

代入 (4a) 可得 PMSM 的 $di_D/dt$ 用 $L_d$ 而非 $L_q$ 作分母。

对于 IM($R_\text{req} > 0$):active flux 是一个独立的动态状态:

$$\frac{d\psi_\text{AF}}{dt} = R_\text{req} \, i_D - \frac{R_\text{req}}{L_d - L_q} \psi_\text{AF} \quad \text{(IM)}$$
(5b)

这里 $R_\text{req}$ 是等效转子电阻(equivalent rotor resistance),对于感应电机 $R_\text{req} > 0$,而 $\psi_\text{PM} = 0$(无永磁体)。

2.3 Torque Equation / 转矩方程

统一转矩方程(unified across all machine types):

$$T_\text{em} = \frac{3}{2} \, n_\text{pp} \, \psi_\text{AF} \, i_Q$$
(6)

其中 $n_\text{pp}$ 是极对数(number of pole pairs),$\frac{3}{2}$ 来自 Clarke 变换增益。

2.4 Mechanical Dynamics / 机械动力学

$$\frac{d\theta_\text{mech}}{dt} = \omega_\text{mech} + \frac{\omega_\text{slip}}{n_\text{pp}}$$
(7a)
$$\frac{d\omega_\text{mech}}{dt} = \frac{T_\text{em} - T_\text{load}}{J_s}$$
(7b)

其中滑差角速度 $\omega_\text{slip}$(slip angular velocity):

$$\omega_\text{slip} = \begin{cases} \dfrac{R_\text{req} \, i_Q}{\psi_\text{AF}} & \text{(IM, } R_\text{req} > 0\text{)} \\ 0 & \text{(PMSM/SynRM, } R_\text{req} = 0\text{)} \end{cases}$$
(8)

2.5 Synchronous Speed / 同步转速

同步电角速度(electrical synchronous speed):

$$\omega_\text{syn} = n_\text{pp} \cdot \omega_\text{mech} + \omega_\text{slip}$$
(9)

Specialization to Machine Types / 各类电机的特殊化

统一模型通过 4 个参数区分不同电机类型:$R_\text{req}$(等效转子电阻)、$\psi_\text{PM}$(永磁磁链,代码中 KE)、$L_d$ 和 $L_q$。

Machine Type$R_\text{req}$$\psi_\text{PM}$ (KE)$L_d$ vs $L_q$KA 特征
SPM (表贴式永磁)$0$$> 0$$L_d = L_q$$\psi_\text{AF} = \psi_\text{PM}$ (constant)
IPMSM (内置式永磁)$0$$> 0$$L_d < L_q$$\psi_\text{AF} = (L_d{-}L_q)i_D + \psi_\text{PM}$
SynRM (磁阻电机)$0$$0$$L_d > L_q$$\psi_\text{AF} = (L_d{-}L_q)i_D$
IM (感应电机)$> 0$$0$$L_d = L_q$Dynamic state (独立动态变量)

3.1 SPM — Surface-Mount PMSM / 表贴式永磁电机

最简单的情况。$L_d = L_q$ 意味着 $(L_d - L_q) = 0$,因此:

$$\psi_\text{AF} = \psi_\text{PM} = \text{const}, \quad \frac{d\psi_\text{AF}}{dt} = 0$$

没有磁阻转矩分量(no reluctance torque),$di_D/dt$ 的分母直接用 $L_d$($= L_q$),模型最为简洁。

3.2 IPMSM — Interior PMSM / 内置式永磁电机

由于转子凸极性(saliency),$L_d \neq L_q$,active flux 包含磁阻分量:

$$\psi_\text{AF} = (L_d - L_q) i_D + \psi_\text{PM}$$

$\frac{d\psi_\text{AF}}{dt} = (L_d - L_q)\frac{di_D}{dt}$,代入 (4a) 后,$di_D/dt$ 的分母变为 $L_d$:

$$\frac{di_D}{dt} = \frac{1}{L_d}\left(u_D - R_s i_D + \omega_\text{syn} L_q i_Q\right)$$

这里的 reluctance torque(磁阻转矩)已隐含在 $\psi_\text{AF} \cdot i_Q$ 的乘积中。

3.3 SynRM — Synchronous Reluctance Machine / 同步磁阻电机

$\psi_\text{PM} = 0$,纯粹靠凸极性产生转矩:

$$\psi_\text{AF} = (L_d - L_q) i_D, \quad T_\text{em} = \frac{3}{2} n_\text{pp} (L_d - L_q) i_D \, i_Q$$

若 $i_D = 0$,则 $\psi_\text{AF} = 0$,无法产生转矩。SynRM 必须维持非零 $i_D$。

3.4 IM — Induction Machine / 感应电机

感应电机没有永磁体($\psi_\text{PM} = 0$),且有转子电阻($R_\text{req} > 0$)。此时 $\psi_\text{AF}$ 不再由电流直接决定,而是一个独立的动态状态

$$\frac{d\psi_\text{AF}}{dt} = R_\text{req} i_D - \frac{R_\text{req}}{L_d - L_q} \psi_\text{AF}$$

物理含义:$\psi_\text{AF}$ 通过 d 轴励磁电流 $i_D$ 建立(第一项),同时因转子电阻而衰减(第二项)。这就是为什么 IM 需要持续提供 $i_D$ 来维持磁场。

IM 的滑差 / Slip: 感应电机需要滑差才能感应转子电流。在 active flux 框架下,$\omega_\text{slip} = R_\text{req} \cdot i_Q / \psi_\text{AF}$,同步角速度 $\omega_\text{syn} = n_\text{pp} \omega_\text{mech} + \omega_\text{slip}$。

注意:对于 IM,通常 $L_d = L_q$(无凸极性),此时需将 $L_d - L_q$ 理解为等效参数(sigma leakage 相关),在代码中仍保持 $L_d \neq L_q$ 的通用形式。

Equation-to-Code Mapping / 方程与代码的对应

以下伪代码展示了统一模型的数值仿真实现。实际代码使用 Numba jitclass 加速,但数学结构完全一致。

4.1 State Variables / 状态变量定义

# State vector x[5] theta_mech = x[0] # mechanical rotor angle [rad] omega_mech = x[1] # mechanical rotor speed [rad/s] KA = x[2] # active flux psi_AF [Wb] iD = x[3] # d-axis stator current [A] iQ = x[4] # q-axis stator current [A]

4.2 Parameters / 参数

# Machine parameters npp = 4 # pole pairs R = 1.5 # stator resistance Rs [Ohm] Ld = 5e-3 # d-axis inductance [H] Lq = 6e-3 # q-axis inductance [H] KE = 0.095 # PM flux psi_PM [Wb] (0 for IM/SynRM) Rreq = 0.0 # equiv. rotor resistance [Ohm] (0 for PMSM/SynRM) Js = 0.001 # rotor inertia [kg*m^2]

4.3 ODE Function / 微分方程函数

def dynamics(x, uD, uQ, TLoad): # Unpack states theta, omega, KA, iD, iQ = x # Slip and synchronous speed if Rreq > 0: # IM omega_slip = Rreq * iQ / KA else: # PMSM / SynRM omega_slip = 0.0 omega_syn = npp * omega + omega_slip # Torque: Eq. (6) Tem = 1.5 * npp * KA * iQ # Active flux dynamics: Eq. (5) if Rreq > 0: # IM — KA is independent state dKA = Rreq * iD - Rreq / (Ld - Lq) * KA diD = (uD - R*iD + omega_syn*Lq*iQ - dKA) / Lq else: # PMSM — dKA = (Ld-Lq)*diD diD = (uD - R*iD + omega_syn*Lq*iQ) / Ld dKA = (Ld - Lq) * diD # q-axis current: Eq. (4b) diQ = (uQ - R*iQ - omega_syn*KA) / Lq # Mechanical: Eq. (7) dtheta = omega + omega_slip / npp domega = (Tem - TLoad) / Js return [dtheta, domega, dKA, diD, diQ]

4.4 Numerical Integration / 数值积分

使用四阶 Runge-Kutta(RK4)方法对上述 ODE 进行积分:

def rk4_step(x, uD, uQ, TLoad, dt): k1 = dynamics(x, uD, uQ, TLoad) k2 = dynamics(x + dt/2 * k1, uD, uQ, TLoad) k3 = dynamics(x + dt/2 * k2, uD, uQ, TLoad) k4 = dynamics(x + dt * k3, uD, uQ, TLoad) return x + (dt/6) * (k1 + 2*k2 + 2*k3 + k4)

每个控制周期内调用若干次 rk4_step,以较小的步长(如 $h_s = 1\,\mu\text{s}$)积分电机模型。

4.5 Variable Mapping Summary / 变量对照表

Math SymbolCode Variable说明
$\psi_\text{AF}$KA or x[2]Active flux
$\psi_\text{PM}$KEPM flux constant
$R_s$RStator resistance
$R_\text{req}$RreqEquiv. rotor resistance
$n_\text{pp}$nppPole pairs
$J_s$JsRotor inertia
$\omega_\text{mech}$omega_r_mech or x[1]Mechanical speed
$\omega_\text{syn}$omega_synSynchronous elec. speed
$T_\text{em}$TemElectromagnetic torque

Quiz / 测验

回答以下 12 道选择题。Answer the following 12 multiple-choice questions.