FTV SE - Open Display by Event - Help Please

Ohkk...Should it be like this

Public WithEvents oGroup As TagGroup

Private Sub Display_BeforeAnimationStart()
On Error Resume Next
Err.Clear
If oGroup Is Nothing Then
Set oGroup = Application.CreateTagGroup(Me.AreaName, 500)
If Err.Number Then
LogDiagnosticsMessage "Error creating TagGroup. Error: " _
& Err.Description, ftDiagSeverityError

Exit Sub
End If
oGroup.Add "System\Second"
oGroup.Add "System\Minute"
oGroup.Add "Heating_Auto_OFF_SCADA"
oGroup.Active = True
End If

End Sub

Private Sub EventTriggerTags_Change(ByVal TagNames As IGOMStringList)
On Error Resume Next
Dim oTag As Tag
If Not oGroup Is Nothing Then
Set oTag = oGroup.Item("Heating_Auto_OFF_SCADA")
Err.Clear
End If
If oTag.Value = 1 Then
ShowDisplay ("Heating_Off")
End If
End Sub
 
Not quite, but you're getting the hang of it. I'll make a few comments below with the <<<symbol

Code:
Public WithEvents oGroup As TagGroup  <<<sets up a TagGroup called "oGroup"

Private Sub Display_BeforeAnimationStart()  <<<will do the following before startup of display:
On Error Resume Next
Err.Clear
If oGroup Is Nothing Then
Set oGroup = Application.CreateTagGroup(Me.AreaName, 500) <<<create space for tags
If Err.Number Then
LogDiagnosticsMessage "Error creating TagGroup. Error: " _
& Err.Description, ftDiagSeverityError

...
...

oGroup.Add "System\Second" <<<adds the System Second tag to your group
oGroup.Add "System\Minute"  <<<adds the System Minute tag to your group
oGroup.Add "Heating_Auto_OFF_SCADA" <<<adds your heater tag to your group
oGroup.Active = True
So that's all good and correct as far as I can tell.

But then you again need to trigger your next sub based on a change in the tag group you defined: oGroup. Currently the sub is triggered by a change in the tag group EventTriggerTags, which you did not create.

You do not need to define your tags again in the second sub, they're already defined in the previous Public sub.

You also do not really need to add the system second and minute tags into your tag group - all that will do is make the second sub execute whenever the second or minute changes (i.e. once every second). But you don't need to do that; you only need to run the second sub when your alarm tag changes.

The only other thing to make sure of, as we've discussed before, is that all of this code is attached to the same display, and that this display is started when your SE application starts and is always updating (even if it's off screen and out of sight).
 
Also check out my Post #8 in this thread, and look at the RefreshFromSource instruction. That will be required; you will also have to define TagsInError as a String List (as I have done in that post)
 
That Display is in startup, but its not refreshing all the time. How can i make it updatng all the time???

I thought if once it would be called it would check my that loop : numerical change , thats y i put numerical change in it.

It means The VBA code runs only once when display is called???
M i right???

How can i make display updatng all the time???


I think this one is ok as per u sayings :

Public WithEvents oGroup As TagGroup

Private Sub Display_BeforeAnimationStart()
Dim TagsInError As StringList
On Error Resume Next
Err.Clear
If oGroup Is Nothing Then
Set oGroup = Application.CreateTagGroup(Me.AreaName, 500)
If Err.Number Then
LogDiagnosticsMessage "Error creating TagGroup. Error: " _
& Err.Description, ftDiagSeverityError

Exit Sub
End If
oGroup.Add "Heating_Auto_OFF_SCADA"
oGroup.Active = True
oGroup.RefreshFromSource TagsInError
End If

End Sub

Private Sub oGroup_Change(ByVal TagNames As IGOMStringList)
On Error Resume Next
Dim oTag As Tag
If Not oGroup Is Nothing Then
Set oTag = oGroup.Item("Heating_Auto_OFF_SCADA")
Err.Clear
End If
If oTag.Value = 1 Then
ShowDisplay ("Heating_Off")
End If
End Sub
 
There would be probem with the understanding of mine Sir,

Actually you have much experience in this and i am naive in this. this is my very first project in FT View or even in VBA.

I think all the new guys like me come here to get help from you guys!!!

SO please tell me like you are telling a very new guy.

Can you send me the manual of these instruction VBA related to FT View. I am not able to find them on the net.

By the way that Display is my ALarm Banner DIsply. i think its updating all the time, M i wrong???
 
That looks good, I think you're almost there.

That Display is in startup, but its not refreshing all the time. How can i make it updatng all the time???

See my attached image: if you go to the display properties and check "Always Updating", then once you open the display it will always update in the background, even if it is not visible.

I thought if once it would be called it would check my that loop : numerical change , thats y i put numerical change in it.

It means The VBA code runs only once when display is called???
M i right???

The first line of each sub determines how/when it runs. Right at the top is you "general declarations" - these are run once when the VBA starts, and just basically create the items you need for the rest of the VBA code.

The next one - "Private Sub Display_BeforeAnimationStart()" tells you that this sub will execute once, before the display animation starts. So again, this will only happen once, when the display starts. In here, you create all your tags and tag groups - this only needs to happen once, once they're created you don't need to create them again.

The final one - "Private Sub oGroup_Change(ByVal TagNames As IGOMStringList)" tells you that this sub will execute every time one of the tags in tag group oGroup changes state. This is where you have put your code to check if the alarm is active, and pop up a screen if so.

I think this one is ok as per u sayings :

Public WithEvents oGroup As TagGroup

Private Sub Display_BeforeAnimationStart()
Dim TagsInError As StringList
On Error Resume Next
Err.Clear
If oGroup Is Nothing Then
Set oGroup = Application.CreateTagGroup(Me.AreaName, 500)
If Err.Number Then
LogDiagnosticsMessage "Error creating TagGroup. Error: " _
& Err.Description, ftDiagSeverityError

Exit Sub
End If
oGroup.Add "Heating_Auto_OFF_SCADA"
oGroup.Active = True
oGroup.RefreshFromSource TagsInError
End If

End Sub

Private Sub oGroup_Change(ByVal TagNames As IGOMStringList)
On Error Resume Next
Dim oTag As Tag
If Not oGroup Is Nothing Then
Set oTag = oGroup.Item("Heating_Auto_OFF_SCADA")
Err.Clear
End If
If oTag.Value = 1 Then
ShowDisplay ("Heating_Off")
End If
End Sub

Close - two more points to make.

1. Private Sub Display_BeforeAnimationStart() needs to be Public Sub Display_BeforeAnimationStart(). If the sub is private, the tags you create in that sub cannot be used in any other subs, including your Private Sub oGroup_Change sub

2. Creating a tag in the oGroup_Change sub and linking it to the original tag is redundant. You can directly address the original tag in this sub (provided you have made the previous sub Public.

I do not have any instruction manuals for VBA and FTView; there is a section on VBA in the FactoryTalk View SE manual, which you should be able to find easily with google. But beyond that I have just used trial and error and practice to learn VBA.
 
Finally here is my working code :


Public WithEvents oGroup As TagGroup

Public Sub Display_AnimationStart()
Dim TagsInError As StringList
On Error Resume Next
Err.Clear
If oGroup Is Nothing Then
Set oGroup = Application.CreateTagGroup(Me.AreaName, 500)
If Err.Number Then
LogDiagnosticsMessage "Error creating TagGroup. Error: " _
& Err.Description, ftDiagSeverityError
Exit Sub
End If
oGroup.Add "Heating_Auto_OFF_SCADA"
oGroup.Add "stack_Glass_R2_Alarm_SCADA"
oGroup.Active = True
oGroup.RefreshFromSource TagsInError
End If
End Sub


Private Sub oGroup_Change(ByVal TagNames As IGOMStringList)
On Error Resume Next
Dim oTag1 As Tag
Dim oTag2 As Tag
If Not oGroup Is Nothing Then
Set oTag1 = oGroup.Item("Heating_Auto_OFF_SCADA")
Set oTag2 = oGroup.Item("stack_Glass_R2_Alarm_SCADA")
Err.Clear
End If
If oTag1.Value = 1 Then
ShowDisplay ("Heating_Off")
End If
If oTag2.Value = 1 Then
ShowDisplay ("R2_Alarm")
End If

End Sub



All thanks to ASF, without his help i could not be able to do it or even understand it.

It is really as great learnig...

Again I am really thankful to ASF Sir
 
Last edited:
Dear ASF Sir: This code is working very much fine, but there is one problem, whenever my scada lose communication with the PLC its shows all the pop up windows...Have u encountered any problem like this???

 
Last edited:

Similar Topics

I have a bunch of devices on my displays that are the same. I have build a global object for them and is working great. I want to place a button...
Replies
2
Views
1,956
Hey, folks. Thanks for reading this. I created an HMI program in FTV ME v. 10.00 a few months back and I was just getting ready to go to the plant...
Replies
2
Views
1,470
I added a built in OCX and while it works it gives the warning every time What setting do I need to change to not get that warning Thanks
Replies
0
Views
1,537
Hello everyone, I am currently working on a project that uses a Rockwell L33ER controller and the FTV Studio V13 as Supervisory computer...
Replies
0
Views
135
Hello everyone, I am working in a platform and we installed FTV CLIENT SE V 12 IN ALL THE CLIENTS COMPUTERS, we have 6 clients and only 1 is not...
Replies
0
Views
107
Back
Top Bottom