Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Wait for Some time before getting Same Event Notification

More
01 Oct 2014 06:23 #2361 by support
Thank you for the explanation.

This is more a question of a general programming nature, not directly having to do with OPC or QuickOPC. You clearly should not unsubscribe from OPC events just because you want to delay a display of them for some time. I think that the best solution is separate the two things (the data in the grid from the data about the events themselves). You can create a data structure that will hold the data about the events that had arrived.

When an OPC event notification arrives, and it denotes a transition to an active state, you will store this information in your data structure, AND you will start a 10-second timer (using something like msdn.microsoft.com/en-us/library/system.timers.timer(v=vs.110).aspx , or similar class).

When this timer elapses, you will check the data structure, and if the event is still there, you would display in in the grid.

When an OPC notification arrives and it denotes a transition to an inactive state, you would remove the event from your data structure, and cancel the timer and/or remove the event from the grid, depending on whether it has already been displayed, or whether it is just in its "delayed, waiting" state.

What do you think?

Please Log in or Create an account to join the conversation.

More
30 Sep 2014 09:25 #2359 by pankaj
"the event is still in Active state for certain duration", that is exactly what I am looking for

To be more precise and clear...
We are developing an application, where we are listening to some vibrations values and if vibration level is 0, then only record those entries in the DataGridView. I have completed till this point and successfully entered in DataGridView

However my requirement is that I don't want to record in Grid straightaway, if that vibration values remains 0 for certain duration (10 seconds in this case), then only insert that entry.

How can i achieve this task in efficient manner ?

Please Log in or Create an account to join the conversation.

More
26 Sep 2014 20:21 #2346 by support
I will try to help, but currently I am unsure about the requirements.

What precisely, in your requirements, is "the same event" - i.e. which properties of the event must be same, and which can be different? Because, for example, the time will probably always differ.

Second, are we talking about Condition events, right? If so, these events are sent when the condition state changes (such as, for example, from inactive to active, or then to acknowledged etc.). They are not sent when the condition state remains the same - and therefore, two "same" events cannot follow each other. Please comment. Maybe you are trying to determine whether, for example, the event is still in Active state for certain duration (10 seconds?)

Best regards

Please Log in or Create an account to join the conversation.

More
26 Sep 2014 09:18 - 26 Sep 2014 20:11 #2345 by pankaj
PS: I guess I have posted in the wrong forum, I don't know how to move this question to "OPC-ALARM-EVENTS" Forum, Can any moderator please move it over there.

Hi,
In one of my projects, I have to keep a track of all active events in a DataGrid,
The catch here is if the same event happens after lets say 10 seconds again,then only display in the Grid
here is my Source Code...
    private readonly DataTable _alarms = new DataTable("Alarms");
    private int _handle;
 
    public AlarmControl()
    {
        InitializeComponent();
        _dataGridView.DataSource = _alarms;
     }
 
     private void AlarmControl_Load(object sender, EventArgs e)
     {
         easyAEClient1.Notification += OnNotification;
         _handle = easyAEClient1.SubscribeEvents("", "MyServerName", 100);
     }
 
 
     private void RefreshBtn_Click(object sender, EventArgs e)
     {
         _alarms.Rows.Clear();
        easyAEClient1.RefreshEventSubscription(_handle);
      }
 
     private void ExitBtn_Click(object sender, EventArgs e)
     {
         easyAEClient1.UnsubscribeAllEvents();
     }
 
 
     private void OnNotification(object sender, EasyAENotificationEventArgs args)
     {
        if (args.Exception != null || args.Event == null)
            return;
 
        if(args.Event.Active) 
        {
            var row = _alarms.NewRow();
            row["Time"] = args.Event.Time;
            row["Active"] = args.Event.Active;
            row["Condition"] = args.Event.ConditionName;
            row["Severity"] = args.Event.Severity;
           row["Message"] = args.Event.Message;
 
     // Here I want a 10 seconds Timer and check if the same Event Still exists,only then Insert in DataGrid
           _alarms.Rows.InsertAt(row,0);
        }
     }
One way I can think is the moment I get this Event Notification, unsubscribe from the event and after 10 seconds call RefreshEventSubscription , if I get same Event Notification, then only add to my Grid.

However I am not sure if this the best way to achieve my requirement, What could be the the best way to achieve it?
Last edit: 26 Sep 2014 20:11 by support. Reason: code formatting

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.048 seconds