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.

GetConditionState and AcknowledgeCondition

More
27 Feb 2019 17:10 #7145 by admin
Thank you for the project.
I could not find anything wrong with the code, in principle.

I assume that, when pressing the button for Acknowledge, the first condition in the list has not yet *again* transitioned into the active state again? Please confirm - because in the opposite case, the exception you are getting would be legitimate.

Here is something that might also be related to the issue:

The active time for acknowledgement must be a precise match in OPC A&E. This spec is, as you known, COM based, and the dates/times are expressed using the Windows FILETIME data type. For use in .NET, the FILETIME gets converted to/from a System.DateTime type. The problem is that the precision of DateTime is slightly less than that of FILETIME. This means that when the alarms's active time makes its way as DateTime to .NET and then back through the Acknowledge method, it may be slightly off - which would cause the OPC server to reject it with the error message you are seeing.

HOWEVER, QuickOPC has a special measurements to prevent this from happening. It observes the event active times, and assures that the conversion roundtrip is precise. So, if things works as designed, the problem is circumvented. We have tested this approach, and I believe that the tests included KepServerEX as well. But o ne never knows... I am writing this to explain that alarm active times are "risky" area.

Do you perhaps have a KepServerEX simulated configuration with which this issue can be reproduced?

Regards

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

More
27 Feb 2019 13:50 #7143 by Barrette
Hello,

Thank you for our help,

I joint a printscreen of the exception and a zip file of the project.

There a 3 butons,

The first to create client.
The secont to subscrite.
the tird to ascknolege first AE received.

Thank you very mutch a have a nice day.
Attachments:

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

More
27 Feb 2019 06:43 #7139 by admin
Thank you for the answers.

I think that the use of GetConditionState distracts from the actual problem, and it has issues of its own. First of all, it is not a recommended approach, because there is always a delay between the event time and this call, and the condition may change in between. Second, in your case, it is clear that not only the quality, but also other properties returned by GetConditionState are not valid - including the dates/times. I do not know why that is so, but your input parameters might be wrong. I suspect the FindSourceNodeDescriptor - code is not provided, and it is not clear what is meant to do, because the QualifiedSourceName already contains a usable source ID that can directly be used as node descriptor for the purpose of acknowledgement or getting the condition state.

Let's go back to the case when GetConditionState was not used. I am missing how the code looked like back then. Please send that over.

Best regards
The following user(s) said Thank You: Barrette

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

More
26 Feb 2019 18:14 #7136 by Barrette
Q1:
My OPC Server is a KepeWare :
string adressIp = "localhost";
string opcSrv = "Kepware.KEPServerEX_AE.V6"

Q2:

First time, I try to use "e.EventData.ActiveTime". This value generate an exception in _easyAEClient1.AcknowledgeCondition(...).

The second time I try to get ActiveTime by call GetConditionState(). But there are "conditionState.Quality.IsBad == true"

Q3:

I attach a image of visual Studio Watch 1window.
there are some values. :

conditionState.AcknowledgeTime {1/1/1601 12:00:00 AM}
conditionState.AcknowledgeTimeLocal {12/31/1600 7:00:00 PM}
conditionState.Acknowledged true
conditionState.Active false
conditionState.ActiveTime {1/1/1601 12:00:00 AM}
conditionState.ActiveTimeLocal {12/31/1600 7:00:00 PM}
conditionState.Enabled true
conditionState.Quality.IsBad true
Attachments:

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

More
26 Feb 2019 16:29 #7135 by admin
Hello,
before I answer, can you please provide more details?

1. Which OPC server are you connecting to?
2. You mentioned that you use "e.EventData.ActiveTime". But that's in the code snippet you have provided. Please clarify. Is it that "e.EventData.ActiveTime" was the first thing you have tried, and it was giving the same error?
3. Have you inspected/displayed the times from e.EventData.ActiveTime and GetConditionState? Do they look reasonable, or are they, for example, equal to DateTime.MinValue or some other special value?

Thank you
The following user(s) said Thank You: Barrette

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

More
26 Feb 2019 13:35 - 26 Feb 2019 15:25 #7134 by Barrette
Hello,

My goal is a send to an Acknowledge to an OPC Server when I receive a notification (A&E).

When I call "_easyAEClient.AcknowledgeCondition", there are this exception:

Exception.InnerException.Message == "The time does not match the latest active time. "

I use the Active time of the class "AEEventData" (e.EventData.ActiveTime)

But, i try to obtain the Active time by call "easyAEClient.GetConditionState()". This method return always a bad data:

conditionState.Quality.IsBad == true

Please, can you help me ?

Best regards

this is my Code:
public void AcknowledgeAlarm(AEEventData e)
        {
            if (e.AcknowledgeRequired && e.Active)
            {
                // ok
                AENodeDescriptor nodeSrc = FindSourceNodeDescriptor(e.QualifiedSourceName);
                //
                // e.QualifiedSourceName == "_CustomAlarms.test.Simulation Examples_Functions_Ramp1"
                // nodeSrc.NodeId              == "_CustomAlarms.test.Simulation Examples_Functions_Ramp1"
 
                // 
                var conditionState = _easyAEClient1.GetConditionState(_descriptor, nodeSrc, e.ConditionName);
                // conditionState:
                // 
                // nconditionState.Quality.IsBad == true
 
                conditionState = _easyAEClient1.GetConditionState(_ip,_opcServer, e.QualifiedSourceName, e.ConditionName);
                // conditionState:
                // 
                // conditionState.Quality.IsBad == true
 
                _easyAEClient1.AcknowledgeCondition(_descriptor, nodeSrc, e.ConditionName, e.ActiveTime, e.Cookie);
                // Exception:
                //
                // Exception.InnerException.Message == "The time does not match the latest active time. "
 
            }
Last edit: 26 Feb 2019 15:25 by admin.

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

Moderators: support
Time to create page: 0.053 seconds