Instrumentation Remote Control through Internet with PHP - IEEE Xplore

9 downloads 94962 Views 500KB Size Report
develop applications for instrumentation remote control through web browsers. These tools include a PHP module for GPIB control in a Win32 platform and a set ...
VECIMS 2008 – IEEE International Conference on Virtual Environments, Human-Computer Interfaces, and Measurement Systems Istambul, Turkey, 14-16 July 2008

Instrumentation Remote Control through Internet with PHP 1

João Santos1,2,3, José Mendonça1, João C. Martins1,4

Instituto Politécnico de Beja, Escola Superior de Tecnologia e Gestão, Rua Afonso III, 1, 7800-050 Beja, Portugal 2 Centro de Física Nuclear da Universidade de Lisboa, Av. Prof. Gama Pinto, 2, 1649-003 Lisboa, Portugal 3 Laboratório de Instrumentação e Física Experimental de Partículas, Av. Elias Garcia 14 - 1º, 1000-149 Lisboa, Portugal 4 INESC-ID, Rua Alves Redol, 9, 1000-029 Lisboa, Portugal Email: [email protected]

Abstract –This paper describes a set of PHP based tools created to develop applications for instrumentation remote control through web browsers. These tools include a PHP module for GPIB control in a Win32 platform and a set of PHP classes that make easier the creation of GUIs in web browsers for instrument control and data visualization. The Web AJAX technology allows asynchronous data loading making it possible to have in the same browser view different panels that are able to interact and to be updated independently.

lines allow the controller to perform all the management operations on the bus [4][5].

Keywords – virtual measurements; remote laboratory; GPIB; PHP; AJAX.

I. INTRODUCTION Computer based instrument control automates the measurement process, making it more reliable and cheaper then when it is done manually by programming individually each instrument through its command panel for every measurement process. Internet allows computer based measurements to be made remotely from almost everywhere with many advantages, either in research, industrial or teaching environment. Instrument operators do not need to be in the laboratory to control their tasks; in hazardous environments this might be crucial. The remote access to a teaching laboratory within an e-learning platform, allows students to use the equipment with less restrictions in time, being able to repeat experiments at their own pace. The GPIB (General Purpose Interface Bus) is today’s de facto standard interface for computer based control of standalone instruments. Though it is being used for over 30 years, its performance, robustness, reliability and simplicity of use have kept it being widely used in the instrumentation industry, and will probably keep it being used for many years to come [1][2]. The GPIB is a digital 8-bit parallel interface that uses 24 lines, 16 of these carrying TTL negative logic signals, and the remaining 8 being used for ground. The 16 signal lines are divided into three groups: 8 data lines, 3 control lines and 5 management lines (fig. 1). The data lines carry messages, either data or specific commands to or from the devices, addresses, and GPIB commands. The control lines use a handshake mechanism to control the asynchronous communication between devices in the bus. The management

978-1-4244-1928-9/08/$25.00 ©2008 IEEE

Fig. 1. GPIB interface: connections and BUS structure [3].

PHP (PHP: Hypertext Preprocessor) is a programming language originally created for the implementation of dynamic contents in Web pages [6]. It is an object oriented language, with syntax similar to C/C++ and PERL, that allows the development of efficient and robust Web applications. PHP runs on the server side, with efficient CPU and memory use, on many platforms. It is free and Open Source software, with developers all over the world. For these reasons it has become one of the most widely Web scripting languages in use. PHP is provided with many extensions to interact with other applications, namely databases and Web servers, and allows the development of others to provide more functionalities, if needed. It is perfectly suited to work with the free Open Source packages Apache HTTP server [7] - the most used Web server - and MySQL [8] - the most popular relational database management system for Web applications. The purpose of the work described in this paper was twofold. First, the creation a PHP extension that, with a HTTP server, makes the functionalities of a GPIB controller available remotely. Second, the development of a set of PHP classes to ease the creation of applications that use this extension to control instruments. This allows instrumentation remote control with Web browsers, without needing any special client software.

Though there is the effort of the Open Source software communities to provide solutions that span over most of the industrial, governmental or educational domains, the fact is that Win32 platforms keep being extensively used for instrument control and data acquisition. The lifetime of industrial, educational or research equipment exceeds the typical lifetime of general purpose computers and software. When this project began, we were not able to find any solution for GPIB control through PHP for the Win32 platform, though for Linux platforms there is such a solution [9][10]. Similarly, in spite of the PHP widespread use, no set of general use tools to create GUIs for instrument control and data visualization through browsers, similar to the one presented, was found for either of the platforms.

interfaces, acts as the instrumentation server. In the set-up we describe in this paper, this was implemented with a Windows XP platform, with a GPIB board, running the Apache HTTP server, a MySQL database and PHP. Another computer can work remotely as a client and can control the instrument, visualize data on different types of panels and download data gathered from the measurements made by the server. A similar architecture had already been tested using dedicated hardware [21]. As the needs for processing power are mainly on the server side, there is a negligible load on client machines. This makes it adequate for remote access without any significant requisites on the client side, besides possessing a web browser. B. The GPIB-PHP driver

II. INSTRUMENTATION REMOTE CONTROL The concept of instrumentation remote control through the Web has been around for more than one decade, either in the industry, research and education environments. A standard for instrument control through Ethernet has been established with the VXI-11 protocol [11][12] that can be used with the VISA API [13], either within several commercial off-theshelf products for instrumentation control, like LabVIEW [14] from National Instruments or VEE [15] from Agilent, or more generic IDEs like Microsoft Visual Studio [16]. Several groups have developed remote educational laboratories for engineering and science teaching [17]–[20], which play an important role in the emerging arena of e-learning. Our approach with this project aims to be as simple as possible in its set-up, using free and Open Source software, within the Win32 platform, and to present very few requisites for the remote users.

A PHP driver was developed as a PHP extension that provides the GPIB functionalities through PHP functions. These functions have syntax similar to the GPIB implementation in C. This driver was developed in C, under Win32, and works according to the structure presented in Figure 3. Programming language (PHP)

GPIB communication (PHP extension)

Interface (GPIB controller (AT-GPIB/TNT))

GPIB Device

A. Architecture for instrumentation remote control with PHP

(Digital Multimeter)

Fig. 3. Programmatic diagram.

The program structure to control a GPIB device has three blocks. One initialization part, where the interface is initialized and the device is addressed, a program body, where the tasks to deal with the device are defined and executed, and a finalization part where the communication with the controller is closed and computer memory is released. Some function calls that illustrate the use of the GPIBPHP driver are presented. The function ibev opens and initializes a device with a configuration that depends on its six parameters, and returns a device handler. In the following example a digital multimeter is initialized: Fig. 2. Set-up for instrumentation remote control with PHP.

The proposed architecture (fig. 2) is based on a client/server model. A PC, running an HTTP server with PHP, and controlling the instruments with generic or specific

Two functions of general use are ibwrt and ibrd. The

first writes data from a string to the specified device or interface board. The second reads data from a device or interface board into a string. The following code configures a digital multimeter (HP 3478A) to be used as an AC Voltmeter and makes a measurement:

A set of thirty four functions covering device level, board level and device/board level are made available to the user in the driver. C. GUIs for Instrumentation Control classes A set of several PHP classes where developed to ease the creation of GUIs in web browsers for instrument control and data visualization. Using the Web AJAX [22] technique makes possible to have in the same browser different panels that are able to interact, and to be updated independently of each other. AJAX is a group of web techniques that when working together can communicate asynchronously with a web server. The main advantage of using AJAX is the possibility to create more dynamic and interactive web pages, exchanging, big or small, amounts of data with the server to a specific DHTML object, without the need to reload every time it fetches a server response. The classes developed allow the creation of panels of general use, panels where controls are set, numeric controls, dynamic buttons, two state indicators (LEDs), numeric tanks, numeric slides, analogue displays, and graph controls.

The following PHP script example illustrates the creation of a set of panels with different controls:


The following examples illustrate the creation of a numeric tank and an analogue display:

The results of these function calls are displayed on Figure 3. Figure 4 illustrates the use interaction between independent panels, with the definition of the graph control properties through buttons of the other panel. The PHP, with its straight set of tools to create, manipulate, and query databases, opens a plethora of different applications scenarios for the management of measurements. The security and authentication features of PHP can also be exploited to further enrich the measurements and control applications.

data acquisition rate that our equipment supports, and proved to work as expected. The extension of the driver capabilities to other boards – this work was carried out with a National Instruments GPIB board – and the development of other classes for control and data analysis is on progress. REFERENCES [1] [2] Fig. 3. Numeric Tank and Analogue Display.

[3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]

Fig. 4. Graph Control interacting with several buttons and text boxes.

[21] [22]

III.

CONCLUSION

The tools described in this paper allow the creation in a simple and fast way of Web applications for instrumentation control using a widespread programming language like PHP. The innovative character of this approach is to allow instrument control with Web browsers, without needing any special client software, except a ubiquitous browser, and demanding a modest processing power. The tests performed with an instrumentation server, working for several weeks has shown to be a reliable and robust solution. The GPIB driver was tested with the higher

A. Toth, “When Is It Best To Use VXI, PXI, Or GPIB For Your System?”, Electonic Design, pp. 22–25, Mar. 15, 2004. National Instruments, “The future of GPIB”, NI News, Jan. 29, 2008: http://www.ni.com/news/archive_files/ninews01292008.htm http://www.adlinktech.com/GPIB/intro.html IEEE Standard Digital Interface for Programmable Instrumentation, ANSI/IEEE Std 488.1-1987. IEEE Standard Codes, Formats, Protocols, and Common Commands for use with IEEE Std 488.1-1987, IEEE Standard Digital Interface for Programmable Instrumentation, IEEE Std 488.2-1992. http://www.php.net http://httpd.apache.org http://www.mysql.com M. Billaud, “PHP-GPIB - une extension de PHP pour piloter les instruments GPIB - IEE-488”, 2005: http://www.labri.fr/perso/billaud/milieu.php?plus=phpgpib#outils F. Hess, “Linux Gpib package”, Berlin: http://linux-gpib.sourceforge.net/ J. L. Beckman, “A protocol for controlling devices over a network - a new VXI bus draft specification”, in Proc. AUTOTESTCON95, Systems Readiness: Test Technology for the 21st Century, 1995. VXIbus Consortium, TCP/IP Instrument Protocol Specification - VXI11, 1995. VXI plug&play Systems Alliance, VPP-4.3: The VISA Library, October, 2006. www.ni.com/labview/ www.home.agilent.com http://msdn.microsoft.com/en-us/vstudio/products/default.aspx H. Shen et al., “Conducting Laboratory Experiments over the Internet”, IEEE Transactions on Education, vol. 42, no. 3, pp. 180-185, August 1999. S. K. Esche1 et al., “A Scalable System Architecture for Remote Experimentation”, in Proc. 32nd ASEE/IEEE Frontiers in Education Conference, Boston, 2002. M. Billaud et al., “Real measures, virtual instruments”, in Proc. 4th IEEE International Caracas Conference on devices, circuits and systems, Caracas, 2002. F. Gomez-Arribas et al., “eMerge: An European Educational Network for Dissemination of online Laboratory Experiments”, in Proc. International Conference on Engineering Education, Valencia, 2003. J. Santos et al., “The CRESCERE Muon’s Lifetime Experiment”, Current Developments in Technology-Assisted Education (2006), vol. 2, pp. 1322-1326, FORMATEX, Badajoz, 2006. http://www.ajax.org