Documentation

Mechanical Import with Model Simplification

This example illustrates the use of the 'ModelSimplificationOpt' argument in the mech_import command.

Importing A Model With All Non-Weld Joints Imported At Top Level

The Physical Modeling XML file SimplificationExample2.xml contains bodies and revolute joints nested below several levels of subsystems. A default import of this XML shows the structure, without model simplification.

h1 = mech_import([matlabroot '/toolbox/physmod/mech/mechdemos/SimplificationExample2']);
open_system('MechanismSimplification2/Subsystem1');

Fig A - Top level model and subsystem

open_system('MechanismSimplification2/Subsystem1/Subsystem');

Fig B - Lower level subsystem

As these screenshots show, weld joints rigidly connect several bodies in this model over subsystem boundaries. Revolute joints in this system are nested below several levels of subsystems.

close_system(h1,0);

When you set the 'ModelSimplificationOpt' argument to 1, the subsystem hierarchy is changed to import all revolute joints at the top level. Welded bodies are also grouped and placed into newly created rigid subsystems.

h2 = mech_import([matlabroot '/toolbox/physmod/mech/mechdemos/SimplificationExample2'],...
    'ModelSimplificationOpt',1);

Fig C - Revolute joints brought to top level by model simplification

open_system('MechanismSimplification2/RigidSubsystem1');

Fig D - All rigidly connected bodies contained in the newly created RigidSubsystem1

Note that the names of the newly created bodies and rigid subsystems preserve the actual path.

close_system(h2,0);

Importing A Model While Preserving Subsystem Hierarchy

The Physical Modeling XML file SimplificationExample1.xml imports into a model similar to the previous model.

h3 = mech_import([matlabroot '/toolbox/physmod/mech/mechdemos/SimplificationExample1']);

Fig E - Top level model

open_system('MechanismSimplification1/Subsystem');

Fig F - Subsystem level showing the plate rigidly connected to bolts and a revolute joint connecting it to the shaft

However, we would like the import operation to preserve the subsystem hierarchy.

close_system(h3,0);

When you set the 'ModelSimplificationOpt' argument to 2, the welded bodies in each subsystem are grouped and placed into newly created rigid subsystems at the same level as the grouped bodies. The overall subsystem hierarchy is maintained using this option.

h4 = mech_import([matlabroot '/toolbox/physmod/mech/mechdemos/SimplificationExample1'],...
    'ModelSimplificationOpt',2);

Fig G - Subsystem hierarchy preserved with model simplification

open_system('MechanismSimplification1/Subsystem');

Fig H - RigidSubsystem1 containing all the rigidly connected plate and bolts

close_system(h4,0);
Was this topic helpful?