Professional OPC
Development Tools

logos

"SubscribeDataChange" using the read function

More
17 Jan 2020 12:57 #8151 by Moien
I am using windows 10 version, Delphi 10.2, .NET FrameWork 4.7. on the developement computer. Moreover, I use QuickOPC 2019.1.
On the server side we have dataFEED Suite 4.60, windows 7, .NET 4.7.2.

In my previous post, I meant that I see you have a class for reading the variable on the OPC UA Server. Probabely, you make an instance of this class somewhere else and call this class. My question is if you are doing some kind of initialization or something like that before making the instance of this class?

We used Prosys UA Client Tool and we activated the "monitor read" option and your test program for reading just one variable (Local Items.EAK_Test1.EAK_Testwert1_I4) was running in parallel (at the same time with your test program). Then we got the current values every second (which means after activating the "monitor read" by Prosys). Isn't there any kind of internal function in background for the OPCLabs "read function" that initialize the UA Server?

Best regards,
Moien

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

More
17 Jan 2020 12:23 #8150 by support
Hello,

that's very weird that you get a behavior that differs from mine. On my part, I used basically "empty table": A virtual machine snapshot that has just clean installation of Windows, Delphi, and .NET Framework. And added QuickOPC 2019.2 from the official installation package, and same for Softing dataFEED.

Can you somehow identify the precise version of Softing dataFEED that you have installed?

Regarding your last question: I am not sure if I fully understand it, but if you are asking about the somewhat unusual header of the source code, then it is because I have used the structure of our UADocExample project, and added a new example, and this (with "class procedure") is how it then must look like. But that has no significance to this issue, and there are no other "preparation" actions with regard to EasyUAClient. The UADocExample code (which you have as part of QuickOPC installation as well) just shows a menu on the console and allows the user to pick the right example.

Best regards

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

More
17 Jan 2020 10:25 #8145 by Moien
Hi again,

This is the class code, right? Do you use some kind of initialization or trigger where the procedure ReadValue is called?

Best regards,
Moien

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

More
17 Jan 2020 08:45 #8144 by Moien
Thanks for installing Softing dataFEED and sending your code.

I just copied and pasted your code and ran in on my computer. I just get the first value of the EAK_Testwert1_I4 and the value is not getting updated.
As soon as I use "client.SubscribeDataChange(EndpointDescriptorUrlString, NodeIdExpandedText,1000);", it starts delievering current values.

Do you have any idea where the problem is?

Best regards,
Moien

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

More
17 Jan 2020 08:05 #8143 by support
Hello,
the first part of your post was about Node Ids in the Softing .NET Demo OPC UA Server, you wrote it yourself, and that it what I was replying to.

To the second part of your email: I have set up the Softing dataFEED as you suggested, and tested the scenario you described (repeatedly reading an incrementing variable). It works fine for me. I used a simple VBScript to feed in the incrementing values (it is attached to this post). It increments the variable every 2 seconds and outputs what it has done, e.g.:
@11:57:51 PM: Writing 13
@11:57:53 PM: Writing 14
@11:57:55 PM: Writing 15
@11:57:57 PM: Writing 16
@11:57:59 PM: Writing 17
@11:58:01 PM: Writing 18
@11:58:03 PM: Writing 19
@11:58:05 PM: Writing 20
@11:58:07 PM: Writing 21

I then have a Delphi program that reads the variable and shows its value, once per second. Here it is:
// This example shows how to repeatedly read value of a single node, and display it.
 
class procedure ReadValue.Repeated;
const
//  EndpointDescriptorUrlString = 'http://opcua.demo-this.com:51211/UA/SampleServer'; // or 'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer'
//  NodeIdExpandedText = 'nsu=http://test.org/UA/Data/;i=10221';
// Example settings with Softing dataFEED OPC Suite:
  EndpointDescriptorUrlString = 'opc.tcp://localhost:4980/Softing_dataFEED_OPC_Suite_Configuration1';
  NodeIdExpandedText = 'nsu=Local%20Items ;s=Local Items.EAK_Test1.EAK_Testwert1_I4';
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Value: OleVariant;
  I: Integer;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;
 
  for I := 1 to 60 do
  begin
    Write('@', TimeToStr(Now), ': ');
 
    // Obtain value of a node
    try
      Value := Client.ReadValue(EndpointDescriptorUrlString, NodeIdExpandedText);
    except
      on E: EOleException do
      begin
        WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
        Exit;
      end;
    end;
 
    // Display results
    WriteLn('Read ', Value);
 
    //
    Sleep(1000);
  end;
end;

Below is the output of the program. You can see it reads each value, as it increments. The same value is usually repeated roughly two times, because the reading is twice as fast as the writing.
@11:58:00 PM: Read 17
@11:58:02 PM: Read 17
@11:58:03 PM: Read 18
@11:58:04 PM: Read 18
@11:58:05 PM: Read 19
@11:58:06 PM: Read 19
@11:58:07 PM: Read 20
@11:58:08 PM: Read 20
@11:58:09 PM: Read 21
@11:58:10 PM: Read 21
@11:58:11 PM: Read 22
@11:58:12 PM: Read 22
@11:58:13 PM: Read 23
@11:58:14 PM: Read 23
@11:58:15 PM: Read 24
@11:58:16 PM: Read 24
@11:58:17 PM: Read 25

If a similar program does not work for you, look for what you have done differently.

The namespace my variable has ("Local%20Items") is the default I got from the dataFEED. I do not know where you have gotten yours and whether it is correct.

Regards
Attachments:

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

More
17 Jan 2020 07:19 #8142 by Moien
Hello,

As I mentioned before, I am using dataFEED OPC Suite from Softing which can be downloaded here ( data-intelligence.softing.com/de/produkte/opc-software-platt...izer-ua/#tx-dftabs-tabContent2 ).
I define the NodeID name space as the following:
'nsu= mainNodeIdDName; s= mainNodeIdDName.SubGroup.VariableName'; and this is what that I am using as the "NodeDescriptor.NodeId.ExpandedText" later on in my Delphi application.
It gets more clear if you install the dataFEED OPC Suite (second part of my previous post) and try writing into and reading one Test Variable on the OPC UA Server.


Best regards,
Moien

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

More
16 Jan 2020 19:39 - 17 Jan 2020 07:53 #8140 by support
Hello,
this is an answer to the first part of your last post (about the NodeIds in the example). I will answer the second part separately, later.

The NodeI ds I have used in the example are those that worked for me, with the version of the server I have. It is possible that you have a different version and it has difference namespaces. If you let me know what you have (and where to get it, if it's not obvious), I can test with the version you have, and make it work too.

Although it is possible that the namespace URIs have changed with a different version of the server, what you have used ("CTT" or "/CTT") looks very suspicious. They are not even properly formed URIs, so I doubt that they are the correct ones. What the namespace URI for a specific node can be found by browsing for it (on the wire, this gives namespace index, and the namespace index is an index to NamespaceArray in the server that contains the URIs). If you browse using our Connectivity Explorer UI tool, you will see the namespace URI with each node immediately, too.

If you are interested of what all the available namespace URIs in your server are, use one of your UA clients, browse to Objects -> Server, and read the NamespaceArray variable underneath. Of course you can pick just *any* URI from the array - it needs to be the right one for the node you want - but it will give you an idea of what they look like.

I am attaching a simple VBScript that can be used with QuickOPC to print out the namespaces in any OPC server. Just unzip it somewhere on the disk, edit it to contain the proper server endpoint URL, and run
cscript ReadValue.NamespaceArray.vbs
With the Softing demo server I used to develop the example, I get:

0: http://opcfoundation.org/UA/
1: urn:TEST-OPC-3:SoftingOpcUaDemoServer
2: http://opcfoundation.org/Quickstarts/ReferenceApplications
3: http://test.org/UA/Data/
4: http://test.org/UA/Data//Instance
5: http://samples.org/Samples/HistoricalEvents
6: http://samples.org/UA/memorybuffer
7: http://samples.org/UA/memorybuffer/Instance
8: http://opcfoundation.org/UA/Boiler/
9: http://opcfoundation.org/UA/Boiler//Instance
10: http://industrial.softing.com/UA/Refrigerator
11: http://opcfoundation.org/UA/Diagnostics

(The same can be written in Delphi, but I use VBScript because it requires no extra software and works on every Windows).

I hope this helps.
Kind regards
Attachments:
Last edit: 17 Jan 2020 07:53 by support.

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

More
16 Jan 2020 11:05 #8138 by Moien
Hi again,

I already tested your program with 300 variables defined on the Softing .NET Demo OPC UA Server. It worked but the Node ID definition is in another form like:

ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'ns=2;s=/Static/All Profiles/Scalar Mass/Boolean/'+//'nsu=' + NamespaceUriString +
Format('Boolean%.3d', );
We have changed the NodeID definition as the following and it did not work:

ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=CTT;s=/Static/All Profiles/Scalar Mass/Boolean/'+//'nsu=' + NamespaceUriString +
Format('Boolean%.3d', );
We even tried:

ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=/CTT;s=/Static/All Profiles/Scalar Mass/Boolean/'+//'nsu=' + NamespaceUriString +
Format('Boolean%.3d', );
It did not work as well (Bad Node ID error).

If you are looking for a reproducible case, please download Softing dataFeed OPC UA Server ( data-intelligence.softing.com/de/produkte/opc-software-platt...izer-ua/#tx-dftabs-tabContent1 ). The Demo version is completely functional and runs for three days and you can restart that again. You can set the Soffting settings as standard. In the standard settings "Address room delimiter" is defind as point (.).
In Softing Configurator you can define OPC UA Test Items: Node name = Local Items (as a string) for example sub node --> EAK_Test1 --> EAK_Testwert1_I4 (as Int32). We write different integer values (incremented) into this variable in a loop. Simultaneously, we are reading this variable using the read function from QuickOPC. The first read delievers the value of the OPC Variable and does not update the value of this incremented variable (it delievers always the same value although it is changing continuously).
We have used three different OPC UA Client (Softing OPC UA Client, WinCC 7.5 OPC UA Channel Client and Prosys OPC UA Client). We have tested read and write functions and they are delievering the current incremented value of "Local Items.EAK_Test1.EAK_TestWert1_I4". Please check this simple example and let me know what you get.

Best regards
Moien

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

More
17 Dec 2019 09:29 #8089 by support
Hello.

Tu further add to this, in my understanding, the only difference between what you asked me to do, and what I did, is that the Softing server I used for testing is not publicly exposed on Web, but I am using the one from our testing setup.

Are you saying that it is somehow important that we put the Softing server on Web, instead of you testing it locally on your side? Why?

Kind regards

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

More
17 Dec 2019 09:15 - 17 Dec 2019 09:21 #8088 by support
Hello,

the code that I have provided below, and that I tested and works fine, uses Softing server, and it use string NodeIds. You can test it for yourself if you like.
I do not understand what else can I do to prove it.

Besides, majority of customers use string NodeIds without any issues. It not something uncommon - quite the opposite.

So, I think the issue must be in something else. So, if it is not working for you, please provide a reproducible scenario that we can analyze.

Best regards.
Last edit: 17 Dec 2019 09:21 by support.

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

Moderators: support
Time to create page: 0.238 seconds

      

 Recommend this on Google