Reputation: 35
Hi I want to run two or more simulink model in parallel and synchronisation. is there any way to do it? One way I think is by creating a subsystem and put all models inside it. It should run parallely. This one is not prefered for me. I want to open two matlab instances and run two different model in synchronisation. is this possible? I want to do it programmatically. Any help is appreciable.
Upvotes: 0
Views: 2466
Reputation: 833
The best way to run parallel simulink simulations is probably the parsim
command. Their is a complete article on the Mathworks website explaining how to do it:
Upvotes: 0
Reputation: 13886
If you have the Instrument Control Toolbox, you can send/receive data between the two models via TCP/IP or UDP/IP blocks. No need to have two MATLAB sessions, this can be done from one MATLAB session, see this loopback example.
However, I would query the need to have two separate models. Why not put both models in the same model as subsystems, or even as Model blocks if you want to keep the atomic nature of each sub-model?
Upvotes: 1
Reputation: 682
You should use a matlab script and implement the synchronization logic in it.
== Update ==
You can execute the simulink model by simply calling it from a Matlab Script. You have to define a task containing the next steps: First you can calculate inputs in Matlab. Then execute the first model with the first inputs. Then save the results to a certain variable. Finally use that variable on the second model and launch second model simulation.
Repeat the task for all the necessary steps.
Upvotes: 1