Table Of ContentModel-Based Calibration Toolbox™
Getting Started Guide
R2022b
How to Contact MathWorks
Latest news: www.mathworks.com
Sales and services: www.mathworks.com/sales_and_services
User community: www.mathworks.com/matlabcentral
Technical support: www.mathworks.com/support/contact_us
Phone: 508-647-7000
The MathWorks, Inc.
1 Apple Hill Drive
Natick, MA 01760-2098
Model-Based Calibration Toolbox™ Getting Started Guide
© COPYRIGHT 2005–2022 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied
only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form
without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through
the federal government of the United States. By accepting delivery of the Program or Documentation, the government
hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer
software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014.
Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain
to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is
inconsistent in any respect with federal procurement law, the government agrees to return the Program and
Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for
more information.
Revision History
November 2005 Online only New for Version 3.0 (Release 14SP3+)
September 2006 Online only Version 3.1 (Release 2006b)
March 2007 Online only Version 3.2 (Release 2007a)
September 2007 Online only Revised for Version 3.3 (Release 2007b)
March 2008 Online only Revised for Version 3.4 (Release 2008a)
October 2008 Online only Revised for Version 3.4.1(Release 2008a+)
October 2008 Online only Revised for Version 3.5 (Release 2008b)
March 2009 Online only Revised for Version 3.6 (Release 2009a)
September 2009 Online only Revised for Version 3.7 (Release 2009b)
March 2010 Online only Revised for Version 4.0 (Release 2010a)
September 2010 Online only Revised for Version 4.1 (Release 2010b)
April 2011 Online only Revised for Version 4.2 (Release 2011a)
September 2011 Online only Revised for Version 4.3 (Release 2011b)
March 2012 Online only Revised for Version 4.4 (Release 2012a)
September 2012 Online only Revised for Version 4.5 (Release 2012b)
March 2013 Online only Revised for Version 4.6 (Release 2013a)
September 2013 Online only Revised for Version 4.6.1 (Release 2013b)
March 2014 Online only Revised for Version 4.7 (Release 2014a)
October 2014 Online only Revised for Version 4.8 (Release 2014b)
March 2015 Online only Revised for Version 4.8.1 (Release 2015a)
September 2015 Online only Revised for Version 5.0 (Release 2015b)
March 2016 Online only Revised for Version 5.1 (Release 2016a)
September 2016 Online only Revised for Version 5.2 (Release 2016b)
March 2017 Online only Revised for Version 5.2.1 (Release 2017a)
September 2017 Online only Revised for Version 5.3 (Release 2017b)
March 2018 Online only Revised for Version 5.4 (Release 2018a)
September 2018 Online only Revised for Version 5.5 (Release 2018b)
March 2019 Online only Revised for Version 5.6 (Release 2019a)
September 2019 Online only Revised for Version 5.7 (Release 2019b)
March 2020 Online only Revised for Version 5.8 (Release 2020a)
September 2020 Online only Revised for Version 5.9 (Release 2020b)
March 2021 Online only Revised for Version 5.10 (Release 2021a)
September 2021 Online only Revised for Version 5.11 (Release 2021b)
March 2022 Online only Revised for Version 5.12 (Release 2022a)
September 2022 Online only Revised for Version 5.13 (Release 2022b)
Contents
Introduction
1
Model-Based Calibration Toolbox Product Description . . . . . . . . . . . . . . . 1-2
What Is Model-Based Calibration? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Designs and Modeling in the Model Browser . . . . . . . . . . . . . . . . . . . . . . . 1-3
Calibration Generation in CAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Gasoline Engine Calibration
2
Gasoline Case Study Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Gasoline Calibration Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Case Study Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Design of Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Benefits of Design of Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Power Envelope Survey Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Create Designs and Collect Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
Data Collection and Physical Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . 2-10
Empirical Engine Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Examine Response Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-11
Examine the Test Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-13
Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
Optimization Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-15
View Optimization Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16
Set Up Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-18
Filling Tables From Optimization Results . . . . . . . . . . . . . . . . . . . . . . . . 2-20
Design and Modeling Scripts
3
Introduction to the Command-Line Interface . . . . . . . . . . . . . . . . . . . . . . . 3-2
Automate Design and Modeling with Scripts . . . . . . . . . . . . . . . . . . . . . . . 3-3
Processes You Can Automate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Engine Modeling Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
v
Understanding Model Structure for Scripting . . . . . . . . . . . . . . . . . . . . . . 3-6
Projects and Test Plans for Model Scripting . . . . . . . . . . . . . . . . . . . . . . . 3-6
Response Model Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Boundary Model Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
How the Model Tree Relates to Command-Line Objects . . . . . . . . . . . . . . 3-9
Multi-Injection Diesel Calibration
4
Multi-Injection Diesel Calibration Workflow . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Multi-Injection Diesel Problem Definition . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Engine Calibration Workflow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
Air-System Survey Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Multi-Injection Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Data Collection and Physical Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Statistical Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8
Optimization Using Statistical Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Case Study Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14
Design of Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Benefits of Design of Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Air-System Survey Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Create Designs and Collect Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
Fit a Boundary Model to Air Survey Data . . . . . . . . . . . . . . . . . . . . . . . . 4-20
Use the Air Survey and Boundary Model to Create the Final Design . . . . 4-22
Multi-Injection Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
Statistical Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-25
Examine the Test Plans for Point-by-Point Models . . . . . . . . . . . . . . . . . . 4-25
Examine Response Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27
Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
Optimization Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-29
Set Up Models and Tables for Optimization . . . . . . . . . . . . . . . . . . . . . . . 4-29
Examine the Point Optimization Setup . . . . . . . . . . . . . . . . . . . . . . . . . . 4-32
Examine the Point Optimization Results . . . . . . . . . . . . . . . . . . . . . . . . . 4-35
Create Sum Optimization from Point Optimization . . . . . . . . . . . . . . . . . 4-37
Fill Lookup Tables from Optimization Results . . . . . . . . . . . . . . . . . . . . . 4-41
Examine the Multiobjective Optimization . . . . . . . . . . . . . . . . . . . . . . . . 4-47
Model Quickstart
5
Predict Engine Torque Using Two-Stage Modeling . . . . . . . . . . . . . . . . . . . 5-2
Open the App and Load Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Set Up the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Verify the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Export the Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
vi Contents
Create Multiple Models to Compare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Generate Current Controller Calibration Tables for Flux-Based Motor
Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13
Collect and Post Process Motor Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
Model Motor Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
Generate Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20
Mapped Engine Lookup Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-34
Mapped CI Lookup Tables as Functions of Fuel Mass and Engine Speed
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-35
Use Test Plan Template to Fit Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-35
Open CAGE Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-37
Use CAGE to Import and Replace Models . . . . . . . . . . . . . . . . . . . . . . . . 5-42
Review and Export Lookup Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-43
Mapped CI Lookup Tables as Functions of Engine Torque and Speed . . 5-45
Use Test Plan Template to Fit Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-45
Open CAGE Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47
Use CAGE to Import and Replace Models . . . . . . . . . . . . . . . . . . . . . . . . 5-52
Review and Export Lookup Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-53
Mapped SI Lookup Tables as Functions of Engine Torque and Speed . . 5-55
Use Test Plan Template to Fit Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-55
Open CAGE Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-57
Use CAGE to Import and Replace Models . . . . . . . . . . . . . . . . . . . . . . . . 5-62
Review and Export Lookup Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-63
Design of Experiment
6
Design of Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Why Use Design of Experiment? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Design Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Create Examples Using the Design Editor . . . . . . . . . . . . . . . . . . . . . . . . . 6-3
Set Up a Model and Create a Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Set Up Model Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Open the Design Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Create a New Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
Create a Constrained Space-Filling Design . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
Apply Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
View Design Displays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
Use the Prediction Error Variance Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
Introducing the Prediction Error Variance Viewer . . . . . . . . . . . . . . . . . . . 6-9
Add Points Optimally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10
vii
Data Editor for Modeling
7
Manipulate Data for Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
View and Edit the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
Create New Variables and Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5
Store and Import Variables, Filters, and Plot Preferences . . . . . . . . . . . . . 7-6
Define Test Groupings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-6
Match Data to Experimental Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-8
Tradeoff Calibration
8
Set Up and Perform a Tradeoff Calibration . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Set Up a Tradeoff Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2
Perform the Tradeoff Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-4
Data Sets
9
Compare Calibrations To Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Setting Up the Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
Comparing the Items in a Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-5
Reassigning Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9
Filling Lookup Tables from Data
10
Fill Lookup Tables from Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
Setting Up a Lookup Table and Experimental Data . . . . . . . . . . . . . . . . . 10-2
Fill Lookup Table from Experimental Data . . . . . . . . . . . . . . . . . . . . . . . 10-5
Select Data Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-8
Export the Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-9
Optimization and Automated Tradeoff
11
Optimization and Automated Tradeoff . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Import Models to Optimize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
viii Contents
EM-Sourced Examples
12
Create Local Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2
Create Optimal Designs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
Load and Modify Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
Create and Apply Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
Gasoline Case Study Design of Experiment . . . . . . . . . . . . . . . . . . . . . . . 12-16
Point-by-Point Modeling for a Diesel Engine . . . . . . . . . . . . . . . . . . . . . 12-21
Gasoline Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-27
ix