- Posts: 46
- Thank you received: 0
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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Reading, Writing, Subscriptions
- "SubscribeDataChange" using the read function
"SubscribeDataChange" using the read function
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.
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.
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
Please Log in or Create an account to join the conversation.
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.
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
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
Please Log in or Create an account to join the conversation.
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.
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.
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.
Please Log in or Create an account to join the conversation.
We already tested that with softing OPC UA Server. It is working with integer Node-IDs, but not with string Node-IDs. I wanted to prove that there are some bugs in your client code for the string Node-IDs. You may test it yourself to see that I am right. If you are not eager to win a new customer, I cannot do anything.
Best regards
Moien
Please Log in or Create an account to join the conversation.
unfortunately we cannot easily change the public demo server; its configuration is hard-coded.
I suggest you download one or more of the many OPC UA servers that are available and that have string IDs. KepServerEX certainly uses them. The Softing .NET demo server has them too - this is the one I used in my tests shown below. And there are more.
Best regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in .NET
- Reading, Writing, Subscriptions
- "SubscribeDataChange" using the read function