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 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).
|Variant Subsystem, Variant Model||Template subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices|
- Define, Configure, and Activate Variant Choices in a Variant Subsystem Block
Represent variant choices in Variant Subsystems.
- Types of Variant Control Modes in Variant Blocks
- Variant Activation Time for 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.
Solución de problemas
Learn how to convert configurable subsystems to variant subsystems and their behavior on loading.
Transform Model to Variant System (Simulink Check)
Use the Model Transformer tool to transform a model into a variant system.