Main Content

cgv.Config

Check and modify model configuration parameter values

Description

A code generation verification configuration (cgv.Config) supports checking and optionally modifying models for compatibility with various modes of execution that use generated code, such as, Software-In-the-Loop (SIL) or Processor-In-the-Loop (PIL).

To execute the model in the mode that you specify, you might need to make additional modifications to the configuration parameter values or the model beyond those configured by the cgv.Config object.

By default, cgv.Config modifies configuration parameter values to the values that it recommends, but does not save the model. Alternatively, you can use cgv.Config parameters to modify the default specification. For more information, see the properties, ReportOnly and SaveModel.

If you use cgv.Config to modify a model, do not use referenced configuration sets in that model. If a model uses a referenced configuration set, update the model with a copy of the configuration set, by using the Simulink.ConfigSetRef.getRefConfigSet method.

If you use cgv.Config on a model that executes a callback function, the callback function might modify configuration parameter values each time the model loads. The callback function might revert changes that cgv.Config made. If this change occurs, the model might not be set up for SIL or PIL. For more information, see Customize Model Behavior with Callbacks.

Creation

cfgObj = cgv.Config(model_name) creates a handle to a cgv.Config object, cfgObj, using default values for properties. model_name is the name of the model that you are checking and optionally configuring.

cfgObj = cgv.Config(model_name, Name, Value) constructs the object using options, specified as parameter name and value pairs. Parameter names and values are not case sensitive.

The cgv.Config function accepts these arguments:

model_name

Name of the model that you are verifying.

Name-Value Pair Arguments

Optional comma-separated pairs of Name,Value arguments, where Name is an argument name or an property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in a variety of orders, such as Name1,Value1,…,NameN,ValueN.

Properties

expand all

Specify whether to compile the model and check that the model outports configuration is compatible with the cgv.CGV object. If your script fixes errors reported by cgv.Config, you can set CheckOutports to off.

  • If on, compile the model and check the model outports configuration.

  • If off, do not compile the model or check the model outports configuration.

Example: 'CheckOutports','on'

If mode of execution is simulation (connectivity is sim), choosing either value for ComponentType does not alter simulation results. However, cgv.Config recommends configuration parameter values based on the value of ComponentType.

If topmodel, the top-model SIL or PIL simulation mode and standalone code interface.

If modelblock, model block SIL or PIL simulation mode and model reference code interface.

Example: 'ComponentType','topmodel'

If sim, the mode of execution is simulation. Recommends changes to a subset of the configuration parameters that SIL and PIL targets require.

If sil, the mode of execution is SIL. Requires that the system target file is set to 'ert.tlc' and that you do not use your own external target. Recommends changes to the configuration parameters that SIL targets require.

If pil, the mode of execution is PIL with custom connectivity that you provide using the PIL Connectivity API. Recommends changes to the configuration parameters that PIL targets with custom connectivity require.

Example: 'Connectivity','sim'

Specify the Signal logging and Output parameters on the Data Import/Export pane of the Configuration Parameters dialog box.

If set to SignalLogging, the object logs signal data to a MATLAB® workspace variable during execution. This parameter selects the Data Import/Export > Signal logging parameter in the Configuration Parameters dialog box.

If set to SaveOutput, the object saves output data to a MATLAB workspace variable during execution. This parameter selects Data Import/Export > Output parameter in the Configuration Parameters dialog box. The Output parameter does not save bus outputs.

Example: 'SignalLogging',''

The ReportOnly property specifies whether cgv.Config modifies the recommended values of the configuration parameters of the model. If you set ReportOnly to on, SaveModel must be off.

Example: 'ReportOnly','off'

Specify whether to save the model with the configuration parameter values recommended by cgv.Config. If you set SaveModel to 'on', ReportOnly must be 'off'.

Example: 'SaveModel','off'

Object Functions

configModelDetermine and change configuration parameter values
displayReportDisplay results of comparing configuration parameter values
getReportDataReturn results of comparing configuration parameter values

Examples

collapse all

Configure the RollAxisAutopilot model for top-model SIL. Then view the changes at the MATLAB Command Window

% Create a cgv.Config object and configure the model for top-model SIL.
openExample('ecoder/TraceGeneratedCodeToBlocksExample','supportingFile','RollAxisAutopilot')
set_param('RollAxisAutopilot', 'SaveFormat', 'StructureWithTime');
cgvCfg = cgv.Config('RollAxisAutopilot', 'LogMode', 'SaveOutput', ...
    'connectivity', 'sil');
cgvCfg.configModel();

% Display the results of what the cgv.Config object changed.
cgvCfg.displayReport();

% Close the model.
bdclose('RollAxisAutopilot');

Version History

Introduced in R2009b