Main Content

Simulink.BusElement

Specify properties of elements of buses

Description

ASimulink.BusElementobject is an element of aSimulink.Busobject. It validates the properties of a signal in a bus.

BusElementobjects exist only within theBusobject. You can specify aBusobject, but not aBusElementobject, as a data type.

When you simulate or update a model, Simulink®checks whether the signals in a bus have the properties specified by the correspondingBusElementobjects.

To create and modifyBusandBusElementobjects in the base workspace or a data dictionary, you can use theBus Editoror MATLAB®commands. You cannot storeBusobjects in model workspaces.

克雷亚tion

Description

example

be= Simulink.BusElement返回一个BusElementobject with default property values.

Properties

expand all

Name of element, specified as a character vector.

Note

To validate the properties of a signal against aBusElementobject, the signal name must be a valid identifier that starts with an alphabetic character or underscore (_), followed by alphanumeric characters or underscores.

Data Types:char|string

Numeric type of the element, specified as'real'or'complex'.

Data Types:char|string

Dimensions of element, specified as a scalar or vector.

Data Types:double

Data type of element, specified as a built-in Simulink data type, aSimulink.NumericTypeobject, or aSimulink.Busobject.

Examples of built-in data types includedoubleanduint8. For more information, seeData Types Supported by Simulink.

You can specify aSimulink.NumericTypeobject whoseDataTypeModeproperty is set to a value other than'Fixed-point: unspecified scaling'.

Specifying aSimulink.Busobject allows you to createBus指定的对象层次公共汽车(即buses that contain other buses).

Data Types:char|string

Minimum value of the element, specified as a scalar. This value must be a finite real double scalar or, if the element is a bus, the value must be empty,[].

Data Types:double

Maximum value of the element, specified as a scalar. This value must be a finite real double scalar or, if the element is a bus, the value must be empty,[].

Data Types:double

Specify how to handle size of element, specified as'Fixed'or'Variable'.

Data Types:char|string

Physical unit for expressing element, specified as a character vector.

Example:'inches'

Data Types:char|string

Bus element description, specified as a character vector. Use the description to document information about theBusElementobject, such as the kind of signal it applies to. This information does not affect Simulink processing.

Data Types:char|string

Examples

collapse all

克雷亚te a hierarchy ofBusobjects using arrays. Array indexing lets you create and access multiple elements in an array. Dot notation lets you access property values.

克雷亚te twoBusElementobjects, namedChirpandSine, in the base workspace.

elems(1) = Simulink.BusElement; elems(1).Name ='Chirp'; elems(2) = Simulink.BusElement; elems(2).Name =的正弦;

克雷亚te aBusobject, namedNestedBus, that uses the elements defined in theelemsarray.

NestedBus = Simulink.Bus; NestedBus.Elements = elems;

克雷亚te two moreBusElementobjects, namedNestedBusandStep. To haveNestedBusrepresent aBusobject, specify aBusobject data type.

clearelemselems(1) = Simulink.BusElement; elems(1).Name ='NestedBus'; elems(1).DataType ='Bus: NestedBus'; elems(2) = Simulink.BusElement; elems(2).Name ='Step';

克雷亚te the bus at the top of the bus hierarchy that uses the elements defined in theelemsarray.

TopBus = Simulink.Bus; TopBus.Elements = elems;

You can view the created objects in theBus Editor.

buseditor

Alternatives

To interactively create aBusElementobject, use theBus Editor.

To createBusElementobjects from blocks in a model, MATLAB data, and external C code, see克雷亚te Bus Objects Programmatically.

Compatibility Considerations

expand all

Errors starting in R2020b

Not recommended starting in R2016b

Introduced before R2006a