Accessing OPC A&E driver’s events individually.

The EventBlock tag is a read-only, 18-element tag that returns a data block for each alarm or event received by the driver. Each read in this tag can return anything from 0 (zero) to “n” events. Events can be accessed individually by the application via OnRead event

Accessing the events requires no specific method, you will only need to link the desired elements to a historic, for example, and run WriteRecord method in the block’s OnRead event. In the historic, each element must be linked to a field, according to their datatype.

Example of script:

Sub EventBlock_OnRead()
Application.GetObject(“Hist1”).WriteRecord()    
End Sub

Depending on the number of points to be monitored, another alternative is to write a script in EventBlock tag’s OnRead event to check the status of each point individually. Each item to be monitored will need an internal tag, which can later be added to a digital alarm or just be visualized on screen.

Example of script monitoring whether the alarm is in or out in item Point_072:

Sub EventBlock_OnRead()
Set Source = Item(“Source”)
Set Message = Item(“Message”)
Set Point_072 = Application.GetObject(“Dados.Point_072”) ‘Internal Tag

 If Source.Value = “gv.Area_001.Point_072” And Message.Value = “2503” Then
 Point_072.Value = true
 Elseif Source.Value = “gv.Area_001.Point_072” And Message.Value = “6064” Then
 Point_072.Value = false
 End if

End Sub

In this example, the Message block element informs the alarm’s status (in/out) according to yhe code being displayed.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *