First, the equations are implemented based on constant parameters, basically ignoring some physical phenomena that motor cad may include. Second, I would check if the definition for axis transformation is the same in the equations you are implementing and in motor cad. It is not uncommon for FEM tools to use a different definition that what a control engineer would use. The are 4 possible definitions:
- Q leads D, rotor angle measured from A-phase to D-axis
- Q leads D, rotor angle measured from A-phase to Q-axis
- D leads Q, rotor angle measured from A-phase to D-axis
- D leads Q, rotor angle measured from A-phase to Q-axis
More about the axis definition you can find in the FEM-Parameterized PMSM doc page: