Data type problems using PID Control Block in Simulink

5 ビュー (過去 30 日間)
Marco
Marco 2024 年 11 月 27 日
コメント済み: Marco 2024 年 11 月 27 日
Hi everyone!
I want to use a PID Control Block in my Simulink Model (R2023b), which only works with uint16 data types. I found the right configs in the PID Block to set all of the data types (inputs, outputs, etc.) to uint16. However, I get the error messages below:
1) Error:Data type mismatch. 'Input Port 1' of 'PID Controler/Tsamp - Ngain/Passthrough/Out1' expects a signal of data type 'double'. However, it is driven by a signal of data type 'uint16'.
Clicking on the path, a new Simulink window opens showing me the error site (see screenshot)
The problem is, that I cannot change the library of the PID Controler Block and I also cannot find any other configs the change the data type from double to uint16.
Do you have any ideas, how to solve the problem?
Thanks!
Best, Marco

回答 (1 件)

Pavl M.
Pavl M. 2024 年 11 月 27 日
it is solvable,
just convert(cast) uint16 to double by appropriate datatype convertion simulink block or by just simulink matlab script block with out = double(inp) between the input port U and output port 1;
OK?
  1 件のコメント
Marco
Marco 2024 年 11 月 27 日
Thanks for the answer.
I cannot insert any blocks in the library of the PID Control Block from Simulink and due to the goal, that I want to stay with uint16 data types this is not possible.
My work around now is to change the continous controler to a discrete one. Here, I can change the two more data types to uint16 and the problem was solved.

サインインしてコメントする。

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by