⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 游动微型机器人动力学特性仿真研究,本软件编制了机器人动力学性能计算软件,研究了微型机器人的游动速度、推进力与微型机器人结构参数和游动参数的关系
💻 FRM
📖 第 1 页 / 共 2 页
字号:
               Top             =   480
               Width           =   735
            End
         End
         Begin VB.Label Label12 
            Caption         =   "°"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   10.5
               Charset         =   134
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   495
            Left            =   14040
            TabIndex        =   31
            Top             =   600
            Width           =   615
         End
         Begin VB.Label Label10 
            Caption         =   "g"
            Height          =   375
            Left            =   6600
            TabIndex        =   30
            Top             =   600
            Width           =   495
         End
         Begin VB.Label Label1 
            Caption         =   "mm"
            Height          =   375
            Left            =   3240
            TabIndex        =   29
            Top             =   600
            Width           =   495
         End
         Begin VB.Label Label6 
            Caption         =   "击水角度α(摆动波幅) a(x)≈tan(α)x"
            Height          =   735
            Left            =   10440
            TabIndex        =   6
            Top             =   600
            Width           =   1935
         End
         Begin VB.Label Label5 
            Caption         =   "机器人质量      M(0)"
            Height          =   735
            Left            =   3960
            TabIndex        =   5
            Top             =   480
            Width           =   1215
         End
         Begin VB.Label Label3 
            Caption         =   "游动时尾部所占波数k"
            Height          =   735
            Left            =   7200
            TabIndex        =   4
            Top             =   480
            Width           =   1095
         End
         Begin VB.Label Label2 
            Caption         =   "机器人尾部长度L"
            Height          =   615
            Left            =   480
            TabIndex        =   3
            Top             =   600
            Width           =   1095
         End
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "上一页"
      Height          =   855
      Left            =   7080
      TabIndex        =   0
      Top             =   11280
      Width           =   1935
   End
   Begin VB.Menu 文件 
      Caption         =   "文件"
      Begin VB.Menu 退出 
         Caption         =   "退出"
      End
   End
   Begin VB.Menu 学号 
      Caption         =   "学号"
      Begin VB.Menu 号码 
         Caption         =   "050210734"
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const PI = 3.14159
Dim L0 As Double  'L0为游动尾部长
Dim L1 As Double '三角形
Dim h As Double
Dim x As Double
Dim M1 As Double
Dim M0 As Double
Dim V1 As Double
Dim k As Double
Dim λ As Double
Dim α As Double
Dim ρ As Double
Public Function tu()
Pic1.Scale (-1, 24)-(9, -2)
Pic1.Line (-0.5, 0)-(8, 0)
Pic1.Line (0, -1)-(0, 23)
Pic1.Line (7.6, -0.4)-(8, 0)
Pic1.Line (7.6, 0.4)-(8, 0)
Pic1.Line (-0.15, 22)-(0, 23)
Pic1.Line (0.15, 22)-(0, 23)
Pic1.CurrentX = 8
Pic1.CurrentY = -0.5
Pic1.Print "f(Hz)"
Pic1.CurrentX = 0.2
Pic1.CurrentY = 23
Pic1.Print "V(mm/s)"
Pic1.DrawStyle = 2
For i = 1 To 8
Pic1.CurrentY = -0.5
Pic1.CurrentX = i - 1
Pic1.Print i - 1
Pic1.Line (i - 1, 0)-(i - 1, 22)
Next
For i = 1 To 11
Pic1.CurrentX = -0.5
Pic1.CurrentY = 2 * i
Pic1.Print 2 * i
Pic1.Line (0, 2 * i)-(7, 2 * i)
Next
Pic1.DrawStyle = 0
End Function
Public Function Romberg(problem As Long, a As Double, b As Double, tol As Double) As Double
     Dim i As Long, j As Long, T() As Double, L As Long
     Dim x As Double, dx As Double, n As Long, sum As Double
     ReDim T(1 To 3)
     T(1) = (b - a) * (fx(problem, a) + fx(problem, b)) / 2
     T(2) = T(1) / 2 + (b - a) * (fx(problem, (a + b) / 2)) / 2
     T(3) = (4 * T(2) - T(1)) / 3
     j = 3
     Do While Abs(T(UBound(T)) - T(UBound(T) - 2)) > tol
          dx = (b - a) / (2 ^ (j - 1))
          x = a - dx
          n = 2 ^ (j - 2)
          sum = 0
          For i = 1 To n
               x = x + 2 * dx
               sum = sum + fx(problem, x)
          Next
          For i = 2 To UBound(T) Step 2
               T(i - 1) = T(i)
          Next
          T(2) = T(1) / 2 + dx * sum
          ReDim Preserve T(1 To UBound(T) + 2)
          For L = 2 To j
               If L <> j Then
                    T(L * 2) = ((4 ^ (L - 1)) * T(L * 2 - 2) - T(L * 2 - 3)) / ((4 ^ (L - 1)) - 1)
               Else
                    T(UBound(T)) = ((4 ^ (L - 1)) * T(UBound(T) - 1) - _
                    T(UBound(T) - 2)) / ((4 ^ (L - 1)) - 1)
               End If
          Next
          j = j + 1
     Loop
     Romberg = T(UBound(T))
End Function

Public Function fx(problem As Long, x As Double) As Double
Select Case problem
Case 0 '矩形
h = Text3.Text
fx = h * Tan(α) * x * Sin(2 * PI * x / λ)
Case 1 '三角形
L1 = Text7.Text
fx = L1 * (L0 - x) / L0 * Tan(α) * x * Sin(2 * PI * x / λ)
End Select
End Function
Private Sub Command1_Click()
Unload Form2
Load formain
formain.Show
End Sub
Private Sub Command2_Click(Index As Integer)
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Then
MsgBox "输入不能为空,请重新输入!", 16, "错误"
ElseIf Text1.Text = 0 Or Text2.Text = 0 Or Text3.Text = 0 Or Text4.Text = 0 Or Text5.Text = 0 Then
MsgBox "输入正确的数值!", 16, "错误"
Else
Label9.Caption = "尾部形状为矩形时游动速度V与摆动频率f的关系"
ρ = 0.001
L0 = Text1.Text
k = Text2.Text
M0 = Text4.Text
α = Text5.Text * PI / 180
λ = L0 / k
M1 = Romberg(0, 0, λ / 2, 0.000001) '矩形
M1 = M1 - Romberg(0, λ / 2, L0, 0.000001)
M1 = M1 * ρ
Text6.Text = M1
For f = 0 To 7 Step 0.001
V1 = f * λ * M1 / (M0 + M1)
If V1 <= 22 Then
Pic1.PSet (f, V1), QBColor(4)
End If
Next
Pic1.CurrentX = 2.3
Pic1.CurrentY = 2.3 * λ * M1 / (M0 + M1)
Pic1.Print "矩形"
Pic1.CurrentX = 4
Pic1.CurrentY = 4
Pic1.Print "ρ = 0.001"
End If
End Sub
Private Sub Command3_Click()
Text1.Text = "20"
Text2.Text = "1"
Text3.Text = "6"
Text4.Text = "0.8"
Text5.Text = "20"
Text6.Text = ""
Text7.Text = "6"
Label9.Caption = ""
Pic1.Cls
Call tu
End Sub
Private Sub Command4_Click(Index As Integer)
If Text1.Text = "" Or Text2.Text = "" Or Text7.Text = "" Or Text4.Text = "" Or Text5.Text = "" Then
MsgBox "输入不能为空,请重新输入!", 16, "错误"
ElseIf Text1.Text = 0 Or Text2.Text = 0 Or Text7.Text = 0 Or Text4.Text = 0 Or Text5.Text = 0 Then
MsgBox "输入正确的数值!", 16, "错误"
Else
Label9.Caption = "尾部形状为三角形时游动速度V与摆动频率f的关系"
ρ = 0.001  '水的密度
L0 = Text1.Text
k = Text2.Text
M0 = Text4.Text
α = Text5.Text * PI / 180
λ = L0 / k
M1 = Romberg(1, 0, λ / 2, 0.000001) '三角形
M1 = M1 - Romberg(1, λ / 2, λ, 0.000001)
M1 = M1 * ρ
Text8.Text = M1
For f = 0 To 7 Step 0.001
V1 = f * λ * M1 / (M0 + M1)
If V1 <= 22 Then
Pic1.PSet (f, V1), QBColor(4)
End If
Next
Pic1.CurrentX = 4.2
Pic1.CurrentY = 4.2 * λ * M1 / (M0 + M1)
Pic1.Print "三角形"
Pic1.CurrentX = 4
Pic1.CurrentY = 4
Pic1.Print "ρ = 0.001"
End If
End Sub

Private Sub Command5_Click(Index As Integer)
Text1.Text = "20"
Text2.Text = "1"
Text3.Text = "6"
Text4.Text = "0.8"
Text5.Text = "20"
Text7.Text = "6"
Text8.Text = ""
Label9.Caption = ""
Pic1.Cls
Call tu
End Sub

Private Sub Command6_Click()
Unload Form2
Load Form1
Form1.Show
End Sub
Private Sub Form_Activate()
Call tu
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -