FTV SE - Open Display by Event - Help Please

Public WithEvents PlcTags As TagGroup

Dim Sample1Req As Tag

Public Sub Display_AnimationStart()
Dim TagsInError As StringList
If PlcTags Is Nothing Then
Set PlcTags = Application.CreateTagGroup(Me.AreaName, 500)
Set Sample1Req = PlcTags.Add("heater_off_alarm")

PlcTags.Active = True
PlcTags.RefreshFromSource TagsInError
End If

End Sub


Private Sub EventTriggerTags_Change(ByVal TagNames As IGOMStringList)

On Error GoTo errHandler

If Sample1Req.Value = 1 Then
ShowDisplay ("Heating off")
End If


ErrHandler:
LogDiagnosticsMessage Err.Description, FTDiagSeverityError

End Sub
 
Please tell me what is wrong in the above code. I am totally naive in VBA linkage to FT view SE. I am using FT View SE v8.0. This is my very much first project on AB.

If the above code is write, then what i have to do extra to make it properly working.

Please Please tell me very clearly...I'll be highly thankful to you.
 
Can you compile the code successfully? What errors are you getting when the code runs? Have you checked your diagnostics viewer for errors?

Note that Set Sample1Req = PlcTags.Add("heater_off_alarm") does not get the PLC tag "heater_off_alarm", it only gets the HMI tag "heater_off_alarm". In my case I had created a HMI tag, which was linked to the PLC tag. If that HMI tag is in a folder, you will also need to include that, e.g. "HeaterTags\Heater_Off_Alarm"
 
I can compile the code without any error.
When i compile it, my display opens in test mode.
That is my HMI tag connected to a particular PLC tag without any folder so that is OK.

But in run time its not opening when the tag gets high in PLC.
 
Three things:

1. Try out the code in the development environment, see if you can make it work there first (i.e. press test display in FTView Studio). It won't actually pop up the window, but you should get an error in your status bar saying something along the lines of "Display command is ignored from the development environment". Once you get that far, you'll know your code is good.

2. If the VBA code encounters an error and doesn't have error handling, it will halt and will not restart until the SE application is shut down and opened again. In your code above, Private Sub EventTriggerTags_Change has error handling, but Public WithEvents PlcTags As TagGroup does not. Perhaps restart the client to ensure that it's executing the VBA code

3. Once you've rebooted, trigger the tag in the PLC, and then go and look through your diagnostics list for any events between when you restarted the application and after you triggered the alarm tag. The diagnostics list will hopefully at least give you an idea of what is happening when that tag is triggered.
 
THe above code is working very much fine, it is not giving me any error.

But i am trying to ask Sir is: I have written this code in VBA display of that "Heating off screen" only.

I have to trigger any event or anything else to keep cached as u said above in the thread, VBA code only run when u press a buttob, they are not cyclic.
 
????I can't make a display Exposed to VBA.????


When i execute this code from VBA triangle button, it bring me back to FT View Screens with Test mode running and without any error in the below status bar.
 
sachincool786 said:
I have to trigger any event or anything else to keep cached as u said above in the thread, VBA code only run when u press a buttob, they are not cyclic.

You are correct. The first part of the code needs to run ONCE ONLY at the startup of the SE application to set up the tags. So you would attach this code to the "before animation start" of a SCADA display that is loaded at startup. Then the second piece of code is triggered whenever there is a change in one of the tags. So that takes care of the trigger, you don't need to press a button or anything to make it work.

sachincool786 said:
But i am trying to ask Sir is: I have written this code in VBA display of that "Heating off screen" only.

That will not work. VBA code associated with a screen only executes if the screen is open. There a few different approaches to make this work - in my application I always have a navigation bar across the bottom of the screen. This display never goes away, so all my VBA code that needs to be continuously active is programmed in this display. Another way is to have a display that is opened at startup and can never be replaced, and positioned off screen so the operator can't see it.
 
No I can't, it's the full SCADA application for an entire factory, I am not at liberty to post it online.
 
Plz there would be any way by which u can send me the backup.
I mean that part only.

Ok, atleast attach the screenshots here of that particular part:
And explain a little bit with the pics.

That would be highly appreciable.
 
Last edited:
Even if I could, the application is enormous and would make even less sense to you. I have already gone to the effort of extracting just the parts relevant to what you (and the OP) are trying to do.

Follow the advice above and report back with your results. I can't and won't do the job for you.
 
OK...
Lemme tell u my condition :
I have a Alarm banner screen on the down of every screen(/DB)... I've put a numerical display (not visible to runtime)

Now on that numerical display i have written this code, whenever i test it, I get this error (pics attached)
Please lemme know where i am wrong.



 
Last edited:
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 NumericDisplay1_change()
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


THis one is finally working, but its showing pop up again and again without checking PLC tag (Tag is low, even then pop up is displaying).

Please tell me what is wrong now
 
Good work, you're getting close. Take a look at what's triggering your second section of code.

"Private Sub NumericDisplay1_change()"

So basically, whenever NumericDisplay1 changes, the code will be executed.

You need to trigger it when your tag changes state.

In post #16 of this thread, you declared:
"Public WithEvents PlcTags As TagGroup"
and then had another sub:
"Private Sub EventTriggerTags_Change(ByVal TagNames As IGOMStringList)"

The first declaration sets up a Tag Group called "PlcTags", and monitors them for changes.

But then your sub is looking for a Tag Group called "EventTriggerTags" to change; when it does then it will execute the code below. That will never happen though, because you never set up a Tag Group called "EventTriggerTags".

You will need to set up the tag group and add the tag in the BeforeAnimationStart section though, because you can't monitor a tag for a change in value if you haven't told the VBA which tag to look at first.
 

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,538
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