This example illustrates the use of the 'ModelSimplificationOpt' argument in the mech_import command.
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
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.
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
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.
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
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.
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
Fig H - RigidSubsystem1 containing all the rigidly connected plate and bolts