I am trying to develop an FOC algorithm in Simulink (see image attached) but I am having extrange results in my simulation. My torque is not constant, when it should, but varying periodically (see image attached), when it should be constant at 2 Nm. Also the scope for my q-axis current my probe is giving me a strange graph (see image attached) I can't even make sense of. Please if anyone could help me I would really appreciate it since I have no clue what is going on. I don't know if it could be the values of my PI regulator but I have already tried all sorts of values and have no idea what else I can do. Please could someone help me out and tell me what I'm doing wrong ?
P.S. Simulink file can be downloaded from my OneDrive: https://1drv.ms/u/s!AokIrMv_d8kz3BMaImhVY_guP_N-?e=3H9HRJ