Main Content

sdo.SessionInterface

Simulink Design Optimization app session interface

Since R2025a

    Description

    Use an sdo.SessionInterface object to import data into any Simulink® Design Optimization™ app programmatically. You can import different kinds of data like parameters, experiments, requirements, and so on, depending on the app.

    When there are a large number of requirements, parameters, or probability distributions, it can be tedious to define them all interactively in an app. Alternatively, you can define them using the command-line functionality and import them into the app using the sdo.SessionInterface object.

    Creation

    Description

    si = sdo.SessionInterface(session) creates an app session interface object prepopulated with the session data in session. You load this session data from a previously saved .mat session file. The session interface object prepopulates with the data corresponding to only the selected parameters or design variables. The type of app session is the same type as session. To modify the properties of this object for your specific application, use dot notation.

    example

    si = sdo.SessionInterface(modelname,app) creates a new blank session interface object based on the Simulink model, modelname. The argument app defines the type of app session. To set the properties of this object for your specific application, use dot notation.

    Input Arguments

    expand all

    Session data from a .mat session file.

    Name of the Simulink model on the MATLAB® path, specified as a string or character vector.

    Type of app, specified as one of these options:

    • "ParameterEstimator"

    • "ResponseOptimizer"

    • "SensitivityAnalyzer"

    Output Arguments

    expand all

    Session interface, returned as an sdo.SessionInterface object.

    Properties

    expand all

    This property is read-only.

    Name of the Simulink model, represented as a string or character vector.

    This property is read-only.

    Type of app, represented as one of these options:

    • 'ParameterEstimator'

    • 'ResponseOptimizer'

    • 'SensitivityAnalyzer'

    Parameters to be tuned during estimation, specified as a vector of param.Continuous objects, param.Discrete objects, or both.

    Dependencies

    To specify Parameters, you must specify a Parameter Estimator app session file or specify the app type as 'ParameterEstimator' when creating the sdo.SessionInterface object.

    Variables to be tuned during optimization, specified as a vector of param.Continuous objects, param.Discrete objects, or both.

    Dependencies

    To specify DesignVariables, you must specify a Response Optimizer app session file or specify the app type as 'ResponseOptimizer' when creating the sdo.SessionInterface object.

    Variables to be explored during optimization, specified as a structure with the fields "Parameters" and "Sampling".

    • "Parameters" — Model parameters, specified as a cell array, where the first column in each row contains a param.Continuous object and the second column contains the corresponding numeric sample values. If the Value field in the "Parameters" field of UncertainVariables is a scalar, then the sample values for that parameter can be a vector whose elements show the uncertainty about this value. If the Value field is not a scalar, then the sample values for the corresponding parameter must be a cell array whose elements have the same dimension as the Value field.

    • "Sampling" — Method for combining the sample values to form the set of uncertain variables, specified as "All" or "VertexOnly".

    Dependencies

    To specify UncertainVariables, you must specify a Response Optimizer app session file or specify the app type as 'ResponseOptimizer' when creating the sdo.SessionInterface object.

    Parameters to be varied during sensitivity analysis, specified as a structure with the fields "Parameters", "ParameterSpace", and "Values".

    • "Parameters" — Model parameters and states, specified as a vector of param.Continuous objects.

    • "ParameterSpace" — Probability distributions for model parameters, specified as an sdo.ParameterSpace object.

    • "Values" — Parameter samples, specified as a table with columns corresponding to the Name field in the "Parameters" field of ParameterSet. You can also generate these samples using sdo.sample.

    Dependencies

    To specify ParameterSet, you must specify a Sensitivity Analyzer app session file or specify the app type as 'SensitivityAnalyzer' when creating the sdo.SessionInterface object.

    Experiments associating measured data to signals in the model, specified as an sdo.Experiment object. For the app type 'Sensitivity Analyzer', these experiments show up as signal matching requirements in the Sensitivity Analyzer app.

    Dependencies

    To specify Experiments, you must specify a Parameter Estimator or Sensitivity Analyzer app session file or specify the app type as 'ParameterEstimator' or 'SensitivityAnalyzer' when creating the sdo.SessionInterface object.

    Requirements to be satisfied, specified as a structure with the fields "Specification", "Source", and an optional field "Name".

    • "Name" — Name of the requirement, specified as a string or character vector.

    • "Specification" — Design requirements to be satisfied during optimization. You can specify these using any of the functions under Time-Domain Requirements, Variable Requirements, or Frequency-Domain Requirements in Specify Design Requirements.

    • "Source" — Signals to log during simulation, specified as a Simulink.SimulationData.Signal object. You evaluate the requirements on these signals.

    Dependencies

    To specify Requirements, you must specify a Response Optimizer or Sensitivity Analyzer app session file or specify the app type as 'ResponseOptimizer' or 'SensitivityAnalyzer' when creating the sdo.SessionInterface object.

    Results of performing evaluation, specified as a structure with the fields "X" and "Y". The values for both of these fields are tables with the same number of rows, where each data element is of type double. The variable names of the table for field "X" must be parameters in the Simulink model used by the session interface object. The field "X" represents combinations of parameter values. The field "Y" represents results from evaluating the model on those parameter combinations. Sensitivity analysis helps identify the parameters in "X" that have the most influence on the outcomes in "Y".

    Dependencies

    To specify EvaluationResults, you must specify a Sensitivity Analyzer app session file or specify the app type as 'SensitivityAnalyzer' when creating the sdo.SessionInterface object.

    Options for estimation such as the optimization solver, tolerances, and so on, specified as an sdo.OptimizeOptions object.

    Dependencies

    To specify EstimationOptions, you must specify a Parameter Estimator app session file or specify the app type as 'ParameterEstimator' when creating the sdo.SessionInterface object.

    Options for optimization such as the optimization solver, tolerances, and so on, specified as an sdo.OptimizeOptions object.

    Dependencies

    To specify OptimizationOptions, you must specify a Response Optimizer app session file or specify the app type as 'ResponseOptimizer' when creating the sdo.SessionInterface object.

    Examples

    collapse all

    This example shows how to create a session interface object prepopulated with the data from a Response Optimizer app session file. The example demonstrates how to further specify design variables and optimization options programmatically and import them into the app.

    Load the session data from a Response Optimizer app session file. Create a session interface object using sdo.SessionInterface.

    load('spe_muscle_sdosession_TwoReq.mat', 'SDOSessionData');
    si = sdo.SessionInterface(SDOSessionData);

    Change the design variables in the app by specifying them programmatically using the DesignVariables property of the session interface object.

    dv = [param.Continuous('alpha', 0.2) ; ...
        param.Continuous('beta', 0.1) ; ...
        param.Continuous('tau', 0.005)];
    dv(3).Minimum = 0;
    si.DesignVariables = dv;

    Change the default optimization options in the app using the OptimizationOptions property of the session interface object.

    opts = si.OptimizationOptions;
    opts.Method = 'patternsearch';
    si.OptimizationOptions = opts;

    Launch the app using sdotool.

    sdotool(si);

    In the app, in the Data section, click DesignVars to see the new design variables. In the Options menu, click Optimization. In the Response Optimization Options dialog box, you can see that the Optimization Method is Pattern search, as specified.

    Version History

    Introduced in R2025a