Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

sdo.getModelDependencies

Package: sdo

List of model path dependencies

Syntax

dirs = sdo.getModelDependencies(modelname)

Description

dirs = sdo.getModelDependencies(modelname) returns paths containing model dependencies required for response optimization using parallel computing. The model must be open.

sdo.getModelDependencies does not return a complete list of model dependency paths when the dependencies are undetectable.

Input Arguments

modelname

Simulink® model name that uses the parameter, specified as a string inside single quotes (' ').

Output Arguments

dirs

Cell array of paths that contain model dependencies.

The cell array is empty when the model does not have any dependencies or sdo.getModelDependencies does not detect any dependencies.

Examples

List model path dependencies required for parallel computing.

Open Simulink model.

% Copy Simulink model and boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo

Enable parallel computing.

opts = sdo.OptimizeOptions;
opts.UseParallel = 'always';

Get model dependency paths.

 dirs = sdo.getModelDependencies('boilerpressure_demo');

Add model dependencies to use during parallel computing.

opts.ParallelPathDependencies = dirs;
 

Make local paths accessible to remote workers.

Open Simulink model.

% Copy Simulink model and boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo

Enable parallel computing.

opts = sdo.OptimizeOptions;
opts.UseParallel = 'always';

Get model dependency paths.

 dirs = sdo.getModelDependencies('boilerpressure_demo');

The resulting path is on a local drive, C:/.

Replace C:/ with valid network path accessible to remote workers.

dirs = regexprep(dirs,'C:/','\\\\hostname\\C$\\')

Add model dependencies to use during parallel computing.

opts.ParallelPathDependencies = dirs;
 

Add path to model path dependency list.

Open Simulink model.

% Copy Simulink model and boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo

Enable parallel computing.

opts = sdo.OptimizeOptions;
opts.UseParallel = 'always';

Get model dependency paths.

 dirs = sdo.getModelDependencies('boilerpressure_demo');

Append an additional path.

dirs=vertcat(dirs,'\\hostname\C$\matlab\work')

Add model dependencies to use during parallel computing.

opts.ParallelPathDependencies = dirs;

More About

expand all

Tips

  • Modify dirs to include:

    • Path dependencies that sdo.getModelDependencies cannot detect such as paths that contain code for your model callbacks

    • Paths that the workers cannot access directly such as path dependencies on local drive

  • Use dirs to set the ParallelPathDependencies property of sdo.OptimizeOptions to use for parallel computing.

See Also

Tutorials

Was this topic helpful?