how to do Serial and Parrarell computing, multiple simulink models in a loop?

Hi all,
I have two simulink files that need to run in a loop.
I have the first file sim1.slx that should run for some time and provide an output which is the input for sim2.slx. Then sim2.slx runs and afterwards it should get back to the first file sim1.slx and do this untill a counter reaches a limit.
I know that this is easy in codes and Matlab scripts, but my platform is only based on simulink.
has anyone any clues how to do this?
best regards
Mona

Risposte (1)

Hi Mona,
I would recommend you to take a look at the parsim command. Its documentation is very well done and give multiple examples.
Hope it helps.
Regards

6 Commenti

Thanks Nicolas, to the best of my knowledge parsim is only for parrallel computing, am I right? what I need is having multiple simulink models in an interactive loop. like start from model A, then run B, then get back to A and repeat. the problem is I can not call a simulink model inside a simulink model.
Okay. Then, do you have any interactions between model A and B? Like an output value of A that is an input of B?
Yes, exactly! the output of A goes into B, and after B is completed it should get back to A again.
Then, for your case, I would recommand to use a MATLAB script to synchronize your simulations. Your code could look like:
% run 1st simulation
simA = sim('my first model');
% configure simulation B
configureSimB(simA);
% run sim B
simB = sim('my second model');
... % so on so forth
I know it will require some work, but there is no automatic solution to do what you want.
Regards
if I put the first model in the Simulation> model Properties> callbacks > startFnc of the simulation configuration, this may run the first model and provide output to the second model. but how I can get back from model B to A again?
The risk with what you are trying to do is that you will end up in an infinite loop because model A call model B and model B call model A.
However, if you really want to go that way, I would simply do the same thing in model B to call model A.

Accedi per commentare.

Categorie

Commentato:

il 6 Set 2019

Community Treasure Hunt

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

Start Hunting!

Translated by