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.

 채택된 답변

Vedant Shah
Vedant Shah 2026년 2월 14일

0 개 추천

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

Tai-Jie
Tai-Jie 2026년 2월 19일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기

제품

릴리스

R2025a

질문:

2026년 2월 10일

댓글:

2026년 2월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by