哈工大機械原理連桿機構運動分析作業_第1頁
哈工大機械原理連桿機構運動分析作業_第2頁
哈工大機械原理連桿機構運動分析作業_第3頁
哈工大機械原理連桿機構運動分析作業_第4頁
哈工大機械原理連桿機構運動分析作業_第5頁
已閱讀5頁,還剩18頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、機械原理大作業 課設計題目:連桿機構運動分析院 5,源代碼RR I級機構運動分析的源代碼Public Class RR '定義輸入字段 Public rxA As Single Public ryA As Single Public vxA As Single Public vyA As Single Public axA As SinglePublic ayA As Single Public phii As Single Public omegai As Single Public alphai As SinglePublic li As Single '定義輸出參數 Pr

2、ivate sgl_rxB As Single Private sgl_ryB As Single Private sgl_vxB As Single Private sgl_vyB As Single Private sgl_axB As Single Private sgl_ayB As Single '實例化類并初始化輸入字段 Public Sub New(ByVal radiusVector_xA As Single, ByVal radiusVector_yA As Single, ByVal velocity_xA As Single, ByVal velocity_yA

3、As Single, ByVal acceleration_xA As Single, ByVal acceleration_yA As Single, ByVal phi_i As Single, ByVal omega_i As Single, ByVal alpha_i As Single, ByVal length_i As Single) rxA = radiusVector_xA ryA = radiusVector_yA vxA = velocity_xA vyA = velocity_yA axA = acceleration_xA ayA = acceleration_yA

4、phii = phi_i omegai = omega_i alphai = alpha_i li = length_i End Sub '定義輸出屬性 Public ReadOnly Property rxB As Single Get Return sgl_rxB End Get End Property Public ReadOnly Property ryB As Single Get Return sgl_ryB End Get End Property Public ReadOnly Property vxB As Single Get Return sgl_vxB End

5、 Get End Property Public ReadOnly Property vyB As Single Get Return sgl_vyB End Get End Property Public ReadOnly Property axB As Single Get Return sgl_axB End Get End Property Public ReadOnly Property ayB As Single Get Return sgl_ayB End Get End Property '計算輸出參數 Public Sub Calculate() sgl_rxB =

6、rxA + li * Math.Cos(phii) sgl_ryB = ryA + li * Math.Sin(phii) sgl_vxB = vxA - omegai * li * Math.Sin(phii) sgl_vyB = vyA + omegai * li * Math.Cos(phii) sgl_axB = axA - omegai * omegai * li * Math.Cos(phii) - alphai * li *_ Math.Sin(phii) sgl_ayB = ayA - omegai * omegai * li * Math.Sin(phii) + alphai

7、 * li *_ Math.Cos(phii) End SubEnd ClassRPR II級基本組運動分析的源代碼Public Class RPR '定義桿組模式枚舉類型 Public Enum Mode As Integer ClockWise = 1 AntiClockWise = -1 End Enum '定義輸入字段 Public rxB As Single Public ryB As Single Public vxB As Single Public vyB As Single Public axB As Single Public ayB As Single P

8、ublic rxD As Single Public ryD As Single Public vxD As Single Public vyD As Single Public axD As Single Public ayD As Single Public li As Single Public lj As Single Public lk As Single Public M As Mode '定義輸出參數 Private sgl_rxC As Single Private sgl_ryC As Single Private sgl_vxC As Single Private

9、sgl_vyC As Single Private sgl_axC As Single Private sgl_ayC As Single Private sgl_rxE As Single Private sgl_ryE As Single Private sgl_vxE As Single Private sgl_vyE As Single Private sgl_axE As Single Private sgl_ayE As Single Private sgl_phij As Double Private sgl_omegaj As Double Private sgl_alphaj

10、 As Double '實例化類并初始化輸入字段 Public Sub New(ByVal radiusVector_xB As Single, ByVal radiusVector_yB As Single, ByVal velocity_xB As Single, ByVal velocity_yB As Single,ByVal acceleration_xB As Single, ByVal acceleration_yB As Single, ByVal radiusVector_xD As Single, ByVal radiusVector_yD As Single,By

11、Val velocity_xD As Single, ByVal velocity_yD As Single, ByVal acceleration_xD As Single, ByVal acceleration_yD As Single,ByVal length_i As Single, ByVal length_j As Single, ByVal length_k As Single, ByVal mode As Mode) rxB = radiusVector_xB ryB = radiusVector_yB vxB = velocity_xB vyB = velocity_yB a

12、xB = acceleration_xB ayB = acceleration_yB rxD = radiusVector_xD ryD = radiusVector_yD vxD = velocity_xD vyD = velocity_yD axD = acceleration_xD ayD = acceleration_yD li = length_i lj = length_j lk = length_k M = mode End Sub '定義輸出屬性 Public ReadOnly Property rxC As Single Get Return sgl_rxC End

13、Get End Property Public ReadOnly Property ryC As Single Get Return sgl_ryC End Get End Property Public ReadOnly Property vxC As Single Get Return sgl_vxC End Get End Property Public ReadOnly Property vyC As Single Get Return sgl_vyC End Get End Property Public ReadOnly Property axC As Single Get Ret

14、urn sgl_axC End Get End Property Public ReadOnly Property ayC As Single Get Return sgl_ayC End Get End Property Public ReadOnly Property rxE As Single Get Return sgl_rxE End Get End Property Public ReadOnly Property ryE As Single Get Return sgl_ryE End Get End Property Public ReadOnly Property vxE A

15、s Single Get Return sgl_vxE End Get End Property Public ReadOnly Property vyE As Single Get Return sgl_vyE End Get End Property Public ReadOnly Property axE As Single Get Return sgl_axE End Get End Property Public ReadOnly Property ayE As Single Get Return sgl_ayE End Get End Property Public ReadOnl

16、y Property phij As Single Get Return sgl_phij End Get End Property Public ReadOnly Property omegaj As Single Get Return sgl_omegaj End Get End Property Public ReadOnly Property alphaj As Single Get Return sgl_alphaj End Get End Property '計算輸出參數 Public Sub Calculate() Dim phii As Double Dim phik

17、As Double Dim s As Double Dim v As Double Dim a As Double '計算phij Dim kDB As Double Dim phiDB As Double Dim phi As Double If rxB <> rxD Then kDB = (ryB - ryD) / (rxB - rxD) If rxB > rxD Then phiDB = Math.Atan(kDB) Else phiDB = Math.Atan(kDB) + Math.PI End If Else If ryB > ryD Then ph

18、iDB = Math.PI / 2 Else phiDB = 3 * Math.PI / 2 End If End If phi = Math.Asin(li + lk) / Math.Sqrt(rxB - rxD) * (rxB - rxD) + (ryB - ryD)*_ (ryB - ryD) sgl_phij = phiDB + M * phi If sgl_phij < 0 Then sgl_phij += 2 * Math.PI End If '計算s If li = 0 And lk = 0 Then s = Math.Sqrt(rxB - rxD) * (rxB

19、- rxD) + (ryB - ryD) * (ryB - ryD) Else s = (li + lk) / Math.Tan(phi) End If '計算phii,phik phii = sgl_phij + M * Math.PI / 2 phik = sgl_phij - M * Math.PI / 2 '計算rC sgl_rxC = rxB + li * Math.Cos(phii) sgl_ryC = ryB + li * Math.Sin(phii) '計算rE sgl_rxE = rxC + (lj - s) * Math.Cos(sgl_phij)

20、sgl_ryE = ryC + (lj - s) * Math.Sin(sgl_phij) '計算omegaj Dim G4 As Double = (rxB - rxD) * Math.Cos(sgl_phij) + (ryB - ryD) *_ Math.Sin(sgl_phij) sgl_omegaj = (vyB - vyD) * Math.Cos(sgl_phij) - (vxB - vxD) *_ Math.Sin(sgl_phij) / G4 '計算v v = (vxB - vxD) * (rxB - rxD) + (vyB - vyD) * (ryB - ryD

21、) / G4 '計算vC sgl_vxC = vxB - sgl_omegaj * Math.Sin(phii) sgl_vyC = vyB + sgl_omegaj * Math.Cos(phii) '計算alphaj Dim G5 As Double = axB - ayD + sgl_omegaj * sgl_omegaj * (rxB - rxD) + 2 * v *_ sgl_omegaj * Math.Sin(sgl_phij) Dim G6 As Double = ayB - ayD + sgl_omegaj * sgl_omegaj * (ryB - ryD)

22、- 2 * v *_ sgl_omegaj * Math.Cos(sgl_phij) sgl_alphaj = (G6 * Math.Cos(sgl_phij) - G5 * Math.Sin(sgl_phij) / G4 '計算s a = (G5 * (rxB - rxD) + G6 * (ryB - ryD) / G4 '計算vC sgl_axC = axB - sgl_alphaj * Math.Sin(phii) - sgl_omegaj * sgl_omegaj *_ Math.Cos(phii) sgl_ayC = ayB + sgl_alphaj * Math.C

23、os(phii) - sgl_omegaj * sgl_omegaj *_ Math.Sin(phii) End SubEnd ClassRRP II級基本組運動分析的源代碼Public Class RRP '定義桿組模式枚舉類型 Public Enum Mode As Integer ClockWise = 1 AntiClockWise = -1 End Enum '定義輸入字段 Public rxB As Single Public ryB As Single Public vxB As Single Public vyB As Single Public axB As

24、Single Public ayB As Single Public rxK As Single Public ryK As Single Public vxK As Single Public vyK As Single Public axK As Single Public ayK As Single Public phij As Single Public omegaj As Single Public alphaj As Single Public li As Single Public lj As Single Public M As Mode '定義輸出參數 Private

25、 sgl_rxC As Single Private sgl_ryC As Single Private sgl_vxC As Single Private sgl_vyC As Single Private sgl_axC As Single Private sgl_ayC As Single Private sgl_rxD As Single Private sgl_ryD As Single Private sgl_vxD As Single Private sgl_vyD As Single Private sgl_axD As Single Private sgl_ayD As Si

26、ngle Private sgl_phii As Double Private sgl_omegai As Double Private sgl_alphai As Double '實例化類并初始化輸入字段 Public Sub New(ByVal radiusVector_xB As Single, ByVal radiusVector_yB As Single, ByVal velocity_xB As Single, ByVal velocity_yB As Single, ByVal acceleration_xB As Single, ByVal acceleration_y

27、B As Single, ByVal radiusVector_xK As Single, ByVal radiusVector_yK As Single,ByVal velocity_xK As Single, ByVal velocity_yK As Single, ByVal acceleration_xK As Single, ByVal acceleration_yK As Single,ByVal phi_j As Single, ByVal omega_j As Single, ByVal alpha_j As Single, ByVal length_i As Single,

28、ByVal length_j As Single,ByVal mode As Mode) rxB = radiusVector_xB ryB = radiusVector_yB vxB = velocity_xB vyB = velocity_yB axB = acceleration_xB ayB = acceleration_yB rxK = radiusVector_xK ryK = radiusVector_yK vxK = velocity_xK vyK = velocity_yK axK = acceleration_xK ayK = acceleration_yK phij =

29、phi_j omegaj = omega_j alphaj = alpha_j li = length_i lj = length_j M = mode End Sub '定義輸出屬性 Public ReadOnly Property rxC As Single Get Return sgl_rxC End Get End Property Public ReadOnly Property ryC As Single Get Return sgl_ryC End Get End Property Public ReadOnly Property vxC As Single Get Re

30、turn sgl_vxC End Get End Property Public ReadOnly Property vyC As Single Get Return sgl_vyC End Get End Property Public ReadOnly Property axC As Single Get Return sgl_axC End Get End Property Public ReadOnly Property ayC As Single Get Return sgl_ayC End Get End Property Public ReadOnly Property rxD

31、As Single Get Return sgl_rxD End Get End Property Public ReadOnly Property ryD As Single Get Return sgl_ryD End Get End Property Public ReadOnly Property vxD As Single Get Return sgl_vxD End Get End Property Public ReadOnly Property vyD As Single Get Return sgl_vyD End Get End Property Public ReadOn

32、ly Property axD As Single Get Return sgl_axD End Get End Property Public ReadOnly Property ayD As Single Get Return sgl_ayD End Get End Property Public ReadOnly Property phii As Single Get Return sgl_phii End Get End Property Public ReadOnly Property omegai As Single Get Return sgl_omegai End Get En

33、d Property Public ReadOnly Property alphai As Single Get Return sgl_alphai End Get End Property '計算輸出參數 Public Sub Calculate() '計算phii Dim h As Double If Math.Cos(phij) = 0 Then h = rxB - rxK Else h = Math.Abs(Math.Cos(phij) * (ryK - ryB - Math.Tan(phij) * (rxK - rxB) End If If M = Mode.Cloc

34、kWise Then sgl_phii = Math.Asin(h + lj) / li) + phij Else sgl_phii = Math.PI - Math.Asin(h + lj) / li) + phij End If '計算rC sgl_rxC = rxB + li * Math.Cos(sgl_phii) sgl_ryC = ryB + li * Math.Sin(sgl_phii) '計算rD Dim s As Double = (sgl_rxC - rxK + lj * Math.Sin(phij) / Math.Cos(phij) sgl_rxD = r

35、xK + s * Math.Cos(phij) sgl_ryD = ryK + s * Math.Sin(phij) '計算omegai Dim Q1 As Double = vxK - vxB - omegaj * (s * Math.Sin(phij) + lj *_ Math.Cos(phij) Dim Q2 As Double = vyK - vyB + omegaj * (s * Math.Cos(phij) - lj *_ Math.Sin(phij) Dim Q3 As Double = li * Math.Sin(sgl_phii) * Math.Sin(phij) +

36、 li *_ Math.Cos(sgl_phii) * Math.Cos(phij) sgl_omegai = (Q2 * Math.Cos(phij) - Q1 * Math.Sin(phij) / Q3 '計算vC sgl_vxC = vxB - sgl_omegai * li * Math.Sin(sgl_phii) sgl_vyC = vyB + sgl_omegai * li * Math.Cos(sgl_phii) '計算vD Dim v As Double = -(Q1 * li * Math.Cos(sgl_phii) + Q2 * li *_ Math.Sin

37、(sgl_phii) / Q3 sgl_vxD = vxK + v * Math.Cos(phij) - s * omegaj * Math.Sin(phij) sgl_vyD = vyK + v * Math.Sin(phij) + s * omegaj * Math.Cos(phij) '計算alphai Dim Q4 As Double = axK - axB + sgl_omegai * sgl_omegai * li *_ Math.Cos(sgl_phii) - alphaj * (s * Math.Sin(phij) + lj * Math.Cos(phij) - ome

38、gaj *_ omegaj * (s * Math.Cos(phij) - lj * Math.Sin(phij) - 2 * v * omegaj * Math.Sin(phij) Dim Q5 As Double = ayK - ayB + sgl_omegai * sgl_omegai * li *_ Math.Sin(sgl_phii) + alphaj * (s * Math.Cos(phij) - lj * Math.Sin(phij) - omegaj *_ omegaj * (s * Math.Sin(phij) + lj * Math.Cos(phij) + 2 * v *

39、omegaj * Math.Cos(phij) sgl_alphai = (Q5 * Math.Cos(phij) - Q4 * Math.Sin(phij) / Q3 '計算aC sgl_axC = axB - sgl_alphai * li * Math.Sin(sgl_phii) - sgl_omegai * sgl_omegai_ * li * Math.Cos(sgl_phii) sgl_ayC = ayB + sgl_alphai * li * Math.Cos(sgl_phii) - sgl_omegai * sgl_omegai_ * li * Math.Sin(sgl

40、_phii) '計算aD Dim a As Double = -(Q4 * li * Math.Cos(sgl_phii) + Q5 * li *_ Math.Sin(sgl_phii) / Q3 sgl_axD = axK + a * Math.Cos(phij) - s * alphaj * Math.Sin(phij) -s * omegaj *_ omegaj * Math.Cos(phij) - 2 * v * omegaj * Math.Sin(phij) sgl_ayD = ayK + a * Math.Sin(phij) + s * alphaj * Math.Cos(

41、phij) -s * omegaj *_ omegaj * Math.Sin(phij) + 2 * v * omegaj * Math.Cos(phij) End SubEnd Class整個連桿機構運動分析的源代碼Public Class Linkage Public Const n As Integer = 999'定義各點坐標字段 Public rB(n) As PointF Public rD(n) As PointF Public rF(n) As PointFPublic rH(n) As PointF '定義G點運動狀態字段 Public rxG(n) As S

42、ingle Public vxG(n) As Single Public axG(n) As Single '計算整個機構的運動狀態 Private Sub Linkage_Load(sender As Object, e As EventArgs) Handles MyBase.Load '定義并初始化已知參數 Dim omega1 As Single = 10 Dim lAB As Single = 170 Dim lCD As Single = 200 Dim lEF As Single = 650 Dim lFG As Single = 500 Dim vxB(n) A

43、s Single Dim vyB(n) As Single Dim axB(n) As Single Dim ayB(n) As Single Dim vxD(n) As Single Dim vyD(n) As Single Dim axD(n) As Single Dim ayD(n) As Single Dim vxF(n) As Single Dim vyF(n) As Single Dim axF(n) As Single Dim ayF(n) As Single Dim phiCD(n) As Single Dim omegaCD(n) As Single Dim alphaCD(

44、n) As Single Dim phiEF(n) As Single Dim omegaEF(n) As Single Dim alphaEF(n) As Single Dim phiAB As Single Dim stepPhi As Single = Math.PI * 2 / 1000 Dim AB As RR Dim BBC As RPR Dim CD As RR Dim DDE As RPR Dim EF As RR Dim FGG As RRP '計算機構運動狀態 For i As Integer = 0 To n phiAB = i * stepPhi '計算

45、B點的運動狀態 AB = New RR(0, 0, 0, 0, 0, 0, phiAB, 10, 0, lAB) AB.Calculate() rB(i).X = AB.rxB rB(i).Y = AB.ryB vxB(i) = AB.vxB vyB(i) = AB.vyB axB(i) = AB.axB ayB(i) = AB.ayB '計算H點和CD桿的運動狀態 BBC = New RPR(rB(i).X, rB(i).Y, vxB(i), vyB(i), axB(i), ayB(i), -110, 0, 0, 0, 0, 0, 0, 300, 0, 1) BBC.Calculat

46、e() rH(i).X = BBC.rxE rH(i).Y = BBC.ryE phiCD(i) = BBC.phij + Math.PI / 2 If phiCD(i) > 2 * Math.PI Then phiCD(i) -= 2 * Math.PI omegaCD(i) = BBC.omegaj alphaCD(i) = BBC.alphaj '計算D點的運動狀態 CD = New RR(-110, 0, 0, 0, 0, 0, phiCD(i), omegaCD(i), alphaCD(i), lCD) CD.Calculate() rD(i).X = CD.rxB rD(i).Y =

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論