Products & Services Solutions Academia Support User Community Company

Learn more about Model-Based Calibration   

Setting Up Models

Introducing the Models View

CAGE generally calibrates lookup tables by reference to models. The Models view is a storage place for all the models in your session.

To view and edit the models in your session, select Models by clicking the button shown in the Data Objects pane.

The Models view displays the following:

Following is an example of the Models display.

The icons in the Models list indicate the type of model, as listed in the Type column. As shown in the following illustration, a model can be a Model Browser statistical model, the boundary of a model, the prediction error variance (PEV) of a model, a user-defined function model, or a feature model (converted from a feature).

You can use the Model Properties dialog to switch a model output between the model value and the boundary or PEV of the model. For function models see Adding New Function Models. You can convert a feature to a model by selecting Feature > Convert to Model.

Importing Models

CAGE enables you to calibrate lookup tables by referring to models constructed in the Model Browser.

CAGE can only open Model-Based Calibration Toolbox model files. You can import models from project files (.mat, .cag) and from exported model files (.exm).

Import Models From Project

You can use the CAGE Import Tool to select models to import from any Model-Based Calibration Toolbox project file produced in CAGE or the Model Browser (.mat or .cag). You can replace suitable models in your current CAGE project (note that Model Browser models must have exactly the same input names as the CAGE model you are replacing).

See CAGE Import Tool for instructions.

Import Exported Models File

To import models from a Model Browser exported models file (.exm):

  1. Select File > Import > Model.

  2. A file browser dialog opens. Locate the desired file or files. You can select multiple files. Examples can be found in matlab/toolbox/mbc/mbctraining. You can select MBC Model (*.exm) to filter for .exm files.

    Click to select the model file, then click Open .

    This opens the Model Import Wizard.

  3. Select the models that you want to import by highlighting the models from the list, or click Select All if you want every model.

  4. Either:

    • Select the check box Automatically assign/create inputs, then you can click Finish.

    • Alternatively to match inputs up manually, instead click Next .

  5. Associate the model factors with the available inputs in your session.

    For example, to associate the model factor spark with the variable spk in your session,

    1. Highlight a Model Input, spark, in the list on the left and the corresponding variable, spark, in the list of Available Inputs on the right.

    2. Click the Assign Input button.

    3. Repeat a and b for all the model factors.

  6. Click Finish to close the wizard and return to the Models view.

      Note   You can skip steps 5 and 6 by selecting the Automatically assign/create inputs box at step 6.

You can now see a display of the model surface and the model connections (inputs).

See Also

Adding New Function Models

A function model is a model that is expressed algebraically. The function can be any MATLAB function (including user-defined functions). The only restriction is that the function must be vectorized, that is, take in column vectors and return a column vector of the same size, as in this example:

function y = foo(x1, x2) 
y = x1 .* x2;

Once you have a function like this, you can create a function model applying it to any models or variables in your session, like the following example.

foo(NOX, SPK)

For example, you might want to view the behavior of torque efficiency. So you create a function model of torque efficiency = torque/peak torque.

To add a function model to your session,

  1. Select File > New > Function Model.

    This opens the Function Model Wizard.

  2. In the dialog box, enter the formula for your function model. For example, enter torque_efficiency=torque/peak_torque.

  3. Press Enter. CAGE checks that the function is recognized; if so, you can click Next. If the function is incorrectly entered, you cannot click Next.

  4. Select the models that you want to import by highlighting the models from the list.

  5. Click Next.

  6. You can select the check box to Automatically assign/create inputs and click Finish to close the wizard and return you to the Models view, or you can click Next and go to the next screen. Here you can manually associate the model factors with the available inputs as follows:

    1. Highlight a Model Input, e.g., peak_torque, in the list on the left and the corresponding model, peak_torque, in the Available Inputs list on the right.

    2. Click the Assign input button.

    Repeat a and b for all the model factors. Click Finish to close the wizard and return you to the Models view.

You can now see a display of the model and its connections (inputs).

See Also

Renaming and Editing Models

Renaming Models

To rename a model,

  1. Highlight the model that you want to rename.

  2. Select Edit > Rename.

  3. Enter the new name for the model and press Enter.

You can also rename the model by selecting a model and clicking the name, or pressing F2.

Editing Model Inputs

You can adjust a model so that variables, formulas, or other models are the factors of the model. For example, a model of torque depends on the spark angle. In place of the spark angle variable, you can use a model of the maximum brake torque (MBT) as the spark input.

To edit the inputs of a model,

  1. Highlight the model.

  2. Select Model > Edit Inputs.

    This opens the Edit Inputs dialog box, shown.

  3. Highlight the Model Input that you want to edit, in the list on the left.

  4. Highlight the new input for that factor, in the Available Inputs list on the right.

  5. Click the Assign Input button.

  6. To close the dialog box, click Finish.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS