Main Content

Model AUTOSAR Calibration Parameters and Lookup Tables

In Simulink®, you can model AUTOSAR calibration parameters and lookup tables, which support run-time tuning of the AUTOSAR application with calibration and measurement tools.

AUTOSAR Calibration Parameters

A calibration parameter is a value in an Electronic Control Unit (ECU). You tune or modify these parameters using a calibration data management tool or an offline calibration tool.

The AUTOSAR standard specifies the following types of calibration parameters:

  • Calibration parameters that belong to a calibration component (ParameterSwComponent), which AUTOSAR software components can access.

  • Internal calibration parameters, which only one AUTOSAR software component defines and accesses.

To provide your Simulink model with access to calibration parameters, reference the calibration parameters in block parameters.

To map Simulink parameter objects in the model workspace to AUTOSAR calibration parameters, open the AUTOSAR code perspective and use the Code Mappings editor, Parameters tab. To view and modify AUTOSAR code and calibration attributes for a selected parameter, click the icon. For more information, see Map Model Workspace Parameters to AUTOSAR Component Parameters.

Calibration Parameters for STD_AXIS, FIX_AXIS, and COM_AXIS Lookup Tables

You can model standard axis (STD_AXIS), fix axis (FIX_AXIS), and common axis (COM_AXIS) lookup tables for AUTOSAR applications. AUTOSAR applications can use lookup tables in either or both of two ways:

  • Implement fast search operations.

  • Support tuning of the application with calibration and measurement tools.

A lookup table uses an array of data to map input values to output values, approximating a mathematical function. An n-dimensional lookup table can approximate an n-dimensional function. A COM_AXIS lookup table is one in which tunable breakpoints (axis points) are shared among multiple table axes.

The AUTOSAR standard defines calibration parameter categories for STD_AXIS, FIX_AXIS, and COM_AXIS lookup table data:

  • CURVE, MAP, and CUBOID parameters represent 1-D, 2-D, and 3-D table data, respectively.

  • COM_AXIS parameters represent axis data.

In Simulink, you can:

  • Import ARXML files that contain AUTOSAR lookup tables in STD_AXIS, FIX_AXIS, and COM_AXIS configurations:

    • For a lookup table in a STD_AXIS configuration, the importer creates a lookup table block and initializes it with a Simulink.LookupTable object.

    • For a lookup table in a FIX_AXIS configuration, the importer creates a lookup table block and initializes the table values with a Simulink.Parameter object and the breakpoint values are initialized with values from fix axes parameters.

    • For a lookup table in a COM_AXIS configuration, the importer creates a prelookup block initialized with a Simulink.Breakpoint object and an interpolation-using-prelookup block initialized with a Simulink.LookupTable object.

    • The importer maps each created Simulink lookup table to AUTOSAR parameters with code and calibration attributes.

    • If the ARXML files define input variables that measure lookup table inputs, the importer creates corresponding model content. If the input variables are global variables, the importer connects static global signals to lookup table block inputs. If the input variables are root-level inputs, the importer connects root-level inports to lookup table block inputs.

  • Create STD_AXIS, FIX_AXIS, and COM_AXIS lookup tables and map them to AUTOSAR parameters. You map lookup table objects to AUTOSAR parameters by using the Code Mappings editor, Parameters tab.

    • To model an AUTOSAR lookup table in a STD_AXIS configuration, create an AUTOSAR Blockset Curve or Map block.

      Open each lookup table block and configure it to generate a routine from the AUTOSAR 4.0 code replacement library (CRL). As you modify block settings, the block dialog box updates the name of the targeted AUTOSAR routine.

      To store the data, create a single Simulink.LookupTable object in the model workspace. Use the object in the Curve or Map block.

      Data appears in the generated C code as fields of a single structure. To control the characteristics of the structure type, such as its name, use the properties of the object.

    • To model an AUTOSAR lookup table in a FIX_AXIS configuration, create an AUTOSAR Blockset Curve or Map block with Breakpoints specification: Even spacing.

      Open each lookup table block and configure it to generate a routine from the AUTOSAR 4.0 code replacement library (CRL). As you modify block settings, the block dialog box updates the name of the targeted AUTOSAR routine.

      To store the data, create a single Simulink.Parameter object in the model workspace. Use the object in the 1-D Lookup Table block.

      Table data appears in the generated C code as a separate variable. The breakpoint values appear as constants.

    • To model an AUTOSAR lookup table in a COM_AXIS configuration, create one or more AUTOSAR Blockset Prelookup blocks. Pair each Prelookup with an AUTOSAR Blockset Curve Using Prelookup or Map Using Prelookup block.

      Open each lookup table block and configure it to generate a routine from the AUTOSAR 4.0 code replacement library (CRL). As you modify block settings, the block dialog box updates the name of the targeted AUTOSAR routine.

      To store each set of table data, create a Simulink.LookupTable object in the model workspace. To store each breakpoint vector, create a Simulink.Breakpoint object in the model workspace. Use each Simulink.LookupTable object in a Curve Using Prelookup or Map Using Prelookup block and each Simulink.Breakpoint object in a Prelookup block. You can reduce memory consumption by sharing breakpoint data between lookup tables.

      Each set of table data appears in the generated C code as a separate variable. If the table size is tunable, each breakpoint vector appears as a structure with one field to store the breakpoint data and, optionally, one field to store the length of the vector. The second field enables you to tune the effective size of the table. If the table size is not tunable, each breakpoint vector appears as an array.

    • Add AUTOSAR operating points to the lookup tables. Connect root level inports to Curve, Map, or Prelookup blocks. Alternatively, configure input signals to Curve, Map, or Prelookup blocks with static global memory.

    • To map Simulink lookup table objects in the model workspace to AUTOSAR calibration parameters, open the AUTOSAR code perspective and use the Code Mappings editor, Parameters tab. To view and modify AUTOSAR code and calibration attributes for a selected parameter, click the icon. For more information, see Map Model Workspace Parameters to AUTOSAR Component Parameters

  • Configure the array layout for multidimensional lookup tables. In the Simulink Configuration Parameters dialog box, Interface pane, set Array layout (Simulink Coder) to Column-major (the default) or Row-major. The array layout selection affects code generation, including C code and exported ARXML SwRecordLayout descriptions.

    If you select row-major layout, go to the Math and Data Types pane and select the configuration option Use algorithms optimized for row-major array layout. The algorithm selection affects simulation and code generation.

  • In the Configuration Parameters dialog box, Interface pane, select the AUTOSAR 4.0 code replacement library for C code generation.

  • Generate ARXML and C code with STD_AXIS, FIX_AXIS, and COM_AXIS lookup table content.

    The generated C code contains required Ifl and Ifx lookup function calls and Rte data access function calls.

    The generated ARXML files contain information to support run-time calibration of the tunable lookup table parameters, including:

    • Lookup table calibration parameters that reference the application data types — category CURVE, MAP, or CUBOID for table data, or category COM_AXIS for axis data.

    • Application data types of category CURVE, MAP, CUBOID, and COM_AXIS, with the data calibration properties that you configured. The properties include SwCalibrationAccess, DisplayFormat, and SwAddrMethod.

    • Software record layouts (SwRecordLayouts) referenced by the application data types of category CURVE, MAP, CUBOID, and COM_AXIS.

For more information, see Configure Lookup Tables for AUTOSAR Calibration and Measurement.

See Also

| | | | | | | | |

Related Examples

More About