REMOTE-CONTROL MEASUREMENT SYSTEM BASED ON THE IEEE-488

The paper presents a complete system for remote measurement. The system is based on the client-server communication structure over the Internet. One part considers the client application – it is used by a user to control the measurement. Second part deals with the server – the server application itself and local connection the instruments over the IEEE-488 interface bus. The communication between client and server is built on TCP connection.


MEASUREMENT TASK
The task of the system is to measure V-A characteristics of a TTL logic gate. TTL logic gate is the Device Under Test (DUT) for the application. The V-A characteristic is a function of the input and output voltage, where the output voltage is the dependent variable. The V-A characteristic is measured for constant power supply voltage.
( ) power input f output , = (1) where input is the input supply voltage of the DUT, power is the power supply voltage of the DUT and output is the output voltage of the DUT. Fig. 1 shows setup of the system for measuring V-A characteristics of a DUT. The system is composed from two supplies, one voltmeter and a DUT. One supply (called Input) is used to setup the input voltage of the DUT. The other one (called Power) is used to setup a constant power voltage for DUT during measurement. The output voltage of the DUT is measured by the voltmeter (called Output).

MEASUREMENT SYSTEM
The system uses the client-server topology for communication (see Fig. 2). Two computers communicate over the Internet. The communication between client and server is built on TCP connection.

Computer
Linux Server  The client application (on the computer with Microsoft Windows) controls the measurement. The server application is running on the computer with Linux. Server application services the client application commands and demands.
The server computer is physically connected to measurement instruments (two power supplies, one voltmeter) via the IEEE-488 interface bus (also known as GPIB). Fig. 10 shows this connection of measurement instruments. The server computer is also available as emulator -it will be described later.

CLIENT APPLICATION
Each student develops both applications -client and server. First, a student starts with developing the client application. The LabWindows/CVI from National Instrument is used to develop a client application. Table 1 describes the variables that can be controlled by users from their client applications.

Variable Description
Input voltage User can set up the range of the input voltage. This is done by entering values -minimum, maximum and count of steps.

Power voltage
User can set up the range of the power voltage. This is also done by entering values -minimum, maximum and count of steps.

TCP address
The IP address of server computer.

TCP port
The listening TCP port of server application.
The client application has a user interface to control and visualize the measurement (see an example of user interface in Fig. 3 -created as a result of their work by students). It shows graphical results of measurements. For easier debugging, the communication log between the client and server applications is also displayed.

Fig. 3 -Client application user interface.
The client application is written as multithreaded application. There are two threads in the application (see Fig. 4  The application uses mutex objects to protect shared resources. This allows student to understand that access to shared variables (or sources of functionality) within an application with more than one thread of execution is restricted and has to be handled correctly.

SERVER EMULATOR
The server emulator application for Microsoft Windows was developed to help students in development of their client application. It is an emulator of the system for remote measurement (server-side part). This server emulator application includes also virtual devices -so it completely replaces the whole server measurement system. This application is available at website [1]. Fig. 5 shows the user interface of the server emulator application for Microsoft Windows. User can select a TCP port, start or stop the server. The additional information (like input voltage, output voltage, power voltage, communication log, count of commands) is displayed. Users can use a client application or application like TELNET to make a TCP connection to the server emulator application (see Fig. 6). The communication protocol is described later in the paper.
There are implemented three modes of the DUT in the server emulator application (see Fig. 7-9): 1. Mode 1: DUT is O.K. DUT is implemented as the TTL logic gate. The output voltage is depended on the input and power voltage.

Mode 3: DUT is broken.
When input voltage is higher than power one -the DUT is broken. The DUT output voltage is constant value (zero). The user can not return from this mode back to other onea restart of application is required. More information about the server emulator application has been published in [2].

SERVER APPLICATION
After successful development of the client application and testing it with server emulator, the students solve a server application. The server computer is physically connected to measurement instruments (two power supplies, one voltmeter) via the IEEE-488 interface bus (also known as GPIB). Fig. 10 shows this connection of measurement instruments.

Voltmeter Output
Supply Input

IEEE-488 interface bus
Computer Linux Server Application Server

Fig. 10 -Connection of measurement instruments to server computer.
Linux server is used to develop and run the server application. Each student has an account on Linux server. Anjuta DevStudio is installed on Linux server to enable remote development of server application. This application can be download from website [3]. An example of the user interface is showed in Fig. 11.   Fig. 11 -Anjuta DevStudio is used to server application development by the students. Table 2 describes the variables which are controlled by user in a server application. The server application is running as a console application. Users can specify the variables' values before execution as command line parameters or in running application from console. Also additional information can be showed -communication log with connected clients and status of connected instruments. The listening IP address of server application. TCP port The listening TCP port of server application.
The server application is a multithreaded program. There are two threads in the application (see Fig. 12): 1. INSTRUMENT thread. This thread is used to communication with instruments. It is sending command to instruments via VISA library. A reply is then written back to queue. 2. CLIENT thread. This thread is listening on TCP port. When client is connected to TCP port the thread services all client commands. New connection to TCP port creates a new CLIENT thread -so each client is serviced by a separated thread. Mutex objects are also used here to protect shared queue.

COMMUNICATION PROTOCOL
TCP connection is applied to exchange information between the client and server application. Data transfers use the message protocol specially designed for this purpose. The message protocol contains commands and replies (Table 3). Both commands and replies are represented by strings. Each command (answer) is separated by characters CR, LF (identifying a new line). This allows using application like TELNET to communicate with the server application. Server application sends an answer to each command received from a client. Table 4 shows type of commands and Table 5 shows type of possible answers: 1. Type C1. Client is writing a value to the device. The server can reply using type S1 or S3. 2. Type C2. Client is reading a value from the device. The server can reply using type S2 or S3.   Table 6 describes the meaning of variable in commands and answers. The list of device names is in Table 7. Table 8 shows the type of request for the supply instrument. Table 9 shows the type of request for the voltmeter instrument.   It error occurs in command server will reply with type of answer S3. The type of error is described in Table 10.

33
Value out of range. Table 11 is example of communication between the client and server -where no problem occurs.

CONCLUSION
The remote-control measurement system was described in this paper. Students at the Czech Technical University use this model to learn and create a complete system for remote measurement. The measuring part of the system is based on the IEEE-488 interface bus by which the instruments are connected to the server. Overall the described system should be a model that student use during their work.
The system is based on the client-server communication topology. A TCP connection is applied to exchange information between the client and server application. The communication protocol was developed and described.
There were developed the server emulator application [2] for Microsoft Windows in LabWindows/CVI from National Instrument. It is an emulator of the system for remote measurement (server-side part). It helps students to develop their client application.