Use of Simulink Signal Logging and SimScape Logs with Parallel

8 views (last 30 days)
Hi,
I've recently started using the Parallel Computing Toolbox for running parallel simulations in Simulink (including SimScape). Previously I was utilising the Simulink signal logging option and SimScape logging option to log simulation data to two log objects (nominally logsout for Simulink and simlog for SimScape). The examples, including a demo model, for parallel simulations in Simulink only seem to show how to extract the model output and time trace ( yout and tout) from the workers. I cannot figure out how to extract the simulations logs from the workers. I imagine there is a way to route all signal data to the model output, and extract the data from there, however my model is multi-domain with a significant amount of physical modelling blocks (SimHydraulics) and I would like to be able to access the Simulink and SimScape logs from parallel runs.
Can anybody help me with this issue?
Regards,
Jack

Accepted Answer

Guy Rouleau
Guy Rouleau on 10 Apr 2012
The following documentation page explain how to use the Single-Output Syntax for the sim Command:
This single-output syntax has been designed especially for calling SIM within PARFOR.
using that, you will call sim:
SimOut = sim('model', 'ReturnWorkspaceOutputs', 'on');
and everything will be stored in simOut. If logging both "logsout" for Simulink signals and and "simlog" for Simscape, you will be able to extract the data with a syntax like:
myVar1 = simOut.get('logsout'); myVar2 = simOut.get('simlog');
  4 Comments
Aditya
Aditya on 9 Jul 2012
Is there a way to save simlog to a file like a mat file? This is not related to using the parallel toolbox but this seems like the right place to ask this question. Thanks, Aditya
K E
K E on 10 Jul 2012
If you get no answers, you could post this as a new question so that it is more likely to be seen.

Sign in to comment.

More Answers (1)

K E
K E on 10 Apr 2012
I am sure there is a better approach, but a workaround would be to save a mat file containing each simulation's results. This could be done using a Matlab script to run the set of simulations; outputting desired simulation results to the Workspace using the To Workspace block; choosing a distinct mat file name within the Matlab script; and saving the mat file. A post-processing script could load all the mat files, for example to plot engine temperature vs. motor constant (if that was what was varying across the simulations). As a cheat with no Parallel toolbox, prior to each simulation create the uniquely named mat file that will contain the results, for example saving some dummy information. Then do not run the simulation if the file already exists. This allows several concurrent sessions of matlab/simulation to work through the set of simulations.

Community Treasure Hunt

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

Start Hunting!