Variant Inline Components
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 a car windshield wiper by using different rain sensors. You can provide the rain sensor models as inputs to a Variant Source block and then switch between the sensors based on the variant control you select. For more information, see Introduction to Variant Controls.
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 as described in Activate Variant During Different Stages of Simulation and Code Generation Workflow. For information on generating code with inline variant blocks, see 变体结构 (Simulink Coder).
模块
Variant Source | Route among multiple inputs using variants |
Variant Sink | Route amongst multiple outputs using variants |
Variant Start | Define start of bounded region (自 R2024a 起) |
Variant End | Define end of bounded region (自 R2024a 起) |
Manual Variant Source | 在输入端的多个变体选择项之间切换 |
Manual Variant Sink | 在输出端的多个变体选择项之间切换 |
类
Simulink.VariantControl | Create a variant control variable object (自 R2021a 起) |
Simulink.Parameter | 存储、共享和配置参数值 |
Simulink.Variant | 指定控制变体选择的条件 |
Simulink.VariantUtils | Utility methods to work with variant elements (自 R2023b 起) |
函数
enumeration | 类枚举成员和名称 |
对象
struct | 结构体数组 |
主题
自动选择变体源和目标信号
- Define and Configure Variant Sources and Sinks
Represent variant choices using Inline Variants. - Visualize Variant Implementations in a Single Layer
View the variant choices in a model containing Inline Variants. - Variant Control Modes in Variant Blocks
Learn how to control variant blocks. - Propagate Variant Conditions to Define Variant Regions with Variant Blocks
Determine active model components by propagating variant conditions using variant blocks. - Propagate Variant Conditions to Define Variant Regions Using Variant Source and Variant Sink Blocks
Propagate variant conditions from the Variant Source and Variant Sink blocks. - Propagate Variant Conditions to Control Execution of Conditional Subsystems
Understand how to use Variant Subsystem blocks with conditionally executed systems as variant choices.
手动指定变体源和目标信号
- Provide Variation in Signal Source and Destination Using Manual Variant Source and Manual Variant Sink Blocks
This example shows how to use the inline variant blocks Manual Variant Source and Manual Variant Sink.
疑难解答
Transform Model to Variant System (Simulink Check)
Use the Model Transformer tool to transform a model into a variant system.