Is there programmatic access to the Simulink SimulationManager information or another way to monitor the progress of a sim(SimulationInput)?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Paul
el 5 de Jul. de 2023
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.
Respuestas (1)
Suman Sahu
el 17 de Ag. de 2023
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
Ver también
Categorías
Más información sobre Run Multiple Simulations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!