Finding Peak Operating Condition of an Automotive Engine

Copyright (c) 2010, The MathWorks, Inc.
All rights reserved.

Contents

Load Test Data

Variables: RPM revolutions per minute Pratio intake to exhaust manifold pressure ratio VE volumetric efficiency (0-1)

clear all, close all, clc
load VEdata

Plot Engine Data Contour Map

x0 = [2700/10000 0.3]; % scaled starting point (RPM, Pratio)
%x0 = [2700/10000 0.33];
%x0 = [2000/10000 0.3];
[ve,RPM,Pratio,VE] = VEMap([0,0],RPM,Pratio,VE); % create contour map
VEPlot(x0);

Define Objective Function

Find maximum VE (solvers assume minimization, negate VEMap to maximize)

objFun = @(x)-VEMap([x(1)*10000 x(2)],RPM,Pratio,VE);

Display Iterative Output on Plot

options = optimset('OutputFcn',@(x,o,s)VEPlot([x(1)*10000 x(2)],o,s));

Solve

[x, peakVE] = fminunc(objFun,x0,options);
Warning: Gradient must be provided for trust-region algorithm;
  using line-search algorithm instead. 

Local minimum possible.

fminunc stopped because it cannot decrease the objective function
along the current search direction.



Add labels

title(['Peak VE Value = ',num2str(-peakVE)])