# permanent magnet synchronous motor Lagrangian in qd0 frame

I'm trying to derive a symplectic model for a permanent magnet synchronous motor (PMSM) in the rotating qd0 reference frame using a geometric integrator. For that purpose, I need the discrete-time Lagrangian of the system. What I currently know is that the co-energy of the system in stator reference frame is as $$\sum_{i=1}^{n_e}\int_0^{\dot{q}_i}\lambda_i({\dot{q}_i})d{\dot{q}_i}=\dfrac{1}{2}{\dot{q}_e^T}L{\dot{q}_e}+\mu^T{\dot{q}_e}$$ where ${q_i}$ is the electrical charge in the ith phase winding, $\lambda_i$ denotes flux linkages of permanent magnets, and $L$ is the inductance matrix, which in my case a diagonal. Taking derivatives of this expression along with kinetic energy of mechanical parts, it is possible to find the well-known voltage equations of PMSM in the stationary reference frame. Of course the Park transformation could be applied to the equations, but it is not desirable in my formulation. So, is it possible to derive the voltage equations in the rotating reference frame directly from Lagrange formulation? If so, what is the Lagrangian or magnetic co-energy of the system.

Thank you all