Step 5: LabRAD for LabVIEW
Overview
To complete the tutorial, we will first walk you through the installation of the VIs you need to interact with your LabRAD System. Then, you will develop a few LabRAD Client Modules that will take data on the different fractals provided by the Fractal Server.
Installing the VIs
After downloading the current API package - LabRAD-VIs-native-v0.9.2.zip - you have two choices for how you would like to access the VIs from your applications Block Diagram:
- To have the VIs available in the User Libraries section of the Functions Palette, you need to extract the downloaded zip file into the user.lib directory inside your LabVIEW installation folder. Then you might want to rename the extracted folder from LabRAD-VIs-native-v0.9.2 to simply LabRAD.
- To use Select a VI... to place the components, you can unzip the downloaded file into any directory of your choice. All you need to do is remember where you placed them.
Depending on your choice, you can now either use the bottom right-hand icon in your Functions Palette like in the following screen shot, or you have to use the bottom left-hand icon and browse for the icons manually:
With either method, you should now be able to access the following VIs (excluding the contents of the "internal" folder, which you will probably not need to use directly):
|
Icon |
|
Filename |
|
Description |
|
|
![](./attachment/Build_Packet.png) |
|
Build Packet.vi |
|
Assembles records into a Request packet |
|
|
![](./attachment/Parse_Packet.png) |
|
Parse Packet.vi |
|
Extracts records from Reply packet |
|
|
![](./attachment/Simple_Client_Connection.png) |
|
Simple Client Connection.vi |
|
Establishes a simple Client Connection to the LabRAD Manager |
|
|
![](./attachment/Simple_Disconnect.png) |
|
Simple Disconnect.vi |
|
Disconnects a simple Connection |
|
|
![](./attachment/Simple_Request.png) |
|
Simple Request.vi |
|
Sends a Request Packet and waits for a Reply |
|
|
![](./attachment/Look_Up_Manager_Info.png) |
|
Look Up Manager Info.vi |
|
Tries to read the connection details from the Windows environment variables |
|
Now, what's with all the "Simple"?
There will be three versions of the LabVIEW API that you can choose from:
- Simple Connections are a very tight wrapper around the native LabVIEW TCP Connection components. They expect predictably serialized traffic on the network connection. This probably gives the VIs slightly better native performance, but does not allow for Messages or concurrent Requests, since those would require interleaved data with unpredictable serialization. For the same reason, Server Modules using Simple Connections cannot make any LabRAD Requests at all on the connection they use to listen for Requests. But for building - well - "simple" user interfaces to an experiment, these should definitely provide sufficient functionality. And even for more complicated Client and Server scripts, you can achieve almost full functionality (except for Messages) by simply using multiple client connections.
- Receive Loop Connections utilize LabVIEW Notifiers and Events to route Requests, Replies, and Messages between your application and a centralized loop that handles all network traffic. This gives access to all features of LabRAD, including Messages and having multiple Requests in flight simultaneously. But, these connections might not perform as well as Simple Connections due to the added overhead.
- Delphi DLL Connections use a library written in Delphi to handle all network traffic and to assemble packets and route them into the appropriate queues. These components will most likely yield the best performance, but will only be available for Windows and are currently somewhat far from completion.
Next
~ Markus Ansmann, Feb 26th, 2008