Skip to Main Content Skip to Search
Product Documentation

Working with Variant Systems

Overview of Variant Systems

Many applications require the ability to customize a model to fit different specifications, without replacing or duplicating the model. For example, a design engineer has a model that simulates an automobile. Various models of an automobile can have many similarities, yet differ in specific ways, such as fuel usage, engine size, or emission standards.

With blocks for variant systems, Simulink provides techniques to customize a model for different applications through design and simulation:

Each variant, active or inactive, has an object. Simulink evaluates the variant objects to determine the active variant.

You can parameterize the variant object by making it dependent on the values of variables and objects in the MATLAB base workspace. For a quick overview, see Model Variants Block Overview and Variant Subsystem Block Overview.

You can programmatically switch the active variant by modifying the values of variant control variables in the base workspace. Alternatively, you can manually override the variant selection on the block parameter dialog box.

Both variant models and variant subsystems use variants in a similar workflow. For more information, see Workflow for Implementing Variant Systems.

For alternative techniques to customize a model for different specifications, see:

TechniqueReference
Change data values in the base workspace.Tunable Parameters
Select alternate subsystems from a library.Configurable Subsystem block
Use a mask to change a subsystem.Creating Dynamic Masked Subsystems
Change the arguments to a parameterized referenced model.Parameterizing Model References

Workflow for Implementing Variant Systems

You can implement a variant system in your model by using the Model Variants block or the Variant Subsystem block. Both blocks use a similar workflow.

  1. Create the subsystems or referenced models that you want to use as variants.

  2. Set up your model to use the variants. Add the Model Variants block or the Variant Subsystem block, depending on your application. Use the blocks to:

    1. Specify variant models or subsystems.

    2. Create a variant object to associate with each variant.

    3. Define a condition for each variant. When the condition is true, Simulink uses this active variant for simulation.

      For more information, see Setting Up Model Variants and Setting Up Variant Subsystems.

  3. Create the control variables for evaluating variant conditions and selecting the active variant. See Setting Up Variant Control and Selecting the Active Variant.

  4. Simulate using the active variant.

  5. Modify the variant specification to select another variant and simulate again.

  6. Generate code for the active variant or all variants, depending on your application. See Code Generation of Variants.

  7. Save the control variables and objects for your variants from the base workspace as described in Exporting Workspace Variables.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS