Project 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Skill-Lync -> Hybrid Drives Development
% Project 1 - Conventional Vehicle Model
% By - Ullekh Gambhira
% 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]
Wheel_Spd = out.Wheel_Spd;
Fuel_rate = out.fuel_rate;
Desired_spd = out.Desired_spd;
%% 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]
kmpl1 = Veh_Dist./(Eng_Fuel_Consump./1000/rho_petrol);
%% Plotting vehicle characteristics time trace
figure(1)
subplot(4,1,1)
hold on
grid on
plot(Time, Acc_Pdl, 'linewidth', 1, 'Color', 'black');
plot(Time, Brk_Pdl, 'linewidth', 1, 'Color', 'red');
ylabel('Pedal [%]');
xlabel('Time [s]');
xlim([0, Time(end)]);
legend('Accel','Brake');
subplot(4,1,2)
plot(Time, Gear_Cmd, 'linewidth', 1, 'Color', 'blue');
xlim([0, Time(end)]);
xlabel('Time [s]');
ylabel('Gear');
subplot(4,1,3)
hold on
plot(Time, Veh_Spd, 'linewidth', 1, 'Color', 'green');
plot(Time, Desired_spd, 'linewidth', 1, 'Color', 'green');
ylabel('Speed');
xlabel('Time [s]');
xlim([0, Time(end)]);
legend('Actual','Desired')
subplot(4,1,4)
plot(Time, Veh_Dist, 'linewidth', 1, 'Color', 'black');
ylabel('Veh Dist');
xlabel('Time [s]');
xlim([0, Time(end)]);
figure(2)
hold on
grid on
plot(Time, Trans_In_Spd, 'linewidth', 1, 'Color', 'black');
plot(Time, Trans_Out_Spd, 'linewidth', 1, 'Color', 'red');
plot(Time, Wheel_Spd, 'linewidth', 1, 'Color', 'blue');
xlabel('Time[s]')
ylabel('Speed [rpm]')
xlim([0, Time(end)]);
ylim([0, 6000]);
legend('Trans Input','Trans Output','Wheel Speed');
figure(3)
subplot(4,1,1)
plot(Time,Eng_Trq,'linewidth', 1, 'Color', 'black');
xlabel('Time [s]');
ylabel('Eng Trq');
subplot(4,1,2)
plot(Time,Eng_Pwr,'linewidth', 1, 'Color', 'red');
xlabel('Time [s]');
ylabel('Eng Pwr');
subplot(4,1,3)
plot(Time,Fuel_rate,'linewidth', 1, 'Color', 'blue');
xlabel('Time [s]');
ylabel('Fuel rate');
subplot(4,1,4)
plot(Time,Eng_Fuel_Consump,'linewidth', 1, 'Color', 'green');
xlabel('Time [s]');
ylabel('Eng Fuel Consump');
%% 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)]);
%Fuel economy
disp('Fuel economy number =')
disp(kmpl)
figure()
plot(Time,kmpl1);
xlabel('Time[s]');
ylabel('Fuel economy number')
title('Fuel economy number')
Fuel economy number(HWFET) =
201.7667
Fuel economy number(UDDS) =
161.2154
conclusion : On comparison of both the cycle we can say that UDDS drive cycle is better.