General purpose minicomputer data acquisition and control system

erful and flexible nature based on a single CAMAC crate/ controller combined with a PDP-11 computer has been as- sembled. As the software support the ...
0 downloads 0 Views 504KB Size
an empirical fitting parameter, y, can be generated by setting C,, = C,, for all values o f t . From the equality a t t = 0, it follows that (see Equations 7 and 10) ui

= 7Wi/(27r)1'2

(14)

where

form will find application in situations where an analytical expression for erf(x) is required. Some of the approximations are illustrated in Figure 1. The function [l (K/ 4 ~ ~ ) ] mis- a~first / ~ approximation of Equation 16 with y = 1. The more exact approximations cannot be discerned graphically and are compared numerically in Table I.

+

LIST O F SYMBOLS

y = mip/mig

B = fitting parameter in y = exp ( - B X C ) C = concentration a t time t (Equation 6) Ci = value of C at t = 0

while equating Equations 8 and 11yields

where

x = Wi/4(Dt)"2

(17)

As a first approximation, y can be set equal to unity, Le., equal masses (mi, = mi,) are assumed. This corresponds t o a previous application ( 3 ) .The actual dependence of y on X can be numerically determined and is shown in Figure 2. A suitable fitting function for this curve is exp(-EXC) where E and C are constants. A simultaneous nonlinear least squares fit on B and C in Equation 12, using a Marquardt-type algorithm (for a brief outline, see, e.g., ref. ( 4 ) ) ,yielded E = 0.3300977, C = 2.142997. For analytical purposes, C = 2 is a convenient choice for which the corresponding best value for B was found as E = 0.3331385. A comparison of the goodness of the fit is given in Table I and Figure 1. DISCUSSION I t is apparent from these results that increasing accuracy is paid for in terms of increasing functional complexity and a suitable compromise will be dictated by the demands of every specific situation. Generally speaking, the form erf(x) = (1

+ n-e-1/3x2/4x2)-1/2

appears to be surprisingly accurate and it is hoped that this

Ci, = Ci for a Gaussian input Ci, = Ci for a block input C,, = maximum of C for a Gaussian input C,, = maximum of C for a block input D = diffusion coefficient mi = input mass (or area of input distribution) mi, = mi for Gaussian input mip = mi for block input P ( x ) = normal probability integral t = time L U ~= width of block input X = convenient parameter (Equation 17) x = axial coordinate f = mean of distribution Greek

symbols

y = convenient fitting function (rni,/mi,) @(XI = Gaussian distribution function u = standard deviation

LITERATURE CITED (1) G. A. Korn and T. M. Korn, "Mathematical Handbook for Scientists and Engineers", McGraw-Hill. New York, 1961, p 564. (2) H. B. Dwight, "Tables of Integrals and Other Mathematical Data", Macmillan, New York, 1966, p 136. (3) K. De Clerk, T. S.Buys, and V. Pretorius. Separ. Sci., 6,759 (1971). (4) N. Draper and H. Smith, "Applied Regression Analysis", Wiley, New York, 1967.

RECEIVEDfor review March 24, 1975. Accepted October 6, 1975.

General Purpose Minicomputer Data Acquisition and Control System Based on CAMAC G. W. Bushnell, T. K. Davies, and A. D. Kirk' Department of Chemistry, University of Victoria, Victoria, B.C., Canada V8W 2 Y 2

S. K. P. Wong Academic Systems Services, University of Victoria, Victoria, B.C., Canada V8W 2Y2

A data acqulsition and control system of an extremely powerful and flexible nature based on a single CAMAC crate/ controller combined with a PDP-11 computer has been assembled. As the software support the BASIC interpreter has been modified to incorporate a set of CAMAC commands. The result is a total system which can be qulckly configured to a particular experimental situation, and then can be quickly programmed to run the experiment and collect data, using a high level, simple-to-learn, interactive language. Applications to time averaglng, kinetics by NMR, and automation of a four-circle x-ray diffractometer are described.

In the past few years, there have appeared a plethora of papers describing specific applications of computers to analytical and other data acquisition and control situations. Frequently, the systems have a dedicated minicomputer, which may consequently be under-utilized. Usually the interfacing is specific to the particular application and therefore of no general purpose use, and generally considerable time and/or cost is involved in software development. Furthermore, the cost per application of this approach is very high, although time-sharing and the advent of microcomputers provide alternative solutions to this problem, but ANALYTICAL CHEMISTRY, VOL. 48, NO. 3, MARCH 1976

587

’,

~

PDP-11 COMPUTER

~~

UNIBUS

/ / ’ / . ’

. _ _ ~ - -

i ’

ASR33 TELETYPE L

S

a

PAPER TAPE

H I G H SPEED PAPER TAPE

DL-1lE INTERFACE

CAMAC CRATE

a

CONTROLLER

[EMULATOR) I _____

GANDALF DRIVER _ __

IBM

370/ 145

Figure 1. System configuration

with attendant trade-offs in degree of sophistication required. In our laboratories, a number of different workers have experienced occasional requirements for data acquisition facilities to digitize spectra (fluorescence, absorption, NMR, etc.), carry out kinetic runs (NMR or absorbance), record mass spectral or chromatographic data, collect single crystal diffractometer data, etc. However, in most cases, the requirement has been sufficiently infrequent that the cost of automating the appropriate instrument has been neither justifiable nor have sufficient funds been available. In most such applications, data can usually be acquired a t low to medium speeds. Consequently, we set out to implement a relatively low-cost, general-purpose data acquisition and control system which would be flexible and could be programmed in a high level interactive language. The system was patterned after a NOVA/CAMAC system developed as part of the TRIUMF project ( I ) . A system similar, but less powerful, has recently been described in this journal ( 2 ) . Our requirement has been met by building both hardware and software flexibility into a small (single rack) system which can be wheeled to the various experimental locations. The hardware flexibility was obtained by the adoption of a single CAMAC crate and controller; the software flexibility by a modification of BASIC. One of the objects of this paper is to draw to the attention of chemists the existence and the virtues of the CAMAC standards. System H a r d w a r e Configuration. As shown in Figure 1, the system consists of a PDPll/lO-AC computer with 16K word memory, ASR 33 teleprinter, a REMEX PTE1300 high speed paper tape emulator (cassette tape), 2400 Baud line to the University’s IBM 370 computer (Digital Equipment Corp. DL11-E interface and Gandalf LDS 100 line driver), a CAMAC crate and power supply (Ortec 6401/6402), single crate controller (Ortec DCO11) and CAMAC modules. The computer and teleprinter are standard items. The line to the computer and the high-speed paper tape emulator are non-essential, but are great conveniences and provide greater speed capability through their more rapid output rates. Connection to the University computer is by telephone jack preserving the mobility of the system. The basic system cost was $14,300 exclusive of any CAMAC modules. Addition of the line ($900) and the paper tape emulator ($4000) raised the cost to $19,200. Beyond this it was necessary to acquire CAMAC modules; a dual-channel 12-bit analog to digital converter (Kinetic Systems-3520, $1,2001, eight-channel 10-bit digital to analog converter (Kinetic Systems-3110, $800), Dataway display unit (Standard Engineering-DD-001, $350), Real time clock including a preset counter (Ortec RC 014, $1000), Delayed Pulse Generator (Nuclear Enterprises 7045-1, $400), Fourfold Busy Done (Ortec CT021, $700), 24-bit driver/ 588

ANALYTICAL CHEMISTRY, VOL. 48, NO. 3, MARCH 1976

input gate (Nuclear Enterprises 9017, $350), Preset Counting Register (Nuclear Enterprises 7039-1, $400). These bring the total system cost to about $26,000, but provide a powerful set of modules to input or output analog or digital signals, control solenoids, drive stepping motors, read position encoders, time events, count pulses, sweep spectra, etc. Other modules are available to drive tape recorders or oscilloscopes and for many other purposes. The list of modules illustrates three of the advantages of CAMAC; first a great variety of modules is available, making systems powerful and flexible; second, one is not bound to a particular manufacturer once the initial crate and controller has been purchased; and third, the modules operate in a crate from a common power supply and dataway so that much unnecessary duplication of power supplies and specific interfaces is avoided. At this point, it is appropriate to describe the CAMAC (Computer Aided Measurement and Control) system in more detail. CAMAC is a mechanical, electrical, and dataway standard. I t was developed by nuclear physicists (8) to gain the advantages outlined in the previous paragraph. The system is being adopted in addition by medical scientists and astronomers but, so far, has come to the attention of only a few chemists. The CAMAC system is based upon a standardized crate with 25 stations wired for power and to a set of data lines. Except for the addition of the dataway it is superficially similar to a NIM crate. The stations accept single or multiple width modules such as clocks, scalers, A to D or D to A converters, etc. In a single crate system, stations number 24 and 25 are occupied by the crate controller/computer interface, while the remaining 23 are available for specific modules. Each station is serviced by a number of bus lines, power, a specific address line (N) by which the controller can address any module occupying that station, and a specific Look u t Me (LAM) line by which a module in that station can request service. The bus lines consist of 24 read lines, 24 write lines, 4 subaddress module lines (A) and 5 function code lines (F) and 9 status and internal control lines. In interacting with a module, the controller activates the particular station address line (N), a t the same time transmitting the desired F and A codes; any data are transferred in or out along the 24 read or write lines. Thus, the computer can instruct any subaddress on any module in the crate and receive from or send data to it. Because of the plug-in nature of the modules, the system is extremely flexible and it is a matter of minutes to hours depending on sophistication to set up or alter an experimental arrangement. Further detail on the operation of CAMAC, including information on function codes, can be obtained from publications of the ESONE committee (4, 5 ) . By way of illustration, Table I gives subaddress and function code information for some representative modules. Although a single CAMAC crate full of modules represents a formidable capability, very large installations can look to multicrate systems. The standard ESONE type U controller, a t somewhat greater cost, allows up to seven crates to be wired together. Addressing now takes the form CFNA where C is the crate number and the FNA is the standard code described above. Alternatively, more than one single crate/controller can be connected to the computer and, if the necessary software is available, used on a time-sharing basis. Software System. To complement the hardware flexibility described above, we wished to have similar flexibility in the software. Assembly language programming is tedious

Table I. Subaddress and Function Code Information for Representative Modules 0rtec.RC 014 Clock & F(16) A(0) Write value into preset counter Preset Counter (Elapsed time: 3.8 p e c F(28) A(0) Clear preset counter, start 18.2 hr) counting (Clock: 4 Hz 1 in 18.2 hr) F(0) A(0) Read preset (Preset count: 1 t o 234) counter Kinetic Systems 3520 F(0) A(X) Reads value held A to D Converter (0 to 1 0 V, + 5 V, or +10 V F(2) A(X) Reads and initiates a new reading on ranges. 25-psec acquisichannel X tion time) F(27) 4x1 Tests LAM status on channel X Read value held in Kinetic Systems 3110 F(O) channel X D to A Converter (settling time 200-300 lines), the time taken for FOR/NEXT loops or GO TO statements becomes prohibitively large. By changing over to one of the other versions of BASIC, significant speed gains are possible, as seen in the comparisons of Table 11. We are therefore presently incorporating the above software modifications into BASIC PTS. If only a teleprinter is available, this places severe restrictions on data acquisition rates, although small data sets can be stored in buffers a t the maximum rate. In addition, program loading is laborious and slow. Hence we have added the cassette tape high-speed paper tape emulator to significantly speed input and output operations (300 characters sec-l). Applications. In the relatively short time that the system has been available it has been used mainly for time averaging and kinetic measurements in conjunction with a modified Varian H.A. 60 NMR instrument. In the simple experimental arrangement required for both applications, the resonance signal derived from the phase sensitive detector of the H.A. 60 is input t o one channel of the two channel A to D converter. The output of one channel of the 8-channel D to A converter drives a voltage to frequency converter to scan the frequency spectrum in 1024 steps (4096 would be possible with a 12-bit D to A converter). The program for time-averaging scans sequentially the 1024 channels, reading the A to D and adding the result to the appropriate channel number. It is shown in Table 111, with remarks and input and output options deleted, and its ANALYTICAL CHEMISTRY, VOL. 48, NO. 3, MARCH 1976

589

Table 11. Speed Comparisona of DEC Versions of Single User Single User Modified 8-user (single user) BASIC PTS

BASIC

Program I

Program I1

Program I11

Program I V

134 (6.7 msec) 1 0 2 (5.1 msec) 23 (1.13 msec) 16.5 (0.83 msec)

162 (16.2 msec) 116 (11.6 msec) 38 (3.8 msec) 22 (2.2 msec)

525 (26 msec) 415 (20.5 msec) 245 (12 msec) 20.55 (11.5 msec)

1335 (66.5 msec) 1065 (53 msec) 765 (38 msec) 165 ( 8 msec)

Program 1

Program I1

Program I l l

Program I V

10 FOR X = 1 t o 20000 20 NEXT X

10 LET Y = 0 20 FOR X = 1 to 10000

10 FOR X = 1 t o 20000 20 LET Y = SIN(X) 30 NEXT X

1 0 FOR X = 1 t o 20000 20 LET Y = 2.5*X/5.0 30 LET Z = X + 2.7* Y 40 LET Z = X - Xl2.79 50 NEXT X

30 LETY

=

Y+X

40 NEXT X a Times

(in sec) are for execution of the given program, values in parentheses are per loop (in msec).

Table 111. Time Averaging by NMR Comment

Initialize CAMAC system DISABLE interrupt 2 CMLD: This command sends the value 0 to the D t o A converter in station 9. (Operator sets lowest frequency for scan). This command sends 999 (milli9 CMW 16,9,0, volts) t o the D t o A converter. 999: STOP: (Operator sets highest frequency for scan). Operator types in desired number 1 0 INPUT X; of scans from teletype. Accumulate X scans. 20 FOR S = 0 to X; Necessary as BASIC version only 45 FOR I = 0 t o 3: FOR J = 0 TO 249; supports a vector u p to 256, so 1000 channels must be a 4 X 250 55 LET V = 999 matrix (I*249 + J ) ; Move the NMR frequency t o the 60 CMW 16,9,0,V; value corresponding t o channel V. Initiating AID conversion in the 65 CMF 25,12,0; module at station 12. Read A/D, assign floating point 66 CMR 0,12,0,L; value to L Add measured L to appropriate 75 LET A(1,J) = channel A(1,J) + L; Continue until X scans 8 5 NEXT J: NEXT I: completed. NEXT S; 1 CMZ;

-

simplicity is readily apparent. The time-averaged spectra obtained are of the same quality as those from a Northern Scientific Time Averaging Computer. For kinetics, the CAMAC commands for control of the instrument and data collection are essentially the same. Instead of scanning all the spectrum, however, the program jumps to the desired peaks in the spectrum, collects data covering the peaks and the base line on either side of them, and then branches into a base-line correction Simpson's Rule integration program. The timing of data collection has so far made use of the computer timing itself, but the program can easily be modified to run the NMR data collection under control of the CAMAC clock. It is, of course, a simple programming matter to collect data a t non-equal time intervals. The peak areas obtained from proton and fluorine spectra by these procedures using 20 to 100 points for each peak and associated base line (depending on peak width) have so far had a reproducibility of about 2%, considerably superior to the instrument integrator specification of 5%. The kinetic study will be described in detail in a later publication (8). A very similar application which is being followed up is the time-averaging of weak fluorescence spectra, where now the wavelength scan involves outputting pulses t o a

590

ANALYTICAL CHEMISTRY, VOL. 48, NO. 3, MARCH 1976

stepping motor. Instrument modifications presently planned will enable the system to digitally record UV-visible and IR spectra; the system is also about to be used for the recording of mass spectra peak amplitudes and times. Such data can be used for the otherwise laborious task of obtaining exact masses (9) and relative peak heights. Our most ambitious undertaking is now well advanced, the automation of a Picker 2861-series, four-circle goniometer, x-ray diffraction system. For this application, the program is sufficiently large that Single User BASIC is inadequate in speed. Consequently BASIC PTS has been introduced and provided with a machine language subroutine t o provide fast stepping motor control, and CAMAC routines similar to those already described. The motor driving subroutine is specific for the Nuclear Enterprise Delayed Pulse Generator, a module which drives the four stepping motors simultaneously with the necessary acceleration and deceleration ramps. Peak scanning is done by alternate'counting periods and steps. Counts are accumulated in the N.E. 16bit counter gated by the Ortec real time clock, and transferred t o the computer a t the end of each counting period. Peak profile analysis is done for each reflection. The results are recorded on magnetic tape using the Remex cassette unit. The communication line to the IBM is to be used to pass the measurements over the computing center. This system will be described in detail in a later paper. In all these applications, once the initial development is completed, the computer can be moved to the site of a task, set up, and operating in 15 to 30 min. Because of its simplicity of operation, it will also be a useful teaching aid, and plans are afoot to design a few simple experiments for our senior undergraduate laboratories.

ACKNOWLEDGMENT The authors acknowledge the advice and encouragement of several members of the TRIUMF group, most notably T. Gathwright and Lyle Robertson.

LITERATURE CITED (1) D. A . LePatourel, R. R. Johnson, D. Marquardt, and D. Gurd, CAMAC

(1975). (3) L. Costrell, /E€€Trans. Nucl. Sci., NS-20, 3 (1973). (4) ESONE Committee, At. Energy Comm. Rep., TID-25875, Washington, D.C. (1972). (5) ESONE Committee, At. €nergy Comm. Rep., TID-25876, Washington, D.C. (1972). (6) H. Halling. K. Zwoll, and W. John, CAMACBull., 6, 21 (1973). (7) F. May, W. Marschik and H. Halling. CAMAC Bull., 6, 21 (1973). ( 8 ) E. A. Dixon, A. Fischer, and F. P. Robinson, Department of Chemistry, University of Victoria, Victoria, B.C., Canada, V8W 2Y2, to be published. (9) D. D. Tunnicliffe and P. A. Wadsworth. Shell Development Corporation, Emeryville. Calif. 94608, "Fortran programs HIRESI and H I R E S ~ . "

RECEIVEDfor review June 26, 1975. Accepted October 6, 1975.