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.
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.
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.