Main Content

Variant Inline Components

Implement structural variations in a single layer

With inline 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 single layer. Such models have a fixed common structure and a finite set of variable components that are activated or deactivated depending on the variant control. You can activate the components automatically or manually.

For example, suppose you want to simulate a model to control the speed of the car windshield wiper by using different rain sensors. You could provide the rain sensor models as inputs to the Variant Source block and then switch between the sensors based on the Types of Variant Control Modes in Variant Blocks you select.

The code that you generate for the inline 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 Variant Source and Sink Blocks in Generated Code (Embedded Coder).

Bloques

Variant SourceRoute among multiple inputs using variants
Variant SinkRoute amongst multiple outputs using variants
Manual Variant SourceSwitch between multiple variant choices at input
Manual Variant SinkSwitch between multiple variant choices at output

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

Automatically Select Variant Source and Destination Signals

Manually Specify Variant Source and Destination Signal

Solución de problemas

Transform Model to Variant System (Simulink Check)

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