Get simulation status of simulink model with event listener

조회 수: 26 (최근 30일)
Gurkenglas
Gurkenglas 2015년 8월 28일
댓글: Pratik Patil 2018년 8월 10일
Hi,
I am trying to get the current simulation status of my simulink model (initializing,running,paused etc.) by using an event listener. I need this because the model takes a long time to start, and I want to show the current status in my GUI. But I dont have a clue, how to set the "blk" parameter, because I want to access the model itself, not a block within the model. So, the following doesnt work:
blk = 'model';
event = 'PostOutputs';
listener = @sim_status;
EventListener = add_exec_event_listener(blk, event, listener);
Does anyone know, how to solve this? Thanks.
  댓글 수: 1
Pratik Patil
Pratik Patil 2018년 8월 9일
Did you find answer to his question? I am looking for a solution to same problem

댓글을 달려면 로그인하십시오.

답변 (1개)

TAB
TAB 2018년 8월 10일
You can Model Callback functions to capture the simulation status.
Some simulation related callback functions are:
  • InitFcn
  • StartFcn
  • PauseFcn
  • ContinueFcn
  • StopFcn
Also you can read simulation status of a model using below command anytime. It will return string — {'stopped'} | 'updating' | 'initializing' | 'running' | 'paused' | 'terminating' | 'external'
get_param('myModel', 'SimulationStatus')
  댓글 수: 1
Pratik Patil
Pratik Patil 2018년 8월 10일
Hey Thanks you Tabrez, This is exactly what I did. I was using them for other purposes, but added one more line of code to findobject on GUI and update the status string in it. But thank you once again Tabrez.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by