Characteristic Maps (C Code)
Characteristic maps defined in the component are evaluated via three subroutines each (as in ESDL).
Table LLpr2 from Linear Interpolation (2D) is again used as an example for a characteristic map:
y \ x | 0.0 | 1.0 | 8.0 | 15.0 |
1.0 | -5.0 | -3.0 | 0.0 | 1.0 |
3.0 | 0.0 | 1.0 | 4.0 | 6.0 |
5.0 | 8.0 | 5.0 | 4.0 | 4.0 |
The CharTable2_search_real64_real64(charline,indx, indY)subroutine is usually sufficient for the evaluation of characteristic lines. Linear interpolation for this example works as follows:
tmpVal = CharTable2_getAt_real64_real64_real64(LLpr2,8,5)
// assigns 4.0 to tmpVal
tmpVal = CharTable2_getAt_real64_real64_real64(LLpr2,2,2);
// calculates interpol. factor for x=2 and y=2
// interpolates value for (2,2) as -0.571 and
// assigns it to tmpVal
tmpVal = CharTable2_getAt_real64_real64_real64(LLpr2,20,9);
// calculates extrapol. factor for x=20, y=10
// extrapolates value for (20,10) as 5.0 and
// assigns it to tmpVal
In some special cases, though, separating the search and interpolate steps in tables can be more efficient. In these cases, the subroutines CharTable2_search_real64_real64(charmap,indX, indY) and CharTable2_interpol_real64_real64_real64(charmap) are used.
CharTable2_search_real64_real64(LLpr2, 1, 3);
// sets x sample point to 1
// and y sample point to 3
tmpVal = CharTable2_interpol_real64_real64_real64(LLpr2);
// assigns 1.0 to tmpVal
CharTable2_search_real64_real64(LLpr2,4,4);
// calculates interpol. factor for x=4, y=4
tmpVal = CharTable2_interpol_real64_real64_real64(LLpr2);
// interpolates value for (4,4) as 3.143 and
// assigns it to tmpVal
In addition to the interpolation routines provided by ASCET, you can add user-defined interpolation routines, or you can mark interpolation routines as high-resolution.
Note |
|---|
The interpolation routines provided with ASCET are examples, not intended to be used in production or in ECUs running in a vehicle. See also the ASCET‑SE user guide. |
See also
User-Defined Interpolation Routines
High-Resolution Interpolation Routines
Variables and Function Parameters
Automatically Generated define Statements for Instance Variables