Documentation

Controlling Model Update at the Block Level

Associativity and Updating

To update an existing generated Simscape™ Multibody™ model with changes to its original external definition (a CAD assembly, for example), the intermediate Physical Modeling XML file and the model itself must retain information about the identities of at least some of its components. This section explains this "identity memory" or associativity.

What Is Associativity?

Associativity is a key concept for understanding the relationship between CAD assemblies and Simscape Multibody models based on them, and the export and updating process that defines Simscape Multibody models from CAD assemblies.

Associativity Between CAD Assemblies and Simscape Multibody Models

Associativity is a persistent (session-independent) parallel relationship among certain components of a CAD assembly, Physical Modeling XML files exported from it, and Simscape Multibody models generated from the XML files.

This relationship preserves the identities and parallelisms of certain CAD components and the corresponding imported components of the Simscape Multibody model. The Simscape Multibody Link exporter defines these unique identities from the CAD assembly components and embeds them in the exported Physical Modeling XML file. Simscape Multibody models generated from the XML file in turn retain these identities.

You actualize associativity when you generate a Simscape Multibody model from a CAD assembly. Associativity is a mapping between parts, constraints, and subassemblies in a CAD assembly and the corresponding Body and Joint blocks, coordinate systems, and subsystems in the Simscape Multibody model generated from that CAD assembly. It uniquely captures the identities of these CAD components, their corresponding blocks, and their topology (how they are connected to one another).

Associativity is not completely symmetric between the CAD and Simscape Multibody worlds, because the translation process moves in one direction only, from CAD assembly to generated Simscape Multibody model.

When and Why You Need Associativity

Associativity is required for updating a generated Simscape Multibody model when its originating CAD assembly has been changed.

How Associativity Is Implemented

When you use the Simscape Multibody Link exporter to create a Physical Modeling XML file from a CAD assembly, these components receive unique XML identifiers. When you use the Simscape Multibody importer to generate a Simscape Multibody model from the XML file, the identifiers are preserved in the corresponding Simscape Multibody model features.

Parallel Identities Between CAD Assembly and Simscape Multibody Model Components Captured by Associativity

CAD Assembly ComponentsCorresponding Imported Simscape Multibody Model Components
Parts and groundsBody and Ground blocks
Constraints between parts
(allowed motions)
Joint blocks
Constraints between parts
(positions and orientations)
Paired coordinate systems attached to Joints
Reference coordinate systemsBody coordinate systems unattached after import
Subassembly hierarchySubsystem hierarchy

Changing Assemblies, Generated Models, and Their Associativity

The associativity of CAD assembly and generated Simscape Multibody model is open, modifiable, and extensible. As long as a generated Simscape Multibody model retains at least one associated imported component, this model retains some associativity with its originating CAD assembly.

Preserving associativity.  You preserve the original associativity if you do not remove or reconnect associated components in either the CAD assembly or the Simscape Multibody model.

Changing the properties of an associated component, without removing or reconnecting it, both uses and preserves associativity.

Extending associativity.  You extend the original associativity if you add new, associable components to the CAD assembly, export the assembly, and update-import the generated Simscape Multibody model. The new components generated in the updated Simscape Multibody model are associated with the new components of the CAD assembly.

Modifying associativity.  You modify the original associativity if you remove or reconnect one or more associated components in the Simscape Multibody model.

  • The associativity of the removed or reconnected associated components is destroyed.

  • The associativity of the other associated components, and of the Simscape Multibody model as a whole, remains intact.

  • You recreate the original associativity of the removed or reconnected components in the Simscape Multibody model if you reimport the unchanged components from the CAD assembly.

    You can prevent this reimportation of the original CAD assembly components and overwriting of your manual changes to a Simscape Multibody model, depending on your import settings. See Working with Associativity in Common Updating SituationsWorking with Associativity in Common Updating Situations.

Replacing associativity.  You replace the original associativity if you remove or reconnect one or more associated components in the CAD assembly.

Once you export the CAD assembly and update-import the Simscape Multibody model, the associativity of the removed or reconnected components is destroyed. In this case, the component is either connected in a new way, with a new associativity, or it is removed altogether.

Working with Associativity in Common Updating Situations

The unique parallel identities created by associativity allow you to revise and expand CAD assemblies, then export the changed CAD assemblies and update existing Simscape Multibody models based on them. While you can also create entirely new Simscape Multibody models from the updated XML, associativity saves the effort invested in editing and testing by reusing existing Simscape Multibody models.

The following translation cases cover the basic possibilities. You can combine some of them into more complex, compound cases. For example, you can change a CAD assembly by both revising existing component properties and adding new components.

You can also modify the import process by preventing or allowing certain automatic block and block connection changes. See Controlling How Update-Import Changes Individual Blocks and Connections.

Exporting a CAD Assembly and Generating a Simscape Multibody Model for the First Time

During CAD export, Simscape Multibody Link assigns a unique XML identifier to each CAD component. For a table summarizing the different CAD components, see How Associativity Is Implemented.

When you import the XML file and generate a Simscape Multibody model from it, the corresponding model components listed in the table's second column receive these parallel identities.

Updating a Generated Simscape Multibody Model by Modifying CAD Assembly Properties

If you modify a CAD assembly and export a new Physical Modeling XML file from it, updating the model with the modifications allows you to reuse an existing Simscape Multibody model that was previously translated from the same assembly.

You modify a CAD assembly when you change the properties of its components without changing their identity. For a table of CAD assembly components you can modify, see How Associativity Is Implemented.

You update a generated Simscape Multibody model when you import the Physical Modeling XML file for the modified CAD assembly. The updated model reflects the new component properties in the modified assembly.

Associativity identifies the components in the existing generated Simscape Multibody model so that the importer can update their properties.

Updating a Generated Simscape Multibody Model by Extending the CAD Assembly

If you add more components to a CAD assembly and export a new Physical Modeling XML file from it, updating the model with the extensions allows you to reuse an existing Simscape Multibody model previously translated from the same CAD assembly.

You extend a CAD assembly when you add one or more components to it. For a table of CAD assembly components you can add, see How Associativity Is Implemented.

You update a generated Simscape Multibody model when you import the Physical Modeling XML file for the extended CAD assembly. The updated model contains new blocks representing the new components in the extended assembly. Blocks representing original CAD components remain unchanged.

Associativity identifies the original components in the existing generated Simscape Multibody model so that the importer does not change them while adding the new associated components.

Modifying a Generated Simscape Multibody Model Associated with a CAD Assembly, Then Updating Its Associated Components

You can also manually add nonassociated components to an existing Simscape Multibody model previously generated from a CAD assembly, separately revise the assembly, then retranslate the assembly by update-importing the Simscape Multibody model with the revisions.

  • The associated Simscape Multibody model components are updated with the CAD assembly revisions.

  • The nonassociated Simscape Multibody model components are not unchanged.

  • If the nonassociated Simscape Multibody model components are connected in the original model to associated blocks, they might become disconnected after update-import.

    • Nonassociated model components can include Constraints, Drivers, Actuators, and Sensors that you manually added and connected to associated, imported Bodies and Joints.

    • Nonassociated model components can also include Bodies and Joints added manually after you generated the original Simscape Multibody model. These Bodies and Joints were not import-generated and therefore cannot be associated.

Replacing Associated Joints with Nonassociated Joints in a Generated Simscape Multibody Model, Then Updating the Model

You can manually delete an associated imported Joint and replace it with a nonassociated Joint. This option is an important case of modifying and updating a generated Simscape Multibody model.

  1. Delete the associated imported Joint.

  2. Add a replacement Joint manually. This Joint is not associated with the original CAD assembly, because it was not imported.

    However, the two Bodies on either side of the Joint and to which it is connected are still associated, unless you also replace them. Thus the replacement Joint is a nonassociated block connected to two associated blocks.

  3. Update-import the modified Simscape Multibody model with changes to the originating CAD assembly. Because it is not associated, the replacement Joint is not changed by the update-import.

  4. Fix any broken connections of the replacement Joint to the associated Bodies, depending on the nature of the changes to the originating CAD assembly.

    If you replace the associated Bodies on either side of the Joint as well, then all three blocks are now nonassociated. The update-import cannot change them or any connections among them.

Controlling How Update-Import Changes Individual Blocks and Connections

You can modify how the update-import process changes the updated model.

Enabling and Disabling Automatic Update of Individual Associated Blocks

If you want to prevent the update-import process from updating or removing particular blocks in a generated model, you can disable the updating or removal for individual blocks. Doing this does not erase any associativity information from these blocks, and you can reenable automatic updating as long as the block exists in the model.

To enable automatic updating for an individual associated block:

  1. Right-click the block and select the Simscape Multibody menu item.

  2. Clear Retain without updating properties. This is the default.

To disable automatic updating for an individual associated block:

  1. Right-click the block and select the Simscape Multibody menu item.

  2. Select Retain without updating properties.

    Note:   The right-click submenu item is available only on associated blocks. The default for Retain without updating properties is cleared. That is, the default is that automatic block updating is enabled.

Respecting and Overriding Associated Block Update Settings During Model Update-Import

You can override individual associated block update settings for the model update as a whole.

In the import dialog, you can specify whether the update-import respects or overrides these individual block settings on the Advanced Options tab. (The mech_import command allows you to set an equivalent option as a command input.)

  • To require that the update-import respect the individual associated block update settings, select the Respect individual block update settings check box. This is the default.

  • To override the individual associated block update settings, clear the Respect individual block update settings check box.

Preserving and Breaking Connectivity of Nonassociated Blocks to Updated Associated Blocks

If you want the update-import to preserve the connections of individual nonassociated blocks to associated blocks, you can enable connection preservation for individual blocks. You can also allow the update-import to break such connections. Allowing connection breaking does not remove the nonassociated block. You can reconnect it manually and reenable connection preservation again as long as the block exists in the model.

To always preserve the connection of an individual nonassociated block from an updated associated block:

  1. Right-click the nonassociated block and select the Simscape Multibody menu item.

  2. Select Retain connectivity to imported blocks. This is the default.

To allow automatic disconnection of an individual nonassociated block from an updated associated block:

  1. Right-click the nonassociated block and select the Simscape Multibody menu item.

  2. Clear Retain connectivity to imported blocks.

    Note:   The right-click submenu item is available only on nonassociated blocks connected to associated imported blocks. The default for Retain connectivity to imported blocks is selected. That is, the default is that automatic updating preserves the nonassociated block's connection to associated blocks.

Associativity in an Updating Sequence Example

This example shows how associativity works and how you can use it in a simple three-body mechanical system translated from a CAD assembly to a Simscape Multibody model.

The machine consists of three bodies connected in a chain. The first and second bodies are constrained with one type of allowed motion. The second and third bodies are constrained with another type of allowed motion.

Translating the Assembly and Generating the Model for the First Time

The initial translation from the CAD assembly results in a Simscape Multibody model with three bodies (B1, B2, B3) connected in a chain by two joints (J1, J2). These associated model components are the Body and Joint blocks and the Body Coordinate Systems (CSs) that connect the Bodies through the Joints.

Revising an Assembly Body, Manually Adding Nonassociated Sensors in the Model, and Updating the Model from the Assembly

The next step is to revise the assembly by changing some properties of one of the assembly parts (P2). At the same time, you add two new, nonassociated components to the generated model: a Joint Sensor (JS) and a Body Sensor (BS).

You then update-import the model from the revised assembly. The body properties of B2 are updated. Assuming you keep the default settings, the connections of the nonassociated Joint and Body Sensors to J1 and B3, respectively, are retained.

Manually Replacing an Associated Model Joint and Updating the Model from the Assembly: Update Options

The last step in the example is to manually replace one of the model joints (J2) with a new, nonassociated Joint block (J3). If you update-import the model from the assembly now, you must choose how to update the replaced joint J3:

  • You can override the manual joint replacement.

    The old joint J2 is reimported and re-replaces the manually inserted joint J3. This is default setting on Simscape Multibody blocks.

  • You can require that the manual changes be retained.

    The newly added joint J3 is retained. This choice requires you to change the default setting on the relevant Simscape Multibody blocks.

The import default is to respect the individual block settings in any case, although you can change that as well.

Was this topic helpful?