Skip to Main Content Skip to Search
Product Documentation

cgv.Config class - Package: cgv

Check and modify model configuration parameter values

Description

Creates a handle to a cgv.Config object that 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 successfully 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. When this change occurs, the model might no longer be set up for SIL or PIL. For more information, see Using Callback Functions.

Construction

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.

Name can also be a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.

Properties

CheckOutports

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.

ValueDescription
on (default)Compile the model and check the model outports configuration
offDo not compile the model or check the model outports configuration

ComponentType

Define the SIL or PIL approach

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

ValueDescription
topmodel (default)Top-model SIL or PIL simulation and standalone code interface mode.
modelblockModel block SIL or PIL simulation and model reference target code interface mode.

Connectivity

Specify mode of execution

ValueDescription
sim (default)Mode of execution is simulation. Recommends changes to a subset of the configuration parameters that SIL and all PIL targets require.
silMode 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.
pilMode 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.

LogMode

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

ValueDescription
SignalLogging

Log 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.

SaveOutput

Save 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.

ReportOnly

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.

ValueDescription
off (default)cgv.Config automatically modifies the configuration parameter values that it recommends for the model.
oncgv.Config does not modify the configuration parameter values that it recommends for the model.

SaveModel

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'.

ValueDescription
off (default)Do not save the model.
onSave the model in the working folder.

Methods

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

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects in the MATLAB Programming Fundamentals documentation.

Examples

Configure the rtwdemo_iec61508 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.
cgvCfg = cgv.Config('rtwdemo_iec61508', 'LogMode', 'SaveOutput', ...
    'connectivity', 'sil');
cgvCfg.configModel();
% Display the results of what the cgv.Config object changed.
cgvCfg.displayReport();
% Close the rtwdemo_iec61508 model.
bdclose('rtwdemo_iec61508');

See Also

cgv.CGV

How To

  


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