Introduction to Calibration and Measurement
Calibration is the process of tuning and finding an optimized set of Electronic Control Unit (ECU) parameter values, and measurement is the process of analyzing signals to verify the behavior of an application. Use calibration tools to tune the parameters during run time and to measure signals from the ECU.
This figure shows the calibration workflow.
MATLAB® enables users to perform calibration starting from the creation of a Simulink® model to the tuning of ECU parameters. There are three ways to calibrate an application:
External mode calibration
ASAP2 file-based calibration using third-party tools
ASAP2 file with XCP transport-based calibration using Vehicle Network Toolbox™ or third-party tools
The calibration workflow described here involves these roles:
The Modeler creates a Simulink model, configures the parameters and test points. After a model is developed that represents an application, the Modeler simulates the model, builds and generates code, and generates calibration files.
A Modeler is required to consult the Calibration Engineer before configuring parameters, configuring code interfaces, and generating calibration file for a model.
After the Modeler develops a Simulink model, the Tools Engineer is responsible in defines storage requirements, configures XCP server, and defines code interfaces after consulting the Calibration Engineer.
The Calibrations Engineer deploys the executable on the target machine and performs calibration and measurement.
Create Simulink Model
You can use Simulink to create a model for the system that you want to calibrate. You can model linear and nonlinear systems that include representations of real-world phenomena. You can design your models to be hierarchical by organizing groups of blocks into subsystems. This approach enables you to build discrete components that reflect your real-life system and simulate the interaction of those components. A Simulink model can contain inports, outports, parameters, signals, states, functions, data stores, and constants.
For more information, see Model-Based Design with Simulink.
Determine Data Representation and Storage Requirements
Configure the data elements in the model for storage. A Simulink model contains data elements such as variables and objects. Based on the model design, model architecture, level of access to the data, and the ability to calibrate the data, you can choose to store the data using one of these storage methods.
MATLAB base workspace — Use the base workspace to store variables while you experiment with temporary models.
Model workspace — Use a model workspace to permanently store data that is local to a model.
Data dictionary — Use data dictionaries to permanently store global data, share data between models, and track changes made to data.
For more information, see Determine Where to Store Variables and Objects for Simulink Models.
Configure Parameters and Test Points
Configure parameters and test points that enable tuning and viewing data. Model configuration parameters and block parameters determine how your model runs by specifying the type of solver used, import and export settings, and other settings that control model behavior. Every model has a configuration set that contains the model configuration parameters and their specified values. Every data element has associated block parameters.
A test point is a signal that is observable when using a Floating Scope and Scope Viewer block in a model. Simulink allows you to
designate any signal in a model as a test point. Designating a signal as a test point
exempts the signal from model optimizations, such as signal storage reuse and block
reduction. These optimizations render signals inaccessible and hence unobservable during
simulation. Test points are primarily intended for use when generating code from a model
with Simulink Coder™. Marking a signal as a test point has no impact on signal logging that
uses the Dataset
logging format.
For more information, see Configure Signals as Test Points.
Simulate the Model
Simulate the model and see if the model behaves as expected. Replace the inports of the model with test data, connect scope blocks for the data to be visualized, and run the simulation. You can also use Simulation Data Inspector to view the simulation data. Update or modify the Simulink model signal and parameter configurations based on the simulation data.
For more information, see Simulation Basics.
Define and Configure Code Interfaces
Before generating code from a model, inform the code generator about the target environment and programming language by specifying a type of output. To integrate generated code with external code and to comply with code standards and guidelines, configure the interfaces that the generated code uses to interact with other software in the target environment. Configure the declarations and definitions of functions, variables, and data types in the code by mapping model data elements to code definitions for C code generation. Configure generated class information to generate C++ code that integrates into existing software architectures, such as class names and namespaces.
For more information, see C Data Code Interface Configuration for Model Interface Elements.
Enable XCP Server - Custom Targets
Generate code, build an executable, and deploy it on hardware to perform external mode
simulation. Use the configuration settings of the model to specify the XCP server details,
and the hardware board details, and then generate the code. For code that is generated by
using ERT (ert.tlc
) and GRT (grt.tlc
) system target
files, you can run external mode simulations that use the XCP communication protocol on your
development computer. For other targets, you can use support packages.
If the Simulink model is configured for a custom system target file that is derived from the ERT or GRT system target files, use classes from the target package to customize connectivity.
For more information, see Customize Connectivity for XCP External Mode Simulations.
Generate Code and Build Model
Use the Model Advisor to check whether the component model is ready for code generation. From the component model, generate source code, object code, a program executable, or a shared utility or utility code. Optionally, generate an HTML report that you can use to review, analyze, publish, or archive code generation results. For a model, you can choose to generate only the code, or generate code and executable. You can deploy the executable on target hardware.
For more information, see Code Generation Configuration.
Customize and Generate Calibration Files
This step is not required for external mode calibration.
Use the Generate Calibration Files tool to customize and generate an ASAP2 file or a CDF file to use for calibration. Some applications must exchange data between generated code and external application code. Use the ASAP2 and CDF interface to establish a communication channel between development and target computers, export an ASAP2 file containing description format of the internal ECU variables, or export a Calibration Data Format (CDF) file containing the information about parameters in a machine-readable format.
Simulink Coder enables you to customize the ASAP2 file such as defining custom CompuMethod names, adding custom data elements to ASAP2 file, grouping the data elements based on their properties, defining the calibration access level for a data element.
For more information, see Generate ASAP2 and CDF Calibration Files.
Deploy Executable
Simulink provides capabilities for designing top models and deploying them as generated code that behaves in a target execution environment like the model behaves during simulation. Deploy application code that runs as a standalone executable program in a single-process or multiprocess target environment. Deploy component source code modules for integration with an external main program, other target environment software, and other components.
For more information, see Deploy Generated Software.
Perform Calibration and Measurement
View and export data, tune the parameters, and measure the signals. Calibration is the process of tuning the parameters to find an optimized set of parameters to use in the software.
In an external mode simulation, you can tune parameters in real time and monitor target application signals. Using the Run on Custom Hardware app, you can set up and run on your development computer or custom hardware external mode simulations that use an XCP communication channel. For more information, see External Mode Simulation by Using XCP Communication.
In ASAP2-based calibration, you can use the generated ASAP2 file to tune parameters and measure signals after doing address replacement for the data elements, and perform calibration by using third-party calibration tools such as Vector, ETAS Inca. In ASAP2 file with XCP transport-based calibration, you can connect your XCP client to a server module using the TCP/IP, serial, and CAN protocols. This allows you to use events and access measurements on the server module. You can perform a direct read from or write to the memory on the server module.
For more information about ASAP2 file with XCP transport based calibration, see
Perform XCP Operations on Deployed Simulink Model (Vehicle Network Toolbox)
Embedded Coder® Support Package for Linux® Applications enables you to create and deploy AUTOSAR adaptive applications to a Linux target hardware, calibrate the applications by using Linux Runtime Manager application, and analyze measurement data by using Simulation Data Inspector. For more information, see Calibrate AUTOSAR Adaptive Application.
See Also
coder.asap2.getEcuDescriptions
| coder.asap2.export