Main Content

Variant Hierarchical Components

Implement structural variations in a separate hierarchy

With hierarchical variant blocks, you can represent all design alternatives of a system in a single model. Each design choice is incorporated into the model as a variant choice in a separate hierarchy. Such models have a fixed common structure and a finite set of variable components that are activated or deactivated depending on the variant controls.

For example, suppose you want to simulate a model that represents a vehicle with three possible engine configurations: 4-cylinder gas, 6-cylinder gas, and 8-cylinder gas. You could implement each engine model as a separate subsystem inside the Variant Subsystem, Variant Model block and then switch between the subsystems based on the Types of Variant Control Modes in Variant Blocks you select.

The code that you generate for the hierarchical variant blocks can contain all the variant choices of a system. You can switch between the choices prior to code compile or at model startup. For more information, see Represent Subsystem and Variant Models in Generated Code (Embedded Coder).

Bloques

Variant Subsystem, Variant ModelTemplate subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices
Variant Assembly Subsystem

Clases

expandir todo

Simulink.VariantControlCreate a variant control variable object
Simulink.VariantSpecify conditions that control variant selection
Simulink.ParameterStore, share, and configure parameter values

Temas

Solución de problemas

Convert Configurable Subsystem to Variant Subsystem

Learn how to convert configurable subsystems to variant subsystems and their behavior on loading.

Convert Variant Subsystem Block to Variant Assembly Subsystem Programmatically

Transform Model to Variant System (Simulink Check)

Use the Model Transformer tool to transform a model into a variant system.