|
|
|
| R2012a Documentation → Model-Based Calibration Toolbox | |
Learn more about Model-Based Calibration Toolbox |
|
| Contents | Index |
| On this page… |
|---|
A feature calibration is the process of calibrating lookup tables and their normalizers by comparing a collection of lookup tables to a model. The collection of lookup tables is determined by a strategy.
A feature refers to the object that contains the model and the collection of lookup tables. For example, a simple feature for calibrating the lookup tables for the maximum brake torque (MBT) consists of
A model of MBT
A strategy that adds the two following tables:
A speed (N), load (L) table
A table to account for the behavior of the air/fuel ratio (A)
Having already set up your variable items and models, you can follow the procedure below to set up your feature calibration:
Add a feature. This is described in the next section, Adding a Feature.
Assign a model. This is described in Assigning a Model.
Set up your strategy. This is described in Setting Up Your Strategy.
Set up the tables. This is described in Setting Up Tables.
This section describes steps 1, 2, and 3 in turn.
When you have completed these four steps, you are ready to calibrate the normalizers, tables, and features.
A feature consists of a model and a collection of lookup tables, organized in a strategy.
To add a feature to your session, select File -> New -> Feature. This automatically switches you to the Feature view and adds an empty feature to your session.
An incomplete feature is a feature that does not contain both
an assigned model and a strategy. If a feature is incomplete, it is
displayed as
in the tree display. If a feature is
complete, it is displayed as
in the tree display.
Having already added a feature and a model to your session, you can assign a model to your feature.
To assign a model to your feature,
Click Select Model to select the model you want to work with. A dialog box appears.
Highlight the correct model to assign to your feature and click OK. You will see the model name and inputs appear above the Select Model button.
A strategy is an algebraic collection of tables, and forms the structure of the feature.
For example, a simple strategy to calibrate a feature for MBT adds two tables:
A table ranging over the variables speed and load
A table to account for the behavior of the model as the AFR varies
To evaluate the feature side by side with the model, you need to have a strategy that takes some or all of the same variables as the model. The strategy is expressed using Simulink diagrams. You can either import a strategy or you can construct a strategy.
The following topics are described next:
To import a Simulink strategy,
Select the appropriate .mdl file. CAGE checks the strategy for more than one outport.
Select the outport that you want to use.
If there is more than one outport to your strategy, a Simulink window opens. Double-click the correct blue outport to parse (or import) the strategy to your feature.
If there is only one outport to your strategy, a dialog box opens.
Click Automatic to parse the strategy without viewing it.
Click Manual to edit the strategy. When you are finished editing double-click the blue outport circle to parse the strategy to your feature. The Simulink windows close and parse this strategy to your feature.
To view a representation of your strategy, select the Feature node. Your strategy is represented in the Strategy pane. Select View > Full Strategy Display to switch between the full description and the simplified expression. You can select and copy the strategy equation to the clipboard.
For information about using Simulink to amend strategies, see Constructing a Strategy.
Example. In the matlab\toolbox\mbc\mbctraining directory, there is a Simulink diagram called tutorial.mdl. If you import this and click Manual in the dialog box, you see the following diagram.

Double-click the Torque-Output outport to parse the strategy into the Strategy pane.
For you to perform a feature calibration, the strategy and the model must have some variables in common.
To construct a strategy using Simulink,
Select Feature > Graphical Strategy Editor or press Ctrl+E.
Three Simulink windows open:
The strategy window for editing your strategy, like the following example.

A library window, cgeqlib, with all the blocks available for building a strategy.

A library window with all the existing blocks in your session, organized in libraries.

In the strategy window, build your strategy using the blocks available in the library windows.
Double-click the blue outport circle to parse the strategy into the CAGE session.
The library, cgeqlib contains all the blocks available for building a strategy, as described in Constructing a Strategy. Tables in the current CAGE session are shown in dark green. A black table block signifies that a new table will be created in CAGE. If you copy a CAGE table block, a new table is created and the block color changes to black to signify this.
Normalizers in the current CAGE session are shown in light blue. Normalizer blocks must be inputs to tables. A black Normalizer block signifies that a new normalizer will be created in CAGE. If you copy a CAGE table block a new normalizer is created and the block color changes to black to signify this.
Some rules for feature parsing:
You can create 1D tables with or without normalizers. If you add a Function block with no normalizer, a 1D lookup table with an internal normalizer is created on parsing. If the Function block has a normalizer as its input, then you can use shared normalizers (from the list of available normalizers in CAGE). After creation you cannot change from using shared normalizers to internal normalizers. You must set normalizer size and values using the Calibration Manager, after parsing the strategy.
2D lookup tables always have shared normalizers. If the input to the Table block is not a normalizer, then a normalizer is created when the strategy is parsed.
If you change the name of inports, table or normalizer blocks for blocks associated with existing CAGE items, then the CAGE item's name is changed. The name is unique for the current CAGE project (suffixes ("_1") are added if necessary to create a unique name).
Prelookup tables must feed into an Interpolation block using a Prelookup block.
Constant values are read in from the block.
Only scalar inputs are supported with the exception of the Fcn block. The function block accepts multiple inputs as inputs to the expression (e.g., u(1)+u(2)).
If the parsing of the Simulink diagram fails, you see an error message in a dialog box, and any renamed items or changed connections in the current feature are restored. You can then correct the Simulink diagram and reparse the diagram.
For more information about using Simulink to build your strategy, see Simulink Help.
If you need to parse strategies older than Release 2008a, you can use the function cgStrategyTables to set the style for strategy parser behavior for 1D tables. Pre-R2008a, the CAGE strategy parser interpreted 1D tables as normalizers if they fed into a lookup table. In R2008a, a normalizer block was added to the cgeqlib library, and lookup table blocks are now always interpreted as lookup tables. This change creates an incompatibility for any older strategies saved as mdl files and reimported into CAGE. If you need to parse pre-R2008a strategies, use the function as follows:
cgStrategyTables('Pre-R2008a') This reverts the parser behavior to the pre-R2008a interpretation of 1D lookup tables. A warning is issued when a 1D table is converted to a normalizer. You can turn the warning off as follows:
warning off mbc:cgslparser:ObsoleteNormalizer
Reset the parser style to Release 2008a and later as follows:
cgStrategyTables('R2008a') You can query the current strategy table style by entering:Style = cgStrategyTables.
Simulink strategies can be exported. For example, you might want to
Include a strategy in a Simulink vehicle model
Compile the strategy using Simulink Coder™ software to produce C code
Evaluate the strategy using Simulink
To export a strategy from CAGE,
Highlight the Feature node that contains the strategy that you want to save.
Assign a name for your strategy.
The strategy is saved as a Simulink model (.mdl) file.
When you select a Feature node you see the Feature view, shown. The Feature view enables you to calibrate the entire feature, that is, fill all the table values by referring to a model.

The parts of the Feature view include
The strategy for the selected feature. This is the algebraic collection of the tables that you are using to calibrate the selected feature.
The Feature History pane, which displays the history of the feature.
Use the Feature menu to control your strategy and model, and initialize and fill the tables in your strategy:
Select Model
Use this to select the correct model for your feature.
Deselect Model
Use this to clear the current model from your feature.
Convert to Model
Takes the current feature and converts it to a model, which you can view by clicking the Model button.
Graphical Strategy Editor
Opens your current strategy for editing. For more information, see Setting Up Your Strategy.
Parse Strategy Diagram
Performs the same function as double-clicking the blue outport of your strategy diagram. For more information, see Setting Up Your Strategy.
Clear Strategy
Clears the current strategy from your feature.
Initialize
Initializes the feature; also in the toolbar. See Initializing Tables and Normalizers for details.
Fill
Fills and optimizes the feature; also in the toolbar. See Filling and Optimizing Table Values for details.
![]() | Performing Feature Calibrations | Initializing Tables and Normalizers | ![]() |

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 |