Main Content

Composite Signals

Use composite signals, such as buses, to group signals and reduce model complexity

To simplify model appearance, combine individual signals into composite signals using these techniques:

  • Virtual buses

  • Nonvirtual buses

  • Mux signals

  • Concatenated signals

For a detailed comparison of composite signals, seeTypes of Composite Signals.

Virtual buses meet most modeling requirements for combining signals into a composite signal and give you flexibility for combining different types of signals.

Blocks

expand all

Bus Assignment Replace specified bus elements
Bus Creator Create bus from input elements
Bus Selector Select elements from incoming bus
In Bus Element Select signal that connects to input port
Out Bus Element Specify signal that connects to output port
Demux Extract and output elements of virtual vector signal
Mux Combine input signals of same data type and complexity into virtual vector
Selector Select input elements from vector, matrix, or multidimensional signal
Vector Concatenate, Matrix Concatenate Concatenate input signals of same data type to create contiguous output signal
Bus to Vector Convert virtual bus to vector
Signal Conversion Convert signal to new type without altering signal values

Functions

expand all

Simulink.Bus Specify properties of buses
Simulink.BusElement Specify properties of elements of buses
Simulink.Bus.cellToObject Convert cell array containing bus information to Simulink.Bus objects
Simulink.Bus.createMATLABStruct CreateMATLABstructures that use the same hierarchy and attributes as buses
Simulink.Bus.createObject Create Simulink.Bus objects from blocks or MATLAB structures
Simulink.Bus.objectToCell Use Simulink.Bus objects to create cell array containing bus information
Simulink.Bus.save Save Simulink.Bus objects in function
Simulink.BlockDiagram.addBusToVector Convert virtual bus signals into vector signals by adding Bus to Vector blocks

Tools

Bus Editor Create, modify, and manage Simulink.Bus objects
Model Explorer View, modify, and add elements of金宝appmodels,Stateflowcharts, and workspace variables

Topics

Composite Signal Basics

Types of Composite Signals

To reduce visual complexity in a model, combine signals into a composite signal.

Bus Basics

Group Signal Lines into Virtual Buses

结合信号到虚拟巴士,只有等于offect visual appearance.

Display Bus Information

Display information about buses, such as signal hierarchy and whether the bus is virtual or nonvirtual.

Bus-Capable Blocks

Identify the blocks that support buses as inputs.

Simplify Subsystem and Model Interfaces with Buses

Use In Bus Element and Out Bus Element blocks for bus inputs and outputs.

Modify Bus Hierarchy

Change the order and hierarchy of nested buses and their elements.

Replace Values of Bus Elements

Use aBus Assignmentblock to assign values to elements of a bus.

Specify Initial Conditions for Bus Signals

Specify bus element values as initial conditions for buses.

Identify Automatic Bus Conversions

Recognize modeling patterns that cause hiddenBus To VectorandSignal Conversionblocks.

Share and Reuse Bus-Routing Blocks

Share blocks that create or interact with buses using subsystem references or custom libraries.

Trace Connections Using Interface Display

Display interfaces to trace signals through the nested levels, annotate signal characteristics, and view units associated with signals.

Bus Objects

Specify Bus Properties with Simulink.Bus Objects

UnderstandSimulink.Busobject uses and implementation.

Create Bus Objects Programmatically

Use functions and classes to defineBusobjects and bus elements, create bus objects from blocks, or createBusobjects from MATLAB®data.

Customize Bus Object Import and Export

Customize the Bus Editor import and export commands by writing MATLAB functions that provide the desired capabilities. Register these functions using the Simulink®Customization Manager.

Nonvirtual Buses

Create Nonvirtual Buses

Convert virtual buses to nonvirtual buses, which affect simulation and code generation.

Modify Sample Times for Nonvirtual Buses

Make the sample time of signals the same so that you can group them in a nonvirtual bus.

Generate Code for Nonvirtual Buses

Code generation uses a structure to represent a nonvirtual bus. You can control data types of initial condition structure fields.

Inspect Generated Code for Nonvirtual Buses

Find nonvirtual buses in generated code for a simple model.

Nonvirtual Buses at Model Interfaces

Connect nonvirtual buses to inputs and outputs of referenced models.

Arrays of Buses

Combine Buses into an Array of Buses

Streamline a model by combining nonvirtual buses that have the same bus type (use the sameBusobject) into an array of buses.

Use Arrays of Buses in Models

Use array of buses in a model, load array of bus data, and log array of buses.

Work with Arrays of Buses

Set up your model to use an array of buses to select signals, assign values to a signal, perform iterative processing, log and load signals, and initialize signals.

Convert Models to Use Arrays of Buses

Convert an existing model that does not use arrays of buses to use arrays of buses.

Related Information

Featured Examples