Main Content

addSpecification

Class:fxpoptimizeptions

在系统中指定已知数据类型

描述

例子

addspecification(选项,,,,名称,价值specifies known data types in the model using name-value pairs. After specifying these known parameters, if you optimize the data types in a system, the optimization process will not change the specified block parameter data type. Specifications are applied to the model during evaluation and to the final model. Specifications are not considered during range collection.

You can use this method in cases where parts of a system are known to always be a certain data type. For example, if the input to your system comes from an 8-bit sensor.

输入参数

展开全部

fxpoptimizeptions在其中为系统指定已知数据类型的对象。

例子:opt = fxpoptimizePtions;

名称值参数

Specify optional pairs of arguments asname1 = value1,...,namen = valuen, 在哪里姓名是参数名称和Value是相应的值。名称值参数必须在其他参数之后出现,但是对的顺序并不重要。

在R2021a之前,请使用逗号分隔每个名称和值,并附上姓名用引号。

例子:addSpecification(Opt,'BlockParameter',BP,“变量”,VAR)

元素或数组万博1manbetxSimulink.Simulation.BlockParameter对象指定在优化过程中不应更改的块参数的数据类型。指定的值必须是该块的有效数据类型。

元素或数组万博1manbetxsimulink.simulation.variable对象指定在优化过程中不应更改的变量的数据类型。您可以指定值万博1manbetxsimulink.parameteror万博1manbetxsimulink.numerictype变量。

例子

展开全部

此示例显示了如何为系统内的块参数指定已知数据类型。

加载要优化数据类型的系统。

load_system('ex_auto_gain_controller');

要指定您要转换的系统的输入始终是八位整数,请创建一个摄影表指定块参数和数据类型的对象。

bp = 万博1manbetxsimulink.simulation.blockparameter(...'ex_auto_gain_controller/input_signal',,,,'OutDataTypeStr',,,,'int8');

fxpoptimizeptions目的,,,,选择,指定在数据类型优化期间使用的选项。To specify the data type of the input to the system, use theaddSpecificationmethod.

opt = fxpoptimizePtions;addspecification(opt,'BlockParameter',,,,bp)

您可以查看添加到一个fxpoptimizeptions对象使用显示特异性method.

显示特异性(OPT)
索引名称块值_____ ______________ __________________________________________________________________________________________________________________________________________________________________________1

此示例显示了如何为系统内的变量指定已知数据类型。

创建一个万博1manbetxsimulink.parameter对象以在模型中设置值一个参数。

myparam = 万博1manbetxsimulink.parameter(2);myParamcopy = copy(myparam);

制作参数的副本,并将数据类型设置为所需的已知值。

myParamcopy = copy(myparam);myParamcopy.datatype ='单身的';

使用A指定变量万博1manbetxsimulink.simulation.variable目的。

var = 万博1manbetxsimulink.simulation.variable('myparam',,,,myParamCopy);

fxpoptimizeptions目的,,,,选择,指定在数据类型优化期间使用的选项。要指定变量的数据类型,请使用addSpecificationmethod.

opt = fxpoptimizePtions();addspecification(opt,'多变的',var);

您可以查看添加到一个fxpoptimizeptions对象使用显示特异性method.

显示特异性(OPT)

版本历史记录

在R2020a中引入