Documentation

Simulink.Breakpoint class

Package: Simulink
Superclasses:

Store and share data for a breakpoint set, configure the data for ASAP2 and AUTOSAR code generation

Description

An object of the Simulink.Breakpoint class stores breakpoint set data for a lookup table. You can use that data in one or more Prelookup blocks. With the object, you can specify a data type and code generation settings for the breakpoint set and share the set between multiple lookup tables. Use Simulink.Breakpoint objects and Simulink.LookupTable objects to configure COM_AXIS code generation for calibration.

The code generated for a Simulink.Breakpoint object is an array or a structure with two fields. If you configure the object to appear as a structure, one field stores the specified breakpoint set data and one scalar field stores the number of elements in the breakpoint set data. You can configure the structure type name, the field name, and other characteristics by using the properties of the object.

To package lookup table and breakpoint set data into a single structure in the generated code, for example, for STD_AXIS code generation, use a Simulink.LookupTable object to store all of the data. See Package Shared Breakpoint and Table Data for Lookup Tables.

Construction

BpSet = Simulink.Breakpoint returns a Simulink.Breakpoint object named BpSet with default property values.

To create a Simulink.Breakpoint object by using the Model Explorer, use the button on the toolbar. The default name for the object is Object.

Property Dialog Box

Breakpoints

The breakpoint set information. You can configure these characteristics:

Support tunable size

Specification to enable tuning the effective size of the table in the generated code. If you select this option, in the generated code, the Simulink.Breakpoint object appears as a structure variable. The structure has one field to store the breakpoint vector data and one field to store the number of elements in the breakpoint vector. You can change the value of the second field to adjust the effective size of the table.

If you clear this option, the Simulink.Breakpoint object appears in the generated code as a separate array variable instead of a structure.

Value

Breakpoint set data. Specify a vector with at least two elements.

You can also use an expression with mathematical operators such as sin(1:0.5:30) as long as the expression returns a numeric vector. When you click Apply or OK, the object executes the expression and uses the result to set the value of this property.

When you set Data type to auto, to set Value, use a typed expression such as single([1 2 3]) or use the fi constructor to embed an fi object.

You can edit this data by using a more intuitive interface in a lookup table block. See Import Lookup Table Data from MATLAB.

Data type

Data type of the breakpoint set. The default setting is auto, which means that the breakpoint set acquires a data type from the value that you specify in Value. If you use an untyped expression such as [1 2 3] to set Value, the breakpoint data use the data type double. If you specify a typed expression such as single([1 2 3]) or an fi object, the breakpoint data use the data type specified by the expression or object.

You can explicitly specify an integer data type, a floating-point data type, a fixed-point data type, or a data type expression such as the name of a Simulink.AliasType object.

For more information about data types in Simulink®, see Data Types Supported by Simulink. To decide how to control the data types of table and breakpoint data in Simulink.LookupTable and Simulink.Breakpoint objects, see Control Data Types of Lookup Table Objects (Simulink Coder).

Dimensions

Dimension lengths of the breakpoint set.

To use symbolic dimensions, specify a character vector. See Implement Dimension Variants for Array Sizes in Generated Code (Embedded Coder).

Min

Minimum value of the elements in the breakpoint set. The default value is empty, []. You can specify a numeric, real value.

For more information about how Simulink uses this property, see Specify Minimum and Maximum Values for Block Parameters.

Max

Maximum value of the elements in the breakpoint set. The default value is empty, []. You can specify a numeric, real value.

For more information about how Simulink uses this property, see Specify Minimum and Maximum Values for Block Parameters.

Unit

Physical unit of the elements in the breakpoint set. You can specify text such as degC. See Unit Specification in Simulink Models.

Field name

Name of a structure field in the generated code. This field stores the breakpoint set data. The default value is BP. To change the field name, specify text.

This column appears only if you select Support tunable size.

Tunable size name

Name of a structure field in the generated code. This scalar field stores the length of the breakpoint set (the number of elements), which the generated code algorithm uses to determine the size of the table. To tune the effective size of the table during code execution, change the value of this structure field in memory. The default name is N. To change the field name, specify text.

This column appears only if you select Support tunable size.

Description

Description of the breakpoint set. You can specify text such as This breakpoint set represents the pressure input.

Data definition: Storage class

Storage class of the structure variable (if you select Support tunable size) or array variable in the generated code. The variable stores the breakpoint set data. The default setting is Auto.

For more information about storage classes, see Override Default Parameter Behavior by Creating Global Variables in the Generated Code (Simulink Coder)

If you have Embedded Coder®, you can choose a custom storage class. For information about custom storage classes, see Control Data Representation by Applying Custom Storage Classes (Embedded Coder).

Data definition: Alias

Alternative name for the variable in the generated code. The default value is empty, in which case the generated code uses the name of the Simulink.Breakpoint object as the name of the variable. To set the alias, specify text.

To enable this property, set Data definition: Storage class to a setting other than Auto.

Data definition: Alignment

Data alignment boundary in the generated code. The starting memory address for the data allocated for the structure or array variable is a multiple of the value that you specify. The default value is -1, which allows the code generator to determine an optimal alignment based on usage.

Specify a positive integer that is a power of 2, not exceeding 128. For more information about using data alignment for code replacement, see Data Alignment for Code Replacement (Embedded Coder).

Struct Type definition: Name

Name of the structure type that the structure variable uses in the generated code. The default value is empty. Specify text.

This property appears only if you select Support tunable size.

Struct Type definition: Data scope

Scope of the structure type definition (imported from your handwritten code or exported from the generated code). The default value is Auto. When you select Auto:

  • If you do not specify a value in the Struct Type definition: Header file box, the generated code exports the structure type definition to the file model_types.h. model is the name of the model.

  • If you specify a value in the Struct Type definition: Header file box, such as myHdr.h, the generated code imports the structure type definition from myHdr.h.

To explicitly specify the data scope:

  • To import the structure type definition into the generated code from your custom code, select Imported.

  • To export the structure type definition from the generated code, select Exported.

If you do not specify a value in the Struct Type definition: Header file box, the generated code imports or exports the type definition from or to StructName.h. StructName is the name that you specify with the property Struct Type definition: Name.

This property appears only if you select Support tunable size.

Struct Type definition: Header file

Name of the header file that contains the structure type definition. You can import the definition from a header file that you create, or export the definition into a generated header file. To control the scope of the structure type, adjust the setting for the Struct Type definition: Data scope property.

This property appears only if you select Support tunable size.

Properties

expand all

Breakpoint set data, specified as a Simulink.lookuptable.Breakpoint object. Use this embedded object to configure the structure field names and characteristics of the breakpoint set data such as breakpoint values, data type, and dimensions.

Code generation settings for the structure variable (if you set SupportTunableSize to true) or array variable (false) that stores the breakpoint set data, specified as a Simulink.CoderInfo object. You can specify a storage class or custom storage class by using this embedded object. For more information, see Simulink.CoderInfo.

Settings for the structure type that the structure variable uses in the generated code, specified as a Simulink.lookuptable.StructTypeInfo object.

If you set SupportTunableSize to false, the Simulink.Breakpoint object does not appear in the generated code as a structure. The code generator ignores this property.

Option to generate code that enables tunability of the effective size of the table, specified as true or false. See Support tunable size.

Data Types: logical

Copy Semantics

Handle. To learn how handle classes affect copy operations, see Copying Objects (MATLAB).

Examples

Share Breakpoint Data Between One-Dimensional Lookup Tables

  1. Create a Simulink.Breakpoint object named myBpSet.

    myBpSet = Simulink.Breakpoint

  2. Specify the breakpoint data.

    myBpSet.Breakpoints.Value = [-2 -1 0 1 2];

  3. Create a Simulink.LookupTable object named FirstLUTObj.

    FirstLUTObj = Simulink.LookupTable;

  4. Specify the table data.

    FirstLUTObj.Table.Value = [1.1 2.2 3.3 4.4 5.5];

  5. Configure the lookup table object to refer to the breakpoint set object.

    FirstLUTObj.Breakpoints = {'myBpSet'};

  6. Create another Simulink.LookupTable object to store a different set of table data. Configure the lookup table object to refer to the same breakpoint set object.

    SecondLUTObj = Simulink.LookupTable;
    SecondLUTObj.Table.Value = [1.2 2.3 3.4 4.5 5.6];
    SecondLUTObj.Breakpoints = {'myBpSet'};

You can use FirstLUTObj and SecondLUTObj to specify the table data in two different Interpolation Using Prelookup blocks. Use myBpSet to specify the breakpoint set data in one or two Prelookup blocks that provide the inputs for the Interpolation Using Prelookup blocks.

Limitations

  • You cannot subclass Simulink.Breakpoint or Simulink.LookupTable. For this reason, you cannot apply custom storage classes other than those in the built-in Simulink package.

  • You cannot use Simulink.Breakpoint objects or Simulink.LookupTable objects that refer to Simulink.Breakpoint objects as instance-specific parameter data for reusable components. For example, you cannot use one of these objects as:

    • A model argument in a model workspace or a model argument value in a Model block.

    • The value of a mask parameter on a CodeReuse Subsystem block.

    • The value of a mask parameter on a subsystem that you reuse by creating a custom library.

    However, you can use standalone Simulink.LookupTable objects, which do not refer to Simulink.Breakpoint objects, in these ways.

  • You cannot generate code according to the FIX_AXIS style.

  • When blocks in a subsystem use Simulink.LookupTable or Simulink.Breakpoint objects, you cannot set data type override (see Control Fixed-Point Instrumentation and Data Type Override) only on the subsystem. Instead, set data type override on the entire model.

Introduced in R2016b

Was this topic helpful?