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

조회 수: 5 (최근 30일)
석준
석준 2024년 9월 25일
답변: Jaimin 2024년 9월 27일
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