📄 plccs.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form PLCCS
Caption = "PLC参数配置 "
ClientHeight = 9195
ClientLeft = 1065
ClientTop = 1740
ClientWidth = 10545
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 9195
ScaleWidth = 10545
Begin VB.TextBox Text1
Alignment = 2 'Center
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2640
TabIndex = 0
Text = "Text1"
Top = 1080
Visible = 0 'False
Width = 1305
End
Begin MSFlexGridLib.MSFlexGrid MSGrid1
Height = 8040
Left = 360
TabIndex = 1
Top = 720
Width = 9570
_ExtentX = 16880
_ExtentY = 14182
_Version = 393216
Rows = 5
Cols = 3
FocusRect = 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
Left = 4440
TabIndex = 5
Text = "Combo1"
Top = 5820
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
Left = 1080
TabIndex = 3
Text = "Combo1"
Top = 5820
Width = 975
End
Begin MSComctlLib.TabStrip TabStrip1
Height = 8775
Left = 120
TabIndex = 6
Top = 240
Width = 10095
_ExtentX = 17806
_ExtentY = 15478
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 1
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
ImageVarType = 2
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "4#炉煤层厚度:"
Height = 180
Index = 1
Left = 3240
TabIndex = 4
Top = 5880
Width = 1170
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "3#炉煤层厚度:"
Height = 180
Index = 0
Left = -120
TabIndex = 2
Top = 5880
Width = 1170
End
Begin VB.Menu exit1
Caption = "关闭(&X)"
End
Begin VB.Menu save1
Caption = "保存(&S)"
End
End
Attribute VB_Name = "PLCCS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MeicHdu(1, 10), Gflcs(1, 7)
Dim colsnum(2), xuhao(38), xmnum As Integer
Dim geidingzhi(17, 1)
Dim xmname(2, 70)
Private Sub exit1_Click()
Unload Me
End Sub
Private Sub Form_Load()
''On Error Resume Next
Dim Tabx As Object
TabStrip1.Tabs(1).Caption = "模拟量滤波系数"
Set Tabx = TabStrip1.Tabs.Add(2, , "控制量系数")
Set Tabx = TabStrip1.Tabs.Add(3, , "鼓风量插值")
'------------------------------------------------------
colsnum(0) = BlnumZA(0)
colsnum(1) = 3 * 19 - 1 '19 每台汽炉控制参数数量
colsnum(2) = 30 - 1
'--------------------------------------------------------
For i% = 0 To colsnum(0)
xmname(0, i%) = AI_Nam(i%)
Next
For i% = 1 To 3
j% = 19 * (i% - 1)
xmname(1, 0 + j%) = i% & "#炉水回路给定" '水位
xmname(1, 1 + j%) = i% & "#炉水回路比例系数"
xmname(1, 2 + j%) = i% & "#炉水回路积分系数"
xmname(1, 3 + j%) = i% & "#炉水回路微分系数"
xmname(1, 4 + j%) = i% & "#炉水回路死区"
xmname(1, 5 + j%) = i% & "#炉给水流量前馈系数"
xmname(1, 6 + j%) = i% & "#炉蒸汽流量对水位前馈系数"
xmname(1, 7 + j%) = i% & "#炉燃烧回路给定" '蒸汽压
xmname(1, 8 + j%) = i% & "#炉燃烧回路比例系数"
xmname(1, 9 + j%) = i% & "#炉燃烧回路积分系数"
xmname(1, 10 + j%) = i% & "#炉燃烧回路微分系数"
xmname(1, 11 + j%) = i% & "#炉燃烧回路死区"
xmname(1, 12 + j%) = i% & "#炉蒸汽流量对蒸汽压力前馈系数"
xmname(1, 13 + j%) = i% & "#炉炉排对鼓风系数"
xmname(1, 14 + j%) = i% & "#炉炉膛负压回路给定"
xmname(1, 15 + j%) = i% & "#炉炉膛负压回路比例系数"
xmname(1, 16 + j%) = i% & "#炉炉膛负压回路积分系数"
xmname(1, 17 + j%) = i% & "#炉炉膛负压回路微分系数"
xmname(1, 18 + j%) = i% & "#炉炉膛负压回路死区"
Next
For j% = 1 To 3
For i% = 1 To 10
xmname(2, i% - 1 + (j% - 1) * 10) = j% & "#鼓风量插值" & i%
Next
Next
'---------------------------------------------------------1#锅炉
geidingzhi(0, 0) = 1 '1#水位 所在行
geidingzhi(0, 1) = 8 '1#水位对应的模拟量号
geidingzhi(1, 0) = 5 '1#水位死区所在行
geidingzhi(1, 1) = 8
geidingzhi(2, 0) = 8 '1#蒸汽压力 所在行
geidingzhi(2, 1) = 0 '1#蒸汽压力对应的模拟量号
geidingzhi(3, 0) = 12
geidingzhi(3, 1) = 0
geidingzhi(4, 0) = 15 '1#炉膛负压 所在行
geidingzhi(4, 1) = 1 '1#炉膛负压对应的模拟量号
geidingzhi(5, 0) = 19
geidingzhi(5, 1) = 1
'----------------------------------------------------2#锅炉
geidingzhi(6, 0) = 1 + 19 '19 每台汽炉控制参数数量
geidingzhi(6, 1) = 8 + Ainumgl
geidingzhi(7, 0) = 5 + 19
geidingzhi(7, 1) = 8 + Ainumgl
geidingzhi(8, 0) = 8 + 19
geidingzhi(8, 1) = 0 + Ainumgl
geidingzhi(9, 0) = 12 + 19
geidingzhi(9, 1) = 0 + Ainumgl
geidingzhi(10, 0) = 15 + 19
geidingzhi(10, 1) = 1 + Ainumgl
geidingzhi(11, 0) = 19 + 19
geidingzhi(11, 1) = 1 + Ainumgl
'-------------------------------------------------------3#锅炉
geidingzhi(12, 0) = 1 + 2 * 19
geidingzhi(12, 1) = 8 + 2 * Ainumgl
geidingzhi(13, 0) = 5 + 2 * 19
geidingzhi(13, 1) = 8 + 2 * Ainumgl
geidingzhi(14, 0) = 8 + 2 * 19
geidingzhi(14, 1) = 0 + 2 * Ainumgl
geidingzhi(15, 0) = 12 + 2 * 19
geidingzhi(15, 1) = 0 + 2 * Ainumgl
geidingzhi(16, 0) = 15 + 2 * 19
geidingzhi(16, 1) = 1 + 2 * Ainumgl
geidingzhi(17, 0) = 19 + 2 * 19
geidingzhi(17, 1) = 1 + 2 * Ainumgl
'===========================================
MSGrid1.Rows = 31
MSGrid1.Cols = 6
For i% = 0 To 5
MSGrid1.ColAlignment(i%) = 3 '居中对齐
MSGrid1.colwidth(i%) = 1200
Next
MSGrid1.colwidth(0) = 1000
MSGrid1.colwidth(1) = 3200
MSGrid1.ColAlignment(1) = 1
Me.Height = 9855
Me.Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
TabStrip1_Click
End Sub
Private Sub MSGrid1_Click()
aa% = MSGrid1.Col
If aa% = 2 Or aa% = 3 Or Pasword = "Weicj" Then
Text1.Visible = True
Text1.SetFocus
Text1 = MSGrid1.Text
'------------------------------
xx1 = MSGrid1.Left + MSGrid1.CellLeft
yy = MSGrid1.CellTop + MSGrid1.Top
Text1.Move xx1, yy
Text1.Width = MSGrid1.CellWidth
Text1.Height = MSGrid1.CellHeight
End If
End Sub
Private Sub save1_Click()
For i% = 1 To MSGrid1.Rows - 1
For j% = 1 To MSGrid1.Cols - 1
zfc$ = zfc$ & MSGrid1.TextMatrix(i%, j%) & ","
Next
Next
finame1$ = sysdir & "\plccs" & xmnum & ".dat" '参数文件名
Open finame1$ For Output As #1
Print #1, zfc$
Close #1
'-------------------------------------------
If xmnum = 1 Then
zfc$ = ""
For i% = 0 To Geidingnum ' Geidingnum+1 个给定值及对应地址
SetupGD(i%) = Val(MSGrid1.TextMatrix(geidingzhi(2 * i%, 0), 2))
zfc$ = zfc$ & SetupGD(i%) & ","
zfc1$ = zfc1$ & MSGrid1.TextMatrix(geidingzhi(2 * i%, 0), 5) & ","
Next
finame1$ = sysdir + "\Gdcs.can" '存给定值
Open finame1$ For Output As #1
Print #1, zfc$
Close #1
finame1$ = sysdir + "\GdcsAdd.can" '存给定值在PLC中的对应地址
Open finame1$ For Output As #1
Print #1, zfc1$
Close #1
End If
'=====================================
writplc = 1
WriteS7
writplc = 0
Unload Me
End Sub
Private Sub TabStrip1_Click()
On Error Resume Next
aa1% = TabStrip1.SelectedItem.Index - 1
'------------------------------------
xmnum = TabStrip1.SelectedItem.Index - 1 '获得选中的站号
Text1.Text = ""
Text1.Visible = False
MSGrid1.Rows = colsnum(xmnum) + 2
MSGrid1.Clear
Text1.Text = ""
MSGrid1.Clear
MSGrid1.TextMatrix(0, 0) = "序号"
MSGrid1.TextMatrix(0, 1) = " 名 称"
MSGrid1.TextMatrix(0, 2) = "系数 "
MSGrid1.TextMatrix(0, 3) = "扩大倍数 "
MSGrid1.TextMatrix(0, 4) = "下载值"
MSGrid1.TextMatrix(0, 5) = "通道号"
For i% = 1 To MSGrid1.Rows - 1
MSGrid1.TextMatrix(i%, 0) = Format(i%, "00")
Next
'=============================
finame1$ = sysdir + "\plccs" & xmnum & ".dat" '上下限报警文件名
If Dir$(finame1$) <> "" Then
Open finame1$ For Input As #1
For j% = 1 To MSGrid1.Rows - 1
For i% = 1 To MSGrid1.Cols - 1
Input #1, zhj$
MSGrid1.TextMatrix(j%, i%) = zhj$
Next
Next
Close #1
End If
For i% = 0 To colsnum(xmnum)
MSGrid1.TextMatrix(1 + i%, 1) = xmname(xmnum, i%)
Next
If xmnum = 1 Then
For i% = 0 To Geidingnum
MSGrid1.TextMatrix(geidingzhi(2 * i%, 0), 2) = SetupGD(i%)
Next
End If
'--------------------------------------------------------------------
If xmnum = 0 Then st1% = Ainumgl: sto1% = 2 * Ainumgl - 1
If xmnum = 1 Then st1% = 19: sto1% = 2 * 19 - 1
If xmnum = 2 Then st1% = 10: sto1% = 20 - 1
For i% = st1% To sto1%
MSGrid1.Row = i% + 1
For j% = 0 To 5
MSGrid1.Col = j%
MSGrid1.CellForeColor = &HC0&
Next
Next
JiSuan
End Sub
Private Sub Text1_Change()
MSGrid1.Text = Text1.Text
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub WriteS7()
On Error Resume Next
BLOCKNO = 1
For jk% = 1 To MSGrid1.Rows - 1
no = Val(MSGrid1.TextMatrix(jk%, 5))
aaa1$ = MSGrid1.TextMatrix(jk%, 4)
AMOUNT = 1
res = new_ss(VerbIdx + 1)
If (res = 0) Then
value_byte(0) = Val("&H" & Mid$(aaa1$, 1, 2))
res = d_field_write(BLOCKNO, no, AMOUNT, value_byte(0))
no = no + 1
value_byte(0) = Val("&H" & Mid$(aaa1$, 3, 2))
res = d_field_write(BLOCKNO, no, AMOUNT, value_byte(0))
End If
Next
End Sub
Private Sub Text1_LostFocus()
JiSuan
Text1.Visible = False
End Sub
Private Sub JiSuan()
Select Case xmnum
Case 0
For i% = 1 To MSGrid1.Rows - 1
a2 = Val(MSGrid1.TextMatrix(i%, 2)) '实际值
a3 = Val(MSGrid1.TextMatrix(i%, 3)) '系数
zfc$ = Right$("0000" & Hex$(a3 * a2), 4)
MSGrid1.TextMatrix(i%, 4) = zfc$
Next
Case 1
'---------------------------------------------------
For i% = 1 To MSGrid1.Rows - 1
a2 = Val(MSGrid1.TextMatrix(i%, 2))
a3 = Val(MSGrid1.TextMatrix(i%, 3)) '系数
zfc12 = a3 * a2
zfc$ = Right$("0000" & Hex$(zfc12), 4)
MSGrid1.TextMatrix(i%, 4) = zfc$
Next
For i% = 0 To 11
a2 = Val(MSGrid1.TextMatrix(geidingzhi(i%, 0), 2)) '实际值
zfc12 = Int((a2 - bbb(geidingzhi(i%, 1))) / kkk(geidingzhi(i%, 1)))
If zfc12 > 27648 Then zfc12 = 27648
zfc$ = Right$("0000" & Hex$(zfc12), 4)
MSGrid1.TextMatrix(geidingzhi(i%, 0), 4) = zfc$
Next
Case 2
kk1 = 27648 / 100
For i% = 1 To MSGrid1.Rows - 1
a2 = Val(MSGrid1.TextMatrix(i%, 2))
If zfc12 > 27648 Then zfc12 = 27648
zfc12 = Right$("0000" & Hex(a2 * kk1), 4)
MSGrid1.TextMatrix(i%, 4) = zfc12
Next
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -