Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello! I wonder if someone can explain the behaviour of KepServer described below. I couldn't find anything similar online.
Context:
I'm building a POC of an application with an OPC UA client in it. For that I'm using node-opcua opensource product.
I'm using KEPServerEX 6.10 as an OPC UA server.
Use case:
I have a basic script that reads a value attribute from the server. The node is pre-configured and comes out of the box with Kepware Server. Node ID is ns=2;s=Simulation Examples.Functions.Sine1.
The script establishes a connection with the server, creates a session, reads a values, closes the session, disconnects from the server.
Expected behaviour:
Each script invocation should return a simulated sinusoid value.
Actual behaviour:
First script invocation returns 0 (zero) value. Response status code is 0 (Good). Subsequent request if it happens within 5 seconds, returns a legit sinusoid value, e.g. 0.20106108486652374. I figured "Tag Cache Timeout (s)" in KepServer Project Settings is relevant. It is set to 5 seconds by default.
Question:
How do I make initial data read return a valid value and not a zero?
Solved! Go to Solution.
Look at the Channel Properties / Tag properties or the Remote Binding Properties
To be honest, by default it should behave the way you are expecting it to, so I'm not sure why it is always starting with 0 when you do your first read.
But if you plot your data over time, you should probably see a confirmation that potentially when you connect it always starts from 0, it may be that is how the simulator works, not sure.
Ideally there is the scan rate on the kepware side and then a 'push on changed value' and on the ThingWorx side it should do a 'Read from Cache'
Wouldn't 0 be the first value of a sinusoid?
Hi @PaiChung
From what I understand the value is constantly changing (with the default KepServer parameters it flows from -39.999... to 39.999... and back repeatedly). Any read should result in a value in that range, no matter if it's a first read or subsequent read.
How come first read always returns 0? Am I getting it wrong and is it that the first read "kick starts" the sinusoid and the initial value is returned?
It is potentially possible that the 'read' request generates the value and that would mean first read is always 0
check your tag 'read/refresh' settings .
Unfortunately a tat outside my area of expertise.
Thanks for looking into this @PaiChung
Can you direct me where can I find the "read/refresh" tag setting?
I couldn't find anything similar in the KepServer Configuration tool (screenshot attached).
Look at the Channel Properties / Tag properties or the Remote Binding Properties
To be honest, by default it should behave the way you are expecting it to, so I'm not sure why it is always starting with 0 when you do your first read.
But if you plot your data over time, you should probably see a confirmation that potentially when you connect it always starts from 0, it may be that is how the simulator works, not sure.
Ideally there is the scan rate on the kepware side and then a 'push on changed value' and on the ThingWorx side it should do a 'Read from Cache'
I think you're right and that's the way the simulator works.
It's definitely not a client issue (my initial concern) as I can see same behaviour when using a desktop OPC UA client (UAExpert).
If I use another simulation provided by KepServer, Sine2 (vs Sine1 used originally), it's similar in that it starts with a fixed number, only the number is different: 4.8985871985824346e-15.
That resolves my initial question. Thanks @PaiChung
Hi @MI_9934026
Since you found a solution, please mark the appropriate response as the Accepted Solution, for the benefit of others with the same question.
Regards.
--Sharon