Simulink Mask Icon Display

18 ビュー (過去 30 日間)
Matthew
Matthew 2012 年 1 月 20 日
コメント済み: Matt 2013 年 12 月 10 日
Is there a way to make the simulink mask icon display measurements from SIMPOWER measurement blocks? Similar to the display simulink block. For example I have a mask which contains power, voltage, and current measurement blocks. I would like to show these results on the icon of the mask. I know I could create an output and connect a display, but I was looking for something more elegant.

採用された回答

TAB
TAB 2012 年 1 月 20 日
You can get some idea from example below.
Here a display (MyOwnDisplay/Subsystem/Display)is used inside the masked subsystem. Run time object of this display is registered with add_exec_event_listener in StartFun callback of model using
lisnh = add_exec_event_listener('MyOwnDisplay/Subsystem/Display',...
'PostOutputs',@disp_listner);
When the simulation is started disp_listner function is called at each update event of Display (which is inside the subsystem). In the disp_listner display inport value is read and converted into string. This string is assigned to 'MaskDisplay' property of masked subsystem.
The code inside disp_listner function is
function disp_listner(dispblk, eventData)
a = sprintf('%s',num2str(dispblk.InputPort(1).Data));
str = ['fprintf(''MyOwnDispValue = ' a ''')'];
set_param('MyOwnDisplay/Subsystem','MaskDisplay',str);
end
  3 件のコメント
TAB
TAB 2012 年 1 月 23 日
You can download this example from here
http://www.mathworks.in/matlabcentral/fileexchange/34686-a-custon-display-like-simulink-display-block-using-masked-subsystem
Matt
Matt 2013 年 12 月 10 日
Is there a way to do this if the dynamically-masked 'Subsystem' is in a separate library? Especially such that all callbacks can be specified in that library? I'm looking for a way to have all the details contained in the library and not need to be specified in the model that uses the library subsystem.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by