Main Content

reduceModel

Class:Simulink.VariantManager
Package:万博1manbetx

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 Arguments

Specify optionalName,Valuearguments.Nameis the argument name andValueis the corresponding value. You can specify several name and value arguments in any order asName1,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 variableWuses a reference value of 1.

Specifies whether the model should be compiled for simulation or code generation mode as part of reduction. If the model contains variant blocks with theVariant control modeparameter set tosim codegen switching, you can specify the value ascodegento retain the code generation branches of the blocks in the reduced model. For the default valuesim, Variant Reducer compiles and retains the simulation branches in the top-level model.

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

When the value istrue, 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 istrue,变异减速机显示步骤的细节s performed during model reduction.

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

When the value istrue, 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 haveSimulink Report Generatorlicense.

Examples

%控制variab减少模型基于它的变体le 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('slexVariantManagement', ... '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}); % Reduce the model by specifying the compilation mode as code generation. Simulink.VariantManager.reduceModel... ('slexVariantReducer','NamedConfigurations', {'config1'},'CompileMode','codegen','OutputFolder','L:\Models');

Version History

Introduced in R2016a