08-17-2005 09:18 AM
08-18-2005 09:35 AM
08-18-2005 10:32 AM
Thank you Daniel. Yes, I am using your "Command-based Architecture for LabVIEW Real-Time" as a template. I have some questions:
1) I notice that the Command Sender and Data Receiver loops on the host are running full-speed, as is the Command Parser loop on the target(i.e., no loop timers). The Medium Priority Task loop on the target however has a 100ms timer. Why is the Data Receiver loop on the host not also timed? Does it need to run faster to avoid data backup?
2) Can data become asynchonous; i.e., get backed up in queue if the receive loop is slower than the send? Is there a way to flush the queue in this case, and is that good practice? I am getting old data now while trying to debug.
3) What are the priority settings of each VI (Target and Host)?
4) My meta data array is 60 elements. I am getting a timeout error at Meta Data Send, even after setting the TCP send timeout to 90000 inside the Meta Data Send subVI. It worked fine with a small (3-element) array. I worked around by simply copying the meta data array to the host application. Any ideas on why this could happen?
Thanks for your response!
08-18-2005 04:28 PM
Hi,
Here are my thoughts on your questions:
1- The 'TCP Msg Read.vi' includes a timeout terminal. By default it is set to 25 seconds. This VI sleeps until a new frame is received or it times out. This is why you don't need an extra 'wait' function to time the loop.
2- All that is handled internally by the TCP/IP driver. The driver buffers data for you so even if the reader is slower, the driver will store the data for you until you are ready to read. If the reader is too slow you will be getting timeout errors on the write operation. Since the driver is buffering data, that is why you keep getting old data. There is no direct way to flush the data. You can try using the low level TCP functions to continuously read until all the data has been read.
3- You can check the priorities of each VI by going to the File>>VI Properties menu of each VI and then looking into the "Execution" dialog.
4- I haven't seen any issues with sending big Metadata arrays. Most likely it has to do something with your network settings and configuration. The goal is that both the client and server have the exact same metadata. Sending the data is a clean approach because you just have to maintain the data in one place. But, if this approach is giving you trouble, having multiple copies of the metadata will work fine too.
Regards,
Daniel
08-19-2005 03:50 PM
Wow this really works great! Once I got the timing correct, everything is flowing smoothly.
More information on the meta data transfer: If I copy the meta data array to both host and target applications, all is fine. If I use the Meta data transfer functions, the host creates the TCP connection and waits on Read Meta Data.vi. The RT Target never stops listening for the TCP connection (like the host never created it). I'll check differences with my original test program (which worked fine with the Meta Data read). But this code seems to match exactly the example given in your paper.
One question on parsing commands received by the target: Is it better to pass data to high-priority loops through RT-FIFOs (as in your example) or by onboard variables available on the motion card? I'm having trouble with RT-FIFOs as in the following - if I have a value that needs to be read multiple times (e.g., motion velocity value, read each time I actuate an axis), I can read it once from an RT-FIFO, but then that FIFO is empty. Do I need to copy the value to another structure (e.g., onboard variable or local variable) and read from that? Or create 60 different shift registers (one for each variable) to pass default return values if the FIFO is empty? What is the normal practice?
Thanks!
08-22-2005 11:29 AM
08-24-2005 01:12 PM
08-30-2005 06:38 PM
Hi Laine,
Unless your VIs are running in parallel, I would not recommend opening a new reference to the FIFO in each VI. Passing the FIFO reference as a subVI should work sufficiently. Do you think this is feasible?
Regards,
Kristi H
08-31-2005 07:46 AM
Yes, this is what I'm trying now. Not too bad, but a little wirey (is that a word?).
I'll post an example when I finish; would appreciate your comments.
Thanks