Borrar filtros
Borrar filtros

Is there programmatic access to the Simulink SimulationManager information or another way to monitor the progress of a sim(SimulationInput)?

1 visualización (últimos 30 días)
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
Scott Tatum
Scott Tatum el 5 de Jul. de 2023
I want to know what the Sim Manager shows, if it sims are currently running or done. Say I have 1000 entries in my Simulink.SimulationInput structure, where am I at in it, when is a given one done. I don't want it in the Sim Manager Gui though, because likely wont even be looking at that computer. I want to update some arbitrary destination with the status, be it a spreadsheet, or maybe a web service, or send an email. I want the flexibility of having a side task monitor and status the progress of the sims, like Sim Manager does, but I want to customize the status actions.
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.

Iniciar sesión para comentar.

Respuestas (1)

Suman Sahu
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 batchsimfunction you can only get the RunningDurationof the batch job. Only once the job has finished, meaning all the simulations are in ‘finished state, you can see the individual SimulationOutputs 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
  1 comentario
Scott Tatum
Scott Tatum el 17 de Ag. de 2023
Thanks for the reply. I am just using the sim( ) command. Do not have all the other parallel licenses to utilize the rest of the options.
I have resorted to having the preSim and postSim functions write out a text file and an external sources is monitoring for the existance of those.
Would be nice to have the same API for what the Simulation manager is showing exposed to an object while the simulations are running.

Iniciar sesión para comentar.


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!

Translated by