Main Content

systemcomposer.rptgen.finder.FunctionResult Class

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

Search result for functions

Since R2022b

Description

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

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

Creation

result = FunctionResult creates a search result object for a function that you find by using a systemcomposer.rptgen.finder.FunctionFinder object.

Note

The find method of the systemcomposer.rptgen.finder.FunctionFinder class creates a search result object for each function 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 function, returned as a string.

Data Types: string

Component where you define the function, specified as a string.

Data Types: string

Parent architecture of component where you define the function, specified as a string.

Data Types: string

Period of function, specified as a numeric value convertible to a string, or a string of valid MATLAB® variables. You can edit the Period property of aperiodic functions. If you edit the Period property of a periodic function, you see an error.

Execution order of functions, specified as a row vector of numeric values.

Example: [model.Architecture.Functions.ExecutionOrder]

Data Types: uint64

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, FunctionFinder, and FunctionResult classes to generate a report that finds all components and their functions in a given software architecture model..

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

Open the ACCSoftwareComposition model.

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

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

functionsReport = slreportgen.report.Report(OutputPath=model_name + "_FunctionsReport", ...
    CompileModelBeforeReporting=false);
append(functionsReport,TitlePage(Title="Components and their Functions in " + model_name));
append(functionsReport,TableOfContents);

Create a chapter to contain all sections related to components and their functions.

compChapter = Chapter("Components and their Functions");

Find all components in the architecture model.

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

Create a section for each component.

while hasNext(componentFinder)
    comp = next(componentFinder);
    compSection = Section(Title=comp.Name);
    compReporter = getReporter(comp);
    compReporter.IncludeSnapshot = 1;
    compReporter.IncludeProperties = 0;
    compReporter.IncludeFunctions = 0;
    append(compSection,compReporter);

Find all functions associated with the component.

    functionFinder = FunctionFinder(model_name);
    functionFinder.ComponentName = comp.Name;
    functionResult = find(functionFinder);
    append(compSection,functionResult);

    append(compChapter,compSection);
end

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

append(functionsReport,compChapter);
close(functionsReport);
rptview(functionsReport);

Version History

Introduced in R2022b