Generate System Architecture Reports with System Composer Report API for Software Architectures
This example shows how to generate a Report API-based architecture report for a System Composer™ software architecture model and its artifacts.
The generateSoftwareArchitectureReport
function, which is included with this example, generates a report that includes these sections:
Title Page
Table of Contents
Architecture Elements chapter that contains the model elements
Service Interfaces chapter that contains interfaces and elements
Views and Diagrams chapter that contains custom views and diagrams associated with the model
You can modify the generateSoftwareArchitectureReport.m
file to create a custom system architecture design report.
The generateSoftwareArchitectureReport
function uses objects of these Report API classes to find architecture design elements and report on the design:
The complete generateSoftwareArchitectureReport
function is listed at the end of this example.
Generate PDF System Architecture Report for ACCSoftwareComposition
Software Architecture
Open the ACCSoftwareComposition
architecture model.
modelName = "ACCSoftwareComposition";
systemcomposer.loadModel(modelName);
Generate a system architecture report for the ACCSoftwareComposition
architecture model. Specify that the document is a PDF.
generateSoftwareArchitectureReport(modelName, "pdf");
This function creates a new file named ACCSoftwareComposition Architecture Report.pdf
in the project root folder.
The generateSoftwareArchitectureReport
Function
You can use reporter, finder, and result classes from the systemcomposer.rptgen
namespace to customize the contents of your system architecture report. You can use the properties of these objects to filter and format the information that is reported.
Here is the generateSoftwareArchitectureReport
function included in this example.
type generateSoftwareArchitectureReport.m
function generateArchitectureReport(mdl, doctype) %GENERATEARCHITECTUREREPORT Generates a system architecture report from the %architecture model. % % generateArchitectureReport() generates a PDF system architecture report % for the ACCSoftwareComposition software 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 software 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. 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 = "ACCSoftwareComposition"; doctype = "pdf"; end if nargin < 2 doctype = "pdf"; end mdlHandle = systemcomposer.loadModel(mdl); 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); close(rpt); close_system(mdl); rptview(rpt); end
Generate Report for AUTOSAR Software Architectures
You can generate a report for an AUTOSAR architecture model and its artifacts using the script in this example. To load an AUTOSAR model, use autosar.arch.loadModel
(AUTOSAR Blockset). Check that the model, profile, requirements, and dictionary file names are updated in accordance with your AUTOSAR model. For more information on AUTOSAR architectures, see Software Architecture Modeling (AUTOSAR Blockset).
See Also
Tools
Classes
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