Project

Otto Cycle Simulation

*********** Comments by Grader ************

GOOD JOB !!!!

But please attach the code using insert code option.

The other thing that you can do is to attach the code and images in

projects.skill-lync.com and paste the link over here.

Code is correct but you have not followed the format as mentioned above.

Marks here are deducted for the above mentioned reasons.

Thank you.

Graded by : Mehul Shah




%Creating a function :-%which can provide us how combustion chamber volume changes with change in crank anglefunction [volume] = chamber_volume_calci(bore,stroke,connecting_rod,CR,intial_angle,final_angle)%defining values that theta can havetheta = linspace(intial_angle,final_angle,100); % expression for crank pin radius,R,,swept_volume,clearance_volumecrankpin_radius = stroke/2R = connecting_rod/crankpin_radiusswept_volume = (pi/4)*bore^2*strokeclearance_volume = swept_volume/(CR - 1)%expression that determine  volume trace from  crank angle,parameters%since expression is long so breaking it into partspart_1 = 0.5*(CR-1);part_2 = R + 1 - cosd(theta);part_3 = (R^2 - sind(theta).^2).^0.5;volume = (1 + part_1*(part_2 - part_3)).*clearance_volume;endfunction%Creating PV plot for OTTO CYLCE%Defining Inputs%State variable at 1st state, (process 1->2 is Isentropic Compression)%given P1 = 101325;T1 = 300;gamma = 1.4;% Volume at 1st state is defined by the engine geometric parameters i.e bore,stroke,connecting rod,CR%givenbore = 0.1stroke = 0.1connecting_rod = 0.15CR = 12%With the of help of engine geometric parameters we will calculate swept volume and clearance volumeswept_volume = (pi/4)*bore^2*strokeclearance_volume = swept_volume/(CR - 1)%therfore volume at state 1V1 = swept_volume + clearance_volume%State variable at 2nd state,  (process 2->3 Constant volume heat addition)V2 = clearance_volume%calculating P2%P1*V1^gamma = P2*V2^gammaP2 = P1*(CR^gamma)% CR = compression ratio which is equal to V1/V2% to define temperature at 2 we will use ideal gas equation%(P1*V1)/T1 = (P2*V2)/T2T2 = (P2*V2*T1)/(P1*V1)%including all sets of values of volume that system have during the process 1->2%so as to have curve connection in our plot,according to points that (pressure,volume) have during processconstant_C = P1*V1^gammaV_compressionprocess = chamber_volume_calci(bore,stroke,connecting_rod,CR,180,0);P_compressionprocess = constant_C./(V_compressionprocess.^gamma);%State variable at 3rd state, (process 3->4 Isentropic expansion)%temperature at state 3 in our case will be given to usT3 = 3000V3 = V2%similarly by ideal gas equationP3 = (P2*T3)/T2%including all sets of values of (pressure,volume) that system have during expansion to reach state 4constant_C = P3*V3^gammaV_expansionprocess = chamber_volume_calci(bore,stroke,connecting_rod,CR,0,180);P_expansionprocess = constant_C./(V_expansionprocess.^gamma);%State variable at 4th state (process 4->1 Constant volume heat rejection)%since process from 4->1 is constant volume heat rejection,thereforeV4 = V1%Calculating P4P4 = P3*(V3/V4)^gamma %Calculating T4 T4 = P4*V4*T3/(P3*V3) %Plottingfigure(1)hold onplot(V1,P1,'o','color','m')plot(V_compressionprocess,P_compressionprocess,'color','b')plot(V2,P2,'o','color','m')plot([V2 V3],[P2 P3],'color','b')plot(V3,P3,'o','color','m')plot(V_expansionprocess,P_expansionprocess,'color','b')plot(V4,P4,'o','color','m')plot([V4 V1],[P4 P1],'color','b')xlabel('Volume','color','r')ylabel('Pressure','color','r')grid on%Calculating Thermal Efficiency%formula (1)eta_otto = 1 -((T4 -T1)/(T3-T2))%formula (2)%eta_otto_1 = 1 - (1/(CR^(gamma-1)))%now we will plot graph between Thermal efficiency and CR CR =[1:1:12] eta_otto_efficiency = 1 - (1./(CR.^(gamma-1)))eta_otto_efficiency_percentage = eta_otto_efficiency.*100figure(2)plot(CR,eta_otto_efficiency_percentage)xlabel('Compression Ratio','color','r')ylabel('Thermal Efficiency-OTTO CYLCE','color','r')grid on 

Output;-

P-V plot for Ideal Otto Cycle

#Output Plot between thermal efficiency percentage vs CR(compression ratio)

there are total four processes in an Ideal otto cycle:

1) Isentropic compression (state 1 --> state 2)

during this process , chamber volume does not change in a linear way , this change is accordingly with crank angle so , therefore we get a curve connection in between state 1 and state 2

How volume changes depends on engine geometric parameter and on different values of crank angle when it rotate. To include this in PV plot we have to define a function which provide as an array of values of volume of chamber for different values of crank anlges. (180,0)

2) Constant volume heat addition (state 2 --> state 3)

3)Isentropic Expansion (state 3 --> state 4)

similarly here also we have to again call the defined function to get different sets of values of volume for different angles (0,180)

4)Constant volume heat rejection (state 4 --> state 1 )

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.