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.

Subscribing to a non-existent item

More
08 Jul 2021 09:27 #9952 by lamar
This VCL Forms App example was intended for demonstrating that in some cases
pulling of a fake item can bypass EventArgs.Succeeded testing.

The freezing is is in a DLL (another app) when used with Matrikon
with a fake item that bypasses EventArgs.Succeeded.

Thank you for your valuable updated note on 08 Jul 2021 07:54.
The returned empty string(?) causes the freezing in my DLL.
I tried testing If EventArgs.VTQ.Value <> '' Then ...
I tried testing If EventArgs.VTQ.Value <> null Then ...
Both if them also fail.
Maybe any kind of touching EventArgs.VTQ.Value will cause freezing.
Do you have any ideas how to grab the empty value?

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

More
08 Jul 2021 08:21 #9950 by support
Hello.
I am not sure if you have sent me the right code.

When I run your program, I get this form:



with the values in the uppermost edit box quickly changing.

This, in my understanding, *is* the expected behavior with the code in the program, which looks like this (shortened):

procedure TForm1.FormCreate(Sender: TObject);
begin
  OPCDAClient := CoEasyDAClient.Create ;
  OPCDAClient.PullItemChangedQueueCapacity := 1000 ;
  OPCDAClient.SubscribeItem('', 'Matrikon.OPC.Simulation.1', 'Random.UInt1', 50) ;
  OPCDAClient.SubscribeItem('', 'Matrikon.OPC.Simulation.1', 'SomeUnknownItem', 50) ;
  OPCDAClient.SubscribeItem('', 'Matrikon.OPC.Simulation.1', 'Bucket Brigade.UIntqa', 50) ;
end;
 
procedure TForm1.Timer1Timer(Sender: TObject);
Var i : Integer ;
  EventArgs: _EasyDAItemChangedEventArgs ;
Begin
  Repeat
    EventArgs := OPCDAClient.PullItemChanged(5) ;
    If EventArgs <> nil Then
      If EventArgs.Succeeded Then
        If EventArgs.VTQ.HasValue and EventArgs.VTQ.Quality.IsGood Then
        Begin
          If EventArgs.Arguments.ItemDescriptor.ItemId = 'Random.UInt1' Then
            Edit1.text := EventArgs.VTQ.Value ;
          If EventArgs.Arguments.ItemDescriptor.ItemId = 'SomeUnknownItem' Then
            Edit2.text := 'Edit2 text changed unexpectedly'  ;
          If EventArgs.Arguments.ItemDescriptor.ItemId = 'Bucket Brigade.UIntqa' Then
            Edit3.text := 'Edit3 text changed unexpectedly' ;
        End;
  Until EventArgs = nil ;
End;

Edit1 is changing because the server sends no errors, good quality Byte-typed updates for the 'Random.UInt1' item.
Edit2 keeps its original text because the server returns an error for this item, EventArgs.Succeeded is false, and the "if" statements do not thus make any update.
Edit3 changes to 'Edit3 text changed unexpectedly', because (I have mentioned in my previous post), the server sends a string value for this item, although it is not configured.

I do not see any signs of the problem you reported, i.e. that the program blocks somewhere, or stops. But, this is not the same code you had included with that report.

Regards
Attachments:

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

More
08 Jul 2021 07:54 - 08 Jul 2021 08:02 #9949 by support
I have not yet run your code, but I have explored how Matrikon Simulation Server behaves with regard to the known/unknown items you listed.

Apparently (and in line with what you yourself has observed), an error is returned for *some* unknown items ("SomeUnknownItem"), but no error and a bad quality for others ("Bucket Brigade.UIntqa"). This explains why in your test, the flow proceeded past the Exception/Succeeded test with the "Bucket Brigade.UIntqa". But it does not explain the behavior after that. I will continue the investigation.

As a side note, I am seeing some weird non-standard behaviors in items I have looked at (under "Bucket Brigade"). The behavior might be good for testing the code resiliency, but probably not so good for testing how things would *normally* work, with real OPC servers and items.

Best regards

*EDITED*: Later on, the same item "Bucket Brigade.UIntqa" now returns a "Good" quality with an (empty?) string value. Go figure.
Attachments:
Last edit: 08 Jul 2021 08:02 by support.

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

More
07 Jul 2021 19:52 #9948 by lamar
Here is the prepared app

File Attachment:

File Name: ReadAndDis...lue3.zip
File Size:844 KB
Attachments:

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

More
07 Jul 2021 19:47 #9947 by support
Actually, now knowing which server and item you are using, you may defer the preparation of your code. Let me check the server behavior on my side first, maybe that will lead us somewhere already. Give me some time too, though...

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

More
07 Jul 2021 19:22 #9946 by lamar
OK. As my code is in a DLL I will prepare a VCL Forms App code. This will take a while.
By the way, I got closer to the issue.

When I subscribe to the fake item "SomeUnknownItem" --- it does NOT fail.
When I subscribe to the fake item "Bucket Brigade.UIntqa" --- it DOES fail.

"Bucket Brigade.UIntqa" is very similar to the existing items
"Bucket Brigade.UInt1"
"Bucket Brigade.UInt2"
"Bucket Brigade.UInt4"

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

More
07 Jul 2021 19:03 #9945 by support
I believe I can get the installer and make the install. No need for that at the moment.

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

More
07 Jul 2021 19:01 #9944 by lamar
Do you need the Matrikon installer, Or do you just want to know hoe I use it?
I use it with default settings, with the predefined default tags.

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

More
07 Jul 2021 18:59 #9943 by support
If you give me the full code, and the Matrikon server configuration (if any is needed), I might be able to tell you more.

Best regards

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

More
07 Jul 2021 18:33 #9942 by lamar
That's true, I have missed the fourth item. This is psychology.
Haman mind often fails with distinguishing between slightly modified repeated patterns.

But believe in me, I truly focused on your event handling code, and, since I do not write
a console application, I tried to adapt it as much as I can.

"If the item was truly non-existent, I would expect your code to only show the message "1 ...", but not 2 to 6."

Seems you are right. I tested it with your simulation server, and the fake item did not cause any problems.
I made the prior test with Matrikon OPC Simulation server. This test passes 1 to 5 even at a non-existent-item.
Very strange...

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

Moderators: support
Time to create page: 0.077 seconds