Products & Services Solutions Academia Support User Community Company

Learn more about Model-Based Calibration   

Setting Up Variable Items

Introducing the Variable Dictionary View

The Variable Dictionary is a store for all the variables, constants, and formulae in your session.

To view or edit the items in the Variable Dictionary, click the button, shown, in the Data Objects pane.

Selecting the Variable Dictionary view displays the variables, constants, and formulae in the current project.

Note that if you have existing CAGE projects you can use the CAGE Import Tool to import variable items and other CAGE items directly from other projects.

Following is an example of the Variable Dictionary view.

The upper pane shows a list of all the current variables, constants, and formulas. The lower pane displays edit boxes so you can specify the settings of the selected variable, constant, or formula.

Different Variable Dictionary Items

Importing and Exporting a Variable Dictionary

A variable dictionary contains all the variable items for your calibrations. You can set up your variable dictionary once, and use it in many calibrations.

If you import a model, it has variables associated with it, in which case you might not have to import a variable dictionary.

Importing a Variable Dictionary

To import a dictionary of variables from an .xml file,

  1. Select File > Import > Variable Dictionary.

  2. Select the correct dictionary file.

Note you can also import variable items directly from other CAGE projects using the CAGE Import Tool.

Exporting a Variable Dictionary

After setting up a variable dictionary, you can save the dictionary for use in many different calibrations.

To export a dictionary of variables to an .xml file,

  1. Select File > Export > Variable Dictionary.

  2. Select a suitable name for the dictionary file.

See Also

Adding and Editing Variable Items

To add variable items you can use the Variable Dictionary toolbar, shown, or you can select items from the File -> New -> Variable Items menu.

Adding a Variable

To add a variable,

  1. Select File > New > Variable Item > Variable.

    A new variable is added to the variable dictionary.

  2. Select Edit > Rename to alter the name of the variable.

  3. Specify the Minimum and Maximum values of the variable in the edit boxes in the lower pane.

  4. Specify the value of the Set Point in the edit box.

Using Set Points in the Variable Dictionary.   The set point of a variable is a point that is of particular interest in the range of the variable. You can edit set points in the variable dictionary or the models view.

For example, for the air/fuel ratio variable, AFR, the range of values is typically 11 to 17. However, whenever only one value of AFR is required, it is preferable to choose 14.3, the stoichiometric constant, over any other value. So enter 14.3 as the Set Point.

CAGE uses the set point as the default value of the variable wherever one value from the variable range is required. For instance, CAGE uses the set point when evaluating a model over the range of a different variable.

For example, a simple model for torque depends on AFR, engine speed, and relative air charge. CAGE uses the set point of AFR when it calculates the values of the model over the ranges of the engine speed and relative air charge.

Adding a Constant

To add a constant,

  1. Select File > New > Variable Item > Constant.

    A new constant is added to the variable dictionary.

  2. Select Edit > Rename to alter the name of the constant.

  3. Specify the value of the constant in the Set Point edit box, in the lower pane.

Adding Formulas

You might want to add a formula to your session. For example, the formula

where afr is the air/fuel ratio and stoich is the stoichiometric constant.

To add a formula,

  1. Select File > New > Variable Item > Formula.

    The Add Formula dialog box appears.

  2. In the dialog, enter the right side of the formula, as in this example afr/stoich. Note it is normal to create inputs to a formula first. If you do not use pre-existing variable names then those inputs are created, so be careful to get input names exactly correct. Follow these requirements for a valid formula string:

    • A formula can only have exactly one variable input

    • No formulae as inputs

    • Not circular (i.e. self referencing)

    • Must not error when evaluated

    • Must produce a vector for a vector input

    • Must be invertible

    Click OK and a new formula is added to the variable dictionary.

  3. Select Edit -> Rename to alter the name of the formula.

See Also

Using the Variable Menu

The Variable menu in the variable dictionary enables you to alter variable items. These choices are also available in the right-click context menu on the list view.

Change item to:

See Also

Using Aliases

The variable dictionary enables you to use the same set of variables, constants, and formulas with many different models and calibrations.

Why Use Aliases?

It is possible that in one model or strategy the engine speed has been defined as N, and in another it has been defined as rpm. The alias function enables you to automatically link inputs with various names to a single CAGE variable when you import models and strategies.

Creating an Alias

For example, in a variable dictionary there are two variables:

To set rpm to be an alias of N,

  1. Highlight the variable rpm.

  2. Select Variable > Change item to > Alias.

  3. In the dialog, choose N from the list.

This eliminates the variable rpm from your variable dictionary, and every model and calibration that refers to rpm now refers to N instead.

You can also add aliases to existing items by entering a list of names in the Alias edit box.

See Also

  


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