Data type mismatch error in PMSM block.

38 vues (au cours des 30 derniers jours)
Tai-Jie
Tai-Jie le 10 Fév 2026 à 16:54
Commenté : Tai-Jie il y a environ 19 heures
I am modeling motor controller with Surface Mount PMSM block from motor control blockset. The model is modified from an example and works fine until I add the MTPA block. Error message indicate that the error is due to data type mismatch of a add block inside PMSM block. However, the input and output data type of the PMSM block remain the same as before.
The two block mentioned in the error message seems related to the electric power calculation, but I didn't connect the PwrInfo part. I also tried connecting a dummy speed signal to the input port of MTPA, and the error disappered. The error only appear when the feedback speed is connected to the MTPA block. I don't know how this action is related to the error, please help.

Réponses (1)

Vedant Shah
Vedant Shah le 14 Fév 2026 à 6:05
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:
  1 commentaire
Tai-Jie
Tai-Jie il y a environ 19 heures
Thanks for the answer. I update the slx file and add the needed MAT file, and it should be able to recreate the error on your side. I tried adding the data type conversion block but the error is still the same.
However, I found the error can be solved by changing the speed input of PMSM block. It was a estimation from the torque output of PMSM with a constant resistance. The error disappeared when I replace the estimation with a simple ramp block.
The problem is solved, but I'm still curious about why there will be errors. I did make sure that datatype remain the same, and the speed estimation model that seems causing the problem worked fine before adding MTPA block. Maybe there is something wrong in the torque → speed → MTPA → PMSM feedback chain, but I can't identify it.

Connectez-vous pour commenter.

Produits


Version

R2025a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by