2007年6月8日 星期五

機動學第十二次作業

B94611029 林軍耀
1.

5/31日曾全程來上課。

2.1~2一組標準全齒輪齒輪之徑節為8(亦可使用自設值),
齒數分別為30T與48T,其工作壓力角為20度(可為
14.5或25度,自選)。

設其徑節為8,
齒數為30T和48T
工作壓力角20度
使用程式function [c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(pd,n2,n3, phi)

其中pd=8
n2=30
n3=48
phi=20
可得

接觸比c_ratio=1.7005
接觸長度c_length =0.6275
齒冠ad =0.1250
周節pc =0.3927
基周節pb = 0.3690
齒輪一節圓直徑d2 = 3.7500
齒輪二節圓直徑d3 = 6
齒輪一之接近角、遠退角及作用角ag = 10.4850 9.9211 20.4061
齒輪二之接近角、遠退角及作用角 6.5532 6.2007 12.7538

其中

齒輪一的節徑為30/8=3.75
齒輪二的節徑為48/8=6

齒輪一的基圓直徑為3.75*cos(20)=3.523
齒輪二的基圓直徑為 6*cos(20)=5.638

單位皆為吋


2.3此組齒輪是否會產生干涉現象?試列式證明之。

(N2²+2N2 x N3)sin²>= 4 + 4N3
滿足此式就不會產生干涉

利用講義中公式可以知道

(20^2+2*20*48)(sin(20))^2 >= 4*(1+48)
271.1 > 196

故可知,不會產生干涉現象

2.4

使用draw_gear和move2_gear
利用move2_gear(8,30,48,20,5)
產生動畫


附上draw_gear和move2_gear程式

function move2_gear(Dpitch,nn1,nn2,phi,omega1)
% move2_gear(Dpitch,nn1,nn2,phi,omega1)
% To draw a whole gear
% Inputs:
% Inputs:
% Dpitch:dimetral pitch
% nn1,nn2: no. of teeth for both gears
% phi:pressure angle, degrees
% omega1: angular velocity of gear 1
% Example move2_gear(10,15,20,20,10)
clf;
d2r=pi/180;delt=0.01;
[coord1,r1,rb1]=one_tooth(Dpitch,nn1,phi,360,0,0);
[coord2,r2,rb2]=one_tooth(Dpitch,nn2,phi,360,0,0);
st=180/nn2;if nn1+nn2>2*fix((nn1+nn2)/2),st=0;end
coord2=rotate2D(coord2,180+st,0,0);
xc1=coord1(:,1);yc1=coord1(:,2);
xc2=coord2(:,1);yc2=coord2(:,2);
height=max(r1,r2)*1.2;
ar=min(abs(r1),abs(r2));
coord=bushing(ar/5,0,0); % Get the coordinates of 1st bushing
xb1=coord(:,1)-r1;yb1=coord(:,2);
xb2=coord(:,1)+r2;yb2=coord(:,2);
coord=bushing(-r1,-r1,0);%Get the 1st pitch circle
xp1=coord(:,1);yp1=coord(:,2);
coord=bushing(-r2,r2,0);% Get the 2nd pitch circle
xp2=coord(:,1);yp2=coord(:,2);
plot(xb1,yb1,'r-');hold on;
plot(xb2,yb2,'k-');
plot(xp1,yp1,'r:');
plot(xp2,yp2,'k:');
plot([-r1,r2]',[0,0]','r:');
xx1=min([r1,r2])/2;phir=(90-phi)*d2r;
plot([0,0]',[-xx1*2,xx1*2]','b:');
plot([-xx1 xx1]',[-xx1*tan(phir), xx1*tan(phir)]','b:');

cir1=line('xdata',[],'ydata',[],'erasemode','xor','linewidth',1,'color','r');
cir2=line('xdata',[],'ydata',[],'erasemode','xor','linewidth',1,'color','k');
line1=line('xdata',[],'ydata',[],'erasemode','xor','linewidth',2,'color','r');
line2=line('xdata',[],'ydata',[],'erasemode','xor','linewidth',2,'color','k');
lx1=[0 -r1]';ly1=[0,0]';
lx2=[r2,0]';ly2=[0,0]';
axis([-2.5*r1 2.5*r2 -height height]);
axis equal;
title('Press Ctl-C to stop');
theta1=180;theta2=180;s1=omega1*delt/d2r;
while 1,
z1=rotate2D([xc1,yc1],theta1,-r1,0);
z2=rotate2D([xc2,yc2],theta2,r2,0);
L1=rotate2D([lx1,ly1],theta1,-r1,0);
L2=rotate2D([lx2,ly2],theta2,r2,0);
set(cir1,'xdata',z1(:,1),'ydata',z1(:,2)); % For 1st circle moving
set(cir2,'xdata',z2(:,1),'ydata',z2(:,2)); % For 2nd circle moving
set(line1,'xdata',L1(:,1),'ydata',L1(:,2)); % For 1st line
set(line2,'xdata',L2(:,1),'ydata',L2(:,2)); % For 2nd line
drawnow;
pause(1/s1); %Stop for a while so we can see the graph
theta1=theta1+s1;
theta2=theta2-s1*r1/r2;
if theta1>360, theta1=theta1-360;end; %Reverse the direction at bondary line
if theta2>360,theta2=theta2-360;end;
end




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [coords,rp,rb]=one_tooth(Dp,N,phi,range,x0,y0)
% [coords]=draw_gear(Dp,N,phi,range,x0,y0)
% To draw a whole gear
% Inputs:
% Dp: Diametrial pitch
% N: no of teeth in a gear
% phi: pressure angle, degrees
% range: the section range to be drawn
% Example one_tooth(10,10,20,360)
nn=10;
d2r=pi/180;
phir=phi*d2r;
rp=N/Dp/2;
pc=pi/Dp;
ra=rp+1/Dp;
rb=rp*cos(phir);
rd=rp-1.25/Dp;
thpb=pc/rp;% angle respect to one pitch
tp=pc/2;
rr=linspace(rb,ra,nn)';
invphi=tan(phir)-phir;
for i=1:nn
beta=acos(rp/rr(i)*cos(phir));
tt(i)=(tp/rp/2+invphi-tan(beta)+beta);
end
coord1=[rr.*cos(tt') rr.*sin(tt')];
coord3=reverse(coord1);
th1=linspace(thpb/2,thpb/2-tt(nn),nn)';
coord0=[cos(th1) sin(th1)]*rd;
th2=linspace(tt(nn),-tt(nn),nn)';
coord2=[cos(th2) sin(th2)]*ra;
coord4=reverse(coord0);
coord=[coord0;coord1;coord2;coord3;coord4];
theta=thpb/d2r;
coords=[];i=0;
while i coord1=rotate2D(coord,-i,x0,y0);
coords=[coords;coord1];
i=i+theta;
end

function [B]=reverse(A)
nn=length(A); B=A;
for i=1:nn,B(i,:)=A(nn-i+1,:);end
B=[B(:,1) -B(:,2)];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [coords] = bushing(rr,x0,y0)
d2r=pi/180;
theta=[360:-10:0]*d2r;
r=abs(rr);
rx=r*cos(theta);ry=r*sin(theta);
if rr<0, rx=rx+x0; ry=ry+y0; coords=[rx' ry']; return; end; rx1=rx/2;rx2=-rx1; ry1=ry/2;ry2=-ry1; r4=r+r/4;r3=r/3; bx=[ 0 0 0 -r -r -r4 -r4 r4 r4 -r r r]; by=[r3 -r3 0 0 -r -r -r4 -r4 -r -r -r 0]; coords(:,1)=[bx rx rx1 rx2]'+x0; coords(:,2)=[by ry ry1 ry2]'+y0;
%%%%%%%%%%%%%%%%%%%
function [coords]=rotate2D(coord,theta,x0,y0)
th=theta*pi/180; c=cos(th);
s=sin(th);fact=[c s;-s c];
coords=coord*fact;
coords(:,1)=coords(:,1)+x0; coords(:,2)=coords(:,2)+y0;
function [coords]=draw_gear(Dp,N,phi,range,x0,y0)
% [coords]=draw_gear(Dp,N,phi,range,x0,y0)
%To draw a whole gear % Inputs: % Dp: Diametrical pitch
% N: no of teeth in a gear % phi: pressure angle, degrees
% range: the section range to be drawn % x0,y0: the location of the gear center
% Example [coords]=draw_gear(10,15,20,360,0,0)
[coord,theta,rp,rb]=tooth(Dp,N,phi); coords=[];
i=0; while i coord1=rotate2D(coord,-i,x0,y0);
coords=[coords;coord1];
i=i+theta;
end
plot(coords(:,1),coords(:,2));hold on;
[coord]=bushing(rp/8,x0,y0);
plot(coord(:,1),coord(:,2),'b-');
[coord]=bushing(-rp,x0,y0);
plot(coord(:,1),coord(:,2),'r:');
[coord]=bushing(-rb,x0,y0);
plot(coord(:,1),coord(:,2),'b:');
axis equal;




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [coords,theta,rp,rb]=tooth(Dp,N,phi)
% Example tooth(10,10,20)
nn=10;
d2r=pi/180;
phir=phi*d2r;
rp=N/Dp/2;
pc=pi/Dp;
ra=rp+1/Dp;
rb=rp*cos(phir);
rd=rp-1.25/Dp;
thpb=pc/rp;% angle respect to one pitch
tp=pc/2;
rr=linspace(rb,ra,nn)';
invphi=tan(phir)-phir;
for i=1:nn
beta=acos(rp/rr(i)*cos(phir));
tt(i)=(tp/rp/2+invphi-tan(beta)+beta);
end
coord1=[rr.*cos(tt') rr.*sin(tt')];
coord3=reverse(coord1);
th1=linspace(thpb/2,thpb/2-tt(nn),nn)';
coord0=[cos(th1) sin(th1)]*rd;
th2=linspace(tt(nn),-tt(nn),nn)';
coord2=[cos(th2) sin(th2)]*ra;
coord4=reverse(coord0);
coords=[coord0;coord1;coord2;coord3;coord4];
theta=thpb/d2r;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [B]=reverse(A)
nn=length(A); B=A;
for i=1:nn,B(i,:)=A(nn-i+1,:);end
B=[B(:,1) -B(:,2)];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [coords] = bushing(rr,x0,y0)
d2r=pi/180;
theta=[360:-10:0]*d2r;
r=abs(rr);
rx=r*cos(theta);ry=r*sin(theta);
if rr<0,
rx=rx+x0;
ry=ry+y0;
coords=[rx' ry'];
return;
end;
rx1=rx/2;rx2=-rx1;
ry1=ry/2;ry2=-ry1;
r4=r+r/4;r3=r/3;
bx=[ 0 0 0 -r -r -r4 -r4 r4 r4 -r r r];
by=[r3 -r3 0 0 -r -r -r4 -r4 -r -r -r 0];
coords(:,1)=[bx rx rx1 rx2]'+x0;
coords(:,2)=[by ry ry1 ry2]'+y0;

%%%%%%%%%%%%%%%%%%%%%%%%

function [coords]=rotate2D(coord,theta,x0,y0)
th=theta*pi/180;
c=cos(th);s=sin(th);fact=[c s;-s c];
coords=coord*fact;
coords(:,1)=coords(:,1)+x0;
coords(:,2)=coords(:,2)+y0;

2 則留言:

幻雨齋 提到...

b94607012 生機(二) 楊善喬

程式非常的完善
看的出有用心
可惜註解好像相對來說少了點
不過整體還是很令人滿意的

曾智威 提到...

作業寫的很詳細
不會有跳脫的感覺