Real-Time VI to Host VI Communication Methods Primary Software: LabVIEW Modules>>Real-Time ModulePrimary Software Version: 7.0 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I want to transfer data from my RT VIs to my host VIs or vice versa. What are my options? Solution: There are several common ways to communicate between VIs running on RT targets and host VIs running on a Windows based desktop PC or PXI controller: For each method, there is an example:
Shared Variables TCP UDP DataSocket Other Communication Methods Shared Variables
A key feature with Shared Variables and Real-Time is the ability to enable RT FIFOs for deterministic data transfer. Previous to LabVIEW 8.0, RT FIFOs were managed manually with VIs much like Queues. Developers typically would use RT FIFO Reads in a low priority loop and then use communication method to transfer the data across the network. With RT FIFOs enabled with Shared Variables, all of the work is automatically handled by the Shared Variable Engine without cluttering the block diagram. See this Developer Zone article, and the example RT FIFO Communication for more information on the legacy RT FIFO VIs Additional shared variable features are available with the LabVIEW Real-Time and Data Logging & Supervisory Control Modules such as alarming, data logging, event structure support, security and more. For more information on the LabVIEW shared variable, see: Developer Zone Tutorial: Using the LabVIEW Shared Variable TCP
TCP is the most common networking protocol, as it is the protocol upon which many Internet protocols, such as HTTP and FTP, are based. It has the advantages of being reliable (lossless) while still providing very good performance. The reliability of TCP is its most important feature: it guarantees that the data will reach the intended receiver, or the sender will be notified of the failure. TCP provides the highest throughput with the best reliability of any of the communication standards available in LabVIEW. It is particularly efficient for transferring large quantities of data. Keep in mind that shared variables use TCP commands to handle network communication as well. The performance increase from using TCP commands directly in your application is usually marginal when compared with using shared variables. Refer to the the Developer Zone Tutorial, Using the LabVIEW Shared Variable for performance comparisons. UDP
Another common networking protocol is UDP. Unlike TCP, UDP is lossy. This means that when sending data, there is no guarantee that it will actually reach its intended destination. If the network is overly congested or the receiver fails to respond, some data may be lost. Because UDP doesn't worry about data loss, it operates using less overhead than TCP, meaning that in some situations it can provide even faster performance. UDP is most appropriate on isolated networks where external traffic will not over-congest the network, or for applications which can function properly even if some of the data is lost. DataSocket Another data transfer protocol available to LabVIEW programmers is DataSocket. It is a precursor to the LabVIEW shared variable and has a similar publish and subscribe topology, front panel binding, etc. One disadvantage of DataSocket is that it was not designed to handle very large data sets. Also, the DataSocket server can only run on Windows machines, while the Shared Variable Engine can run on Windows machines and RT targets. Other Communication Methods On RT Series networked devices, you can also communicate through the serial (RS-232) port. On RT Series PXI controllers you can use CAN, RS-485, GPIB, and other standard communication protocols. It is pertinent to note that most communication protocols are non-deterministic, so, in order to ensure deterministic performance in your time-critical code, you should not perform communication from within the time-critical VI. Transfer the data to a normal priority VI also running on the RT side to perform your communication. Related Links: Developer Zone Tutorial: Using the LabVIEW Shared Variable Developer Zone Tutorial: Real-Time FIFO for Deterministic Data Transfer Between VIs KnowledgeBase 372CGCQS. Network Communication to an RT Series DAQ Device Attachments:
Report Date: 06/10/2002 Last Updated: 09/09/2008 Document ID: 2M9ARPEW |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||



