Documentation

Contents

sdo.getParameterFromModel

Design variable for optimization

Syntax

p_des = sdo.getParameterFromModel(modelname,paramname)
p_des = sdo.getParameterFromModel(modelname)

Description

p_des = sdo.getParameterFromModel(modelname,paramname) creates an object from a Simulink® model parameter that you can tune to satisfy design requirements during optimization. The model must be open.

p_des = sdo.getParameterFromModel(modelname) creates model parameter objects for all the parameters in the model.

Input Arguments

modelname

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

paramname

Model parameter name, specified as a string inside single quotes (' ') for one parameter or a cell array of strings for multiple parameters.

Output Arguments

p_des

A param.Continuous object for one parameter or an array of objects for multiple parameters.

If paramname is not specified, then p_des contains all the parameters of the model.

The Value property of the object is set to the current value of the model parameter.

Examples

expand all

Get Model Parameter as Optimization Design Variable

load_system('sldo_model1_stepblk');

p_des = sdo.getParameterFromModel('sldo_model1_stepblk','Kp');

Get Multiple Model Parameters as Optimization Design Variables

paramname = {'Kp','Ki','Kd'};

load_system('sldo_model1_stepblk');

p_des = sdo.getParameterFromModel('sldo_model1_stepblk',paramname);

Get All Model Parameters as Optimization Design Variables

load_system('sldo_model1_stepblk');
p_des = sdo.getParameterFromModel('sldo_model1_stepblk');
Was this topic helpful?