cgv.CGV
Represent a model as a code generation verification object that has methods to configure and execute a model in a variety of simulation modes to automate verification of numerical equivalence of executing the generated code
Description
A code generation verification (cgv
) object executes a model
in different environments such as, simulation, Software-In-the-Loop (SIL), or
Processor-In-the-Loop (PIL) and stores numerical results. Using the cgv.CGV
class methods, you can create a script to verify that the model and the
generated code produce numerically equivalent results.
cgv.CGV
and cgv.Config
use two of the same properties. Before executing a cgv.CGV
object, use cgv.Config
to verify the model configured for
the mode of execution that you specify. If the top model is set to normal simulation mode,
referenced models set to PIL mode are changed to Accelerator mode.
Creation
creates a handle to a code generation verification object using the default parameter values.
cgvObj
= cgv.CGV(model_name
)model_name
is the name of the model that you are verifying.
constructs the object using the parameter values, specified as cgvObj
= cgv.CGV(model_name
,Name
,Value
)Name,Value
pair arguments. Parameter names and values are not case sensitive.
The cgv.CGV
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, whereName
is the argument name andValue
is the corresponding value.Name
must appear inside single quotes (''
). You can specify several name-value pair arguments in a variety of orders, such asName1,Value1,…,NameN,ValueN
.'ComponentType'
— Define the SIL or PIL approachIf
topmodel
(default), 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 mode.If mode of execution is simulation (
Connectivity
issim
), choosing either value forComponentType
does not alter simulation results.Connectivity
— Specify mode of executionIf
sim
ornormal
(default), mode of execution is Normal simulation.If
sil
, mode of execution is SIL.If
pil
, mode of execution is PIL.
Example: Test Model for Numerical Equivalence
Properties
Object Functions
activateConfigSet | Activate configuration set of model |
addBaseline | Add baseline file for comparison |
addConfigSet | Add configuration set |
addHeaderReportFcn | Add callback function to execute before executing input data in object |
addInputData | Add input data |
addPostExecFcn | Add callback function to execute after each input data file is executes |
addPostExecReportFcn | Add callback function to execute after each input data file executes |
addPostLoadFiles | Add files required by model |
addPreExecFcn | Add callback function to execute before each input data file executes |
addPreExecReportFcn | Add callback function to execute before each input data file executes |
addTrailerReportFcn | Add callback function to execute after the input data executes |
compare | Compare signal data |
copySetup | Create copy of cgv.CGV object |
createToleranceFile | Create file correlating tolerance information with signal names |
getOutputData | Get output data |
getSavedSignals | Display list of signal names to command line |
getStatus | Return execution status |
plot | Create plot for signal or multiple signals |
run | Execute CGV object |
setMode | Specify mode of execution |
setOutputDir | Specify folder |
setOutputFile | Specify output data file name |
Examples
Version History
Introduced in R2009b