Showing results for 
Search instead for 
Did you mean: 

IWorkspace2 Interface: Undefined timing behaviour.



I set various channels using the SetSingleChannelValue function of the IWorkspace2 Interface.

When I read a channel using the GetSingleChannelValue function afterwards, I don't get the expected result. It seems that it takes some undefined (?) time for the set-value operation to complete after the function returned.


For example after executing the following code, channel_val will be 0 (when 0 is the previous value of the channel):


WorkSpace = Factory().GetIWorkspace2()
WorkSpace.SetSingleChannelValue('some_channel', 10)

WorkSpace.GetSingleChannelValue('some_channel', channel_val)


However, when waiting some time after the call to SetSingleChannelValue, channel_val will have the correct value (10):


WorkSpace = Factory().GetIWorkspace2()
WorkSpace.SetSingleChannelValue('some_channel', 10)

time.sleep(0.2) #Wait 200ms

WorkSpace.GetSingleChannelValue('some_channel', channel_val)


Can anybody explain this behaviour? In my oppinion this is a bug, because when I call a function to do some operation, I expect the operation (set-value in this case) to be completed when the function returns. I'm using VeriStand 2012.





0 Kudos
Message 1 of 5

Hello Krid,


setting the value is asynchronous. So the gateway sends the command to real time side asap. 

Reading of the value is based on gateway refresh rate, that is 15 Hz. So in the worst case you have to wait up to 60ms to get value refreshed on host side.




0 Kudos
Message 2 of 5

Hello Jiri,


thank you for your answer. Is the gateway refresh rate of 15Hz a fixed value or is it possible to access/change this value using the API (I haven't found anything in the docs so far)?


I'm thinking of using the IChannelMonitor interface to be notified when a channel value really changed to the value I set it to (seems to be a quite cumbersome solution though).



0 Kudos
Message 3 of 5

Hi Krid,


it is not possible to change that 15 Hz through API.

If you need more rapid action, you will have to use Real-Time sequence a manage the logic on the RT side.

Or you can subscribe for a UDP stream of specific channel through API. Than you will get undecimated data, but with slight transport delay...




0 Kudos
Message 4 of 5

Hi Jiri


I may have an answer at the end of this thread :



0 Kudos
Message 5 of 5