主要内容

本页采用了机器翻译。点击此处可查看英文原文。

使用报告 API 生成系统设计报告

R2026b

本示例展示如何基于报告 API 生成系统设计报告。系统设计报告是从系统的 Simulink® 模型生成的动态系统设计的描述。

基于报告 API 的系统设计报告使用报告 API 类的对象来报告系统组件。请参阅为 Simulink 和 Stateflow 元素创建报告生成器。

gensdd 函数

此示例中包含的 gensdd 函数生成包含以下节的报告:

  • 标题页面

  • 目录

  • 图窗列表

  • 表列表

  • 系统层次结构

  • 根系统章节,包含根模块图、模型注释(如有)、任务和模块执行顺序,以及根图中每个模块的属性。

  • 子系统章节,包含模型子系统的图、模型注释(如有)、模块执行顺序和模块属性。

  • 图章节包含每个模型图的图和图对象属性

  • 包含模型变量的设计数据章节

  • 系统模型配置章节包含有关模型活动配置集的详细信息

完整的 gensdd 函数列在本示例末尾。您可以修改 gensdd.m file 来创建自定义系统设计报告。

为 sf_car 模型生成 PDF 系统设计报告

为 sf_car 模型生成系统设计报告,并指定文档为 PDF。

gensdd("sf_car","PDF");

以下是报告的第一页:

Snippet of report showing the title page that contains the model name, "System Design Description", a snapshot of the model, the author name, and the report creation date.

此示例包括文件 sdd_sf_car_copy.pdf 中的报告副本。

自定义报告

gensdd 函数使用这些报告 API 类的对象来查找系统设计元素并报告系统设计:

报告器类

查找器和结果类

您可以使用这些对象的属性来过滤和格式化报告的信息。例如,在 makeSystemHierarchy 文件中的 gensdd.m 函数中,可以通过设置 istFormatter 报告器的 Lslreportgen.report.SystemHierarchy 属性将系统层次结构列表格式更改为有序列表。

function makeSystemHierarchy(rpt, hModel)
% Create a chapter reporting on the system hiearchy
import mlreportgen.report.*
import slreportgen.report.*
ch = Chapter("Title", "System Hierarchy");
ol = mlreportgen.dom.OrderedList();
add(ch,SystemHierarchy("Source",hModel,"ListFormatter",ol));
add(rpt, ch);
end

Snippet of the report showing part of Chapter 1 titled "System Hiearchy" and a portion of the linked model hiearchy.

该报告还使用这些报告 API 类的对象来创建和格式化报告的各个节:

您可以自定义报告和节的外观。请参阅报告格式化方法。

完整的 gensdd 函数

 type gensdd.m

另请参阅

| | | | | | | | | | | | |

主题