reduceModel

Class: Simulink.VariantManager
Package: Simulink

Generate reduced model for specified variant configurations

Syntax

Simulink.VariantManager.reduceModel(Model)
Simulink.VariantManager.reduceModel(Model, Name, Value)

Description

Simulink.VariantManager.reduceModel(Model) creates a reduced model for the specified configuration. The referenced models and library blocks are also reduced. By default, the name of the reduced model and any reduced child referenced model name is the original model name suffixed with _r.

Simulink.VariantManager.reduceModel(Model, Name, Value) specifies the reduction parameters in the Name and Value arguments form.

Input Arguments

expand all

Required field. Model to be reduced, specified as a character vector.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' ') and is caseinsensitive whereas, the value string is casesensitive. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Specifies the names of variant configurations. By default, current values of variant control variables are used for reduction.

Specifies the variant control variable values to be used for reduction. By default, the current values of variant control variables are used.

The specified values must be a cell array with variant control variable names and their corresponding values.

Note

'VariableGroups' and 'NamedConfigurations' are mutually exclusive.

Consider this example:

Simulink.VariantManager.reduceModel('iv_model', ...
                                          'VariableGroups',...
                                          {{'V',1,'W',1},{'V',2,'W',2}})

Specifies the full-range variant control variable values to be used for reduction. This allows you to reduce a model for all valid values of the specified variant control variable. Provide a reference value for variant control variable that results in a successful model compilation.

Consider this example:

Simulink.VariantManager.reduceModel('slexVariantReducer',...
                    'VariableGroups',{'V',1},...
                    'FullRangeVariables',{'W',1});

You can specify a variant control variable, 'W', as a full-range variant control variable. This allows you to reduce the model for all valid values of variable 'W'. In the example, full-range variant control variable W uses a reference value of 1.

Specifies the folder to place the reduced models and related artifacts. By default, the reduced models are generated in ./reducedModel subfolder in the original model folder.

When the value is true, the Variant Reducer preserves the compiled signal attributes between the original and reduced models by adding signal specification blocks at appropriate block ports in the reduced model. Compiled signal attributes include signal data types, signal dimensions, compiled sample times, etc.

When the value is true, the Variant Reducer displays details of the steps performed during model reduction.

Specifies the suffix to append to the reduced models and the related artifacts.

When the value is true, the Variant Reducer generates a html file with details about the reduced model and any modifications that may be required for masks and callbacks.

Note

To generate summary, you must have Simulink Report Generator license.

Examples

% Reduce model based on its variant control variable values in the base workspace.
Simulink.VariantManager.reduceModel('sldemo_variant_subsystems');

% Reduce the model associated with a variant configuration data object and configurations to be retained in the reduced model.
Simulink.VariantManager.reduceModel('slexVariantManagementExample', ...
                                          'NamedConfigurations', {'LinInterStd',
                                          'NonLinExterHighFid'})

% Reduce the model by specifying variant control variable values. Here, two groups are specified corresponding to 
% {V==1, W==1}, and {V==2, W==2} respectively.
Simulink.VariantManager.reduceModel('iv_model', ...
                                          'VariableGroups',...
                                          {{'V',1,'W',1},{'V',2,'W',2}});

% Reduce the model by specifying variant control variable values where 'W' is a full-range variant control variable and 'V' is 1. Here, Variant Reducer 
% automatically maps the specification to correspond to the following four explicit groups: {V==1, W==1}, {V==1, W==2}, {V==1, W==3} and {V==1, W==0} respectively.
Simulink.VariantManager.reduceModel('slexVariantReducer',...
                                          'VariableGroups',...
                                          {'V',1},...
                                          'FullRangeVariables',{'W',1}); 

Introduced in R2016a