├── Drive_cycles.m ├── EC_factors.m ├── Engine_Chevy_Ecotec.m ├── Engine_L13A.m ├── Engine_R16A.m ├── Engine_R18A.m ├── Fuel_properties.m ├── Glider_specs.m ├── HWFET.xlsx ├── Li_ion_config_known.m ├── Motor_Bosch.m ├── PART_I.m ├── PART_III_1.m ├── PART_III_2.m ├── PART_II_1.m ├── PART_II_2.m ├── README.md ├── Report.pdf ├── Transmission_Chevy.m ├── Transmission_Honda.m ├── UDDS.xlsx ├── US06.xlsx ├── Willans_engine_model_Chevy.m ├── Willans_engine_model_Honda.m ├── Willans_map_Chevy.m ├── Willans_map_L13A.m ├── Willans_map_R16A.m ├── Willans_map_R18A_baseline.m ├── Willans_map_motor.m ├── Willans_motor_model_Bosch.m ├── e_points_cm.txt ├── e_points_e.txt ├── e_x.txt ├── e_y.txt ├── ploss_x.txt └── ploss_y.txt /Drive_cycles.m: -------------------------------------------------------------------------------- 1 | %Drive cycles required for the Ecocar E&EC 4-cycle 2 | 3 | %First 505s of the UDDS 4 | UDDS_505=xlsread('UDDS.xlsx','B4:B508'); 5 | 6 | %HWFET 7 | HWFET=xlsread('HWFET.xlsx','B4:B769'); 8 | 9 | %US06 city 10 | US06_city_1=xlsread('US06.xlsx','B4:B135'); 11 | US06_city_2=xlsread('US06.xlsx','B501:B604'); 12 | US06_city=cat(1,US06_city_1,US06_city_2); 13 | 14 | %US06 highway 15 | US06_highway=xlsread('US06.xlsx','B136:B500'); 16 | 17 | 18 | % %plots of drive cycles 19 | % figure('Name','UDDS 505') 20 | % plot(UDDS_505) 21 | % title('UDDS-505') 22 | % xlabel('Time/sec'),ylabel('Speed/mph'); 23 | 24 | %conversion to m/s , factor 0.44704 25 | UDDS_505=UDDS_505.*0.44704; 26 | HWFET=HWFET.*0.44704; 27 | US06_city=US06_city.*0.44704; 28 | US06_highway=US06_highway.*0.44704; 29 | % 30 | % figure('Name','HWFET') 31 | % plot(HWFET) 32 | % xlabel('Time/sec'),ylabel('Speed/mph'); 33 | % title('HWFET') 34 | % 35 | % figure('Name','US06 City') 36 | % plot(US06_city) 37 | % xlabel('Time/sec'),ylabel('Speed/mph'); 38 | % title('US06-city') 39 | % 40 | % figure('Name','US06 Highway') 41 | % plot(US06_highway) 42 | % xlabel('Time/sec'),ylabel('Speed/mph'); 43 | % title('US06-highway') 44 | 45 | for c=2:length(UDDS_505) 46 | a_UDDS_505(c)=UDDS_505(c)-UDDS_505(c-1); 47 | if a_UDDS_505(c)<0 48 | a_UDDS_505(c)=0; 49 | end 50 | end 51 | 52 | for c=2:length(HWFET) 53 | a_HWFET(c)=HWFET(c)-HWFET(c-1); 54 | if a_HWFET(c)<0 55 | a_HWFET(c)=0; 56 | end 57 | end 58 | 59 | for c=2:length(US06_city) 60 | a_US06_city(c)=US06_city(c)-US06_city(c-1); 61 | if a_US06_city(c)<0 62 | a_US06_city(c)=0; 63 | end 64 | end 65 | 66 | for c=2:length(US06_highway) 67 | a_US06_highway(c)=US06_highway(c)-US06_highway(c-1); 68 | if a_US06_highway(c)<0 69 | a_US06_highway(c)=0; 70 | end 71 | end 72 | 73 | Cycle_Distance_km=[sum(UDDS_505)/1000;sum(HWFET)/1000;sum(US06_city)/1000;sum(US06_highway)/1000]; 74 | Avg_Velocity_kph=[mean(UDDS_505);mean(HWFET);mean(US06_city);mean(US06_highway)]; 75 | Max_Velocity_kph=[max(UDDS_505);max(HWFET);max(US06_city);max(US06_highway)]; 76 | Cycle_Time_s=[length(UDDS_505);length(HWFET);length(US06_city);length(US06_highway)]; 77 | Avg_acceleration=[mean(a_UDDS_505);mean(a_HWFET);mean(a_US06_city);mean(US06_highway)]; 78 | Drive_Cycle={'UDDS 505';'HWFET';'US06_city';'US06_highway'}; 79 | % t=table(Drive_Cycle,Max_Velocity_kph,Avg_Velocity_kph,Cycle_Time_s,Cycle_Distance_km) 80 | -------------------------------------------------------------------------------- /EC_factors.m: -------------------------------------------------------------------------------- 1 | PEU_WTW_factor_E10=100.9;%Wh Pe/kWh fuel consumed 2 | 3 | GHG_WTW_factor_E10=334;%g GHG/kWh 4 | 5 | PEU_WTW_factor_Electricity=33; 6 | 7 | GHG_WTW_factor_Electricity=489; 8 | 9 | -------------------------------------------------------------------------------- /Engine_Chevy_Ecotec.m: -------------------------------------------------------------------------------- 1 | %Engine specs Ecotec 2.5L DOHC I4 gasoline engine Chevy Malibu 2013 2 | %Vd=2457 cc 3 | %HP=147 kW @ 6300 rpm 4 | %T=259 Nm @4400 rpm 5 | %Redline=7000 rpm 6 | %Bore=88mm 7 | %Stroke=101mm 8 | 9 | Power=147000; 10 | rpm_max=7000; 11 | omega_max=2*pi*rpm_max/60; 12 | pma_max=33.9;%from max torque consideration at rated engine speed 13 | S=0.101; 14 | Vd=0.002457; 15 | acc_load=11000; 16 | m_engine=165;%mass of a typical 2.5L engine 17 | -------------------------------------------------------------------------------- /Engine_L13A.m: -------------------------------------------------------------------------------- 1 | %Engine specs Honda L13A 2 | %Vd=1339 cc 3 | %HP=73 kW @ 6500 rpm 4 | %T=128 Nm @4300 rpm 5 | %Redline=6800 rpm 6 | %Stroke=80 mm 7 | 8 | Power=73000; 9 | rpm_max=6800; 10 | omega_max=2*pi*rpm_max/60; 11 | pma_max=32.8;%Discussion in report 12 | S=0.08; 13 | Vd=0.001339; 14 | acc_load=800; 15 | m_engine=75.1;%Vd of L13a*(Vd of R18A/mass of R18A) -------------------------------------------------------------------------------- /Engine_R16A.m: -------------------------------------------------------------------------------- 1 | %Engine specs Honda R16A 2 | %Vd=1595 cc 3 | %HP=93 kW @ 6500 rpm 4 | %T=151 Nm @4300 rpm 5 | %Redline=6800 rpm 6 | %Bore=81mm 7 | %Stroke=77.4mm 8 | 9 | Power=93000; 10 | rpm_max=6800; 11 | omega_max=2*pi*rpm_max/60; 12 | pma_max=32.8;%Discussion in report 13 | S=0.0774; 14 | Vd=0.001595; 15 | acc_load=8000; 16 | m_engine=89.5;%Vd of R16a*(Vd of R18A/mass of R18A) -------------------------------------------------------------------------------- /Engine_R18A.m: -------------------------------------------------------------------------------- 1 | %Engine specs Honda HRV R18A 2 | %Vd=1799 cc 3 | %HP=105 kW @ 6500 rpm 4 | %T=172 Nm @4300 rpm 5 | %Redline=6700 rpm 6 | %Bore=81mm 7 | %Stroke=87.3mm 8 | 9 | Power=105000; 10 | rpm_max=6700; 11 | omega_max=2*pi*rpm_max/60; 12 | pma_max=32.8;%Discussion in report 13 | S=0.0873; 14 | Vd=0.001799; 15 | acc_load=8000; 16 | m_engine=101;%mass of a typical 1.8L engine 17 | -------------------------------------------------------------------------------- /Fuel_properties.m: -------------------------------------------------------------------------------- 1 | %fuel properties E10 2 | Hlv=41.184e6;%MJ/kg E10fuel 3 | rho_l=0.746;%kg/l #10 4 | m_fuel=10*3.78541*0.746;%10 gallons, 0.77kg/l E10 fuel 5 | 6 | -------------------------------------------------------------------------------- /Glider_specs.m: -------------------------------------------------------------------------------- 1 | %Glider vehicle specs 2 | 3 | %Vehicle equivalent test weight (incl. 2 people) in kgs 4 | m=1500; 5 | 6 | %GVWR (gross vehicle weight rating) in kgs 7 | GVWR=2000; 8 | 9 | %(Drag coefficient)*(Area), Cd*Af in m^2 10 | CdAf=0.75; 11 | 12 | %Coefficient of rolling resistance, Crr 13 | cr=0.009; 14 | 15 | %consants 16 | g=9.81; 17 | rho=1.26; 18 | 19 | r=0.348;%tyre radius of Honda HRV 215/55R17 sidewall=5.24" rim=17" =>r= 13.74" -------------------------------------------------------------------------------- /HWFET.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AntiLibrary5/PHEV-modeling-MATLAB/223a755e8a49dc18b88fe269cd5af2a92381d0b3/HWFET.xlsx -------------------------------------------------------------------------------- /Li_ion_config_known.m: -------------------------------------------------------------------------------- 1 | %The input to the script is number of series modules, no of 2 | %cells in series in a module, and no of cells in parallel 3 | %and the output will be the coefficients for the open 4 | %circuit voltage and internal resistance equation for the pack 5 | 6 | % Built with A123 AMP20 cells, a rescalable 7x15s3p module 7 | % "Modified" Rint model parameters, for class use 8 | 9 | % Battery mass 10 | module_added_mass=5.2; % Packaging per 15s3p module, in kg 11 | %# bat_mass=series_cells*parallel_cells*cell_mass+modules*module_added_mass; % Cell mass all modules, in kg 12 | %# bat_overall_mass=1.1*bat_mass; % 10% added weight for packaging 13 | 14 | battery_desc='A123'; 15 | 16 | % Li ion cell ESS Parameters 17 | module_added_mass=5.2; % Packaging per 15s3p module, in kg 18 | 19 | no_modules=7; %Enter number of Modules in series 20 | noCells_s_module=15; %Enter number of cell in series in module 21 | noCells_p=7; %Enter number of cell in parallel in module 22 | cell_V=3.3; % Cell nominal voltage in V, @ C/3 23 | cell_mass=0.496; % Cell mass, in kg 24 | cell_V_min=2.5; % Min mell OCV 25 | cell_V_max=3.6; % Max mell OCV 26 | cell_Ah=19.0; % Cell capacity 27 | 28 | module_V=noCells_s_module*cell_V; 29 | 30 | pack_V=module_V*no_modules; % Pack nominal voltage 31 | pack_Ah=cell_Ah*noCells_p; % Pack amps/hr 32 | 33 | scaling_factor=pack_V/cell_V; %for converting characteristics from cell to pack 34 | 35 | % Battery mass 36 | mass_s=noCells_s_module/15; 37 | mass_p=noCells_p/3; 38 | mass_module_packaging=module_added_mass*no_modules*mass_s*mass_p; 39 | mass_cell=no_modules*noCells_s_module*noCells_p*cell_mass; 40 | mass_pack_Li=(mass_module_packaging+mass_cell)*1.1; 41 | 42 | % Index of battery soc 43 | bat_soc_idx=[5 10 15 20 25 30 40 50 60 70 80 90 95 100]/100; 44 | % OCV for cell, in V from HPPC test 45 | cell_voc=[3.14 3.32 3.35 3.33 3.35 3.37 3.40 3.42 3.41 3.43 3.42 3.43 3.48 3.60]; 46 | % Cell charge resistance, in ohm from HPPC test 47 | cell_r_chg=[.00321 .00227 .00213 .00217 .00218 .00214 .00209 .00206 .00203 .00201 .00202 .00203 .00206 .00207]; 48 | % Cell discharge resistance, in ohm from HPPC test 49 | cell_r_dis=[.00337 .00236 .00221 .00212 .00203 .00202 .00193 .00189 .00181 .00180 .00181 .00176 .00175 .00195]; 50 | 51 | % Pack description 52 | batpk_desc=[battery_desc ' ' num2str(pack_V*pack_Ah/1000) ' kWh '... 53 | ', ' num2str(no_modules) ' x ' num2str(noCells_s_module) 's x ' ... 54 | num2str(noCells_p) 'p '... 55 | ', Nominal Voltage ' num2str(pack_V) ' V' ... 56 | ', Minimum Voltage ' num2str(cell_V_min*noCells_s_module*no_modules) ' V' ... 57 | ', Maximum Voltage ' num2str(cell_V_max*noCells_s_module*no_modules) ' V' ... 58 | ', ' num2str(mass_pack_Li) ' kgs']; 59 | 60 | disp(['Battery: ' batpk_desc]); 61 | 62 | x=0.05:0.001:1; %SOC 63 | 64 | %fitting the data points for an equation 65 | fit_v_plot=polyfit(bat_soc_idx,cell_voc,8); 66 | val_v_plot=polyval(fit_v_plot,x); 67 | 68 | fit_r_chg_plot=polyfit(bat_soc_idx,cell_r_chg,8); 69 | val_r_chg_plot=polyval(fit_r_chg_plot,x); 70 | 71 | fit_r_dis_plot=polyfit(bat_soc_idx,cell_r_dis,8); 72 | val_r_dis_plot=polyval(fit_r_dis_plot,x); 73 | 74 | val_v_pack_plot=polyval(fit_v_plot,x)*scaling_factor; 75 | val_r_chg_pack_plot=polyval(fit_r_chg_plot,x)*scaling_factor; 76 | val_r_dis_pack_plot=polyval(fit_r_dis_plot,x)*scaling_factor; 77 | 78 | % figure 79 | % plot(x,val_v_pack_plot) 80 | % xlabel('SOC'),ylabel('Voc volts') 81 | % 82 | % figure 83 | % plot(x,val_r_chg_pack_plot) 84 | % hold on 85 | % plot(x,val_r_dis_pack_plot) 86 | % xlabel('SOC'),ylabel('Rint ohms') 87 | % legend('Rint during charging','Rint during discharging') -------------------------------------------------------------------------------- /Motor_Bosch.m: -------------------------------------------------------------------------------- 1 | %Bosch IMG specs: 2 | linear_base_speed=5.9;%m/s 3 | Max_Torque=337; 4 | Max_Power=73000; 5 | G=9; 6 | eff_dr=0.98; 7 | Vr=0.005665; 8 | rm=0.135; 9 | pm_acc=1200; -------------------------------------------------------------------------------- /PART_I.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear all 3 | 4 | %loading various drive cycles involved in the E&EC 4cycle 5 | run('Drive_cycles.m'); 6 | 7 | %storing at the wheel results for UDDS-505 8 | [UDDS_505_Propulsion_energy,UDDS_505_Braking_energy,... 9 | UDDS_505_Net_energy,... 10 | UDDS_505_Avg_positive_power,UDDS_505_Peak_power,... 11 | UDDS_505_Peak_tractive_force,... 12 | UDDS_505_Idle_time]=at_the_wheels_results(UDDS_505); 13 | 14 | %storing at the wheel results for HWFET 15 | [HWFET_Propulsion_energy,HWFET_Braking_energy,... 16 | HWFET_Net_energy,... 17 | HWFET_Avg_positive_power,HWFET_Peak_power,... 18 | HWFET_Peak_tractive_force,... 19 | HWFET_Idle_time]=at_the_wheels_results(HWFET); 20 | 21 | %storing at the wheel results for US06 City 22 | [US06_city_Propulsion_energy,US06_city_Braking_energy,... 23 | US06_city_Net_energy,... 24 | US06_city_Avg_positive_power,US06_city_Peak_power,... 25 | US06_city_Peak_tractive_force,... 26 | US06_city_Idle_time]=at_the_wheels_results(US06_city); 27 | 28 | %storing at the wheel results for US06 Highway 29 | [US06_highway_Propulsion_energy,US06_highway_Braking_energy,... 30 | US06_highway_Net_energy,... 31 | US06_highway_Avg_positive_power,US06_highway_Peak_power,... 32 | US06_highway_Peak_tractive_force,... 33 | US06_highway_Idle_time]=at_the_wheels_results(US06_highway); 34 | 35 | %creating table for 'at the wheels' result 36 | At_the_wheels={'Propulsion Energy Wh/km';'Braking Energy Wh/km';... 37 | 'Net Energy Wh/km';... 38 | 'Avg. Positive Power kW';'Peak Power kW';... 39 | 'Peak Tractive Force kN';... 40 | 'Idle Time %'}; 41 | 42 | udds505=[UDDS_505_Propulsion_energy;UDDS_505_Braking_energy;... 43 | UDDS_505_Net_energy;... 44 | UDDS_505_Avg_positive_power;UDDS_505_Peak_power;... 45 | UDDS_505_Peak_tractive_force;... 46 | UDDS_505_Idle_time]; 47 | 48 | hwfet=[HWFET_Propulsion_energy;HWFET_Braking_energy;... 49 | HWFET_Net_energy;... 50 | HWFET_Avg_positive_power;HWFET_Peak_power;... 51 | HWFET_Peak_tractive_force;... 52 | HWFET_Idle_time]; 53 | 54 | us06_city=[US06_city_Propulsion_energy;US06_city_Braking_energy;... 55 | US06_city_Net_energy;... 56 | US06_city_Avg_positive_power;US06_city_Peak_power;... 57 | US06_city_Peak_tractive_force;... 58 | US06_city_Idle_time]; 59 | 60 | us06_hw=[US06_highway_Propulsion_energy;US06_highway_Braking_energy;... 61 | US06_highway_Net_energy;... 62 | US06_highway_Avg_positive_power;US06_highway_Peak_power;... 63 | US06_highway_Peak_tractive_force;... 64 | US06_highway_Idle_time]; 65 | 66 | weighted=[(0.29*UDDS_505_Propulsion_energy+0.12*HWFET_Propulsion_energy+... 67 | 0.14*US06_city_Propulsion_energy+0.45*US06_highway_Propulsion_energy);... 68 | (0.29*UDDS_505_Braking_energy+0.12*HWFET_Braking_energy+... 69 | 0.14*US06_city_Braking_energy+0.45*US06_highway_Braking_energy);... 70 | (0.29*UDDS_505_Net_energy+0.12*HWFET_Net_energy+... 71 | 0.14*US06_city_Net_energy+0.45*US06_highway_Net_energy);... 72 | (0.29*UDDS_505_Avg_positive_power+0.12*HWFET_Avg_positive_power+... 73 | 0.14*US06_city_Avg_positive_power+0.45*US06_highway_Avg_positive_power);... 74 | (0.29*UDDS_505_Peak_power+0.12*HWFET_Peak_power+... 75 | 0.14*US06_city_Peak_power+0.45*US06_highway_Peak_power);... 76 | (0.29*UDDS_505_Peak_tractive_force+0.12*HWFET_Peak_tractive_force+... 77 | 0.14*US06_city_Peak_tractive_force+0.45*US06_highway_Peak_tractive_force);... 78 | (0.29*UDDS_505_Idle_time+0.12*HWFET_Idle_time+... 79 | 0.14*US06_city_Idle_time+0.45*US06_highway_Idle_time)]; 80 | 81 | T=table(At_the_wheels,udds505,hwfet,us06_city,us06_hw,weighted) 82 | 83 | %for average power for acceleration and gradeability requirement 84 | vf=27.7778;%60mph in m/s 85 | tf=11; %required 0-60mph acceleration time 86 | grade=3.5;%in percent 87 | grade=atand(grade/100);%conversion to degrees 88 | 89 | %storing the results 90 | [Avg_power_acc,Avg_power_gradeability]=Avg_power(vf,tf,grade); 91 | 92 | %creating table for 93 | At_the_wheels_results={'Average power required to meet minimum acceleration time kW';... 94 | 'Average power required to climb 3.5% grade at 60mph at GVWR kW'}; 95 | Values=[Avg_power_acc;Avg_power_gradeability]; 96 | 97 | T2=table(At_the_wheels_results,Values) 98 | 99 | 100 | 101 | set(groot,'defaultFigureVisible','on') 102 | 103 | %local function for repeated calculations of 'at the wheels' energy 104 | %consumption 105 | function [Propulsion_energy,Braking_energy,Net_energy,... 106 | Avg_propulsion_power,Peak_power,Peak_tractive_force,... 107 | Idle_time]=at_the_wheels_results(V) 108 | %load required variables 109 | run('Glider_specs.m'); 110 | Cycle_time=length(V); 111 | Cycle_distance=sum(V)/1000; %Distance covered during the cycle in km 112 | for c=2:Cycle_time 113 | if V(c)>0 114 | if V(c)>=V(c-1) %traction 115 | Ft_p(c)=cr*m*g+0.5*rho*CdAf*V(c)^2+m*(V(c)-V(c-1));%tractive force 116 | Pt_p(c)=Ft_p(c)*V(c);%tractive power 117 | elseif V(c)=2000 110 | m=2000; 111 | end 112 | dod = []; 113 | %To store values of power output from battery throughout CY cycles 114 | powerbattery=[]; 115 | %To store E_oc values throughout CY cycles 116 | voltageoc=[]; 117 | %To store current values throughout CY cycles 118 | current=[]; 119 | 120 | dod=[]; 121 | while DD<0.8 122 | for n=2:length(v) 123 | E=polyval(fit_v_plot,(1-DOD(n-1)))*scaling_factor; 124 | if E<=(cell_V_min*noCells_s_module*no_modules) 125 | error('Pack over discharged') 126 | elseif E>=(cell_V_max*noCells_s_module*no_modules) 127 | error('Pack overcharged') 128 | end 129 | if v(n)==0 130 | T_idle(n)=1; 131 | Pmot_in(n)=0; 132 | else 133 | Fw=cr*m*g+0.5*rho*CdAf*v(n)^2+m*(v(n)-v(n-1)); 134 | Tw=Fw*r; 135 | omega_w(n)=v(n)/r; 136 | Pw(n)=Fw*v(n); 137 | omega_m(n)=G*omega_w(n); 138 | if v(n)>=v(n-1) 139 | Pm(n)=Pw(n)/eff_dr; 140 | Pm(n)=Pm(n); 141 | Tm(n)=Pm(n)/omega_m(n); 142 | pme(n)=(Tm(n))/(2*Vr); 143 | cm(n)=omega_m(n)*rm; 144 | e(n)=e00+e01*cm(n)+e02*cm(n)^2+e03*cm(n)^3+e04*cm(n)^4; 145 | ploss(n)=ploss0+ploss1*cm(n)+ploss2*cm(n)^2+ploss3*cm(n)^3+ploss4*cm(n)^4; 146 | pma(n)=(pme(n)+ploss(n))/e(n);%%pascal 147 | Pmot_in(n)=pma(n)*2*Vr*omega_m(n); 148 | elseif v(n)0 162 | Rin=polyval(fit_r_dis_plot,(1-DOD(n-1)))*scaling_factor; 163 | I(n)=(E-((E*E)-(4*Rin*Pbatt(n)))^0.5)/(2*Rin); 164 | CR(n)=CR(n-1)+(I(n)/3600); 165 | 166 | elseif Pbatt(n)==0 167 | I(n)=0; 168 | elseif Pbatt(n)<0 169 | Rin=polyval(fit_r_chg_plot,(1-DOD(n-1)))*scaling_factor; 170 | I(n)=(-E+((E*E)-(4*Rin*Pbatt(n)))^0.5)/(2*Rin); 171 | CR(n)=CR(n-1)-(I(n)/3600); 172 | 173 | end 174 | DOD(n)=(CR(n)/pack_Ah); 175 | D(n)=D(n-1)+(v(n)/1000); 176 | VOC(n)=E; 177 | if DOD(n)>=0.8 178 | break; 179 | end 180 | 181 | end 182 | dod=[dod DOD]; 183 | voltageoc=[voltageoc VOC]; 184 | current=[current I]; 185 | %updating end of cycle values 186 | DOD_EOC(CY)=DOD(n); 187 | CR_EOC(CY)=CR(n); 188 | D_EOC(CY)=D(n); 189 | Pw_EOC(CY)=trapz(Pw)/3600; 190 | %The DOD,CR and D values of next cycle should start where their previous cycle values left 191 | %off 192 | DOD(1)=DOD(n); 193 | CR(1)=CR(n); 194 | D(1)=D(n); 195 | %the while loop will exit when DD=DOD_end reaches 0.9 196 | DD=DOD_EOC(CY); 197 | %next cycle 198 | CY=CY+1; 199 | end 200 | 201 | s=length(dod); 202 | sec=1:s; 203 | 204 | Range_km=D_EOC(end); 205 | 206 | Range_miles=Range_km*0.621371; 207 | 208 | Net_tractive_energy=trapz(Pw_EOC)/Range_km; 209 | 210 | Battery_energy_used=pack_V*pack_Ah*0.75; 211 | 212 | Battery_energy_kWhpMile=(Battery_energy_used/Range_miles)/1000; 213 | 214 | Battery_energy_WhpKm=(Battery_energy_used)/Range_km;% 75% used 215 | 216 | Battery_energy_fuel_gallon_eq=Battery_energy_used/33560;%1 gallon (US) = 33.56 kWh 217 | 218 | Total_energy_consumption_WhpKm=Battery_energy_WhpKm;%Wh/km 219 | 220 | Total_energy_consumption_mpgge=Range_miles/Battery_energy_fuel_gallon_eq;%mpgge 221 | 222 | WTW_PEU=Battery_energy_kWhpMile*PEU_WTW_factor_Electricity;%Wh PE/mile 223 | 224 | WTW_GHG=Battery_energy_kWhpMile*GHG_WTW_factor_Electricity;%g GHG/mile 225 | 226 | Total_mass=m; 227 | 228 | 229 | end -------------------------------------------------------------------------------- /PART_II_1.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear all 3 | run('Glider_specs.m'); 4 | run('Transmission_Honda.m'); 5 | run('Engine_R16A.m'); 6 | run('Willans_engine_model_Honda.m'); 7 | 8 | %Accelration time 0-100kph: 9 | pm_acc=(acc_load/omega_max)*(4*pi)*(1/Vd)*(1/10^5); 10 | 11 | for c=1:length(Gear_ratio)%max velocity at a particular gear 12 | V_max(c)=omega_max*r/Gear_ratio(c); 13 | end 14 | 15 | v=zeros(1,14001); 16 | G=zeros(1,14001); 17 | cm=zeros(1,14001); 18 | e=zeros(1,14001); 19 | ploss=zeros(1,14001); 20 | pme=zeros(1,14001); 21 | Te=zeros(1,14001); 22 | 23 | 24 | m=m+m_engine+m_transmission; 25 | t=linspace(0,140,14001); 26 | gear=zeros(1,14001); 27 | dt=0.01; 28 | 29 | for n=1:14000 30 | if ((v(n)==0) || v(n)<=V_max(1)) 31 | G(n)=Gear_ratio(1); 32 | gear(n)=1; 33 | elseif ((v(n)>V_max(1)) && v(n)<=V_max(2)) 34 | G(n)=Gear_ratio(2); 35 | gear(n)=2; 36 | elseif ((v(n)>V_max(2)) && v(n)<=V_max(3)) 37 | G(n)=Gear_ratio(3); 38 | gear(n)=3; 39 | elseif ((v(n)>V_max(3)) && v(n)<=V_max(4)) 40 | G(n)=Gear_ratio(4); 41 | gear(n)=4; 42 | elseif ((v(n)>V_max(4)) && v(n)<=V_max(5)) 43 | G(n)=Gear_ratio(5); 44 | gear(n)=5; 45 | elseif ((v(n)>V_max(5)) && v(n)<=V_max(6)) 46 | G(n)=Gear_ratio(6); 47 | gear(n)=6; 48 | end 49 | cm(n)=(S*G(n)*v(n))/(pi*r); 50 | e(n)=e00+e01*cm(n)+e02*cm(n)^2; 51 | ploss(n)=ploss0+ploss1*cm(n)+ploss2*cm(n)^2; 52 | pme(n)=e(n)*pma_max-ploss(n); 53 | pme(n)=pme(n)-pm_acc;%accounting for accessory load 54 | Te(n)=(pme(n)*Vd)/(4*pi)*10^5; 55 | v(n+1)=v(n)+(dt*(((eff_dr*G(n)*Te(n))/(m*r))-(cr*g)-(0.625*(CdAf/m)*v(n)^2))); 56 | end 57 | [c,index] = min(abs(v-27.77)); 58 | acceleration_time=t(index); 59 | v=v*3.6; 60 | figure 61 | plot(t,v) 62 | xlabel('Time/s'),ylabel('Velocity/kph'); 63 | title('WOT performance of the Chevy Malibu') 64 | 65 | figure 66 | subplot(2,1,1) 67 | plot(t,(cm.*(pi/S)).*(60/(2*pi))) 68 | xlabel('Time/s'),ylabel('Engine speed/rpm'); 69 | title('Variation of Engine Speed during WOT'); 70 | subplot(2,1,2) 71 | plot(t,gear) 72 | xlabel('Time/s'),ylabel('Gear') 73 | 74 | %maximum velocity from WOT 75 | Top_speed=v(length(v)); 76 | 77 | 78 | %finding maximum vehicle speed for the given power 79 | a=0.625*CdAf; 80 | b=0; 81 | c=cr*m*g; 82 | d=-Power; 83 | %from the cruising condition of vehicle 84 | p=[a b c d]; 85 | roots=roots(p); 86 | %maximum velocity 87 | v_max=roots(3)*3.6 88 | 89 | %Gradeability 90 | v_hill=27.77; 91 | alpha=asind((Power-(0.625*CdAf*v_hill^3)-(cr*m*v_hill))/(m*g*v_hill)); 92 | Gradeability=tand(alpha)*100; 93 | 94 | Parameters={'Test mass kg';'Max Speed kph';'Acceleration 0-60 mph s';... 95 | 'Highway gradeability at 60mph at test mass %';'Powertrain sizing:';... 96 | 'Engine peak power kW';'Estimated accessory load kW';'Engine mass kg';'Transmission mass kg';... 97 | 'Transmission gearing';'1st gear';'2nd gear';'3rd gear';... 98 | '4th gear';'5th gear';'6th gear';'Reverse';'Final drive'}; 99 | Values={m;Top_speed;acceleration_time;Gradeability;' ';Power/1000;acc_load/1000;m_engine;m_transmission;.... 100 | ' ';G1;G2;G3;G4;G5;G6;reverse;Final_drive}; 101 | %printing table 102 | table(Parameters,Values) -------------------------------------------------------------------------------- /PART_II_2.m: -------------------------------------------------------------------------------- 1 | clear all 2 | close all 3 | 4 | run('Drive_cycles'); 5 | 6 | %storing various energy consumption results for UDDS 505 7 | [UDDS_505_Net_tractive_energy,UDDS_505_Fuel_energy_WhpKm,... 8 | UDDS_505_Total_energy_consumption_WhpKm,... 9 | UDDS_505_Total_energy_consumption_mpgge,... 10 | UDDS_505_WTW_PEU,UDDS_505_WTW_GHG,... 11 | UDDS_505_Range_km,Total_mass]=energy_cunsumption_results(UDDS_505); 12 | 13 | %storing various energy consumption results for HWFET 14 | [HWFET_Net_tractive_energy,HWFET_Fuel_energy_WhpKm,... 15 | HWFET_Total_energy_consumption_WhpKm,... 16 | HWFET_Total_energy_consumption_mpgge,... 17 | HWFET_WTW_PEU,HWFET_WTW_GHG,... 18 | HWFET_Range_km,Total_mass]=energy_cunsumption_results(HWFET); 19 | 20 | %storing various energy consumption results for US06 city 21 | [US06_city_Net_tractive_energy,US06_city_Fuel_energy_WhpKm,... 22 | US06_city_Total_energy_consumption_WhpKm,... 23 | US06_city_Total_energy_consumption_mpgge,... 24 | US06_city_WTW_PEU,US06_city_WTW_GHG,... 25 | US06_city_Range_km,Total_mass]=energy_cunsumption_results(US06_city); 26 | 27 | %storing various energy consumption results for US06 highway 28 | [US06_highway_Net_tractive_energy,US06_highway_Fuel_energy_WhpKm,... 29 | US06_highway_Total_energy_consumption_WhpKm,... 30 | US06_highway_Total_energy_consumption_mpgge,... 31 | US06_highway_WTW_PEU,US06_highway_WTW_GHG,... 32 | US06_highway_Range_km,Total_mass]=energy_cunsumption_results(US06_highway); 33 | 34 | %creating table 35 | 36 | energy_cnsmp={'Net tractive energy Wh/km';'Fuel energy_Wh/km';... 37 | 'Total energy consumption Wh/km';... 38 | 'Total energy consumption mpgge';... 39 | 'WTW PEU Wh PE/km';'WTW GHG emission g/km';'Range km';'Mass'}; 40 | 41 | udds505=[UDDS_505_Net_tractive_energy;UDDS_505_Fuel_energy_WhpKm;... 42 | UDDS_505_Total_energy_consumption_WhpKm;... 43 | UDDS_505_Total_energy_consumption_mpgge;... 44 | UDDS_505_WTW_PEU;UDDS_505_WTW_GHG;... 45 | UDDS_505_Range_km;Total_mass]; 46 | 47 | hwfet=[HWFET_Net_tractive_energy;HWFET_Fuel_energy_WhpKm;... 48 | HWFET_Total_energy_consumption_WhpKm;... 49 | HWFET_Total_energy_consumption_mpgge;... 50 | HWFET_WTW_PEU;HWFET_WTW_GHG;... 51 | HWFET_Range_km;Total_mass]; 52 | 53 | us06city=[US06_city_Net_tractive_energy;US06_city_Fuel_energy_WhpKm;... 54 | US06_city_Total_energy_consumption_WhpKm;... 55 | US06_city_Total_energy_consumption_mpgge;... 56 | US06_city_WTW_PEU;US06_city_WTW_GHG;... 57 | US06_city_Range_km;Total_mass]; 58 | 59 | us06highway=[US06_highway_Net_tractive_energy;US06_highway_Fuel_energy_WhpKm;... 60 | US06_highway_Total_energy_consumption_WhpKm;... 61 | US06_highway_Total_energy_consumption_mpgge;... 62 | US06_highway_WTW_PEU;US06_highway_WTW_GHG;... 63 | US06_highway_Range_km;Total_mass]; 64 | 65 | %weighted results 66 | weighted=[(0.29*UDDS_505_Net_tractive_energy+0.12*HWFET_Net_tractive_energy+... 67 | 0.14*US06_city_Net_tractive_energy+0.45*US06_highway_Net_tractive_energy);... 68 | (0.29*UDDS_505_Fuel_energy_WhpKm+0.12*HWFET_Fuel_energy_WhpKm+... 69 | 0.14*US06_city_Fuel_energy_WhpKm+0.45*US06_highway_Fuel_energy_WhpKm);... 70 | (0.29*UDDS_505_Total_energy_consumption_WhpKm+0.12*HWFET_Total_energy_consumption_WhpKm+... 71 | 0.14*US06_city_Total_energy_consumption_WhpKm+0.45*US06_highway_Total_energy_consumption_WhpKm);... 72 | (0.29*UDDS_505_Total_energy_consumption_mpgge+0.12*HWFET_Total_energy_consumption_mpgge+... 73 | 0.14*US06_city_Total_energy_consumption_mpgge+0.45*US06_highway_Total_energy_consumption_mpgge);... 74 | (0.29*UDDS_505_WTW_PEU+0.12*HWFET_WTW_PEU+... 75 | 0.14*US06_city_WTW_PEU+0.45*US06_highway_WTW_PEU);... 76 | (0.29*UDDS_505_WTW_GHG+0.12*HWFET_WTW_GHG+... 77 | 0.14*US06_city_WTW_GHG+0.45*US06_highway_WTW_GHG);... 78 | (0.29*UDDS_505_Range_km+0.12*HWFET_Range_km+... 79 | 0.14*US06_city_Range_km+0.45*US06_highway_Range_km);Total_mass]; 80 | 81 | table(Drive_Cycle,Max_Velocity_kph,Avg_Velocity_kph,Cycle_Time_s,Cycle_Distance_km) 82 | %printing table in command window 83 | table(energy_cnsmp,udds505,hwfet,us06city,us06highway,weighted) 84 | 85 | City_mpg=0.33* US06_city_Total_energy_consumption_mpgge+0.67*UDDS_505_Total_energy_consumption_mpgge 86 | Highway_mpg=0.78* US06_highway_Total_energy_consumption_mpgge+0.22* HWFET_Total_energy_consumption_mpgge 87 | Combined=0.43*City_mpg+0.57*Highway_mpg 88 | 89 | %local function for repeated calculations 90 | function [Net_tractive_energy,Fuel_energy_WhpKm,... 91 | Total_energy_consumption_WhpKm,Total_energy_consumption_mpgge,... 92 | WTW_PEU,WTW_GHG,Range_km,Total_mass]=energy_cunsumption_results(v) 93 | run('Glider_specs.m'); 94 | run('Transmission_Honda.m'); 95 | run('Engine_R16A.m'); 96 | run('Willans_engine_model_Honda'); 97 | run('Drive_cycles'); 98 | run('Fuel_properties'); 99 | run('EC_factors'); 100 | %conventional vehicle 101 | m=m+m_engine+m_fuel+m_transmission;%added mass 102 | % pm_acc=(acc_load/omega_max)*(4*pi)*(1/Vd)*(1/10^5);%accessory load 103 | CY=1; 104 | for c=1:length(Gear_ratio) 105 | V_max(c)=omega_max*r/Gear_ratio(c); 106 | end 107 | D=zeros(1,length(v)); 108 | fuel_tank=37.85;%10 gallons of E10 109 | while fuel_tank>0 110 | for n=2:length(v) 111 | if v(n)>0 112 | if v(n)>=v(n-1) 113 | Fw(n)=cr*m*g+0.5*rho*CdAf*v(n)^2+m*(v(n)-v(n-1)); 114 | Tw(n)=Fw(n)*r; 115 | Pw(n)=Fw(n)*v(n); 116 | omega_w(n)=v(n)/r; 117 | if ((v(n)==0) || v(n)<=V_max(1)) 118 | G(n)=Gear_ratio(1); 119 | elseif ((v(n)>V_max(1)) && v(n)<=V_max(2)) 120 | G(n)=Gear_ratio(2); 121 | elseif ((v(n)>V_max(2)) && v(n)<=V_max(3)) 122 | G(n)=Gear_ratio(3); 123 | elseif ((v(n)>V_max(3)) && v(n)<=V_max(4)) 124 | G(n)=Gear_ratio(4); 125 | elseif ((v(n)>V_max(4)) && v(n)<=V_max(5)) 126 | G(n)=Gear_ratio(5); 127 | elseif ((v(n)>V_max(5)) && v(n)<=V_max(6)) 128 | G(n)=Gear_ratio(6); 129 | end 130 | Pe(n)=Pw(n)/eff_dr;%with power loss consideration, can account for other power cunsumption sinks like auxiliaries 131 | Pe(n)=Pe(n)+acc_load; 132 | omega_e(n)=G(n)*omega_w(n); 133 | Te(n)=Pe(n)/omega_e(n);%Te(n)=Tw(n)/G(n); 134 | pme(n)=(4*pi*Te(n))/(Vd);%pascal 135 | pme(n)=pme(n); 136 | cm(n)=S*omega_e(n)/pi; 137 | e(n)=e00+e01*cm(n)+e02*cm(n)^2; 138 | ploss(n)=ploss0+ploss1*cm(n)+ploss2*cm(n)^2;%bar 139 | ploss(n)=ploss(n)*10^5;%pascal 140 | eff(n)=e(n)/(1+(ploss(n)/pme(n))); 141 | pma(n)=pme(n)/eff(n); 142 | %or %pma(n)=(pme(n)+ploss(n))/e(n);%pascal 143 | mf=(pma(n)*omega_e(n)*Vd)/(4*pi*Hlv); 144 | fuel_tank=fuel_tank-mf; 145 | elseif v(n)