Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Simulink.BusElement class

Package: Simulink

Describe element of bus signal

Description

An object of this class specifies the properties of a signal in a bus. Bus element objects validate of the properties of signals in a bus. A Simulink.Bus object contains bus elements. A bus element exists only within a bus object. You can specify a bus object, but not a bus element, as a block parameter value. When you simulate a model or update diagram, Simulink® checks whether the signals in a bus connected to blocks have the properties specified by the bus elements. If not, Simulink halts and displays an error message.

You can use the Simulink Bus editor (see Create Bus Objects with the Bus Editor), or MATLAB® commands (see Create Bus Objects Programmatically) to create and modify bus objects and bus elements in the base MATLAB workspace.

Construction

busElementName = Simulink.BusElement returns a bus element with these property values:

              Name: 'a'
        Complexity: 'real'
        Dimensions: 1
          DataType: 'double'
               Min: []
               Max: []
    DimensionsMode: 'Fixed'
        SampleTime: -1
              Unit: ''
       Description: ''

Output Arguments

expand all

Bus element, returned as a Simulink.BusElement object.

Properties

expand all

Name of bus element, specified as a character vector.

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

Dimensions of bus element, specified as an array.

Data type of bus element, specified as a built-in Simulink data type or Simulink.NumericType object. Examples of built-in data types include double and uint8. You can specify a Simulink.NumericType object whose DataTypeMode property is set to a value other than 'Fixed-point: unspecified scaling'. Specifying a bus object allows you to create bus objects that specify hierarchical buses (that is, buses that contain other buses).

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

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

How to handle size of bus element, specified as 'Fixed' or 'Variable'.

Sample time of bus element, specified as a double. The sample time is the size of the interval between times when this signal value must be recomputed. If these conditions apply, use the default value of -1:

  • The bus element is a bus.

  • The bus that includes this element passes through a block that changes the bus sample time, such as a Rate Transition block.

Physical unit for expressing bus element, specified as a character vector (for example, 'inches').

Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects (MATLAB) in the MATLAB documentation.

Examples

expand all

Create the CONTROL bus object and its bus elements. The bus objects are stored in the base workspace.

clear elems;
elems(1) = Simulink.BusElement;
elems(1).Name = 'VALVE1';
elems(1).Dimensions = 1;
elems(1).DimensionsMode = 'Fixed';
elems(1).DataType = 'double';
elems(1).SampleTime = -1;
elems(1).Complexity = 'real';

elems(2) = Simulink.BusElement;
elems(2).Name = 'VALVE2';
elems(2).Dimensions = 1;
elems(2).DimensionsMode = 'Fixed';
elems(2).DataType = 'double';
elems(2).SampleTime = -1;
elems(2).Complexity = 'real';

CONTROL = Simulink.Bus;
CONTROL.Elements = elems;

This script is similar to the file that you get by saving a bus object to a MATLAB file and choosing the Object format. For information about saving bus objects, see Save and Import Bus Objects.

Alternatives

You can use the Bus Editor to create interactively a bus object and its bus elements. For details, see Create Bus Objects with the Bus Editor.

Programmatically, you can create bus objects and elements from:

Introduced before R2006a

Was this topic helpful?