Documentation Center

  • Trial Software
  • Product Updates

Contents

Simulink.Bus

Specify properties of signal bus

Description

Objects of this class (in conjunction with objects of the Simulink.BusElement class) specify the properties of a signal bus. Use bus objects to enable Simulink® software to validate the properties of buses connected to the inputs of blocks in your model. You do this by entering, in the Data type parameter of a block parameter dialog box, the name of a bus object that defines a bus. When you update the model diagram or start a simulation of the model, Simulink checks whether the buses connected to the blocks have the properties specified by the bus objects. If not, Simulink halts and displays an error message.

The blocks that support using a bus object as a data type are:

You can use the Model Explorer Add > Simulink Bus command (see Using the Model Explorer to Create Data Objects), the Simulink Bus editor (see Manage Bus Objects with the Bus Editor), or MATLAB® commands (see Data Objects) to create bus objects in the base MATLAB workspace. You must use the Bus editor or the MATLAB command line to set the properties of a bus object. Simulink also provides a set of utility functions for creating and saving bus objects.

To view bus object properties:

  1. Open the Model Explorer.

  2. In the Model Hierarchy pane, select the Base Workspace node.

  3. In the Contents pane, select the bus object.

    In the Property dialog box appears.

Property Dialog Box

Bus elements

Table that displays the properties of the bus elements. You cannot edit this table. You must use either the Simulink Bus editor (see Bus Objects) or MATLAB commands to add or delete bus elements or change the properties of existing bus elements. To launch the bus editor, click the Launch Bus editor button at the bottom of this dialog box or in the Simulink Editor, select Edit > Bus EditorBus editor.

Data scope

Specifies whether the data type definition should be imported from, or exported to, a header file during code generation. The possible values are:

ValueAction
Auto (default)If no value is specified for Header file, export the data type definition to model_types.h, where model is the model name.

If a value is specified for Header file, import the data type definition from the specified header file.
ExportedExport the data type definition to a header file, which can be specified in the Header file field. If no value is specified for Header file, the header file name defaults to type.h, wheretype is the data type name.
ImportedImport the data type definition from a header file, which can be specified in the Header file field. If no value is specified for Header file, the header file name defaults to type.h, wheretype is the data type name.

Header file

Name of a C header file from which a data type definition is imported, or to which a data type definition is exported, based on the value of Data scope. This field is intended for use by Simulink Coder™ software. See Generate Code Including User-Defined Data Types. Simulink software ignores this field.

Alignment

Data alignment boundary, specified in number of bytes. The starting memory address for the data allocated for the bus will be a multiple of the Alignment setting. The default value is -1, which specifies that the code generator should determine an optimal alignment based on usage. Otherwise, specify a positive integer that is a power of 2, not exceeding 128. This field is intended for use by Simulink Coder software. See Configure Data Alignment for Function Implementations. Simulink software ignores this field.

Description

Description of this structure. This field is intended for you to use to document this bus. Simulink software does not use this field.

Properties

Name

Access

Description

Alignment

RW

Integer value specifying a data alignment boundary, in number of bytes. This property is intended for use by Simulink Coder software. Simulink software does not use it. (Alignment)

DataScope

RW

A string specifying whether the data type definition should be imported from, or exported to, a header file during code generation. (Data scope)

Description

RW

A string that describes this bus. This property is intended for user use. Simulink software does not use it. (Description)

Elements

RW

An array of Simulink.BusElement objects that define the names, data types, dimensions, and other properties of the bus's elements. The elements must have unique names (see Choosing a Signal Name). (Bus elements)

HeaderFile

RW

A string that specifies the name of a C header file from which a data type definition is imported, or to which a data type definition is exported, during code generation. (Header file)

Was this topic helpful?