How to Use Variant Manager in Simulink, Part 1
From the series: Variant Manager
Learn how Variant Manager can help in system development when there are various design alternatives. These various design alternatives can be modeled in Simulink® models using variant elements. To manage these variant elements, you can use Variant Manager.
This demonstration shows an example of a wiper system model. The wiper system model includes multiple modes that are modeled using variant elements. Variant Manager captures the model hierarchy, enabling visualization and management of variant elements.
In Part 2 of this video series, you will learn how to analyze configurations and reduce the model using Variant Manager.
Published: 31 Oct 2023
In Model Based Design, for system development, Products may have many systems each having multiple design alternatives.
And sometimes we may Create multiple products using different system configurations, Resulting in many possible combinations.
Simulating these multiple combinations can get complex.
To simply this we can represent all these combinations in a single Simulink model with the help of variant elements.
And to manage these combinations and elements, you can use Variant Manager.
Variant manager allows you to manage, analyze and reduce your model effectively.
In this video we will look at the Wiper system model.
Wiper system model has Manual modes such as ThreeSpeed mode which include Low, Medium and high speed mode and a Variable speed mode. The sensor based mode has smart mode and Variable and Smart mode.
Let us look at the model representing this wiper system.
In this model, we need to figure out the speed command of front and rear wiper systems. The model accepts manual input from the user and sensor inputs from rain and fog sensor to determine the outputs.
This model can run under different modes like threespeed, variable, smart and variable&smart. Now these modes are modeled using variant elements like variant subsystems, which contains multiple subsystem options and you can activate any one of them as required.
A variant source block is used to select any one possibility from all the available variant choices.
Also, the model uses lookup table to determine gain for the variable mode. This may require the flexibility to have different values of x and y axes. To have this flexibility, values of X and Y axes are stored in the form of variant parameters as seen here. (Show parameter names on screen)
Now to manage these variant elements and their resulting combinations, let us use variant manager. Select the modeling tab in the toolstrip and click on Variant manager.
As you can see, the Variant Manager has captured the model hierarchy, allowing you to visualize and manage the usage of different variant elements. (Show variant elements)
Additionally, all variant parameters can be viewed in one place which makes it clear and convenient to view conditions, values, and other details.
(go back to “blocks”) The variant blocks which we saw in the model can also be seen here. These variant blocks provide choices which can create multiple combinations.
Now to simulate combinations of these choices, you must first create variant configurations.
You can automatically generate variant configurations using the “Generate Configurations” option.
Let us generate all valid and unique configurations for this model. Then again click on “Generate configurations”. And now you can add these generated configurations to the variant manager.
If you wish to add a customized configuration instead of automatically generated one, simply click here. You can also rename the configurations for better understanding as per your choice.
For each configuration you can add control variables or import them directly from the workspace using the “import” option.
For this configuration I will select the values of Front and Rear wiper control variables as Three Speed. For this configuration, I will select ThreeSpeed value for front and rear control variables.
In this example we will remove the auto generated configurations and use only the custom configurations. And Similar to three speed configurations we have created 4 other custom configurations.
Now, to apply any of the listed configurations, you can select the desired configuration and simply click on “Activate configuration.”
Now you can run your model with this activated configuration.
Also, you can easy view where your control variables are contributing in the selected configuration by using the “Show Usage” option.
If you wish to avoid creation of any unnecessary configurations, you can also add constrains with certain conditions.
Now that you have your configurations and constrains ready, you can store them in Simulink variant configuration object. Let us save current combinations with object name as “My_object”. You can easily recall all your configurations and constrains using the object name with reload option.
Now you can activate and run any configuration as per your choice.
Now you know how to manage your Variant elements using Variant manager.
You can look at part 2 of this video series to understand how to analyze your configurations and reduce your model using Variant manager.