LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a Shared Network Variable to transmit buffered strings

NIFORUMS POST

Hello.


My general goal is that I have a "command console" running on a LVRTOS PXI and I am trying to have a VI on the Host PC send and recieve these console commands.

So far I have tried to send a string of characters to a PXI using a Shared Network Variable. The problem is the VIs I have created so far result in the string being output repeatedly at the speed of the PXI's loop. This makes sense but I was attempting to have a single string "consumed" by a read even and I attempted to use the Queue objects to do this. However, they appear to not be "transportable" over the network.

I assumed that enabling buffering on the Shared Network Variable would help this problem (it is a "buffer" so once a read occurs hopefully an item is removed from the buffer). However, the behavior does not change as buffering is enabled or disabled for this string-based Network Variable.


At this point I realize TCP is going to be an option but using the Shared Network Variable for this is convenientfor other several other reasons.

Does anyone have any suggestions?

0 Kudos
Message 1 of 4
(2,920 Views)

I beleive you can right-click on the shared vaiable node and get it to return a timestamp.

Any time the time stamp changes, there should be a new string.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 4
(2,917 Views)
Hi Ben,

I implemented your suggestion a week ago and it was working quite well until our transmit rates started to increase. Timestamps only have a resolution of 1ms. If I start transmitting large blocks of commands (parsing a textfile) quickly two strings could have different content but be sent in the same millisecond thus failing the conditional test and dropping a command.

I noticed on my "local" machine a queue structure works perfectly but I can't "share" a queue via a network shared variable.
0 Kudos
Message 3 of 4
(2,886 Views)

Perhaps you could create your own cluster datatype for the shared variable where you have a numeric value and the desired data string.  Everytime you put in a new string, increment by 1 the number you put in the numeric.  That way on the receiving end you could compare the numeric value with the previous numeric value.  If they are the same, the discard the new read.  If they are different, then you know it is a new value put in the shared variable even if the new value has the exact same ms time stamp as the last.  Then you should even have to bother reading the timestamps.  Basically you are putting a serial number in your data.

Actually, perhaps even easier, you could also put it in the string itself.  If you prepend some digits (say 5) as the serial number.  When you read the string, strip off these first 5 characters and compare to the last reading.  The remaining characters would be your actual string data.

Message Edited by Ravens Fan on 10-27-2007 08:57 PM

0 Kudos
Message 4 of 4
(2,868 Views)