📄 zkhm.frm
字号:
With Label4(i)
.Caption = Format(time1(3), "hh:mm")
End With
End Select
time1(Index + 1) = time1(Index + 1) + time2
Next
'*****************************
'记录反应开始信息
'*****************************
Call tlBeginOrEndWriteRecord(Batchlsrs(Index + 1), Detaillsrs(Index + 1), _
Continousrs(Index + 1), Index + 1, strControlType, True)
gGongZuoZhuangTai(Index + 1) = True
gdteStartTime(Index + 1) = Time
Dim ywValue As Single
With mainfrm
Select Case Index + 1
Case 1
ywValue = .fyf1_Control.jlgcsYeWei
Case 2
ywValue = .fyf2_Control.jlgcsYeWei
Case 3
ywValue = .fyf3_Control.jlgcsYeWei
End Select
End With
gblnBeginSet(Index + 1) = False
For i = 0 To 19
gjlgYeWei2(Index + 1, i) = ywValue
Next
End Sub
Private Sub Form_Load()
Width = Screen.Width - dataviewfrm.Width - dataviewfrm.Left
Left = dataviewfrm.Left + dataviewfrm.Width
Top = baojingfrm.Top + baojingfrm.Height
Height = Screen.Height - baojingfrm.Top - baojingfrm.Height
'****************************
'初始化时间刻度等变量
'****************************
For i = 1 To 3
time1(i) = Time()
TimeLength(i) = 0
Command2(i - 1).Enabled = False
gblnIsAuto(i) = True
Next
time2 = "00:20"
'*************************
'水平时间轴刻度
'*************************
'*************************
'一号反应釜
'*************************
For i = 1 To 30
Load Line1H(i)
With Line1H(i)
.X1 = Picture1(0).Left + (Picture1(0).Width / 30) * i
.X2 = .X1
.Y1 = Picture1(0).Top + Picture1(0).Height
Select Case i
Case 0, 10, 20, 30, 40, 50, 60
.Y2 = .Y1 + 150
Case 5, 15, 25, 35, 45, 55
.Y2 = .Y1 + 100
Case Else
.Y2 = .Y1 + 50
End Select
.Visible = True
End With
'*************************
'二号反应釜
'*************************
Load Line2H(i)
With Line2H(i)
.X1 = Picture1(1).Left + (Picture1(1).Width / 30) * i
.X2 = .X1
.Y1 = Picture1(1).Top + Picture1(1).Height
Select Case i
Case 0, 10, 20, 30, 40, 50, 60
.Y2 = .Y1 + 150
Case 5, 15, 25, 35, 45, 55
.Y2 = .Y1 + 100
Case Else
.Y2 = .Y1 + 50
End Select
.Visible = True
End With
'*************************
'三号反应釜
'*************************
Load Line3H(i)
With Line3H(i)
.X1 = Picture1(2).Left + (Picture1(2).Width / 30) * i
.X2 = .X1
.Y1 = Picture1(2).Top + Picture1(2).Height
Select Case i
Case 0, 10, 20, 30, 40, 50, 60
.Y2 = .Y1 + 150
Case 5, 15, 25, 35, 45, 55
.Y2 = .Y1 + 100
Case Else
.Y2 = .Y1 + 50
End Select
.Visible = True
End With
Next
'*************************
'水平时间轴轴刻度标注
'*************************
'*************************
'一号反应釜
'*************************
For i = 1 To 4
Load Label9(i)
With Label9(i)
.Left = Picture1(0).Left - 260 + (Picture1(0).Width / 3) * (i - 1)
.Top = Picture1(0).Top + Picture1(0).Height + 140
.Caption = Format(time1(1), "hh:mm")
.Visible = True
End With
'*************************
'二号反应釜
'*************************
Load Label3(i)
With Label3(i)
.Left = Picture1(1).Left - 260 + (Picture1(1).Width / 3) * (i - 1)
.Top = Picture1(1).Top + Picture1(1).Height + 140
.Caption = Format(time1(2), "hh:mm")
.Visible = True
End With
'*************************
'三号反应釜
'*************************
Load Label4(i)
With Label4(i)
.Left = Picture1(2).Left - 260 + (Picture1(2).Width / 3) * (i - 1)
.Top = Picture1(2).Top + Picture1(2).Height + 120
.Caption = Format(time1(3), "hh:mm")
.Visible = True
End With
time1(1) = time1(1) + time2
time1(2) = time1(2) + time2
time1(3) = time1(3) + time2
Next
'*************************
'竖直数值轴刻度
'*************************
'*************************
'一号反应釜
'*************************
For i = 1 To 10
Load Line1V(i)
With Line1V(i)
.X2 = Picture1(0).Left
.Y2 = Picture1(0).Top + (Picture1(0).Height / 10) * i
.Y1 = .Y2
Select Case i
Case 5, 10
.X1 = Picture1(0).Left - 150
Case Else
.X1 = Picture1(0).Left - 80
End Select
.Visible = True
End With
'*************************
'二号反应釜
'*************************
Load Line2V(i)
With Line2V(i)
.X2 = Picture1(1).Left
.Y2 = Picture1(1).Top + (Picture1(1).Height / 10) * i
.Y1 = .Y2
Select Case i
Case 5, 10
.X1 = Picture1(1).Left - 150
Case Else
.X1 = Picture1(1).Left - 80
End Select
.Visible = True
End With
'*************************
'三号反应釜
'*************************
Load Line3V(i)
With Line3V(i)
.X2 = Picture1(2).Left
.Y2 = Picture1(2).Top + (Picture1(2).Height / 10) * i
.Y1 = .Y2
Select Case i
Case 5, 10
.X1 = Picture1(2).Left - 150
Case Else
.X1 = Picture1(2).Left - 80
End Select
.Visible = True
End With
Next
For i = 0 To 2
With Text1(i)
.Locked = True
End With
Next
End Sub
'********************
'窗体属性:计量罐液位
'********************
Public Property Let jlgYeWei(ByVal vData As Single)
mvarjlgYeWei(mvarindex) = vData
End Property
Public Property Get jlgYeWei() As Single
jlgYeWei = mvarjlgYeWei(mvarindex)
End Property
'********************
'窗体属性:一甲胺流量
'********************
Public Property Let yjaLiuLiang(ByVal vData As Single)
mvaryjaLiuLiang(mvarindex) = vData
End Property
Public Property Get yjaLiuLiang() As Single
yjaLiuLiang = mvaryjaLiuLiang(mvarindex)
End Property
'********************
'窗体属性:投料阀开度
'********************
Public Property Let tlfaKaiDu(ByVal vData As Single)
mvartlfaKaiDu(mvarindex) = vData
End Property
Public Property Get tlfaKaiDu() As Single
tlfaKaiDu = mvartlfaKaiDu(mvarindex)
End Property
'********************
'窗体属性:反应釜温度
'********************
Public Property Let fyfWenDu(ByVal vData As Single)
mvarfyfWenDu(mvarindex) = vData
End Property
Public Property Get fyfWenDu() As Single
fyfWenDu = mvarfyfWenDu(mvarindex)
End Property
'********************
'窗体属性:反应釜号
'********************
Public Property Let Index(ByVal vData As Single)
mvarindex = vData
End Property
Public Property Get Index() As Single
Index = mvarindex
End Property
'********************
'窗体属性:冷却水温度
'********************
Public Property Let lqysWenDu(ByVal vData As Single)
mvarlqysWenDu(mvarindex) = vData
End Property
Public Property Get lqysWenDu() As Single
lqysWenDu = mvarlqysWenDu(mvarindex)
End Property
Private Sub Picture1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, y As Single)
Dim YY As Single
Select Case Index
Case 0
YY = mainfrm.fyf1_fyfWenDu.SheDingValue
Case 1
YY = mainfrm.fyf2_fyfWenDu.SheDingValue
Case 2
YY = mainfrm.fyf3_fyfWenDu.SheDingValue
End Select
Picture1(Index).Scale (0, gsngfyfwdScaleTop(Index + 1))-(Picture1(Index).ScaleWidth, gsngfyfwdScaleBottom(Index + 1))
With LineSheDing(Index)
If Button = vbKeyLButton Then
.Y1 = YY
.Y2 = YY
.BorderColor = fyfWenDuSheDing_Color
.Visible = True
End If
If Button = vbKeyRButton Then
.Visible = False
End If
End With
End Sub
Private Sub Text1_Change(Index As Integer)
If Not (gblnIsAuto(Index + 1)) Then
Text1(Index).BackColor = &H80000005
End If
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If (KeyCode = vbKeyUp) And Not (gblnIsAuto(Index + 1)) Then
msngKaiDu(Index + 1) = msngKaiDu(Index + 1) + 1
If msngKaiDu(Index + 1) > 100 Then msngKaiDu(Index + 1) = 0
Text1(Index).Text = CStr(msngKaiDu(Index + 1))
End If
If (KeyCode = vbKeyDown) And Not (gblnIsAuto(Index + 1)) Then
msngKaiDu(Index + 1) = msngKaiDu(Index + 1) - 1
If msngKaiDu(Index + 1) < 0 Then msngKaiDu(Index + 1) = 100
Text1(Index).Text = CStr(msngKaiDu(Index + 1))
End If
'*****************************
'使控制量开度值生效
'*****************************
If KeyCode = vbKeyReturn Then
If Command2(Index).Enabled Then
Call Inform(91)
Exit Sub
End If
If CSng(Text1(Index).Text) < 0 Then
Call Inform(92)
Text1(Index).Text = CStr(0)
Exit Sub
End If
If CSng(Text1(Index).Text) > 100 Then
Call Inform(92)
Text1(Index).Text = CStr(100)
Exit Sub
End If
If gGongZuoZhuangTai(Index + 1) Then
With mainfrm
Select Case Index + 1
Case 1
Call A_out(.fyf1_Control.tlfBaseAddress, .fyf1_Control.tlfChannel, CSng(Text1(Index).Text), 0)
Case 2
Call A_out(.fyf2_Control.tlfBaseAddress, .fyf2_Control.tlfChannel, CSng(Text1(Index).Text), 0)
Case 3
Call A_out(.fyf3_Control.tlfBaseAddress, .fyf3_Control.tlfChannel, CSng(Text1(Index).Text), 0)
End Select
gsngManualToAutoKaiDu(Index + 1) = CSng(Text1(Index).Text)
msngKaiDu(Index + 1) = CSng(Text1(Index).Text)
If Not gblnIsAuto(Index + 1) Then Text1(Index).BackColor = RGB(50, 200, 150)
End With
End If
If CSng(Text1(Index).Text) = 0 Then gIsTouLiao(Index + 1) = False
End If
End Sub
Private Sub Timer1_Timer()
For i = 1 To 3
If gblnIsAuto(i) Then
Select Case i
Case 1
gintkdSheDing(1) = mainfrm.fyf1_Control.tlfaKaiDu
Case 2
gintkdSheDing(2) = mainfrm.fyf2_Control.tlfaKaiDu
Case 3
gintkdSheDing(3) = mainfrm.fyf3_Control.tlfaKaiDu
End Select
Text1(i - 1).Text = CStr(gintkdSheDing(i))
End If
If gGongZuoZhuangTai(i) Then
'**********************
'正在反应,窗口这样显示:
'**********************
If gIsTouLiao(i) Then
Text3(i - 1).Text = "正在投料"
Else
Text3(i - 1).Text = "暂停投料"
End If
Text2(i - 1).Text = Format(gyjaTouLiaoLiang(i), "0.0")
Text4(i - 1).Text = CDate(Time - gdteStartTime(i))
Else
'**********************
'停止反应,窗口这样显示:
'**********************
Text4(i - 1).Text = "00:00:00"
Text3(i - 1).Text = "投料结束"
End If
'*****************************
'绘即时曲线,任何时间都画,满屏或
'按下开始按钮后自动清屏重画
'*****************************
With mainfrm
Picture1(i - 1).Scale (0, gsngjlgywScaleTop(i))-(3600, gsngjlgywScaleBottom(i))
Picture1(i - 1).PSet (TimeLength(i), 500 - gjlgYeWei(i)), QBColor(jlgYeWei_Color)
Picture1(i - 1).Scale (0, gsngyjallScaleTop(i))-(3600, gsngyjallScaleBottom(i))
Picture1(i - 1).PSet (TimeLength(i), gyjaLiuLiang(i)), QBColor(yjaLiuLiang_Color)
Picture1(i - 1).Scale (0, gsngtlfkdScaleTop(i))-(3600, gsngtlfkdScaleBottom(i))
Picture1(i - 1).PSet (TimeLength(i), gtlfaKaiDu(i)), QBColor(tlfaKaiDu_Color)
Picture1(i - 1).Scale (0, gsnglqyswdScaleTop)-(3600, gsnglqyswdScaleBottom)
Picture1(i - 1).PSet (TimeLength(i), glqysWenDu), QBColor(lqysWenDu_Color)
Picture1(i - 1).Scale (0, gsngfyfwdScaleTop(i))-(3600, gsngfyfwdScaleBottom(i))
Picture1(i - 1).PSet (TimeLength(i), gfyfWenDu(i)), QBColor(fyfWenDu_Color)
End With
TimeLength(i) = TimeLength(i) + 1
If TimeLength(i) > 3600 Then
TimeLength(i) = 0
Picture1(i - 1).Cls
'******************************
'为时间轴刻度重新赋值
'******************************
time1(i) = Time()
For j = 1 To 4
Select Case i
Case 1
With Label9(j)
.Caption = Format(time1(1), "hh:mm")
End With
Case 2
With Label3(j)
.Caption = Format(time1(2), "hh:mm")
End With
Case 3
With Label4(j)
.Caption = Format(time1(3), "hh:mm")
End With
End Select
time1(i) = time1(i) + time2
Next
End If
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -