So the idea is to use the DTC example of the induction motor and adapt it to a PMSM, while:
1) using angle measurement.
2) fixed carrier switching frequency of 10kHz
3) motor is defined in the file
4) implementing the block diagram Fig 6.
5) implementing switching table Table 4.
6) adding a torque=f(angular speed[rpm]) dependency
The document reference is:
https://www.researchgate.net/publication/282319539_Space_Vector_Modulated_Direct_Torque_Control_of_IPMSM_Drive
I have added my file with my actual status.