ssGetDataTypeTotalSlope
Return total slope of scaling of registered data type
Syntax
extern double ssGetDataTypeTotalSlope (SimStruct *S, DTypeId dataTypeId)
Arguments
S
SimStruct representing an S-function block.
dataTypeId
Data type ID of the registered data type for which you want to know the total slope.
Description
Fixed-point numbers can be represented as
real-world value = (slope × integer) + bias,
where the slope can be expressed as
slope = fractional slope × 2exponent.
This function returns the total slope, rather than the fractional slope, of
the data type designated by dataTypeId
. To get the fractional
slope, use ssGetDataTypeFracSlope
:
If the registered data type has trivial scaling, including
double
andsingle
data types, the function returns a total slope of1
.If the registered data type is
ScaledDouble
, the function returns the total slope of the nonoverridden data type. Refer to the examples below.
This function errors out when ssGetDataTypeIsFxpFltApiCompat
returns
FALSE
.
Requirement
To use this function, you must include fixedpoint.h
and
fixedpoint.c
. For more information, see Structure of the S-Function.
Languages
C
Examples
The data type sfix32_En4
becomes
flts32_En4
with data type override. The total slope
returned by this function in either case is 0.0625
(2-4).
The data type ufix16_s7p98
becomes
fltu16_s7p98
with data type override. The total slope
returned by this function in either case is 7.98
.
TLC Functions
FixPt_DataTypeTotalSlope
Version History
Introduced before R2006a