MATLAB Answers

0

Visually fading out Simulinik blocks based on user defined categories

Asked by Hans-Martin Schulz on 22 Dec 2015
Latest activity Answered by Vaibhav Awale on 13 Jan 2016
Hi, We use large models of whole cars, thus including subsystems and blocks from different domains (engine, transmission, ...), representing different functionality (controller vs. plant), connections representing different type of signals e.g. the torque of the engine vs. the measured torque signal. All these different properties shall be used for making the models easier to present, debug, ... Therefore I would like to - classify the blocks and connections into categories: control block vs. plant model, COM signal vs. physical value, ..., while the model is created. - later after opening the model I select the categories I would like to be presented visually at the screen, i.e. all items not falling in the selected category shall be hidden visually but remain part of the model. I do not want to delete them, just hiding them for a moment for easier reading of the model (Remark: I know masking of block, signal busses, structuring a model into subsystems ... all do not solve the problem above)
All hints solving this manually, by exisiting tools or by using an API for a self-build tool would be very welcome.
Regards Hans-Martin

  0 Comments

Sign in to comment.

Products

1 Answer

Answer by Vaibhav Awale on 13 Jan 2016

Hi,
One possible way this can be done is by changing the 'ForegroundColor' property of blocks.
For example, you can add a 'Tag' to blocks. Tag can be added by right clicking on the block and selecting 'properties'. You can add the tag 'Controller' for all controller related blocks and the tag 'Plant' for all plant related blocks.
Then, you can find all blocks with 'Controller' tag using "find_system" command. For example,
>> controller_blocks = find_system(gcs,'Tag','Controller');
This will return a vector of handles to blocks which have 'Controller' as their tag. You can then set the 'ForegroundColor' property for all these blocks to white or some light color.
>> for i = 1:length(controller_blocks),
>> set_param(cont_blocks(i),'ForegroundColor','white');
>> end
Same can be done for all blocks having 'Plant; as their tags.
For signals, I am not very sure how you would differentiate between 'COM' signals and 'physical' signals. Maybe you can do something similar after getting 'line_handles' for corresponding signal.
I hope this helps.
Regards,
Vaibhav Awale

  0 Comments

Sign in to comment.