Skip to main content
1-Visitor
January 14, 2019
Solved

Timing when Thingworx writes Kepware Tag

  • January 14, 2019
  • 2 replies
  • 1772 views

In a Thingworx service, we are setting a property value inside a script. The property is a remotely bound tag to Kepware. In the next line, we are trying to read the value but instead of getting the recently set value we get the old value.

  

logger.debug(me.value);  // Value is 0 initially
me.value = 1;
logger.debug(me.value);  // Still returns  0

Is this the expected behavior? We have tried both "read from cache" and "fetch from remote" settings on the parameter.

 

If we add a pause to the code we need about 200 ms to get the new value.

 

Many thanks!
Erik

Best answer by PaiChung

So you have a read/write tag that you set and then read?

What happens is, you set the tag, it goes to Kepware, on the next cycle Kepware sends that value back to Thingworx.

So the roundtrip probably is inducing that delay because if you run the set and get right after eachother it will be finished in a milisecond or less.

is it important for one reason or another that you read the value right away after setting it?

I think if you do this from a mashup - Set - ServiceInvoke Completed - Get you probably won't run into this behavior.

2 replies

PaiChung22-Sapphire IAnswer
22-Sapphire I
January 14, 2019

So you have a read/write tag that you set and then read?

What happens is, you set the tag, it goes to Kepware, on the next cycle Kepware sends that value back to Thingworx.

So the roundtrip probably is inducing that delay because if you run the set and get right after eachother it will be finished in a milisecond or less.

is it important for one reason or another that you read the value right away after setting it?

I think if you do this from a mashup - Set - ServiceInvoke Completed - Get you probably won't run into this behavior.

1-Visitor
January 30, 2019

Thank you - now we understand how the system works so we can find a solution. 

Best regards
Erik