How to implement real-time input using a MATLAB Function block

6 次查看(过去 30 天)
Hello, I am currently researching the control of a Stewart platform simulation. I would like to input the necessary values by dividing them by the step size and using a MATLAB function block to deliver the input values in real-time. Is it possible to receive the calculated input values from a script file into the function block and deliver these values in real-time for each step according to the simulation time?
I want to input the values calculated in the script file into the MATLAB function block as data, with time and step settings, and have the block calculate the 8 prism joint displacements. These displacements should be divided into steps over the simulation time and delivered in real-time.

回答(1 个)

Jaimin
Jaimin 2024-9-27
In order to obtain the calculated input values from a script file within the function block and provide these values in real-time for each simulation step, I have a workaround that you might consider trying.
Please follow these steps:
  1. Add a MATLAB Function block to the model.
  2. Use a Bus block to combine all outputs from the 'parse motion' block.
  3. Connect the Bus created in Step 2 to the input port of the MATLAB Function block from Step 1.
  4. Link the output of the MATLAB Function block from Step 1 to the input port of the parse motion block.
  5. Set the priority of the MATLAB Function block from Step 1 higher than that of the parse motion block.
  6. Incorporate domain-specific logic into the newly created MATLAB Functionblock and assign initial data to the relevant properties.
For more information on “MATLAB Function” and “Bus” Block you can refer following documentations:
I hope this will be helpful.

类别

Help CenterFile Exchange 中查找有关 Troubleshooting in Simulink Real-Time 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by