■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■
▼
TargetLink Data Types Application Note September 2004
3
▲
■■■■■■■■■■I
▲■
E
A subsystem is converted to TargetLink. Inside the subsystem is a
Simulink Gain block whose output signal type is specified to be
uint16
. Consequently, the output data type (
output.type
) property of
the replacing TargetLink block is set to
UInt16
, and this type is used
during production code generation. However, the TargetLink Gain
block will not simulate
uint16
using integer arithmetic, but will
produce doubles. This applies even if the Gain block’s input signal has
an integer data type. During MIL simulation, the output is checked for
compliance with the
UInt16
range (overflow detection).
This has two consequences:
■ When integer data types are involved, the simulation behavior may
be different after conversion.
■ Since signal data types have changed, conversion might introduce
data type conflicts, which makes simulation after conversion
impossible without additional manual work, i.e. insertion of
DataTypeConversion
blocks.
The latter could be the case if, for example, the Gain block’s output is
fed to another block outside the converted subsystem, whose input is
required to be
uint16
. After conversion, the Gain block’s output is
double, so the model cannot be initialized.
Evaluation of Simulink Data Types
During conversion, Simulink data types of block outputs are evaluated
and used when the data types (
output.type
property) of the replacing
TargetLink blocks are set. Two approaches to evaluating Simulink data
types have been implemented, as described below.
Compiled Scaling Parameters
During conversion, a model can be set to the so-called compiled
mode. In this mode, the data types and scaling parameters of all
signals (block outputs) can be read out using the Simulink API.
Commenti su questo manuale