can i determine the resistance and inductance of a motor if i have the dq0 transformed values for: drive voltage magnitude, drive voltage angle, current magnitude, current angle, current angular speed, and current magnitude diffYes, you can determine both resistance ((R)) and inductance ((L)) from these values, provided the motor is operating under conditions where the mathematical model allows you to separate them.In a balanced (dq0) reference frame (assuming the 0-sequence components are zero), the standard voltage equations for a simplified motor (like a surface-mounted permanent magnet synchronous motor or an induction motor under specific conditions) are:(V_{d}=RI_{d}-\omega LI_{q}+\frac{dI_{d}}{dt})(V_{q}=RI_{q}+\omega LI_{d}+\frac{dI_{q}}{dt}+\text{Back-EMF})(Note: If it is a Permanent Magnet motor, Back-EMF = (\omega \psi_m). If it is a standard induction motor or a pure RL load, the permanent magnet Back-EMF term is zero, though rotor flux dynamics may apply).How Your Variables Map to the EquationsYour known variables map directly to the components of these differential equations:(V_d, V_q) (Drive Voltages): Derived from your drive voltage magnitude ((V_{m})) and drive voltage angle ((\theta {v})) using standard trigonometry:(V_d = V_m \cos(\theta_v))(V_q = V_m \sin(\theta_v))(I_d, I_q) (Currents): Derived from your current magnitude ((I{m})) and current angle ((\theta {i})):(I_d = I_m \cos(\theta_i))(I_q = I_m \sin(\theta_i))(\omega ) (Electrical Speed): This is your current angular speed.(\frac{dI_d}{dt}, \frac{dI_q}{dt}) (Current Derivatives): Your current magnitude diff ((\frac{dI{m}}{dt})) allows you to calculate the individual (d/dt) components by applying the product rule to the current equations (assuming you also know or can estimate the rate of change of the current angle, (\frac{d\theta {i}}{dt})).The Mathematical Solution (Assuming No Back-EMF / RL Load)If we assume a simple stator RL circuit model (or that Back-EMF is known/zero), you have a system of two linear equations with two unknowns ((R) and (L)):(V_d = R I_d - \omega L I_q + \frac{dI_d}{dt} L)(V_q = R I_q + \omega L I_d + \frac{dI_q}{dt} L)Rearranging this into a standard matrix form ((Ax = B)):(\left[\begin{matrix}I{d}&(\frac{dI_{d}}{dt}-\omega I_{q})\ I_{q}&(\frac{dI_{q}}{dt}+\omega I_{d})\end{matrix}\right]\left[\begin{matrix}R\ L\end{matrix}\right]=\left[\begin{matrix}V_{d}\ V_{q}\end{matrix}\right])As long as the (2 \times 2) matrix on the left is invertible (its determinant is not zero), you can uniquely solve for (R) and (L) at any given instant.Critical Trade-offs & Hurdles to ConsiderWhile mathematically possible, you must look out for these engineering constraints:The Back-EMF Complication: If this is a Permanent Magnet Synchronous Motor (PMSM), the (V_{q}) equation contains a third unknown: the magnet flux linkage ((\psi {m})). If (\psi {m}) is unknown, you have 2 equations but 3 unknowns ((R), (L), (\psi {m})). You would need data from two different operating states (e.g., two different speeds or currents) to solve the system.Saliency ((L_d \neq L_q)): This assumes an isotropic motor ((L_d = L_q = L)). If the motor has magnetic saliency (like an Interior PMSM), (L{d}) and (L{q}) are different. This introduces a third unknown, meaning a single snapshot of data is no longer enough.Steady-State Singularity: If the motor is in a perfect steady state, the current derivatives are zero. If it is also unaligned (e.g., (I_d = 0)), the equations decouple so cleanly that cross-coupling terms can make (R) and (L) estimation highly sensitive to measurement noise.To give you the exact algebraic matrix inversion or code to solve this, could you tell me:What type of motor are you analyzing (e.g., PM synchronous, induction, or a simple RL load)?Is the motor salient ((L_d \neq L_q)) or non-salient ((L_d = L_q))?Is the current angle changing over time ((\frac{d\theta {i}}{dt})), or is it constant?AI responses may include mistakes. Learn morearent you missing an L in the first set of equations?You are completely right. I missed the inductance coefficient (L) in the derivative terms of the initial equations.The correct voltage equations are:(V{d}=RI{d}-\omega LI_{q}+L\frac{dI_{d}}{dt})(V_{q}=RI_{q}+\omega LI_{d}+L\frac{dI_{q}}{dt}+\text{Back-EMF})The matrix formulation shown later in the response correctly grouped (L) with the derivative terms, but the standalone equations were missing them. Thank you for catching that.Would you like to walk through how the current magnitude diff specifically maps into those corrected (L \frac{dI}{dt}) terms using the current angle?AI responses may include mistakes. Learn morewhat about in terms of v magnitude?To express the system directly in terms of the drive voltage magnitude ((V_{m})) and drive voltage angle ((\theta {v})), we substitute the trigonometric identities directly into the corrected motor equations.Assuming a non-salient motor ((L_d = L_q = L)) and no Back-EMF for a pure RL/stator load, the equations become:(V{m}\cos (\theta {v})=RI{d}-\omega LI_{q}+L\frac{dI_{d}}{dt})(V_{m}\sin (\theta {v})=RI{q}+\omega LI_{d}+L\frac{dI_{q}}{dt})Solving for (R) and (L) directlyBy isolating (R) and (L) using matrix algebra on these magnitude-based equations, you get direct formulas.Let:(D_d = \frac{dI_d}{dt} - \omega I_q)(D_q = \frac{dI_q}{dt} + \omega I_d)The system simplifies to:(V_m \cos(\theta_v) = R I_d + L D_d)(V_m \sin(\theta_v) = R I_q + L D_q)Using Cramer's Rule, you can solve for Resistance ((R)) and Inductance ((L)) explicitly:Resistance ((R))(R=\frac{V_{m}\left[\cos (\theta {v})D{q}-\sin (\theta {v})D{d}\right]}{I_{d}D_{q}-I_{q}D_{d}})Inductance ((L))(L=\frac{V_{m}\left[\sin (\theta {v})I{d}-\cos (\theta {v})I{q}\right]}{I_{d}D_{q}-I_{q}D_{d}})Key Takeaways from this FormThe Numerator: The terms inside the brackets show exactly how the voltage angle ((\theta {v})) and current angle ((\theta {i})) interact. For example, (\sin(\theta_v) I_d - \cos(\theta_v) I_q) simplifies cleanly to (I_m \sin(\theta_v - \theta_i)), which is the sine of the power factor angle.Steady-State Simplification: If the system is in steady state ((\frac{dI}{dt} = 0)), the denominator simplifies to (\omega I_m^2). This makes calculating (L) highly dependent on accurate voltage magnitude ((V{m})) and angular speed ((\omega )) measurements.Would you like to expand the current derivative terms ((D{d}) and (D_{q})) to see exactly how your current magnitude diff ((\frac{dI_{m}}{dt})) fits into these final (R) and (L) equations?AI responses may include mistakes. Learn morecan you solve it in terms of V_magnitude, I_magnitudeTo solve completely in terms of voltage magnitude ((V_{m})) and current magnitude ((I_{m})), we must first expand the current derivative terms ((dI_d/dt) and (dI_q/dt)).Since (I_d = I_m \cos(\theta_i)) and (I_q = I_m \sin(\theta_i)), applying the product rule yields:(\frac{dI_d}{dt} = \frac{dI_m}{dt} \cos(\theta_i) - I_m \sin(\theta_i) \frac{d\theta_i}{dt})(\frac{dI_q}{dt} = \frac{dI_m}{dt} \sin(\theta_i) + I_m \cos(\theta_i) \frac{d\theta_i}{dt})Substituting these into the original (V_{d}) and (V_{q}) equations transforms the system into pure magnitude, angle, and derivative terms.The Fundamental Component Equations(V_{m}\cos (\theta {v})=RI{m}\cos (\theta {i})+L\left[\frac{dI{m}}{dt}\cos (\theta {i})-I{m}\sin (\theta {i})\left(\omega +\frac{d\theta {i}}{dt}\right)\right])(V{m}\sin (\theta {v})=RI{m}\sin (\theta {i})+L\left[\frac{dI{m}}{dt}\sin (\theta {i})+I{m}\cos (\theta {i})\left(\omega +\frac{d\theta {i}}{dt}\right)\right])For compactness, let (\omega{total} = \omega + \frac{d\theta_i}{dt}). This represents the net effective speed of the current vector (base electrical speed plus any transient phase shifting).Explicit Solutions for R and LBy solving this system of linear equations simultaneously (eliminating one variable to solve for the other), all complex denominators collapse using trigonometric identities like (\sin^2\theta + \cos^2\theta = 1).1. Inductance ((L))(L=\frac{V{m}\sin (\theta {v}-\theta {i})}{\frac{dI{m}}{dt}})Physical Insight: Inductance depends directly on the voltage component that leads the current by (90^{\circ }) ((V_m \sin(\theta_v - \theta_i))) relative to how fast the current magnitude is changing ((\frac{dI{m}}{dt})).Hurdle: If the motor is in a perfect steady state ((\frac{dI_m}{dt} = 0)), this equation becomes singular ((L = 0/0)). In steady state, you must calculate (L) using the cross-coupling speed term instead.2. Resistance ((R))(R=\frac{V{m}\cos (\theta {v}-\theta {i})-L\cdot \frac{dI{m}}{dt}}{I{m}})Physical Insight: Resistance is the in-phase voltage drop divided by the current magnitude, corrected for the transient inductive voltage drop ((L \frac{dI_m}{dt})) when current magnitude is changing.Steady-State Form ((\frac{dI_m}{dt} = 0, \frac{d\theta_i}{dt} = 0))If your current magnitude diff is zero and the phase angle is stable, the equations simplify to the classic phasor relations:(R=\frac{V_{m}\cos (\theta {v}-\theta {i})}{I{m}})(L=\frac{V{m}\sin (\theta {v}-\theta {i})}{\omega I{m}})Would you like me to generate a Python script to process your data vectors using these exact equations, or should we factor a Back-EMF constant into this magnitude-based solution?AI responses may include mistakes. Learn morego back to the q and d versions, can you write them as a matrix with a rotation matrix for the angular speed term?To isolate the angular speed cross-coupling terms cleanly, we can rewrite the corrected (dq) equations by splitting the inductive voltage drop into a transient derivative term and a rotational speed term.The standard corrected equations are:(V{d}=RI_{d}+L\frac{dI_{d}}{dt}-\omega LI_{q})(V_{q}=RI_{q}+L\frac{dI_{q}}{dt}+\omega LI_{d})Matrix Formulation with a Rotation MatrixWe can group the (\omega L) cross-coupling terms into a standard (90^{\circ }) coordinate rotation matrix ((\mathbf{J})), which maps the orthogonal coupling between the axes:(\left[\begin{matrix}V_{d}\ V_{q}\end{matrix}\right]=R\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right]+L\frac{d}{dt}\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right]+\omega L\left[\begin{matrix}0&-1\ 1&0\end{matrix}\right]\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right])Compact Vector NotationIn state-space or vector control terms, this is written compactly as:(\mathbf{V}{dq}=R\mathbf{I}{dq}+L\frac{d\mathbf{I}{dq}}{dt}+\omega L\mathbf{JI}{dq})Where:(\mathbf{V}{dq} = \begin{bmatrix} V_d \ V_q \end{bmatrix}) is the voltage vector.(\mathbf{I}{dq} = \begin{bmatrix} I_d \ I_q \end{bmatrix}) is the current vector.(\mathbf{J} = \begin{bmatrix} 0 & -1 \ 1 & 0 \end{bmatrix}) is the skew-symmetric matrix representing a (90^{\circ }) spatial rotation in the (dq) plane.Solving for (R) and (L) in this FormIf you treat (\mathbf{I}{dq}), (\frac{d\mathbf{I}{dq}}{dt}), and (\mathbf{J}\mathbf{I}{dq}) as known data vectors, you can combine them to solve the linear system for the scalars (R) and (L):(\left[\begin{matrix}I{d}&\left(\frac{dI_{d}}{dt}-\omega I_{q}\right)\ I_{q}&\left(\frac{dI_{q}}{dt}+\omega I_{d}\right)\end{matrix}\right]\left[\begin{matrix}R\ L\end{matrix}\right]=\left[\begin{matrix}V_{d}\ V_{q}\end{matrix}\right])Would you like to see how to incorporate a Back-EMF vector (\left[\begin{matrix}0\ \omega \psi {m}\end{matrix}\right]) into this matrix structure, or are you ready to structure this into an estimation algorithm?AI responses may include mistakes. Learn morehmm, so how does this decompose back into the tri phase spaceTo decompose these dq matrix equations back into the physical three-phase (abc) space, we apply the inverse Park and Clarke transformations.In three-phase space, the cross-coupling rotation matrix ((\mathbf{J})) disappears. It transforms back into physical mutual inductances between the stator windings and the time-varying derivatives of the phase currents.Here is exactly how the math breaks down.1. The Transformation MatrixTo go from dq0 to abc, we use the inverse transformation matrix (\mathbf{T}^{-1}(\theta)), where θ is the electrical angle of the rotor:(\mathbf{x}{abc}=\mathbf{T}^{-1}(\theta )\mathbf{x}{dq0})Assuming a balanced system (where the 0-sequence component is zero), the transformation matrix is:(\mathbf{T}^{-1}(\theta )=\sqrt{\frac{2}{3}}\left[\begin{matrix}\cos (\theta )&-\sin (\theta )\ \cos (\theta -\frac{2\pi }{3})&-\sin (\theta -\frac{2\pi }{3})\ \cos (\theta +\frac{2\pi }{3})&-\sin (\theta +\frac{2\pi }{3})\end{matrix}\right])2. Decomposing the Vector Equation Term-by-TermLet's apply (\mathbf{T}^{-1}(\theta)) to each part of our compact vector equation:(\mathbf{V}{dq}=R\mathbf{I}{dq}+L\frac{d\mathbf{I}{dq}}{dt}+\omega L\mathbf{JI}{dq})The Resistance Term ((R \mathbf{I}{dq}))Resistance is a scalar scalar property of the copper wire and is independent of spatial rotation. It transforms perfectly linearly:(\mathbf{T}^{-1}(\theta )\cdot R\mathbf{I}{dq}=R\mathbf{I}{abc})The Transient & Rotation Terms ((L \frac{d\mathbf{I}{dq}}{dt} + \omega L \mathbf{J} \mathbf{I}{dq}))This is where the magic happens. When you apply the time derivative to a rotating frame, the chain rule dictates that:(\frac{d\mathbf{I}{abc}}{dt}=\frac{d}{dt}\left[\mathbf{T}^{-1}(\theta )\mathbf{I}{dq}\right]=\mathbf{T}^{-1}(\theta )\frac{d\mathbf{I}{dq}}{dt}+\frac{d\mathbf{T}^{-1}(\theta )}{dt}\mathbf{I}{dq})Because (\frac{d\theta}{dt} = \omega), differentiating the sines and cosines inside (\mathbf{T}^{-1}(\theta)) yields:(\frac{d\mathbf{T}^{-1}(\theta )}{dt}=\omega \mathbf{T}^{-1}(\theta )\mathbf{J})Substituting this back in gives:(\frac{d\mathbf{I}{abc}}{dt}=\mathbf{T}^{-1}(\theta )\frac{d\mathbf{I}{dq}}{dt}+\omega \mathbf{T}^{-1}(\theta )\mathbf{JI}{dq})Notice that the right side of this equation is identically equal to our inductive terms in the dq frame. Therefore, when multiplied by L, both terms collapse back into a single three-phase transient derivative:(\mathbf{T}^{-1}(\theta )\left(L\frac{d\mathbf{I}{dq}}{dt}+\omega L\mathbf{JI}{dq}\right)=L\frac{d\mathbf{I}{abc}}{dt})3. The Final Three-Phase Voltage EquationWhen you reconstruct all the components in the stationary abc frame, the rotation matrix (\mathbf{J}) vanishes entirely, leaving a decoupled system of physical differential equations:(\left[\begin{matrix}V_{a}\ V_{b}\ V_{c}\end{matrix}\right]=R\left[\begin{matrix}I_{a}\ I_{b}\ I_{c}\end{matrix}\right]+L\frac{d}{dt}\left[\begin{matrix}I_{a}\ I_{b}\ I_{c}\end{matrix}\right])Physical InterpretationIn the abc frame: The voltage drops are purely resistive (R I) and self-inductive ((L \frac{dI}{dt})). The speed-dependent cross-coupling (ω L) is hidden inside the time-varying nature of the AC phase currents themselves.In the dq frame: The reference frame rotates with the magnetic field, forcing the AC currents to look like DC values. Because the coordinate system is physically spinning at speed ω, the math throws out a "speed voltage" term ((\omega L \mathbf{J})), which behaves like a pseudo-force (similar to the Coriolis effect in mechanics).Would you like to see how the matrix expands if the motor has saliency ((L_d \neq L_q)), which causes the three-phase inductances to vary depending on the rotor angle θ?AI responses may include mistakes. Learn moreyes with the salience partWhen a motor has magnetic saliency ((L_d \neq L_q)), the physical inductance of the three-phase stator windings is no longer a constant scalar ((L)). Because the geometry of the rotor changes with its position, the self and mutual inductances in the three-phase (abc) space become time-varying functions of the rotor electrical angle ((\theta )).Here is how the system decomposes back into the three-phase space under salient conditions.1. The Slipped-Inductance ConceptIn a salient motor (like an Interior Permanent Magnet or Synchronous Reluctance motor), we define two baseline average inductance parameters:Average Inductance ((L_{0})): (\frac{L_{d}+L_{q}}{2})Saliency Inductance Variant ((L_{g})): (\frac{L_{d}-L_{q}}{2})2. The Three-Phase Inductance Matrix (\mathbf{L}{abc}(\theta))When you transform the salient (dq) system back into the three-phase space, the spatial variation creates an angle-dependent matrix (\mathbf{L}{abc}(\theta)). The final voltage equation in the physical (abc) frame looks like this:(\mathbf{V}{abc}=R\mathbf{I}{abc}+\frac{d}{dt}\left[\mathbf{L}{abc}(\theta )\mathbf{I}{abc}\right])Because (\mathbf{L}{abc}(\theta)) depends on time (via (\theta )), expanding the derivative using the product rule reveals how the speed and transient components behave:(\mathbf{V}{abc}=R\mathbf{I}{abc}+\mathbf{L}{abc}(\theta )\frac{d\mathbf{I}{abc}}{dt}+\omega \frac{d\mathbf{L}{abc}(\theta )}{d\theta }\mathbf{I}{abc})3. The Full Matrix DecompositionThe explicit breakdown of the matrix (\mathbf{L}{abc}(\theta)) shows that self-inductance fluctuates at twice the rotor speed ((2\theta)) because the magnetic poles align with a winding twice per electrical revolution:(\mathbf{L}{abc}(\theta )=\left[\begin{matrix}L{0}+L_{g}\cos (2\theta )&-\frac{1}{2}L_{0}+L_{g}\cos (2\theta -\frac{2\pi }{3})&-\frac{1}{2}L_{0}+L_{g}\cos (2\theta +\frac{2\pi }{3})\ -\frac{1}{2}L_{0}+L_{g}\cos (2\theta -\frac{2\pi }{3})&L_{0}+L_{g}\cos (2\theta +\frac{2\pi }{3})&-\frac{1}{2}L_{0}+L_{g}\cos (2\theta )\ -\frac{1}{2}L_{0}+L_{g}\cos (2\theta +\frac{2\pi }{3})&-\frac{1}{2}L_{0}+L_{g}\cos (2\theta )&L_{0}+L_{g}\cos (2\theta -\frac{2\pi }{3})\end{matrix}\right])How it Maps Back to your Original ProblemIf you are trying to calculate the motor parameters using the (dq) frame values from your first question, saliency splits your single unknown inductance into two distinct values ((L_{d}) and (L_{q})).The (dq) matrix equation with the rotation matrix now modifies to handle the split:(\left[\begin{matrix}V_{d}\ V_{q}\end{matrix}\right]=R\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right]+\left[\begin{matrix}L_{d}&0\ 0&L_{q}\end{matrix}\right]\frac{d}{dt}\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right]+\omega \left[\begin{matrix}0&-L_{q}\ L_{d}&0\end{matrix}\right]\left[\begin{matrix}I_{d}\ I_{q}\end{matrix}\right])Physical TakeawaysVarying Impedance: In the (abc) frame, calculating parameters directly is messy because the inductance values are constantly changing with (\theta ).The Power of DQ0: The Park transform removes this (2\theta) variation entirely. In the (dq) frame, (L_{d}) and (L_{q}) become constants relative to rotor position, meaning you can isolate them if you capture enough data points during a transient state.Would you like to see how to restructure the matrix inversion to simultaneously solve for both (L_{d}) and (L_{q}) using your magnitude and angle data?AI responses may include mistakes. Learn moreit feels like the L_abc matrix is a product of somethingYou have excellent mathematical intuition. The (\mathbf{L}{abc}(\theta)) matrix is absolutely a product—specifically, it is a similarity transformation of a constant matrix from the rotor's (dq0) reference frame, mapped back into the three-phase space using the Park transformation matrix (\mathbf{T}(\theta)).Physically, the rotor has constant inductances ((L{d}) and (L_{q})) along its axes. As the rotor spins, the three-phase stator windings "see" these inductances through a changing geometric window.Mathematically, it decomposes into this exact matrix product:(\mathbf{L}{abc}(\theta )=\mathbf{T}^{-1}(\theta )\cdot \mathbf{L}{dq0}\cdot \mathbf{T}(\theta ))The Component MatricesUsing the amplitude-invariant form of the Park transform, the three parts of this product are defined as:The Core Inductance Matrix ((\mathbf{L}{dq0})):This is the decoupled, constant matrix as seen from the perspective of the spinning rotor:(\mathbf{L}{dq0}=\left[\begin{matrix}L_{d}&0&0\ 0&L_{q}&0\ 0&0&L_{0}\end{matrix}\right])The Forward Transformation Matrix ((\mathbf{T}(\theta))):This projects the three-phase quantities into the rotor frame:(\mathbf{T}(\theta )=\frac{2}{3}\left[\begin{matrix}\cos (\theta )&\cos (\theta -\frac{2\pi }{3})&\cos (\theta +\frac{2\pi }{3})\ -\sin (\theta )&-\sin (\theta -\frac{2\pi }{3})&-\sin (\theta +\frac{2\pi }{3})\ \frac{1}{2}&\frac{1}{2}&\frac{1}{2}\end{matrix}\right])The Inverse Transformation Matrix ((\mathbf{T}^{-1}(\theta))):This projects the quantities back from the rotor frame to the three-phase stator frame:(\mathbf{T}^{-1}(\theta )=\left[\begin{matrix}\cos (\theta )&-\sin (\theta )&1\ \cos (\theta -\frac{2\pi }{3})&-\sin (\theta -\frac{2\pi }{3})&1\ \cos (\theta +\frac{2\pi }{3})&-\sin (\theta +\frac{2\pi }{3})&1\end{matrix}\right])Re-Deriving the Matrix (Why the (2\theta) terms appear)When you perform the matrix multiplication (\mathbf{T}^{-1}(\theta) \mathbf{L}{dq0} \mathbf{T}(\theta)), you are multiplying terms like (\cos(\theta) \cdot \cos(\theta)) and (\sin(\theta) \cdot \cos(\theta)).Applying product-to-sum trigonometric identities reveals why the final three-phase matrix contains terms fluctuating at twice the rotor frequency ((2\theta)):(\cos^2(\theta) = \frac{1 + \cos(2\theta)}{2})(\sin^2(\theta) = \frac{1 - \cos(2\theta)}{2})(\sin(\theta)\cos(\theta) = \frac{\sin(2\theta)}{2})This proves that the complicated, time-varying (\mathbf{L}{abc}(\theta)) matrix is nothing more than a constant, diagonal physical property of the machine being looked at through a rotating coordinate system.Would you like to see how this product expands algebraically for a single phase element (like (L_{aa})), or are you interested in how the Back-EMF permanent magnet flux fits into this matrix product structure?

And finally the formulas in the D`Q` frame if our stuff is missalligned:

If your control system or measurement tool is misaligned with the true physical axes of the rotor by an angular error $\delta$ (where $\delta = \theta_{true} - \theta_{estimated}$), you are operating in a misaligned (or estimated) $d'q'$ frame. Because of this misalignment, the clean decoupling of the true $dq$ frame is lost. The inductance matrix will no longer be diagonal, meaning you will observe cross-coupling inductances between the $d'$ and $q'$ axes even when the motor is completely stationary. Here is the exact mathematical formulation of what you will see.

1. The Frame Rotation Matrix $\mathbf{R}(\delta)$

To map vectors from the true physical rotor frame ($dq$) to your misaligned measurement frame ($d'q'$), we define a standard 2D rotation matrix $\mathbf{R}(\delta)$: $$\mathbf{R}(\delta) = \begin{bmatrix} \cos(\delta) & -\sin(\delta) \ \sin(\delta) & \cos(\delta) \end{bmatrix}$$ The relationship between the true quantities and your observed quantities is:


2. The Rotated Inductance Matrix $\mathbf{L}_{d'q'}$

In the true frame, the salient inductance matrix is purely diagonal: $\mathbf{L}{dq} = \begin{bmatrix} L_d & 0 \ 0 & L_q \end{bmatrix}$. Transforming this matrix into your misaligned frame via a similarity transformation ($\mathbf{R} \mathbf{L}{dq} \mathbf{R}^{-1}$) gives your observed inductance matrix $\mathbf{L}{d'q'}$: $$\mathbf{L}{d'q'} = \mathbf{R}(\delta) \begin{bmatrix} L_d & 0 \ 0 & L_q \end{bmatrix} \mathbf{R}^{-1}(\delta)$$ Carrying out this matrix product yields: $$\mathbf{L}{d'q'} = \begin{bmatrix} L{avg} + L_{var}\cos(2\delta) & L_{var}\sin(2\delta) \ L_{var}\sin(2\delta) & L_{avg} - L_{var}\cos(2\delta) \end{bmatrix}$$ Where:

Physical Insight on the Matrix


3. The Complete Misaligned Matrix Equation

If we take the true frame state-space equation (including the cross-coupling rotation matrix $\mathbf{J}$) and project the entire system into your misaligned $d'q'$ frame, the formula expands to: $$\mathbf{V}{d'q'} = R \mathbf{I}{d'q'} + \mathbf{L}{d'q'} \frac{d\mathbf{I}{d'q'}}{dt} + \omega \mathbf{R}(\delta) \mathbf{J} \mathbf{L}{dq} \mathbf{R}^{-1}(\delta) \mathbf{I}{d'q'} + \mathbf{V}{emf, d'q'}$$ Because the matrix $\mathbf{J}$ represents a geometric $90^\circ$ rotation, it commutes through the frame transformation cleanly ($\mathbf{R}\mathbf{J}\mathbf{R}^{-1} = \mathbf{J}$). This simplifies the speed-voltage coupling term into a product of the fundamental rotation matrix $\mathbf{J}$ and your newly skewed inductance matrix: $$\mathbf{V}{d'q'} = R \mathbf{I}{d'q'} + \mathbf{L}{d'q'} \frac{d\mathbf{I}{d'q'}}{dt} + \omega \mathbf{J} \mathbf{L}{d'q'} \mathbf{I}_{d'q'} + \begin{bmatrix} -\omega \psi_m \sin(\delta) \ \omega \psi_m \cos(\delta) \end{bmatrix}$$

What this means for your original parameter estimation goal

If you are trying to calculate resistance and inductance from your drive data but your frame is misaligned:

  1. Apparent Resistance: The scalar $R$ term remains perfectly invariant to rotation.
  2. Inductance Distortion: You will not measure true $L_d$ or true $L_q$. Instead, you will calculate the coupled values from the $\mathbf{L}_{d'q'}$ matrix.
  3. The Back-EMF Bleed: Notice that the permanent magnet Back-EMF is no longer isolated to your observed q-axis. A component of it ($-\omega \psi_m \sin(\delta)$) has now bled directly into your $d'$-axis voltage.

Knowing that misalignment introduces these error terms, would you like to explore:

And in the ABC frame:

Here is the completely expanded, explicit scalar equation for Phase A. It has been arranged vertically component-by-component so you can easily trace how the phase currents, their derivatives, and the rotor position $\theta$ interact. $$\begin{aligned} V_a = \ & R I_a \ & + \left[ L_0 + L_g \cos(2\theta) \right] \frac{dI_a}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta - \frac{2\pi}{3}\right) \right] \frac{dI_b}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta + \frac{2\pi}{3}\right) \right] \frac{dI_c}{dt} \ & - 2\omega L_g I_a \sin(2\theta) \ & - 2\omega L_g I_b \sin\left(2\theta - \frac{2\pi}{3}\right) \ & - 2\omega L_g I_c \sin\left(2\theta + \frac{2\pi}{3}\right) \ & - \omega \psi_m \sin(\theta) \end{aligned}$$

Vertical Block Guide

Would you like to see how this long expression algebraically collapses back into the single $V_d$ or $V_q$ equation when we apply the forward Park transform to Phase A, B, and C combined?

$$\begin{aligned} \mathbf{V_a} = \ & R I_a \ & + \left[ L_0 + L_g \cos(2\theta) \right] \frac{dI_a}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta - \frac{2\pi}{3}\right) \right] \frac{dI_b}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta + \frac{2\pi}{3}\right) \right] \frac{dI_c}{dt} \ & - 2\omega L_g I_a \sin(2\theta) \ & - 2\omega L_g I_b \sin\left(2\theta - \frac{2\pi}{3}\right) \ & - 2\omega L_g I_c \sin\left(2\theta + \frac{2\pi}{3}\right) \ & - \omega \psi_m \sin(\theta) \ \ \mathbf{V_b} = \ & R I_b \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta - \frac{2\pi}{3}\right) \right] \frac{dI_a}{dt} \ & + \left[ L_0 + L_g \cos\left(2\theta + \frac{2\pi}{3}\right) \right] \frac{dI_b}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos(2\theta) \right] \frac{dI_c}{dt} \ & - 2\omega L_g I_a \sin\left(2\theta - \frac{2\pi}{3}\right) \ & - 2\omega L_g I_b \sin\left(2\theta + \frac{2\pi}{3}\right) \ & - 2\omega L_g I_c \sin(2\theta) \ & - \omega \psi_m \sin\left(\theta - \frac{2\pi}{3}\right) \ \ \mathbf{V_c} = \ & R I_c \ & + \left[ -\frac{1}{2}L_0 + L_g \cos\left(2\theta + \frac{2\pi}{3}\right) \right] \frac{dI_a}{dt} \ & + \left[ -\frac{1}{2}L_0 + L_g \cos(2\theta) \right] \frac{dI_b}{dt} \ & + \left[ L_0 + L_g \cos\left(2\theta - \frac{2\pi}{3}\right) \right] \frac{dI_c}{dt} \ & - 2\omega L_g I_a \sin\left(2\theta + \frac{2\pi}{3}\right) \ & - 2\omega L_g I_b \sin(2\theta) \ & - 2\omega L_g I_c \sin\left(2\theta - \frac{2\pi}{3}\right) \ & - \omega \psi_m \sin\left(\theta + \frac{2\pi}{3}\right) \end{aligned}$$ Would you like me to write a Python function that executes these equations numerically, or should we look at how to derive the total electrical power or torque from this unified structure?

In the DQ frame is a lot saner:

$$\begin{aligned} \mathbf{V_d} = \ & R I_d \ & + \left[ L_{avg} + L_{var}\cos(2\delta) \right] \frac{dI_d}{dt} \ & + \left[ L_{var}\sin(2\delta) \right] \frac{dI_q}{dt} \ & - \omega_i \left[ L_{avg} - L_{var}\cos(2\delta) \right] I_q \ & - \omega_i \left[ L_{var}\sin(2\delta) \right] I_d \ & - \omega_m K_e \sin(\delta) \ \ \mathbf{V_q} = \ & R I_q \ & + \left[ L_{var}\sin(2\delta) \right] \frac{dI_d}{dt} \ & + \left[ L_{avg} - L_{var}\cos(2\delta) \right] \frac{dI_q}{dt} \ & + \omega_i \left[ L_{avg} + L_{var}\cos(2\delta) \right] I_d \ & + \omega_i \left[ L_{var}\sin(2\delta) \right] I_q \ & + \omega_m K_e \cos(\delta) \end{aligned}$$ Would you like me to translate this complete feed-forward model and its tracking gradients into a C code implementation block for your embedded microcontroller?

And the derivatives:

$$\begin{aligned} \frac{\partial \text{loss}}{\partial R} = \ & 2 , r_d I_d \ & + 2 , r_q I_q \ \ \frac{\partial \text{loss}}{\partial L_0} = \ & 2 , r_d \left( \frac{dI_d}{dt} - \omega_i I_q \right) \ & + 2 , r_q \left( \frac{dI_q}{dt} + \omega_i I_d \right) \ \ \frac{\partial \text{loss}}{\partial L_{bias}} = \ & 2 , r_d \cos(2\delta)\frac{dI_d}{dt} \ & + 2 , r_d \sin(2\delta)\frac{dI_q}{dt} \ & - 2 \omega_i , r_d \sin(2\delta)I_d \ & + 2 \omega_i , r_d \cos(2\delta)I_q \ & + 2 , r_q \sin(2\delta)\frac{dI_d}{dt} \ & - 2 , r_q \cos(2\delta)\frac{dI_q}{dt} \ & + 2 \omega_i , r_q \cos(2\delta)I_d \ & + 2 \omega_i , r_q \sin(2\delta)I_q \ \ \frac{\partial \text{loss}}{\partial \delta} = \ & -4 L_{bias} , r_d \sin(2\delta)\frac{dI_d}{dt} \ & + 4 L_{bias} , r_d \cos(2\delta)\frac{dI_q}{dt} \ & - 4 \omega_i L_{bias} , r_d \cos(2\delta)I_d \ & - 4 \omega_i L_{bias} , r_d \sin(2\delta)I_q \ & - 2 \omega_m K_e , r_d \cos(\delta) \ & + 4 L_{bias} , r_q \cos(2\delta)\frac{dI_d}{dt} \ & + 4 L_{bias} , r_q \sin(2\delta)\frac{dI_q}{dt} \ & - 4 \omega_i L_{bias} , r_q \sin(2\delta)I_d \ & + 4 \omega_i L_{bias} , r_q \cos(2\delta)I_q \ & - 2 \omega_m K_e , r_q \sin(\delta) \end{aligned}$$ Would you like me to generate a C code template or Python script to test these explicit tracking gradients in your simulator?

Last, we need to match saturation effects somehow. We're using a simplified model to just kinda match the angle of the observed residual as we probe with HFI. It seems to be fixed relative to 2 times the current angle, hence we need to depend on current x d_current_dt products to capture this behavior. The formulas I used are:

To handle $K_{sat}$ as a slow, steady motor constant and $\theta_{sat}$ as a fast, dynamic position tracking state, we must keep them as separate explicit variables. When your arbitrary software frame is misaligned from the true physical saturation axis, the $2\times$ current vector modulation passes through a spatial phase shift of $\theta_{sat}$. By expanding the trigonometric relationships directly, your microcontroller can track the true magnetic core position online while holding the motor's saturation coefficient constant. To keep the math tight and fast for your processor, we define your two raw current-velocity vector components as single variables: $$A = I_d \frac{dI_d}{dt} - I_q \frac{dI_q}{dt}$$ $$B = I_q \frac{dI_d}{dt} + I_d \frac{dI_q}{dt}$$

1. Explicit Angle-Compensated Voltage Equations

Inserting $K_{sat}$ and $\theta_{sat}$ directly, the model predictions for your software frame feedforward voltages are: $$V_{d,\text{model}} = V_{d,\text{linear}} + K_{sat} \left[ A\cos(\theta_{sat}) - B\sin(\theta_{sat}) \right]$$ $$V_{q,\text{model}} = V_{q,\text{linear}} + K_{sat} \left[ A\sin(\theta_{sat}) + B\cos(\theta_{sat}) \right]$$

2. Explicit Parameter Gradient Equations

Using your software frame voltage residuals $r_d = V_d - V_{drive,d}$ and $r_q = V_q - V_{drive,q}$, your optimizer updates the steady motor constant and the fast-moving position state using these two separate gradients:

For the Constant Motor Saturation Magnitude ($K_{sat}$):

$$\mathbf{\frac{\partial \text{loss}}{\partial K_{sat}}} = 2 , r_d \left[ A\cos(\theta_{sat}) - B\sin(\theta_{sat}) \right] + 2 , r_q \left[ A\sin(\theta_{sat}) + B\cos(\theta_{sat}) \right]$$

For the Dynamic Saturation Phase Angle ($\theta_{sat}$):

$$\mathbf{\frac{\partial \text{loss}}{\partial \theta_{sat}}} = 2 K_{sat} , r_d \left[ -A\sin(\theta_{sat}) - B\cos(\theta_{sat}) \right] + 2 K_{sat} , r_q \left[ A\cos(\theta_{sat}) - B\sin(\theta_{sat}) \right]$$