Skip to Main Content Skip to Search
Product Documentation

Optimizing Table Values

Filling and Optimizing Table Values

Use the Feature Fill Wizard to fill and optimize the values in tables by reference to the model or data. You can fill multiple tables at once using the wizard, and you can Fill from the top feature node or from any table node in a feature. Use Fill at the top feature node to calibrate the entire feature, that is, fill all the table values by referring to a model.

When filling with reference to a model, the Feature Fill Wizard optimizes the table values to minimize the current total square error between the feature values and the model. This routine optimizes the fit between your strategy and your model. Using Fill places values into your table. The optimization process shifts the cell values up and down to minimize the overall error between the interpolation between the model and the strategy. To learn more about the filling processes, see How CAGE Optimizes Table Values.

CAGE projects store last-used feature filling settings for tables, models, data, and optimizations. This can save time if you need to use the Feature Filling Wizard repeatedly with slightly different settings. You can remove saved fill settings by selecting Feature > Reset Fill Settings.

To fill feature tables, perform the following steps:

  1. Click or select Table > Fill. This opens the Feature Fill Wizard.

    Screen 1: Select tables to fill.

    Select the check boxes of the tables you want to fill. For each table you can set the following options:

    • Clear Mask — select this check box to clear any table mask and fill all unlocked table cells (locked cells are never altered). Clear this check box to fill unlocked cells in the current extrapolation mask only, or all unlocked cells if there is no mask.

    • Extrapolate — select this to extrapolate across the whole table after filling cells. The extrapolation is based on the filled cells in the mask and any locked cells.

    • Table Bounds — enter values here to set bounds on the table values

    • Gradient Bounds — enter values here to set bounds on the gradient (slope) between rows (left edit box) and between columns (right edit box). For example, entering 0 Inf in the left edit box imposes the constraint that the gradient must be positive (increasing) between successive rows.

    When you have selected filling options for each table, click Next.

  2. Choose filling items and links.

    • Click the top Select to choose an item to fill the tables from. A dialog box opens where you can select a model or variable. You can only choose a variable if you have a suitable data set available containing some of the inputs to the feature.

      The feature filler adjusts the table cells so that the value of the feature across the range of inputs best matches the value of the filling item (model or data).

    • Click the Constraint Select to choose a constraint to use in the filling process. You can use Linear, 1–D table, 2–D table, ellipsoid and model constraints (see Edit Constraint). The feature filler limits its activity to within this constraint, for example, the boundary constraint of a model. While boundary models are often used as model constraints in this setting you can use any model. For example, you can use a function that returns a logical output (true for valid, false for invalid) by setting up the model constraint >=0.5.

    • Click Link to associate a model, feature or table (selected on the right side) with a variable (selected on the left side). Linking replaces the variable inputs to any relevant models and features with the linked item. This enables useful operations such as feeding a table into a model, for example, an optimal cam schedule into a torque model, without needing to make a separate function model. Click Unlink to disassociate any pair.

    Click Next.

  3. Set variable values. Select Data source: Grid or Data set. The data set option is only available if there is a suitable data set available containing some of the inputs to the feature.

    When filling from a model, you can use a Grid or Data set for the data source.

    When filling from a variable, you must fill from a Data set, so you cannot choose Grid.

    • Grid settings

      You can define your own grid, use table normalizers, or use normalizers as a starting point and choose to interleave values between breakpoints.

      By default the wizard selects the table's normalizer breakpoints and the set points of other variables, so the number of grid points is the number of table cells. To increase the grid size you can enter more points for variables by editing the Value fields, or you can interleave values between breakpoints (see below). Increasing the number of grid points increases the quality of the approximation and minimizes interpolation error, but also increases the computation time.

      • You can edit grid variable values manually, or you can click the Initialize From Normalizer button to use breakpoints of normalizers as a variable's value. In the dialog box where you can select normalizers, you can also choose to interleave values between breakpoints. Interleaving values can minimize interpolation error by adding values between each normalizer value. In this way you can create a grid of more points than table cells to optimize over. Select normalizers in the dialog box to use those breakpoints as a variable's value.

        In this dialog box, you can enter a value in the Number of values between breakpoints edit box to add values between breakpoints. By default, the feature filler compares the feature and model at the table breakpoints. Choose a positive value to compare the feature and model on a finer grid. A positive value further enhances the comparison between feature and model to account also for errors introduced by linear interpolation in the table (see How CAGE Optimizes Table Values). A value of 1 inserts one grid point between each pair of breakpoints, and so on. Click OK to return to the Feature Fill Wizard.

      • Edit set point values in the Value fields to optimize over a range rather than at a single point. If you choose a range of values the table will be filled using the average model value at each cell. For example, if you enter -5:5:50 for the variable spark, the optimization of table values will be carried out at values of spark between -5 and 50 in steps of 5 degrees.

    • Data Set settings.

      If you have multiple data sets, select the filling data set from the Data set drop down list.

      When filling from a Data Set, the wizard displays the values in your selected data set, and the set points of any other required variables. You cannot edit the variable values.

    Click Next.

  4. Fill Tables. Click Fill Tables to fill the tables.

    CAGE evaluates the model over the number of grid points specified, then calculates the total square error between this mesh model and the feature values. CAGE adjusts the table values until this error is minimized, using lsqnonlin if there are no gradient constraints, otherwise fmincon is used with linear constraints to specify the gradient of the table at each cell.

    The graph shows the change in RMSE as the optimization progresses.

    • You can enter a value in the Smoothing edit box to apply a smoothing penalty to the optimization. The Smoothness penalty uses the second derivative to avoid steep jumps between adjacent table values. There is a penalty as smoothing trades smoother tables for increased error. Enter a smoothing factor (0–Inf) and click Fill Tables to observe the difference in the resulting RMSE and the table shape. Keep increasing the value until you reach the required smoothness. If you go too far the results will be a flat plane.

    • Select the Create dataset check box to create a dataset containing the output values at each specified grid point.

    • Select the Feature model check box to create a feature model (on finishing the feature fill wizard) that is a static snapshot of the feature with its links included inside the feature model. If these links are features then the link is bundled up within the feature model of the feature being filled.

    • Select the Fill model with links check box to create a model (on finishing the feature fill wizard) that is a static snapshot of the fill model with its links connected to the model inputs (visible in the Connections diagram, in the Models view).

    • Select the remaining check boxes to display plots when you close the Wizard. You can see plots of error against all the variables (Plot), error between feature and model (Error), table surface and error surface.

    You can click Back to return to previous screens and fill more tables, or you can click Finish. When you click Finish to dismiss the wizard, the plots with selected check boxes appear.

When you have completed a calibration, you can export your feature. For information, see Importing and Exporting Calibrations.

Filling Tables by Extrapolation

Filling a table by extrapolation fills the table with values based on the values already placed in the extrapolation mask. The extrapolation mask is described below. You can also choose to extrapolate automatically after filling cells in the mask in the Filling and Optimizing Table Values.

To fill a table by extrapolating over a preselected mask, click or select Table > Extrapolate .

This extrapolation does one of the following:

Using the Extrapolation Mask

The extrapolation mask defines a set of cells that form the basis of any extrapolation.

For example, a speed-load (or relative air charge) table has values in the following ranges that you consider to be accurate:

You can define an extrapolation mask to include all the cells in these ranges. You can then fill the rest of your table based on these values.

To add or remove a cell from the extrapolation mask,

  1. Right-click the table.

  2. Select Add To Extrapolation Mask or Remove From Extrapolation Mask from the menu.

Cells included in the extrapolation mask are colored yellow.

Creating a Mask from the Boundary Model or Predicted Error

You can automatically generate an extrapolation mask based on the boundary model or prediction error. Prediction error (PE) is the standard deviation of the error between the model and the data used to create the model.

To generate a mask automatically,

  1. Select Table > Extrapolation Mask > Generate From Boundary Model or Generate From PE

  2. If you select PE, a dialog appears where you must set the PE threshold to apply, and click OK.

The cells in the table either within the boundary model or where the prediction error is within the threshold now form the extrapolation mask, and thus are colored yellow.

  


Recommended Products

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