Discussion:
Simulink Model Hierarchy
(too old to reply)
Philipp
2010-01-13 12:04:03 UTC
Permalink
Hi,
I need some help with the following problem:

I want to generate a list of all subsystems in my Simulink model.

I think I know how to find all subsystem blocks:
subsys = find_system( sys, 'LookUnderMasks','all', 'FollowLinks', FollowLinks, ...
'blocktype','SubSystem');

but this still includes all simscape blocks, which have the block property "subsystem" but are not subsystems, e.g. a current sensor.

So I am looking for a way to identifiy Simscape blocks programatically and remove them from the subsys list.
Gavin Walker
2010-01-15 11:05:15 UTC
Permalink
Post by Philipp
Hi,
I want to generate a list of all subsystems in my Simulink model.
subsys = find_system( sys, 'LookUnderMasks','all', 'FollowLinks', FollowLinks, ...
'blocktype','SubSystem');
but this still includes all simscape blocks, which have the block property
"subsystem" but are not subsystems, e.g. a current sensor.
So I am looking for a way to identifiy Simscape blocks programatically and
remove them from the subsys list.
Simscape has functionality for finding all Simscape components within a
model:

http://www.mathworks.co.uk/access/helpdesk/help/toolbox/physmod/simscape/ref/simscape.dependency.model.html [fn_list, missing, reference2fnList, reference2missing] =simscape.dependency.model('modelName')With a little post-processing of reference2fnList you can find the Subsystemblocks that are Simscape. You might also need to check the MaskType of othersubsystem that you find if you only wish to show the hierarchy of yourdesign -- for example 'S-Function Builder', 'Sigbuilder block', 'Stateflow'are MaskTypes of some MathWorks blocks.There might be built-in functionality to do the task you are working on,though. Can you give a little more information on what you will use thislist of Subsystems for?Gavin
Continue reading on narkive:
Loading...