Characteristic Lines (C Code)
Characteristic lines defined in the component are evaluated via three subroutines each (as in ESDL).
Table LLpr from Linear Interpolation (1D) is again used as an example for a characteristic line.
x axis points | 0.0 | 1000.0 | 2000.0 | 3000.0 | 4000.0 | 5000.0 | 6000.0 |
values | 0.0 | 0.8 | 1.1 | 1.5 | 1.8 | 2.0 | 2.2 |
The CharTable1_getAt_real64_real64(charline, index) subroutine is usually sufficient for the evaluation of characteristic lines. Linear interpolation for this example works as follows:
tmpVal = CharTable1_getAt_real64_real64(LLpr,3000);
// assigns 1.5 to tmpVal
tmpVal = CharTable1_getAt_real64_real64(LLpr,2280);
// calculates interpolation factor for 2280
// interpolates value for 2280 as 1.212 and
// assigns it to tmpVal
tmpVal = CharTable1_getAt_real64_real64(LLpr,9000);
// calculates interpolation factor for 9000
// interpolates value for 9000 as 2.2 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 CharTable1_search_real64(charline, index) and CharTable1_interpol_real64_real64(charline) are used.
CharTable1_search_real64(LLpr, 1000);
// sets sample point to 1000
tmpVal = CharTable1_interpol_real64_real64(LLpr);
// assigns 0.8 to tmpVal
CharTable1_search_real64(LLpr, 2780);
// calculates interpolation factor for 2780
tmpVal = CharTable1_interpol_real64_real64(LLpr);
// interpolates value for 2780 as 1.412 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