Part 1 / 第一部分 (30 分)
坐标系、旋转与物理矢量 / Coordinate Frames, Rotation, and Physical Vectors
1.1 圆周运动的坐标表示 / Coordinates of Circular Motion
设质点 $P$ 在半径为 $r$ 的圆上做匀速圆周运动,角速度为 $\omega$。
Task 1.1
在静止笛卡尔坐标系 $(\alpha, \beta)$ 下,写出 $P$ 的坐标 $(p_\alpha(t),\; p_\beta(t))$。
将 $P$ 的位置投影到圆的一条直径上(取 $\alpha$ 轴),写出该投影的表达式。指出这是一个什么样的运动(正弦/余弦振动)。
现在建立一个与 $P$ 同步旋转的坐标系 $(d, q)$,其 $d$ 轴始终指向 $P$。在该旋转坐标系下,$P$ 的坐标是什么?与 (a) 对比,哪个更简单?
1.2 物理矢量与坐标无关性 / Physical Vectors are Frame-Independent
一个物理矢量 $\hat{\vec{p}}$(上标 hat 表示不指定坐标系)在不同坐标系下有不同的坐标分量,但它代表的物理实体不变。例如:
- 在静止 $\alpha\beta$ 系下:$\vec{p}^s = \begin{bmatrix} p_\alpha \\ p_\beta \end{bmatrix}$
- 在旋转 $dq$ 系下:$\vec{p}^r = \begin{bmatrix} p_d \\ p_q \end{bmatrix}$
两者通过旋转矩阵 $\mathbf{R}(\theta)$ 相连:$\vec{p}^r = \mathbf{R}(-\theta)\,\vec{p}^s$。
Task 1.2
写出 $2\times2$ 旋转矩阵 $\mathbf{R}(\theta)$,并验证 $\mathbf{R}(-\theta) = \mathbf{R}^T(\theta)$。
用 Task 1.1(a) 的结果验证:将 $\alpha\beta$ 坐标通过 $\mathbf{R}(-\omega t)$ 变换到 $dq$ 系后,是否得到 Task 1.1(c) 的结果。
1.3 旋转坐标系中的求导算子 / Derivative Operator in a Rotating Frame
物理定律(如牛顿定律、法拉第定律)写成矢量形式时,应在任何坐标系下都成立。但如果我们在旋转坐标系中对坐标分量直接求时间导数 $\frac{d}{dt}$,会丢掉坐标系本身的旋转贡献。
Task 1.3 — 惯性力的例子 / Inertial Force Example
设一个麦克风放在桌上。桌子相对于墙是静止的。定义:
- 墙为参考原点,麦克风到桌子边缘的距离为 $Y$,桌子到墙的距离为 $X$
- 麦克风相对墙的绝对位置 = $X + Y$
若桌子("旋转坐标系"的类比)以速度 $v$ 移动,在桌子的参考系中麦克风静止($\dot{Y}=0$)。写出麦克风在墙参考系中的加速度。指出"桌子在动"带来的额外项对应什么力(惯性力 / inertial force)。
推广到旋转坐标系:一个矢量 $\hat{\vec{p}}$ 在角速度 $\omega$ 的旋转系下,其坐标分量的"绝对导数"(在惯性系中的导数)与"相对导数"(直接对旋转系坐标求导)之间的关系是什么?写出修正后的求导算子。
结论预告 / Key Result: 在角速度 $\omega$ 的旋转坐标系中,对物理矢量用复数表示时,求导算子需修正为:
$$\frac{d}{dt}\bigg|_{\text{inertial}} = \frac{d}{dt}\bigg|_{\text{rotating}} + j\omega$$
即 Laplace 算子 $s \to s + j\omega$。这保证了牛顿定律与法拉第定律在旋转系下仍然成立。
Task 1.4 — 反电动势的例子 / Back-EMF Example
法拉第电磁感应定律:$e = -\frac{d\psi}{dt}$(感应电压 = 磁链的时间导数取负)。
在经典力学中,力 $F = m\ddot{x}$ 是位置的二阶导数。对应到电机电路中,反电动势(back-EMF)$e = -\frac{d\psi}{dt}$ 是磁链的一阶导数。解释为什么"力 ↔ 反电动势"是一对类比。
如果磁链矢量 $\hat{\vec{\psi}}$ 在旋转系下的分量为 $(\psi_d,\, \psi_q)$,利用 Task 1.3 的修正算子,写出反电动势在旋转系下的表达式。指出多出来的 $j\omega\vec{\psi}$ 项的物理含义(速度电动势 / speed EMF)。
Part 4 / 第四部分 (20 分)
综合推导:写出五条 ODE / Putting It All Together: Derive the 5 ODEs
现在你已经掌握了所有工具:旋转坐标系、修正求导算子 $\frac{d}{dt} + j\omega$、磁链、KVL。
Task 4.1 — 电压方程推导
从 Part 3 的 KVL 出发,将电压方程写成磁链形式:$u = R_s\,i + \frac{d\psi}{dt}$。
将上式变换到以角速度 $\omega_\text{syn}$ 旋转的 $dq$ 坐标系,利用修正求导算子,写出 $dq$ 系下的电压方程(分 $d$ 轴和 $q$ 轴两条)。
引入 active flux 定义 $\psi_\text{AF} = \psi_d - L_q\,i_D$,将 (b) 的结果重写为以 $(\psi_\text{AF},\, i_D,\, i_Q)$ 为状态变量的形式。解出 $\frac{di_D}{dt}$ 和 $\frac{di_Q}{dt}$——这就是代码中的 $\dot{x}[3]$ 和 $\dot{x}[4]$。
Task 4.2 — Active flux 动力学
对于 PMSM($R_\text{req} = 0$),从 $\psi_\text{AF} = (L_d - L_q)\,i_D + \psi_\text{PM}$ 直接求导,写出 $\frac{d\psi_\text{AF}}{dt}$——这是代码中 $\dot{x}[2]$ 的 PMSM 分支。
对于 IM($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}$——这是 $\dot{x}[2]$ 的 IM 分支。
Task 4.3 — 机械方程
写出转矩方程 $T_\text{em} = \frac{3}{2}\,n_\text{pp}\,\psi_\text{AF}\,i_Q$。
写出牛顿第二定律的旋转形式:$J_s \frac{d\omega_\text{mech}}{dt} = T_\text{em} - T_\text{load}$——这是 $\dot{x}[1]$。
写出 $\frac{d\theta_\text{mech}}{dt} = \omega_\text{mech} + \frac{\omega_\text{slip}}{n_\text{pp}}$——这是 $\dot{x}[0]$。解释 IM 的滑差项 $\omega_\text{slip} = \frac{R_\text{req}\,i_Q}{\psi_\text{AF}}$ 为什么对 PMSM 为零。
恭喜!/ Congratulations! 完成 Task 4.1–4.3 后,你已经从零推导出了代码中 DYNAMICS_MACHINE 函数的全部 5 条 ODE:$\dot{x}[0] \sim \dot{x}[4]$。这就是统一 AC 电机模型的完整数学基础。
English Version
Homework 1 in English
In our simulation code, the motor model is described by five ordinary differential equations (ODEs):
$$\dot{x}[0],\;\dot{x}[1],\;\dot{x}[2],\;\dot{x}[3],\;\dot{x}[4]$$
They correspond to the time derivatives of $\theta_\text{mech}$, $\omega_\text{mech}$, $\psi_\text{AF}$ (KA), $i_D$, and $i_Q$, respectively. By choosing different parameters ($R_\text{req}$, $\psi_\text{PM}$, $L_d$, $L_q$), the same set of equations can describe SPM, IPMSM, SynRM, and IM.
This homework asks you to start from nothing and derive these five equations step by step.
Why write differential equations?
If you place a microphone on a table, you can directly see its position. But the internal states of a motor, such as current and flux linkage, are not visible. We write differential equations in order to use mathematics to predict those invisible states, and only then can we control them. This is one of the core ideas of the course.
Part 1. Coordinate Frames, Rotation, and Physical Vectors
1.1 Coordinates of Circular Motion
Let a point $P$ move on a circle of radius $r$ with constant angular speed $\omega$.
Task 1.1
In the stationary Cartesian frame $(\alpha, \beta)$, write the coordinates of $P$ as $(p_\alpha(t),\; p_\beta(t))$.
Project the position of $P$ onto one diameter of the circle, taking the $\alpha$ axis. Write the expression of this projection and state what kind of motion it is (sine/cosine vibration).
Now introduce a coordinate frame $(d, q)$ that rotates synchronously with $P$, with the $d$ axis always pointing toward $P$. What are the coordinates of $P$ in this rotating frame? Compared with part (a), which description is simpler?
1.2 Physical Vectors are Frame-Independent
A physical vector $\hat{\vec{p}}$ (the hat means that no coordinate frame is specified) has different coordinate components in different frames, but the physical entity it represents does not change. For example:
- In the stationary $\alpha\beta$ frame: $\vec{p}^s = \begin{bmatrix} p_\alpha \\ p_\beta \end{bmatrix}$
- In the rotating $dq$ frame: $\vec{p}^r = \begin{bmatrix} p_d \\ p_q \end{bmatrix}$
The two are connected by the rotation matrix $\mathbf{R}(\theta)$: $\vec{p}^r = \mathbf{R}(-\theta)\,\vec{p}^s$.
Task 1.2
Write the $2\times2$ rotation matrix $\mathbf{R}(\theta)$ and verify that $\mathbf{R}(-\theta) = \mathbf{R}^T(\theta)$.
Using the result of Task 1.1(a), verify whether transforming the $\alpha\beta$ coordinates to the $dq$ frame through $\mathbf{R}(-\omega t)$ gives the same result as Task 1.1(c).
1.3 Derivative Operator in a Rotating Frame
When physical laws such as Newton's law and Faraday's law are written in vector form, they should remain valid in any coordinate frame. However, if we directly take the time derivative $\frac{d}{dt}$ of the coordinate components in a rotating frame, we lose the contribution caused by the rotation of the frame itself.
Task 1.3 - Inertial Force Example
Suppose a microphone is placed on a table. The table is stationary relative to the wall. Define:
- The wall as the reference origin, the distance from the microphone to the edge of the table as $Y$, and the distance from the table to the wall as $X$.
- The absolute position of the microphone relative to the wall as $X + Y$.
If the table, which plays the role of the "rotating frame" in this analogy, moves with speed $v$, while the microphone is stationary in the table frame ($\dot{Y}=0$), write the acceleration of the microphone in the wall frame. Identify what force the extra term caused by the moving table corresponds to (inertial force).
Generalize this result to a rotating frame: for a vector $\hat{\vec{p}}$ in a frame rotating at angular speed $\omega$, what is the relation between its "absolute derivative" (in the inertial frame) and its "relative derivative" (taking the derivative of the rotating-frame coordinates directly)? Write the corrected derivative operator.
Key Result: In a rotating frame with angular speed $\omega$, if a physical vector is represented in complex form, the derivative operator must be corrected to
$$\frac{d}{dt}\bigg|_{\text{inertial}} = \frac{d}{dt}\bigg|_{\text{rotating}} + j\omega$$
that is, the Laplace operator changes from $s$ to $s + j\omega$. This is what guarantees that Newton's law and Faraday's law remain valid in the rotating frame.
Task 1.4 - Back-EMF Example
Faraday's law of electromagnetic induction is $e = -\frac{d\psi}{dt}$ (induced voltage equals the negative time derivative of flux linkage).
In classical mechanics, force $F = m\ddot{x}$ is the second derivative of position. In motor circuits, back-EMF $e = -\frac{d\psi}{dt}$ is the first derivative of flux linkage. Explain why "force <-> back-EMF" is a useful analogy.
If the flux-linkage vector $\hat{\vec{\psi}}$ has components $(\psi_d,\, \psi_q)$ in the rotating frame, use the corrected operator from Task 1.3 to write the back-EMF expression in that frame. State the physical meaning of the extra $j\omega\vec{\psi}$ term (speed EMF).
Part 2. From Field to Circuit: Flux and Flux Linkage
2.1 Magnetic Flux is a Field Quantity
Magnetic flux $\Phi$ is the surface integral of the magnetic flux density $\vec{B}$ over a cross-section $S$:
$$\Phi = \iint_S \vec{B} \cdot d\vec{A}$$
This is a concept from the field description because it depends on spatial distribution. In circuit analysis, however, we do not want to handle spatial integrals; we want all quantities to be functions of time.
2.2 Definition of Flux Linkage
For a coil with $N$ turns, flux linkage is defined as
$$\psi = N \Phi = L \, i$$
where $L$ is the inductance and $i$ is the current. Flux linkage $\psi$ is a purely circuit-level quantity with unit Wb (weber). It compresses the field information into a scalar quantity that depends only on time.
Task 2.1
Explain why circuit analysis prefers flux linkage $\psi$ rather than magnetic flux density $\vec{B}$. Hint: differential equations need time-domain quantities.
Faraday's law in terms of flux linkage is $u = \frac{d\psi}{dt}$, ignoring the sign convention. If $\psi = L\,i$ and $L$ is constant, write the expression of $u$ in terms of $i$.
If the inductance $L$ is not constant, for example if it varies with rotor position, how many terms appear when you expand $u = \frac{d(Li)}{dt}$? Which term corresponds to back-EMF?
Part 3. Equivalent Circuit and Kirchhoff's Laws
3.1 Single-Phase Equivalent Circuit
Consider one stator phase winding of the motor. Its equivalent circuit contains:
- Voltage source $u$: the terminal voltage applied by the inverter
- Resistance $R_s$: the copper resistance of the winding
- Leakage inductance $L_\sigma$: the inductance associated with leakage flux that does not link the rotor
- Magnetizing inductance $L_m$: the inductance associated with the main flux path that links the rotor, whether through magnets or an induction cage
Task 3.1
Draw this single-phase equivalent circuit. Label $u$, $R_s$, $L_\sigma$, $L_m$, together with the branch currents and flux linkages.
Write the KVL equation for this circuit. State the physical meaning of each term: resistive voltage drop, induced voltage of the leakage flux linkage, and induced voltage/back-EMF of the main flux linkage.
Explain the physical difference between $L_\sigma$ and $L_m$. Which one corresponds to the flux path that does not link the rotor, and which one corresponds to the flux path that links the permanent magnets or rotor windings?
3.2 From Three Phases to a Vector: The KCL Constraint
The motor has three stator windings, phases A, B, and C, with currents $i_A$, $i_B$, and $i_C$.
Task 3.2
If the three-phase windings share a neutral point in a star connection, write the KCL constraint: $i_A + i_B + i_C = \;?$
This constraint means that the three current components are not independent; they are confined to a two-dimensional plane in three-dimensional space. Explain why a two-dimensional vector $\vec{i}^s = \begin{bmatrix} i_\alpha \\ i_\beta \end{bmatrix}$ is enough to represent the three-phase current equivalently.
What is the connection between the $\alpha\beta \to dq$ coordinate transformation and the circular-motion example in Part 1? Why does choosing a rotating frame simplify the motor differential equations?
Hint: Recall that in Part 1 the coordinates of a point moving in a circle are sinusoidal in the $\alpha\beta$ frame, but become constants in the synchronously rotating $dq$ frame. In steady state, the three-phase motor currents are also sinusoidal. Without a coordinate transformation, products of sinusoidal terms appear in the voltage equations, creating modulation and making the model highly nonlinear. A proper rotating frame turns sinusoids into constants and simplifies the equations greatly.
Part 4. Putting It All Together: Derive the 5 ODEs
You now have all the required tools: rotating coordinates, the corrected derivative operator $\frac{d}{dt} + j\omega$, flux linkage, and KVL.
Task 4.1 - Derivation of the Voltage Equations
Starting from the KVL equation in Part 3, rewrite the voltage equation in flux-linkage form: $u = R_s\,i + \frac{d\psi}{dt}$.
Transform the above equation into the rotating $dq$ frame with angular speed $\omega_\text{syn}$. Using the corrected derivative operator, write the voltage equations in the $dq$ frame, one for the $d$ axis and one for the $q$ axis.
Introduce the active-flux definition $\psi_\text{AF} = \psi_d - L_q\,i_D$. Rewrite the result of part (b) in terms of the state variables $(\psi_\text{AF},\, i_D,\, i_Q)$. Solve for $\frac{di_D}{dt}$ and $\frac{di_Q}{dt}$. These are exactly $\dot{x}[3]$ and $\dot{x}[4]$ in the code.
Task 4.2 - Active-Flux Dynamics
For PMSM ($R_\text{req} = 0$), start directly from $\psi_\text{AF} = (L_d - L_q)\,i_D + \psi_\text{PM}$ and derive $\frac{d\psi_\text{AF}}{dt}$. This is the PMSM branch of $\dot{x}[2]$ in the code.
For IM ($R_\text{req} > 0$), explain why $\psi_\text{AF}$ becomes an independent dynamic variable, and write $\frac{d\psi_\text{AF}}{dt} = R_\text{req}\,i_D - \frac{R_\text{req}}{L_d - L_q}\psi_\text{AF}$. This is the IM branch of $\dot{x}[2]$.
Task 4.3 - Mechanical Equations
Write the torque equation $T_\text{em} = \frac{3}{2}\,n_\text{pp}\,\psi_\text{AF}\,i_Q$.
Write Newton's second law in rotational form: $J_s \frac{d\omega_\text{mech}}{dt} = T_\text{em} - T_\text{load}$. This is $\dot{x}[1]$.
Write $\frac{d\theta_\text{mech}}{dt} = \omega_\text{mech} + \frac{\omega_\text{slip}}{n_\text{pp}}$. This is $\dot{x}[0]$. Explain why the IM slip term $\omega_\text{slip} = \frac{R_\text{req}\,i_Q}{\psi_\text{AF}}$ becomes zero for PMSM.
Congratulations! After completing Tasks 4.1 to 4.3, you will have derived from scratch all five ODEs used in the code inside the DYNAMICS_MACHINE function, namely $\dot{x}[0] \sim \dot{x}[4]$. This is the complete mathematical foundation of the unified AC machine model.