Data type mismatch error in PMSM block.

30 次查看(过去 30 天)
Tai-Jie
Tai-Jie 2026-2-10,16:54
回答: Vedant Shah about 16 hours 前
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.

回答(1 个)

Vedant Shah
Vedant Shah about 16 hours 前
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:

类别

Help CenterFile Exchange 中查找有关 Electrical Block Libraries 的更多信息

产品


版本

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by