This section explores the characteristics of a generated CAD-based model, imported with default or nondefault settings. It also explains when and how to edit your model and expand it with additional blocks, such as Constraints, Drivers, Actuators, and Sensors. The section concludes by pointing out major model-generation and simulation errors and problems that can arise from CAD-based models, and techniques for solving them.
Note: This section assumes a model generated with default import settings and not yet edited manually. To see the effects of using nondefault import settings in a newly generated model, see Nondefault Features in Generated Models.
Most of the properties of models that you generate from an XML file are the same as the default properties of all Simulink® models. For information on working with Simulink models, see the Simulink documentation.
SimMechanics™ models that are successfully generated from CAD-based Physical Modeling XML have certain common properties that reflect their origin in CAD assembles:
Machine Environment, Ground, Body, and Joint blocks only.
Unattached coordinate systems corresponding to reference coordinate systems in the original assembly and, in general, not associated with constraints.
Subsystems below the top level encapsulating subassemblies from the original assembly.
Subassembly roots, represented by Root Body – Root Weld – Fixed Body. A Root Body occurs at the top of each subsystem hierarchy if you need such a body to correctly represent constraints in the original CAD assembly.
Joints with DoFs containing the correct joint primitives for the translational and rotational DoFs between any two bodies.
If no appropriate specific Joint exists, the importer inserts a Custom Joint with the appropriate primitives.
Joints without DoFs, represented by Welds.
Apart from Root Body blocks, each Body block referencing its STL body geometry file.
Both machine- and model-wide visualization enabled.
This is an example of a model generated from a robot arm assembly.
A generated model has one Ground. The origin of this Ground is the origin of the World coordinate system and represents the original CAD assembly origin.
Each body in a generated SimMechanics model, apart from the ground and root bodies, is configured to reproduce the body geometry and color of its original CAD assembly body. If the needed STL files were created upon export and are referenced by the generated model, the custom body geometries are visualized. Each Body references its own STL file.
Caution In order for custom visualization to work, this STL file must be either:
Otherwise, visualization reverts to the default body geometry.
Fully understanding the structure of a generated model requires understanding the original system in its CAD representation. Refer to your originating CAD assembly, CAD platform and associated documentation, and the SimMechanics Link documentation.
The importer controls allow generation of models with nondefault appearance and structure. Optional, nondefault coordinate systems can enhance the fidelity and usefulness of your models.
The following table summarizes the default and possible nondefault appearance options of a newly imported model.
|Default Appearance and Layout Options||Nondefault Appearance and Layout Options|
|Short Joint block names based on joint type||Potentially long Joint block names based on model hierarchy|
|Block names that are potentially overlapping||Block names that do not overlap|
|Block diagrams first oriented horizontally from left to right, then vertically from top to bottom||Block diagrams first oriented vertically from top to bottom, then horizontally from left to right|
The following table summarizes the default and nondefault hierarchy and organization options of a newly imported model.
|Aspect of Hierarchy & Organization||Default Hierarchy & Organization||Nondefault Option A||Nondefault Option B|
|At the subsystem level corresponding to the subassembly level in the original CAD assembly||At the highest level of the model or subsystem being imported||Same as default|
|Grouping of Bodies|
rigidly connected by Welds
|Ungrouped and located individually at the subsystem level corresponding to the subassembly level in the original CAD assembly||Grouped into their own subsystem within the subsystem corresponding to the subassembly level in the original CAD assembly||Same as nondefault hierarchy A|
Model Hierarchy and Organization Changed During Import: Graphical
Examples. These examples use the Physical Modeling XML example files,
Detailed graphics show the model hierarchies and organizations resulting
from different model simplification options during import. Key block
types are color coded to indicate their function in the model.
|Block Color||Block Type|
|Green||Rigidly welded Bodies|
|Red||Moving Joints (DoFs)|
two ways to see the difference between no model simplification and
the reorganization by grouping Bodies rigidly connected by Welds.
Import the file with no model simplification.
The figure shows a detailed graphic of the default model hierarchy. Except for the root body at the top level of model hierarchy, the rigidly welded Bodies are ungrouped, at the first level below the top level.
Import the file with the option to group Bodies rigidly
connected by Welds into their own subsystems. (With the
this choice corresponds to a value of
2 for the
The figure shows a detailed graphic of the reorganized model hierarchy. The rigidly welded Bodies in the subsystem are grouped into their own subsystem, creating a second level of hierarchy but simplifying the model appearance.
two ways to see the difference between no model simplification and
the double simplification of:
Promoting moving Joints to the top level of hierarchy
Grouping Bodies rigidly connected by Welds
Import the file with no model simplification. The figure shows a detailed graphic of the default model hierarchy. The moving Joints, representing degrees of freedom (DoFs), are located two levels down in the model hierarchy. Rigidly welded Bodies are ungrouped.
Import the file with the option to promote the moving
Joints to the top level and to group the Bodies rigidly connected
by Welds into their own subsystems. (With the
this choice corresponds to a value of
1 for the
The figure shows a detailed graphic of the simplified and reorganized model hierarchy. The DoFs, represented by the moving Joints, are promoted to the top level. Rigidly welded Bodies are grouped into a single subsystem. The model hierarchy is simplified with a single level below the top level, instead of two levels.
In addition to the paired coordinate systems automatically generated for Body–Joint connections, a generated model can contain other coordinate systems:
Imported versions of reference coordinate systems in the original CAD assembly that are not, in general, associated with CAD constraints. See Inserting Reference Coordinate Systems into Assemblies Before Export. Upon import, before manual modifications to the model, these Body coordinate systems are not connected to other blocks.
Coordinate systems manually added to the generated model after import. See Adding More Coordinate Systems .
Coordinate Systems: Automatically Generated, Inserted Before Export, and Manually Added After Import
A SimMechanics model satisfying full modeling requirements typically contains other blocks beyond those generated by import. These blocks can include Constraints, Drivers, Sensors, and Actuators (from the SimMechanics block library), as well as blocks from Simulink, such as Scopes. You manually insert and connect these additional blocks in your generated model.
Tip When you first generate a model from Physical Modeling XML, you might want to save this original CAD-based model before you create later versions by eliminating unnecessary blocks and adding new ones.
The constraint-to-joint mapping creates whatever blocks are needed to correctly isolate the degrees of freedom (DoFs). In some models, certain generated blocks are not needed for simulation. You can delete these unnecessary blocks to simplify your model without affecting its dynamics, as long as you reconnect the remaining blocks properly.
In particular, you can simplify the fundamental root, Ground – Root Weld – Root Body, in certain cases. (The same holds for subassembly roots. However, the corresponding subsystem's Root Body takes the place of Ground, and the subsystem's Fixed Body plays the role of Root Body.)
If the Root Body is connected to the rest of the block diagram by a single Joint, you can delete the Root Weld – Root Body blocks and reconnect the Joint directly to Ground.
If the Root Body is connected to the rest of the block diagram by multiple Joints, you cannot delete the Root Weld – Root Body sequence because a Ground can connect to only one Joint, and the generated model contains only one Ground. You have two alternatives in this case:
Determine where the Root Body coordinate systems (CSs) are. Delete the Root Weld – Root Body sequence. Then manually add more Grounds at the spatial points representing each of the deleted Root Body CS origins. Reconnect each Joint to its corresponding Ground at the correct spatial point.
Leave the Root Weld – Root Body sequence as it is.
Regrouping, Reducing, and Eliminating Welds. Not all Welds are redundant. Some Welds are needed to connect a Body that otherwise would be isolated from the rest of the model. Such Welds represent rigid connections between distinct assembly parts.
If you want to group Bodies rigidly connected by Welds
into their own subsystems, use the model hierarchy simplification
controls in the Advanced Options tab of the Import
Physical Modeling XML dialog box or
If you want to reduce or eliminate such Welds, return to your original assembly and reexport it with rigid subassemblies. See the SimMechanics Link documentation.
In addition to the automatically generated pairs of coordinate systems that connect Joints representing CAD constraints, you can also add your own coordinate systems to Bodies, after import. If you want to add Constraint, Driver, Actuator, or Sensor blocks to a generated model, and connect these blocks to one or more of the Bodies, you need extra Body coordinate systems as connection points.
These sections describe how to add Body coordinate systems to a Body:
Reference Coordinate Systems in the Original Assembly. You can also insert reference coordinate systems, in general not associated with constraints, in the original assembly before export. You might find positioning and orienting such coordinate systems easier in the CAD environment. Translation preserves these coordinate systems, which appear in the generated model in addition to the coordinate systems pairs connecting Joints and Bodies.
For more information, see Inserting Reference Coordinate Systems into Assemblies Before Export.
Constraints reduce the number of independent degrees of freedom in a mechanical system by preventing certain movements. Drivers affect DoFs, not by eliminating them completely, but by forcing their motions to follow an external time-dependent signal. A constrained or driven DoF is not free to respond to forces and torques independently.
These sections discuss how to add constraints and drivers to your model:
Note: You insert these constraints into the SimMechanics model as blocks. They act in addition to the part constraints in the original CAD assembly.
You can actuate bodies and joints in your SimMechanics models with external forces and motions and set up internal forces between bodies. You can also vary the mass or inertia (or both) of a body in time. Consult these sections for more details:
When you import a CAD assembly into the SimMechanics environment, the XML file determines the initial geometric configuration of the model's bodies. By default, the initial velocities of the bodies are zero, and the model is in home configuration.
If you want to change the initial positions and/or velocities of the bodies in your model to be different from the CAD-determined configuration, you need to add initial condition actuators, as discussed in Specifying Initial Positions and Velocities.
You can find the general instructions for building valid SimMechanics models in these sections:
When it generates the Body blocks in a model (except for Root Bodies), the SimMechanics importer automatically customizes the body geometries for visualization by referencing the STL files associated with the CAD assembly export. It also automatically customizes the body colors to match the original CAD part colors, which are captured by the exported XML file.