Main Content

systemcomposer.rptgen.finder.ComponentResult Class

Namespace: systemcomposer.rptgen.finder
Superclasses: mlreportgen.finder.Result (MATLAB Report Generator)

Search result for components

Since R2022b

Description

Search result object for information about a component in a System Composer™ architecture model.

The systemcomposer.rptgen.finder.ComponentResult class is a handle class.

Creation

result = ComponentResult creates a search result object for a component that you find by using a systemcomposer.rptgen.finder.ComponentFinder object.

Note

The find method of the systemcomposer.rptgen.finder.ComponentFinder class creates a search result object for each component that it finds. You do not need to create this object yourself.

Properties

expand all

Universal unique identifier (UUID) of result element, returned as a string.

Data Types: string

Name of component, returned as a string.

Data Types: string

Parent of component, returned as a string.

Data Types: string

Children of component, returned as an array of systemcomposer.rptgen.finder.ComponentResult objects.

Ports on component, returned as an array of systemcomposer.arch.ComponentPort objects.

Reference model name used by component, returned as a string.

Data Types: string

Kind of AUTOSAR component, returned as a string.

Data Types: string

Tag to associate with result, specified as a string. You can use this property to attach additional information to a result. You can set this property to any value that meets your requirements.

Data Types: string

Methods

expand all

Examples

collapse all

Use the ComponentFinder, ComponentResult, ConnectorFinder, and ConnectorResult classes to create a report that finds all components and connections in a given architecture model.

import systemcomposer.rptgen.finder.*
import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*

Open the scKeylessEntrySystem project.

prj_name = "scKeylessEntrySystem";
prj = openProject(prj_name);

Load the KeylessEntryArchitecture architecture model.

model_name = "KeylessEntryArchitecture";
mdl = systemcomposer.loadModel(model_name);

Create a report and append a title page and table of contents.

compReport = slreportgen.report.Report(OutputPath=model_name + "_SystemArchitectureReport.pdf", ...
    CompileModelBeforeReporting=false);
append(compReport,TitlePage(Title="Components and Connectors in " + model_name));
append(compReport,TableOfContents);

Create a chapter to contain all sections related to the components of the architecture model.

componentsChapter = Chapter("Components in " + model_name);

Find all components in the architecture model.

componentFinder = ComponentFinder(model_name);
componentFinder.Query = AnyComponent;

while hasNext(componentFinder)
    componentResult = next(componentFinder);  

Create a section for each component.

    compSection = Section(Title=componentResult.Name);    
    append(compSection,componentResult);

Find all connectors on the component.

    connectorFinder = ConnectorFinder(model_name);
    connectorFinder.ComponentName = componentResult.Name;
    connectorResult = find(connectorFinder);
    for connector = connectorResult
        connectorReporter = getReporter(connector);
        append(compSection,connectorReporter.Source);
    end

    append(componentsChapter,compSection);
end

Append the chapter to the report and view the generated report.

append(compReport,componentsChapter);
close(compReport);
rptview(compReport);

Version History

Introduced in R2022b