1547 lines
51 KiB
Plaintext
1547 lines
51 KiB
Plaintext
VERSION 5.00
|
|
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
|
|
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
|
|
Begin VB.Form frmVerbundzaehlerPruefung
|
|
Caption = "Verbundzählerprüfung"
|
|
ClientHeight = 10575
|
|
ClientLeft = 60
|
|
ClientTop = 420
|
|
ClientWidth = 15075
|
|
LinkTopic = "Form1"
|
|
ScaleHeight = 10575
|
|
ScaleWidth = 15075
|
|
StartUpPosition = 3 'Windows-Standard
|
|
Begin VB.Frame Frame1
|
|
Height = 10635
|
|
Left = 0
|
|
TabIndex = 0
|
|
Top = 0
|
|
Width = 15075
|
|
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
|
|
Height = 5535
|
|
Left = 120
|
|
TabIndex = 26
|
|
Top = 180
|
|
Width = 14835
|
|
_ExtentX = 26167
|
|
_ExtentY = 9763
|
|
_Version = 393216
|
|
End
|
|
Begin VB.CommandButton cmdClr
|
|
Caption = "CLR"
|
|
Height = 315
|
|
Left = 10020
|
|
TabIndex = 22
|
|
Top = 8280
|
|
Width = 735
|
|
End
|
|
Begin VB.CommandButton cmdCopy
|
|
Caption = "copy"
|
|
Height = 315
|
|
Left = 10020
|
|
TabIndex = 21
|
|
Top = 7860
|
|
Width = 735
|
|
End
|
|
Begin VB.Frame Frame6
|
|
Height = 1875
|
|
Left = 2700
|
|
TabIndex = 13
|
|
Top = 5880
|
|
Width = 2115
|
|
Begin VB.ComboBox cmbDaempfung
|
|
Enabled = 0 'False
|
|
Height = 315
|
|
Left = 1080
|
|
Style = 2 'Dropdown-Liste
|
|
TabIndex = 15
|
|
Top = 780
|
|
Width = 675
|
|
End
|
|
Begin VB.CommandButton cmdRegulieren
|
|
Caption = "Regulieren"
|
|
Height = 375
|
|
Left = 540
|
|
TabIndex = 14
|
|
Top = 240
|
|
Width = 1275
|
|
End
|
|
Begin VB.Label Label9
|
|
Caption = "Dämpfung"
|
|
Height = 315
|
|
Left = 180
|
|
TabIndex = 20
|
|
Top = 840
|
|
Width = 855
|
|
End
|
|
Begin VB.Label lblDaempfung
|
|
Alignment = 2 'Zentriert
|
|
BorderStyle = 1 'Fest Einfach
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 24
|
|
Charset = 0
|
|
Weight = 400
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 1080
|
|
TabIndex = 16
|
|
Top = 1140
|
|
Width = 555
|
|
End
|
|
End
|
|
Begin VB.Frame Frame5
|
|
Caption = "SPS"
|
|
Height = 4515
|
|
Left = 120
|
|
TabIndex = 10
|
|
Top = 5880
|
|
Width = 2475
|
|
Begin VB.CommandButton cmdAbbrechen
|
|
Caption = "abbrechen"
|
|
Height = 255
|
|
Left = 1080
|
|
TabIndex = 45
|
|
Top = 4140
|
|
Width = 915
|
|
End
|
|
Begin VB.TextBox txtIntervall
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 1080
|
|
TabIndex = 44
|
|
Text = "2"
|
|
Top = 3300
|
|
Width = 675
|
|
End
|
|
Begin VB.TextBox txtSchrittweiteQ
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 1080
|
|
TabIndex = 40
|
|
Text = "0,05"
|
|
Top = 2880
|
|
Width = 675
|
|
End
|
|
Begin VB.TextBox txtQbis
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 1080
|
|
TabIndex = 37
|
|
Text = "2,3"
|
|
Top = 2460
|
|
Width = 735
|
|
End
|
|
Begin VB.TextBox txtQVon
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 1080
|
|
TabIndex = 34
|
|
Text = "1,5"
|
|
Top = 2100
|
|
Width = 735
|
|
End
|
|
Begin VB.CommandButton cmdQanfahren
|
|
Caption = "Q Anfahren"
|
|
Height = 375
|
|
Left = 1080
|
|
TabIndex = 31
|
|
Top = 3720
|
|
Width = 1275
|
|
End
|
|
Begin VB.TextBox txtQSoll
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 900
|
|
TabIndex = 17
|
|
Text = "0"
|
|
Top = 1080
|
|
Width = 735
|
|
End
|
|
Begin VB.CommandButton cmdQEinstellen
|
|
Caption = "START "
|
|
Height = 375
|
|
Left = 900
|
|
TabIndex = 12
|
|
Top = 270
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdStop
|
|
Caption = "STOP"
|
|
Height = 375
|
|
Left = 900
|
|
TabIndex = 11
|
|
Top = 660
|
|
Width = 1275
|
|
End
|
|
Begin VB.Label Label10
|
|
Caption = "Intervall"
|
|
Height = 195
|
|
Left = 120
|
|
TabIndex = 43
|
|
Top = 3300
|
|
Width = 855
|
|
End
|
|
Begin VB.Label Label8
|
|
Caption = "Schrittweite"
|
|
Height = 195
|
|
Left = 120
|
|
TabIndex = 42
|
|
Top = 2940
|
|
Width = 855
|
|
End
|
|
Begin VB.Label Label7
|
|
Caption = "m³/h"
|
|
Height = 195
|
|
Left = 1860
|
|
TabIndex = 41
|
|
Top = 2940
|
|
Width = 435
|
|
End
|
|
Begin MSForms.Label Label6
|
|
Height = 255
|
|
Left = 660
|
|
TabIndex = 39
|
|
Top = 2520
|
|
Width = 255
|
|
Caption = "bis"
|
|
Size = "450;450"
|
|
FontHeight = 165
|
|
FontCharSet = 0
|
|
FontPitchAndFamily= 2
|
|
End
|
|
Begin VB.Label Label5
|
|
Caption = "m³/h"
|
|
Height = 195
|
|
Left = 1860
|
|
TabIndex = 38
|
|
Top = 2520
|
|
Width = 435
|
|
End
|
|
Begin VB.Label Label4
|
|
Caption = "m³/h"
|
|
Height = 255
|
|
Left = 1860
|
|
TabIndex = 36
|
|
Top = 2160
|
|
Width = 435
|
|
End
|
|
Begin MSForms.Label Label1
|
|
Height = 255
|
|
Left = 600
|
|
TabIndex = 35
|
|
Top = 2160
|
|
Width = 375
|
|
Caption = "von"
|
|
Size = "661;450"
|
|
FontHeight = 165
|
|
FontCharSet = 0
|
|
FontPitchAndFamily= 2
|
|
End
|
|
Begin VB.Label Label15
|
|
Caption = "Q ist"
|
|
Height = 255
|
|
Left = 420
|
|
TabIndex = 25
|
|
Top = 1500
|
|
Width = 375
|
|
End
|
|
Begin VB.Label lblQist
|
|
Alignment = 1 'Rechts
|
|
BorderStyle = 1 'Fest Einfach
|
|
Height = 315
|
|
Left = 900
|
|
TabIndex = 24
|
|
Top = 1440
|
|
Width = 735
|
|
End
|
|
Begin VB.Label Label21
|
|
Caption = "m³/h"
|
|
Height = 255
|
|
Left = 1800
|
|
TabIndex = 23
|
|
Top = 1500
|
|
Width = 435
|
|
End
|
|
Begin VB.Label Label35
|
|
Caption = "Q soll"
|
|
Height = 195
|
|
Left = 420
|
|
TabIndex = 19
|
|
Top = 1140
|
|
Width = 495
|
|
End
|
|
Begin VB.Label Label36
|
|
Caption = "m³/h"
|
|
Height = 255
|
|
Left = 1800
|
|
TabIndex = 18
|
|
Top = 1140
|
|
Width = 435
|
|
End
|
|
End
|
|
Begin VB.CommandButton cmdSchaubild
|
|
Caption = "SPS Schaubild"
|
|
Height = 555
|
|
Left = 12120
|
|
TabIndex = 9
|
|
Top = 9840
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdQuit
|
|
Caption = "Beenden"
|
|
Height = 555
|
|
Left = 13620
|
|
TabIndex = 8
|
|
Top = 9840
|
|
Width = 1215
|
|
End
|
|
Begin VB.TextBox txtStatus
|
|
Height = 2595
|
|
Left = 2700
|
|
MultiLine = -1 'True
|
|
ScrollBars = 2 'Vertikal
|
|
TabIndex = 7
|
|
Top = 7860
|
|
Width = 7215
|
|
End
|
|
Begin VB.Frame Frame4
|
|
Height = 1875
|
|
Left = 4920
|
|
TabIndex = 1
|
|
Top = 5880
|
|
Width = 4935
|
|
Begin VB.CheckBox chkNZpruefen
|
|
Caption = "NZ"
|
|
Height = 195
|
|
Left = 3360
|
|
TabIndex = 33
|
|
Top = 1380
|
|
Value = 1 'Aktiviert
|
|
Width = 1275
|
|
End
|
|
Begin VB.CheckBox chkHZpruefen
|
|
Caption = "HZ"
|
|
Height = 195
|
|
Left = 3360
|
|
TabIndex = 32
|
|
Top = 1140
|
|
Value = 1 'Aktiviert
|
|
Width = 1275
|
|
End
|
|
Begin VB.TextBox txtPeriodendauermessung_Zeit
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 780
|
|
TabIndex = 28
|
|
Text = "120"
|
|
Top = 1200
|
|
Width = 555
|
|
End
|
|
Begin VB.CommandButton cmdFehlermessen
|
|
Caption = "Periodendauer- Messung"
|
|
Height = 555
|
|
Left = 1740
|
|
TabIndex = 6
|
|
Top = 1110
|
|
Width = 1455
|
|
End
|
|
Begin VB.TextBox txtImpulseZaehlen_Zeit
|
|
Alignment = 1 'Rechts
|
|
Height = 315
|
|
Left = 780
|
|
TabIndex = 3
|
|
Text = "60"
|
|
Top = 360
|
|
Width = 555
|
|
End
|
|
Begin VB.CommandButton cmdImpulsezaehlen
|
|
Caption = "Impulse zählen"
|
|
Height = 555
|
|
Left = 1740
|
|
TabIndex = 2
|
|
Top = 240
|
|
Width = 1455
|
|
End
|
|
Begin VB.Label Label3
|
|
Caption = "s"
|
|
Height = 255
|
|
Left = 1440
|
|
TabIndex = 30
|
|
Top = 1260
|
|
Width = 195
|
|
End
|
|
Begin VB.Label Label2
|
|
Caption = "Prüfzeit"
|
|
Height = 195
|
|
Left = 120
|
|
TabIndex = 29
|
|
Top = 1260
|
|
Width = 615
|
|
End
|
|
Begin VB.Label Label34
|
|
Caption = "Prüfzeit"
|
|
Height = 195
|
|
Left = 120
|
|
TabIndex = 5
|
|
Top = 420
|
|
Width = 615
|
|
End
|
|
Begin VB.Label Label33
|
|
Caption = "s"
|
|
Height = 255
|
|
Left = 1440
|
|
TabIndex = 4
|
|
Top = 420
|
|
Width = 195
|
|
End
|
|
End
|
|
Begin VB.Label lblAutosize
|
|
BorderStyle = 1 'Fest Einfach
|
|
Caption = "lblAutosize"
|
|
Height = 255
|
|
Left = 13680
|
|
TabIndex = 27
|
|
Top = 5760
|
|
Visible = 0 'False
|
|
Width = 915
|
|
End
|
|
End
|
|
End
|
|
Attribute VB_Name = "frmVerbundzaehlerPruefung"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = True
|
|
Attribute VB_Exposed = False
|
|
Option Explicit
|
|
|
|
Private m_SPS As CSPS
|
|
Private m_FMBus As CFMBus
|
|
Private m_FM85 As CFM85P
|
|
Private m_ColPumpen As Collection
|
|
Private m_blnAktivated As Boolean
|
|
Private m_Referenzzaehler As CRefzaehler
|
|
Private m_DurchflussSoll As Double
|
|
Private m_bVoreinstellwertSetzen As Double
|
|
Private m_KWert As Double
|
|
Private m_Pumpe As CPumpe
|
|
Private mblnAbbruch As Boolean
|
|
|
|
Private m_blnSimulation As Boolean
|
|
|
|
|
|
Enum enum_spalte
|
|
Ueberschrift = 0
|
|
RZ = 1
|
|
HZ1 = 2
|
|
NZ1 = 3
|
|
HZ2 = 4
|
|
NZ2 = 5
|
|
End Enum
|
|
|
|
Enum enum_zeile
|
|
Ueberschrift = 0
|
|
Adresse = 1
|
|
SerienNr = 2
|
|
Impulswertigkeit = 3
|
|
Impulse = 4
|
|
GezaehlteImpulse = 5
|
|
VerbleibeneImpulse = 6
|
|
Durchfluss_m3 = 7
|
|
Anteil = 8
|
|
Periodendauer = 9
|
|
Pruefzeit = 10
|
|
Fehler = 11
|
|
Durchfluss_HZ_NZ = 12
|
|
Fehler_HZ_NZ = 13
|
|
|
|
Anzahl = 14
|
|
End Enum
|
|
|
|
|
|
Private Sub PrintStatus(strText As String)
|
|
txtStatus.text = txtStatus.text & strText & vbCrLf
|
|
txtStatus.SelStart = Len(txtStatus.text)
|
|
DebugMsg ": " & strText
|
|
End Sub
|
|
|
|
|
|
Private Sub sendonly(text)
|
|
m_FMBus.send (text)
|
|
m_FMBus.receive (500)
|
|
End Sub
|
|
|
|
|
|
|
|
Private Function GetKWert(ImpulswertigkeitPZ As Long, ImpulswertigkeitRZ As Long, letzterFehlerRZ As Double) As Double
|
|
' K Wert bestimmen
|
|
GetKWert = ImpulswertigkeitRZ / ImpulswertigkeitPZ
|
|
PrintStatus "PZ-Impulse/qm = " & ImpulswertigkeitPZ
|
|
PrintStatus "RZ-Impulse/qm = " & ImpulswertigkeitRZ
|
|
PrintStatus "interpolierter Fehler RZ: " & letzterFehlerRZ & " % "
|
|
|
|
PrintStatus "unkorrigierter K Wert (" & ImpulswertigkeitRZ & "/" & ImpulswertigkeitPZ & "): " & GetKWert
|
|
GetKWert = ImpulswertigkeitRZ * (1 + letzterFehlerRZ / 100) / ImpulswertigkeitPZ
|
|
PrintStatus "mit RZ Fehler korrigierter K Wert: " & GetKWert
|
|
End Function
|
|
|
|
|
|
|
|
Private Sub UpdateQist()
|
|
lblQist.caption = Format(m_SPS.getQIst, "0.0000")
|
|
|
|
If m_SPS.SolldurchflussErreicht Then
|
|
lblQist.BackColor = vbGreen
|
|
Else
|
|
lblQist.BackColor = vbYellow
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub WarteAufDurchflussErreicht()
|
|
Sleep 2000, True
|
|
lblQist.BackColor = vbYellow
|
|
Do
|
|
If mblnAbbruch Then
|
|
lblQist.BackColor = &H8000000F
|
|
Exit Sub
|
|
End If
|
|
lblQist.caption = Format(m_SPS.getQIst, "0.0000")
|
|
DoEvents
|
|
Loop While Not m_SPS.SolldurchflussErreicht
|
|
lblQist.BackColor = vbGreen
|
|
End Sub
|
|
|
|
Private Sub SetQinSPS()
|
|
' Betrieb Start zurücksetzen
|
|
m_SPS.setBetrieb 8
|
|
Sleep 500
|
|
m_SPS.setBetrieb 0
|
|
|
|
' Durchlauf auswählen
|
|
m_SPS.setBehaelter 1
|
|
|
|
m_SPS.SetQSoll m_DurchflussSoll
|
|
PrintStatus "Nächster Durchfluss: " & m_DurchflussSoll
|
|
|
|
' Pumpenauswahl
|
|
' Hochbehälter Auswahl wenn Q < 1 m ^3 -> Pumpe.Nr = 4
|
|
' siehe modPumpe
|
|
m_SPS.AllePumpenAbwaehlen
|
|
|
|
Set m_Pumpe = Pumpenwahl(m_DurchflussSoll, m_ColPumpen)
|
|
PrintStatus "zu startende Pumpe: " & m_Pumpe.GetSPSVarname
|
|
m_Pumpe.Anwahl
|
|
m_SPS.SetServoStellung 50
|
|
|
|
' Vorwahl Referenzzaehler
|
|
m_SPS.SetMID m_Referenzzaehler.EinbauplatzNr
|
|
m_SPS.SetQDiff 0
|
|
|
|
' Durchfluss starten
|
|
m_SPS.setBetrieb 2
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub chkHZpruefen_Click()
|
|
If chkHZpruefen.value = vbUnchecked Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = 0
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = 1
|
|
chkNZpruefen.value = vbChecked
|
|
Else
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = ""
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = ""
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub chkNZpruefen_Click()
|
|
If chkNZpruefen.value = vbUnchecked Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = 1
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = 0
|
|
chkHZpruefen.value = vbChecked
|
|
Else
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = ""
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = ""
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub cmbDaempfung_Change()
|
|
Dim Wert As Integer
|
|
Wert = Val(cmbDaempfung.text)
|
|
' Dämpfung
|
|
sendonly Trim(Wert & "T")
|
|
lblDaempfung.caption = Wert
|
|
PrintStatus "Dämpfung " & Wert
|
|
End Sub
|
|
|
|
Private Sub cmbDaempfung_Click()
|
|
Call cmbDaempfung_Change
|
|
End Sub
|
|
|
|
Private Sub cmdAbbrechen_Click()
|
|
mblnAbbruch = True
|
|
End Sub
|
|
|
|
Private Sub cmdCLR_Click()
|
|
txtStatus.text = ""
|
|
End Sub
|
|
|
|
Private Sub cmdCopy_Click()
|
|
Clipboard.setText txtStatus.text
|
|
End Sub
|
|
|
|
Private Sub cmdFehlermessen_Click()
|
|
cmdFehlermessen.Enabled = False
|
|
Me.MousePointer = vbHourglass
|
|
|
|
If Not m_Referenzzaehler Is Nothing Then
|
|
Call Periodendauermessung
|
|
Else
|
|
txtQSoll.SetFocus
|
|
MsgBox "Bitte zuerst den Durchfluss eingeben und START klicken, damit der richtige Referenzzähler für diesen Durchfluss ausgewählt wird."
|
|
End If
|
|
|
|
cmdFehlermessen.Enabled = True
|
|
Me.MousePointer = vbNormal
|
|
End Sub
|
|
|
|
Private Sub initFlexgrid()
|
|
MSFlexGrid1.Clear
|
|
MSFlexGrid1.Cols = 6
|
|
MSFlexGrid1.Rows = enum_zeile.Anzahl
|
|
|
|
' Ueberschrift = 0
|
|
' Adresse = 1
|
|
' SerienNr = 2
|
|
' Impulswertigkeit = 3
|
|
' GezaehlteImpulse = 4
|
|
' VerbleibeneImpulse = 5
|
|
' Durchfluss_m3 = 6
|
|
' Anteil = 7
|
|
' Periodendauer = 8
|
|
' Pruefzeit = 9
|
|
' Durchfluss_HZ_NZ = 10
|
|
' fehler_HZ_NZ = 11
|
|
|
|
|
|
Dim Spalte As Integer
|
|
Dim Zeile As Integer
|
|
|
|
|
|
MSFlexGrid1.Font.Size = 12
|
|
MSFlexGrid1.FormatString = "| RZ | HZ 1 | NZ 1 | | " '| HZ 2 | NZ 2 "
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.Ueberschrift) = "FM85"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.SerienNr, enum_spalte.Ueberschrift) = "-"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.Ueberschrift) = "Impulswertigkeit [Imp/m³]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.Ueberschrift) = "Impuls vorwahl"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.Ueberschrift) = "Gezählte Imp"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.Ueberschrift) = "Verbleibene Imp"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.Ueberschrift) = "Q [m³/h]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.Ueberschrift) = "Anteil"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Periodendauer, enum_spalte.Ueberschrift) = "Periodendauer [s/2994]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.Ueberschrift) = "Prüfzeit [s]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler, enum_spalte.Ueberschrift) = "Fehler [%]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_HZ_NZ, enum_spalte.Ueberschrift) = "Q HZ+NZ [m³/h]"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler_HZ_NZ, enum_spalte.Ueberschrift) = "Fehler HZ+NZ [%]"
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.RZ) = "1"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.HZ1) = "1"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.NZ1) = "2"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.HZ2) = "3"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.NZ2) = "4"
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ1) = "1000"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.NZ1) = "10000"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ2) = "1000"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.NZ2) = "106105"
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.HZ1) = "0"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.NZ1) = "0"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.RZ) = "0"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.HZ2) = "0"
|
|
'MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.NZ2) = "0"
|
|
|
|
|
|
For Zeile = 0 To MSFlexGrid1.Rows - 1
|
|
For Spalte = 0 To MSFlexGrid1.Cols - 1
|
|
MSFlexGrid1.col = Spalte
|
|
MSFlexGrid1.row = Zeile
|
|
If MSFlexGrid1.text = "" Then
|
|
MSFlexGrid1.CellBackColor = RGB(220, 220, 220)
|
|
End If
|
|
Next
|
|
Next
|
|
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
End Sub
|
|
|
|
|
|
Private Sub Periodendauermessung()
|
|
Dim intAdresseHZ As Integer
|
|
Dim intAdresseNZ As Integer
|
|
|
|
Dim blnFertig As Boolean
|
|
|
|
Dim AnzahlPeriodenHZ As Long
|
|
Dim AnzahlPeriodenNZ As Long
|
|
Dim AnzahlPeriodenRZ As Long
|
|
|
|
Dim verbleibendeImpulseHZ As Long
|
|
Dim verbleibendeImpulseNZ As Long
|
|
Dim verbleibendeImpulseRZ As Long
|
|
|
|
Dim PeriodendauerHZ As Long
|
|
Dim PeriodendauerNZ As Long
|
|
Dim PeriodendauerRZ As Long
|
|
|
|
Dim dblPruefzeitHZ As Double
|
|
Dim dblPruefzeitNZ As Double
|
|
Dim dblPruefzeitRZ As Double
|
|
Dim dblPruefzeit_s As Double
|
|
Dim lngStartzeit As Long
|
|
|
|
Dim dblPruefvolumen As Double
|
|
|
|
Dim ImpulswertigkeitHZ As Long
|
|
Dim ImpulswertigkeitNZ As Long
|
|
Dim ImpulswertigkeitRZ As Long
|
|
|
|
Dim dblQ_HZ As Double
|
|
Dim dblQ_NZ As Double
|
|
Dim dblQ_HZ_NZ As Double
|
|
Dim dblQ_RZ As Double
|
|
|
|
Dim dblFehler As Double
|
|
Dim dblFehlerRZ As Double
|
|
Dim dblTemperatur As Double
|
|
|
|
Dim Zeile As Integer
|
|
Dim Spalte As Integer
|
|
Dim dblZeitFaktor As Double
|
|
|
|
Dim bln_Auf_NZ_warten As Boolean
|
|
|
|
For Zeile = enum_zeile.GezaehlteImpulse To enum_zeile.Fehler_HZ_NZ
|
|
For Spalte = 1 To MSFlexGrid1.Cols - 1
|
|
MSFlexGrid1.TextMatrix(Zeile, Spalte) = ""
|
|
Next
|
|
Next
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.RZ) = 1
|
|
dblPruefvolumen = m_DurchflussSoll * Val(txtPeriodendauermessung_Zeit.text) / 3600
|
|
|
|
dblZeitFaktor = Val(txtPeriodendauermessung_Zeit.text) / Val(txtImpulseZaehlen_Zeit.text)
|
|
|
|
If chkHZpruefen.value = vbUnchecked Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = 0
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = 1
|
|
End If
|
|
|
|
If chkNZpruefen.value = vbUnchecked Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = 1
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = 0
|
|
End If
|
|
|
|
ImpulswertigkeitRZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.RZ))
|
|
If ImpulswertigkeitRZ = 0 Then
|
|
MsgBox "Bitte Impulswertigkeit des RZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
PrintStatus "Impulswertigkeit RZ: " & ImpulswertigkeitRZ
|
|
|
|
If chkHZpruefen.value = vbChecked Then
|
|
ImpulswertigkeitHZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ1))
|
|
If ImpulswertigkeitHZ = 0 Then
|
|
MsgBox "Bitte Impulswertigkeit des HZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
PrintStatus "Impulswertigkeit HZ 1: " & ImpulswertigkeitHZ
|
|
|
|
AnzahlPeriodenHZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.HZ1))
|
|
If AnzahlPeriodenHZ = 0 And MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) <> "" Then
|
|
AnzahlPeriodenHZ = ImpulswertigkeitHZ * dblPruefvolumen * CDbl(MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1))
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.HZ1) = AnzahlPeriodenHZ
|
|
If AnzahlPeriodenHZ = 0 Then
|
|
MsgBox "Bitte AnzahlPerioden des HZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
PrintStatus "AnzahlPerioden HZ : " & AnzahlPeriodenHZ
|
|
End If
|
|
|
|
If chkNZpruefen.value = vbChecked Then
|
|
ImpulswertigkeitNZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.NZ1))
|
|
If ImpulswertigkeitNZ = 0 Then
|
|
MsgBox "Bitte Impulswertigkeit des NZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
PrintStatus "Impulswertigkeit NZ 1: " & ImpulswertigkeitNZ
|
|
|
|
AnzahlPeriodenNZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.NZ1))
|
|
PrintStatus "AnzahlPerioden NZ : " & AnzahlPeriodenNZ
|
|
If AnzahlPeriodenNZ = 0 And chkHZpruefen.value = vbUnchecked Then
|
|
AnzahlPeriodenNZ = ImpulswertigkeitNZ * dblPruefvolumen * 1 ' voller Anteil
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.NZ1) = AnzahlPeriodenNZ
|
|
If AnzahlPeriodenNZ = 0 Then
|
|
MsgBox "Bitte AnzahlPerioden des NZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
AnzahlPeriodenRZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.RZ))
|
|
If AnzahlPeriodenRZ = 0 Then
|
|
AnzahlPeriodenRZ = ImpulswertigkeitRZ * dblPruefvolumen
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.RZ) = AnzahlPeriodenRZ
|
|
If AnzahlPeriodenRZ = 0 Then
|
|
MsgBox "Bitte AnzahlPerioden des RZ angeben!"
|
|
Exit Sub
|
|
End If
|
|
End If
|
|
PrintStatus "AnzahlPerioden RZ : " & AnzahlPeriodenRZ
|
|
|
|
PrintStatus "Reset alle FM85..."
|
|
sendonly "**0@"
|
|
sendonly "R"
|
|
Sleep 5000, True
|
|
|
|
dblFehlerRZ = m_Referenzzaehler.letzterFehler(m_DurchflussSoll)
|
|
PrintStatus "Fehler des RZ bei " & m_DurchflussSoll & "m³/h =" & Format(dblFehlerRZ, "0.00") & " %"
|
|
|
|
PrintStatus "Periodendauermessung starten HZ"
|
|
intAdresseHZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.HZ1))
|
|
sendonly "**" & intAdresseHZ & "@"
|
|
|
|
If chkHZpruefen.value = vbChecked Then
|
|
' Periodenzahl HZ festlegen
|
|
sendonly Hex(AnzahlPeriodenHZ) & "H"
|
|
End If
|
|
|
|
' Periodenzahl RZ festlegen
|
|
sendonly Hex(AnzahlPeriodenRZ) & "M"
|
|
|
|
PrintStatus "Periodendauermessung starten NZ"
|
|
intAdresseNZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.NZ1))
|
|
sendonly "**" & intAdresseNZ & "@"
|
|
|
|
If chkNZpruefen.value = vbChecked Then
|
|
' Periodenzahl NZ festlegen
|
|
sendonly Hex(AnzahlPeriodenNZ) & "H"
|
|
End If
|
|
' Periodenzahl RZ festlegen
|
|
sendonly Hex(AnzahlPeriodenRZ) & "M"
|
|
|
|
' Startzeit festlegen
|
|
lngStartzeit = GetTickCount()
|
|
Do
|
|
If Not g_ohneSPS Then
|
|
UpdateQist
|
|
End If
|
|
|
|
dblPruefzeit_s = (GetTickCount - lngStartzeit) / 1000
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.RZ) = Format(dblPruefzeit_s, "#")
|
|
|
|
If chkHZpruefen.value = vbChecked Then
|
|
verbleibendeImpulseHZ = GetHexZahlFromFM85(intAdresseHZ, "I", 0)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.HZ1) = verbleibendeImpulseHZ
|
|
Else
|
|
verbleibendeImpulseHZ = 0
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.HZ1) = ""
|
|
End If
|
|
|
|
If chkNZpruefen.value = vbChecked Then
|
|
If AnzahlPeriodenNZ - verbleibendeImpulseNZ > 1 Then
|
|
If bln_Auf_NZ_warten = False Then
|
|
PrintStatus "Es gab 2 Impulse. Nun muss auch auf alle NZ Impulse gewartet werden."
|
|
End If
|
|
' gezählte Impulse beim NZ >= 2 => Es läuft Wasser durch den NZ => Auf NZ Impulse warten
|
|
bln_Auf_NZ_warten = True
|
|
Else
|
|
' gezählte Impulse beim NZ noch < 2 => Es läuft KEIN Wasser durch den NZ, NICHT auf NZ Impulse warten
|
|
bln_Auf_NZ_warten = True
|
|
End If
|
|
|
|
verbleibendeImpulseNZ = GetHexZahlFromFM85(intAdresseNZ, "I", 0)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.NZ1) = verbleibendeImpulseNZ
|
|
Else
|
|
verbleibendeImpulseNZ = 0
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.NZ1) = ""
|
|
End If
|
|
|
|
verbleibendeImpulseRZ = GetHexZahlFromFM85(intAdresseHZ, "J", 0)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.VerbleibeneImpulse, enum_spalte.RZ) = verbleibendeImpulseRZ
|
|
|
|
DoEvents
|
|
If mblnAbbruch Then
|
|
PrintStatus "Periodendauer-Messung abgebrochen"
|
|
Exit Sub
|
|
End If
|
|
|
|
Loop While Not (verbleibendeImpulseHZ = 0 And ((bln_Auf_NZ_warten = False) Or verbleibendeImpulseNZ = 0) And verbleibendeImpulseRZ = 0)
|
|
|
|
|
|
|
|
If chkHZpruefen.value = vbChecked Then
|
|
PeriodendauerHZ = GetHexZahlFromFM85(intAdresseHZ, "X", 179640 * dblZeitFaktor)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Periodendauer, enum_spalte.HZ1) = PeriodendauerHZ
|
|
PrintStatus "Periodendauer HZ " & PeriodendauerHZ
|
|
|
|
dblPruefzeitHZ = PeriodendauerHZ * 167 / 500000 'Quarzzeitbasis 1/2994 s
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.HZ1) = Format(dblPruefzeitHZ, "0.00")
|
|
PrintStatus "=> Pruefzeit HZ: " & Format(dblPruefzeitHZ, "0.000") & " s"
|
|
|
|
dblQ_HZ = 3600 * AnzahlPeriodenHZ / ImpulswertigkeitHZ / dblPruefzeitHZ
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.HZ1) = Format(dblQ_HZ, "0.000")
|
|
PrintStatus "Durchfluss HZ : " & Format(dblQ_HZ, "0.00000") & " m³/h"
|
|
Else
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.HZ1) = ""
|
|
dblQ_HZ = 0
|
|
End If
|
|
|
|
If chkNZpruefen.value = vbChecked Then
|
|
PeriodendauerNZ = GetHexZahlFromFM85(intAdresseNZ, "X", 179650 * dblZeitFaktor)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Periodendauer, enum_spalte.NZ1) = PeriodendauerNZ
|
|
PrintStatus "Periodendauer NZ " & PeriodendauerNZ
|
|
|
|
dblPruefzeitNZ = PeriodendauerNZ * 167 / 500000 'Quarzzeitbasis 1/2994 s
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.NZ1) = Format(dblPruefzeitNZ, "0.000")
|
|
PrintStatus "=> Pruefzeit NZ: " & Format(dblPruefzeitNZ, "0.000") & "s"
|
|
|
|
dblQ_NZ = 3600 * AnzahlPeriodenNZ / ImpulswertigkeitNZ / dblPruefzeitNZ
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.NZ1) = Format(dblQ_NZ, "0.000")
|
|
PrintStatus "Durchfluss NZ : " & Format(dblQ_NZ, "0.000") & " m³/h"
|
|
Else
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Periodendauer, enum_spalte.NZ1) = ""
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.NZ1) = ""
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.NZ1) = ""
|
|
dblQ_NZ = 0
|
|
End If
|
|
|
|
dblQ_HZ_NZ = dblQ_HZ + dblQ_NZ
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_HZ_NZ, enum_spalte.HZ1) = Format(dblQ_HZ_NZ, "0.000")
|
|
PrintStatus "Q Hz + Q Nz = " & Format(dblQ_HZ_NZ, "0.000") & "m³/h"
|
|
|
|
If dblQ_HZ_NZ > 0 Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = Format(dblQ_HZ / dblQ_HZ_NZ, "0.000")
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = Format(dblQ_NZ / dblQ_HZ_NZ, "0.000")
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.RZ) = "1"
|
|
End If
|
|
|
|
PeriodendauerRZ = GetHexZahlFromFM85(intAdresseHZ, "Y", 179646 * dblZeitFaktor)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Periodendauer, enum_spalte.RZ) = PeriodendauerRZ
|
|
PrintStatus "Periodendauer RZ " & PeriodendauerRZ
|
|
|
|
dblPruefzeitRZ = PeriodendauerRZ * 167 / 500000 'Quarzzeitbasis 1/2994 s
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.RZ) = Format(dblPruefzeitRZ, "0.000")
|
|
PrintStatus "=> Pruefzeit RZ: " & Format(dblPruefzeitRZ, "0.000") & "s"
|
|
|
|
dblQ_RZ = 3600 * AnzahlPeriodenRZ / ImpulswertigkeitRZ / dblPruefzeitRZ
|
|
PrintStatus "Durchfluss RZ (fehlerbehaftet) : " & Format(dblQ_RZ, "0.00000") & " m³/h"
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler, enum_spalte.RZ) = Format(dblFehlerRZ, "0.00") & " %"
|
|
PrintStatus "Fehler des RZ bei " & m_DurchflussSoll & "m³/h =" & Format(dblFehlerRZ, "0.00") & " %"
|
|
|
|
dblQ_RZ = dblQ_RZ / (1 + dblFehlerRZ / 100)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.RZ) = Format(dblQ_RZ, "0.000")
|
|
PrintStatus "Durchfluss RZ (korrigiert) : " & Format(dblQ_RZ, "0.00000") & " m³/h"
|
|
|
|
If dblQ_RZ > 0 Then
|
|
dblFehler = 100 * (dblQ_HZ_NZ - dblQ_RZ) / dblQ_RZ
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler_HZ_NZ, enum_spalte.HZ1) = Format(dblFehler, "0.000")
|
|
PrintStatus "Fehler des Verbundzaehlers: " & Format(dblFehler, "0.000") & " %"
|
|
Else
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler_HZ_NZ, enum_spalte.HZ1) = "?"
|
|
End If
|
|
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
End Sub
|
|
|
|
Private Sub cmdImpulsezaehlen_Click()
|
|
cmdImpulsezaehlen.Enabled = False
|
|
Me.MousePointer = vbHourglass
|
|
|
|
ImpusleZaehlen
|
|
|
|
Me.MousePointer = vbNormal
|
|
cmdImpulsezaehlen.Enabled = True
|
|
End Sub
|
|
|
|
Private Sub ImpusleZaehlen()
|
|
Dim lngStartzeit As Long
|
|
|
|
Dim intAdresseHZ As Integer
|
|
Dim intAdresseNZ As Integer
|
|
|
|
Dim ImpulswertigkeitHZ As Long
|
|
Dim ImpulswertigkeitNZ As Long
|
|
Dim ImpulswertigkeitRZ As Long
|
|
|
|
Dim lngHZImpulse As Long
|
|
Dim lngNZImpulse As Long
|
|
Dim lngRZImpulse As Long
|
|
|
|
Dim dblQ_RZ As Double
|
|
Dim dblQ_HZ As Double
|
|
Dim dblQ_NZ As Double
|
|
Dim dblQ_Ges As Double
|
|
|
|
Dim dblAnteil_HZ As Double
|
|
Dim dblAnteil_NZ As Double
|
|
|
|
Dim dblPruefzeit_s As Double
|
|
Dim dblZeitFaktor As Double
|
|
|
|
Dim lngSimu_RZ_Imp As Long
|
|
Dim lngSimu_HZ_Imp As Long
|
|
Dim lngSimu_NZ_Imp As Long
|
|
|
|
'Ueberschrift = 0
|
|
'Adresse = 1
|
|
'SerienNr = 2
|
|
'Impulswertigkeit = 3
|
|
'Impulse = 4
|
|
'GezaehlteImpulse = 5
|
|
'VerbleibeneImpulse = 6
|
|
'Durchfluss_m3 = 7
|
|
'Anteil = 8
|
|
'Periodendauer = 9
|
|
'Pruefzeit = 10
|
|
'Fehler = 11
|
|
'Durchfluss_HZ_NZ = 12
|
|
'Fehler_HZ_NZ = 13
|
|
|
|
Dim Spalte As Integer
|
|
Dim Zeile As Integer
|
|
|
|
For Zeile = enum_zeile.Impulse To enum_zeile.Fehler_HZ_NZ
|
|
For Spalte = 1 To MSFlexGrid1.Cols - 1
|
|
MSFlexGrid1.TextMatrix(Zeile, Spalte) = ""
|
|
Next
|
|
Next
|
|
|
|
PrintStatus "Reset alle FM85..."
|
|
sendonly "**0@"
|
|
sendonly "R"
|
|
Sleep 5000
|
|
|
|
intAdresseHZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.HZ1))
|
|
intAdresseNZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Adresse, enum_spalte.NZ1))
|
|
|
|
ImpulswertigkeitHZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ1))
|
|
ImpulswertigkeitNZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.NZ1))
|
|
ImpulswertigkeitRZ = Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.RZ))
|
|
|
|
PrintStatus "FM85 Impulszählung HZ starten..."
|
|
'Impulszählung für HZ
|
|
sendonly "**" & intAdresseHZ & "@"
|
|
sendonly "Q"
|
|
|
|
PrintStatus "FM85 Impulszählung NZ starten..."
|
|
'Impulszählung für RZ starten
|
|
sendonly "**" & intAdresseNZ & "@"
|
|
sendonly "Q"
|
|
|
|
PrintStatus "FM85 Impulszählung RZ starten..."
|
|
'Impulszählung RZ starten
|
|
sendonly "**" & intAdresseHZ & "@"
|
|
sendonly "O"
|
|
|
|
lngStartzeit = GetTickCount()
|
|
Do
|
|
If Not g_ohneSPS Then
|
|
UpdateQist
|
|
End If
|
|
|
|
lngSimu_RZ_Imp = 1690 * dblPruefzeit_s / Val(txtImpulseZaehlen_Zeit.text)
|
|
lngSimu_HZ_Imp = 838 * dblPruefzeit_s / Val(txtImpulseZaehlen_Zeit.text)
|
|
lngSimu_NZ_Imp = 154 * dblPruefzeit_s / Val(txtImpulseZaehlen_Zeit.text)
|
|
|
|
' Zeit in Stunden
|
|
dblPruefzeit_s = (GetTickCount - lngStartzeit) / 1000
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Pruefzeit, enum_spalte.HZ1) = Format(dblPruefzeit_s, "0.0")
|
|
|
|
' Haupzähler
|
|
If ImpulswertigkeitHZ > 0 Then
|
|
' Impulse für HZ auslesen und darstellen
|
|
lngHZImpulse = GetHexZahlFromFM85(intAdresseHZ, "U", lngSimu_HZ_Imp)
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.HZ1) = lngHZImpulse
|
|
If dblPruefzeit_s > 0 Then
|
|
' m³/h = Impulse / [Impulse/m³] / h
|
|
dblQ_HZ = (lngHZImpulse / ImpulswertigkeitHZ) / (dblPruefzeit_s / 3600)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.HZ1) = Format(dblQ_HZ, "0.000")
|
|
End If
|
|
End If
|
|
|
|
If ImpulswertigkeitNZ > 0 Then
|
|
' Impulse für NZ auslesen und darstellen
|
|
lngNZImpulse = GetHexZahlFromFM85(intAdresseNZ, "U", lngSimu_NZ_Imp)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.NZ1) = lngNZImpulse
|
|
|
|
If dblPruefzeit_s > 0 Then
|
|
' m³/h = Impulse / [Impulse/m³] / h
|
|
dblQ_NZ = (lngNZImpulse / ImpulswertigkeitNZ) / (dblPruefzeit_s / 3600)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.NZ1) = Format(dblQ_NZ, "0.000")
|
|
End If
|
|
End If
|
|
|
|
If ImpulswertigkeitRZ > 0 Then
|
|
' Impulse für RZ auslesen und darstellen
|
|
lngRZImpulse = GetHexZahlFromFM85(intAdresseHZ, "L", lngSimu_RZ_Imp)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.RZ) = lngRZImpulse
|
|
If dblPruefzeit_s > 0 Then
|
|
dblQ_RZ = (lngRZImpulse / ImpulswertigkeitRZ) / (dblPruefzeit_s / 3600)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_m3, enum_spalte.RZ) = Format(dblQ_RZ, "0.000")
|
|
End If
|
|
End If
|
|
|
|
dblQ_Ges = dblQ_HZ + dblQ_NZ
|
|
|
|
' Anteil anzeigen
|
|
If dblQ_Ges > 0 Then
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Durchfluss_HZ_NZ, enum_spalte.HZ1) = Format(dblQ_Ges, "0.000")
|
|
|
|
dblAnteil_HZ = dblQ_HZ / dblQ_Ges
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1) = Format(dblAnteil_HZ, "0.000000")
|
|
|
|
dblAnteil_NZ = dblQ_NZ / dblQ_Ges
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.NZ1) = Format(dblAnteil_NZ, "0.000000")
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.RZ) = Format(dblAnteil_NZ + dblAnteil_HZ, "0.00")
|
|
|
|
End If
|
|
|
|
If mblnAbbruch Then
|
|
PrintStatus "Impulszählung abgebrochen"
|
|
Exit Sub
|
|
End If
|
|
|
|
DoEvents
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
Loop While lngStartzeit + 1000 * Val(txtImpulseZaehlen_Zeit.text) > GetTickCount And mblnAbbruch = False
|
|
|
|
' Impulsvorwahl für Periodendauermessung hochrechnen
|
|
dblZeitFaktor = Val(txtPeriodendauermessung_Zeit.text) / Val(txtImpulseZaehlen_Zeit.text)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.HZ1) = Int(Val(MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.HZ1)) * dblZeitFaktor)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.NZ1) = Int(Val(MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.NZ1)) * dblZeitFaktor)
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulse, enum_spalte.RZ) = Int(Val(MSFlexGrid1.TextMatrix(enum_zeile.GezaehlteImpulse, enum_spalte.RZ)) * dblZeitFaktor)
|
|
|
|
PrintStatus "Impulszählung beendet"
|
|
End Sub
|
|
|
|
Private Function GetHexZahlFromFM85(EinbauplatzNr As Integer, strSende As String, lngSimuDefault As Long) As Long
|
|
Dim strAntwortAdressierung As String
|
|
Dim strAntwort As String
|
|
Dim Versuche As Long
|
|
|
|
On Error GoTo Errorhandler
|
|
|
|
If m_blnSimulation Then
|
|
GetHexZahlFromFM85 = lngSimuDefault
|
|
Exit Function
|
|
End If
|
|
|
|
Versuche = 0
|
|
startagain1:
|
|
If g_Abbruch = True Then Exit Function
|
|
If EinbauplatzNr > 0 Then
|
|
' FM85P mit entspr. Adresse ansprechen
|
|
m_FMBus.send "**" & EinbauplatzNr & "@"
|
|
strAntwortAdressierung = m_FMBus.receive(700)
|
|
If InStr(1, strAntwortAdressierung, EinbauplatzNr) = 0 Then
|
|
PrintStatus "FM85P-" & EinbauplatzNr & " antwortete bei Adressierung '" & strAntwortAdressierung & "'"
|
|
If Versuche < 10 Then
|
|
Versuche = Versuche + 1
|
|
GoTo startagain1
|
|
End If
|
|
LogIntoDB "FM85P-" & EinbauplatzNr & " antwortete mit '" & strAntwort & "'", "FM85 Hauptprüfung"
|
|
End If
|
|
End If
|
|
Versuche = 0
|
|
|
|
startagain2:
|
|
m_FMBus.send strSende
|
|
strAntwort = m_FMBus.receive(700)
|
|
|
|
If g_Abbruch = True Then Exit Function
|
|
|
|
If IsNumeric("&H" & strAntwort) Then
|
|
GetHexZahlFromFM85 = CLng("&H" & strAntwort)
|
|
'PrintStatus "Anwort vom FM85: " & strAntwort & " = " & GetHexZahlFromFM85
|
|
Else
|
|
PrintStatus "FM85P-" & EinbauplatzNr & " antwortete mit '" & strAntwort & "'"
|
|
If InStr(1, strAntwort, "MESSERGEBNIS LIEGT NICHT VOR") > 0 Then
|
|
GetHexZahlFromFM85 = -1
|
|
Exit Function
|
|
End If
|
|
|
|
If Versuche < 10 Then
|
|
Versuche = Versuche + 1
|
|
GoTo startagain2
|
|
End If
|
|
LogIntoDB "FM85P-" & EinbauplatzNr & " antwortete mit '" & strAntwort & "'", "FM85 Hauptprüfung"
|
|
GetHexZahlFromFM85 = -1
|
|
End If
|
|
Exit Function
|
|
Errorhandler:
|
|
LogIntoDB "Fehler " & Err.Number & " in GetHexZahlFromFM85:" & Err.Description, "Prg Fehler!"
|
|
GetHexZahlFromFM85 = -1
|
|
End Function
|
|
|
|
|
|
|
|
Private Sub cmdQanfahren_Click()
|
|
Dim dblDurchfluss As Double
|
|
Dim dblDurchflussVon As Double
|
|
Dim dblDurchflussBis As Double
|
|
Dim dblDurchflussDelta As Double
|
|
Dim lngZeitms As Long
|
|
|
|
mblnAbbruch = False
|
|
|
|
cmdQanfahren.Enabled = False
|
|
Me.MousePointer = vbHourglass
|
|
|
|
dblDurchflussVon = CDbl(txtQVon.text)
|
|
dblDurchflussBis = CDbl(txtQbis.text)
|
|
dblDurchflussDelta = CDbl(txtSchrittweiteQ.text)
|
|
lngZeitms = CDbl(txtIntervall.text) * 1000
|
|
|
|
If (dblDurchflussVon > dblDurchflussBis And dblDurchflussDelta > 0) Or (dblDurchflussVon < dblDurchflussBis And dblDurchflussDelta < 0) Then
|
|
' absteigend aber delta > 0
|
|
PrintStatus "falsches Vorzeichen in der Schrittweite wurde korrigiert"
|
|
dblDurchflussDelta = -dblDurchflussDelta
|
|
txtSchrittweiteQ.text = dblDurchflussDelta
|
|
End If
|
|
|
|
|
|
dblDurchfluss = dblDurchflussVon
|
|
txtQSoll.text = dblDurchfluss
|
|
|
|
PrintStatus "Startwert anfahren: " & dblDurchfluss & " m³/h"
|
|
If Not g_ohneSPS Then
|
|
m_SPS.SetQSoll dblDurchfluss
|
|
WarteAufDurchflussErreicht
|
|
End If
|
|
|
|
PrintStatus "Startwert erreicht"
|
|
|
|
Do
|
|
dblDurchfluss = dblDurchfluss + dblDurchflussDelta
|
|
|
|
If dblDurchfluss >= dblDurchflussBis And dblDurchflussBis > dblDurchflussVon Then
|
|
' aufsteigend
|
|
Exit Do
|
|
End If
|
|
|
|
If dblDurchfluss <= dblDurchflussBis And dblDurchflussBis < dblDurchflussVon Then
|
|
' aufsteigend
|
|
Exit Do
|
|
End If
|
|
|
|
If mblnAbbruch Then Exit Do
|
|
|
|
PrintStatus "Zwischenwert: " & dblDurchfluss & " m³/h"
|
|
If Not g_ohneSPS Then
|
|
txtQSoll.text = dblDurchfluss
|
|
m_SPS.SetQSoll dblDurchfluss
|
|
End If
|
|
|
|
DoEvents
|
|
Sleep lngZeitms
|
|
UpdateQist
|
|
Loop While True
|
|
|
|
If mblnAbbruch Then
|
|
PrintStatus "Anfahren abgebrochen"
|
|
GoTo Ende
|
|
End If
|
|
|
|
If Not g_ohneSPS Then
|
|
m_SPS.SetQSoll dblDurchflussBis
|
|
WarteAufDurchflussErreicht
|
|
End If
|
|
|
|
PrintStatus "Durchfluss erreicht"
|
|
|
|
Ende:
|
|
cmdQanfahren.Enabled = True
|
|
Me.MousePointer = vbNormal
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdQEinstellen_Click()
|
|
cmdQEinstellen.Enabled = False
|
|
txtQSoll.Enabled = False
|
|
Me.MousePointer = vbHourglass
|
|
|
|
mblnAbbruch = False
|
|
|
|
lblQist.caption = ""
|
|
m_DurchflussSoll = CDbl(txtQSoll)
|
|
|
|
Set m_Referenzzaehler = New CRefzaehler
|
|
m_Referenzzaehler.loadForDurchfluss m_DurchflussSoll, 0
|
|
|
|
PrintStatus "Referenzzähler mit NW " & m_Referenzzaehler.Nennweite & " gewählt"
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.RZ) = m_Referenzzaehler.ImpulseQM
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler, enum_spalte.RZ) = Format(m_Referenzzaehler.letzterFehler(m_DurchflussSoll), "0.000")
|
|
AutoSpaltenBreite MSFlexGrid1, lblAutosize
|
|
|
|
If Not g_ohneSPS Then
|
|
Call SetQinSPS
|
|
WarteAufDurchflussErreicht
|
|
End If
|
|
PrintStatus "Solldurchfluss erreicht"
|
|
|
|
cmdQEinstellen.Enabled = True
|
|
Me.MousePointer = vbNormal
|
|
txtQSoll.Enabled = True
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub VorbereitenFM85_fuer_Regulierung(lngImpulswertigkeit As Long, Optional dblAnteil = 1)
|
|
Dim letzterFehlerRZ As Double
|
|
Dim TmpStr As String
|
|
|
|
If m_Referenzzaehler Is Nothing Then
|
|
MsgBox "Der Durchfluss muss zuerst gestartet werden!"
|
|
Exit Sub
|
|
End If
|
|
|
|
PrintStatus "FM85 reset"
|
|
' RESET
|
|
sendonly "**0@"
|
|
sendonly "R"
|
|
Sleep 3000, True
|
|
|
|
sendonly "**0@"
|
|
sendonly "1s" ' Multiplikator
|
|
' keine Doppelimpulssprerre
|
|
sendonly "G"
|
|
' Doppelimpulssperrzeit
|
|
sendonly "0000S"
|
|
|
|
letzterFehlerRZ = m_Referenzzaehler.letzterFehler(m_DurchflussSoll)
|
|
If letzterFehlerRZ = -99 Then
|
|
ErrorMsg "Der Fehler des Referenzzählers konnte nicht bestimmt werden und wird als 0 angenommen. Bitte prüfen Sie, ob eine Referenzzählermessung vorliegt."
|
|
letzterFehlerRZ = 0
|
|
PrintStatus "angenommener Fehler des RZ: " & letzterFehlerRZ & " % "
|
|
Else
|
|
PrintStatus "interpolierter Fehler des RZ: " & letzterFehlerRZ & " % "
|
|
End If
|
|
|
|
' gleiche Impulswertigkeit für alle Zähler
|
|
'######################################
|
|
' Todo K Wert bestimmen
|
|
PrintStatus "mit dem Anteil korrigierte Impulswertigkeit des HZ: " & lngImpulswertigkeit * dblAnteil
|
|
m_KWert = GetKWert(lngImpulswertigkeit * dblAnteil, m_Referenzzaehler.ImpulseQM, letzterFehlerRZ)
|
|
|
|
TmpStr = ValToKString(m_KWert)
|
|
sendonly TmpStr
|
|
PrintStatus "K-Wert FM85-Befehl: " & TmpStr
|
|
End Sub
|
|
|
|
Private Sub cmdQuit_Click()
|
|
Abbruch
|
|
Unload Me
|
|
End Sub
|
|
|
|
Private Sub cmdRegulieren_Click()
|
|
Dim dblAnteil As Double
|
|
dblAnteil = 1
|
|
|
|
If Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ1)) = 0 Then
|
|
MsgBox "Bitte die Impuslwertigkeit des HZ 1 angeben"
|
|
Exit Sub
|
|
End If
|
|
|
|
If Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.RZ)) = 0 Then
|
|
MsgBox "Bitte die Impuslwertigkeit des RZ angeben"
|
|
Exit Sub
|
|
End If
|
|
|
|
If m_Referenzzaehler Is Nothing Or m_DurchflussSoll = 0 Then
|
|
MsgBox "Der Durchfluss muss zuerst gestartet werden!"
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim lngImpulswertigkeit_HZ As Long
|
|
cmdRegulieren.Enabled = False
|
|
Me.MousePointer = vbHourglass
|
|
|
|
PrintStatus "FM85 für Regulierung programmieren..."
|
|
|
|
If CDbl(MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1)) > 0 Then
|
|
dblAnteil = CDbl(MSFlexGrid1.TextMatrix(enum_zeile.Anteil, enum_spalte.HZ1))
|
|
PrintStatus "Anteil Q durch HZ: " & Format(dblAnteil, "0.00")
|
|
Else
|
|
dblAnteil = 1
|
|
End If
|
|
|
|
|
|
MSFlexGrid1.TextMatrix(enum_zeile.Fehler, enum_spalte.RZ) = m_Referenzzaehler.letzterFehler(m_DurchflussSoll)
|
|
|
|
lngImpulswertigkeit_HZ = CLng(Val(MSFlexGrid1.TextMatrix(enum_zeile.Impulswertigkeit, enum_spalte.HZ1)))
|
|
If lngImpulswertigkeit_HZ > 0 Then
|
|
Call VorbereitenFM85_fuer_Regulierung(lngImpulswertigkeit_HZ, dblAnteil)
|
|
End If
|
|
|
|
cmbDaempfung.Enabled = True
|
|
|
|
Me.MousePointer = vbNormal
|
|
|
|
cmdRegulieren.Enabled = True
|
|
cmbDaempfung.SetFocus
|
|
End Sub
|
|
|
|
Private Sub cmdSchaubild_Click()
|
|
Call g_App.getSPS().ActivateProTool
|
|
End Sub
|
|
|
|
Private Sub cmdStop_Click()
|
|
Call Abbruch
|
|
mblnAbbruch = True
|
|
m_DurchflussSoll = 0
|
|
lblQist.caption = ""
|
|
lblQist.BackColor = &H8000000F
|
|
End Sub
|
|
|
|
Private Sub Abbruch()
|
|
PrintStatus "Abbruch!"
|
|
|
|
If g_ohneSPS Then Exit Sub
|
|
|
|
m_SPS.SetQSoll 0
|
|
|
|
m_SPS.setBetrieb 0
|
|
m_SPS.WassserAblassen 0
|
|
m_SPS.SetServoStellung 50
|
|
|
|
' Alle Pumpen abwählen
|
|
m_SPS.AllePumpenAbwaehlen
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub Form_Activate()
|
|
If Not m_blnAktivated Then
|
|
' hier code der einmal nach dem Laden der Form ausgeführt werden soll
|
|
PrintStatus "Bereit"
|
|
End If
|
|
m_blnAktivated = True
|
|
End Sub
|
|
|
|
Private Sub Form_Load()
|
|
' If Not g_ohneSPS Then
|
|
Set m_SPS = g_App.getSPS
|
|
' Else
|
|
' MsgBox "Es ist keine SPS verfügbar!"
|
|
' End If
|
|
|
|
Set m_FMBus = g_App.getFMBus
|
|
Set m_ColPumpen = g_App.Settings.getPumpen
|
|
|
|
cmbDaempfung.Clear
|
|
Dim i As Integer
|
|
For i = 1 To 9
|
|
cmbDaempfung.AddItem i
|
|
Next
|
|
cmbDaempfung.ListIndex = 0
|
|
|
|
If g_ohneSPS Then
|
|
m_blnSimulation = True
|
|
End If
|
|
|
|
initFlexgrid
|
|
End Sub
|
|
|
|
|
|
|
|
Private Function PrfVorbereiten() As Boolean
|
|
Dim dummy As Long
|
|
|
|
TestAutomatik:
|
|
If m_SPS.IstAutomatik Then
|
|
dummy = MsgBox("Bitte SPS auf Automatik stellen", vbOKCancel)
|
|
If dummy = vbCancel Then
|
|
PrfVorbereiten = False
|
|
Exit Function
|
|
End If
|
|
GoTo TestAutomatik
|
|
End If
|
|
|
|
TestReferenzPrf:
|
|
If m_SPS.IstRefZPrf Then
|
|
dummy = MsgBox("Bitte SPS auf Hauptzähler Vergleichs-Prüfung stellen", vbOKCancel)
|
|
If dummy = vbCancel Then
|
|
PrfVorbereiten = False
|
|
Exit Function
|
|
End If
|
|
GoTo TestReferenzPrf
|
|
End If
|
|
|
|
TestPruefbereit:
|
|
If m_SPS.IstStreckePruefbereit_Neu Then
|
|
dummy = MsgBox("Bitte SPS auf Prüfbereitschaft einstellen", vbOKCancel)
|
|
If dummy = vbCancel Then
|
|
PrfVorbereiten = False
|
|
Exit Function
|
|
End If
|
|
GoTo TestPruefbereit
|
|
End If
|
|
|
|
PrfVorbereiten = True
|
|
End Function
|
|
|
|
Private Sub MSFlexGrid1_Click()
|
|
Dim Zeile As Long
|
|
Dim Spalte As Long
|
|
Dim strInhalt As String
|
|
|
|
Zeile = MSFlexGrid1.row
|
|
Spalte = MSFlexGrid1.col
|
|
|
|
strInhalt = MSFlexGrid1.text
|
|
|
|
strInhalt = InputBox("alter Wert = " & strInhalt, "Bitte geben Sie einen neuen Zellenwert ein.", strInhalt)
|
|
If strInhalt <> "" Then
|
|
MSFlexGrid1.text = strInhalt
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub txtQSoll_KeyPress(KeyAscii As Integer)
|
|
' nur numerische Werte mit Komma zulassen
|
|
Select Case KeyAscii
|
|
Case 48, 49, 50, 51, 52, 53, 54, 55, 56, 57
|
|
Case 44
|
|
If InStr(1, txtQSoll, ",") > 0 Then
|
|
KeyAscii = 0
|
|
End If
|
|
Case 46
|
|
If InStr(1, txtQSoll, ",") > 0 Then
|
|
KeyAscii = 0
|
|
Else
|
|
KeyAscii = 44
|
|
End If
|
|
Case 3, 22, 24, 8
|
|
' cut copy Paste Backspace
|
|
Case Else
|
|
KeyAscii = 0
|
|
End Select
|
|
End Sub
|
|
|
|
|