0% found this document useful (0 votes)
23 views

Group 8

This document contains code to analyze the thermodynamic cycle of an internal combustion engine. It defines various parameters, calculates pressure and volume values over the engine cycle, and plots graphs of pressure vs volume, pressure vs crank angle, and kinematic properties of the piston like displacement, velocity and acceleration vs crank angle. The code exports tables of calculated values to Excel files for further analysis.

Uploaded by

Quoc Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Group 8

This document contains code to analyze the thermodynamic cycle of an internal combustion engine. It defines various parameters, calculates pressure and volume values over the engine cycle, and plots graphs of pressure vs volume, pressure vs crank angle, and kinematic properties of the piston like displacement, velocity and acceleration vs crank angle. The code exports tables of calculated values to Excel files for further analysis.

Uploaded by

Quoc Nguyen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

>> clearvars;

%% Cac thong so ban dau


S = 0.90; % S/D=1.07, don vi dm
D = 0.8401;
R = S/2; %dm
lambda = 0.32;
Fp = (pi*(D^2))/4;
Va = 0.528 ; %Don vi the tich: lit % a: cuoi qtrinh nap
Vc = 0.033; % c: cuoi qtrinh nen
Vz = 0.033; % z: cuoi qtrinh chay
Vb = Va; % b: cuoi qtrinh gian no
Vr = Vc; % r: cuoi qtrinh thai
n1 = 1.367; %2.3.2.4.Chi so nen da bien trung binh
n2 = 1.318; %2.3.4.3.Chi so dan no da bien trung binh
P0 = 0.1013; %2.2.1.Don vi ap suat: MN/m^2
Pa = 0.1367; %2.2.5
Pc = 6.05; %2.3.3.10
Pz = 9.075; %2.3.3.10
Pb = 0.408; %2.3.4.5
Pr = 0.11; %2.2.6
n = 3750; %vong/phut
w = (pi*n)/30; %rad/s
mnp = 4.4; %don vi g/cm2
mtt = 18
mk = 18;
mA = 0.4 * mtt;
mB = 0.6 * mtt;
mj = mA + mnp;
mr = mB + mk;
%% ve do thi cong chi thi
% hieu chinh rr'
a1hc = linspace (0,5,100); % dong muon xupap thai = 3
x1hc = R.*((1-cosd(a1hc))+(lambda/4).*(1-cosd(2.*a1hc)));
V1hc = x1hc*Fp + Vc;
Vr1 = max (V1hc);
Prr1 = linspace (Pr,Pa,100); % khoang ap suat trong doan hieu chinh
Vrr1 = linspace (Vc,Vr1,100); % khoang the tich trong doan hieu chinh
P1hc = interp1 (Vrr1,Prr1,V1hc,'spline');

% qua trinh nap


a1 = linspace (5,180,100);
x1 = R.*((1-cosd(a1))+(lambda/4).*(1-cosd(2.*a1)));
Fp = (pi*(D^2))/4;
V1 = x1*Fp + Vc;
P1 = linspace (Pa,Pa,100);

% qua trinh nen (goc danh lua som = 15)


% doan 1
a2 = linspace (180,345,100);
x2 = R.*((1-cosd(a2))+(lambda/4).*(1-cosd(2.*a2)));
V2 = x2*Fp + Vc;
P2 = Pa.*(Va./V2).^n1;

% qua trinh chay - gian no


% hieu chinh doan c'-c"
a2hc = linspace (345,360,100);
x2hc = R.*((1-cosd(a2hc))+(lambda/4).*(1-cosd(2.*a2hc)));
V2hc = x2hc*Fp + Vc;
Pchc = Pa.*(Va./V2hc).^n1;

% xac dinh toa do diem c'


Vc1 = max (V2hc);
Pc1 = min (Pchc);
% xac dinh toa do diem c"
Pz1 = Pz; % z1 la diem z'
Pcz1 = Pz1 - Pc;
Pc2 = Pcz1/3 + Pc;
Vc2 = Vc;
% ve doan c'-c"
Vc1c2 = linspace (Vc1,Vc2,100);
Pc1c2 = linspace (Pc1,Pc2,100);
P2hc = interp1(Vc1c2,Pc1c2,V2hc,'spline');

% hieu chinh c"-z"


a3hc = linspace(360,375,100);
x3hc = R.*((1-cosd(a3hc))+(lambda/4).*(1-cosd(2.*a3hc)));
VZ = x3hc*Fp + Vc;
PZ= Pz.*(Vz./VZ).^n2;

% xac dinh diem z"


Vz2 = max (VZ);
Pz2 = min (PZ);
% xac dih diem zhc
azhc = 374;
xzhc = R.*((1-cosd(azhc))+(lambda/4).*(1-cosd(2.*azhc)));
Vzhc = xzhc*Fp + Vc;
Pzhc = Pz.*( Vz./Vzhc).^n2;
% ve doan c"-z"
Vz1z2 = [Vc2,Vzhc,Vz2];
Pz1z2 = [Pc2,Pzhc,Pz2];
V3hc = linspace(Vc2,Vz2,100);
P3hc = interp1(Vz1z2,Pz1z2,V3hc,'spline');

% gian no
a3 = linspace (375,488,100);
x3 = R.*((1-cosd(a3)+(lambda/4).*(1-cosd(2.*a3))));
V3 = x3*Fp + Vc;
P3 = Pz.*(Vz./V3).^n2;

% qua trinh thai


% hieu chinh b'b"
a4hc = linspace (488,540,100); %mo som xupap thai = 52
x4hc = R.*((1-cosd(a4hc))+(lambda/4).*(1-cosd(2.*a4hc)));
V1b = x4hc*Fp + Vc;
P1b = Pz.*(Vz./V1b).^n2;
% xac dinh diem b'
Vb1 = min (V1b);
Pb1 = max (P1b);
% xac dinh diem b"
Pb2 = ((Pb-Pr)/3)+Pr;
Vb2 = Va;
% xac dinh bhc1
abhc1 = 500;
xbhc1 = R.*((1-cosd(abhc1))+(lambda/4).*(1-cosd(2.*abhc1)));
Vbhc1 = xbhc1*Fp + Vc;
Pbhc1 = Pz.*(Vz./Vbhc1).^n2;
% ve doan b'b"
Vb1b2 = [Vb1,Vbhc1,Vb2];
Pb1b2 = [Pb1,Pbhc1,Pb2];
V4hc = linspace(Vb1,Va,100);
P4hc = interp1(Vb1b2,Pb1b2,V4hc,'spline');

% hieu chinh b"


a5hc = linspace(540,570,100);
x5hc = R.*((1-cosd(a5hc))+(lambda/4).*(1-cosd(2.*a5hc)));
V2b = x5hc*Fp + Vc;
%xac dinh diem b'''
Pb3 = Pr;
Vb3 = min(V2b);
%xac dinh diem bhc2
abhc2 = 550;
xbhc2 = R.*((1-cosd(abhc2))+(lambda/4).*(1-cosd(2.*abhc2)));
Vbhc2 = xbhc2*Fp + Vc;
Pbhc2 = 0.225;
% ve doan cong sau b"
Vb2b4 = [Vb2,Vbhc2,Vb3];
Pb2b4 = [Pb2,Pbhc2,Pb3];
V5hc = linspace(Vb2,Vb3,100);
P5hc = interp1(Vb2b4,Pb2b4,V5hc,'spline');

% doan cuoi
a4 = linspace (570,720,100);
x4 = R.*((1-cosd(a4))+(lambda/4).*(1-cosd(2.*a4)));
V4 = x4*Fp + Vc;
P4 = linspace (Pr,Pr,100);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% do thi cong P-V
atong = [a1hc,a1,a2,a2hc,a3hc,a3,a4hc,a5hc,a4];
jtong = R*(w^2).*(cosd(atong)+lambda.*cosd(2.*atong));
Vtong = [V1hc,V1,V2,V2hc,VZ,V3,V1b,V2b,V4];
Ptong = [P1hc,P1,P2,P2hc,P3hc,P3,P4hc,P5hc,P4];

% ve do thi P-V
figure(1);
plot (Vtong,Ptong,'k','linewidth',1.5);
title('DO THI CONG CHI THI P-V');
xlabel('The tich V (lit)');
ylabel('Ap suat P (MN/m2)');
grid on;

%%
%% Graph P-phi Pj P1
figure(2);
Pj = (-mj.*jtong)*(10^-6);%
Pkt = (Ptong-0.1);
plot (atong,Pj,'r','linewidth',1.5);
hold on
plot (atong,Pkt,'b','linewidth',1.5);
P1 = Pkt + Pj;
plot (atong,P1,'k','linewidth',1.5);
axis([0 720 -8 8]);
grid on;
title('GRAPH Pkt Pj P1');
xlabel('Rotate angle of crankshaft (degree)');
ylabel('Pkt (MN/m2) Pj (MN/m2) P1 (MN/m2)');
legend('Pj','Pkt','P1');

%% Kinematic of piston graph


adh = [a1hc,a1,a2,a2hc];
%Tranpostion of piston
SpI = 0.1*R.*(1-cosd(adh));
SpII = 0.1*R.*((lambda/4).*(1-cosd(2.*adh)));
Sp = SpI + SpII;
figure(3);
plot (adh,SpI,'r','linewidth',1.5);
hold on;
plot (adh,SpII,'b','linewidth',1.5);
hold on;
plot (adh,Sp,'k','linewidth',1.5);
axis([0 360 -0.01 0.1]);
title('KINEMATIC OF PISTON GRAPH - Sp');
xlabel('Rotate angle of crankshaft (degree)');
ylabel('Tranposition of piston (m)');
legend('SpI','SpII','Sp');
grid on;

%velocity of piston
VpI = 0.1*R*w.*(sind(adh));
VpII = 0.1*R*w.*((lambda/2).*sind(2*adh));
Vp = VpI + VpII;
figure(4);
plot (adh,VpI,'r','linewidth',1.5);
hold on;
plot (adh,VpII,'b','linewidth',1.5);
hold on;
plot (adh,Vp,'k','linewidth',1.5);
axis([0 360 -35 35]);
title('VELOCITY GRAPH OF PISTON - Vp');
xlabel('Rotate angle of crankshaft (do)');
ylabel('Velocity of piston (m/s2)');
legend('VpI','VpII','Vp');
grid on;

%Acceleration of piston
jI = 0.1*R*(w^2).*(cosd(adh));
jII = 0.1*R*(w^2).*(lambda.*cosd(2.*adh));
Jp = jI + jII;
figure(5);
plot (adh,jI,'r','linewidth',1.5);
hold on;
plot (adh,jII,'b','linewidth',1.5);
hold on;
plot (adh,Jp,'k','linewidth',1.5);
axis([0 360 -25000 30000]);
title('ACCELERATION GRAPH OF PISTON - Jp');
xlabel('Rotate angle of crankshaft (degree)');
ylabel('Acceleration of piston (m/s2)');
legend('JpI','JpII','Jp');
grid on;

%% exporting excel table


%%% Exporting pressure table MCCT
Vxn = (Va:-0.02:Vc);
Pxn = Pa.*(Va./Vxn).^n1;
Vxg = (Vz:0.02:Vb);
Pxg = Pz.*(Vz./Vxg).^n2;
xlswrite('compression.xlsx',[Vxn(:),Pxn(:)]);
xlswrite('power.xlsx',[Vxg(:),Pxg(:)]);
%%% Exporting table of values ??for the results of dynamic calculations
xlswrite('dynamic.xlsx',[atong(:),Pkt(:),Pj(:),P1(:)]);
%%% Exporting table of kinetic calculation results
xlswrite('kinematic.xlsx',[adh(:),Sp(:),Vp(:),Jp(:)]);

%%
clc;

You might also like