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

code all

The document contains calculations and plots related to the dynamics of a piston system, including forces, displacements, velocities, and accelerations across various phases of operation. It utilizes parameters such as angular velocity, mass densities, and pressure adjustments to derive results and visualize them through graphs. Data is also exported to Excel files for further analysis.

Uploaded by

lehoangky503
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

code all

The document contains calculations and plots related to the dynamics of a piston system, including forces, displacements, velocities, and accelerations across various phases of operation. It utilizes parameters such as angular velocity, mass densities, and pressure adjustments to derive results and visualize them through graphs. Data is also exported to Excel files for further analysis.

Uploaded by

lehoangky503
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

%Do thi Dong luc hoc

TSN = 10.5;
S = 84; %mm
B = 72; %mm
Vd = 342;
Vc = Vd/(TSN-1);
Va = TSN*Vc;
n1 = 1.37;
n2 = 1.2;
pa = 0.09;
pc = 2.26;
pb = 0.4166;
pr = 0.11;
pz = 7;
lamda = 1/3;
R = S/2000; %m
Fp = (pi*(B/1000)^2)/4;
n = 6000; %rpm
w = 2*pi*n/60;
mnp = 12*10; %kg/m^2
mtt = 15*10; %kg/m^2
mk = 15*10; %kg/m^2
mA = mtt/3;
mB = 2*mtt/3;
mt = mnp + mA;
mr = mk + mB;
%Hieu chinh a tu 0-3 do
a01 = linspace(0,3,30);
p01j = -mt*R*w^2*(cosd(a01)+lamda*cosd(2*a01))*10^-6; %MN/m^246
xhc = R*((1-cosd(1.5))+lamda*(1-cosd(3))/4);
Vhc = (xhc*pi*B^2/4)+Vc;
Xr1 = R*((1-cosd(3))+lamda*(1-cosd(2*3))/4);
Vr1 = (Xr1*pi*B^2/4)+Vc;
pr1 = pa;
ahc = [0,1,2,3];
phc = [pr,0.1,0.09,pr1];
pkt01 = interp1(ahc,phc,a01,'spline');
p101 = p01j + pkt01;
%Qua trinh nap
a1 = linspace(3,180,100);
p1j = -mt*R*w^2*(cosd(a1)+lamda*cosd(2*a1))*10^-6;
pkt1 = linspace(pa,pa,100);
p11 = p1j + pkt1;
%Qua trinh nen:
a2 = linspace(180,340,160);
p2j = -mt*R*w^2*(cosd(a2)+lamda*cosd(2*a2))*10^-6;
xc1 = R*((1-cosd(a2))+lamda*(1-cosd(2*a2))/4);%m
vc1 = (xc1*pi*B^2/4)+Vc;
pkt2 = (pa*(Va.^n1*vc1.^-n1));
p12 = p2j + pkt2;
%Hieu chinh a tu 340-360
a23 = linspace(340,360,40);
p23j = -mt*R*w^2*(cosd(a23)+lamda*cosd(2*a23))*10^-6;
Xc1 = R*((1-cosd(340))+lamda*(1-cosd(2*340))/4);
Vc1 = (Xc1*pi*B^2/4)+Vc;
pc1 = pa*(Va.^n1*Vc1.^-n1);
pz1 = 0.85*pz;
pcz1 = pz1 - pc;
pcc2 = pcz1/3;
pc2 = pcc2 + pc;
ahc1 = [340,343.2,360];
phc1 = [pc1,1.718,pc2];
a11 = linspace(340,360,40);
pkt11 = interp1(ahc1,phc1,a11,'spline');
p123 = p23j + pkt11;
%Qua trinh chay
a3 = linspace(360,364,10);
p3j = -mt*R*w^2*(cosd(a3)+lamda*cosd(2*a3))*10^-6;
Vz = Vc;
ro = 1;
Vz1 = Vz/ro;
pz2 = 5.77;
pkt3 = linspace(pc2,pz2,10);
p13 = p3j + pkt3;
%Hieu chinh a tu 364-370
a34 = linspace(364,370,20);
p34j = -mt*R*w^2*(cosd(a34)+lamda*cosd(2*a34))*10^-6;
ahc2 = [364,366.5,370];
phc2 = [pz2,pz1,pz2];
a22 = linspace(364,370,20);
pkt22 = interp1(ahc2,phc2,a22,'spline');
p134 = p34j + pkt22;
%Qua trinh gian no
a4 = linspace(370,492,90);
p4j = -mt*R*w^2*(cosd(a4)+lamda*cosd(2*a4))*10^-6;
xz2 = R*((1-cosd(370))+lamda*(1-cosd(2*370))/4);
vz2 = ((xz2*pi*B^2/4)+Vc);
xb1 = R*((1-cosd(a4))+lamda*(1-cosd(2*a4))/4);
vb1 = (xb1*pi*B^2/4)+Vc;
pkt4 = (pz2*vz2.^n2*vb1.^-n2);
p14 = p4j + pkt4;
%Hieu chinh a tu 494-540
a45 = linspace(494,540,80);
p45j = -mt*R*w^2*(cosd(a45)+lamda*cosd(2*a45))*10^-6;
Xb1 = R*((1-cosd(489))+lamda*(1-cosd(2*489))/4);
Vb1 = (Xb1*pi*B^2/4)+Vc;
pb1 = pz2*vz2.^n2*Vb1.^-n2;
ahc3 = [489,500,513,527,540];
phc3 = [pb1,0.35,0.25,0.16,pr];
a33 = linspace(492,540,80);
pkt33 = interp1(ahc3,phc3,a33,'spline');
p145 = p45j + pkt33;
%Qua trinh thai
a5 = linspace(540,720,200);
p5j = -mt*R*w^2*(cosd(a5)+lamda*cosd(2*a5))*10^-6;
pkt5 = linspace(pr,pr,200);
p15 = p5j + pkt5;
a = [a01,a1,a2,a23,a3,a34,a4,a45,a5];
pkt = [pkt01,pkt1,pkt2,pkt11,pkt3,pkt22,pkt4,pkt33,pkt5];
pj = [p01j,p1j,p2j,p23j,p3j,p34j,p4j,p45j,p5j];
p1 = [p101,p11,p12,p123,p13,p134,p14,p145,p15];
b = asind(lamda*sind(a));
figure(2)
plot(a,pkt,'g','linewidth',1);
hold on
plot(a,pj,'b','linewidth',1);
hold on
plot(a,p1,'r','linewidth',1);
hold on
xlabel('GQTK (Do)');
ylabel('Pkt,Pj,P1 (MN/m^2)');
title('DO THI LUC KHI THE Pkt, LUC QUAN TINH Pj VA LUC TONG HOP P1');
legend('Luc khi the Pkt','Luc quan tinh Pj','Luc tong hop P1')
ax = gca;
ax.XAxisLocation = 'origin';
grid on
figure(3);
% Do thi chuyen vi cua piston
alpha = [a01,a1,a2,a23];
X = R*((1-cosd(alpha))+(lamda*(1-cosd(2*alpha)))/4);
plot(alpha,X,'g','linewidth',1);
hold on;
X1 = R*(1-cosd(alpha));
plot(alpha,X1,'b','linewidth',1);
hold on;
X2 = R*((lamda*(1-cosd(2*alpha)))/4);
plot(alpha,X2,'r','linewidth',1);
xlabel('Alpha (Do)');
ylabel('Sp (m)');
title('DO THI CHUYEN VI CUA PISTON');
legend('Sp','Sp1','Sp2');
ax = gca;
ax.XAxisLocation = 'origin';
grid on
figure(4);
% Do thi van toc cua piston
V = R*w*(sind(alpha)+lamda*sind(2*alpha)/2);
plot(alpha,V,'g','linewidth',1);
hold on;
V1 = R*w*sind(alpha);
plot(alpha,V1,'b','linewidth',1);
hold on;
V2 = R*w*lamda*sind(2*alpha)/2;
plot(alpha,V2,'r','linewidth',1);
xlabel('Alpha (Do)');
ylabel('Vp (m/s)');
title('DO THI VAN TOC CUA PISTON');
legend('V','V1','V2');
ax = gca;
ax.XAxisLocation = 'origin';
grid on
figure(5);
% Do thi gia toc cua piston
J = R*w^2*(cosd(alpha)+lamda*cosd(2*alpha));
plot(alpha,J,'g','linewidth',1);
hold on;
J1 = R*w^2*cosd(alpha);
plot(alpha,J1,'b','linewidth',1);
hold on;
J2 = R*w^2*lamda*cosd(2*alpha);
plot(alpha,J2,'r','linewidth',1);
hold on
xlabel('GQTK (Do)');
ylabel('jp (m/s^2)');
title('DO THI GIA TOC CUA PISTON');
legend('jp','jp1','jp2');
ax = gca;
ax.XAxisLocation = 'origin';
grid on
xlswrite('DLH.xlsx',[a(:),pkt(:),pj(:),p1(:)]);
xlswrite('DOTHI-X-V-J.xlsx',[alpha(:),X(:),V(:),J(:)]);

You might also like