Verify Numerical Equivalence with CGV
Before verifying numerical equivalence:
Configure your model for SIL or PIL simulation.
Use the
cgv.Config
class of the CGV API to verify the model configuration for SIL or PIL simulation.Configure your model for code generation. For more information, see Configure Model for Code Generation Objectives by Using Code Generation Advisor.
Save your model. If you modify a model without saving it, CGV can issue an error.
To verify numerical equivalence:
Set up the tests for the first execution environment. For example, simulation.
Use
run
to run the tests for the first execution environment.Set up the tests for the second execution environment. For example, top-model PIL.
Use
cgv.CGV.run
to run the tests for the second execution environment.Use
getOutputData
to get the output data for each execution environment.Use
getSavedSignals
to display the signal names in the output data. (optional)Build a list of signal names for input to other
cgv.CGV
methods. (optional)Use
createToleranceFile
to create a file correlating tolerance information with output signal names. (optional)Use
compare
to compare the output signals of the first and second execution environments for numerical equivalence.
Note
Simulink® Test™ is a separate product that provides additional capabilities for SIL and PIL testing, for example, test sequence construction and test management.