How to Generate an AUTOSAR Lookup Table Using Lookup Table Optimization
Designing a lookup table involves various choices: fixed-point or floating-point data, size of the table, evenly spaced data or uneven spacing, and other algorithm settings such as the interpolation method. The Lookup Table Optimizer app solves this problem by generating an efficient lookup table that minimizes the RAM memory. You can also generate a Lookup Table block that maps to AUTOSAR library routines and generate AUTOSAR compliant C code.
Published: 15 Nov 2019
A lookup table is a key construct for embedded designs and this video highlights a couple ways of generating efficient lookup tables. Lookup tables are primarily used to model algorithmic components with complex input/output relationships using empirical or recorded data.
But they are also used to speed up the run-time execution of some parts of your algorithm at the expense of increased memory.
Common use cases are replacing a complex function like a trig function with a lookup table or a complete subsystem with a more efficient lookup table implementation or from data – when you have data, say, from calibration or testing that you want to model as a lookup table.
So, let’s consider a simple model with an exponential function which can be more efficiently implemented using a lookup table, or consider the subsystem entirely.
The Lookup Table Optimizer app solves this optimization problem for you, once you specify the constraints like the:
- desired input and output data types
- range of the output
- threshold on the approximation of the output.
Now, for automotive applications, AUTOSAR is a popular, open, and standardized software architecture for ECU software development. Complying with it is an additional constraint and you can specify this as an option for optimization.
Once you start the optimization, you will notice the runs with different table sizes, word lengths, different breakpoint spacing options and once we find the most efficient solution, we can generate the AUTOSAR compliant lookup table to replace the original lookup table in our model.
The generated lookup table is an AUTOSAR Map block from AUTOSAR Blockset.
AUTOSAR blockset provides capabilities to model and develop AUTOSAR Classic and Adaptive software in simulink.
Now, in the other use case where you have raw data, such as calibration data from the CDF file in the example model here, you can load the data into a lookup table.
We then repeat the same steps as we did earlier, using the lookup table optimizer app to specify the constraints and then run the optimization to generate an AUTOSAR compliant lookup table from your data.
You can use the comparison plot to verify that the error is within tolerance – by looking at the plot on the right here. You can then replace the original LUT with the Optimized AUTOSAR compliant LUT in your model.
To generate code that maps to the AUTOSAR IFX library routine, you can use the AUTOSAR component designer app, make sure that you have the right code configuration settings and last but not least, match the datatypes of the breakpoints to the respective inputs.
Once you generate code, here is the generated code for the AUTOSAR Map block showing the corresponding IFX routine.
To see more examples and to learn more about optimizing LUTs in your design, Please refer to additional links below the video.
Featured Product
Fixed-Point Designer
Up Next:
Related Videos:
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)