주요 콘텐츠

System Composer Report API를 사용하여 시스템 아키텍처 리포트 생성하기

R2022b 이후

이 예제에서는 System Composer™ 아키텍처 모델과 그 아티팩트에 대한 Report API 기반 아키텍처 리포트를 생성하는 방법을 보여줍니다.

이 예제에 포함된 generateArchitectureReport 함수는 다음 섹션을 포함하는 리포트를 생성합니다.

  • [Title Page]

  • [Table of Contents]

  • 모델 요소가 포함된 [Architecture Elements] 챕터

  • 시스템 요구 사항이 포함된 [Requirements Analysis] 챕터

  • 모델과 연결된 사용자 지정 뷰 및 다이어그램이 포함된 [Views and Diagrams] 챕터

generateArchitectureReport.m 파일을 수정하여 사용자 지정 시스템 아키텍처 설계 리포트를 만들 수 있습니다.

generateArchitectureReport 함수는 다음 Report API 클래스의 객체를 사용하여 아키텍처 설계 요소를 찾고 설계에 대해 보고합니다.

완전한 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.m
function 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

참고 항목

클래스

도움말 항목