Main Content

addSpecification

Class: fxpOptimizationOptions

Specify known data types in a system

Syntax

addSpecification(options,'BlockParameter',block_param)

Description

addSpecification(options,'BlockParameter',block_param) specifies a known data type for a block parameter. 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.

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.

Input Arguments

expand all

fxpOptimizationOptions object in which to specify a known data type for a system.

Simulink.Simulation.BlockParameter objects specifying the data types of block parameters that should not change during the optimization.

Examples

expand all

This example shows how to specify known data types for block parameters within your system. Load the system for which you want to optimize the data types.

load_system('ex_auto_gain_controller');

To specify that the input to the system you are converting will always be an eight-bit integer, create a BlockParameter object that specifies the block parameter, and the data type.

bp = Simulink.Simulation.BlockParameter(...
'ex_auto_gain_controller/input_signal', 'OutDataTypeStr', 'int8');

The fxpOptimizationOptions object, opt, specifies options to use during data type optimization. To specify the data type of the input to the system, use the addSpecification method.

opt = fxpOptimizationOptions;
addSpecification(opt, 'BlockParameter', bp)

You can view all specifications added to a fxpOptimizationOptions object using the showSpecifications method.

showSpecifications(opt)
    Index         Name                      BlockPath                  Value 
    _____    ______________    ____________________________________    ______

      1      OutDataTypeStr    ex_auto_gain_controller/input_signal    'int8'
ans=1×4 table
    Index         Name                      BlockPath                  Value 
    _____    ______________    ____________________________________    ______

      1      OutDataTypeStr    ex_auto_gain_controller/input_signal    'int8'

Introduced in R2020a