| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
The properties that can be specified for a bus signal by its Bus Creator block parameters, and inherited by all downstream blocks that use the bus, are adequate for defining virtual buses and performing limited error checking. Defining a nonvirtual bus, or performing complete error checking on any bus, requires you to specify additional information by providing a bus object.
A bus objects is analogous to a structure definitions in C: it defines the members of the bus but does not create a bus. A bus object is an instance of class Simulink.Bus that is defined in the base workspace. A bus object serves as the root of an ordered hierarchy of bus elements, which are instances of class Simulink.BusElement. Each element completely specifies the properties of one signal in a bus: its name, data type, dimensionality, etc. The order of the elements contained in the bus object defines the order of the signals in the bus.
Creating a bus object establishes a composite data type whose name is the name of the bus object and whose properties are given by the object. A bus object specifies only the architectural properties of a bus, as distinct from the values of the signals it contains. For example, a bus object can specify the number of elements in a bus, the order of those elements, whether and how elements are nested, and the data types of constituent signals; but not the signal values.
Referenced models, Stateflow charts, and Embedded MATLAB blocks that input and output buses require those buses to be defined with bus objects. Inport and Outport blocks can use bus objects to specify the structure of the bus passing through them. Root inport blocks use bus objects to specify the structure of the bus. Root outport blocks use bus objects to check the structure of the incoming bus and to specify the structure of the bus in the parent model, if any.
You can associate a bus object with any Bus Creator block, Inport block, or Outport block. When a bus object governs a signal output by a block, the signal is a bus that has exactly the properties specified by the object. When a bus object governs a signal input by a block, the signal must be a bus that has exactly the properties specified by the object; any variance causes an error.
A bus object can also specify properties that were not defined by constituent signals, but were left to be inherited. Thus a property specification in a bus object can either validate or provide the corresponding property in the bus. If the bus specifies a different property, an error occurs. If the bus did not specify the property, but left it to be inherited, the bus inherits the property from the bus object. Note again that such inheritance never includes signal values.
You can use the Simulink Bus Editor to create and manage bus objects, as described in Using the Bus Editor, or you can use the Simulink API, as described in Using the Bus Object API. After you have created a bus object and specified its attributes, you can associate it with any block that needs to use the bus definition that the object provides, as described in Associating Bus Objects with Simulink Blocks.
You can associate a bus object with any Bus Creator block, Inport block, or Outport block. The techniques vary slightly depending on the type of the block.
To associate a bus object with a Bus Creator block:
Open the Block Parameters dialog.
Select Specify properties via bus object.
Enter the bus object name in the Bus object field.
Click OK or Apply.
See theBus Creator block documentation for more information.
Inport and Outport blocks use bus objects to provide the specifications necessary for a bus signal to cross the boundary between nonvirtual subsystems.
To associate a bus object with an Inport or Outport block:
Open the Block Parameters dialog.
Select the Signal Attributes tab.
Select Specify properties via bus object.
Enter the bus object name in the Bus object for validating input bus field.
Click OK or Apply.
See the Inport block and Outport block documentation for more information.
![]() | Bus-Capable Blocks | Using the Bus Editor | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |