Newsletters - MATLAB News & Notes
Fitting a Statistical Model to Test Engine Data
by Chris Hayhurst
Lookup tables in engine controllers have historically been calibrated directly from test data, forcing engine tests to be run at most or all operating points in order to achieve a full calibration. As engines are becoming more complicated, the number of input variables increases and the number of tests required grows exponentially. At the same time there is pressure to test and calibrate engines in less time, using fewer prototypes and making better reuse of testing effort in subsequent programs.
It is possible instead to use design-of-experiment techniques to plan a reduced engine test, fit statistical models to the results, and then use those models to perform analytical rather than experimental calibration.
| The Model-Based Calibration Toolbox provides a clear process from test planning to analytical calibration. |
In order to rely on models for the calibration stage, the models themselves must be capable of fitting complex engine responses and incorporating constraint information and measures of validity.
Example: Modeling the Torque Response of an Automotive Engine
This article illustrates how the process introduced above is used in the production of a "two-stage" (local and global) statistical model based on a set of torque measurements from a specifically-designed engine test.
Planning the Test
Data is often acquired in a structured way; here, holding all input variables fixed except for one local input variable-in this case a sweep of spark advance angle. To preserve as much statistical information as possible the structure of the testing should be taken into account during the model fitting. The two-stage modeling approach is a technique taken from the pharmaceutical industry that can capture the structure of measured data locally and globally. In the local stage, torque is modeled against spark advance. The global stage extends the model over the global variables: engine load, speed, and air-fuel ratio. The model output is reconstructed from the combination of the local and global stages.
Fitting the Model
Once the data is imported into the toolbox and the model structure decided, the two-stage model is fitted automatically and becomes available for analysis. For this particular engine response, the data typically has two distinct regions on either side of the maximum recorded torque. This shape of response is hard to fit with a single polynomial type curve unless a high order is used. A polynomial spline is selected from the available model types to fit this behavior. This curve type has two polynomials joined in a continuous way at a 'knot' and allows many fewer coefficients to be used to fit data that has two or more distinct regions.
Tools are provided for automatically or manually identifying outliers, (anomalous data points). The plot shows a fit to a local spark sweep (lower graph) with one point automatically flagged as an outlier based on the statistical measure of studentized residuals.
When a type of curve, such as this polynomial spline, is heuristically fitted to data, the coefficients of the curve are not always physically meaningful. The Model-Based Calibration Toolbox lets you pick an equivalent number of curve parameters, or 'response features' that do have physical meaning. In this case, two of the four parameters chosen are the maximum torque and the spark value at maximum torque. The red dot on the lower plot shows the maximum point, which is also where the spline knot has been placed.
Extending the model fit over the other three input parameters (engine speed, load, and air-fuel ratio) involves fitting other models to the way the local response features, such as maximum torque, vary, so that
Maximum torque = f (speed, load, air-fuel ratio)
These response feature models are also fitted automatically, but the user has control over the model type used and the way in which the fit is performed, as shown in the local model case.
The overall torque model is reconstructed from the local and the global models together.
Torque = f (spark, speed, load, air-fuel ratio)
This model can now be used as a prediction of torque that can be evaluated at thousands of operating points in a few seconds, instead of a few minutes for one point testing of a physical engine. This opens the door for analytical calibration, in which large numbers of evaluations are required to determine the optimum settings for the engine under any driving condition.
The last stage in the modeling exercise is to export the model to a form in which it can be evaluated. The exported model has three outputs available:
- The response being modeled: Torque = f (spark, speed, load, air-fuel ratio)
- The prediction error to assess the accuracy of prediction
- A logical constraint output: the operating point inside or outside the viable operating region of the engine
You can export the model to MATLAB, for use in a script, or to Simulink, for a part of a larger vehicle model. From a Simulink representation of the model, you can use MathWorks tools for code generation to place the model into a real-time hardware-in-the-loop test.
![]() |
Simulink block produced by exporting a model from the Model-Based Calibration Toolbox showing the extra information provided in addition to the torque output. |
Further Reading
|
Store






