A method for inputting values in real-time according to fixed steps.
1 回表示 (過去 30 日間)
古いコメントを表示
I want to calculate values in real-time based on fixed steps within a MATLAB Function block and pass them as inputs to the prismatic joint. Currently, the calculations are being made inside the MATLAB Function block, but the values are not being transmitted in real-time, and only the final calculated value is being input. If anyone knows how to pass the calculated input values in real-time, I would appreciate your help.
0 件のコメント
回答 (2 件)
Angelo Yeo
2024 年 9 月 19 日
However, since the term "Speedgoat" is not mentioned in the question, I will assume it is basically a desktop real-time environment. The default behavior of the MATLAB Function block is to operate at the sample time of the input signal. (Both Stateflow Chart blocks and MATLAB Function blocks have their Update method set to Inherited by default.)
For reference, Simulink Desktop real-time runs in soft real-time, so depending on the algorithm, it might not run strictly in real-time. On the other hand, simulations using Simulink Real-Time with Speedgoat equipment guarantee real-time performance.
Please take a look at the sample model for Simulink Desktop Real-Time simulation as attached.
0 件のコメント
Rishav
2024 年 9 月 19 日
編集済み: Rishav
2024 年 9 月 19 日
Hi 석준,
You can follow the below mentioned steps to pass calculated input values in real-time from a MATLAB Function block to a prismatic joint in Simulink:
- Set the Sample Time - Ensure the MATLAB Function block is set to inherit its sample time from the Simulink model by specifying -1 as the sample time. This ensures it executes at every simulation step.
- Output the Calculated Values - Inside the MATLAB Function block, perform your calculations and directly assign the result to the output variable. Ensure this variable is connected to the input of the prismatic joint.
- Connect the MATLAB Function Block to the Prismatic Joint - Drag a line from the output of the MATLAB Function block to the input of the prismatic joint.
- Use a Fixed-Step Solver - In the Simulink model configuration parameters, choose a fixed-step solver to ensure consistent time steps, which is crucial for real-time applications.'
Please refer to the following documentation on Prismatic joint:
1 件のコメント
Angelo Yeo
2024 年 9 月 19 日
No. Native Simulink simulations do not guarantee Real-Time simulation (neither soft real time nor hard real time). If you are using Generative AI to make up answers, please be responsible and leave a note about it.
参考
カテゴリ
Help Center および File Exchange で Model Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!