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

📄 mainfrm.frm

📁 This is a boiler test system,has been use in factory
💻 FRM
📖 第 1 页 / 共 5 页
字号:
   End
   Begin VB.Image Imaghuo 
      Height          =   1815
      Left            =   3480
      Top             =   5880
      Width           =   2655
   End
   Begin VB.Image Imagyan 
      Height          =   660
      Left            =   13995
      Top             =   1800
      Width           =   165
   End
   Begin VB.Menu exit10 
      Caption         =   "退出(&X)"
   End
   Begin VB.Menu systemwh 
      Caption         =   "系统维护"
      Begin VB.Menu mdfpas 
         Caption         =   "修改口令"
      End
      Begin VB.Menu setsens 
         Caption         =   "传感器参数设置"
         Index           =   0
      End
      Begin VB.Menu setsens 
         Caption         =   "PLC参数"
         Index           =   1
      End
   End
   Begin VB.Menu datavew 
      Caption         =   "数据"
      Begin VB.Menu datass 
         Caption         =   "实时数据"
      End
      Begin VB.Menu datall 
         Caption         =   "1#炉数据报表"
         Index           =   0
      End
      Begin VB.Menu datall 
         Caption         =   "2#炉数据报表"
         Index           =   1
      End
      Begin VB.Menu datall 
         Caption         =   "3#炉数据报表"
         Index           =   2
      End
   End
   Begin VB.Menu baojing 
      Caption         =   "报警"
      Begin VB.Menu databj 
         Caption         =   "实时报警"
         Index           =   0
      End
      Begin VB.Menu databj 
         Caption         =   "历史报警"
         Index           =   1
      End
   End
   Begin VB.Menu bangtu1 
      Caption         =   "曲线"
      Begin VB.Menu fcxzt1 
         Caption         =   "实时曲线"
         Index           =   0
      End
      Begin VB.Menu fcxztls 
         Caption         =   "历史曲线"
      End
      Begin VB.Menu shei0 
         Caption         =   "关显示0水位线"
      End
   End
   Begin VB.Menu zt1 
      Caption         =   "状态"
      Begin VB.Menu sszt 
         Caption         =   "实时状态"
      End
      Begin VB.Menu hlstatu 
         Caption         =   "历史状态"
      End
   End
   Begin VB.Menu datastail 
      Caption         =   "数据库"
   End
   Begin VB.Menu geiding 
      Caption         =   "给定"
   End
   Begin VB.Menu help1 
      Caption         =   "帮助(&P)"
      Begin VB.Menu daterq 
         Caption         =   "时间"
      End
      Begin VB.Menu PLCMNL 
         Caption         =   "S7300原始输入"
      End
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cou1, ir000(15), flag_kg1, flag_gk2, flag_gk3
Dim ViewmnlS7, f1_flag, ll_flag As Integer
Dim SaveFlag(28), Run_Flag(15), flagdj(90) As Integer
Dim SsOnOff, linenum, Bj_Flag, CuntLp, cunt3, cunt5 As Integer
Dim bmpdiryan(2, 2), Bmpdirhy(2) As String
Dim TempData(70, 20)
Dim OutComm(5), Inzfc As String
Dim bpq As Integer
Public Function fcs(a$)
 On Error Resume Next
 b% = 0
 l% = Len(a$)
 For i% = 2 To l%
     b% = b% Xor Asc(Mid(a$, i%, 1)) '宋老师
 Next i%
 ff$ = Hex$(b%)
   If Len(ff$) = 1 Then
   ff$ = "0" + ff$
 End If
 fcs = ff$
End Function

Private Sub Command1_Click(Index As Integer)
'On Error Resume Next
  For i% = 0 To 2
    Command1(i%).Enabled = True
  Next
  Command1(Index).Enabled = False
  glnum = Index
'---------------------------------------
  Me.Picture = LoadPicture(bmpdir & "main" & Index & ".bmp")
  For i% = 0 To 17 'siemens s7-300采集的13*2路模拟量
     pcl813(i%).ToolTipText = AI_Nam(Ainumgl * Index + i%)
  Next
  For i% = 0 To 11
     Run_Flag(i%) = 5
  Next
  For i% = 0 To 2
    ImgYan(i%).Picture = LoadPicture(bmpdiryan(Index, i%))
  Next

End Sub

Private Sub Commands_Click()
FormCyq.Show
End Sub

Private Sub databj_Click(Index As Integer)
If Index = 0 Then
  FormBjSs.Show
Else
  FormBjls.Show
End If
End Sub

Private Sub datacj_Timer()
'On Error Resume Next
 StatusBar1.Panels(2).Text = Time$
 SumLL(1) = SumLL(1) + Val(Format(PvtAI(3) / 3600, "0.00000")) '1#水
 SumLL(3) = SumLL(3) + Val(Format(PvtAI(21) / 3600, "0.00000")) '2#水
 SumLL(5) = SumLL(5) + Val(Format(PvtAI(39) / 3600, "0.00000")) '3#水

'==========================
 If Bj_Flag = 1 Then             '-----------报警指示
    imageBJ.Picture = Imgbjf(cou1).Picture
 End If
 If Run_Flag(0) <> Bj_Flag Then
    Run_Flag(0) = Bj_Flag         '----------有/无报警
    Labelbj.Caption = BJNam(Run_Flag(0))
    If Run_Flag(0) = 0 Then
       imageBJ.Picture = LoadPicture(bmpdir & "newbjf2.bmp")
    End If
 End If
 cou1 = cou1 + 1 '-------------------每2秒读一次数据
 If cou1 > 1 Then
    cou1 = 0
    bpq = bpq + 1 '------------------每2秒读变频器功率
    If bpq > 5 Then bpq = 0
    MSComm1.Output = OutComm(bpq)
'---------------------------
    aa% = tcpserver.State
    If aa% <> 2 Then Timer2.Enabled = True
    'If aa% <> FlagMod Then
    '   FlagMod = aa%
    '  sbStatusBar.Panels(3).Text = state1(aa%)
   ' End If
    Exit Sub
 End If
 ReadS7_300
'--------------------------------------------时实数据------2002-4-5
 For i% = 0 To SsqxNum
   For j% = 0 To 299
      SSPvt(i%, j%) = SSPvt(i%, j% + 1)
   Next
   SSPvt(i%, j%) = PvtAI(SsQxsx(i%))
 Next
'------------------------------------------模拟量显示
  For i% = 0 To 17          '--------------siemens s7-300采集的13*2路模拟量
     pcl813(i%).Caption = PvtAI(i% + glnum * Ainumgl)
  Next
'------------------------------------------报警纪录
  For jk% = 0 To BJNum
      If SaveFlag(jk%) <> PvtDI(BJsunx(jk%)) Then
        SaveFlag(jk%) = PvtDI(BJsunx(jk%))
        FileName$ = datadir + "\" + "y" + Mid$(Date$, 3, 2) + Mid$(Date$, 6, 2)
        If Dir$(FileName$, 16) = "" Then
           MkDir FileName$
        End If
        FileName$ = FileName$ & "\baoj.dat"
        Open FileName$ For Append As #1
          zfc$ = "@" & Date$ & "," & Time$ & "," & jk% & "," & SaveFlag(jk%) & ","
          zfc$ = zfc$ & PvtAI(BjXuHao(jk%)) & "," & "*"
        Print #1, zfc$
        Close #1
     End If
  Next
'-----------------------------------------回路状态
  For i% = 0 To 3
     If Run_Flag(1 + i%) <> PvtDI(ZTsunx(i% + glnum * 4)) Then
        Run_Flag(1 + i%) = PvtDI(ZTsunx(i% + glnum * 4))
        StatusBar1.Panels(i% + 3).Text = Mid$(DI_Nam(ZTsunx(i% + glnum * 4)), 1, 5) & ":" & workfs(Run_Flag(1 + i%))
     End If
  Next
'------------------------炉膛火苗显示
 If PvtAI(14 + glnum * Ainumgl) > 100 Then hm% = 1
 If PvtAI(14 + glnum * Ainumgl) > 150 Then hm% = 2
 If Run_Flag(9) <> hm% Then
    Run_Flag(9) = hm%
    Imaghuo.Picture = LoadPicture(Bmpdirhy(hm%))
 End If
'-----------------------炉排转速
 If PvtAI(6 + glnum * Ainumgl) > 5 Then
    CuntLp = CuntLp + 1
    If CuntLp > 9 Then CuntLp = 0
    ImgLP.Picture = Imagelp(CuntLp).Picture
 End If
 '----------------------动态液位显示 2002-04-27
  yyy% = Int(37 + 0.19 * PvtAI(8 + glnum * Ainumgl))  '11.2 =112/量程
  For i% = 0 To linenum
    If i% <= yyy% Then
      If flagdj(i%) <> 1 Then
        flagdj(i%) = 1 '开显示标记
        Line1(i%).Visible = True
      End If
    Else
      If flagdj(i%) = 0 Then Exit For
      flagdj(i%) = 0 ' 关显示标记
      Line1(i%).Visible = False
    End If
  Next
'-----------------------5分钟存数据-------------
  tf% = Timer Mod 60 * 5
  If tf% >= 30 And tf% < 70 And f1_flag = 0 Then
     f1_flag = 1
     StatusBar1.Panels(1).Text = Date$
'---------------------------------------------目录---------
     FileName$ = datadir + "\" + "y" + Mid$(Date$, 3, 2) + Mid$(Date$, 6, 2)
     If Dir$(FileName$, 16) = "" Then
         MkDir FileName$
     End If
'---------------------------------------------文件--------------
     FileName$ = FileName$ + "\" + sydwjc + Mid$(Date$, 3, 2) + Mid$(Date$, 6, 2) + Mid$(Date$, 9, 2) + ".dat"
     Open FileName$ For Append As #1
      
      zfc$ = "@" + Mid$(Time$, 1, 2) + Mid$(Time$, 4, 2) & ","
      For ii% = 0 To ztnum
         zfc$ = zfc$ & PvtDI(ZTsunx(ii%)) & ","    '--------------回路状态(开关量)
      Next

      For jj% = 0 To 9
        SumLL(jj%) = Int(0.5 + 10000 * SumLL(jj%)) / 10000
        zfc$ = zfc$ & SumLL(jj%) & "," '--------------------------流量累计
      Next
      For jj% = 0 To BlnumZA(0)
         zfc$ = zfc$ & PvtAI(jj%) & ","  '------------------------模拟量
      Next
      zfc$ = zfc$ & "*"
      Print #1, zfc$
      Close #1
'--------------
  End If
  If tf% > 70 And f1_flag = 1 Then
     f1_flag = 0
  End If
'===========================流量累计====================
  SumLL(0) = SumLL(0) + Val(Format(PvtAI(2) / 1800, "0.00000")) '1#汽
  SumLL(2) = SumLL(2) + Val(Format(PvtAI(20) / 1800, "0.00000")) '2#汽
  SumLL(4) = SumLL(4) + Val(Format(PvtAI(38) / 1800, "0.00000")) '3#汽
  
  SumLL(6) = SumLL(6) + Val(Format(PvtAI(42) / 1800, "0.00000")) '软化水
  SumLL(7) = SumLL(7) + Val(Format(PvtAI(43) / 1800, "0.00000")) '凝结水
End Sub


Private Sub datall_Click(Index As Integer)
'   qiantai = 0
'   glsel = Index
'   FormDatarb.Show
Form2.Show
End Sub

Private Sub datass_Click()
 qiantai = 0
 FormDatass.Show
End Sub

Private Sub datastail_Click()
Form1.Show
End Sub

Private Sub daterq_Click()
set_dt.Show
End Sub

Private Sub exit10_Click()
On Error Resume Next
 Dim rel
 rel = MsgBox("是否退出本系统?", 36, SysTitle)
 If rel = 7 Then Exit Sub
 End
End Sub
Private Sub fcxzt1_Click(Index As Integer)
 Set myquxian = New FormQxss
 myquxian.Show
End Sub

Private Sub fcxztls_Click()
 blxuhao(0) = 99
 datetime = Date$
 sel24.Show
End Sub

Private Sub Form_Load()
 initialze
 StatusBar1.Panels(1).Text = Date$
 If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
'----------------


MSFlexGrid1.Move 11500, 0
MSFlexGrid1.colwidth(0) = 1800
MSFlexGrid1.colwidth(1) = 700
MSFlexGrid1.colwidth(2) = 700
'====================
Dim leftwy(50)
linenum = 75
leftwy(1) = 90: leftwy(2) = 30: leftwy(3) = 15: leftwy(4) = 30: leftwy(5) = 15
leftwy(7) = 15: leftwy(8) = 15: leftwy(9) = 15: leftwy(11) = 15
leftwy(13) = 15: leftwy(15) = 15: leftwy(17) = 15: leftwy(20) = 15

leftwy(25) = 15: leftwy(31) = 15

For i% = 1 To linenum
    Load Line1(i%)
    Line1(i%).y1 = Line1(i% - 1).y1 - 15  '变量名字
    Line1(i%).y2 = Line1(i% - 1).y2 - 15  '变量名字
    flagdj(i%) = 2 '水位线显示标记1,显示 0,关显示
    Line1(i%).Visible = True
Next

For ij% = 1 To (linenum + 1) / 2
    Line1(ij%).X1 = Line1(ij% - 1).X1 - leftwy(ij%)
    Line1(ij%).X2 = Line1(ij% - 1).X2 + leftwy(ij%)
    
    Line1(linenum - ij%).X1 = Line1(linenum + 1 - ij%).X1 - leftwy(ij%)
    Line1(linenum - ij%).X2 = Line1(linenum + 1 - ij%).X2 + leftwy(ij%)
Next
    Load Line1(76)
    Line1(76).y1 = Line1(37).y1  '变量名字
    Line1(76).y2 = Line1(37).y2 ' - 15  '变量名字
    Line1(76).Visible = True
    Line1(76).BorderColor = &HFF&
    Line1(76).X1 = Line1(37).X1 ' - leftwy(ij%)
    Line1(76).X2 = Line1(37).X2 '+ leftwy(ij%)
    Line1(76).ZOrder 0
'=========================================
  For i% = 0 To 17 '单位
     Labedw(i%).Caption = DanWei(i%)
  Next
 Imgbjf(0).Picture = LoadPicture(bmpdir & "NEWBJf0.bmp")
 Imgbjf(1).Picture = LoadPicture(bmpdir & "NEWBJf1.bmp")
 imageBJ.Picture = LoadPicture(bmpdir & "NEWBJf2.bmp")
'-------------------------------------------------
 For i% = 1 To 9
   Load Imagelp(i%)
 Next
 For i% = 0 To 9
   Imagelp(i%).Picture = LoadPicture(bmpdir & "lp" & i% & ".bmp")
 Next
 ImgLP.Picture = Imagelp(0).Picture
'--------------------------------------
 Bmpdirhy(0) = ""
 Bmpdirhy(1) = sysdir & "\bmp\huox.bmp"
 Bmpdirhy(2) = sysdir & "\bmp\huod.bmp"
'-----------------------------------------
 For j% = 0 To 2
   For i% = 0 To 2
     bmpdiryan(j%, i%) = bmpdir & "yan" & j% & i% & ".bmp"
   Next
 Next
 For i% = 1 To 2
   Load Imapumpz(i%)
   Load Imapumpy(i%)
   Load ImgYan(i%)

⌨️ 快捷键说明

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