问题
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.
回答1:
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.
回答2:
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?
来源:https://stackoverflow.com/questions/31288319/i-want-to-run-two-or-more-simulink-model-in-parallel-and-synchronisation