Specify properties of physical connection buses
Simulink.ConnectionBus object is a data type that, when used
Simulink.ConnectionElement objects, lets you design rigid interface specifications
for Simscape™ conserving connections. When you apply such rigid specification to a
Simscape Bus or Connection Port block, the block ports become
typed by the interface and do not accept connections to a different domain
ConnectionBus object specifies the architectural properties of an
interface, such as element names, hierarchy, and domain types. A
ConnectionBus object is similar to a cable connector. The connector defines
all the pins and their configuration and controls what types of wires can be connected to it.
ConnectionBus object defines the configuration and domain types
of the ports of the associated Simscape Bus or Connection Port
ConnectionBus objects contain
Simulink.ConnectionElement objects. Each
specifies the properties of a port in a connection bus, such as its name and domain type. To
create nested connection buses, specify a
ConnectionElement on the parent bus
and set its type as the child
To create and modify
ConnectionBus objects in the base workspace or a
data dictionary, you can use the Type Editor, the
Model Explorer, or
MATLAB® commands. You cannot store
ConnectionBus objects in model
To simulate a model containing blocks that use a
ConnectionBus object must be in the base workspace or in a data
dictionary. You save and load
ConnectionBus objects similar to
Simulink.Bus objects. For more information, see Determine How to Manage Simulink.Bus Objects.
To apply an existing connection bus specification to a Simscape Bus or Connection Port block, use the Connection type parameter and select the bus name from the drop-down list.
name = Simulink.ConnectionBus
ConnectionBus object with default property values. The name of the
ConnectionBus object is the name of the MATLAB variable to which you assign the
Description — Connection bus description
'' (default) | character vector
Connection bus description, specified as a character vector. Use the description to
document information about the
ConnectionBus object, such as the
application it is used for or domain types of its ports. This information does not
affect Simulink® processing.
Elements — Elements of connection bus
empty array (default) | array of
Elements of connection bus, specified as an array of
Simulink.ConnectionElement objects. Each
ConnectionElement object defines the properties of a conserving
connection within the bus, such as its name and domain type. For more information, see
Create Connection Bus and Connection Element Objects Using MATLAB Commands
Define a rigid interface with one mechanical translational and one
electrical port by creating a
ConnectionBus object containing a
two-element array of
ConnectionElement objects. Array indexing lets you
create and access multiple elements in an array. Dot notation lets you access property
ConnectionBus object called
MechElec = Simulink.ConnectionBus
MechElec = ConnectionBus with properties: Description: '' Elements: [0×0 Simulink.ConnectionElement]
By default, the connection bus has no description and an empty array of connection elements.
Use the dot notation to fill in the description:
MechElec.Description = 'Rigid interface with one mechanical and one electrical port'
MechElec = ConnectionBus with properties: Description: 'Rigid interface with one mechanical and one electrical port' Elements: [0×0 Simulink.ConnectionElement]
ConnectionElement object to define the mechanical
mech = Simulink.ConnectionElement
mech = ConnectionElement with properties: Name: 'a' Type: 'Connection: <domain name>' Description: ''
This command creates a
ConnectionElement object with default
ConnectionElement name to
mech.Name = 'mech'
mech = ConnectionElement with properties: Name: 'mech' Type: 'Connection: <domain name>' Description: ''
Specify the domain type for the connection:
mech.Type = 'Connection: foundation.mechanical.translational.translational'
mech = ConnectionElement with properties: Name: 'mech' Type: 'Connection: foundation.mechanical.translational.translational' Description: ''
For a list of Foundation domain types, see Domain-Specific Line Styles (Simscape).
Optionally, fill in the port description:
mech.Description = 'Mechanical translational port'
mech = ConnectionElement with properties: Name: 'mech' Type: 'Connection: foundation.mechanical.translational.translational' Description: 'Mechanical translational port'
Similarly, create another
ConnectionElement object to define the
elec = Simulink.ConnectionElement; elec.Name = 'elec'; elec.Type = 'Connection: foundation.electrical.electrical'; elec.Description = 'Electrical port'
elec = ConnectionElement with properties: Name: 'elec' Type: 'Connection: foundation.electrical.electrical' Description: 'Electrical port'
Add the two elements to the
MechElec.Elements = [mech elec]
MechElec = ConnectionBus with properties: Description: 'Rigid interface containing one mechanical and one electrical port' Elements: [2×1 Simulink.ConnectionElement]
You can view the created objects in the Type Editor:
Introduced in R2021b