LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variable engine write hangs

I am using the shared variable engine to bind shared variables to an OPC server (DSC/Labview 8.5)
 
When using read only variables, all works OK
 
When using a read/write variable (specified either R/W or W only in the shared variable definition), the shared variable engine hangs, and needs to be stopped and restarted for the program to work again. If the engine is not stopped and restarted, I basically get a shared variable is not located error (same as if I stopped the service manually)
 
I have tried synchronous or asynch writing as per the OPC Client I/O Server Advanced tab definitions (as well as In or Out of process).
 
Any idea why writes would be failing, but reads are working OK
 
0 Kudos
Message 1 of 6
(2,585 Views)
H RS7,

Have you tried to create a brand new variable in a LabVIEW project, bind it, set it to read/write then deploy it?
Then monitor it in the Variable Manager?

Does it give you any error at all?
I tried it on my computer, it works fine
Van L
NI Applications Engineer
0 Kudos
Message 2 of 6
(2,555 Views)
I have found out some info.
 
All the 'Read Only' variables are as expected in the variable engine, and they update as expected when running the software
 
The R/W variables are also there, and update OK when using the OPC Quick client to make changes
 
If I run the program it all hangs and I still have to stop and restart the variable service
 
If I single step through the program, it works OK
 
I added a timed loop to minimize the number of writes to the variable, and it now works OK as well
 
 
Next question
 
Is there a way to prevent the variable from being written to at more than a given rate, but to eliminate the latency of having a timed loop
 
 
0 Kudos
Message 3 of 6
(2,544 Views)
Hi RS7

Is the Timed loop giving you latencey?
What rate do you want to write it at and what are you experiencing?
Can you provide more details please

Thank you RS7

Van L
NI Applications Engineer
0 Kudos
Message 4 of 6
(2,528 Views)

a timed loop fires say every 1 sec, so I may have up to 1 sec latency between the clicking of a switch, an the action required.

If I set the loop interval to less than 500 ms, then I get long delays between the writing to the variable, and when it actually occurs. Even shorter times, I may never see the change in the variable.

I don't need fast updates, I just need them to start occurring without a delay when the event happens. In addition, if possible to have some way to allow the next setting of the variable to happen when the first one is finished.

 

In effect the sequence required is

 

1) Write to the variable

2) dissallow any further writes to the variable

3) check if the variable state has changed to that expected, and reallow variable write access

4) have a safety check, so if the write does not happen after a given time, time out, and reallow variable writes

0 Kudos
Message 5 of 6
(2,518 Views)
Hi RS7,

Sorry for the late reply, most of us were away for Memorial weekend.

I would suggest looking into the Semaphore vi Architecture to lock and release write to the variable.

There is a good semaphore example in Find Example in LabVIEW.

Give that a try and see if that solves your problem

Thank you

Van L
NI Applications Engineer
0 Kudos
Message 6 of 6
(2,471 Views)