A method for inputting values in real-time according to fixed steps.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Angelo Yeo
am 19 Sep. 2024
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 Kommentare
Rishav
am 19 Sep. 2024
Bearbeitet: Rishav
am 19 Sep. 2024
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 Kommentar
Angelo Yeo
am 19 Sep. 2024
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.
Siehe auch
Kategorien
Mehr zu Model Preparation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!