Explanation of Accelerator mode and listener functions

조회 수: 2 (최근 30일)
Paul
Paul 2012년 4월 21일
I am writing a report on work that I have been doing using Simulink and matlab working together at the same time.Recently I read a comment suggesting that adding an event listener to a block when Simulink runs in accelerator mode will not work.
I would assume that this is because the function for adding an event listener is written in C++ but i can not find anything to confirm if this is true.
Does anyone have any information they can point me towards plese ?
Thanks
  댓글 수: 1
Kaustubha Govind
Kaustubha Govind 2012년 4월 25일
I don't see this in the documentation. Could you point out to the page where you read this comment?

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

채택된 답변

Abhishek Gupte
Abhishek Gupte 2012년 5월 8일
Yes, event-listeners do not work in non-Normal simulation modes.
Event-listener functions are fired when the block methods that they are attached to ( eg. 'PostOutputs' ), are called. The API used is the block's Run-Time-Object (RTO). In a nutshell, an RTO is a Simulink block's proxy in MATLAB.
In Accelerator mode, a mex file of the model is generated. Instead of calling individual block methods, the corresponding block's mex counterpart is called. The API used to communicate between the mex function and the Simulink environment is called the C-Mex S-function API. This is shown here.
Since the block's methods are not directly executed, the block's RTO does not exist in Accel ( and all other non-Normal ) modes. Hence, the event listeners are never fired.
There is no workaround for this.

추가 답변 (0개)

카테고리

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