Laptop Control of PXI over Ethernet
This white paper describes how to use the many possible networking protocols available in National Instruments software to control and monitor a PXI measurement system over Ethernet.
Table of Contents:- Introduction
- Configuration Background
- Interface Terminal Application
- Data Logging Application
- Multiple Clients
- Distributed Application
- Advanced Configurations
- Security Concerns
- Application Examples
- PXI Technology Demonstrations
|
||
Introduction |
This white paper describes how to use the many possible networking protocols available in National Instruments software to control and monitor a PXI measurement system over Ethernet. These techniques could be used in any networked environment, but this note pays special attention to applications using a laptop to communicate with the PXI system. This document covers several application use cases that are possible with this configuration. Please refer to the collection of related application notes about networked PXI for more information about other applications and environments.
|
||
Configuration Background |
There are many reasons you might want to control a PXI system from a laptop. Some examples might be:
· In-vehicle test
· Convenient operator terminal
· Distributing a complex measurement application
· PXI technology demonstrations
In a workstation environment, you can communicate to a (possibly remote) PXI system using MXI-4, which offers a high-performance connection using PCI-to-PCI bridge technology. However, this mechanism cannot be used with laptops because they have no PCI slots. Instead, standard networking hardware and software can solve many of the same applications, as described below.
The basic setup used for all these laptop control of PXI applications consists of a Windows-based laptop/notebook computer and a PXI chassis containing a PXI controller with an Ethernet port. A National Instruments PXI embedded controller can run the Microsoft Windows or LabVIEW Real-Time, our real-time embedded environment, and a laptop can control either kind of PXI system over Ethernet. Whether you use a LabVIEW Real-Time target or a Microsoft Windows target depends on your development and deployment plans, but the ideas presented in this paper apply to both target platforms (except as noted otherwise). For more information on the hardware and software products involved in Ethernet control of PXI, please see the PXI Network System Controller.
The network topology connecting the laptop and the PXI system varies depending on the application and the distances involved. For example, if the goal is simply to create an easily portable PXI system using the laptop for the keyboard/mouse/display interface, you can use a (typically orange) crossover Ethernet cable. If you have a more complicated system involving multiple chassis, multiple laptops, or longer distances, a more standard network layout with hubs and routers (and standard blue or grey network cables) would be used. For some applications, a wireless Ethernet solution might even be appropriate.
|
||
Interface Terminal Application |
One common situation where you might want to control a PXI system using a laptop is simply using the laptop as an “interface terminal” to a PXI system that doesn’t have a convenient interface point – perhaps it’s inside a secure area, or perhaps it’s at a remote location, or perhaps it’s just inconvenient to provide a separate keyboard and mouse and monitor for a portable PXI system, and you have all those pieces handy in your laptop already. The laptop acting as the interface terminal can set up configuration options on the PXI system, start, stop, and control tests, and review results. The PXI system simply acts on the instructions from the interface terminal and reports results back as requested by the interface terminal.
Figure 2. Laptop Interface Terminal for Remote PXI System
Because Ethernet is so simple and reliable across a wide variety of distances – whether it’s across the room, across campus, or across the country – network control is the perfect solution for controlling and monitoring your PXI application from a laptop, no matter where the two computers are actually located.
Fortunately, in National Instruments software there are already many tools with which you can set up exactly this sort of PXI system.
For example, if your PXI system is running a LabVIEW application, you can use the very familiar LabVIEW front panel interface to control an application that’s running on a PXI system from your laptop, whether the PXI system is sitting next to the laptop or in the next room or in another city. The laptop can act as a “VI Terminal” by taking advantage of the Remote Front Panel protocol included with LabVIEW 6.1 and later:
Figure 3. Starting a LabVIEW Remote Front Panel
Anyone who has used a LabVIEW application knows how to interact with a Remote Front Panel, because it looks and works exactly like a normal LabVIEW front panel. It simply presents the remote application’s front panel in your own (local) LabVIEW environment. In the case of a laptop controlling a PXI system, you can use this capability to operate the application running on the PXI system from LabVIEW running on your laptop by accessing the PXI system’s LabVIEW front panels from the laptop.
If you have an Instrument Control application running on your PXI system – controlling third-party instruments connected via GPIB, VXI/VME, serial, or TCP/IP – you can also take advantage of National Instruments Remote VISA tools. By running a Remote VISA Server on the PXI system, you can interact with those instruments using the same VISA functions that you would use if the instrument was directly connected to your laptop, simply by opening a session to the instrument through the Remote VISA protocol. For example, a GPIB instrument that you might normally access by opening the resource “GPIB0::5::INSTR” could be accessed remotely by opening the resource “visa://pxisys/GPIB0::5::INSTR”. After the session is open, all the VISA calls are the same as they would be on your local system. You can even take advantage of the VISA ability to find resources based on attributes of the device, regardless of the device’s location, to access a remote instrument using the exact same application you would use on your local machine. This feature works even if the hardware and software for communicating to that bus are not present on your local machine, which makes it a good fit for a laptop with limited peripheral capabilities.
|
||
Data Logging Application |
Another application where you can really take advantage of network features already available on your PXI system is data logging. Once you have deployed the application on a PXI embedded controller, you may want to regularly retrieve the logs for analysis and archiving purposes, and the built-in networking on your PXI controller makes this very easy.
The simplest case is to simply log to a file on the PXI controller that is in a “shared” folder. On a Windows-based PXI controller, you can easily set up the folder with appropriate permissions based on the username, how many people are allowed to access it, and so on. This folder can be set up to be accessed via Windows file sharing from a Windows laptop, or can be published using other protocols such as HTTP (for a Web browser).
An interesting related case is the possibility of using National Instruments DataSocket to log the data to your laptop as it is acquired. DataSocket is a protocol available in National Instruments LabVIEW, Measurement Studio (compatible with third-party application development environments), and LabWindows/CVI to simplify the transfer of measurements across the network. A DataSocket system consists of one DataSocket server, which can run on any Windows machine (see Figure), and any number of DataSocket clients, which could be either Windows or LabVIEW Real-Time. Typically one of the DataSocket clients is the “writer,” sending data to the server, and the other clients are “readers,” retrieving data from the server. You can run the server on the same computer as one of the clients (this is probably the most common setup, in fact). For example, in the PXI data logging application, you could have a Windows-based laptop running the DataSocket server as well as a DataSocket reader client, and the Windows or LabVIEW Real-Time-based PXI system acting as the DataSocket writer. In the case of the data logging application, the reader would simply pull the data from the DataSocket server and record it to disk.
Figure 4. The DataSocket Server Window
To set up a simple DataSocket logger for a laptop and PXI system, you just need to use the LabVIEW DataSocket write VIs the measurement application on your PXI controller, as in the following example, which simply adds the DataSocket write VI to the standard DAQ solution for digital I/O:
Figure 5. A Simple LabVIEW Sample Program Modified to Log Measurements to a DataSocket Server
You can use these LabVIEW VIs to transfer data easily from your PXI system to your laptop. You could also use the DataSocket C++ API or other options on the PXI end, but LabVIEW makes this process very simple.
Then, on the laptop side, you can write a simple LabVIEW (or C++, or whichever environment suits your needs) program that reads the DataSocket and records that data to a file in whatever format is most appropriate for your needs.
If your data logging requires guaranteed delivery of every logged data point, a handshaking protocol may be appropriate on top of DataSocket, which is normally a real-time protocol not guaranteed to deliver all data to its clients (which makes it simpler to handle multiple readers and writers that are faster than the readers, but may not be desirable in some applications). For an example of how to use handshaking to ensure that DataSocket does not drop data, see Handshaking Example for DataSockets .
|
||
Multiple Clients |
A common situation with a networked PXI system is that you want several different operators or engineers to be able to view the status of the test or the data being acquired by your measurement system. Often, it makes sense for some or all of these readers to be portable, using laptops to view the data, record and analyze results, report errors, and take other appropriate action based on the information from the PXI system.
There are several National Instruments tools that can help you set up this application. One of the simplest is DataSocket. You can run a DataSocket server on any Windows system – for example, your laptop – and communicate to it using LabVIEW for both writing (publishing) and reading (subscribing) data. In the case of a networked PXI measurement system, it just takes a few clicks or a few lines of code to make a LabVIEW or LabWindows/CVI program running on the PXI system publish the measurements it is acquiring to a DataSocket server. Then you can subscribe to those data points from your laptop to verify that the test is working, while another operator is viewing the same data from a workstation, and another laptop across campus is retrieving the same data for analysis, and yet another reader is logging the results.
Figure 6. The Sample Numeric Data Point Variable in the DataSocket Server
The setup for a multiple-reader system using DataSocket is the same as for a single-reader example such as a data logger; you simply add more DataSocket clients.
Of course, you can combine different protocols so that each of the multiple readers accesses the data in the way that is most suitable for them. For example, if you’re just trying to “check in” on your test system, a Web browser viewing a LabVIEW Web Server page based on your VI might be appropriate, while at the same time your VI is outputting data to a DataSocket server and also being closely monitored (and controlled, if necessary) from a different remote location using LabVIEW Remote Front Panels.
|
||
Distributed Application |
For some applications, it’s helpful to distribute the workload among many computers, either because more processing or more I/O bandwidth is needed. In certain cases, it makes sense for to have a laptop as part of a distributed measurement application. This configuration is made possible using Ethernet to connect the various pieces of your application.
For the laptop case, most likely your distributed system will be distributed between multiple PXI systems for processing and a laptop as an interface terminal. Refer to the Interface Terminal section above for more information about setting up the laptop to control and monitor a PXI system over Ethernet – this configuration can easily be extended to handle an application distributed over several PXI systems.
If you’re trying to distribute an Instrument Control application, you may find that the National Instruments Remote VISA protocol provides a good solution. By setting up a PXI system (or even several PXI systems) with the Remote VISA server and using the ability of VISA to find resources by attributes anywhere on the network, you can write an application that detects the best device for an operation based on its attributes and uses it regardless of where it is physically connected. You can run an entire Instrument Control application that communicates to dozens of instruments connected in different ways – GPIB, VXI/VME, serial, TCP/IP, or even certain PXI instruments (those with VISA instrument drivers) – from a laptop that doesn’t have any interface to those devices other than its network connection to the PXI system(s). You can then write your measurement application to run on the laptop and it will automatically communicate to the distributed PXI systems to perform the I/O that the laptop cannot perform itself.
|
||
Advanced Configurations |
You can also extend the ideas presented in this paper for wireless networking, so that you could create a portable operator terminal for a factory floor, for example. Because modern networks can easily include a wireless interface such as IEEE 802.11, it is simple to extend the “Interface Terminal” application for a wireless operator setup. Many recent laptops offer the ability to connect to a wireless network, and you can use a wireless hub or a wireless-networking PC Card in a carrier module to connect your PXI chassis.
|
||
Security Concerns |
One question that applies to any networked environment is, “what about security?” In the case of laptop control of PXI, it depends on what your network topology is, as well as which software tools you are using, both from NI and third-parties.
By using a private network – for example, by connecting your laptop directly to your PXI system with a crossover Ethernet cable – you can ensure a completely secure Ethernet control of PXI solution. As soon as you expose your PXI or laptop system to the outside world (i. e. by connecting them through a standard network with hubs, routers, etc. ) you need to be aware of the security needs of your application. Although with most NI tools, you have a basic level of access control using IP-based permissions for their operations, a moderately sophisticated attacker could fool the user by “spoofing” an IP address, or illegally read data by “sniffing” it, if the network is publicly accessible.
You can often use standard third-party tools to ensure a secure connection. For example, you could use a virtual private network (VPN) for two machines to communicate with data encryption through secure firewalls.
|
||
Application Examples |
This section discusses some common applications that combine some of the cases described above to provide a complete solution for real-world problems. Where appropriate, you should refer to the example code that is available with this white paper.
In-Vehicle Test Application – A typical in-vehicle test application using PXI can benefit from laptop control over Ethernet by having the laptop available as a terminal and data logger for a PXI system with appropriate CAN modules installed. This saves the user the trouble of fitting a monitor/mouse/keyboard interface into a potentially cramped test area.
Operator Terminal Application – This application uses the laptop as a VI terminal for a factory-floor PXI test system, possibly in combination with other similar terminals in a multiple-reader layout. With the flexible, long-distance cabling offered by Ethernet, the laptop operator terminal can be located in a safe, convenient location while the PXI system itself is in a remote, cramped, or hazardous area some distance away. Because Ethernet makes it easy to have multiple interface points using a hub, several operators can view the data being collected by the PXI system and even take control of the system if appropriate.
Distributing a Complex Measurement Application -- If your application requires a lot of I/O – exceeding the bandwidth of a single PXI system, for example – you may end up distributing that application across multiple PXI systems. In that case, it might be useful to have a laptop directing the application, so you could monitor the state of multiple slave PXI systems that are doing the work.
|
||
PXI Technology Demonstrations |
One situation where laptop control of PXI makes a lot of sense is in a portable PXI demonstration. Often, you’re already carrying a laptop, so using that computer to control your PXI system instead of transporting a bulky monitor, separate mouse and keyboard, and all the associated tangle of cables from place to place is very desirable.
Related Links:
PXI Network System Controller
Remote Instrument Control with NI-VISA
Building Intelligent Ethernet-Based Distributed I/O Systems with National Instruments LabVIEW
Developing Scalable Networked Monitoring and Control Systems with LabVIEW
posted on 2006-04-05 12:26 LabVIEW开发者 阅读(762) 评论(0) 编辑 收藏 举报