Run Matlab script automatically in parallel to simulation
4 views (last 30 days)
Show older comments
Hi,
I'm simulating a rocket with an iterative guidance scheme. The equations of motion shall be evaluated continiously while guidance updates shall be taken into account as soon as they are available, until then the old parameters shall be used. I am not quite sure how to do this. My current solution is to run a script manually in parallel to the simulink model, reading the output, calcualting guidance updates and updating those parameters for the simulink model. Is there a way to automatically run the script in parallel when starting the simulation? Or are there better ways to include the guidance scheme into the model?
Thanks,
Flo
0 Comments
Answers (1)
Kiran Felix Robert
on 16 Dec 2020
Hi Florian,
I understand that you want to include a MATLAB Function (script) to be executed while your simulation is in execution. Refer the MATLAB Function block, which you can add it to the simulation loop. Also refer the Model Callbacks – PauseFcn / ContinueFcn to call a MATLAB script from the Simulink model.
Also refer the Run Multiple Simulations and Parallel Computing Toolbox Documentations, and to answers here and here for more information.
Kiran Felix Robert
2 Comments
Smriti Mehrotra
on 3 Mar 2022
Hi Florian,
Could you please expand on how you ran your matlab script and simulation? I'm trying to send the outputs of a tcp/ip block , transformed into a current profile (spreadhseet), into a signal builder to send into a model of an EV. I need to tcp socket, a matlab script and a simulation at the same time.
Any adivse would be really appreciated!
Thanks,
Smriti
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!