Main Content

Variant Connector

Remove or disconnect physical components from network

  • Library:
  • Simscape / Utilities

  • Variant Connector block

Description

The Variant Connector block lets you define variant choices in a physical network. Variant choices allow you to exclude some components from simulation without physically removing the components from the physical network. The components to be disconnected must be connected to the port associated with condition data. During simulation, the variant condition is propagated to all the connected components within the physical network. If the variant control associated with the block evaluates to true, all the components that are connected to the block become active. If the variant control evaluates to false, all the components connected to the block become inactive.

Note

  • The Variant Connector block does not propagate the variant condition across the boundary between the Simscape™ physical network and the Simulink® blocks connected to it. In other words, a block that has both conserving ports and Simulink signal ports, such as a Simulink-PS Converter or a PS-Simulink Converter block, does not propagate the variant condition from a Variant Connector block between the two parts of the model.

  • The Variant Connector block propagates the variant condition not only to the connected port but also to the other ports of the Subsystem and Simscape Bus blocks. For more information, see Variant Condition Propagation in Subsystem and Simscape Bus Blocks.

Ports

Conserving

expand all

This port is located on the left side of the block and is labeled with a rectangle. During simulation, if the variant choice associated with the block evaluates to true, all the components that are connected to this port become active. If the variant choice associated with the block evaluates to false, all the components connected to this port become inactive.

By default, this port is untyped. You define the type of this port by connecting it to a conserving port of another block, components in the network, or a Simscape Bus port.

Conserving connection port. By default, this port is untyped.

You define the type of the port by connecting it to a conserving port of another block, components in the network, or a Simscape Bus port.

Parameters

expand all

Select a connector type based on the components to deactivate.

  • Leaf: If you want to deactivate all the components connected to the block, set Connection Type to Leaf.

    For example, in this model, the variant condition associated with the Variant Connector block, ConneBlk1, is A == 1. The variant condition associated with the Variant Connector block, ConneBlk2, is B == 1. During simulation, when A == 1 evaluates to true and B == 1 evaluates to false, all the components connected to ConneBlk1 block become active, and all the components connected to ConneBlk2 block become inactive.

  • Primary and Nonprimary: If you want to restrict the propagation of the variant condition to a set of components, create a Bounded region by using primary and nonprimary connector blocks. To form a bounded region, the primary and nonprimary connector blocks must have the same Connector Tag property.

    When you set Connection Type to Primary or Nonprimary, the connector tag of the block is displayed on the block icon. The connector tag of the primary connector block is displayed with double lines and the connector tag of the nonprimary connector block is displayed with single lines.

Specify an identifier in the Connector Tag parameter. The primary and nonprimary connector blocks with the same tag form a Bounded region.

Dependencies

To enable this parameter, set Connector Type to Primary or Nonprimary.

Displays the variant controls available in the global workspace. The variant control can be a Boolean condition expression containing a regular MATLAB variable or a Simulink.Variant object representing a Boolean condition expression.

To edit a variant name, double-click a Variant control expression cell and type in the variant control expression. Click Apply after you edit a variant control name.

When the variant control associated with the block evaluates to true, all the components connected to the block become active.

Programmatic Use

Block Parameter: VariantControls
Type: cell array of character vectors
Value: Variant control that is associated with the Variant choice
Default: 'Variant'

This read-only field is based on the condition for the associated Variant control in the global workspace. Create or change a Variant condition in the Simulink.Variant parameter dialog box or in the global workspace.

For more information, see Create Variant Controls Programmatically and Simulink.Variant.

Select Show variant condition on block to display the variant condition associated with the block on the block icon.

Click Open block in Variant Manager to open the Variant Manager.

More About

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced in R2020b