Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

HowTo: Display a text window depending on the value changes

$
0
0

Hello,

My name is Paul and I can't speak English well so I'm using the translator, Sorry, this strange explanation

 

I want to build some features in Processbook by using VB code.

 

 In Processbook I use several tags from the PLC, HMI system that are defined in PI as 'Values'.

 

What I want is:
There is a tag called Value76 to indicate the equipment state. The value of 1 - 3 will change depending on the state of the equipment.

 

When changes to a value of 1, "Any Faults" text window that says it disappear but floats 30 seconds, and the text window that says

 

"Ready" is changed to a value of 2 is floating for 30 seconds and disappear, and change in value of 3 and I think it is disappear floating

 

text window 30 seconds that says "Operation".
 

I created a text window, Normally it is hidden in Invisible state, would like to be seen if Value is changed.

 

below is the code  what I want a similar action in other departments using. I'm not sure below code is correct

 

Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

Private Const SND_APPLICATION = &H80 ' look for application specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Private Const SND_SYNC = &H0 ' play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Public prestep1 As Integer
Public prestep2 As Integer
Private AlarmAck(0 To 50) As Integer

------------------------------------------------------------------------------------

 

'Private Sub Value76_DataUpdate()
If prestep2 < Value76.GetValue(Time, 1) Then
Text47.Contents = "Unit2 " & "Step Changed"
Text47.Visible = True
prestep2 = Value76.GetValue(Time, 1)

For i = 0 To 50
AlarmAck(0) = 0
Nexti
End If
End Sub

 

 

'Private Sub Value77_DataUpdate()
If prestep1 < Value77.GetValue(Time, 1) Then
Text48.Contents = "Unit1 " & Value77.GetValue(Time, 1) & "Step Changed"
Text48.Visible = True
prestep1 = Value77.GetValue(Time, 1)

For i = 0 To 50
AlarmAck(0) = 0
Next i
End If
End Sub

 

 

Is this possible?  Could someone please explain how to do this?
 
With Friendly Regards,

 

Paul


Viewing all articles
Browse latest Browse all 1120

Trending Articles