Is there programmatic access to the Simulink SimulationManager information or another way to monitor the progress of a sim(SimulationInput)?
4 ビュー (過去 30 日間)
古いコメントを表示
I have a process setup to run a series of simulations using the sim(mySims) using the Simulink.Simulation input object. I would like to be able to have another function / process / something monitor the progress and provide status updates. I am doing lots of batch things and do not really care to see the built in SimulationManager gui, and it doesn't give me a way to send updates to an external sources.
I could potentially use the Simulink.SimulationInput.setPostSimFcn, but I am already using that for the individual sims to do some processing for smaller sets, and I do not need the updates from those. So I'd like to not modify that function.
So is there a way to overwrite the SimulationManager with my own monitoring function?
3 件のコメント
Paul
2023 年 7 月 5 日
It would seem that the Pre and PostSimFcn would be the place from which to create an indication that a simulation has started and ended. But if you don't want to use the Pre and PostSimFcns for this use, I'm afraid I don't have any other suggestions. I guess one thought might be to try to use model callback functions. But the potential efficacy of that solution, such as it may be, might depend on if using the sim or parsim or batchsim functions.
回答 (1 件)
Suman Sahu
2023 年 8 月 17 日
Hi Scott,
Since you are doing simulations in batch, I am assuming you are using ‘batchsim’ function. Using the ‘batchsim‘ function you can only get the ‘RunningDuration’ of the batch job. Only once the job has finished, meaning all the simulations are in ‘finished’ state, you can see the individual ‘SimulationOutput’s results and timing info.
‘batchsim’ function returns a ‘Simulink.Simulation.Job’ object which gives the ‘RunningTime’ info for the job while it is in ‘running’ State.
Once the job’s ‘State’ value is ‘finished’, you can use the ‘fetchOutputs(Simulink.Simulation.Job)’ function which returns an array of ‘Simulink.SimulationOutput’ objects containing the results of the individual simulations in the batch job.
Since you can only see the individual simulation results only after the batch job is finished, it may not help you in monitoring purposes.
You can try to use the ‘parsim’ function where you can asynchronously fetch the individual simulation results as they complete using the ‘fetchNext(Future)’ function. It can help you monitor how many of the simulations have finished. To learn more about it refer to the following documentation: Fetch next available unread output from Simulink.Simulation.Future object array - MATLAB fetchNext
Hope it was helpful
参考
カテゴリ
Help Center および File Exchange で Run Multiple Simulations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!