Variant Hierarchical Components
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 can implement each engine model as a separate subsystem inside the Variant Subsystem, Variant Model, Variant Assembly Subsystem block and then switch between the subsystems based on the variant controls you select. For more information, see Introduction to Variant Controls.
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 as described in Activate Variant During Different Stages of Simulation and Code Generation Workflow. For information on generating code with hierarchical variant blocks, see Represent Subsystem and Variant Models in Generated Code (Embedded Coder).
|Variant Subsystem, Variant Model, Variant Assembly Subsystem||Template subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices|
|Class enumeration members and names|
- Define, Configure, and Activate Variant Choices in a Variant Subsystem Block
Represent variant choices in Variant Subsystems.
- Variant Control Modes in Variant Blocks
Learn how to control variant blocks.
- Propagate Variant Conditions Outside Variant Subsystems
Propagate variant conditions outside a Variant Subsystem block to adapt its interface according to the state of underlying blocks.
- Use Variant Subsystem Blocks with Conditionally Executed Subsystems
Understand how to use Variant Subsystem blocks with conditionally executed systems as variant choices.
- Variant Function-Call Signals on Variant Subsystem Outport
This example shows how the Variant Subsystem block allows function-call signals from its choice blocks to be merged on its outports.
- Model Reference Variants
This example shows how to use model reference variants.
- Control Active Choice of Locked Custom Library Variant Subsystem Using Mask Parameter
Control active choice of Variant Subsystem that belongs to a locked custom library.
- Add or Remove Variant Choices of Variant Assembly Subsystem Blocks Using External Files
Understand how to add or remove variant choices of the Variant Assembly Subsystem block using the Variant choices specifier parameter.
- Control Variant Choices in Masked Variant Assembly Subsystem Block Using Mask Parameter Object
This example shows how to specify variant choices and set an active choice in a masked Variant Assembly Subsystem block using a mask parameter object.
Risoluzione dei problemi
Learn how to convert configurable subsystems to variant subsystems and their behavior on loading.
Steps to convert Variant Subsystem block to Variant Assembly Subsystem block.
Transform Model to Variant System (Simulink Check)
Use the Model Transformer tool to transform a model into a variant system.