Project 1
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 Model: Dynamic simulation of the system
- Backward Model: Quasi-Static simulation of the system.
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 . 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.
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.
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.

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.
- Map based models:
Elements are modeled using maps, which characterize the relationship between the input & output and output & losses etc. - Analytical models:
Elements are modeled using the physical equations, that represent the internal dynamics.
Objectives:
- Understand the concept of forward energy-based fuel consumption model of a conventional vehicle.
- Understand the functioning various vehicle components including engine, torque converter, transmission system, longitudinal dynamics, etc.
- Development of a Matlab script used to load all the variables required for running the Simulink model.
- Development of the Simulink model of the vehicle.
- Development of a MATLAB script to do some basic post-process calculations and generate results and plots.
- Analyzing the results.
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 1 - Conventional Vehicle Model
% By - SathiyaMoortht
% Description:
%% Initialization File
% Initialization file for loading the variables for the Conventional vehicle simulation model
%% 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
% Drive cycle values in m/s
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);
vel_end = cyc_vel(end);
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.
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.
Driver Block:

This block is basically a PI controller. A PI Controller is a feedback control loop that calculates an error signal by taking the difference between the output of a system. It multiplies the error with constant gain for P and for I, it integrates and then multiply with a smaller gain. The constant value for P and I are found by trial-and-error method. Here, the error is the difference between the desired vehicle speed (from drive cycle) and the actual vehicle speed. The error could be positive or negative. The integrator block used keeps on adding the error is then divided into two since the driver block need to produce the signal for acceleration and brake pedal. The saturation block extracts the positive and negative signal as the acceleration pedal is passed on between the values 0 and 100, while for the brake pedal, the values between -100 and 0 are extracted, which means it provides the value between 0 and 100 percentage. This negative signal for the brake pedal is multiplied by -1 to make it a positive value. The scope is provided to compare the actual and desired speed. The sample scope output for the UDDS drive cycle is provided in Figure 4. For stopping the simulation when a set of conditions are satisfied, another set of blocks are provided. The comparative block compares the actual time and end time of drive cycle, similarly the current velocity is compared with the end velocity. If both conditions are satisfied, then the simulation is forcefully stopped. This is done in order to stop the simulation when drive cycle end independent of the drive cycle chosen as different drive cycle have different end time.

fig: Scope output for comparing velocities
Controller Block:

The output of the driver block which is the acceleration and brake pedal signal is passed on to the Controller block. The controller block consists of three control units: Engine Control Unit, Transmission Control Unit and Brake Control Unit. All these data from the three Control Unit goes to the bus creator. The bus creator is used to combine all these three signals to a one signal. This combined signal is then sent to the Powertrain block.
Engine control unit:

The engine control unit has Idle Speed Controller to make sure that the engine is idling and doesn't go beyond idle speed. The signal from the Idle Speed controller is added to the throttle request from the Driver block is then converted into engine torque request based on the maximum and minimum torque curves made from 1D lookup table. A sample output from the scope for the UDDS drive cycle.

fig: Scope output for showing engine speed.
Idle speed controller:

The Idle Speed Controller is a PI Controller where the engine speed and the idle speed of the engine is compared. The error is then multiplied with constant P and the integrated error is multiplied with constant I.
Transmission Control Unit:

It uses a state logic and provided the current gear of the vehicle. The state is defined by comparing the throttle signal and vehicle speed. The ShiftLogic is the logic control block for defining the gear.
Shift Logic:

The gear_state is defined between 4 states as the vehicle has four gears in total. The UP and DOWN values are calculated using another state selection_state. When in selection_gear state, a function ComputeThreshold is calculated where the inputs are Gear and Throttle. The output will be down_th and up_th for the function which are speed limits. The outputs from the function is fed in, then the downshift and upshift is done based on vehicle speed and the parameter inputs from matlab file Trans_Shift_map.
Compute Threshold function:

The function uses lookup tables to find the transmission shifts and provides two outputs which feeds the selection_state.
Brake Control Unit:
The Brake pedal signal from the Driver block is multiplied with the maximum friction, which gives the maximum braking torque. The gain block is used convert to actual value from the percentage.
Powertrain Block:
The Powertrain block consists of five main subsystems:
Engine, Transmission, Differential, Wheels and Vehicle Dynamics. The signals from the Controller block are extracted using the bus selector, which consists of the signal for Engine torque requirement, Gear command, and Brake Torque Requirement.
Engine:

The Engine blocks takes in Engine Torque requirement as input and it is compared with the maximum and minimum torque curve and is maintained between the required range using the saturation dynamic block. The maximum and minimum torque curve are found using the lookup table according to the engine speed from the data from the matlab file "Engine_data_1_9L_Saturn_95kW". The engine torque requirement after filtration is passed to the 2D lookup table along with engine speed where the fuel consumption rate is found. The saturation block ensures that the fuel rate value is positive and integrating it gives the total engine fuel consumption. The required parameters are transferred to the workspace using To Workspace blocks.
Transmission:
The transmission takes engine torque and gear as inputs. The signals are then passed into Torque converter. The transmission torque from the torque converter is passed into the gear system where the speed and torque changes as per the gear reduction. The selected gear corresponding to a particular time is used to find the corresponding gear ratio value using the lookup table and is multiplied with torque from the torque converter. The switch is used in order to consider the efficiency of the transmission. The sample output from the scope for the UDDS drive cycle.

fig: Scope output from the transmission subsystem.
Torque converter:

A torque converter is a form of fluid coupling that transfer rotating power from a vehicle's engine to its transmission. In an automatic transmission, it replaces the mechanical clutch. The pump which is coupled with the engine is used to derive the pump speed and dividing it with the transmission speed gives the speed ratio. This speed ratio is used to find the torque ratio and capacity factor using the lookup table. The capacity factor is used for finding the pump torque from the pump speed using the equation,
Capacity Factor kf = pump speed in rpm/sqrt(pump torque in Nm)
This pump torque is used to find the turbine torque using the torque ratio. Multiple scopes are used to visualize the various parameters.

Scope output for analyzing pump speed, turbine speed and speed ratio.

this scope for analyzing pump and turbine torque.
Differential:

The Differential subsytem takes the output from the transmission system and reduce it as the gear ratio of the differential. The switch block is used to compensate for the negative and positive sign values. The required parameters are transferred between the other subsytems and the command window using the goto and To Workspace blocks.
Wheels:

The Wheels subsystem takes the axle torque and brake torque as the input. The brake torque is to reduce the axle torque to maintain the desired vehicle speed. Dividing the dynamic radius of the wheel with equivalent torque and vehicle velocity gives the tractive force and the wheel speed.
Vehicle Dynamics:

The Vehicle Dynamics block is used to find the vehicle dynamic characteristics like velocity, acceleration and distance travelled from the tractive force. The vehicle force corresponding to the actual vehicle is the difference between the tractive and the road load. The road load constitutes the drag, rolling and grading resistance. The velocity saturation is multiplied with the rolling resistance to ensure that it is avoided when the vehicle is not in motion. The saturation gives the value 0 for the zero velocity case and 1 for the vehicle with certain velocity. From the equivalent force, the actual vehicle acceleration, velocity and distance travelled can be found. The sample output from the scope for the UDDS drive cycle is shown in Figure 9. The longitudinal dynamics equation which is used for the respective block is,

where, ρaρa is the air density, AfAf is the frontal area, CdCd is the drag coefficient, VV is the vehicle speed, VwVw is the wind speed, CrCr is the rolling resistance coefficient, MM is the vehicle mass, gg is the gravity constant and θθ is the road grade.

fig: Scope output showing velocity, acceleration, and road load
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 1 - Conventional Vehicle Model
% By - Sathiyamoorthy
% Description:
% The following file is to used with the Initialization file and Simulink
% results for post-processing of the data.
% The file is incomplete, has some examples of how the data is imported
% into a readable format, data analysis and plotting examples.
% Based on the project task, use commands in a similar format as given
% below, to analyse the data and generate required plots.
% You can change variable names if desired
%% Post-Processing File
% File for post-processing the Conventional vehicle simulation model data
%% Renaming variables
Time = out.tout;
Acc_Pdl = out.Acc_Pdl; % Accelerator pedal [%]
Brk_Pdl = out.Brk_Pdl; % Brake pedal [%]
Gear_Cmd = out.Gear_Cmd; % Transmission gear
Trans_In_Spd = out.Trans_In_Spd*30/pi; % Transmission input speed [rpm]
Trans_Out_Spd = out.Trans_Out_Spd*30/pi;% Transmission output speed [rpm]
Eng_Trq = out.Eng_Trq; % Engine brake torque [Nm]
Eng_Spd = out.Eng_Spd*30/pi; % Engine speed [rpm]
Eng_Fuel_Consump = out.Eng_Fuel_Consumption; % Engine fuel consumption [g]
Veh_Dist = out.Veh_Dist/1000; % Distance traveled by vehicle [km]
Veh_Spd = out.Veh_Spd*18/5; % Vehicle speed [kmph]
%% 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
figure()
subplot(3,1,1)
hold on
grid on
plot(Time, Acc_Pdl, 'linewidth', 1, 'Color', 'black');
plot(Time, Brk_Pdl, 'linewidth', 1, 'Color', 'red');
ylabel('Pedal [%]')
xlim([0, Time(end)]);
legend('Accel','Brake');
subplot(3,1,2)
hold on
grid on
plot(Time, Trans_In_Spd, 'linewidth', 1, 'Color', 'black');
plot(Time, Trans_Out_Spd, 'linewidth', 1, 'Color', 'red');
ylabel('Speed [rpm]')
xlim([0, Time(end)]);
ylim([0, 6000]);
legend('Trans Input','Trans Output');
subplot(3,1,3)
hold on
grid on
plot(Time, Gear_Cmd, 'linewidth', 1, 'Color', 'black');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Gear');
%% 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:
- The time trace for engine, transmission input, transmission output and wheel speed on one plot.
- The engine torque, engine power, fuel rate and fuel consumption using subplots.
- The accelerator and brake pedal, gear command, vehicle desired and actual speed, vehicle distance using subplots.
- The engine operating points on the engine fuel map.
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.

So this diagram from the matlab output after we run the program and here is the acceleration pedal graph, speed of engine rpm and gear shifting

This figure shows the output vehicle dynamics that vehcle covers distance, velocity, acceleration and road load.
So here is the Engine fuel consumption map for UDDS drive cycle.

So far we have completed the cycle for UDDS now start the HWFET cycle by changing the number in matlab initial problem.
HWFET:

So this diagram from the matlab output after we run the program and here is the acceleration pedal graph, speed of engine rpm and gear shifting for HWFET drive cycle.

This figure shows the output vehicle dynamics that vehcle covers distance, velocity, acceleration and road load for HWFET drive cycle.

Figure : Engine fuel consumption map for HWFET 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. 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.
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.