All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
Aim: To develop a forward energy-based fuel consumption model of a conventional vehicle in MATLAB and Simulink. Theory: Energy Based Models - Model StructureThere are two basic types of structure for the energy-based models: Forward Model: Dynamic simulation of the system Backward Model: Quasi-Static…
Jibin Jafar
updated on 08 Aug 2022
Aim:
To develop a forward energy-based fuel consumption model of a conventional vehicle in MATLAB and Simulink.
Theory:
Energy Based Models - Model Structure
There are two basic types of structure for the energy-based models:
Forward models simulate from source to sink, that is, from the input to the engine to the wheels, in order to assess vehicle performance.
Backward models simulate from the source to the sink, i.e. the input is the vehicle speed and acceleration, and the engine input is calculated backwards.
Forward Models
Forward models are utilized for detailed simulations, whereas dynamic models are used for forward models (refer Figure 1). The input is force/torque/power, and the outputs are the vehicle state variables velocity and acceleration. Because physical casualty makes models and simulations more realistic, they are better for control development. To achieve the desired vehicle state, there is a feedback loop. Because of the dynamics, the simulation is slower, and the approach is mostly used to model a vehicle drive cycle and study the system's dynamic behavior. Significantly aids in the management of development.
Figure 1: Forward Model
Backward Models
Backward models are calculated in a quasi-static manner. The inputs include vehicle conditions like velocity and acceleration, whereas the output is the force, torque, and power required at the source, i.e. the engine. They are simple and quick to use, making them ideal for quick computations and comparisons. They lack dynamics, and the method is mostly used to calculate simple fuel consumption and optimize energy management (refer Figure 2).
Figure 2: Backward Model
Conventional Vehicle
Conventional vehicles use an internal combustion engine fueled by gasoline or diesel, to power the wheels. The heat engine works on the premise of releasing heat by combusting fuel with an oxidizer in a combustion chamber to produce expanding gases that push against a piston, producing force and torque. The chemical energy of fuel is transformed into heat energy in internal combustion (IC) engines to produce meaningful mechanical work. Four stroke reciprocating engines are the most prevalent type of engine. Internal combustion engines and conventional vehicles use ideal thermodynamic cycles like the Otto Cycle, Diesel Cycle, Over expanded cycle, and so on.
Energy Demand for Drive Cycle
Energy demand at the wheel, due to a drive cycle can be computed. The force at the wheels are given by,
Ftractive=MdVdt+12ρaAfCd(V±Vw)2+CrMgcos(α)+Mgsin(α)
where, M is the vehicle mass [kg], V is the vehicle velocity [m/s], ρa is the air density [kg/m3], Af is the frontal area of the vehicle [m2], Cd is the drag coefficient, Vw is the wind velocity [m/s], Cr is the rolling coefficient, g is the acceleration due to gravity [m/s2], and α is the road inclination.
The power at the wheels is given by,
Ptractive=Ftractive⋅V
Ptractive=MVdVdt+12ρaAfCdV(V±Vw)2+CrVMgcos(α)+VMgsin(α)
Assuming no grade (α= 0) and no headwind (Vw= 0),
Ptractive=Pw=MVdVdt+12ρaAfCdV3+CrMgV
Energy demand for the drive cycle is computed by integrating power over time for the entire cycle,
Ew=∫Pwdt=∫MVdVdtdt+∫12ρaAfCdV3dt+∫CrMgVdt
Assuming mass, air density, drag coefficient, frontal area, rolling resistance coefficient and acceleration due to gravity are constant for the drive cycle,
Ew=M∫VdVdtdt+12ρaAfCd∫V3dt+CrMg∫Vdt
Ew=ki∫VdVdtdt+ka∫V3dt+kr∫Vdt
where, ki is the coefficient of inertial resistance, ka is the coefficient of aerodynamic drag, and kr is the coefficient of rolling resistance, and they are given by,
ki=M
ka=12ρaAfCd
kr=CrMg
The energy component [ki∫VdVdtdt] is the kinetic energy of the vehicle and is always 0 over the entire drive cycle. For a conservative system (i.e. no dissipative forces), the aerodynamic drag and rolling resistance component of the energy will also be 0. Also, when Pw<0, the energy is absorbed by the brakes. This can potentially be recaptured through regenerative braking.
To calculate energy, the integrals can be discretized. Generally, time step of 1 sec is sufficient for the drive cycles.
Ew=ki∑iV(i)dV(i)dtΔt+ka∑iV3(i)Δt+kr∑iV(i)Δt
Powertrain Sizing
Based on the individual power requirement for the drive cycle, effect of aerodynamic drag, rolling resistance and inertial component can be analyzed. High power is required to sustain high vehicle speeds, due to the increasing drag component. From the overall power plot, the maximum positive power is the power that needs to be provided at the wheels by the powertrain to complete the cycle. This sets the minimum powertrain sizing requirement. Additionally, if all the potential braking energy is to be captured, then the regenerative unit must be at least be designed to handle maximum negative power for the cycle.
Drive Cycle Development
Although the regulatory drive cycles are important as they form part of the certification processes and are well developed, they only form a part of the vehicle development process as they do not represent all the driving conditions that the manufacturer wants to develop for. The manufacturer might have tests representing different driving scenarios and also might have more aggressive tests depending on the application. Therefore, for an optimized design and to minimize the development time, it is important to be able to develop drive cycles, which can be either used in simulations or vehicle testing. Cycles that depend on certain vehicle capability can be relatively developed. For example, to test the vehicle towing capacity upto a grade, need to specify towing load, speed, grade and time of operation. Multiple cycles can be added to test the capability of the powertrain. For developing a drive cycle from a real world driving trip, the data is divided into kinematic sequences. The sequences are classified into distinct clusters. Probability of the occurrence of each type of sequence during a certain type of driving trip is calculated. Drive cycles are constructed by randomly selecting sequence based on their probabilities and a cycle is built based on the selection of cycle type, minimum cycle duration, distance, number of stops, average and top speeds, etc.
Energy Based Models - Element Models
To model the internal physical properties of the element and the losses, there are two kinds of approaches: Map based models and Analytical models.
Objectives:
MATLAB Initializing Code:
A MATLAB script “Project1_InitFile.m” is to load the variable to the workspace that is to be used for the further calculation/processing for the Simulink model. A typical midsize car with a 1.9L engine and a 4-speed automatic transmission is considered. Data is taken from ADVISOR data base developed by NREL, USA. Transmission shift map and controller is taken from Matlab/Simulink example database.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Skill-Lync -> Hybrid Drives Development
% Project - Conventional Vehicle Model
% By: Jibin Jafar
%% Description:
% Initialization File
% Initialization file for loading the variables for the Conventional vehicle simulation model
clear all;
close all;
clc;
%% Vehicle Parameters
M = 1500; % Vehicle weight [kg]
Cr = 0.015; % Rolling resistance coefficient
Rw = 0.35; % Rolling radius [m]
Cd = 0.33; % Drag coefficient
Af = 2; % Frontal area [m2]
rhoa = 1.225; % Air density [kg/m3]
Vwind = 0; % Wind velocity [kmph]
g = 9.81; % Gravitational acceleration [m/s2]
theta = 0; % Slope [deg]
myu_road_tire = 1; % Coefficient of friction between tire - road interface
%% Powertrain Parameters
FDR = 3.73; % Final Drive Ratio / Diff Ratio
DiffEff = 0.99; % Differential efficiency (assumed independent of operating conditions)
NumGear = 4; % Number of gears in transmission
TransGear = [1:NumGear]; % Transmission Gears
TransRatio = [3.06, 1.62, 1, 0.7]; % Corresponding Transmission ratios
TransEff = 0.90; % Transmission efficiency (assumed independent of operating conditions)
TC_SR = [0, .5, .6, .7, .8, .87, .92, .94, .96, .97, 1]; % Torque Converter Speed Ratio (Matlab default) -> TurbSpd/PumpSpd
TC_TR = [2.232, 1.5462, 1.4058, 1.2746, 1.1528, 1.0732, 1.0192, 1, 1, 1, 1]; % Torque Converter Torque Ratio (Matlab default) -> TurbTrq/PumpTrq
TC_Cf = 1e-4 * [.72558, .66322, .63463, .59042, .51331, .4144, .29287, .22444, .12186, .04386, 0]; % Torque Converter Capacity Factor (Matlab default) -> PumpTrq/PumpSpd^2 [Nm/rpm^2]
load Vehicle_Data/Engine_data_1_9L_Saturn_95kW
load Vehicle_Data/Trans_Shift_map
%% Driver Parameters
Kp = 10; % P gain for driver PI model
Ki = 1; % I gain for driver PI model
%Drive_Cycle_Select = 1; % Drive cycle selection
%% Inputting the desired DriveCycle
Drive_Cycle_Select = input(sprintf('Select a Drive Cycle: n 1. UDDS n 2. HWFET n 3. FTP n 4. US06 n 5. NEDC n 6. WLTP n Your selection is: '));
% Drive cycle values in m/s
% Loading Drive Cycle values. Variables: cyc_time, cyc_vel
if Drive_Cycle_Select == 1
load DriveCycles/UDDS;
elseif Drive_Cycle_Select == 2
load DriveCycles/HWFET;
elseif Drive_Cycle_Select == 3
load DriveCycles/FTP;
elseif Drive_Cycle_Select == 4
load DriveCycles/US06;
elseif Drive_Cycle_Select == 5
load DriveCycles/NEDC;
elseif Drive_Cycle_Select == 6
load DriveCycles/WLTP;
end
time_end = cyc_time(end); %End time from drive cycle
vel_end = cyc_vel(end); %End Velocity from drive cycle
%% Running Simulink Model
sim('Project1_VehicleModel'); % Run Simulink model
%% Running Post Processing Script
Project1_ProcessingFile; % Run Post processing Matlab script
Each step of the code is explained with comments.
The code assigns various vehicle, powertrain and driver parameters. The MATLAB file "Engine_data_1_9L_Saturn_95kW" loads the engine parameters including Engine efficiency map, Engine fuel map, Engine Inertia, Engine map speed, Engine map torque and Engine torque and maximum torque values. The MATLAB file "Trans_Shift_map" provides the necessary data required for the control logic of Transmission control unit. This code is designed such a way that it asks for the drive cycle that need to be used for the study and the user input decides the desired drive cycle for the study. The screenshot of the command window asking for the drive cycle of study is shown in Figure 3. For the chosen drive cycle, the Simulink vehicle model will be run automatically, and after that, MATLAB post processing script will be run automatically for providing the necessary plots for the study.
Figure 3: User interface for selecting drive cycle.
Simulink Vehicle Model:
The Simulink model consist of three main subsystems: Driver, Controller and Powertrain, as shown in Figure 4. The Driver subsytem generates the accelerator and brake pedal outputs to match the desired and actual vehicle speed. The Controller block represents the electronic control units, which generates the desired engine torque, desired transmission gear and desired brake torque based on the driver inputs. The Powertrain subsytem represents the actual vehicle consisting of all vehicle components which inputs the control signals from Controller and provides actual vehicle motion characteristics.
In brief, the Simulink model is modeled using a ‘Driver’ block, which is a basic PI controller that generates accelerator and brake pedal outputs to match the desired and actual vehicle speeds. The ‘Controller’ block is the brains of the vehicle, representing the electronic controls units. Based on the driver inputs, it generates desired engine torque, desired transmission gear and desired brake torque. These inputs are fed to the ‘Powertrain’ block which represents the drivetrain of the vehicle. It consists of an ‘Engine’ connected to the ‘Automatic Transmission’ through a ‘Torque Converter’. The output of the transmission is connected to the ’Differential’, which powers the ‘Wheels’, that provides the tractive force for vehicle acceleration. The longitudinal dynamics of the vehicle along with the road load is represented in the ‘Vehicle Dynamics’ block. The solver selected is ode3 with a fixed step size of 0.01 sec.
MATLAB Post Processing Code:
The MATLAB script "Project1_ProcessingFile" is used to analyze the data from the Simulink model and to generate plots. After the Simulink vehicle model is run, some of the data are sent to the workspace which is used to plot different parameters for the study of conventional vehicle in MATLAB.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Skill-Lync -> Hybrid Drives Development
% Project - Conventional Vehicle Model
% By: Jibin Jafar
% Description:
% The following file is to used with the Initialization file and Simulink
% results for post-processing of the data.
%% Post-Processing File
% File for post-processing the Conventional vehicle simulation model data
close all;
%% Renaming variables
Time = ans.tout;
Acc_Pdl = ans.Acc_Pdl; % Accelerator pedal [%]
Brk_Pdl = ans.Brk_Pdl; % Brake pedal [%]
Gear_Cmd = ans.Gear_Cmd; % Transmission gear
Trans_In_Spd = ans.Trans_In_Spd*30/pi; % Transmission input speed [rpm]
Trans_Out_Spd = ans.Trans_Out_Spd*30/pi;% Transmission output speed [rpm]
Eng_Trq = ans.Eng_Trq; % Engine brake torque [Nm]
Eng_Spd = ans.Eng_Spd*30/pi; % Engine speed [rpm]
Eng_Fuel_Consump = ans.Eng_Fuel_Consumption; % Engine fuel consumption [g]
Enf_Fuel_Rate = ans.Eng_Fuel_Rate; % Engine Fuel COnsumption rate [g/s]
Veh_Dist = ans.Veh_Dist/1000; % Distance traveled by vehicle [km]
Veh_Spd = ans.Veh_Spd*18/5; % Vehicle speed [kmph]
WheelSpd = ans.WheelSpd;
%Wheel_Spd = (ans.Veh_Spd.*60)./(2.*pi.*Rw); % Wheel rpm
%% Data Analysis
Eng_Pwr = Eng_Spd.*pi./30.*Eng_Trq./1000; % Engine brake power [kW]
rho_petrol = 0.7197; % Density of petrol [kg/L]
kmpl = Veh_Dist(end)/(Eng_Fuel_Consump(end)/1000/rho_petrol); % Fuel economy [kmpl]
%% Plotting vehicle characteristics time trace
% Plot: Transmission Input and Output, Wheel Speed
figure(1)
plot(Time, Trans_In_Spd, 'linewidth', 1, 'Color', 'black');
hold on;
plot(Time, Trans_Out_Spd, 'linewidth', 1, 'Color', 'red');
hold on;
plot(Time, WheelSpd, 'linewidth', 1, 'Color', 'blue');
ylabel('Speed [rpm]');
xlabel('Time [s]');
xlim([0, Time(end)]);
ylim([0, 6000]);
legend('Trans Input','Trans Output','Wheel Speed');
grid on;
grid minor;
% Plot: Engine Torque, Engine Power, Fuel Rate & Fuel Consumption
figure (2)
subplot(4,1,1)
plot(Time, Eng_Trq, 'linewidth', 1, 'Color', 'black');
xlabel('Time [s]');
ylabel('Engine Torque [Nm]');
title('Engine Torque');
grid on;
grid minor;
xlim([0, Time(end)]);
subplot(4,1,2)
plot(Time, Eng_Pwr, 'linewidth', 1, 'Color', 'blue');
xlabel('Time [s]');
ylabel('Engine Power [Nm]');
title('Engine Power');
grid on;
grid minor;
xlim([0, Time(end)]);
subplot(4,1,3)
plot(Time, Enf_Fuel_Rate, 'linewidth', 1, 'Color', 'red');
xlabel('Time [s]');
ylabel('Fuel Rate [g/s]');
title('Engine Fuel Rate');
grid on;
grid minor;
xlim([0, Time(end)]);
subplot(4,1,4)
plot(Time, Eng_Fuel_Consump, 'linewidth', 1, 'Color', 'red');
xlabel('Time [s]');
ylabel('Fuel Consumption [g]');
title('Engine Fuel Consumption');
grid on;
grid minor;
xlim([0, Time(end)]);
% Plot: Accelerator & Brake Pedal, Gear, Vehicle actual & desired speed,
% Vehicle DIstance
figure (3)
subplot(4,1,1)
plot(Time, Acc_Pdl, 'linewidth', 1, 'Color', 'black');
hold on;
plot(Time, Brk_Pdl, 'linewidth', 1, 'Color', 'red');
ylabel('Pedal [%]')
xlim([0, Time(end)]);
legend('Accel','Brake');
grid on;
grid minor;
subplot(4,1,2)
hold on;
grid on;
grid minor;
plot(Time, Gear_Cmd, 'linewidth', 1, 'Color', 'black');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Gear');
subplot(4,1,3)
hold on;
grid on;
grid minor;
plot(cyc_time, (cyc_vel.*(18./5)),'linewidth', 1,'Color', 'black');
plot(Time, Veh_Spd,':', 'linewidth', 1, 'Color', 'red');
legend('Desired','Actual');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Velocity [km/h]');
subplot(4,1,4)
plot(Time, Veh_Dist, 'linewidth', 1, 'Color', 'black');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Distance [km]');
grid on;
grid minor;
%% Plotting engine operating points on engine fuel map
figure('Name','Engine Operating Points');
hold on
grid on
title('Engine Operating Points','fontsize',12);
p1=plot(Eng_map_spd*30/pi,Eng_max_trq,'linewidth',2,'color','r');
p2=line([Eng_map_spd(end)*30/pi Eng_map_spd(end)*30/pi],[0 Eng_max_trq(end)]);
set(p2,'linewidth',1,'linestyle','--','color','k');
p3=line([Eng_map_spd(1)*30/pi Eng_map_spd(1)*30/pi],[0 Eng_max_trq(1)]);
set(p3,'linewidth',1,'linestyle','--','color','k');
[c,h] = contour(Eng_map_spd'*30/pi,Eng_map_trq,Eng_fuel_map');
clabel(c,h);
xlabel('Engine Speed [rpm]');
ylabel('Engine Torque [Nm]');
title('Engine Fuel Consumption Map [g/s]');
p4 = plot(Eng_Spd,Eng_Trq,'.','color','k');
legend([p1 p4],{'Max Curve','Operating Points'});
axis([Eng_map_spd(1)*30/pi Eng_map_spd(end)*30/pi 0 Eng_map_trq(end)]);
For the study of the developed vehicle model with various drive cycle, the code to plot the following relations are made:
Comparative Study of the Developed Model for UDDS and HWFET Drive Cycle:
UDDS | HWFET | |
Fuel Economy Numbers (kmpl) | 14.2054 | 16.5012 |
The fuel economy is seemed to be significantly more for HWFET drive cycle than the UDDS for the same vehicle characteristics. This variation is purely based on drive cycle which is easily observable from Figure 10 and 11. The third subplot in Figure 10 and 11 gives the information on variation of velocity with respect to time. The UDDS drive cycle seems to have more prominent varying velocity over time than HWFET. Therefore, more brake pedal has to be used for UDDS than HWFET which can be observed from the first subplot. The more the brake pedal is pressed, the more will be the energy loss, which in turn means that less will be the fuel economy number.
Figure 10: Vehicle Characteristics according to UDDS drive cycle.
Figure 11: Vehicle Characteristics according to HWFET drive cycle.
The second subplot in Figure 10 and 11 gives the information on the gear over the entire drive cycle. For the UDDS cycle, more vigorous gear shifting is observed, while for the HWFET, the gear transmission is comparatively smoother. From the fourth subplot, even though the drive cycle duration is significantly less for HWFET than UDDS, the vehicle as per the HWFET seems to have covered way more distance than the other. This is again due to the smoother velocity curve for HWFET. Also, from the subplots three of Figure 10 and 11, it can be seen that the developed model was able to achieve the desired velocity, even though there are minor variations, which is obvious.
Figure 12: Engine Characteristics according to UDDS drive cycle.
The drive cycle velocity for HWFET is more in the higher range than the UDDS. The power requirement is directly proportional to the power of three for the aerodynamic drag and directly proportional to the rolling and grading resistance. Since, the proportion of higher velocity is more predominant in HWFET, the vehicle requires more power to run HWFET than UDDS, which means that, the fuel consumption of UDDS is less than HWFET even though the drive cycle time is more for UDDS. This can be seen in Figure 12 and 13 in subplot four. The engine torque, engine power and engine fuel rate is seemed to be directly proportional to each other from the Figures.
Figure 13: Engine Characteristics according to HWFET drive cycle.
The engine operating points on the engine fuel map is shown in Figure 14 and 15 for UDDS and HWFET drive cycles.
Figure 14: Engine fuel consumption map for UDDS cycle.
Figure 15: Engine fuel consumption map for HWFET cycle.
From the Figures 14 and 15, the operating points are seemed to be extreme for UDDS drive cycle. These figures reveal that, the engine is capable of going in higher velocity than required in both drive cycle as the max engine speed possible is 6000 rpm. For the cases, the operating parameters are within the engine torque curve, and for HWFET, there is not operating points that is challenging the engine capability.
Downloadable Link:
The developed MATLAB programs and Simulink model can be downloaded from:
https://drive.google.com/drive/folders/1azba7DXioKPv98-Pkc24BHTB5K7iO_BF?usp=sharing
Conclusion:
The MATLAB script for both initializing and post processing has be successfully made, and a forward energy-based fuel consumption Simulink model of a conventional vehicle is also developed successfully, and the functionality is checked. The comparative study of UDDS and HWFET for the developed vehicle model is analyzed.
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
MATLAB Project: Genetic Algorithm
Aim: To write a code in MATLAB to optimise the stalagmite function and find the global maxima of the function. Theory: A genetic algorithm (GA) is a method for solving both constrained and unconstrained optimization problems based on a natural selection process that mimics biological evolution [1].…
06 Feb 2024 09:06 AM IST
MATLAB Project: Solving second order ODEs [Simple Pendulum]
Aim:To write a MATLAB program to solve the second order differential equation and to simulate the pendulum motion. Theory:A differential equation is an equation with a function and one or more of its derivatives [1].y+dydx=5x: It is a differential equation with the function y and its derivative dydx.…
06 Feb 2024 09:02 AM IST
MATLAB Project: Air Standard Cycle
Aim: To create a MATLAB Program to solve an OTTO Cycle and make its plots. Also to calculate the thermal efficiency of the Engine. Theory: The Otto Cycle is an idealized thermodynamic cycle consisting of a set of processes used by Spark Ignition (SI) internal combustion engines. It describes how heat engines turn…
06 Feb 2024 08:57 AM IST
MATLAB Project: Curve Fitting
Aim: To write MATLAB code to fit a linear and cubic polynomial for the Cp data, and plot the linear and cubic fit curves along the raw data points. Theory: Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points, possibly subject to constraints…
06 Feb 2024 08:47 AM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.