Main Content

sscScalableAdvisor

Analyze model for scalable compilation advisability

Since R2021b

Description

sscScalableAdvisor(modelname) runs the Advisory tool that analyzes your model for unsupported patterns, provides compilation statistics, and makes recommendations on whether to enable scalable compilation.

example

sscScalableAdvisor(modelname,subsyspaths) lets you identify the repeating subsystems in the model without restructuring. If the model contains reusable components, the Advisory tool recognizes them automatically. Reusable components are individual Simscape™ blocks or textual components designated as reusable, referenced subsystems, or linked subsystems. If the model contains other types of subsystems, you must provide their names with the subsyspaths argument for the Advisory tool to consider them as repeating components.

example

sscScalableAdvisor(___,CompareBaseline=false) lets you skip the baseline compilation when optimizing model configuration. To make recommendations on whether to enable scalable compilation, the Advisory tool compiles the model twice: first, without scalable compilation, to calculate the baseline, and then again with applying scalable compilation. After you have decided to enable scalable compilation, you can still use the Advisory tool to try different ways of restructuring your model into repeated components, to optimize the configuration. In this case, you do not need to calculate a baseline, because you are interested only in the scalable compilation statistics for the current configuration. To save time, you can use this syntax to skip the baseline compilation. (since R2025a)

example

Examples

collapse all

In this example, you use the Advisory tool to analyze your model for unsupported patterns, provide compilation statistics, and make recommendations on whether to enable scalable compilation.

Open the Transmission Line example model:

openExample('simscape/TransmissionLineExample')

This model contains five identical subsystems, named S1 through S5, with each subsystem consisting of ten T-section segment blocks, named T-1 through T-10.

If the model contains reusable components, the tool recognizes them automatically. Reusable components are individual Simscape blocks or textual components designated as reusable, referenced subsystems, or linked subsystems. If the model contains other types of subsystems, you must provide their names with the subsyspaths argument for the Advisory tool to consider them as repeating components.

In this example, you provide the names of all five subsystems, S1 through S5, in a cell array as the second input argument:

r = sscScalableAdvisor('TransmissionLine', ...
{'TransmissionLine/S1', 'TransmissionLine/S2', 'TransmissionLine/S3', ...
'TransmissionLine/S4', 'TransmissionLine/S5',})
r = 

ScalableReport for model 'TransmissionLine'

          TotalModelCompilationTime: 7.2313
            SimscapeCompilationTime: 6.7703
                         PeakMemory: '27 MB'

    ScalableSimscapeCompilationTime: 3.5232
                 ScalablePeakMemory: '19 MB'

                         Subsystems: [1×4 table]
                         Components: [0×4 table]

The Advisory tool returns the compilation statistics. If the model contains unsupported patterns, workflows, or optimizations, the Advisory tool recommends to not enable scalable compilation and lists the applicable limitations. In this case, however, none of the limitations apply, and the compilation time is significantly reduced. The compilation time for the Simscape part of the model is 3.5232 s, instead of 6.7703 s, which brings the total compilation time down by about 45% (7.2313 - 6.7703 + 3.5232 = 3.9842 s).

Model compilation time depends on multiple factors, such as the processor used, other processes running at the same time, memory caching, and so on. The exact numbers may vary slightly between successive runs of the Advisory tool, but the ratio between different parts of the compilation process remains the same. Use this data to estimate the potential gain from scalable compilation.

If the compilation time for a model is reduced by more than 5 seconds, the Advisory tool recommends to enable scalable compilation, opens the Configuration Parameters dialog box, and highlights Reuse components during compilation to simplify your workflow. However, 5 seconds is an arbitrary number. Use the Advisory tool to estimate the potential gain from scalable compilation, and if you decide that the results are satisfactory, replace the repeated subsystems with reusable components and enable scalable compilation, as described in Create Reusable Components and Turn On Scalable Compilation.

Input Arguments

collapse all

Model name, specified as a character vector or string scalar. If the model is not on the MATLAB® path, the model name must include the full path.

Data Types: char | string

Optional argument that identifies the repeating subsystems in the model. Specify this argument as a cell array of subsystem names, including the path to each subsystem from the root of the model, to have the compilation artifacts be reused among subsystems with identical contents.

Data Types: char | string

Version History

Introduced in R2021b

expand all