Search code examples
cdata-conversionautosarautomotive

Usage of Compu method of Category Linear Conversion with texttable


I am reading about the Data-Conversion in Autosar(RTE). I understood using comp-method we can fetch the offset and factor values.

<COMPU-METHOD>
<SHORT-NAME>linear</SHORT-NAME>
<CATEGORY>LINEAR</CATEGORY>
<UNIT-REF DEST="UNIT">kmh</UNIT-REF>
<COMPU-INTERNAL-TO-PHYS>
<COMPU-SCALES>
<COMPU-SCALE>
<COMPU-RATIONAL-COEFFS>
<COMPU-NUMERATOR>
<V>30</V>
<V>2</V>
</COMPU-NUMERATOR>
<COMPU-DENOMINATOR>
<V>1</V>
</COMPU-DENOMINATOR>
</COMPU-RATIONAL-COEFFS>
</COMPU-SCALE>
</COMPU-SCALES>
</COMPU-INTERNAL-TO-PHYS>
</COMPU-METHOD>

In the above example, the formula will be

F = 30 + 2 * x

But I am not able to understand Compumethod of category SCALE_LINEAR_AND_TEXTTABLE or TEXTTABLE.

<COMPU-METHOD>
<SHORT-NAME>linearAndTexttable</SHORT-NAME>
<CATEGORY>SCALE_LINEAR_AND_TEXTTABLE</CATEGORY>
<UNIT-REF DEST="UNIT">kmh</UNIT-REF>
<COMPU-INTERNAL-TO-PHYS>
<COMPU-SCALES>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">0</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">300</UPPER-LIMIT>
<COMPU-RATIONAL-COEFFS>
<COMPU-NUMERATOR>
<V>30</V>
<V>2</V>
</COMPU-NUMERATOR>
<COMPU-DENOMINATOR>
<V>1</V>
</COMPU-DENOMINATOR>
</COMPU-RATIONAL-COEFFS>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">350</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">350</UPPER-LIMIT>
<COMPU-CONST>
<VT>SensorError</VT>
</COMPU-CONST>
</COMPU-SCALE>
<COMPU-SCALE>
<LOWER-LIMIT INTERVAL-TYPE="CLOSED">351</LOWER-LIMIT>
<UPPER-LIMIT INTERVAL-TYPE="CLOSED">351</UPPER-LIMIT>
<COMPU-CONST>
<VT>SignalNotAvailable</VT>
</COMPU-CONST>
</COMPU-SCALE>
</COMPU-SCALES>
</COMPU-INTERNAL-TO-PHYS>
</COMPU-METHOD>

In the above example, I can get the factor and offset values. But what about the Upper and Lower limit values of each compu-scales.We need to use these values also in the formula or these values just used to generate the enumeration macros in ApplicationTypes header file?


Solution

  • The upper and lower values of the texttable part are required for the generation of enumeration macros, they do not contribute to the linear part.