5/16/07

第十章 10.7 擺動從動件之畫圖

擺動式從動件若採用梢型,其應用則如參考書中之第8.34圖所示。其繪圖程式如swingpincam.m。其呼叫語法如下:
function [x,y]=swingpincam(cth,r0,s,a,range,pattern,cw)

其中之輸入參數定義如下:
cth:凸輪角度,度數
r0:凸輪基圓半徑
a:凸輪軸與從動件軸間距
s:從動件衝程
cw:凸輪轉動方向(反時鐘為正,順時鐘為負)
pattern  = 運動的型式,二元素之列矩陣,其代碼如下:
      1:等速運動uniform 2:抛物線parabolic 3:簡諧simple harmonic
      4:擺線cycloidal 5:多項式polynomial motion
      e.g. [4 3]:升程為擺線運動cycloidal;返程為簡諧運動harmonic motion
range    =升程及返程之範圍,三元素列矩陣 e.g.[90 180 240]升程始於90 度,
      止於180度;返程始於240 度,止於360。


程式內容
function [x,y]=swingpincam(cth,r0,s,a,range,pattern,cw)
% Find the cam curve with a swing-pin as fig. 8.34
%Inputs:
%  cth:angle of cam, degrees
%  r0:radius of base circle
%   a:distance between two axis for cam and swing pin
%   A0:inclined angle of pin, radians
%   s:stroke
%   cw:rotation direction of cam(-counterclockwise,+clockwise
%pattern  = denote the type of motion used(a 3 element-row matrix)
%         1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
%         5:polynomial motion
%         example [4 3]
%range    =the degrees the specific motion starts, eg.[90 180 240]
% Example: [x y]=swingpincam([10 60],5,2,10,[90 180 240],[4 3],-1)
figure(1);
clf;
th=cth*pi/180;
A0=asin(r0/a);
m=a*cos(A0);
for i=1:length(cth)
t=th(i)*cw;
B=[cos(t) -sin(t);sin(t) cos(t)];
[ym,yy,yyy]=dwell(cth(i),range,pattern);
AA=A0+ym*s/m;
Sx=[0 a-m*cos(AA) a;0 m*sin(AA) 0];
X=B\Sx;
x(i)=X(1,2);y(i)=X(2,2);
line(X(1,1:2),X(2,1:2));
line(X(1,2:3),X(2,2:3),'linewidth',3,'color','red')
line([X(1,:) X(1,1)],[X(2,:) X(2,1)]);
end
hold on;
line([0 a a-m*cos(A0) 0],[0 0 m*sin(A0) 0],'linewidth',3,'color','blue')
plot([0 x],[0 y],'bo',x,y,'k-')
plot(r0*cos(th),r0*sin(th),'b-')
axis equal


執行例:
>> [x y]=swingpincam(0:10:360,5,2,10,[90 180 240],[4 3],-1)