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

📄 form3.frm

📁 天津大学电机试验台程序,可以测试电机启动电流
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Printer.Line (xc, yc)-(xc + 5 * w1, yc)

Printer.CurrentX = xc + 5 * w1 - 25
Printer.CurrentY = yc + 20
Printer.Print "时间(s)"

Printer.CurrentX = xc - 30
Printer.CurrentY = yc - 10 * h1 - 22
Printer.Print "电流(A)"

For i = 0 To 5
Printer.CurrentX = xc + i * w1 - 8
Printer.CurrentY = yc + 5
Printer.Print Str(i)
Next i

For i = 1 To 50
Printer.Line (xc + i * 0.1 * w1, yc)-(xc + i * 0.1 * w1, yc - 10 * h1)
Next i

For i = 1 To 10
Printer.CurrentX = xc - 15
Printer.CurrentY = yc - i * h1 - 6
Printer.Print Str(i * 3)
Next i

For i = 1 To 20
Printer.Line (xc, yc - i * 0.5 * h1)-(xc + 5 * w1, yc - i * 0.5 * h1)
Next i


Printer.Line (xm, ym - 10 * h1)-(xm, ym)
Printer.Line (xm, ym)-(xm + 5 * w1, ym)

Printer.CurrentX = xm + 5 * w1 - 25
Printer.CurrentY = ym + 20
Printer.Print "时间(s)"

Printer.CurrentX = xm - 30
Printer.CurrentY = ym - 10 * h1 - 22
Printer.Print "转矩(N.m)"

For i = 0 To 5
Printer.CurrentX = xm + i * w1 - 8
Printer.CurrentY = ym + 5
Printer.Print Str(i)
Next i

For i = 1 To 50
Printer.Line (xm + i * 0.1 * w1, ym)-(xm + i * 0.1 * w1, ym - 10 * h1)
Next i

For i = 1 To 10
Printer.CurrentX = xm - 24
Printer.CurrentY = ym - i * h1 - 6
Printer.Print Str(i * 2.5)
Next i

For i = 1 To 20
Printer.Line (xm, ym - i * 0.5 * h1)-(xm + 5 * w1, ym - i * 0.5 * h1)
Next i

Timer2.Enabled = True

End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer2.Enabled = False
Command4.Enabled = False

Label5.Caption = reportname

Set reportdb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\报表")
Set reportrd = reportdb.OpenRecordset("报表", dbOpenTable)
reportrd.MoveFirst

Do Until reportrd.EOF
If (reportrd.Fields("表名") = reportname) Then
Exit Do
Else
reportrd.MoveNext
End If
Loop

'reportrd.MoveNext
 
  Dim items(11) As String
  Dim item1s(11) As String
  Dim intloopindex As Integer
  Dim item3s(11) As String
  Dim item2s(11) As String
  items(0) = "测定项目"
  items(1) = "报表日期"
  items(2) = "空载电流"
  items(3) = "空载转速"
  items(4) = "空载转矩"
  items(5) = "额定电流"
  items(6) = "额定转速"
  items(7) = "额定转矩"
  items(8) = "启动电流"
  items(9) = "启动转矩"
  items(10) = "堵转电流"
  items(11) = "堵转转矩"
  
  item2s(0) = "测定数据"
 item2s(1) = Mid(reportrd("表名"), 1, 8)
  item2s(2) = reportrd.Fields(14)
  item2s(3) = reportrd.Fields(13)
  item2s(4) = reportrd.Fields(15)
  item2s(5) = reportrd.Fields(10)
  item2s(6) = reportrd.Fields(9)
  item2s(7) = reportrd.Fields(11)
  item2s(8) = reportrd.Fields(17)
  item2s(9) = reportrd.Fields(18)
  item2s(10) = reportrd.Fields(19)
  item2s(11) = reportrd.Fields(20)
  
  item3s(0) = "铭牌数据"
  item3s(1) = ""
  item3s(2) = reportrd.Fields(1)
  item3s(3) = Mid(reportrd.Fields(0), 16, Len(reportrd.Fields(0)))
  item3s(4) = reportrd.Fields(4)
  item3s(5) = reportrd.Fields(8)
  item3s(6) = reportrd.Fields(6)
  item3s(7) = reportrd.Fields(7)
  item3s(8) = reportrd.Fields(5)
  item3s(9) = reportrd.Fields(2)
  item3s(10) = reportrd.Fields(3)
  
  item1s(0) = "铭牌项目"
  item1s(1) = "试验人员"
  item1s(2) = "电机型号"
  item1s(3) = "编    号"
  item1s(4) = "生产厂家"
  item1s(5) = "额定功率"
  item1s(6) = "额定转速"
  item1s(7) = "额定电流"
  item1s(8) = "额定电压"
  item1s(9) = "防护等级"
  item1s(10) = "出厂日期"
 ' item1s(11) =
  
  For intloopindex = 0 To MSFlexGrid1.Rows - 1
    MSFlexGrid1.Col = 0
    MSFlexGrid1.Row = intloopindex
    MSFlexGrid1.Text = Str(intloopindex)
    MSFlexGrid1.Col = 1
    MSFlexGrid1.Text = items(intloopindex)
    
    MSFlexGrid1.Col = 2
    MSFlexGrid1.Text = item2s(intloopindex)
    
    MSFlexGrid1.Col = 3
    MSFlexGrid1.Text = item1s(intloopindex)
    
    MSFlexGrid1.Col = 4
    MSFlexGrid1.Text = item3s(intloopindex)
 Next intloopindex
    'MSFlexGrid1.Row = 1
    'MSFlexGrid1.Col = 2
    'i = 1
    'MSFlexGrid1.Text = Date '(Now:)', i)

 'MSFlexGrid1.Row = 1

 'For intloopindex = 1 To MSFlexGrid1.Cols - 1
   ' MSFlexGrid1.Col = intloopindex
   ' MSFlexGrid1.Text = Chr(Asc("A") - 1 + intloopindex)
    'Next intloopindex
    'MSFlexGrid1.Row = 1
    'MSFlexGrid1.Col = 1

End Sub

Private Sub Form_Paint()
Dim i As Integer, j As Integer
 
 'picture1画图
 Cls
 
 Picture1.Scale (0, 0)-(50, 20)
 For i = 1 To 19
 Picture1.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture1.Line (j, 0)-(j, 20)
 Next j
 
 Cls
  Picture2.Scale (0, 0)-(50, 25)
 For i = 1 To 24
 Picture2.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture2.Line (j, 0)-(j, 25)
 Next j
 
 
 Cls
  Picture3.Scale (0, 0)-(50, 20)
 For i = 1 To 19
 Picture3.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture3.Line (j, 0)-(j, 20)
 Next j
 
X = Picture1.Left - 300
Y = Picture1.Top + Picture1.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture1.Width / 5
Next reg1
 
X = Picture1.Left - 440
Y = Picture1.Top + Picture1.Height - 50
For reg1 = 0 To 3000 Step 300
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture1.Height / 10
Next reg1
 
  'picture2画图
  
 
X = Picture2.Left - 300
Y = Picture2.Top + Picture2.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture2.Width / 5
Next reg1
  
X = Picture2.Left - 350
Y = Picture2.Top + Picture2.Height - 50
For reg1 = 0 To 25 Step 2.5
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture2.Height / 10
Next reg1

'picture3画图

X = Picture3.Left - 300
Y = Picture3.Top + Picture3.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture3.Width / 5
Next reg1
 
 X = Picture3.Left - 350
Y = Picture3.Top + Picture3.Height - 50
For reg1 = 0 To 30 Step 3
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture3.Height / 10
Next reg1
End Sub

Private Sub List1_Click()
Shape1.Refresh
Shape2.Refresh
Shape3.Refresh

Dim i As Integer, j As Integer
 
 'picture1画图
 Cls
 
 Picture1.Scale (0, 0)-(50, 20)
 For i = 1 To 19
 Picture1.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture1.Line (j, 0)-(j, 20)
 Next j
 
 Cls
  Picture2.Scale (0, 0)-(50, 25)
 For i = 1 To 24
 Picture2.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture2.Line (j, 0)-(j, 25)
 Next j
 
 
 Cls
  Picture3.Scale (0, 0)-(50, 20)
 For i = 1 To 19
 Picture3.Line (0, i)-(50, i)
 Next i
 Cls
 For j = 1 To 49
 Picture3.Line (j, 0)-(j, 20)
 Next j
 
X = Picture1.Left - 300
Y = Picture1.Top + Picture1.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture1.Width / 5
Next reg1
 
X = Picture1.Left - 440
Y = Picture1.Top + Picture1.Height - 50
For reg1 = 0 To 3000 Step 300
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture1.Height / 10
Next reg1
 
  'picture2画图
  
 
X = Picture2.Left - 300
Y = Picture2.Top + Picture2.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture2.Width / 5
Next reg1
  
X = Picture2.Left - 350
Y = Picture2.Top + Picture2.Height - 50
For reg1 = 0 To 25 Step 2.5
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture2.Height / 10
Next reg1

'picture3画图

X = Picture3.Left - 300
Y = Picture3.Top + Picture3.Height + 50
For reg1 = 0 To 5 Step 1
CurrentX = X + 150
CurrentY = Y + 0
Print reg1;
X = X + Picture3.Width / 5
Next reg1
 
 X = Picture3.Left - 350
Y = Picture3.Top + Picture3.Height - 50
For reg1 = 0 To 30 Step 3
CurrentX = X
CurrentY = Y
Print reg1;
Y = Y - Picture3.Height / 10
Next reg1

marx0 = Shape2.Left
mary0 = Shape2.Top + Shape2.Height
marx1 = Shape2.Left
mary1 = Shape2.Top + Shape2.Height

speedx0 = Shape1.Left
speedy0 = Shape1.Top + Shape1.Height
speedx1 = Shape1.Left
speedy1 = Shape1.Top + Shape1.Height

currentx0 = Shape3.Left
currenty0 = Shape3.Top + Shape3.Height
currentx1 = Shape3.Left
currenty1 = Shape3.Top + Shape3.Height

t = 0

Dim msg

If (List1.Text = "空载曲线") Then
If (reportrd.Fields("空载试验是否已做") = "否") Then
msg = MsgBox("没有进行过空载试验!", vbOKOnly)
Frame2.Enabled = True
Else
Set kzdb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\空载")
Set kzrd = kzdb.OpenRecordset(Form3.Label5.Caption, dbOpenTable)
kzrd.MoveFirst
Timer1.Enabled = True
Frame2.Enabled = False
End If
End If

If (List1.Text = "额定曲线") Then
If (reportrd.Fields("额定试验是否已做") = "否") Then
msg = MsgBox("没有进行过额定试验!", vbOKOnly)
Frame2.Enabled = True
Else
Set eddb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\额定")
Set edrd = eddb.OpenRecordset(Form3.Label5.Caption, dbOpenTable)
edrd.MoveFirst
Timer1.Enabled = True
Frame2.Enabled = False
End If
End If

If (List1.Text = "启动曲线") Then
If (reportrd.Fields("启动试验是否已做") = "否") Then
msg = MsgBox("没有进行过启动试验!", vbOKOnly)
Frame2.Enabled = True
Else
Set qddb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\启动")
Set qdrd = qddb.OpenRecordset(Form3.Label5.Caption, dbOpenTable)
qdrd.MoveFirst
Timer1.Enabled = True
Frame2.Enabled = False
End If
End If

If (List1.Text = "堵转曲线") Then
If (reportrd.Fields("堵转试验是否已做") = "否") Then
msg = MsgBox("没有进行过堵转试验!", vbOKOnly)
Frame2.Enabled = True
Else
Set dzdb = OpenDatabase("F:\天津大学电机试验台程序\试验台数据库\堵转")
Set dzrd = dzdb.OpenRecordset(Form3.Label5.Caption, dbOpenTable)
dzrd.MoveFirst
Timer1.Enabled = True
Frame2.Enabled = False
End If
End If


End Sub

Private Sub Timer1_Timer()
If (List1.Text = "空载曲线") Then
If (t <= 4.9) Then
t = t + 0.1
marx1 = marx1 + Shape2.Width / 50
mary1 = Shape2.Height - Val(kzrd.Fields("转矩")) * Shape2.Height / 25 - Shape2.Height / 50

speedx1 = speedx1 + Shape1.Width / 50
speedy1 = Shape1.Height - Val(kzrd.Fields("速度")) * Shape1.Height / 3000

currentx1 = currentx1 + Shape3.Width / 50
currenty1 = Shape3.Height - Val(kzrd.Fields("电流")) * Shape1.Height / 30

kzrd.MoveNext

Picture2.Line (marx0, mary0)-(marx1, mary1), RGB(255, 0, 0)
marx0 = marx1
mary0 = mary1

Picture1.Line (speedx0, speedy0)-(speedx1, speedy1), RGB(255, 0, 0)
speedx0 = speedx1
speedy0 = speedy1

Picture3.Line (currentx0, currenty0)-(currentx1, currenty1), RGB(255, 0, 0)
currentx0 = currentx1
currenty0 = currenty1

Else
Timer1.Enabled = False
Frame2.Enabled = True
Command4.Enabled = True
End If
End If

If (List1.Text = "额定曲线") Then
If (t <= 4.9) Then
t = t + 0.1
marx1 = marx1 + Shape2.Width / 50
mary1 = Shape2.Height - Val(edrd.Fields("转矩")) * Shape2.Height / 25 - Shape2.Height / 50

speedx1 = speedx1 + Shape1.Width / 50
speedy1 = Shape1.Height - Val(edrd.Fields("速度")) * Shape1.Height / 3000

currentx1 = currentx1 + Shape3.Width / 50
currenty1 = Shape3.Height - Val(edrd.Fields("电流")) * Shape1.Height / 30

edrd.MoveNext

Picture2.Line (marx0, mary0)-(marx1, mary1), RGB(255, 0, 0)
marx0 = marx1
mary0 = mary1

Picture1.Line (speedx0, speedy0)-(speedx1, speedy1), RGB(255, 0, 0)
speedx0 = speedx1
speedy0 = speedy1

Picture3.Line (currentx0, currenty0)-(currentx1, currenty1), RGB(255, 0, 0)
currentx0 = currentx1
currenty0 = currenty1

Else
Timer1.Enabled = False
Frame2.Enabled = True
Command4.Enabled = True
End If

⌨️ 快捷键说明

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