5/18/07

第十二章 齒列(2)

範例10.1


圖10.6之共軸齒列中若主從動齒輪之轉速比VR為10,且兩者之齒數需不得小於15齒時,求主從組合之徑節及齒輪4與5之齒數(齒輪2與齒輪3分別為20及30齒)。

[解]:

因為速度比之關係為:
VR=w2/w5 = (-H3/N2)(-N5/N4) =(-30/20)(-N5/N4) = 10



N5=N4/{N3/[R2 x RV]}=(20/3)N4


由於本題為共軸,下面各齒輪之直徑關係應成立:

D2 + D3 = D4 + D5


注意左邊之徑節Pd2應相同,但可以不同於右邊之徑節Pd4。即:
Pd2=Pd3=N2/D2=N3/D3
Pd4=Pd5=N4/D4=N5/D5


代入上式,得:
[N2 + N3]/Pd2 = [N4 + N5]/Pd4


將 之通式代入上式,可得 :

N4=(Pd4/Pd2)[N2+N3]/{1+)N2/N3)VR}=6.52(Pd4/Pd2)


利用MATLAB程式函數coaxial_trains()之運算如下:
function coaxial_trains(rv,n2,n3,teeth_limit,pitch_list)


輸入參數:

rv:速度比。
n2,n3:第一齒輪組合之齒數。
teeth_limit:所選齒輪之最低齒數。
pitch_list:可被選用之齒輪周節選單。

程式10.1
function coaxial_trains(rv,n2,n3,teeth_limit,pitch_list)
%
%prog 10.1
% pitch_list is a row vector for listing pitches of gears
% rv: velocity ratio
% teeth_limit:number of teeth limit for gears
% n2,n3: no. of teeth for the first pair gears
% Example:
%     pitch_list=[1:.25:2,2.5,3,3.5,4:2:18,20:4:56]
%     coaxial_trains(10,20,30,15,[1:.25:2,2.5,3,3.5,4:2:18,20:4:56])
nlist=length(pitch_list);
fact=n3/n2/rv;
['           N4       N5       Pd2      Pd4']
for i=1:nlist
pd2=pitch_list(i);
for j=1:nlist
pd4=pitch_list(j);
for k=teeth_limit:200
n4=k;
n5=n4/fact;
n4f=(n2+n3)/(1+1/fact)*(pd4/pd2);
if  fix(n5)==n5 & abs(n4f-n4)<0.1
[n4,n5,pd2,pd4]
end
end
end
end

執行例:設RV=10,N2=20,N3=30 及 最低齒數=15,求其可能之組合。

>> coaxial_trains(10,20,30,15,[1:.25:2,2.5,3,3.5,4:2:18,20:4:56])
ans =    N4   N5    Pd2   Pd4
ans =    87   580    1.5   20
ans =   174  1160    1.5   40
ans =    15   100   1.75    4*
ans =    87   580     3    40
ans =    15   100    3.5    8*
ans =    24   160    12    44*
ans =    15   100    14    32*
ans =    18   120    16    44*
上述中徑節比較接近的如具星號的組合。程式之輸入項中,pitch_list為業界所使用之可能徑節。

10-2.5複式齒輪組之設計

前面討論的齒輪組中,其速度比之計算較為直接而且容易,但若需要設計一套合乎預定轉速比之齒輪組時,則必須反向設計。換言之,先就已知齒輪組的轉速比決定各齒輪之齒數,此時計算之步驟變為相當複雜,而且必須使用嚐試與錯誤的方法。當然利用電腦進行演算則可以加快整個反設計之過程。本節將舉例介紹這種反向的演算法。 10-2.5.1 設計步驟 範例10.3設計一組複式齒輪使其轉速比為180。 [解]: 開始時,假設要設計一組複式齒輪使其轉速比為180。其考慮的因素及過程如下:
  • 1. 決定組合數:複式齒列可用串聯多個組合之方式達到整體轉速比。設計總是由最簡單的結構開始,由於每組之轉速比以維持在10以內為佳,超過此值時則需考慮增加齒輪組數。因此轉速比為180時必須用較多的組數才成達到目標。首先,將180開方,其值為13.416,仍然比10大,故使用兩組組合仍嫌不足,如將180開立方,其值為5.646,低於10甚多,故使用三組齒輪之組合。
  • 2. 若能直接找到轉速比為5.646之齒輪組合時,應是最好的選擇,因為只要將這種組合串聯三組即可。設驅動之小齒輪數最小為12齒(N2>=12)*,則依序可以得到對應大齒輪之齒數如下:
N3=5.646x12=67.75
N3=5.646x13=73.40
N3=5.646x14=79.06
N3=5.646x15=84.69
  • 3. 大齒輪齒數必須為整數。由上列之數值中,最接近整數者為79.06,故選用轉速比79:14是最佳選擇,串聯三組此轉速比之組合應可得到總轉速比為 (79/14)3=179.68,其值與理想比值180之誤差約0.2% 。若此複式齒輪作成之變速齒輪箱不作為計時之用,而僅作一般吊車的變速系統,則此項差異應可接受。其齒數順序為14:79;14:79;14:79等三組。
  • 4. 由於大部份製造機械均需要正確的轉速比,以免產生脫序運動。這時硬要三組之轉速比均相等並不一定適當,有些時候,可以就總轉速比值之性質求得不同組合之轉速比。起先仍可由180之開立方值出發,由其值5.646之近似整數如6開始。兩組串聯可得比值為36:1,再由180除以36可以得最後組之轉速比為5。則三組合之轉速比分別為6, 6, 5。若小齒輪為14齒,則其對應大齒輪分別為84, 84, 70。其齒數序為14:84,14:84,14:70。此處小齒輪採用14齒係因在壓力角25度時,可以防止內切的最小齒數。
10-2.5.2 實例應用

範例10.4 試設計一套如圖10.6之共軸齒列,令其輸入與輸出軸之轉速比VR=18。

[解]:

相關步驟說明如下:

  • 1. 雖然VR不一定為整數,但若為整數則會使解題更為簡化。
  • 2. 將VR=18開平方,得4.2426,其值小於每組合應低於10之限制,故可使用兩組合串列的方式,構成一齒列。
  • 3. 若能找到將一組正好等於4.2626之轉速比時即可使用雙組同比值的方式,其軸距即可相同,並符合共軸之條件。其步驟是先以小齒輪最低齒數12開始,相乘之,利用MATLAB指令可計算如下:
>>VR=18;  %整組之轉速比設為18。
>>mr=sqrt(VR); %以開方先取得單組轉速比估計值。得mr=4.2426。
>>T1=[12:40]’; %先設定驅動輪由12齒開始至40齒可能範圍,行矩陣。
>> T2=round(T1.*mr); %以估計值計算被動齒輪之齒數。
>>VR2=(T2./T1).^2; %計算實際之總轉速比。
>>Diff=(VR2-VR)/VR*100;%求其誤差百分比。
>>[T1 T2 VR2 Diff]  %列出相關值
ans =
12.0000   51.0000   18.0625    0.3472
13.0000   55.0000   17.8994   -0.5588
14.0000   59.0000   17.7602   -1.3322
15.0000   64.0000   18.2044    1.1358
16.0000   68.0000   18.0625    0.3472
17.0000   72.0000   17.9377   -0.3460
18.0000   76.0000   17.8272   -0.9602
19.0000   81.0000   18.1745    0.9695
20.0000   85.0000   18.0625    0.3472
21.0000   89.0000   17.9615   -0.2142
22.0000   93.0000   17.8698   -0.7231
23.0000   98.0000   18.1550    0.8612
24.0000  102.0000   18.0625    0.3472
25.0000  106.0000   17.9776   -0.1244
26.0000  110.0000   17.8994   -0.5588
27.0000  115.0000   18.1413    0.7849
28.0000  119.0000   18.0625    0.3472
29.0000  123.0000   17.9893   -0.0595
30.0000  127.0000   17.9211   -0.4383
31.0000  132.0000   18.1311    0.7284
32.0000  136.0000   18.0625    0.3472
33.0000  140.0000   17.9982   -0.0102
34.0000  144.0000   17.9377   -0.3460
35.0000  148.0000   17.8808   -0.6621
36.0000  153.0000   18.0625    0.3472
37.0000  157.0000   18.0051    0.0284
38.0000  161.0000   17.9508   -0.2732
39.0000  165.0000   17.8994   -0.5588
40.0000  170.0000   18.0625    0.3472
其中第一行為驅動軸由12齒至40齒之變化;第二行為轉速比維持4.2626時之被動輪齒數(整數);第三行為實際計算之轉速比;最後一行為計算誤差百分比。就所得之值觀察,T1=12之誤差為0.3472%,差強人意。最小者為T1=33,其誤差為-0.0102%,不過被動輪為140齒,顯然嫌大些。
  • 4. 採用18之質因數,並將兩組合設成不同轉速比。在每組VR值不超過10之情況下,其可能集合有[9X2]、[6X3]等兩種。在齒輪組的考慮中應選齒數較不懸殊的組合,故取[6X3]。
  • 5. 設兩組速度比之組合為[6X3]。原則上小齒輪應不小於12齒,故所選的組合必須乘一個係數。至於選取何係數,兩個組合可以不同。
  • 6. 基於共軸,各組合間之齒數關係如下,且設等於常數K:
N2 + N3 = N4 + N5 = K
VR = w2/w3 = (-N3/N2)(-N5/N4)=N3N5/(N2N4)
  • 7. 要解上兩式,前一組合之VR=6,後一組合之VR=3,則
N3/N2=6   therefore, N3=6N2
N5/N4=3   therefore, N5=3N4
  • 8. 聯合上面之公式,可得下面之結果:
K = 7N2   K=4N2
  • 9. K值之最小公倍數應為28,因此N2=4,N4=7。
  • 10. 為防止內切的問題,壓力角為25度時之最小齒數應為12齒,故N2及N4應乘三倍,即得此齒列之兩組合之齒數分別為N2=12,N3=72;N4=21,N5=63。

10-2.5.3謝福吉(Selfridge)法

同軸複式齒列但具有非整數轉速比設計問題則較為複雜。有些齒列之轉速比不但非為整數,有時為無理數,尤其當英制系統轉為公制或有π的常數隱藏其中時,更無法以整數比作出近似之組合。故如何找出近似的比值相當重要。下面介紹的計算法稱為謝福吉(Selfridge)法,通常可應用到三個組合以內之演算。 設齒數之最高及最低齒限分別為Nmax、Nmin,其容許誤差為ε,則因
VR =N3N5/(N2N4)
轉速比之最高與最低範圍為
VRhigh=VR + e; VRlow=VR - e
VRlow<=N3N5/(N2N4)<=VRhigh
由於齒數需為整數,其最大及最小齒數為Nmax、Nmin,其關係如下:
Nmin=ceil(N2N4VRlow<=N3N5<=fix(N2N4VRlow)=Nmax
式中,函數CEIL()表示將取接近數值之高整數;而函數FIX()則取接近數值之低整數。

10-2.5.4 MATLAB程式函數

利用電腦重複測試之能力可以找出合適之齒數,使其值落於Nmax與Nmin之間。 其MATLAB程式函數two_stage_trains()如下:
function [result,counter]=two_stage_trains(rv,nmin,nmax,epx)
此程式處理兩組合齒輪組。輸入參數為: rv:速度比。 nmin:最低齒數限。 nmax:最高齒數限。 epx:容許誤差。 輸出則為RESULT及counter。前者包括齒輪2及3之齒數,該組之轉速比;齒輪4及5之齒數,該組之轉速比;總轉速比及誤差。counter為計數實際無法達成之次數,程式中每連續試一次無法達到原設定之容許誤差時,誤差值會自動加倍,直到得到較滿意的答案為止。 程式10.2
function [RESULT,counter]=two_stage_trains(rv,nmin,nmax,epx)
%
%prog 10.2
% Find the grear teeth for the set of coaxil gear trains
% rv: velocity ratio
% nmax,nmin:max.& min. number of teeths can be used for gears
% epx: error
% RESULT:a row matrix of eight elements, including
%   N2   N3  RV1    N4   N5  RV2      RV      error
% Example:
%     two_stage_trains(pi,15,100,3.1416e-5)
epsx=epx;
counter=0;
['  N2   N3  RV1    N4   N5  RV2    RV    誤差']
ok=1;
while ok,
ss=1;
rv_h=rv+epx; rv_l=rv-epx;
nh3=fix(nmax^2/rv_h);
nh4=fix(nmax/sqrt(rv_h));
for pin1=nmin:nh4
nhh=min(nmax,fix(nh3/pin1));
for pin2=pin1:nhh
tm=fix(pin1*pin2*rv_h);
tn=ceil(pin1*pin2*rv_l);
if tm>=tn
nm=max(nmin,fix((tn+nmax-1)/nmax));
np=sqrt(tm);
for k=tn:tm
for gear1=nm:np
if (mod(k,gear1))==0
gear2=k/gear1;
error=(rv-k/(pin1*pin2));
if error<=epx
ratio1=gear1/pin1;
ratio2=gear2/pin2;
ratio=ratio1*ratio2;
result(ss,:)=[pin1,gear1,ratio1,pin2,gear2,ratio2,ratio,abs(error)];
ss=ss+1;
end
end
end
end
end
end
end
if ss==1
epx=epx*2;
counter=counter+1;
else
ok=0;
end
end
RESULT=sortrows(result,8);
執行例: 設計一同軸複式齒例,其轉速比為π,最高齒數為100齒,最低為15齒,容許誤差為e-5π。 執行two_stage_trains()函式,結果如下:
>> a=two_stage_trains(pi,15,100,3.1416e-5)
ans =
N2   N3  RV1    N4   N5  RV2      RV      誤差
a =
25        51      2.04      50        77         1.54       3.1416  7.3464e-006
29        88    3.0345      85        88       1.0353       3.1416  1.0503e-005
22        62    2.8182      61        68       1.1148       3.1416  1.2922e-005
33        68    2.0606      61        93       1.5246       3.1416  1.2922e-005
43        77    1.7907      57       100       1.7544       3.1416  1.7786e-005
28        85    3.0357      86        89       1.0349       3.1416  1.8642e-005
43        85    1.9767      56        89       1.5893       3.1416  1.8642e-005
23        75    3.2609      82        79      0.96341       3.1416  2.3194e-005
41        75    1.8293      46        79       1.7174       3.1416  2.3194e-005
17        54    3.1765      91        90      0.98901       3.1416  2.8336e-005
17        60    3.5294      91        81      0.89011       3.1416  2.8336e-005
16        63    3.9375      94        75      0.79787       3.1416  2.9687e-005
32        63    1.9688      47        75       1.5957       3.1416  2.9687e-005
經過排序之結果,誤差最小之組合為: N2:N3=25:51, N4:N5=50:77。

10-6 行星齒輪的組合

圖10.22 李維列舉之12種可能的行星系列(1-Arm,2-Sun) 行星齒輪系存在各種型式,李維氏(Levai)針對其構造作成12種基本模式,如圖10.22,其中1代表旋轉臂;2代表太陽齒。利用這些基本之組合可以變化其他較為複雜的組合。這個組合中,必須確定兩件事:一為各模式中,各齒輪之尺寸是否合適。其二是其相關之轉速比如何。茲就這兩方面進行討論。 齒輪之尺寸 基本上齒輪之尺寸與各模組之組合有關。為配合齒輪組之空間,各齒輪之直徑應有一定的規範,尤其內齒輪與外齒輪間之契合,必須兩者之齒輪直徑能夠相互容納。就圖10.22所示之12種模式下,其尺寸關係如下:
模式1: D2 + 2D3 = D4
模式2: D2 + 2D3 +2D4 = D5
模式3: D2 + 2D3 +D4 -D5= D6
模式4: D2 + D3 +D4+ 2D5 = D6
模式5: D2 -D3 +D4 + 2D5= D6
模式6: D2 +D3 +D4 = D5
模式7: D2 + D3 -D4 = D5
模式8: D2 -D3 +D4 = D5
模式9: D2 - D3 +D4 +D5 +D6= D7
模式10: D2 + D3 +D4 +D5 +D6= D7
模式11: D2 - D3 +D4 +D5 -D6= D7
模式12: D2 + 2D3 +D4 +D5 +D6= D7                                  (10.37)
根據公式9.12,齒輪之直徑與齒數之關係為徑節。故公式10.37要化為各齒輪之齒數N時,必須以其對應直徑D與徑節Pd相乘。一對齒輪相契合時,其徑節必須相同,但對於同軸之另外其他對之齒輪則不一定有此限制。此在本章第2.5節中已有詳述。為使本項目討論過程簡化,可以假設整組模式所使用之齒輪徑節均相同。如此,公式10.37內之直徑D亦可直接更換為齒數N使用。 值得一提的是,在模式5、8、11中,因為輸入為內齒輪,故內齒輪之直徑應大於與其契合的外齒輪,其條件為D2 > D3。此條在驗證時必須設法加入,以免輸入不合理的齒輪直徑。 模組之性能 要探討各模組的性能,主要是討論太陽齒輪之輸入軸、輸出軸、托臂及其轉速比等。圖10.22中每組僅有三個輸出入口,這三個軸之一可以固定,並令其他兩組分別為輸出入。其間之關係則可用公式法進行計算,而其速度比則可固定托臂,再視其輸出入之齒數比。計算公式如下: (10-38) 各組之轉速比VR分別為:

模式1: VR= - N4 /N2 模式2: VR= + N5 /N2 模式3: VR= -( N4 /N2 )x (N6 /N5) 模式4: VR=+( N3 /N2 )x (N6 /N4) 模式5: VR= -( N3 /N2 )x (N6 /N4) 模式6: VR= -( N3 /N2 )x (N5 /N4) 模式7: VR= + ( N3 /N2 )x (N5 /N4) 模式8: VR= +( N3 /N2 )x (N5 /N4) x (N7 /N6) 模式9: VR= - ( N3 /N2 )x (N5 /N4) x (N7 /N6) 模式10: VR=+ ( N3 /N2 )x (N5 /N4) x (N7 /N6) 模式11: VR= - ( N3 /N2 )x (N5 /N4) x (N7 /N6) 模式12: VR=+ ( N4 /N2 )x (N6 /N5) (10.39)

有各組之轉速比VR之後,即可計算三個轉間之實際轉速,設第一軸、托臂及最後軸之轉速分別為ωF、ωA、ωL,根據公式10.38可以分別改寫如下: 一、求第一軸:   ωF=VRx(ωL-ωA)ωA            (10.40) 二、求最後軸: ωL=(ωF-ωA)/VR+ωA (10.41) 三、求托臂: ωA=(VRxωL-ωF)/[VR-1] (10.42)

程式應用

下面是利用MATLAB撰寫之函式程式planetary(),可以直接解圖10.22中各模組之關係,其呼叫格式如下:
function [WF,WA,WL,RV]=planetary(wf,wa,wl,gearset,mode)
其中之參數: wf, WF:第一輸入軸之角速度,ωF(rad/s)。 wl, WL:最後齒輪軸之角速度,ωL(rad/s)。 wa, WA:旋轉臂之角速度,ωA(rad/s)。 gearset:齒輪之齒數組合(由第二個齒輪算起),列矩陣。 mode: 行星齒輪組之型式代碼(1~12, 參考圖10.22)。 執行上項函式時,輸入wf, wa, wl三個參數中,可容許一個為未知,其未知參數可用[]取代,但不能用0,因為0將認為該軸靜止不動或固定。若不知各組之齒輪數目及搭配之尺寸,則可設gearset=[],程式會自動產生一個例子,可以代入執行。然後再設法修正。程式會自檢測所輸入之組合齒數是否適當,讀者可以自行檢驗。 程式內容:
function [WF,WA,WL,RV]=planetary(wf,wa,wl,gearset,mode)
%Program for section 10.6 to solve Levai's models
% Find angular velocities of sun,arm and planetary
% Variables:
%    wf,WF:angular vel. for the 1st input shaft
%    wl,WL:angular vel. for the last input shaft
%    wa,WA:anbular vel. for the arm shaft.
%    gearset:no of gear tooth in row matrix [n1 n2,..]
%    mode:types of gear set (1~12, as in Fig. 9.22)
%Note:one of wf, wl & wa can be unknown and replaced by [].
%     if leave gearset in [], the program will respond
%        an example that matches the specific mode.
% Example:[WF,WA,WL,RV]=planetary(60,1,[],[18 30 28 20],7)
% Designed by D. S. Fon, Bime of NTU, dated March 8,2003
% Revised: March 9, 2006
% preset signs for each set
sinx=[-1 +1 -1 +1 -1 -1 +1 +1 -1 +1 -1 +1];
example={'[15 45 105]','[18 15 12 72]','[30 15 12 18 54]',...
'[30 15 20 20 105]','[80 15 12 30 137]','[40 15 20 75]'...
,'[80 20 40 60]','[100 30 50 120]','[80 15 12 18 12 107]'...
,'[60 30 15 30 15 150]','[40 20 12 20 40 52]',...
'[60 30 12 30 162]'};
WA=0;WF=0;WL=0;RV=0;
gearmin=12;
mode(mode>12)=12;
if isempty(gearset)
disp('Example: ')
example(mode)
return
end
gearset=[mode gearset];
[code,ge]=examset(mode,gearset,gearmin);
switch code
case 2
disp('The last gear size has been modified.')
ge(2:end)
case 3
disp('Error occurs in size matching')
return
end

% set up the no of gears required in the mode.
switch mode
case 1, rv=ge(4)/ge(2)*sinx(1);
case 2, rv=ge(5)/ge(2)*sinx(2);
case 3, rv=ge(4)/ge(2)*ge(6)/ge(5)*sinx(3);
case {4,5}, rv=ge(3)/ge(2)*ge(6)/ge(4)*sinx(mode);
case {6,7,8},rv= ge(3)/ge(2)*ge(5)/ge(4)*sinx(mode);
case {9,10,11},rv= ge(3)/ge(2)*ge(5)/ge(4)*ge(7)/ge(6)*sinx(mode);
otherwise
rv= ge(4)/ge(2)*ge(6)/ge(5)*sinx(mode);
end
if isempty(wa), wa=(rv*wl-wf)/(rv-1);
elseif isempty(wf), wf=rv*(wl-wa)+wa;
else  wl=1/rv*(wf-wa)+wa;
end
WA=wa;WF=wf;WL=wl;RV=rv;

function [code,ge]=examset(mode,gearset,gemin)
% Check the proper gear set imported
% set up the no of gears required for a mode.
max_item_no=[4 5 6 6 6 5 5 5 7 7 7 6];
code=1;
%Forcing the minimum required teeth in a gear.
gearset(gearset<gemin)=gemin;
itemmax=max_item_no(mode);
item_no=length(gearset);
if itemmax>item_no,
gearset=[gearset ones(1,12)*12];
gearset=gearset(1:item_no);
end
ge=abs(gearset);
switch mode
case 1, gtmp=ge(2)+2*ge(3);
case 2, gtmp=ge(2)+2*ge(3)+2*ge(4);
case 3, gtmp=ge(2)+2*ge(3)+ge(4)-ge(5);
case 4, gtmp=ge(2)+ge(3)+ge(4)+2*ge(5);
case 5, gtmp=ge(2)-ge(3)+ge(4)+2*ge(5);
case 6, gtmp=ge(2)+ge(3)+ge(4);
case 7, gtmp=ge(2)+ge(3)-ge(4);
case 8, gtmp=ge(2)-ge(3)+ge(4);
case 9, gtmp=ge(2)-ge(3)+ge(4)+ge(5)+ge(6);
case 10, gtmp=ge(2)+ge(3)+ge(4)+ge(5)+ge(6);
case 11, gtmp=ge(2)+ge(3)+ge(4)+ge(5)-ge(6);
case 12, gtmp=ge(2)+2*ge(3)+ge(4)+ge(5);
end         
if ge(itemmax)~=gtmp,
ge(itemmax)=gtmp;
code=2;
end
if mode==5|mode==8|mode==9,
if ge(2)<ge(3), code=3;end
end
執行例一:使用其內部設定之範例,設定mode=3。
>> [WF,WA,WL,RV]=planetary(60,1,[],[],3)
Example:
ans =
'[30 15 12 18 54]'
WF =
0
WA =
0
WL =
0
RV =
0
再將上值代入,執行結果:
>> [WF,WA,WL,RV]=planetary(60,1,[],[30 15 12 18 54],3)
WF =
60
WA =
1
WL =
-48.1667
RV =
-1.2000
執行例二:如圖10.14及範例10.6所述之型式如圖10.22之第一型,其中N2=15,N3=45,N4=105。若N4內齒輪固定,旋臂(連結N3齒)每轉一圈(即ωA=1),則執行下列指令並得結果如下:
>> [WF,WA,WL,RV]=planetary([],1,0,[15 45 105],1)

WF =     8
WA =     1
WL =     0
RV =     -7
執行例三:如圖10.15及範例10.8設其旋轉臂轉速ωA為1 rad/s,而N2=A20=20,N3=B60=60,N4=D40=40,N5=E120=120,N6=C140=140。由圖10.15可知,本齒輪可由圖10.22中之第一型與第六型綜合。故開始時可利用第一型先求出輸入軸A對應旋轉臂之轉速,然後依第六型求得齒輪E之轉速。即
>> [WF,WA,WL,RV]=planetary([],1,0,[20 60 140],1)
WF =     8
WA =     1
WL =     0
RV =    -7
由其結果得到ω2=8 rad/s。其次依第六型求輸出軸E如下:
>> [WF,WA,FL,rv]=planetary(WF,1,[],[20 60 40 120],6)
WF =     8
WA =     1
WL =    0.22222
RV =    -9
由其結果得到ωE=0.22222 rad/s。其中WF為利用上式所得的結果。

5/17/07

第十二章 齒列(1)

9-1.3滾動錐角之計算



9-1.3.1外接錐之錐角比
就圖9.5所示,滾動接觸點應沿著OP線,令其頂點為O。則兩錐角之和與合錐角之關係如下:
Σ=γ2+γ3                                                9.6


各錐與錐角之函數關係為:
sinγ2  = AP/OP ;  sinγ3 =BP/OP                          9.7

sinγ2/sinγ3= AP/BP =ω3 /ω2 = sin (Σ-γ3)/sinγ3       9.8

改寫上式,得:
[sinΣ cosγ3 - cosΣ sinγ3 ]/ sinγ3=ω3 /ω2       9.9


左邊分子分母各除以cosγ3可以解tanγ3,得到
tanγ3= sinΣ / [ω3 /ω2 + cosΣ]                    9.10


公式9.10可用電腦程式計算,亦可利用圖解法。例如要作一轉速比ω2 :ω3 = 5:3比例之圓錐,設合錐角Σ為60度,其MATLAB之程式如下:
function [gama1,gama2]=bevel_angle(omega,sigma,mode)
%
% Demo9.1:
%      [gama1,gama2]=bevel_angle(omega,sigma,mode)
% mode:1 for outer set; -1 for innner set
% sigma: combined angle, degrees
% omega: angular velocity ratio=w1/w2, decimal
% gama1: cone angle for gear 1, degrees
% gama2: cone angle for gear 2, degrees
% Examples:[gama1,gama2]=bevel_angle([1 2 3 4 5],45,1)
d2g=pi/180;
sa=sigma*d2g;
gama1=atan(sin(sa)./(omega+mode*cos(sa)))/d2g;
gama2=sigma-mode*gama1;



-------------------------------------------
執行例一:ω1 /ω2 =5/3;Σ=60;
>> [gama1,gama2]=bevel_angle(5/3,[60],1)
gama1 =   21.7868
gama2 =   38.2132


執行例二:ω1 /ω2 =5/3;Σ=[60 50 40 30];
>> [gama1,gama2]=bevel_angle(5/3,[60 50 40 30],1)
gama1 =   21.7868   18.3506   14.8008   11.1676
gama2 =   38.2132   31.6494   25.1992   18.8324


9-1.3.2內接錐之錐角比



若兩錐組合一為內輪γ2,外輪γ3,則上述公式更改如下:
tanγ3= sinΣ / [ω3 /ω2  - cosΣ]              9.10


利用電腦程式執行如下:

執行例三:ω1 /ω2 =7/3;Σ=[ 30];內接錐
>> [gama1,gama2]=bevel_angle(7/3,[30],-1)
gama1 =   18.8171
gama2 =   48.8171

執行例三:ω1 /ω2 =[7/3 5/3 4/3]7/3;Σ=[ 30];內接錐
>> >> [gama1,gama2]=bevel_angle([7/3 5/3 4/3],[30],-1)
gama1 =   18.8171   31.9848   46.9357
gama2 =   48.8171   61.9848   76.9357


9-7.2齒輪之接觸比



齒輪作用之另一重要特性為接觸比(Contact ratio),亦即在同一時間內有多少對牙齒同時相互嚙合。其對數愈多,表示各對牙齒所承受的負荷較輕,力量之傳遞也愈為均勻;對數愈少,齒牙負荷相對愈重,若接觸比小於1,即表示在某些時候可能沒有齒牙配對,則這兩對齒輪在力的傳遞上就會發生不均勻的問題。一般之接觸比應不小於1.2,亦即80%的時間是兩對牙齒共同協力作業,而約有20%的時間,僅有一對負責傳遞的工作。

長度之計算
圖9.24中之兩齒輪顯示其喫合在兩個位置,一為接觸開始時,一為離開時。在這兩點間,接觸點沿著壓力作用線MN方向移動,發生接觸係自A開始,是為壓力線與齒輪2之齒冠交點;離開點B則為壓力線與齒輪3之齒冠交點。F與G點為齒輪2之齒形在接近點A與離開點B時與節圓相交的兩點;同理,D與E為齒輪3在其節圓之對應點。由於兩節圓相互滾動接觸,故此兩點構成的弧長應相等。

圖9.24 兩齒輪之接觸長度


兩齒輪之接觸路徑應等於基圓切線上之線段AB,設兩對齒輪之齒冠均為a,則其長度為LAB:

接觸比之計算



接觸比mc應為接觸路徑長度與基周節之比,其公式如下:

作用角



對齒輪2與3 而言(圖9.24),其節圓上之作用弧(Arcs of action)為FPG及DPE,其對應角θ2與θ3,稱為作用角。作用角由接近角與退遠角組成,接近角(Angle of approach)則為兩齒輪接觸之點開始至節點間之夾角,分別α2與α3其對應弧分別為弧FP與DP,而其角度應以切線MN上之對應線段FP與DP與其基圓周節相除得之(圖9.25):

圖9.25

退遠角(Angle of recess)則是齒輪自節點開始至離開不接觸時之角度,或β2與β3,對應線段則為PG與PE。同理可表示如下:




通常接近角與遠退角不相等。作用角則為上述兩角之和,如公式(9-31)及(9.32)

9-7.2.4 MATLAB程式



上式9.25可以用MATLAB函式contact_ratio()計算,此函式之輸入值為徑節、兩齒輪之齒數及壓力角,輸出項包括公式9.26至公式9.32所計算之結果。其中之參數ag則為列矩陣,依序儲存兩齒輪之接近角、退遠角與作用角。其呼叫格式如下:

function [c_ratio, c_length, ad, pc, pb, d2, d3, ag] =
contact_ratio(pd, n2,n3, phi)

其中輸入參數:
Pd:徑節
n2, n3:兩齒輪之齒數
phi:壓力角

輸出參數:
cr_ratio:接觸比
cr_length:接觸長度
ad:齒冠
pc, pb:周節及基周節
d2, d3:兩齒輪節圓直徑。
ag:兩齒輪之接近角、遠退角及作用角 =
function [c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(pd,n2,n3, phi)
%
%Find the contact ratios
% Inputs:
%        Pd: Diametrial pitch;
%      n2,n4:number of both gears;
%        phi: pressure angle, degrees
% Outputs:
%    c_ratio, c_length: contact ratio and length
%       ad:addendium
%    pc,pb: circular and basic circular pitches
%    r2, r3: radii of pitch circles
%    ag: angles of action, in matrix of
%       [alpha2 beta2 theta2 alpha3 beta3 theta3]
% Example: [c_r,c_l,ad,pc,pb,d2,d3,ag]
%                       =contact_ratio(6,24,48,20)
% Revised: March 9, 2006
d2g=pi/180;
pangle=phi*d2g;
cosx=cos(pangle);sinx=sin(pangle);
ad=1./pd;pc=pi./pd;
pb=pc.*cosx;
r2=n2./(2*pd);r3=n3./(2*pd);d2=2*r2;d3=2*r3;
rb2=r2.*cosx;rb3=r3.*cosx;
ax=sqrt((r3+ad).^2-(r3.*cosx).^2)-r3.*sinx;
xb=sqrt((r2+ad).^2-(r2.*cosx).^2)-r2.*sinx;
c_length=ax+xb;
c_ratio=c_length./pb;
ag1=[ax./rb2 xb./rb2 c_length./rb2]/d2g;
ag2=[ax./rb3 xb./rb3 c_length./rb3]/d2g;
ag=[ag1;ag2];


執行例一:

某對齒輪之周節為4,分別有24及48齒,其壓力角為20度,求其接觸比及相關資料。
>> [c_ratio, c_length,ad,pc,pb,r2,r3,ag]=contact_ratio(4,20,30,20)
c_ratio =    1.6052
c_length =    1.1847
ad =    0.2500
pc =    0.7854
pb =    0.7380
r2 =     5
r3 =    7.5000
ag =14.8816   14.0115   28.8932
9.9211    9.3410   19.2621

所得之資訊如下:

接觸比=1.6052
接觸長度=1.1847 吋
齒冠=0.25吋
周節pc=0.7854;基周節pb=0.7380
齒輪節圓直徑r2=5吋, r3=7.5吋
齒輪2之接近角=14.8816度;遠退角=14.0115度
作用角=28.8932度
齒輪3之接近角=9.921度;遠退角=9.3410度
作用角=19.2621度

執行例二:

某對齒輪之周節為5,分別有20及30齒,其壓力角為20及25度,求其接觸比及相關資料。
>> [c_ratio, c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(5,20,30,[20 25]')
c_ratio =
1.6052
1.4419
c_length =
0.9477
0.8211
ad =
0.2000
pc =
0.6283
pb =
0.5904
0.5694
d2 =
4
d3 =
6
ag =
14.8816   14.0115   28.8932
13.2629   12.6921   25.9550
9.9211    9.3410   19.2621
8.8419    8.4614   17.3033



指令中,壓力角之輸入以行型式輸入(即[20 25]' ),其結果亦以行之型式對應出現。其他變數亦可如此作對照。這種比較不限1X2行矩陣,也不限於僅使用於一個輸入變數,但需同大小之矩陣。若不需要後面之輸出項,則僅提及前面所需之項目即可。讀者可自行印證不同變數矩陣之應用,若使用矩陣輸入,以採用行向量型式為宜。

9-7.3齒厚之計算



為分析齒輪承受應力及其應變,需能計算齒輪在任何半徑下之齒厚。以圖9.26為例,某一齒牙之漸開線上,過節圓點P,令P對基圓作切點N,基於漸開線之繪製原理,知弧線BN應等於線段MP,故

圖9.26 漸開線函數之形成

9-7.3.1漸開線MATLAB函數



漸開函數可以查表或由計算程式中得知,而計算齒厚時,可以利用這一個漸開函數計算。用MATLAB之ainv()函式可以得到相對的答案,其呼叫格式如下:
function [epsilon, epsrad]=ainv(z)

其中,z為漸開函數值,得到之對應角度Φ為epsilon, epsrad,分別以度數及弧度表示。

function [epsilon, epsrad]=ainv(z)
% Find the inv funtion of involute angle.
% Using Secant's method.
% Input: z:(<2.2)
% outputs:epsrad, angle in radians
%              epsilon: angle in degrees.
e1=0.63166;z1=0.1;
e2=0.97502;z2=0.5;
ok=0;
while ~ok
e0=(z-z1)/(z2-z1)*(e2-e1)+e1;
z0=tan(e0)-e0;
if abs(z0-z)<1e-6;
break;
else
if z0>z2
z2=z0;e2=e0;
else
z1=z0;e1=e0;
end
end
if abs(z2-z1)<1e-6; break; end
end
epsrad=e0;
epsilon=epsrad*180/pi;



執行例:
>> [ep,eprad]=ainv(0.1)
ep =       36.191
eprad=      0.63166
>> [ep,eprad]=ainv(1)
ep=        64.874
eprad =      1.1323


範例9.14


試以Pd、N及壓力角為輸入,寫一MATLAB程式,計算齒冠圓、節圓及基圓處之齒厚,並求齒尖端處之半徑。

function [r,thickness,beta]=tooth_thick(N,Pd,phi0)
%
% Find the thickness of a tooth in a gear
% Inputs: N, number of teeth; Pd: diametrical pitch;
%            phi0, pressure angle, in degrees
% Output:  r, radii of base, pitch, addendum and point circles
%              thickness: row matrix of 4 elements as above.
%              beta: row matrix of 4 beta angles as above.
d2g=pi/180;
phi=phi0*d2g;
rp=N/Pd/2;
ra=rp+1/Pd;
cosx=cos(phi);
rb=rp*cosx;
tp=pi/Pd/2;
betaa=acos(rp*cosx/ra);
betap=phi;
betab=0;
ta=2*ra*(tp/rp/2+invx(phi)-invx(betaa));
tb=2*rb*(tp/rp/2+invx(phi));
[a,beta0]=ainv(tp/rp/2+invx(phi));
r=[rb rp ra rb/cos(beta0)];
thickness=[tb tp ta 0];
beta=[betab betap betaa beta0]/d2g;

function a=invx(x);
a=tan(x)-x;


執行例:
>> [r,thickness,beta]=tooth_thick(30,4,20)
r =            3.5238         3.75            4       4.1612
thickness =      0.47406       0.3927      0.18435            0
beta =            0           20          28.241       32.132


範例9.15


一標準全齒正齒輪以壓力角20度進行加工,其徑節為6,若在半徑2.1吋處之齒厚為0.1860吋,求其在基圓及節圓處之齒厚。

[解]

由表9.2之周齒厚為



若就問題9.15撰寫一MATLAB函式,輸入值為r, t, Pd及 phi,輸出為N, rp, rb, tb等。其內容如下:

[解]
function [rb, tb, rp,beta, N]=find_thick(r,t,Pd,phi0)
%
%Find the thickness of tooth at base circle
%Inputs: r, t: thickness t at a radius r
%           Pd,phi0: dia pitch and pressure angle in deg.
%Outputs: rb, tb: thickness tb at base circle rb
%              rp, beta,N: radius,beta and No. of teeth for the pitch circle
d2g=pi/180;
phi=phi0*d2g;
cosx=cos(phi);
mm=pi*cosx/4/Pd/r;
kk=invx(phi)-t/2/r;
x1=phi;x2=phi/2;
f1=funcx(x1,mm,kk);
f2=funcx(x2,mm,kk);
ok=0;
while ~ok,
x=x1-f1*(x2-x1)/(f2-f1);
f=funcx(x,mm,kk);
if abs(f)<1e-5, ok=1; end
x2=x1;f2=f1;f1=f;x1=x;
if f1==f2, ok=1; end
end
beta=x/d2g;
N=2*Pd*r*cos(x)/cosx;
rp=N/Pd/2;
rb=rp*cosx;
tb=2*rb*(pi/N/2+invx(phi));

function [f]=funcx(beta,mm,kk)
f=mm/cos(beta)+kk-invx(beta);

function a=invx(x)
a=tan(x)-x;


執行例:

>> [rb, tb, rp,beta, N]=find_thick(2.1,0.186,6,20)
rb = 1.8794
tb = 0.30203
rp = 2
beta = 26.5
N = 24


範例9.17


一小齒輪與齒條機構中,令小齒輪之壓力角為20度,試求小齒輪與齒條運轉時不產生干涉之最小齒數為若干?

[解]

依據公式9.50
N = 2k/sin²ψ=2(1)/sin²(20) = 17.097~18T

故最低不干涉之齒數為18T

就上述之計算結果,試撰寫一MATLAB函式程式,計算參考書中表9.1中標準正齒輪系與一齒列產生干涉現象之最低齒數。

[解]
function [minT, value]=min_teeth(phi,k)
%
% Find the minimum teeth to avoid undercutting for standard gears
%  phi: pressure angle, in degrees
%  minT, value: Min. teeth and calculated value for the gear
%  k: coefficient(1 or 0.8)
if nargin<2
k=1;
end
d2g=pi/180;
sinx=sin(phi*d2g);
value=2*k./(sinx.*sinx);
minT=ceil(value);


執行例
>> [minT, value]=min_teeth([14.5 20 25 20],[1 1 1 0.8])
minT =    32       18      12       14
value =    31.903   17.097   11.198    13.678


其結果如參考書中之表9.1所示之數值。


範例9.19



有一對齒輪組,其壓力角為20o,兩輪之齒數分別為10T與30T,試問是否會產生干涉現象?

[解]
根據公式9.47,測試干涉之條件為:
(N2²+2N2 x N3)sin²>= 4 + 4N3


設N2=10T,N3=30T,Φ=20o 則

10(10+2*30)*sin²(20o)<4(1+30)

故會產生干涉。

範例9.20



設一組標準齒輪,壓力角為phi,齒數分別為N1、N2,試撰寫一MATLAB之程式,測試其是否發生干涉。

[解]

程式如下:
function [x]=isinterf(phi,N1,N2)
%
% Test if the gear set exists an interference
% phi:pressure angle, in degrees
% N1,N2:teeth of both gears
% x=0:no interference; x=1 interence exists
x=0;
sinx=sin(phi*pi/180);
if N2<N1,nn=N1;N1=N2;N2=nn;end
if N1*(N1+2*N2)*sinx*sinx<4*(1+N2), x=1;end



執行例:
>> isinterf(20,20,30)
ans =     0
>> isinterf(20,12,30)
ans =     1



範例9.21


一組標準齒輪其徑節為2,壓力角為14.5度,齒數分別為14T與16T。檢查是否會產生干涉?若發生干涉,則重新計算不產生干涉之齒冠高度及新的接觸比。

[解]

設小齒輪14T為齒輪2,16T為齒輪3。根據不干涉之條件為公式9.47之標準,即

(N2²+2N2 x N3)sin²>= 4 + 4N3


代入相關值,即
[14² + 2(14)(16)sin²(14.5)< 4 + 4(16)

或利用函式檢測:
>> isinterf(14.5,14,16)
ans =     1


顯然,此組齒輪有干涉現象。



不產生干涉之兩齒冠高度可利用公式9.44與9.48計算,令其為等式:

撰寫成程式如下:
function [a,r,AP,BP,length,mc]=addendum_cut(phi0,N1,N2,Pd)
%
% Find the shortening of addendum to avoid interferences
% Inputs: phi0:pressure angle, in deg.; N1,N2:No. of teeth
%            Pd:dia. pitch, or module in (1/Pd)
% outputs: a:row matrix for addendums [a1,a2,a1',a2',delta1,delta2]
%         AP,BP,length: contact length in portions and whole
%         mc: contact ratio
phi=phi0*pi/180;
cosx=cos(phi); sinx=sin(phi);
rp1=N1/Pd/2;rp2=N2/Pd/2;
r=[rp1 rp2];
a1=1/Pd;a2=a1;
aa1=sqrt((rp2*sinx+rp1*sinx)^2+(rp1*cosx)^2)-rp1;
if aa1>a1,
aa1=a1;
BP=sqrt((rp1+a1)^2-(rp1*cosx)^2)-rp1*sinx;
else
BP=rp2*sinx;
end
aa2=sqrt((rp1*sinx+rp2*sinx)^2+(rp2*cosx)^2)-rp2;
if aa2>a2,
aa2=a2;
AP=sqrt((rp2+a2)^2-(rp2*cosx)^2)-rp2*sinx;
else
AP=rp1*sinx;
end
a=[a1 a2 aa1 aa2 a1-aa1 a2-aa2];
length=AP+BP;
mc=length*Pd/pi/cosx;


執行例:
>> [a,r,AP,BP,length,mc]=addendum_cut(14.5,14,16,2)
a =   0.5    0.5   0.37406   0.30387  0.12594   0.19613
r =          3.5            4
AP =      0.87633
BP =       1.0015
length =    1.8779
mc =      1.2348

第十一章 齒輪(1)-漸開線

11.1 何謂漸開線(Involute)


漸開線常作為齒輪之齒面輪廊,使其接觸點能切於一點,其法線形成一壓力角。漸開線實際上是一捲繞在圓上之線往外拉開時,在同一點所走過的軌跡,亦即以一基圓為迴轉的平台,往外伸張的曲線。其表示式如下:
x = rb(cos(theta) + theta*sin(theta))
y = rb(sin(theta) − theta*cos(t))


其中,rb為基圓之半徑,theta為張開之角度,其單位為弧度。

當角度theta由零開始變化,亦即沿水平軸方向反時鐘方向展開,起始點始於基圓之表面,然後以螺線形往外延伸。依其延伸之角度,此曲線一直往外擴散。相關程式如involute_curve.m,其呼叫格式如下:
function h=involute_curve(rb,theta,mode,Nb)

其輸入參數如下:
rb=基圓半徑
theta = 展開角度,degrees
 Nb=區間之點數(預設值為100點)
 mode=控制參數,=1為單方向; =2 為雙方向

程式內容:
function h=involute_curve(rb,theta,mode,Nb)
% Create an involute curve
% Inputs:
%  rb=base radius
%  theta = max angle for limit, degrees
%  Nb=number of points
%  mode=1 for one direction, =2 for bi-direction
%  Example: involute_curve(5,720)
% Author:Din-sue Fon. BIME, NTU, March 10,2001
% Check the number of input arguments
if nargin<4,Nb=100;end
if nargin<3,mode=1;end
if nargin<2,theta=90;end
if nargin<1,rb=10;end
theta=theta*pi/180;
cth=linspace(0,2*pi,50);
if mode==1,
th=linspace(0,theta,Nb);
else
th=linspace(-theta,theta,Nb);
end
x0=rb*cos(th);y0=rb*sin(th);
x=rb*(cos(th)+th.*sin(th));
y=rb*(sin(th)-th.*cos(th));
for i=1:length(th)
line([x0(i) x(i)],[y0(i) y(i)],'color','b');
end
h=line(x,y,'color','k','linewidth',2);
hbase=line(rb*cos(cth),rb*sin(cth),'color','r','linewidth',1.5);
axis equal;axis off;


執行例:
>> involute_curve(5,360)

ans =  259.0045




>> involute_curve(5,360,2)

ans =  1.1680e+003


第十一章 齒輪(6)--齒輪之製造

11.6 齒輪之製造

齒列為一水平的齒輪,若製成磨刀則可以作為刻劃圓形齒輪之外形。本節中所列程式為利用齒列製造某一齒輪外形之方式,其中最重要的是依齒牙之外形先一水平面的方式製作齒列之齒牙外形。每顆齒牙均是對稱的,故其外形曲線可以僅考慮其一半即可,通常這個外形參數可以分五個區(regions)第一區為底部水平部份,第二區為底側圓角部份,第三區為斜坡部份,第四區為上部圓角,最後為頂部水平部份。這五個區的對應點可以設為參數,以ptregion參數表示一個陣列,包含五個元素,每個元素代表該區所要表示的點數。利用這些點數去繪出齒列上一顆齒牙之外形。



為繪出齒列上之牙齒,係呼叫rackm這個函數,計算其中之各點座標rack以及法線方向 n。其呼叫格式如下:

function [rack,n]=rackm(phir,Dp,A,B,rt,rf,ptregion)


上述函數係保留在整個gearrack.m函數中呼叫,其型式如下:

function gearrack(Dp,N,ar,br,ag,phi,rt,rf,npos,ptregion)

其輸入參數定義如下:
Dp     = 徑節
N       = 齒數
ar      = 齒冠
br      = 齒根
ag      = 齒輪之齒冠
phi     = 壓力角,度數
rt      = 頂部圓角半徑
rf      = 根部圓角半徑
r       = 齒輪節圓半徑
npos    = 齒列之位置數
ptregion=五區之點數,例如:[2 15 2 15 2]


程式內容
function gearrack(Dp,N,ar,br,ag,phi,rt,rf,npos,ptregion)
%
% Matlab program to show motion of rack relative to gear blank
% Input variables:
% Dp      = Diametral pitch
% N       = Number of gear teeth
% ar      = Addendum of the rack
% br      = Dedendum of the rack
% ag      = Addendum of the gear
% phi     = pressure angle in degrees
% rt      = tip radius of rack
% rf      = fillet radius of rack
% r       = pitch radius of gear
% npos    = Number of rack positions
% ptregion=points of different regions,eg.[2 15 2 15 2]
% Author: Kenneth J. Waldron, 1999
% Revised by DSFON, BIME, NTU Date:May 29,2007
% Example  gearrack(10,10)
if nargin<10, ptregion=[2 15 2 15 2];end
if nargin<9, npos=15;end
if nargin<3,ar=1.25;br=1.1;ag=1.0,phi=20;rt=0.02;rf=0.04;end
ans='y';
disp('   ')
disp('   This is the Rack Motion Program')
disp('   ')
height=0.8;width=0.8;
h=axes('position',[.05 .05 width height],'box','on','xcolor','k','ycolor','k');
set(gcf,'color', 'w')

% Compute basic parameter values.
r2d=180/pi;d2r=1/r2d;
A=ar/Dp;B=br/Dp;p=pi/Dp;
r=p*N/(pi*2);
theta=pi/N;
ro=r+ag/Dp;
phir=phi*d2r;
%gamma=pi/2-phir;
%lt=pi/(2*Dp)-2*A*tan(phir)-2*rt*tan(gamma/2);
%lb=pi/(2*Dp)-2*B*tan(phir)-2*rf*tan(gamma/2);

% Check for negative values for lt and lb.  If either is negative,
% set the value to zero and compute the corresponding radius.
[rack,n]=rackm(phir,Dp,A,B,rt,rf,ptregion)
figure(1);
clf;

% Draw the rack.  Start by defining the plots
rackline=line('xdata', [], 'ydata' ,[], 'linewidth',1,...
'erasemode', 'xor','color', 'r');
rackpitchline=line('xdata', [], 'ydata' ,[],'linewidth',0.4,...
'erasemode','xor','color', 'k', 'linestyle', '-.');
itotal=length(rack(1,:));
rackx=rack(1,:);racky=rack(2,:);
range=pi/Dp;
j=itotal;
for i=1:1:itotal-1
j=j+1;
rackx(j)=-rackx(itotal-i)+range;
racky(j)=racky(itotal-i);
end 
itotal=j;
xmax=max(rackx);xmin=min(rackx);xrange=xmax-xmin;
ymax=max(-racky);ymin=min(-racky);yrange=ymax-ymin;
ymin=ymin-0.05*yrange;
axis([xmin xmax ymin ymax]);axis equal

% Plot the positions
set(rackline, 'xdata', rackx, 'ydata', -racky);
set(rackpitchline, 'xdata',[xmin, xmax], 'ydata', [0,0]);
text(xmax-0.15*xrange, 0.01,'Pitch line');
title('The Tooth Profile');
% Draw the rack as it rolls about the gear through an angle theta.


% Define the pitch circle and blank circle arcs
figure(2);
clf;
bth=linspace(-theta,theta,20);hold on;
plot(ro*sin(bth),ro*cos(bth),'r:');
plot(r*sin(bth),r*cos(bth),'b:');
text(xmin-0.15*xrange, r*cos(bth(6)), 'Pitch Circle');
text(xmin-0.15*xrange, ro*cos(bth(6)), 'Blank Circle');
title('Motion of Rack Relative to Gear');
dth=4*theta/npos;
th=-theta-dth/1.5;
beta=-theta;
itotal=length(rackx);
for k=1:1:npos
th=th+dth;
cth=cos(th);sth=sin(th);
for i=1:1:itotal
tempx=-cth*(rackx(i)-r*th)+sth*(racky(i)-r);
tempy=-sth*(rackx(i)-r*th)-cth*(racky(i)-r);

% Rotate the coordinate system by -pi/N so that the y axis is along the
% centerline of the gear tooth instead of the centerline of the gap.

racktx(k,i)=tempx*cos(beta)-tempy*sin(beta);
rackty(k,i)=tempx*sin(beta)+tempy*cos(beta);
end
line(racktx(k,:),rackty(k,:));
end

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

function [rack,n]=rackm(phir,Dp,A,B,rt,rf,ptregion)
%
%Calculate a rack profile, with ptregion specifies 5-region points
% phir:pressure angle in radian
% Dp:diametral pitch
% ar: addendium
% br: bottom reference,dedendum of rack
% rt  = tip radius of rack
% rf  = fillet radius of rack
gamma=pi/2-phir;
lt=pi/(2*Dp)-2*A*tan(phir)-2*rt*tan(gamma/2);
lb=pi/(2*Dp)-2*B*tan(phir)-2*rf*tan(gamma/2);
if lt <0
lt=0;
rt=(pi/(2*Dp)-2*A*tan(phir))/(2*tan(gamma/2));
end
if lb <0
lb=0;
rf=(pi/(2*Dp)-2*B*tan(phir))/(2*tan(gamma/2));
end
i=0;
for k=1:length(ptregion) %for 5 regions
beta=0.0;nx=ptregion(k);dbeta=1/nx;
for j=1:nx
i=i+1; 
beta=beta+dbeta;
switch k
case 1
rack(:,i)=[beta*lt/2;A];n(:,i)=[0;1.0];
case 2
rack(:,i)=[lt/2+rt*sin(beta*gamma);...
A-rt*(1-cos(beta*gamma))];
n(:,i)=[sin(beta*gamma);cos(beta*gamma)];
case 3
sg=sin(gamma);cg=cos(gamma); 
rack(:,i)=[(1-beta)*(lt/2+rt*sg)+...
beta*(pi/(2*Dp)-lb/2-rf*sg);...
(1-beta)*(A-rt*(1-cg))+beta*(-B+rf*(1-cg))];
n(:,i)=[cos(phir);sin(phir)];
case 4
sb=sin((1-beta)*gamma); cb=cos((1-beta)*gamma);
rack(:,i)=[pi/(2*Dp)-lb/2-rf*sb;-B+rf*(1-cb)];
n(:,i)=[sb;cb];
case 5
rack(:,i)=[pi/(2*Dp)-lb/2*(1-beta);-B];
n(:,i)=[0;1];
end
end
end


執行例:

>> gearrack(10,10)

ag =    1


This is the Rack Motion Program


rack =

Columns 1 through 8

0.0095    0.0190    0.0207    0.0223    0.0239    0.0254    0.0270    0.0284
0.1250    0.1250    0.1249    0.1247    0.1244    0.1239    0.1234    0.1227

Columns 9 through 16

0.0298    0.0312    0.0324    0.0336    0.0347    0.0356    0.0365    0.0372
0.1218    0.1209    0.1199    0.1187    0.1175    0.1162    0.1148    0.1133

Columns 17 through 24

0.0378    0.0734    0.1090    0.1102    0.1117    0.1134    0.1154    0.1175
0.1118    0.0141   -0.0837   -0.0867   -0.0896   -0.0924   -0.0950   -0.0974

Columns 25 through 32

0.1198    0.1223    0.1250    0.1278    0.1307    0.1338    0.1369    0.1401
-0.0997   -0.1018   -0.1037   -0.1053   -0.1067   -0.1079   -0.1088   -0.1095

Columns 33 through 36

0.1433    0.1466    0.1518    0.1571
-0.1099   -0.1100   -0.1100   -0.1100


n =

Columns 1 through 8

0         0    0.0814    0.1622    0.2419    0.3201    0.3961    0.4695
1.0000    1.0000    0.9967    0.9868    0.9703    0.9474    0.9182    0.8829

Columns 9 through 16

0.5398    0.6065    0.6691    0.7274    0.7808    0.8290    0.8718    0.9088
0.8418    0.7951    0.7431    0.6862    0.6248    0.5592    0.4899    0.4173

Columns 17 through 24

0.9397    0.9397    0.9397    0.9088    0.8718    0.8290    0.7808    0.7274
0.3420    0.3420    0.3420    0.4173    0.4899    0.5592    0.6248    0.6862

Columns 25 through 32

0.6691    0.6065    0.5398    0.4695    0.3961    0.3201    0.2419    0.1622
0.7431    0.7951    0.8418    0.8829    0.9182    0.9474    0.9703    0.9868

Columns 33 through 36

0.0814    0.0000         0         0
0.9967    1.0000    1.0000    1.0000

第十一章 齒輪(3)-繪製齒輪



11.3 如何繪製齒輪

前面已經討論許多繪製齒輪必要的過程,本節將綜合各節所述,作成可以放置任意位置的齒輪組draw_gear.m,呼叫程式時,可以在任意的地方建立齒輪之外形。利用其轉動座標的功能,可以調整其契合的位置,成為齒輪組。
其呼叫型式如下:



function [coords]=draw_gear(Dp,N,phi,range,x0,y0)




其中,輸入參數分別定義如下:

Dp: 節矩

N: 齒數

phi: 壓力角

range: 繪出之部份

x0,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<range
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;


執行範例



>> [coords]=draw_gear(10,15,20,360,0,0)




第十一章 齒輪(2)-齒輪曲線



11.2 齒輪曲線之形成

由前面齒列之程式可以瞭解齒輪雖然僅有齒牙相接觸,但其曲線之形成仍然必須依據特定的曲線規則。漸開線是最常用的曲線,為此可以使用齒列作為切刀,修正曲線之外廓。程式gear_curve.m除可產生齒輪之基本曲線外,可以依所需之齒數建立一個完整的齒輪,並且使其作適當的迴轉運動。程式中另呼叫onegear.m、rotate2xy.m。前者是將一個完整的齒輪的外形座標組合,後者則是座標旋轉的程式。程式gear_curve.m之呼叫格式如下:

  function [rack,gear]=gear_curve(Dp,N,phi,ar,br,rt,rf,ag,ptregion)


Dp      = 節矩
ar      = 齒列之齒冠
br      = 齒列之齒根
phi     = 壓力角, degrees
rt      = 頂部圓角半徑
rf      = 根部圓角半徑
r       = 齒輪之節圓半徑
ag      = 齒輪之齒冠
bg      = 齒輪之齒根
ptregion= 齒形之五區點數,列矩陣,例如:[5 15 5 15  5]
N       = 齒輪之齒數


function [rack,gear]=gear_curve(Dp,N,phi,ar,br,rt,rf,ag,ptregion)
%
% Matlab program to draw a gear generated by a straight flanked hob.
%
%Some of the important variables used are:
%
% Example  gear_curve(10,10,20,1.25,1,0.02,0.04,1.0,[30 30 40 30 30],10)
%          gear_curve(10,10)
%
%Dp      = Diametral pitch
%ar      = Addendum constant for rack
%br      = Dedendum constant for rack
%phi     = pressure angle in degrees
%rt      = tip radius of rack
%rf      = fillet radius of rack
%r       = pitch radius of gear
%ag      = Addendum constant for gear
%bg      = Dedendum constant for gear
%ptregion= No. of points for five regions, row matrix
%N       = Number of gear teeth
if nargin<4,
ar=1.25;br=1;rt=0.02;rf=0.04;ag=1;
%ptregion=[10 15 20 15 15];
ptregion=[10 15 10 15 10];
end
th=linspace(0,2*pi,50);
if nargin<3,phi=20;end ans="'y';" d2r="pi/180;" ansp="'y';" pc="pi/Dp;" r="pc*N/(pi*2);%" ro="r+ag/Dp;" phir="phi*d2r;" rackline="line('xdata'," rackpitchline="line('xdata'," xmax="max(rack(1,:));xmin="min(rack(1,:));xrange="xmax-xmin;" ymax="max(rack(2,:));ymin="min(rack(2,:));yrange="ymax-ymin;" ymin="ymin-0.05*yrange;" ymax="ymax+0.05*yrange;" dtheta="2*pi/N/d2r;" gear0="gear;" i="1:N-1," gear="[gear," gearline="line('xdata'," gearpitchline="line('xdata'," xtemp="gear(1,:);ytemp="gear(2,:);" xmax="max(xtemp);xmin="min(xtemp);xr="xmax-xmin;" ymax="max(ytemp);ymin="min(ytemp);yr="ymax-ymin;" s="0.1;" xgear="xtemp';ygear="ytemp';" ainc="1;" theta="0;i="0;">360,theta=theta-360;i=i+1; end
set(gearline, 'xdata', xgear, 'ydata', ygear);
[xgear,ygear]=rotate2xy(xgear,ygear,ainc);
theta=theta+ainc;
drawnow;
pause(0.01);
end

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

function [rack,n]=rackm(phir,Dp,A,B,rt,rf,ptregion)
%
%Calculate a rack profile, with ptregion specifies 5-region points
% phir:pressure angle in radian
% Dp:diametral pitch
% ar: addendium
% br: bottom reference,dedendum of rack
% rt  = tip radius of rack
% rf  = fillet radius of rack
gamma=pi/2-phir;
lt=pi/(2*Dp)-2*A*tan(phir)-2*rt*tan(gamma/2);
lb=pi/(2*Dp)-2*B*tan(phir)-2*rf*tan(gamma/2);
if lt < 0
lt=0;
rt=(pi/(2*Dp)-2*A*tan(phir))/(2*tan(gamma/2));
end
if lb <0
lb=0;
rf=(pi/(2*Dp)-2*B*tan(phir))/(2*tan(gamma/2));
end
i=0;
for k=1:length(ptregion) %for 5 regions
beta=0.0;nx=ptregion(k);dbeta=1/nx;
for j=1:nx
i=i+1; 
beta=beta+dbeta;
switch k
case 1
rack(:,i)=[beta*lt/2;A];n(:,i)=[0;1.0];
case 2
rack(:,i)=[lt/2+rt*sin(beta*gamma);...
A-rt*(1-cos(beta*gamma))];
n(:,i)=[sin(beta*gamma);cos(beta*gamma)];
case 3
sg=sin(gamma);cg=cos(gamma);
rack(:,i)=[(1-beta)*(lt/2+rt*sg)+beta*(pi/(2*Dp)-lb/2-rf*sg);...
(1-beta)*(A-rt*(1-cg))+beta*(-B+rf*(1-cg))];
n(:,i)=[cos(phir);sin(phir)];
case 4
sb=sin((1-beta)*gamma); cb=cos((1-beta)*gamma);
rack(:,i)=[pi/(2*Dp)-lb/2-rf*sb;-B+rf*(1-cb)];
n(:,i)=[sb;cb];
case 5
rack(:,i)=[pi/(2*Dp)-lb/2*(1-beta);-B];
n(:,i)=[0;1];
end
end
end

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

function [gear,plx,ply]=onegear(rack,n,r,ro,N)
%
%find coordinates of one gear
% rack:coordinates of a rack
% n: normal vector of each point on the rack
% r: pictch radius
% ro:outside radius
% N: no. of teeth
d2r=pi/180;
ang=(rack(1,:).*n(2,:)-rack(2,:).*n(1,:))./(r*n(2,:));
geart(1,:)=-cos(ang).*(rack(1,:)-r*ang)+sin(ang).*(rack(2,:)-r);
geart(2,:)=-sin(ang).*(rack(1,:)-r*ang)-cos(ang).*(rack(2,:)-r);

% Define the pitch circle arc

maxang=max(ang);
minang=min(ang);
dk=(maxang-minang)/20;
i=0;
for k=minang:dk:maxang
i=i+1;
plx(i)=r*sin(k);
ply(i)=r*cos(k);
end 

% Rotate the coordinate system by -pi/N so that the y axis is along the
% centerline of the gear tooth instead of the centerline of the gap.

[xx,yy]=rotate2xy(geart(1,:)',geart(2,:)',-pi/N/d2r);
xx=xx';yy=yy';
% Test for the undercut points which cannot be on the gear
itotal=length(rack(1,:));
jstop=itotal+1;
istop=itotal+1;
for i = 1:itotal-2
for j=i+1:itotal-1
if istop==itotal+1 & jstop==itotal+1
ra=[xx(i) yy(i)];
rb=[xx(i+1) yy(i+1)];
rc=[xx(j) yy(j)];
rd=[xx(j+1) yy(j+1)];
rba=rb-ra;rca=rc-ra;
rac=ra-rc;rda=rd-ra;
rdc=rd-rc;rbc=rb-rc;
rbd=rb-rd;
Aabc=rba(1)*rca(2)-rba(2)*rca(1);
Aabd=rba(1)*rda(2)-rba(2)*rda(1);
Acda=rdc(1)*rac(2)-rdc(2)*rac(1);
Aadb=rda(1)*rba(2)-rda(2)*rba(1);
Acdb=rdc(1)*rbc(2)-rdc(2)*rbc(1);
test1=Aabc*Aabd;
test2=Acda*Acdb;   

% Check for the intersection of two line segments

if test1<0 & test2<0
istop=i;
jstop=j+1;
alpha=abs(Acdb)/(abs(Acda)+abs(Acdb));
re(1)=alpha*ra(1)+(1-alpha)*rb(1);
re(2)=alpha*ra(2)+(1-alpha)*rb(2);
j=itotal;
i=itotal;
end 
end  
end
end

% If two lines intersect, delete the points in the undercut region.

j=0;
for i=1:itotal
if i<=istop | i >= jstop
j=j+1;
geart(:,j)=[xx(i);yy(i)];
if i==istop
j=j+1;
geart(1,j)=re(1);
geart(2,j)=re(2);
end
end
end
itotal=j;

% Check that the points do not extend beyond the addendum circle (ro).

j=0;
rtest1=0;
istop='n';
i=0;
for i=1:itotal
if istop=='n'
rtest2=sqrt(geart(1,i)^2+geart(2,i)^2);
if rtest2<=ro
j=j+1;
gear(:,j)=geart(:,i);
xx(j)=gear(1,j);
yy(j)=gear(2,j);
end

% If the points extend beyond the addendum circle, discard the
% points beyond ro and find the intersection of the gear with the
% ro circle.

if rtest2>ro
alpha=(ro-rtest1)/(rtest2-rtest1);
j=j+1;
gear(:,j)=geart(:,i-1)+alpha*(geart(:,i)-geart(:,i-1));
xx(j)=gear(1,j);
yy(j)=gear(2,j);
istop='y';
end
rtest1=rtest2;
end
end

% if the addendum is reached replace the points beyond the
% addendum with points on a circle arc.

if j<itotal
beta = atan2(gear(1,j), gear(2,j));
dbeta=beta/5;
betak=beta;
for k=1:5
j=j+1;
betak=betak-dbeta;
sbetak=sin(betak);
cbetak=cos(betak);
gear(1,j)=ro*sbetak;
gear(2,j)=ro*cbetak;
end
end
jtotal=j;

% Reflect the points to draw the rest of the gear tooth

for i=1:jtotal-1
j=j+1;
gear(1,j)=-gear(1,jtotal-i);
gear(2,j)=gear(2,jtotal-i);
end 
itotal=j;

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

function [x,y]=rotate2xy(x,y,theta,x0,y0)
if nargin<4, x0=0;y0=0;end;
th=theta*pi/180;
c=cos(th);s=sin(th);fact=[c s;-s c];
coords=[x y]*fact;
x=coords(:,1)+x0;y=coords(:,2)+y0;


執行例:
>>gear_curve(10,10);



第十一章 齒輪(5)-齒列與齒輪



11.5 齒列與齒輪間之互動關係

本節將示範一齒列與一齒輪間之運動情形,程式是動態的變化,但可依參數輸入值決定其間之關係。其程式名稱為move2_rack.m,呼叫格式如下:
function move2_rack(Dpitch,nn1,phi,omega1)



輸入參數定義如下:

Dpitch:節矩
 nn1:齒輪數目
 phi:壓力角,degrees
 omega1: 齒輪角速度,rad/s

程式內容:

function move2_rack(Dpitch,nn1,phi,omega1)
%  move2_gear(Dpitch,nn1,nn2,phi,omega1)
% To draw a whole gear
% Inputs:
%  Inputs:
%    Dpitch:dimetral pitch
%    nn1: no. of teeth for both gears
%    phi:pressure angle, degrees
%    omega1: angular velocity of gear 1
% Example move2_rack(10,15,20,10)
clf;
d2r=pi/180;delt=0.01;
phir=phi*d2r;
pc=pi/Dpitch;
[coord1,r1,rb1]=one_tooth(Dpitch,nn1,phi,360,0,0);
[coord2]=rack(Dpitch,phi,nn1,0,0,-r1);
xc1=coord1(:,1);yc1=coord1(:,2);
xc2=coord2(:,1);yc2=coord2(:,2);
coord=bushing(r1/8,0,0); % Get the coordinates of  1st bushing
xb1=coord(:,1);yb1=coord(:,2);
coord=bushing(-r1,0,0);%Get the 1st pitch circle
xp1=coord(:,1);yp1=coord(:,2);
xp2=[0 0]';yp2=[0 -r1]';
plot(xb1,yb1,'r-');hold on;
plot(xp1,yp1,'r:');
plot(xp2,yp2,'k:');
xx=nn1*pc/2;xx1=xx/2;
plot([-xx xx]',[-r1 -r1]','r:');
plot([-xx1  xx1]',[xx1*tan(phir)-r1, -xx1*tan(phir)-r1]','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');
rm=r1+1/Dpitch;
axis([-1.2*rm 1.2*rm -1.3*rm 1.3*rm]);
axis equal;
title('Press Ctl-C to stop');
delta=0;delx=0;dels=omega1*delt;
while 1,
z1=rotate2D([xc1,yc1],delta,0,0);
z2=[xc2-delx,yc2];
L1=rotate2D([xp2,yp2],delta,0,0);
set(cir1,'xdata',z1(:,1),'ydata',z1(:,2)); % For 1st circle moving
set(cir2,'xdata',z2(:,1),'ydata',z2(:,2)); % For the rack moving
set(line1,'xdata',L1(:,1),'ydata',L1(:,2)); % For 1st line
drawnow;
pause(1/omega1);      %Stop for a while so we can see the graph
delta=delta+dels;
delx=delx-dels*r1*d2r;
if delta>360, delta=delta-360;end;   %Reverse the direction at bondary line
if delx<pc,delx=delx+pc;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<range
coord1=rotate2D(coord,-i,x0,y0);
coords=[coords;coord1];
i=i+theta;
end

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


function [coords]=rack(Dp,phi,nn,theta,x0,y0)
d2r=pi/180;
phir=phi*d2r;
h=2/Dp;
pc=pi/Dp;
sl=h/cos(phir);
m=sl*sin(phir);
m1=(pc/2-m)/2;
coord=[-pc/2 0;-m1-m 0;-m1,h;m1 h;m1+m 0;pc/2 0];
coords=coord;
for i=1:nn-1
coord1=[coord(:,1)+i*pc coord(:,2)];
coords=[coords;coord1];
end
nd=fix(nn/2)-mod(nn+2,4)*.25;
coords=rotate2D(coords,theta,x0-nd*pc,y0-h/2);

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;


執行例

>> move2_rack(10,15,20,10)


齒列與齒輪的互動

第十一章 齒輪(4)--兩齒輪之滾動



10.4 兩齒輪之滾動

若有兩個不同大小之齒輪在不同位置下相互契合,此時之滾動情形可利用下面程式示範。此程式稱為move2_gear.m,其呼叫方式與move2_rack.m幾乎相同。呼叫格式如下:

function move2_gear(Dpitch,nn1,nn2,phi,omega1)



輸入參數之定義如下:

Dpitch:節矩
nn1,nn2:兩齒輪之齒數
phi:壓力角,degrees
omega1: 齒輪1之角速度,rad/s

程式內容


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<range
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;

執行範例

>> move2_gear(10,15,20,20,10)



5/16/07

第十章 凸輪運動

10.1抛物線曲面之計算

利用MATLAB程式可以計算抛物線之運動參數,其程式內容如下,呼叫之名稱與參數分別為:
function [y, yy, yyy]=parabol_cam(phi, phi_in, beta_range, direct, travel,rpm)

8-4.3.2 MATLAB計算程式
function [y, yy, yyy]=parabol_cam(phi,phi_in,beta_range,direct,travel,rpm)
% code = 2
% [y, yy, yyy]=parabol_cam(phi,phi_in,beta_range,direct,travel,rpm)
% phi=cam angle, degrees
% phi_in=starting cam angle, degrees
% beta_range=motion range, degrees
% direct=motion type; +1 for upward, -1 for downward
% travel=the follower travels(=1 for a unit of travel)
% rpm=cam rotation speed, rpm(=0 for not effective)
% Example: [y, yy, yyy]=parabol_cam(10,180,120,1,1,0)
d2r=pi/180;
th=phi*d2r; thinit=phi_in*d2r; beta=beta_range*d2r;
speed=rpm*2*pi/60;if rpm==0, speed=1;end;
theta=th-thinit;
thmed=thinit+beta/2;
thx=theta/beta;
if direct==1,
if th<thmed
y=2*thx^2;
yyy=4/beta/beta;
yy=yyy*th;
else
y=1-2*(1-thx)^2;
yy=4/beta*(1-thx);
yyy=-4/beta/beta;
end
else
if th<thmed
y=1-2*thx^2;
yyy=-4/beta/beta;
yy=yyy*th;
else
y=2*(1-thx)^2;
yy=-4/beta*(1-thx);
yyy=4/beta/beta;
end
end
y=y*travel;
yy=yy*speed*travel;
yyy=yyy*speed*speed*travel;



執行例:
1. 升程起始點120∘,β=60∘,h=0.8cm,角度為150∘時之位移、速度及加速度:
>> [y, yy, yyy]=parabol_cam(150,120,60,1,0.8,0)
y =          0.4   (cm)
yy =       1.5279  (cm/s)
yyy =      -2.9181  (cm/s2)

2. 返程起始點210∘,β=150∘,h=0.8,角度為250∘時之位移、速度及加速度:
>> [y, yy, yyy]=parabol_cam(250,210,150,-1,0.8,0)
y =      0.68622(cm)
yy =      -0.3259(cm/s)
yyy =     -0.46689(cm/s2)


範例8.1


某凸輪開始時先在0-120∘區間滯留,其高度為零。升程落於120-180∘,並於180-210∘滯留,其總升程為8公分。設刻度區間為10∘,凸輪則以等角速度旋轉,且其升程與返程均採用等加速度運動。求其變化曲線。

[解]:

1. 設ψ凸輪之迴轉角度,ψ=120-180∘為升程,轉折點為150∘,起點120∘,令θ = ψ-120,β = 60及h = 8代入公式8.9,可得升程之第一段(θ=120-150∘):
y(θ)=2h(θ/β)²=2(8)[(ψ-120)/60]²

2. 而升程之第二段(θ=150-180∘)則仍以ψ-120=θ,β=60及h=8代入公式8.10,得:
y(θ)=h[1-2(1-θ/β)²]=(8)[1-2(1-{ψ-120}/60]²

3. 返程之區間為210∘至360∘,轉折點為(210+360)/2=285∘,而β=360-210=150∘。設ψ-210=θ,代入返程一段的位移公式8.11,得第一區段(θ=210-285∘):
y(θ)=h[1-2(θ/β)²]=(8)[1-2({ψ-210}/150]²


4. 返程第二段之區間為285至360度,其轉折點與β均與第3項同,代入返程二段的位移公式,可以得到:
y(θ)=2h[1-(θ/β)²]=2(8)[1-({ψ-210}/150]²


由上面所得之函數可以利用電腦程式運算。針對升程(Demo8.1)與返程( Demo8.2)計算結果如下:
% Demo8_1
% 計算升程對應點之資料:位移,速度及加速度
theta=120:10:180;
for i=1:length(theta)
[ss(i), vv(i), aa(i)]=parabol_cam(theta(i),120,60,1,8,0);
end;
%(theta:對應角度; ss:位移, vv:速度, aa:加速度)
[theta' ss' vv' aa']

>> demo8_1
ans =
120.0000         0         0   29.1805
130.0000    0.4444    5.0930   29.1805
140.0000    1.7778   10.1859   29.1805
150.0000    4.0000   15.2789  -29.1805
160.0000    6.2222   10.1859  -29.1805
170.0000    7.5556    5.0930  -29.1805
180.0000    8.0000   -0.0000  -29.1805
%----------------------------------------

% Demo8_2
% 計算返程對應點之資料:位移,速度及加速度
theta=210:10:360;
for i=1:length(theta)
[ss(i), vv(i), aa(i)]=parabol_cam(theta(i),210,150,-1,8,0);
end;
%(theta:對應角度; ss:位移, vv:速度, aa:加速度)
[theta' ss' vv' aa']

%------------------------------------------

>> demo8_2
ans =
210.0000    8.0000         0   -4.6689
220.0000    7.9289   -0.8149   -4.6689
230.0000    7.7156   -1.6297   -4.6689
240.0000    7.3600   -2.4446   -4.6689
250.0000    6.8622   -3.2595   -4.6689
260.0000    6.2222   -4.0744   -4.6689
270.0000    5.4400   -4.8892   -4.6689
280.0000    4.5156   -5.7041   -4.6689
290.0000    3.4844   -5.7041    4.6689
300.0000    2.5600   -4.8892    4.6689
310.0000    1.7778   -4.0744    4.6689
320.0000    1.1378   -3.2595    4.6689
330.0000    0.6400   -2.4446    4.6689
340.0000    0.2844   -1.6297    4.6689
350.0000    0.0711   -0.8149    4.6689
360.0000    0.0000   -0.0000    4.6689

若就從動件之位移,利用電腦之資料或依10度為區間實際計算,可以得出其運動圖如圖8.19。




10.2 擺線曲線之函數


撰寫一套程式,仿抛物線之parabol_cam(phi, phi_in, beta_range, direct, travel,rpm),作一產生擺線曲線之函數。並計算下面之情況:總升程為50mm,升程以擺線運動經歷180度,其後滯留90度,再以擺線返程。凸輪之最小半徑為25mm。輸出資料除位移、速度及加速度外,並計算對應點之曲率半徑ρ、壓力角Φ。

[解]

function [y, yy, yyy, rho, alpha]=cycloidal_cam(r0,theta,theta_in,beta_range,direct,travel,rpm)
% code = 2
% [y, yy, yyy,rho,phi]=cycloidal_cam(r0,theta,theta_in,beta_range,direct,travel,rpm)
% r0:min. radius of the pitch surface.
% theta=cam angle, degrees
% theta_in=starting cam angle, degrees
% beta_range=motion range, degrees
% direct=motion type; +1 for upward, -1 for downward
% travel=the follower travels(=1 for a unit of travel)
% rpm=cam rotation speed, rpm(=0 for not effective)
% rho: radius of curvature
% alpha: pressure angle, in degrees.
% Example: [y, yy, yyy,rho,alpha]=cycloidal_cam(25,10,180,120,50,1,0)
d2r=pi/180;
th=theta*d2r; thinit=theta_in*d2r; beta=beta_range*d2r;
speed=rpm*2*pi/60;if rpm==0, speed=1;end;
theta=th-thinit;
thmed=thinit+beta/2;
thx=theta/beta;pi2=pi*2;
if direct==1,
y=thx-(1/pi2)*sin(pi2*thx);
yy=(1/beta)*(1-cos(pi2*thx));
yyy=(pi2/beta/beta)*sin(pi2*thx);
else
y=1-thx+(1/pi2)*sin(pi2*thx);
yy=-(1/beta)*(1-cos(pi2*thx));
yyy=-(pi2/beta/beta)*sin(pi2*thx);
end
y=y*travel;
yy=yy*speed*travel;
yyy=yyy*speed*speed*travel;
r=r0+y;
rho=(r.*r+yy.*yy).^1.5./(r.*r+2*yy.*yy-r.*yyy);
alpha=atan2(yy,r)/d2r;


執行例:

>> [y, yy, yyy,rho,alpha]=cycloidal_cam(25,[0:30:180],0,180,1,50,0)

y = 0   1.4417   9.7751    25   40.225   48.558       50
yy = 0   7.9577  23.873   31.831  23.873   7.9577      0
yyy = 0   27.566   27.566  3.8982e-015  -27.566  -27.566 -7.7963e-015
rho = 25   217.26   53.972   46.005   46.589    53.537    75
alpha = 0   16.749   34.47    32.482   20.103    6.1744    0


10.3 簡諧曲線之函數


8.5 撰寫一套程式,仿抛物線之parabol_cam(phi, phi_in, beta_range, direct, travel,rpm),作一產生簡諧曲線之函數。並計算下面之情況:總升程為50mm,升程以擺線運動經歷90度,其後滯留90度,再以擺線返程。凸輪之最小半徑為25mm。輸出資料除位移、速度及加速度外,並計算對應點之曲率半徑ρ、壓力角Φ。

[解]
function [y, yy, yyy, rho, alpha]=harmonic_cam(r0,theta,theta_in,beta_range,direct,travel,rpm)
% code = 2
% [y, yy, yyy,rho,phi]=harmonic_cam(r0,theta,theta_in,beta_range,direct,travel,rpm)
% r0:min. radius of the pitch surface.
% theta=cam angle, degrees
% theta_in=starting cam angle, degrees
% beta_range=motion range, degrees
% direct=motion type; +1 for upward, -1 for downward
% travel=the follower travels(=1 for a unit of travel)
% rpm=cam rotation speed, rpm(=0 for not effective)
% rho: radius of curvature
% alpha: pressure angle, in degrees.
% Example: [y, yy, yyy,rho,alpha]=harmonic_cam(25,10,180,120,50,1,0)
d2r=pi/180;
th=theta*d2r; thinit=theta_in*d2r; beta=beta_range*d2r;
speed=rpm*2*pi/60;if rpm==0, speed=1;end;
theta=th-thinit;
thmed=thinit+beta/2;
thx=theta/beta;
if direct==1,
y=0.5*(1-cos(pi*thx));
yy=(pi/2/beta)*sin(pi*thx);
yyy=(pi/beta)^2/2*cos(pi*thx);
else
y=0.5*(1+cos(pi*thx));
yy=-(pi/2/beta)*sin(pi*thx);
yyy=-(pi/beta)^2/2*cos(pi*thx);
end
y=y*travel;
yy=yy*speed*travel;
yyy=yyy*speed*speed*travel;
r=r0+y;
rho=(r.*r+yy.*yy).^1.5./(r.*r+2*yy.*yy-r.*yyy);
alpha=atan2(yy,r)/d2r;


執行例:
>> [y, yy, yyy,rho,alpha]=harmonic_cam(25,10,180,120,50,1,0)
y =      0.37059
yy =     -0.72444
yyy =     0.29117
rho =    25.654
alpha =   -1.6356


範例8.11



某凸輪開始在0-90∘區間在零高度滯留,然後提升後在150至180∘區間滯留,時高度為10公分,其餘則為返程。設刻度區間為10∘繪出其高度圖。凸輪則以等角速度旋轉,其升程與返程均採用等加速度運動。

[解]
1. 設ψ凸輪之迴轉角度,ψ=90-150∘為升程,轉折點為120∘,起點90∘,令θ = ψ-90,β = 60及h = 10代入公式8.9,可得升程之第一段(θ =90-120):
y(θ)=2h(θ/β)²=2(10)[(ψ-90)/60]²


2. 而升程之第二段(θ =120-150),則以ψ-90=θ,β=60及h=10代入公式8.10,得:
y(θ)=h[1-2(1-θ/β)²]=(10)[1-2{1-(ψ-90)/60}²]


3. 返程之區間為180∘至360∘,轉折點為(180+360)/2=270∘,β=360-180=180∘。設ψ-180=θ,代入返程一段的位移公式8.11,第一區段(θ =180-270)得:

y(θ)=h[1-2(1-θ/β)²]=(10)[1-2{1-(ψ-180)/180}²]


4. 返程第二段之區間θ =270-360度,代入返程一段的位移公式,可以得到:

y(θ)=2h(1-θ/β)²=2(10)[1-(ψ-180)/180]²


利用MATLAB程式可撰寫如下:
function [theta,y]=P8_11(theta,limit0,s)
% ex P8.11
% Inputs: theta: angles in row matrix
%         limit0: mark angles [(dwell) t0 (rise) t1 (dwell) t2(return)t3]
%         s:stroke
% Example: [theta,y]=P8_11([0:10:360],[90 150 180 360],30)
d2r=pi/180;
h=s;lm=limit0*d2r;
lm=[lm(1) (lm(1)+lm(2))/2 lm(2) lm(3) (lm(3)+lm(4))/2 lm(4)]/d2r;
LM=lm*d2r;
th=theta*d2r;
y=ones(size(th));
y(th<LM(1))=0;
y(th>=LM(3))=h;
y(th>=LM(1)&th<LM(2))=2*h*((th(th>=LM(1)&th<LM(2))-LM(1))/(LM(3)-LM(1))).^2;
y(th>=LM(2)&th<LM(3))=h*(1-2*(1-(th(th>=LM(2)&th<LM(3))-LM(1))/(LM(3)-LM(1))).^2);
y(th>=LM(4)&th<LM(5))=h*(1-2*((th(th>=LM(4)&th<LM(5))-LM(4))/(LM(6)-LM(4))).^2);
y(th>=LM(5)&th<=LM(6))=2*h*(1-(th(th>=LM(5)&th<=LM(6))-LM(4))/(LM(6)-LM(4))).^2;
plot(th/d2r,y);
xlabel('Theta in degrees');
ylabel('Follower displacement');
grid on;

執行結果:
>> [theta,y]=P8_11([0:10:360],[90 150 180 360],30)
theta =      0    10    20    30    40    50    60    70    80    90   100   110   120   130   140   150   160   170   180   190   200   210   220   230   240   250   260   270   280   290   300   310   320   330   340   350   360
y =          0            0            0            0            0            0            0            0            0            0       1.6667       6.6667           15       23.333       28.333           30           30           30           30       29.815       29.259       28.333       27.037        25.37
23.333       20.926       18.148           15       11.852       9.0741       6.6667       4.6296        2.963       1.6667      0.74074      0.18519           0




10.4 DWELL函數簡介


上述各函數作為從動件運動件運動包括其上升下降之位移、速度、加速度等均可以利用程式表示。為求統一,可歸納到dwell.m這個函數之中。其呼叫法為:

function [y,yy,yyy]=dwell(ctheta,range,pattern)

其中參數定義如下:
ctheta = 需要計算之凸輪角度,單位為度數。可以使用矩陣輸入之型式。
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。
輸出: y:位移(其最大值為1,故得到對應值後應與從動件之衝程相乘,才是真正的位移,其第一及第二導數相同);yy 對於凸輪角ctheta之第一導數; yyy 對於凸輪角ctheta之第二導數。

程式內容:

function [y,yy,yyy]=dwell(ctheta,range,pattern)
%
% This function determines the follower displacement and derivatives
% for a full rotation cam.  The routine is set up for the displacement
% schedule in Examples 6.7 and 6.8

% The input values are:

%ctheta   = individual cam angles (deg)--can be a matrix to be processed
%pattern  = denote the types of motion used(a 2 element-row matrix). types
%         are:
%         1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
%         5:polynomial motion
%         e.g. [4 3]:cycloidal motion for rise and harmonic motion for
%         return
%range    =the degrees the specific motion starts(array of 3 elements), e.g.
%          [90 180 240] starts to rise at 90 deg. and ends at 180 deg.
%           starts to return at 240 deg. and ends at 360 deg.
% Output: y is for displacement, yy is the derivative of the displacement with
% respect to theta, and yyy the second derivative with respect  to theta.
% Example dwell(60,[90 180 240],[4 3]);
% Author:DSFon, BIME, NTU Revise Date:May 18, 2007

d2r=pi/180;
theta=ctheta*d2r;range=range*d2r;
dim=length(ctheta);
y=zeros(size(ctheta));yy=y;yyy=y;
for i=1:dim
if theta(i)>=range(3)    %for the last motion(downward)
mode=pattern(2);betax=2*pi-range(3);
switch mode,
case 1, [y(i),yy(i),yyy(i)]=uniform(theta(i), range(3),betax,-1);
case 2, [y(i),yy(i),yyy(i)]=parabolicm(theta(i), range(3),betax,-1);
case 3, [y(i),yy(i),yyy(i)]=harmonicm(theta(i), range(3),betax,-1);
case 4, [y(i),yy(i),yyy(i)]=cycloidm(theta(i), range(3),betax,-1);
case 5, [y(i),yy(i),yyy(i)]=polynorm(theta(i), range(3),betax,-1);
end;

elseif theta(i)>=range(2) % dewell on the top
y(i)=1;
elseif theta(i)>=range(1) % for the 1st motion(upward)
mode=pattern(1);betax=range(2)-range(1);
switch mode,
case 1, [y(i), yy(i), yyy(i)]=uniform(theta(i), range(1),betax,+1);
case 2, [y(i), yy(i), yyy(i)]=parabolicm(theta(i), range(1),betax,+1);
case 3, [y(i), yy(i), yyy(i)]=harmonicm(theta(i), range(1),betax,+1);
case 4, [y(i), yy(i), yyy(i)]=cycloidm(theta(i), range(1),betax,+1);
case 5, [y(i), yy(i), yyy(i)]=polynorm(theta(i), range(1),betax,+1);
end
end
end


%*********************************************

function [t1, t2, t3]=uniform(th, thinit,beta,direct)
% code = 1 for uniform motion
%th=cam angle, radians
%beta=motion range, radians
%thinit=starting cam angle, radians
%beta=motion range, radians
%direct=motion type; +1 for upward, -1 for downward
theta=th-thinit;
t1=theta/beta;
if direct==-1,
t1=1-t1;
end;
t2=direct*1/beta;
t3=0;


%*********************************************
function [t1, t2, t3]=parabolicm(th,thinit,beta,direct)
% code = 2 for parabolic motion
%th=cam angle, radians
%beta=motion range, radians
%thinit=starting cam angle, radians
%beta=motion range, radians
%direct=motion type; +1 for upward, -1 for downward
theta=th-thinit;
thmed=thinit+beta/2;thx=theta/beta;
if direct==1,
if th<thmed
t1=2*thx^2;
t3=4/beta/beta;
t2=t3*th;
else
t1=1-2*(1-thx)^2;
t2=4/beta*(1-thx);
t3=-4/beta/beta;
end
else
if th<thmed
t1=1-2*thx^2;
t3=-4/beta/beta;
t2=t3*th;
else
t1=2*(1-thx)^2;
t2=-4/beta*(1-th/beta);
t3=4/beta/beta;
end
end

%*********************************************

function [t1, t2, t3]=harmonicm(th,thinit,beta,direct)
% code = 3 for harmonic motion
%th=cam angle, radians
%beta=motion range, radians
%thinit=starting cam angle, radians
%beta=motion range, radians
%direct=motion type; +1 for upward, -1 for downward
theta=th-thinit;
t1=0.5*(1-cos(pi*theta/beta));
if direct==-1,  t1=1-t1;end;
t2=direct*(0.5*pi/beta)*sin(pi*theta/beta);
t3=direct*0.5*(pi/beta)^2*cos(pi*theta/beta);


%*********************************************
function [t1, t2, t3]=cycloidm(th,thinit,beta,direct)
%
% code = 4 for cycloidal motion
%th=cam angle, radians
%thinit=starting cam angle, radians
%beta=motion range, radians
%direct=motion type; +1 for upward, -1 for downward
theta=th-thinit;
t1=theta/beta-(0.5/pi)*sin(2*pi*theta/beta);
if direct==-1,t1=1-t1;end;
t2=direct*(1-cos(2*pi*theta/beta));
t3=direct*2*pi/beta/beta*sin(2*pi*theta/beta);

%*********************************************

function [t1, t2, t3]=polynorm(th,thinit,beta,direct)
%
% code = 5 for polynormial motion
%th=cam angle, radians
%thinit=starting cam angle, radians
%beta=motion range, radians
%direct=motion type; +1 for upward, -1 for downward
theta=th-thinit;
thx=theta/beta;
t1=thx*thx*thx*(10+thx*(-15+thx*6));
if direct==-1, t1=1-t1;end;
t2=direct*(30/beta)*thx*thx*(1+thx*(-2+thx));
t3=direct*(60/beta/beta)*thx*(1+thx*(-3 +2*thx));


本程式將配合其他凸輪繪製時呼叫使用。

Dwell執行範例8.10


下面plot_dwell.m為一執行Dwell函數之範例。其指令如下:
function plot_dwell(ctheta,s,pattern,range)

相關參數請參照後節之程式介紹。

function plot_dwell(ctheta,s,pattern,range)
%ctheta   = cam angle (deg)--can be a matrix
%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
% Output: y is for displacement, yy is the derivative of the displacement with
% respect to theta, and yyy the second derivative with respect % to theta.
% Example plot_dwell(0:10:360,2,[4 3],[90 180 240]);
figure(1);clf;
[y,yy,yyy]=dwell(ctheta,range,pattern)
h1=plot(ctheta,y*s,'b-',ctheta,yy*s,'k-',ctheta,yyy*s,'r-')
legend('Displacement','Velocity','Acceleration',3)
xlabel('Elapsed Angle, degrees')
grid


執行例
>>plot_dwell(0:10:360,2,[4 3],[90 180 240]);



範例8.10


就梢從動件之凸輪通常可利用課本圖8.26及公式8.26之轉軸進行模擬各角度之位置,假設一從動件之梢長為L,其偏置量為e,凸輪之基圓半徑為r0,衝程為s。可以利用dwell函數求各角度對應衝程,然後依公式8.26進行轉軸。設此程式名稱為pincam,其呼叫方式如下:
function [x,y]=pincam(cth,r0,s,e,L,range,pattern,cw)

其中,各參數定義如下:
輸入參數:
cth:凸輪角度,度數
r0:凸輪基圓半徑
e:偏置量
s:從動件衝程
L:從動件長度
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]=pincam(cth,r0,s,e,L,range,pattern,cw)
%Find the pin type cam with an offsect e
%Inputs:
%  cth:angle of cam, degrees
%  r0:radius of base circle
%   e:offset
%   s:stroke
%   L:length of pin
%   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]=pincam([10 60],5,2,1,10,[90 180 240],[4 3],-1)
figure(1);
clf;
th=cth*pi/180;
s0=sqrt(r0*r0-e*e);
for i=1:length(cth)
t=th(i)*cw;
A=[cos(t) -sin(t);sin(t) cos(t)];
[ym,yy,yyy]=dwell(cth(i),range,pattern);
x0=s0+ym*s;
Sx=[0 x0 x0+L;e e e];
X=A\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')
end
hold on;
plot([0 x],[0 y],'ro',x,y,'k-')
axis equal

執行例一:偏置量為零時
>> [x y]=pincam([0:10:360],6,5,0,10,[90 180 240],[4 3],-1)


執行例二:偏置量不為零時
>> [x y]=pincam([0:10:360],6,5,4,10,[90 180 240],[4 3],-1);




範例8.12



試就問題8.11所得從動子之抛物線運動之位移量,繪製一凸輪,設從動子屬刀緣接觸型,其基圓半徑為35mm,順時鐘方向旋轉。

[解]請參考圖8.6

繪圖程式撰寫如下:
function [rp,rb]=drawcam(r0,y,direct)
% To draw a cam profile with base radius of r0 and rise in y
% The program may work with P8_11
% Input: direct: +1 for clockwise; -1 for counterclockwise
%
% Example: [s,T]=drawcam(35,y)
d2r=pi/180;
nn=length(y);
LM=max(y+r0);
figure(2);
line([-LM LM]',[0 0]');line([0 0]',[-LM LM]');
if direct==1,
theta=linspace(0,360,nn)'*d2r;
else
theta=linspace(360,0,nn)'*d2r;
end
theta=theta+pi/2;
rb=[r0*cos(theta) r0*sin(theta)];
rp=[(r0+y').*cos(theta) (r0+y').*sin(theta)];
line(rb(:,1),rb(:,2),'color','r')
line(rp(:,1),rp(:,2));
axis equal;

執行結果:
>> [s]=drawcam(35,y,1)
s =
35            0
34.468       6.0777
32.889       11.971
30.311         17.5
26.812       22.498
22.498       26.812
17.5       30.311
11.971       32.889
6.0777       34.468
2.1431e-015           35
-6.3671        36.11
-14.251       39.154
-25       43.301
-37.496       44.686
-48.516        40.71
-56.292         32.5
-61.08       22.231
-64.013       11.287
-65  7.9602e-015
-63.83      -11.255
-60.384      -21.978
-54.848      -31.667
-47.523      -39.877
-38.805      -46.246
-29.167      -50.518
-19.128      -52.553
-9.2291      -52.341
-9.1849e-015          -50
8.1357       -46.14
15.074      -41.416
20.833      -36.084
25.473      -30.358
29.081      -24.402
31.754      -18.333
33.585      -12.224
34.651      -6.1098
35 -8.5725e-015







範例8.13


試就問題8.11所得從動子之抛物線運動之位移量,繪製一凸輪,設從動子屬滾子型,其半徑為8mm,基圓半徑為40mm,順時鐘方向旋轉。
[解]請參考圖8.29

繪圖程式撰寫如下:
function [rp,rb]=draw_roller_cam(r0,r,y,direct)
% To draw a cam profile with base radius of r0 and rise in y
% The program may work with P8_11
% Input: direct: +1 for clockwise; -1 for counterclockwise
%
% Example: [rp,rb]=draw_roller_cam(40,6,y,1)
d2r=pi/180;
nn=length(y);
LM=max(y+r0);
figure(2);
line([-LM LM]',[0 0]');line([0 0]',[-LM LM]');
if direct==1,
theta=linspace(0,360,nn)'*d2r;
else
theta=linspace(360,0,nn)'*d2r;
end
theta=theta+pi/2;
rb=[r0*cos(theta) r0*sin(theta)];
rp=[(r0+y').*cos(theta) (r0+y').*sin(theta)];
line(rb(:,1),rb(:,2),'color','r');
line(rp(:,1),rp(:,2));
th=linspace(0,2*pi,50)';
for i=1:nn,
line(rp(i,1)+r*cos(th),rp(i,2)+r*sin(th));
end
axis equal;


執行結果:
>> [rp,rb]=draw_roller_cam(40,8,y,1)
rp =
2.4493e-015           40
-6.9459       39.392
-13.681       37.588
-20       34.641
-25.712       30.642

------------------------------------------
57.265      -10.097
55 -1.3471e-014
51.064        9.004
46.115       16.784
40.415       23.333
34.188       28.687
27.616       32.912
20.833       36.084
13.934       38.284
6.9781       39.575
1.2246e-014           40
rb =
2.4493e-015           40
-6.9459       39.392
-13.681       37.588
-20       34.641
-25.712       30.642

------------------------------------
25.712       30.642
20       34.641
13.681       37.588
6.9459       39.392
1.2246e-014           40




圖P8.1所得之結果作一切線切於各滾子內圈之弧即可得其工作曲線,而所採用的點數愈多,其內、外包絡線愈為顯明。

範例8.14



試就問題8.11所得從動子之抛物線運動之位移量,繪製一凸輪,設從動子屬平板型,基圓半徑為100mm,順時鐘方向旋轉。

[解]請參考圖8.32

繪圖程式撰寫如下:
function [rp,rb]=draw_plat_cam(nn,r0,s,d,range,pattern,cw)
% The program work with dewell.m
%Inputs:
%  nn:number of points in process
%  r0:radius of base circle
%  re:radius of the roller
%   a:distance between two axes of cam and roller
%   s:stroke
%   d:length of plate follower
%   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: draw_plat_cam(36,5,2,2,[90 180 240],[4 3],-1)
figure(1);clf;d2r=pi/180;
th=linspace(0,360,nn);
[y,ff]=dwell(th,range,pattern);
theta=(th+90)*d2r;%The follower is in upright position
if cw==-1,theta=pi-theta;end
rb=[r0*cos(theta);r0*sin(theta)];
%
%rp=[(r0+y*s).*cos(theta)+cw*ff*s.*sin(theta);...
%    (r0+y*s).*sin(theta)-cw*ff*s.*cos(theta)];
%line(rp(1,:),rp(2,:));%Draw working circle
for i=1:nn,
rr=r0+y(i);
xx=rr*cos(theta(i));yy=rr*sin(theta(i));
line([0 xx], [0 yy]);
dx=d*sin(theta(i));dy=d*cos(theta(i));
line([xx+dx xx-dx],[yy-dy yy+dy],'linewidth',2,'color','red');
end
line(rb(1,:),rb(2,:),'color','r');%draw base circle
axis equal;



執行結果:
>> draw_plat_cam(36,5,2,2,[90 180 240],[4 3],1)


圖P8.14 平板從動子之凸輪軌跡


10.5 凸輪運動之進階分析


如何繪製凸輪之外緣曲線,是探討凸輪的主題。下面程式為針對板式從動件所產生之凸輪外緣曲線,並且依所需之運動型式進行設計。


平板從動件之凸輪

camwork程式為一平板式從動件對凸輪運動時之相對軌跡曲線之繪製,其法與前面之drawcam大致上相同。通常係讓凸輪固定,然後由從動件依設定之角度進行繪製。本程式之呼叫法如下:

  function camwork(rb,rise,range,pattern,platdim,direction,ainc)

參數說明:

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。
rb:基圓半徑
rise:從動件升程
platdim:從動件平板尺寸,其型式如 [Ll,Lr,t], 其中,L1,Lr分別為從動件中心線前與後之板面     長度,t:從動件之厚度
direction:凸輪轉動方向, +1 為逆時鐘;-1 為順時鐘。
ainc: 迴轉角度分量,度


本程式呼叫 dwell.m, bush.m, camfollow.m及 frame.m等函數,若需要板面傾斜某一角度,則需另呼叫trans4.m程式,此函數在第二章中有關轉動座標之函數中已經介紹過,可以引用。

function camwork(rb,rise,range,pattern,platdim,direction,ainc)
%Draw a plate cam in diferent positions
% Call dwell.m, bush.m, camfollow.m, frame.m
%Inputs:
%   rb:radius of the cam base circle
%   rise:rise of the follower
%range    =the degrees the specific motion starts(array of 3 elements), e.g.
%          [90 180 240] starts to rise at 90 deg. and ends at 180 deg.
%           starts to return at 240 deg. and ends at 360 deg.
%pattern  = denote the types of motion used(a 2 element-row matrix). types
%         are:
%         1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
%         5:polynomial motion
%         e.g. [4 3]:cycloidal motion for rise and harmonic motion for
%         return
%platdim:the plate dimension, in forms of [Ll,Lr,t], in which
%        L1,Lr:length of plage in front of and behind the centerline,
%        t:thickness of the axle of the plate follower.
%   direction:cam direction, +1 for counterclockwise; -1 for clockwise
%   ainc: angular increment, degrees
%Examples: camwork(5,2,[100 180 270],[3 3],[2 3 1],1,60)
platdim(find(platdim<=0.2))=0.2;
d2r=pi/180;
camangle=0:1:360;
th=camangle*d2r;
[s,ss,sss]=dwell(camangle,range,pattern);
s=s*rise;ss=ss*rise;
xcam=(rb+s).*cos(th)-ss.*sin(th);
ycam=(rb+s).*sin(th)+ss.*cos(th);
ycam=ycam*direction;
[coords]=bushing(-rb,0,0);
xb=coords(:,1);yb=coords(:,2);
[coords]=bushing(rb/7,0,0);
xbush=coords(:,1);ybush=coords(:,2);
figure(1);
clf;
axis equal;
thi=[0:ainc:360]';
nx=length(thi);
bush=line('xdata',[],'ydata',[],'linewidth',1.5,'color','r','erasemode','none');
base=line('xdata',[],'ydata',[],'linewidth',1,'color','b','erasemode','none');
cam=line('xdata',[],'ydata',[],'linewidth',2,'color','k','erasemode','none');
frame1=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
frame2=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
for k=1:nx-1,
follow(k)=line('xdata',[],'ydata',[],'linewidth',1,'color','k','erasemode','none');
end
line1=line('xdata',[],'ydata',[],'linewidth',1,'color','k','erasemode','none');
bead=line('xdata', [], 'ydata', [],'marker','o','markersize', 6, 'erasemode',...
'xor');
set(bush,'xdata',xbush,'ydata',ybush);
set(base,'xdata',xb,'ydata',yb);
set(cam,'xdata',xcam,'ydata',ycam);
%set(bush,'xdata',xbush,'ydata',ybush);
thr=thi*d2r;
tho=thi;if direction==-1,tho=360-thi;end;
[coordf]=camfollow(platdim(1),platdim(2),platdim(3),rise);
coords=coordf;
linest=[];
[frame0]=frame(platdim(3),rise,1,0);
set(frame1,'xdata',frame0(:,1)+rb,'ydata',frame0(:,2))
[frame0]=frame(platdim(3),rise,-1,0);
set(frame2,'xdata',frame0(:,1)+rb,'ydata',frame0(:,2))

for i=1:length(thr)-1
[s,ss,sss]=dwell(thi(i),range,pattern);
s=s*rise;ss=ss*rise;
xx=(rb+s)*cos(thr(i))-ss*sin(thr(i));
yy=((rb+s)*sin(thr(i))+ss*cos(thr(i)))*direction;
coords=coordf;
coords(:,1)=coordf(:,1)+rb+s;
xf=rb+s;yf=0;
[coords]=trans4(coords,tho(i),5);
[linef]=trans4([0 0;xf yf],tho(i),5);
text(linef(2,1),linef(2,2),num2str(tho(i)));
linest=[linest;0 0;linef];
set(bead,'xdata',xx,'ydata',yy);
set(follow(i),'xdata',coords(:,1),'ydata',coords(:,2));
end
set(line1,'xdata',linest(:,1),'ydata',linest(:,2));
axis equal;

function [coords] = bushing(rr,x0,y0)
% Determine the coordinates of the anchor seat
% rr: radius of the shaft
% x0,y0: center coordinates of the shaft
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;
hold off;


function [coords]=camfollow(tl,tr,thickness,stroke,theta)
%Detemine the coordinates of the plate follower
%Inputs:
%   tl:length of plate in front of center line
%   tr:length of plate behind the cneter line
%   thickness:thichness of the plate
%   stroke:rise of the follower
%   theta:the slant angle(degrees) of plate
%Outputs:coords:coordinates of the plate
%coordinates for bock and outside form
t=thickness;s=stroke*1.5;tm=t/2;
coords=[0 0;0 tl; tm tl; t tm;t+s tm;t+s -tm;t -tm;tm -tr;0 -tr;0 0];
if nargin==5 % draw a slant follower
coords=trans4(coords,theta,5);
end

function [coords]=frame(thickness,stroke,mode,theta)
% determine the coordinate of follower seat
% Inputs:
%     thickness:the thckness of the follower shaft
%     stroke:rise of the follower
%     theta:slant angle of the follower, degrees
%      mode:+1 for one side, -1 for another side
t=thickness*1.05;s=stroke*1.2;
t0=thickness+stroke;tx=t/2;tm=t/3;
if mode==1
coords=[t0 -tx];
tt=t0+tm;
while 1
coords=[coords;tt -tx;tt-tm -tx-tm;tt -tx];
tt=tt+tm;
if tt-t0>s, break;end
end
end
if mode==-1
coords=[t0 tx];
tt=t0+tm;
while 1
coords=[coords;tt tx;tt-tm tx+tm;tt tx];
tt=tt+tm;
if tt-t0>s, break;end
end
end
if nargin==4,
coords=trans4(coords,theta,5);
end


執行範例:


基圓半徑5公分,升程2公分,分佈範圍為[100 180 270]度,升程與返程均使用簡諧運動型式,從動件為平板,左2公分,右3公分,板軸厚度為1公分,試將圓周以60均分繪出其從動件位置及對應之凸輪曲線。

>>camwork(5,2,[100 180 270],[3 3],[2 3 1],1,60)




10.6 滾輪從動件之凸輪

以滾子從動件運轉之凸輪可以利用camwork2.m進行繪製,其呼叫法如下:

  function camwork2(rb,ro,rise,offset,range,pattern,direction,ainc)

參數說明:

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。
rb:基圓半徑
ro:滾子從動件半徑
rise:從動件升程
offset:從動件之中心線偏置量
direction:凸輪轉動方向, +1 為逆時鐘;-1 為順時鐘。
ainc: 迴轉角度分量,度


camwork2程式呼叫 dwell.m, bush.m, camfollow2.m及 frame.m等函數。同camwork,若滾子軸需要板面傾斜某一角度,則需另呼叫trans4.m程式,此函數在第二章中有關轉動座標之函數中已經介紹過,可以引用。


function camwork2(rb,ro,rise,offset,range,pattern,direction,ainc)
%
%function camwork2(rb,ro,rise,offset,range,pattern,direction,ainc)
%find roller cam curve using envelop technique
% Call dwell.m, bush.m, camfollow.m, frame.m
%Inputs:
%   rb:radius of the cam base circle
%   ro:radius of the roller follower
%   rise:rise of the follower
%   offset:the offset of centerline of follower
%   range =the degrees the specific motion starts(array of 3 elements), e.g.
%          [90 180 240] starts to rise at 90 deg. and ends at 180 deg.
%           starts to return at 240 deg. and ends at 360 deg.
%   pattern= denote the types of motion used(a 2 element-row matrix). types
%         are:
%         1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
%         5:polynomial motion
%         e.g. [4 3]:cycloidal motion for rise and harmonic motion for
%         return
%   direction:cam direction, +1 for counterclockwise; -1 for clockwise
%   ainc: angular increment, degrees
%Examples: camwork2(5,2,1.5,1,[100 180 270],[3 3],1,60)
%Designed by D S Fon, BIME, NYU. Dated June 10, 2002
d2r=pi/180;
camangle=0:1:360;
th=camangle*d2r;
[s,ss,sss]=dwell(camangle,range,pattern);
s=s*rise;ss=ss*rise;
rho=rb+ro+s;
alpha=atan((rho./(offset*offset+rho.*rho)-offset).*ss);
phi=alpha-atan(offset./rho)/d2r;
offset0=abs(offset);
dd=sqrt((rb+ro)^2-offset*offset);%distance from center of roller to x-axis
ct=cos(th);st=sin(th);
UU=(dd+s).*st-(offset+ss).*ct;
VV=(dd+s).*ct+(offset+ss).*st;
xcam=offset*st+(dd+s).*ct-sign(ct)*ro./sqrt(1+(UU./VV).^2);
ycam=(xcam.*UU+(dd+s).*ss)./VV;
ycam=ycam*direction;
xf=offset*st+(dd+s).*ct;
yf=(-offset*ct+(dd+s).*st)*direction;
arg=ycam.^2+xcam.^2-(yf.^2+xf.^2);
ycam(arg>0)=[];
xcam(arg>0)=[];
[coords]=bushing(-rb,0,0);
xb=coords(:,1);yb=coords(:,2);
[coords]=bushing(-abs(offset),0,0);
xoff=coords(:,1);yoff=coords(:,2);
figure(1);
clf;
thi=[0:ainc:360]';
nx=length(thi);
base=line('xdata',[],'ydata',[],'linewidth',1,'color','b','erasemode','none');
offcircle=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
pitch=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
cam=line('xdata',[],'ydata',[],'linewidth',2,'color','k','erasemode','none');
frame1=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
frame2=line('xdata',[],'ydata',[],'linewidth',1,'color','r','erasemode','none');
for k=1:nx-1,
follow(k)=line('xdata',[],'ydata',[],'linewidth',1,'color','k',...
'erasemode','none');
linex(k)=line('xdata',[],'ydata',[],'linewidth',1,'color','k',...
'erasemode','none');
end
set(base,'xdata',xb,'ydata',yb);
set(cam,'xdata',xcam,'ydata',ycam);
set(offcircle,'xdata',xoff,'ydata',yoff);
set(pitch,'xdata',xf,'ydata',yf);
thr=thi*d2r;
tho=thi;if direction==-1,tho=360-thi;end;
[coordf]=camfollow2(ro,ro/2,rise);
coordf(:,2)=coordf(:,2);
coords=coordf;
maxline=rb+ro*2+rise;
offset0=-offset*direction;
[frame0]=frame(ro/2,rise,1,0);
set(frame1,'xdata',frame0(:,1)+rb+ro,'ydata',frame0(:,2)+offset0);
[frame0]=frame(ro/2,rise,-1,0);
set(frame2,'xdata',frame0(:,1)+rb+ro,'ydata',frame0(:,2)+offset0);
for i=1:length(thr)-1
[s,ss,sss]=dwell(thi(i),range,pattern);
s=s*rise;ss=ss*rise;
ct=cos(thr(i));st=sin(thr(i));
xf=offset*st+(dd+s)*ct;
yf=(-offset*ct+(dd+s)*st)*direction;
[coords]=trans4(coordf,tho(i),5);
coords=trans4(coords,[xf yf],1);
linef=[maxline 0;0 0;0 offset0];
[linef]=trans4(linef,tho(i),5);
linef=[linef;xf yf];
text(xf,yf,num2str(tho(i)));
set(linex(i),'xdata',linef(:,1),'ydata',linef(:,2));
set(follow(i),'xdata',coords(:,1),'ydata',coords(:,2));
end
axis equal;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [coords] = bushing(rr,x0,y0)
% Determine the coordinates of the anchor seat
% rr: radius of the shaft
% x0,y0: center coordinates of the shaft
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;
hold off;


function [coords]=camfollow2(r,thickness,stroke,theta,npts)
%[coords]=camfollow2(r,thickness,stroke,theta,npts)
%This program gives coordinates for different type of cam followers
% Inputs:
%    r        : radius of roller if any
%    thickness: thickness of rod
%    stroke   : the maximum stroke movement
%    theta    : angle that foller inclines
%    npts     : No. of points to draw the roller, default=30, npts=3 for point follower
%    if thickness >2r, the orign will be transfered to the edge of circle or the point,
%       otherwise, it is located at the center of the circle.
%Designed by D.S.Fon, BIME, NTU, dated June 6, 2002
t=thickness;tm=t/2;
s=stroke;
if stroke>0,s=stroke*1.5;end
th1=0;th2=2*pi;
loc=0;
if t<2*r,
th1=asin(abs(tm)/r);
th2=th2-th1;
else
t=2*r,th1=pi/2;th2=th2-th1;
loc=1;
end
nn=30;if nargin==5,nn=npts;end;
th=linspace(th1,th2,nn);
rx=r*cos(th);ry=r*sin(th);
coords=[rx' ry';s+r -tm;s+r tm;rx(1) ry(1)];
if loc,coords=trans4(coords,[r 0],1);end
if nargin==4 % draw a slant follower
coords=trans4(coords,theta,5);
end


function [coords]=frame(thickness,stroke,mode,theta)
% determine the coordinate of follower seat
% Inputs:
%     thickness:the thckness of the follower shaft
%     stroke:rise of the follower
%     theta:slant angle of the follower, degrees
%      mode:+1 for one side, -1 for another side
t=thickness*1.05;s=stroke*1.2;
t0=thickness+stroke;tx=t/2;tm=t/3;
if mode==1
coords=[t0 -tx];
tt=t0+tm;
while 1
coords=[coords;tt -tx;tt-tm -tx-tm;tt -tx];
tt=tt+tm;
if tt-t0>s, break;end
end
end
if mode==-1
coords=[t0 tx];
tt=t0+tm;
while 1
coords=[coords;tt tx;tt-tm tx+tm;tt tx];
tt=tt+tm;
if tt-t0>s, break;end
end
end
if nargin==4,
coords=trans4(coords,theta,5);
end



執行範例:

基圓半徑5公分之凸輪,其從動件為滾子,直徑為2公分。設此組凸輪之升程1.5公分,從動件之偏置量為1公分。分佈範圍為[100 180 270]度,升程與返程均使用簡諧運動型式,從動件為平板,左2公分,右3公分,板軸厚度為1公分,試將圓周以60均分繪出其從動件位置及對應之凸輪曲線。

將上述資訊化為指令參數,執行結果如下:
>> camwork2(5,2,1.5,1,[100 180 270],[3 3],1,60)






其他凸輪動畫


Interactive Cam Mechanism Design