Run sections of Simulink diagram separately

15 views (last 30 days)
So just as MATLAB code can section parts of the code and run them individually, I would like to do the same with Simulink. Some background: I have a robotic arm inverse kinematics as one section, the second section is a PID control on a DC motor. I want the end effector of the robotic arm to get in place first (the inverse kinematics section to run first) before the DC motor runs. The DC motor is separate from the robotic arm but the time and speed that it runs will depend on the robotic arm.
Is there a way to run them separately with some block, or have the program pause? Maybe I should keep the sections in separate files, save data from the first section to Workspace, then use that workspace data in the second section. Not sure, any advice?

Accepted Answer

Raj
Raj on 19 Jun 2019
1)"keep the sections in separate files, save data from the first section to Workspace, then use that workspace data in the second section" Yes that's one way but quite cumbersome i think.
2) Convert your DC motor section of model into an 'Enabled Subsystem'. Once your robotic arm model completes its run, set a control flag/signal which can be used as a trigger for the DC motor subsystem. See details here.
3) Convert your DC motor section to a 'If action subsystem' and use the time vector from a clock to start the DC motor section after sometime(this time should be sufficient for the robotic arm model to complete its run). See details here.

More Answers (0)

Tags

Products

Community Treasure Hunt

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

Start Hunting!