grid; hold off; function thoigian global v1 t1 plotv1,t1;grid; function quangduong global v1 s1 v1 s1 plotv1,s1;grid;.
Trang 1Tính đặc tính của động cơ
L Hùng Cờng - ôtô 42
function tinhskeo()
global b2 b3 b4 b5 b6 b7 b8 b11 b10
h0 = figure('Color',[0.8 0.8 0.8],
'MenuBar','none',
'PaperPosition',[18 180 576 432],
'PaperUnits','points',
'Position',[1 1 798 581],
'Tag','Fig1',
'numbertitle','off',
'resize','off',
'name','Đồ án Tốt Nghiệp - Lu Hùng Cờng Ôtô K42',
'ToolBar','none');
h1 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[440 125 155 300],
'Style','frame',
'Tag','Frame1');
t1 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 390 50 25],
'String','Loại xe ',
'Style','text',
'Tag','StaticText1');
p1 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 390 90 25],
'String',['Du lịch vỏ kín';'Du lịch vỏ hỏ ';'Xe tải(4x2) ';'Xe tải(4x4) ';'Xe khách '],
'Style','popupmenu',
Trang 2'Tag','lxe',
'Value',4);
t2 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 240 50 25],
'String','Loại động cơ',
'Style','text',
'Tag','StaticText2');
p2 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 240 90 25],
'String',['Xăng có hạn chế ';'Xăng không hạn chế ';'Diesel cháy trực tiếp';'Diesel cháy dự bị ';'Diesel cháy xoáy lốc '],
'Style','popupmenu',
'Tag','ldc',
'Value',5);
t3 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 365 50 25],
'String','Tổng trọng lợng',
'Style','text',
'Tag','StaticText3');
e3 = uicontrol('Parent',h0,
'Units','points',
'callback','tinhskeo1(''11'')',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 375 90 15],
'Style','edit',
'Tag','txtG');
t4 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
Trang 3'ListboxTop',0,
'Position',[445 340 50 25], 'String','Träng lîng b¸m',
'Style','text',
'Tag','StaticText3');
e4 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'callback','tinhskeo1(''11'')', 'Position',[500 350 90 15], 'Style','edit',
'Tag','txtG2');
t5 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 315 50 25], 'String','HÒ sè c¶n l¨n',
'Style','text',
'Tag','StaticText3');
e5 = uicontrol('Parent',h0,
'Units','points',
'callback','tinhskeo1(''11'')', 'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 325 90 15], 'Style','edit',
'Tag','txtf');
t6 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 290 50 25], 'String','Gãc dèc Max',
'Style','text',
'Tag','StaticText4');
e6 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
Trang 4'callback','tinhskeo1(''11'')', 'ListboxTop',0,
'Position',[500 300 90 15], 'Style','edit',
'Tag','txtgoc');
t7 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 265 50 25], 'String','VËn tèc Max',
'Style','text',
'Tag','StaticText3');
e7 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'callback','tinhskeo1(''11'')', 'ListboxTop',0,
'Position',[500 275 90 15], 'Style','edit',
'Tag','txtvmax');
t8 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 215 50 25], 'String','Sè vßng quay nv', 'Style','text',
'Tag','StaticText3');
e8 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'callback','tinhskeo1(''11'')', 'ListboxTop',0,
'Position',[500 225 90 15], 'Style','edit',
'Tag','txtnv');
t9 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
Trang 5'ListboxTop',0,
'Position',[445 190 50 25],
'String','Sè cÊp sè',
'Style','text',
'Tag','StaticText3');
e9 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 200 90 15],
'callback','tinhskeo1(''11'')', 'Style','edit',
'Tag','txtn');
t10 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 165 50 25],
'String','TØ sè truyÒn cao nhÊt', 'Style','text',
'Tag','StaticText3');
e10 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
'ListboxTop',0,
'Position',[500 175 90 15],
'callback','tinhskeo1(''11'')', 'Style','edit',
'Tag','txtin');
t11 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[445 140 50 25],
'String','Cì lèp rb(m)',
'Style','text',
'Tag','StaticText3');
e11 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[1 1 1],
Trang 6'ListboxTop',0,
'Position',[500 150 90 15], 'callback','tinhskeo1(''11'')', 'Style','edit',
'Tag','txtrb');
h1 = uicontrol('Parent',h0,
'Units','points',
'BackgroundColor',[0 1 0],
'ListboxTop',0,
'Position',[440 5 155 115], 'Style','frame',
'Tag','Frame2');
b1 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''1'')', 'ListboxTop',0,
'Position',[475 130 30 15], 'String','OK',
'Tag','Pushbutton1');
b2 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''2'')', 'ListboxTop',0,
'Position',[455 95 60 20],
'String','§Æc tÝnh ngoµi',
'enable','off',
'Tag','PshNe');
b3 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''3'')', 'ListboxTop',0,
'Position',[455 70 60 20],
'enable','off',
'String','C«ng suÊt',
'Tag','PshNk');
b4 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''4'')', 'enable','off',
'ListboxTop',0,
Trang 7'Position',[455 45 60 20],
'String','Lực kéo',
'Tag','PshPk');
b5 = uicontrol('Parent',h0,
'Units','points',
'enable','off',
'Callback','tinhskeo1(''5'')', 'ListboxTop',0,
'Position',[455 20 60 20],
'String','Động học',
'Tag','PshD');
b6 = uicontrol('Parent',h0,
'enable','off',
'Units','points',
'Callback','tinhskeo1(''6'')', 'ListboxTop',0,
'Position',[525 95 60 20],
'String','Gia tốc',
'Tag','Pshj');
b7 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''7'')', 'enable','off',
'ListboxTop',0,
'Position',[525 70 60 20],
'String','Thời gian',
'Tag','Psht');
b8 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''8'')', 'enable','off',
'ListboxTop',0,
'Position',[525 45 60 20],
'String','Quãng đờng',
'Tag','Pshs');
b9 = uicontrol('Parent',h0,
'Units','points',
'Callback','close(gcf)',
'ListboxTop',0,
'Position',[555 18 30 15],
Trang 8'String','Exit',
'Tag','Pushbutton2');
b10 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''10'')',
'ListboxTop',0,
'Position',[555 130 30 15],
'String','Help',
'Tag','Pushbutton3');
b11 = uicontrol('Parent',h0,
'Units','points',
'Callback','tinhskeo1(''9'')',
'ListboxTop',0,
'enable','off',
'Position',[515 130 30 15],
'String','Cancel',
'Tag','Pushbutton4');
a1 = axes('Parent',h0,
'Units','pixels',
'Box','on',
'CameraUpVector',[0 1 0],
'Color',[1 1 1],
'Position',[51 61 526 505],
'Tag','Axes1',
'XColor',[0 0 0],
'YColor',[0 0 0],
'ZColor',[0 0 0]);
Tính đờng đặc tính của động cơ
Trang 9function tinhskeo1(x)
format short;
switch x
case '1'
tinhtoan;
case '2'
dactinh;
case '3'
congsuat;
case '4'
luckeo;
case '5'
donghoc;
case '6'
giatoc;
case '7'
thoigian;
case '8'
quangduong;
case '9'
xoadl;
case '10'
help1;
case '11'
can1;
end
function can1
global b11
set(b11,'enable','on');
function xoadl
set(findobj(gcf,'tag','txtG'),'string',''); set(findobj(gcf,'tag','txtf'),'string','');
Trang 10set(findobj(gcf,'tag','txtgoc'),'string',''); set(findobj(gcf,'tag','txtvmax'),'string',''); set(findobj(gcf,'tag','txtnv'),'string','');
set(findobj(gcf,'tag','txtrb'),'string','');
set(findobj(gcf,'tag','txtn'),'string','');
set(findobj(gcf,'tag','txtin'),'string','');
set(findobj(gcf,'tag','txtG2'),'string','');
return;
function help1
msgbox('Xin liên hệ với tác giả để có phiên bản hoàn thiện','Notice','warn');
return;
function tinhtoan
global ne Ne Me Nk Pk D giatoc t1 v v1 s1
global G f F k n
global b2 b3 b4 b5 b6 b7 b8
%nhập dữ liệu
G=str2num(get(findobj(gcf,'tag','txtG'),'string')); f=str2num(get(findobj(gcf,'tag','txtf'),'string')); goc=str2num(get(findobj(gcf,'tag','txtgoc'),'string '));
vmax=str2num(get(findobj(gcf,'tag','txtvmax'),'stri ng'));
nv=str2num(get(findobj(gcf,'tag','txtnv'),'string') );
rb=str2num(get(findobj(gcf,'tag','txtrb'),'string') );
n=str2num(get(findobj(gcf,'tag','txtn'),'string')); in=str2num(get(findobj(gcf,'tag','txtin'),'string') );
G2=str2num(get(findobj(gcf,'tag','txtG2'),'string') );
lxe=(get(findobj(gcf,'tag','lxe'),'value'));
ldc=(get(findobj(gcf,'tag','ldc'),'value'));
%Kiểm tra dữ liệu
Trang 11if isempty(G)|isempty(f)|isempty(goc)|
isempty(vmax)|
isempty(nv)|isempty(rb)|isempty(n)|isempty(in)| isempty(G2)
msgbox('Bạn đã nhập thiếu dữ
liệu','Notice','warn');
return;
end;
%biến đổi dữ liệu
hf=0;
if lxe==1
k=.035;
F=2.8;
nt=.95;
end;
if lxe==2
k=.05;
F=2;
nt=.95;
end;
if lxe==3
k=.07;
F=5;
nt=.9;
end;
if lxe==4
k=.07;
F=5;
nt=.9;
hf=1;
end;
if lxe==5
k=.04;
F=6.5;
nt=.85;
end;
if ldc==1
Trang 12ne1=1.3;
a=1;b=1;c=1;
end;
if ldc==2
ne1=.9;
a=1;b=1;c=1;
end;
if ldc==3
ne1=1;
a=.5;b=1.5;c=1;
end;
if ldc==5
ne1=1;
a=.7;b=1.3;c=1;
end;
if ldc==4
ne1=1;
a=.6;b=1.4;c=1;
end;
%hằng số
fi=.7;
si=f+goc;
g=10;
%tính toán
if hf==1
msgbox('Xin liên hệ với tác giả để có phiên bản hoàn thiện','Notice','warn');
return;
end;
%tinh dach tinh ngoai cua dong co
Nv=(G*f*vmax/270+k*F*vmax^3/3500)/nt;
Nemax=Nv/(a*ne1+b*ne1^2-c*ne1^3);
ne=linspace(900,(nv*ne1),20);
ne2=ne/nv;
Ne=(a*ne2 + b*ne2.^2-c*ne2.^3)*Nv;
Me=716.2*Ne*(diag(ne.^(-1))');
Trang 13%tinh hop so
Memax=max(Me)
i0=.377*rb*nv/vmax
i1k=si*G*rb/(Memax*i0*nt);
i1b=G2*rb*fi/(Memax*i0*nt);
%phai so sanh
i1=i1k;
if in<1
i=[(n-2):-1:0];
i=(i1.^i).^(1/(n-2))
i(n-1)=in;
else
i=[(n-1):-1:0];
i=(i1.^i).^(1/(n-1))
end;
%tinh van toc theo tung so truyen v=(.377*rb/i0)*((i.^(-1))')*ne;
%chi tieu cong suat
Nk=Ne*nt;
%chi tieu luc keo
Pw=(k*F/13)*v.^2;
Pk=(i0*nt/rb)*(i')*Me;
%chi tieu dong hoc
D=(Pk-Pw)/G;
%tinh gia toc
delta=1.04+.05*i.^2;
giatoc=(diag(delta.^(-1))')*g*(D-f); j=giatoc.^(-1);
%tinh thoi gian
v1=[10:.5:max(max(v))*.95];
ne1=i0/.377/rb*i'*v1;
for demx=1:size(ne1,1)
Trang 14for demy=1:size(ne1,2)
if ((ne1(demx,demy)<=900) |
(ne1(demx,demy)>=2300) )
ne1(demx,demy)=0;
end;
end;
end;
ne12=ne1/nv;
Ne1=(.7*ne12 + 1.3*ne12.^2-ne12.^3)*Nv; for demx=1:size(ne1,1)
for demy=1:size(ne1,2)
if ((ne1(demx,demy)<=900) |
(ne1(demx,demy)>=2300) )
ne1(demx,demy)=1;
end;
end;
end;
Me1=716.2*Ne1.*(ne1.^(-1));
Pw1=(k*F/13)*v1.^2;
%Pw1=[Pw1;Pw1;Pw1;Pw1;Pw1];
Pw2=Pw1;
for t=1:(n-1)
Pw2=[Pw2;Pw1];
end;
Pw1=Pw2;
Pk1=(i0*nt/rb)*diag(i)*Me1;
D1=(Pk1-Pw1)/G;
delta1=1.04+.05*i.^2;
giatoc1=(diag(delta1.^(-1))')*g*(D1-f); j=giatoc1.^(-1);
t=j*.5/3.6;
for demx=1:size(t,1)
for demy=1:size(t,2)
if (t(demx,demy)<=0)
t(demx,demy)=10;
end;
end;
end;
Trang 15for demx=2:size(t,2)
t1=[t1 min(t(:,[demx]))];
end;
a=0;
for demx=1:size(t,2)
a=a+t1(:,[demx]);
t1(:,[demx])=a;
end;
%tinh quang duong
s=t1*5;
a=5*t1(:,1);
for dem=1:(size(s,2)-1)
b=(5+dem*5)*t1(:,[dem+1]);
s1(:,[dem])=(b-a-s(:,[dem]))/3.6; a=b;
end;
a=0;
for demx=1:size(s1,2)
a=a+s1(:,[demx]);
s1(:,[demx])=a;
end;
s1=[s1 s1(end)];
%Thay đổi chức năng phím bấm
set(b2,'enable','on');
set(b3,'enable','on');
set(b4,'enable','on');
set(b5,'enable','on');
set(b6,'enable','on');
set(b7,'enable','on');
set(b8,'enable','on');
%ve
function dactinh
Trang 16global ne Ne Me
plot(ne,Ne,'r',ne,2.5*Me,'b');
grid;
function congsuat
global Nk v G f F k n
plot([1:90],G*f/270*[1:90],'r',
[1:90],G*f/270*[1:90]+k*F/3500*([1:90].^3),'r'); hold on;
for a=1:n
plot(v(a,:),Nk);
end;
grid;
hold off;
function luckeo
global Pk v G f F k n
plot([1:90],G*f,'r',
[1:90],G*f+k*F/13*([1:90].^2),'r');
hold on;
for a=1:n
plot(v(a,:),Pk(a,:));
end;
grid;
hold off;
function donghoc
global D v n
for a=1:n
plot(v(a,:),D(a,:));
hold on;
end;
grid;
hold off;
function giatoc
global v giatoc n
for a=1:n
plot(v(a,:),giatoc(a,:));
hold on;
Trang 17grid;
hold off;
function thoigian global v1 t1
plot(v1,t1);grid;
function quangduong global v1 s1
v1
s1
plot(v1,s1);grid;