|
|
|
| R2011b Documentation → Model-Based Calibration Toolbox | |
Learn more about Model-Based Calibration Toolbox |
|
| Contents | Index |
| On this page… |
|---|
Now you can use the data to create a statistical model of an automobile engine that predicts the torque generated by the engine as a function of spark angle and other variables.
Note It does not matter in which order you set up local and global models, as both must be completed before you set up the response model. |
To create a new test plan, do one of the following:
In the Test Plans list pane at the bottom, click New.
Alternatively, click the New Test Plan button (
) in the toolbar.
Note that this button changes depending on which node is selected
in the model tree. It always creates a child node (not necessarily
a test plan node), as does the New button at
the bottom.
Or select File > New Test Plan.
The New Test Plan dialog box appears.

Click the two-stage test plan icon and click OK.
The default name of the new test plan, Two-Stage, appears in the Model Browser tree, in the All Models pane.
The view switches to the new test plan node, and the Model Browser window displays a diagram representing the two-stage model.
See also Test Plan Level.

Setting up the local model requires that you specify the model's inputs and type.

The model you are building is intended to predict the torque generated by an engine as a function of spark angle at a specified operating point defined by the engine's speed, air/fuel ratio, and load. The input to the local model is therefore the spark angle.
To specify spark angle as the input,
Double-click (or right-click) the Local Inputs icon on the model diagram to specify the local model input.
The Local Input Factor Setup dialog box appears.

Set Symbol to S.
Set Signal to spark. This is optional and matches the raw data.
Notice that the new name of the local model input now appears on the two-stage model diagram.
The type of a local model is the shape of curve used to fit the test data, for example, quadratic, cubic, or polyspline curves. In this example, you use polyspline curves to fit the test data. A spline is a curve made up of pieces of polynomial, joined smoothly together. The points of the joins are called knots. In this case, there is only one knot. These polynomial spline curves are very useful for torque/spark models, where different curvature is required above and below the maximum.
To specify polyspline as the model type,
Double-click the local model icon in the model diagram.
The Local Model Setup dialog box appears.

Select Polynomial Spline from the Local Model Class list.
Set Spline Order to 2 below and 2 above knot.
Notice that the new name of the local model class, PS (for polyspline) 2,2 (for spline order above and below knot) now appears on the two-stage model diagram.

Setting up the global model is similar to setting up the local model. You must specify the model (or curve) type and the inputs used to create the model.

The inputs to the global model are the variables that determine the operating point of the system being modeled. In this example, the operating point of the engine is determined by the engine's speed in revolutions per minute (rpm - often called N), load (L), and air/fuel ratio (afr).
To specify these inputs,
Double-click the Global Inputs icon on the model diagram.
The Global Input Factor Setup dialog box appears.

By default, there is one input to the global model. Because this engine model has three input factors, you need to increase the input factors as follows:
Click the up arrow button indicated by the cursor above to increase the number of factors to three.
Edit the three factors to create the engine model input. In each case, change the symbols and signals to the following:
| Symbol | Signal |
|---|---|
N | n |
L | load |
A | afr |
Leave the Min and Max boxes at the defaults (you fill them during the data selection process). You might want to set factor ranges at this stage if you were designing an experiment, but in this case there is already data available, so you use the actual range of the data to model instead.
Fitting the local model finds values for each model coefficient or response feature (for example, knot) for each test. These coefficients then become the data to which you fit the global model.
By default, quadratic polynomials are used to build the global model for each response feature. In this case you use the default.
To specify quadratic curves as the global model curve fitting method,
Double-click the icon representing the global model in the two-stage model diagram.
The Global Model Setup dialog box appears.

Polynomial should already be selected from the Linear Model Subclass pop-up menu. Under Model options, the order for the three variables N, L, and A is set by default to 2, which is required.
Set Stepwise to Minimize PRESS (PREdicted Sum Square error).
Click OK to accept the settings and dismiss the Model Settings dialog box.
You use the Stepwise feature to avoid overfitting the data; that is, you do not want to use unnecessarily complex models that "chase points" in an attempt to model random effects. Predicted error sum of squares (PRESS) is a measure of the predictive quality of a model. Minimize PRESS throws away terms in the model to improve its predictive quality, removing those terms that reduce the PRESS of the model.
This completes the setup of the global model.
The model you have set up now needs data:
Double-click the Responses block in the Test Plan diagram. As no data has yet been selected for this test plan, this launches the Data Wizard.

For the same result, you could also click the Select Data button
in the toolbar of the Model Browser
(or TestPlan > Select
Data menu item). Also, if you did not already
load a data set at the project node, you can do it at this point using TestPlan > Load New Data.
The Data Wizard dialog box appears.

Select S in the Model Input Factors box and Spark under All Data Signals.
If the signal name entered during the input factor setup matches a signal name in the data set, the wizard automatically selects the correct signal when the input factor is selected. If the name is not correct, you must select the correct signal manually by clicking. This autoselect facility can save time if the data set has a large number of signals.
Select the Copy Range check box, as shown in the following figure. This selection tells the model to use the range in the data for that factor.

Click the large Select Data Signal button, as indicated above.
Repeat this process to match the correct data signals to the other three input factors, N, L, and A (from n, load, and afr).
When you have matched all four input factors to the correct data signals (for both stages of the two-stage model), click Next.
The model you just set up now needs a response specified (that is, the factor you want the model to predict, in this case, torque).
The next screen of the Data Wizard is for selecting response models.

Only certain model types with a clearly defined maximum or minimum can support datum models. See New Response Models and Datum Models.
Clear the check box Open Data Editor on completion. You have already inspected the data.
The Model Browser now calculates local and global models using the test plan models you just set up.
Notice that torque appears on the two-stage model diagram, and a new node appears on the tree in the All Models pane, called PS22.
![]() | Starting the Toolbox and Loading Data | Verifying the Model | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |