System Composer レポート API によるシステム アーキテクチャ レポートの生成
この例では、System Composer™ アーキテクチャ モデルとそのアーティファクトについて、レポート API ベースのアーキテクチャ レポートを生成する方法を示します。
この例に含まれている generateArchitectureReport 関数は、次の節を含むレポートを生成します。
タイトル ページ
目次
モデル要素を含むアーキテクチャ要素の章
システム要件を含む要件解析の章
モデルに関連付けられているカスタムのビューと図を含むビューと図の章
generateArchitectureReport.m ファイルを変更して、カスタム システム アーキテクチャ設計レポートを作成できます。
generateArchitectureReport 関数は、次のレポート API クラスのオブジェクトを使用して、アーキテクチャ設計要素を検索し、設計についてのレポートを生成します。
slreportgen.report.Report(Simulink Report Generator)
完全な generateArchitectureReport 関数は、この例の最後に記載されています。
InsulinInfusionPumpSystem アーキテクチャの PDF システム アーキテクチャ レポートの生成
scExampleInsulinPumpSystem プロジェクトを開きます。
prj = openProject("scExampleInsulinPumpSystem"); model_name = "InsulinInfusionPumpSystem";
InsulinInfusionPumpSystem アーキテクチャ モデルのシステム アーキテクチャ レポートを生成します。PDF ドキュメントにするように指定します。
generateArchitectureReport(model_name, "pdf");この関数は、InsulinInfusionPumpSystem Architecture Report.pdf という名前の新しいファイルをプロジェクトのルート フォルダーに作成します。
generateArchitectureReport 関数
systemcomposer.rptgen 名前空間のレポーター クラス、ファインダー クラス、結果クラスを使用して、システム アーキテクチャ レポートの内容をカスタマイズできます。これらのオブジェクトのプロパティを使用して、レポートされる情報へのフィルターの適用と書式設定ができます。
この例に含まれている generateArchitectureReport 関数は次のとおりです。
type generateArchitectureReport.mfunction generateArchitectureReport(mdl, doctype)
%GENERATEARCHITECTUREREPORT Generates a system architecture report from the
%architecture model.
%
% generateArchitectureReport() generates a PDF system architecture report
% for the InsulinInfusionPumpSystem architecture model.
%
% generateArchitectureReport(mdl) generates a PDF system architecture
% report for the specified model.
%
% generateArchitectureReport(mdl, doctype) generates a system
% architecture report from the specified model and document type: 'html',
% 'docx', or 'pdf'.
%
% The generated document is a description of an architecture's
% design generated from its System Composer architecture model. The
% description contains the following sections:
%
% * Title Page
% * Table of Contents
% * Architecture Elements Chapter -- Contains each component in the
% architecture model along with their connectors and each profile in the
% architecture model along with their stereotypes and properties.
% * Requirements Analysis Chapter -- Contains each requirement set linked
% in the architecture model along with their implementations.
% * Views and Diagrams Chapter -- Contains each view and sequence diagram
% in the architecture model.
import mlreportgen.report.*
import slreportgen.report.*
import slreportgen.finder.*
import mlreportgen.dom.*
import mlreportgen.utils.*
import systemcomposer.query.*
import systemcomposer.rptgen.finder.*
if nargin < 1
mdl = "InsulinInfusionPumpSystem";
doctype = "pdf";
end
if nargin < 2
doctype = "pdf";
end
mdlHandle = systemcomposer.loadModel(mdl);
% Find all file dependencies and create a cell array of file names
files = (dependencies.fileDependencyAnalysis(mdl)');
files = convertCharsToStrings(files);
[path, name, ext] = fileparts(files);
files = name + ext;
% Create a cell array of requirement set file names
boolReqSet = contains(files, ".slreqx");
reqSetFiles = files(boolReqSet);
rptFileName = mdl + " Architecture Report";
rpt = slreportgen.report.Report(OutputPath=rptFileName, ...
Type=doctype, CompileModelBeforeReporting=false);
open(rpt);
makeTitlePage(rpt, mdlHandle);
append(rpt, TableOfContents);
makeIntroduction(rpt);
makeArchitectureElements(rpt, mdlHandle);
makeRequirementsAnalysis(rpt, reqSetFiles);
makeViewsDiagrams(rpt, mdlHandle);
close(rpt);
close_system(mdl);
rptview(rpt);
end
参考
ツール
クラス
systemcomposer.rptgen.report.AllocationList|systemcomposer.rptgen.report.AllocationSet|systemcomposer.rptgen.report.Component|systemcomposer.rptgen.report.Connector|systemcomposer.rptgen.report.DependencyGraph|systemcomposer.rptgen.report.Function|systemcomposer.rptgen.report.Interface|systemcomposer.rptgen.report.Profile|systemcomposer.rptgen.report.RequirementLink|systemcomposer.rptgen.report.RequirementSet|systemcomposer.rptgen.report.SequenceDiagram|systemcomposer.rptgen.report.Stereotype|systemcomposer.rptgen.report.View