Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

Simulink 中进行 Code Prover 分析

验证导入到 Simulink® 模型中的代码以及从中生成的代码

使用 Polyspace® 标识 Simulink 模型中潜在的 Bug、运行时错误以及编码标准违规。在验证和确认过程的两个不同步骤中使用 Polyspace。

在生成代码之前,请检测并解决模型中的自定义代码可能引入的问题。C function 块、C caller 块和 S function 块中包含自定义代码。请参阅Run Polyspace Analysis on Custom Code in Simulink Models

在生成代码后,分析生成的代码,找出模型中可能没有发现的特定于代码的问题,例如,由于模型的未测试部分或不正确的代码生成选项而导致的错误。请参阅对通过 Embedded Coder 生成的代码运行 Polyspace 分析

在集成 Polyspace 和 MATLAB® 后,您可以直接从 Simulink 工具条运行 Polyspace 分析,也可以使用 MATLAB 脚本自动执行 Polyspace 分析。请参阅将 Polyspace 与 MATLAB 和 Simulink 集成使用 MATLAB 脚本运行 Polyspace 分析。另外,还可以从 Simulink 模型生成选项文件,并在系统命令行中使用这些选项文件对生成的代码运行 Polyspace 分析。请参阅使用打包的选项文件对生成的代码运行 Polyspace 分析

函数

polyspacesetupPolyspace 安装与 Simulink 集成
pslinkrunCrossReleaseAnalyze C/C++ code generated by R2020b or newer Embedded Coder versions by using a different version of Polyspace that is more recent than the Simulink version (自 R2021a 起)
pslinkoptionsCreate an options object to customize configuration of a Simulink model, generated code or a S-Function block. Use the object to specify configuration options for these Simulink objects in a Polyspace run from the MATLAB command line
pslinkrunRun Polyspace analysis on model, system, or S-Function
pslinkfunManage model analysis at the command line
polyspacePackNGoGenerate and package options files to run Polyspace analysis on code generated from Simulink model (自 R2020b 起)

polyspace.ModelLinkOptionsCreate a project configuration object for running Polyspace analysis on generated code

属性

pslinkoptions 属性pslinkoptions 对象的属性
polyspace.ModelLinkOptions PropertiesCustomize Polyspace analysis of generated code with options object properties

模型设置

全部展开

Settings from (C)Settings to use for the Polyspace analysis of C code
Settings from (C++)Settings to use for the Polyspace analysis
Project configurationSet advanced configuration options to customize analysis
InputOption to choose whether to constrain Inport block variables
Tunable parametersOption to specify the assumed value of tunable parameter values during the analysis
OutputOption to verify whether output variables are within expected bounds
Model reference verification depthDepth of model reference hierarchy for Polyspace analysis
Model by model verificationOption to analyze each model or referenced model individually
Ignore model referencesOption to ignore specified model references (自 R2023b 起)
Model reference input/output range verificationOption to verify that input and output of model references are within specified values (自 R2024a 起)
Output folderPath and folder name for your analysis results
Make output folder name unique by adding a suffixOption to add a unique suffix to the results folder for every Polyspace run
Open results automatically after verificationOption to open analysis results in Polyspace user interface after analysis completes
Add results to current Simulink projectOption to add your Polyspace results to current Simulink project
Product modeChoice between Polyspace Bug Finder and Polyspace Code Prover (自 R2021b 起)
Use custom project fileOption to use custom configuration from a Polyspace project (.psprj) file
Enable additional file listOption to add additional supporting code files to analysis
Stub lookup tablesOption to stub autogenerated functions that use lookup tables with linear interpolation
Verify all S-function occurrencesOption to analyze all instances of selected S-Function block
Check configuration before verificationOption to check model and code configurations for errors before code analysis

主题

设置

分析生成的代码

分析自定义代码

高级配置

如何分析生成的代码