The error is caused by a data type mismatch inside the Simulink model. It appears after connecting the real speed feedback signal to the MTPA block, even though the PMSM block inputs/outputs seem unchanged.
When the real speed feedback is connected:
PMSM speed (double) → MTPA block (expects single)
Simulink propagates the double data type into a subsystem where internal signals are defined as single, which leads to the error. That is why the message points to a block inside the PMSM subsystem — it is simply where the mismatch is detected, not where it originates.
Although I was not able to reproduce the issue on my side due to the missing MAT file or required workspace variables, based on the model analysis it should be resolved by inserting a "Data Type Conversion" block between the plant speed output and the MTPA input:
Speed feedback → Data Type Conversion (single) → MTPA
This ensures datatype consistency between the plant and control sections.
For more information, refer to the following documentations:

