Project 1
# Project 1 :
Aim :
The development of a forward energy-based fuel consumption model of a conventional vehicle with the modeling process, writing scripts in Matlab, modeling in Simulink, analyzing data and generating plots.
Objectives :
- The development of a forward energy-based fuel consumption model of a conventional vehicle by using simulink modelling.
- The model developed has the capability to simulate the vehicle on different drive cycles like UDDS, HWFET, FTP, NEDC, etc.
- calculate the fuel economy numbers (kmpl) for UDDS and HWFET cycle. This forms the baseline numbers for comparing with the future hybrid version.
- Analyze and understand the vehicle operating points in terms of engine speed, torque, transmission speeds, pedal positions, gear, distance traveled, etc.
- Plot the time trace for engine, transmission input, transmission output and wheel speed on one plot.
- Plot engine torque, engine power, fuel rate and fuel consumption using subplots.
- Plot accelerator and brake pedal, gear command, vehicle desired and actual speed, vehicle distance using subplots.
- Plot the engine operating points on the engine fuel map.
- Describing the vehicle behavior throughout the drive cycle and generate the plots for both drive cycles.
Introduction :
IC Engine :
An internal combustion engine (ICE or IC engine) is a heat engine in which the combustion of a fuel occurs with an oxidizer (usually air) in a combustion chamber that is an integral part of the working fluid flow circuit.
Internal-combustion engine, any of a group of devices in which the reactants of combustion (oxidizer and fuel) and the products of combustion serve as the working fluids of the engine. Such an engine gains its energy from heat released during the combustion of the nonreacted working fluids, the oxidizer-fuel mixture.
Each system has are two basic generalized variables :
- Effort [ε] : It is generalized force variable, eg. Torque, voltage, force, heating value.
- Flow [φ] : It is generalized velocity variable, eg. Velocity, current, mass, flow rate.
- Power [P] : It is the product of the effort and flow variable. It is interchangeable between energy domain.
Every complex system can be defined by a small number of general elements. These elements are defined based on their function.
- Type 1 : Energy convertors – converts the energy from one type to another.
- Type 2 : Energy Transformers – Transform the energy within the same type.
- Type 3 : Energy Storage – stores and releases the energy, either in the same form or a different form.
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 the source to the sink viz. start simulation from the input to the engine to the wheels to determine the vehicle performance.
Backward models simulate from the source to the sink viz. input is the vehicle speed and acceleration, and the engine input is back calculated.
Forward Model :
- Forward models are a Dynamic Simulation.
- Dynamic models are used for detailed simulations.
- Force/torque/power is the input and the vehicle state variables velocity and acceleration are outputs.
- Models and simulation are more realistic due to physical causality, hence appropriate for control development.
- There is a feedback loop to meet the desired vehicle state.
- Slower simulation due to the dynamics.
- Approach mainly used to simulate a vehicle on a driving cycle, to analyse the dynamic behaviour of the system. Helps significantly in control development.


Matlab Script :
Matlab script used to load all the variables required for running the Simulink model and for post-processing. The drive cycle selection is also done here.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Skill-Lync -> Hybrid Drives Development
% Project 1 - Conventional Vehicle Model
% By - Ullekh Gambhira
% 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);
Blocks used in Modelling :
Constant block :
The Constant block generates a real or complex constant value signal. Use this block to provide a constant signal input. The block generates scalar, vector, or matrix output, depending on: The dimensionality of the Constant value parameter.
GoTo :
Goto (Simulink Reference) The Goto block passes its input to its corresponding From blocks. The input can be a real- or complex-valued signal or vector of any data type. From and Goto blocks allow you to pass a signal from one block to another without actually connecting them.
Connection Port :
A subsystem needs a Connection Port block for each physical connection line that crosses its boundary. You can manually place a Connection Port block inside a subsystem, or Simulink can automatically insert a Connection Port block when you create a subsystem within an existing network.
PS Lookup Table :
A lookup table block uses an array of data to map input values to output values, approximating a mathematical function. Given input values, Simulink performs a “lookup” operation to retrieve the corresponding output values from the table.
Scope :
Scope, Floating Scope (Simulink Reference) The Scope block displays its input with respect to simulation time. The Scope block can have multiple axes (one per port); all axes have a common time range with independent y-axes. The Scope allows you to adjust the amount of time and the range of input values displayed.
Gain :
The Gain block multiplies the input by a constant value (gain). The input and the gain can each be a scalar, vector, or matrix. You specify the value of gain in the Gain parameter. The Multiplication parameter lets you specify element-wise or matrix multiplication.
Integrator :
Integrator (Simulink Reference) The Integrator block outputs the integral of its input at the current time step. The following equation represents the output of the block y as a function of its input u and an initial condition y 0, where y and u are vector functions of the current simulation time t .
Saturation :
Saturation (Simulink Reference) The Saturation block imposes upper and lower bounds on a signal. When the input signal is within the range specified by the Lower limit and Upper limit parameters, the input signal passes through unchanged.
Dynamic Saturation :
The Saturation Dynamic block bounds the range of an input signal to upper and lower saturation values. An input signal outside of these limits saturates to one of the bounds where: The input below the lower limit is set to the lower limit. The input above the upper limit is set to the upper limit.
Rate limitor :
The Rate Limiter Dynamic block limits the rising and falling rates of the signal. The external signal up sets the upper limit on the rising rate of the signal. The external signal lo sets the lower limit on the falling rate of the signal.
Bus Creater :
The Bus Creator block combines a set of input elements into a bus. You can connect any element types to the input ports, including other buses. You can access elements in a bus by using a Bus Selector block. Elements of a bus must have unique names.
Bus Selector :
The Bus Selector block outputs the elements you select from the input bus. The block can output the selected elements separately or in a new virtual bus. The Bus Selector block does not support mixing message and signal elements as outputs.
Switch :
The Manual Switch block is a toggle switch that selects one of its two inputs to pass through to the output. To toggle between inputs, double-click the block. You control the signal flow by setting the switch before you start the simulation or by changing the switch while the simulation is executing.
Clock :
The Clock block outputs the current simulation time at each simulation step. This block is useful for other blocks that need the simulation time. When you need the current time within a discrete system, use the Digital Clock block. A Clock block outputs a real-valued signal of type double .
Forward Simulink Model For IC Engine :

Driver Block :
- The Driver block which is a basic Pl controller that generates acc and brake pedal outputs to match the desired and actual vehicle speed.
- It uses a drive cycle, a drive cycle typically represented as a series data point which plots the vehicle speed against time.
- The vehicle desired speed is provided in the relational operatorand baloon condition based upon the simulation stop will execute.
- the sturation block limits the upper and lower condition based on the limit provides.

Scope results :

Controller Block :
The controller block is the brain of the vehicle, representing the electronic controls unit. Based on the driver input , it generates desired engine torque, desired transmission gear and desired brake torque.

Scope Result :

1. Engine Control Unit :
- The engine control unit derives the engine speed to execute the engine torque requirement.
- In the engine control unit the max and min torque are mapped by using 1-D lookup table and the signals are combined with the ideal speed controller.

Output result :

2. Transmission Control Unit :
- In the transmission control unit Trottle and vehicle speed are inputtes to the gear transmission logic control system.
- Based on the vehicle speed and throttle response the gears command are controlled.

- Gear Shift Logic Chart :
- Based on the vehicle speed and throttle response the gears are selected based on the state and during conditions.
- The up and down gears are shifted based upon the conditions and the actions on the logics.
- Based on the simulink function using 2-D lookup table to map the up shifting and down shifting conditions.

3. Brake Control Unit :
- The brake control unit is controlled on the mass, gravity, wheel radius and the coefficients of friction between the tire and the road surfaces.
- The brake and the tire load are multiply for finding the brake torque.

Powertrain Block :
The powertrain block which represents the drivetrain of the vehicle. it consist 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 dynamic block.

Scope result :

1. Engine Block Model :
- The engine model is modelled using the engine speed and engine torque requirement.
- Based on the engine torque and engine speed the max and min torque are mapped using 1-D look up table and that are saturated using upper and lower limits.
- The saturated executes the engine fuel rate and the integration of the fuel flow rate gives the fuel consumption of the engine.

Output Scope :

2. Transmission Block Model :
- The engine torque and the gear transmiossion are inputted into the transmission block.
- Based upon the transmission input torque and transmission output speed the positive and negative effeciencies are determined using switch threshold conditions.
- From which the transmission output torque are derived.

Scope Plot :

- Torque Converter :
- In the torque converter the pump and turbine torque are determined by using the 1-D mapped models.
- The pump torque are derived by using the c-factor mapped 1-D model.

Scope Plot Results :



3. Differential Block Model :
- The transmission output torque is inputed into the gain of final drive ratio by which the positive and negative differential efficiencies are derived by using switch threshold conditions
- The wheel speed from thye vehicle is inputted to compute the transmission output speed.
4. Wheel Model Block :
- The net torque axle torque and brake torque are transmitted into the wheel and the wheel radius are determined to estimate the tractive force.
- The wheel speed is determined by using the velocity of the vehicle and te wheel radius.

5. Vehicle Dynamics :
The vehicle dynamics is the motion of the vehicle generated by the steering action, through which the vehicle is capable of independent motion, in a vehicle several forces act on it and the net or resultant force governs the motion according to the newtons second law.
The propulsion unit of the vehicle delivers the forces neccesary to move the vehicle forward. This force of the propulsion unit helps the vehicle to overcome the resisting forces due to gravity, air and tire resistance.

Output Results :

Matlab Script for Post Processing File :
%% 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_Rate = out.Eng_Fuel_Rate; % Engine Fuel Rate
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]
Desired_Spd = out.Desired_Spd*18/5; %Desired Speed (Kmph)
Wheel_Spd = out.Wheel_Spd*30/pi; %Wheel speed (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]
Veh_Distance = (out.Veh_Dist.Data(:,1))/1000;
Eng_Fuel_Consumption = out.Eng_Fuel_Consumption.Data(:,1);
kmpl = Veh_Distance(end)/(Eng_Fuel_Consumption(end)/1000/rho_petrol); % Fuel economy [kmpl]
%% Fuel Economy For Engine
T = table({'FUEL ECONOMY'},(kmpl));
T.Properties.VariableNames = {'ENGINE','KMPL'}
writetable(T,'UDDS.xlsx','Sheet',1);
%%Plotting
%%Plotting the drive cycle
figure(1)
plot(cyc_time,cyc_vel,'LineWidth',2,'Color','r')
grid on
xlabel('Time[sec]')
ylabel('Velocity[Mph]')
legend('Drive Cycle')
%% Plotting for the time trace for engine
figure(2)
hold on
plot(Time, Acc_Pdl, 'linewidth', 1, 'Color', 'b');
plot(Time, Brk_Pdl, 'linewidth', 1, 'Color', 'g');
plot(Wheel_Spd,'LineWidth',1,'Color','black')
grid on
xlabel('Time[sec]')
ylabel('Speed[rpm]')
legend('Transinspeed - Transoutspeed - Wheelspd')
title('Time Trace for Engine')
%% Plotting vehicle characteristics time trace
figure(3)
subplot(3,1,1)
hold on
grid on
plot(Time, Acc_Pdl, 'linewidth', 1, 'Color', 'black');
plot(Time, Brk_Pdl, 'linewidth', 1, 'Color', 'red');
xlabel('Time[sec]')
ylabel('Pedal [%]')
xlim([0, Time(end)]);
title('Acc and Brk Padel')
legend('Accel','Brake');
subplot(3,1,2)
hold on
grid on
plot(Desired_Spd, 'linewidth', 1, 'Color', 'black');
plot(Veh_Spd, 'linewidth', 1, 'Color', 'red');
xlabel('Time[sec]')
ylabel('Speed [rpm]')
title('Desired and Actual Speed')
legend('Trans Input','Trans Output');
subplot(3,1,3)
hold on
grid on
plot(Time, Gear_Cmd, 'linewidth', 1, 'Color', 'g');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Gear');
title('Gear Command')
legend('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)]);
Output Results Plots:
A drive cycle is typically represented by a series of data point which plots vehicle speed against time. Driving cycles are produced to access the performance of vehicles in various ways, including fuel consumption and pollutant emissions.


- The plot describes the time and the speed of the engine.
- In this the transmission input speed, transmission output speed and the wheel speed are plotted.
- Depending on the desired velocity of the vehicle the wheel speed is computed with the wheel radius.
- From the wheel speed the transmission output speed is computed based on the FDR in the differnt unit.
- The transmission input speed is evaluated by the transmission output speed, gear ratios and the transmission input torque.


- The plotting has been done for the maps with engine speed on x-axis and engine brake torque on y-axis, and the engine operating points are represented using contour function.
- From the plotting the engine max and min torque are identified and also the operating conditions are determined.
- The engine fuel consumption is estimated by using the fuel map, based on the engine speed and engine torque at operating conditions the fuel consumption of the vehicle is obtained.
Result :
- From the UDDS and HWFET drive cycles the fuel economy is observed as,
- In UDDS drive cycle : 14.095
- In HWFET drive cycle : 16.512
- Based on the fuel economy the HWFET drive cycle has higher economy than UDDS drive cycle, due to low braking and higher desired velocities.
Conclusion :
The development of a forward energy-based fuel consumption model of a conventional vehicle by using simulink models are created and analysed. The simulation of different drive cycles are done by using matlab. The various calculation and factors are find out and observed.
The vehicle behaviour throughout the drive cycles and plots for drive cycles are carried out and studied.