Bus Objects in the Fixed-Point Workflow
How Data Type Proposals Are Determined for Bus Objects
This example shows how the software determines the data types for elements of bus objects using the ex_bus_range
model.
The data type proposal for a bus object is found by taking the union of the ranges of all sources driving the same bus element, and then proposing a data type for this range. The Fixed-Point Tool does not log minimum and maximum ranges for elements of a bus signal.
Open the ex_bus_range
model and range data.
load bus_range.mat open_system('ex_bus_range')
Each of the four input ports in this model have specified design ranges. The In2
and In4
input ports must share the same data type because they drive the same element of the mybus
bus object.
The Fixed-Point Tool proposes a data type based on the union of these two ranges. After proposing data types for the model, select the Data Objects node in the Model Hierarchy pane. In the Result Details pane for the mybus : b
element of the bus object, notice the row labeled Shared Design in the Ranges used for proposal table. The proposed data type is based on this range, which is the union of the design ranges of the In2
and In4
blocks.
Bus Naming Conventions with Data Type Override
When you use data type override on a model that contains buses, the Fixed-Point Tool
generates a new bus which uses the overridden data type. To indicate that a model is using
an overridden bus, the tool adds a prefix to the name of the original bus object. While a
model is in an overridden state, a bus object named myBus
is renamed
based on the following pattern.
DTO Mode | DTO Applies To | ||
---|---|---|---|
All Numeric Types | Floating Point | Fixed Point | |
Scaled Double | dtoScl_myBus | dtoSclFlt_myBus | dtoSclFxp_myBus |
Double | dtoDbl_myBus | dtoDblFlt_myBus | dtoDblFxp_myBus |
Single | dtoSgl_myBus | dtoSglFlt_myBus | dtoSglFxp_myBus |
Note
You cannot see bus objects with an overridden data type within the Type Editor because they are not stored in the base workspace.
Limitations of Bus Objects in the Fixed-Point Workflow
An update diagram error can occur if any of the following conditions occur.
Your model is in accelerator mode and has a bus object with an overridden data type at the output port.
To perform data type override, run the model in normal mode.
The data types in your model are overridden and the model contains Stateflow® charts that use MATLAB® as the action language.
Your model contains tunable MATLAB structures assigned to a bus signal (such as Unit Delay blocks with a structure as the initial condition, Stateflow data, and MATLAB structures from the workspace).
To use the Fixed-Point Tool, change the structure to a non tunable structure. To avoid unnecessary quantization effects, specify the structure fields as doubles. For more information on using a structure as an initial condition with bus objects, see Data Type Mismatch and Structure Initial Conditions.
Your model contains a structure parameter specified through the mask of an atomic subsystem.
To use the Fixed-Point Tool, make the system non-atomic.