S ecmchimica Acta. Vol. 4lB. No. 14, pp. El%%El% P&d in GreatBritain.
0%4-8547/92 ss.al + .a0 0 1992Pergamon PressLtd
1992
An electronic aid for line selection for scanning inductively coupled plasma atomic emission spectrometers* DOUGLASP. WEBB and ERIC D. SALIN? Department of Chemistry, McGill University, 801 Sherbrooke St. W., Montreal, P.Q., Canada H3A 2K6 (Received 18 May 1992; accepted 16 July 1992) Ah&act-This article is an electronic publication in Spectrochimicu Actu Electronica (SAE), the electronic section of Spectrochimica Actu Part B (SAB). Accompanying this hard copy text is a disk containing the program, source Ales, data files and a brief manual along with a few programming notes. The main article discusses the purpose of this work, and the Appendix provides brief instruction on the use of the program, manipulation of the data, and source code. An automatic file selection system for the control of a rapid scanning spectrometer performing atomic emission spectrometry has been developed using the PROLOG language. The system can be “taught” the elemental composition of a given sample type. It uses this information (when available) to generate a linear search strategy which minimizes the number of lines that need to be measured. The rules used by the system can be observed during system operation to allow a trace of the logic. Reading of the initial data base takes no more than 6 s and then decisions are made in less than 1 s pet line.
As MODERN analytical instrumentation increases in speed, power and (often) complexity, the level of expertise required of the operator can also increase dramatically. Fortunately, micro/mini computers are now embedded in, or connected to, most modem instrumentation, and these allow the instrument manufacturers to include operational expertise with every instrument. While these programs have generally minimized the mechanical expertise required of the operator, little has been done to assist the operator with data interpretation or make intelligent decisions on the use of these powerful new instruments. Over the last 44 years many of the “artificial intelligence” languages like PROLOG and LISP, have migrated from minicomputers and mainframes to affordable microcomputers. Simultaneously, the power of microcomputer systems has increased dramatically to the point where the speed of processing approaches that of the minicomputer of several years ago. These developments have led to the generation of this prototype line selection system for a rapid scan spectrometer. The expert system was developed in what has been described as a “Fifth Generation Language”, PROLOG, or more specifically Turbo PROLOG [l]. It has recently been updated to run on PDC PROLOG [2] which contains many of the features found in the CLOCKSIN and MELLISH [3] implementation of the language. As one advances upward from machine code programming, to assembler level programming through the “higher level” languages of C, BASIC, FORTRAN, Pascal, and APL which are used in the scientific community, one finds that each level generally requires less programming to carry out a specific task. Eventually, of course, all instructions are converted to machine code before execution, but the higher level languages offer ease of use to the * This article is an electronic publication in Spectrochimica Acta Electronica (SAE), the electronic section of Spectrochimica Acru Part B (SAB). The accompanying disk is identified as “Line Selection Aid for ICP-AES”, Spectrochimica Acta Electronica 47X3,E1587-El594 (1992). Readers of this journal ate permitted to copy the contents of the disk for their personal use. Note “Copyright and Disclaimer” at the end of the article, and section 8 of the manual, and generally, the “Instructions for Authors”, published elsewhere in this issue. P Author to whom correspondence should be addressed. El587
El588
D. P. WEBBand E. D.
SALIN
programmer, and this usually turns into a faster completion of the programming assignment. PROLOG offers distinct advantages over other languages for the solution of many problem types. Its name means PROgramming in LOGic. The specific type of logic used is a subset of predicate calculus. PROLOG searches through its set of facts and rules (relationships) to ascertain whether a given statement (the goal) is logically true, so PROLOG is ideal for solving problems which can be reduced to predicate calculus-like logical constructs. For this reason PROLOG is ideal for theorem proving. PROLOG offers a number of advantages over traditional high level languages. The first advantage is that PROLOG has a built-in search strategy called “backward chaining” [4]. PROLOG also provides powerful database management tools and pattern matching capabilities. As with all programming languages, if a capability is desired which is not an integral part of PROLOG, it can be added explicitly by the programmer. PROLOG has been used extensively in computer science and cognitive science, though its applications to date in chemistry have been limited. In this area, PROLOG has been applied to pattern recognition problems [5], IR spectrometry [6, 71, synthesis methodology recommendations [8], and chromatographic separation enhancement [9]. Since it is a logic based language, rather than the traditional procedural type of language, it is not surprising that it has been used to reason about chemical systems [lo, 111. Many expert systems have been developed in other languages. While these cover a wide variety of topics, several are particularly noteworthy in the context of this paper. BRUNNEEet al. [12] and WONGand CRAWFORD [13] reported an expert system developed in LISP for the control of a mass spectrometer, another form of rapid scanning instrument, and FIELDENet al. [14] described an expert system for use in electroanalysis. It should also be mentioned that there is a growing body of work on process control and fault diagnosis using expert systems [15].
DESIGN CONSIDERATIONS Those interested in an in depth examination of the ration d’&e for this work are referred to our previous work [ 161. However, a brief recap will be presented here. One popular type of inductively coupled plasma (ICP) spectrometer currently available is the sequential scanning system. These spectrometers can access, in any order desired, any emission line in a broad wavelength range sometimes extending from 170 to about 600 nm. Most of these spectrometer systems come with software which will automatically select the wavelength that should allow determination of the concentration of any given element. The problem with these systems is that they do not adapt to situations where the best spectral line is overlapped by a line from another element in the sample matrix. They also tend to be limited in the number of lines that they recommend as potentially useful to the operator. A skilled and knowledgeable instrument operator might be able to resolve a spectral overlap problem with a comprehensive table of spectral lines and sufficient time; however, a loss of throughput would result. Our work focused on automating the process of selecting the spectral line that is most likely to give useful results. Many instruments now have a software facility (semi-quantitative scan) for rapidly examining prominent elemental lines for many of the elements that ICP spectrometers are used to determine. This information is usually only semi-quantitative in nature. However, this information can be used to estimate which lines can be expected to appear in intensities that will be detectable. This information can be used to select spectral lines for each element which are least likely to be overlapped. Figure 1 contains a partial flow chart of the logic path. LINEX was designed to be independent of any specific instrument, and therefore it does not have the capability to directly read semi-quantitative information. However, it has a facility which allows the creation of a template which simulates this capability. This capability has been described previously [16], and is examined in some detail in Section A.4 of the Appendix.
l&r
m-ettempt
saveelementfor
Fetlum.
Fig. 1. Flow chart of the logic path.
(Below the detectionlimit)
i
1:s ratio une*tad ?
El590
D. P. WEBBand E. D. SALIN
PROGRAM LOGIC There is only one possibility for analysis by LINEX: Partial Search. The Partial Search involves the use of a template as described above. The bandpass of the spectrometer is an input parameter. This allows the emulation of a variety of spectrometers. Set-up of the template and resolution is accomplished in a windowed environment. Simulated spectrometer operation results in the appearance of two windows. One window is the “operator” interface, which allows the operator to trace program progress and record results. The second window is a mock’ instrument interface, which allows the user to simulate instrument response. The expert system tells the instrument (instrument interface) which wavelength to seek, and the instrument (instrument interface) is expected to respond with a background corrected intensity. This intensity and all previous intensities are used in conjunction with the template information to make decisions about which wavelength should be accessed next.
RESULTS AND DISCUSSION
The program was relatively easy to implement given that it took only about 250 h of programmer time. It has conveniently combined heuristics with the simple arithmetic necessary for the spectral strip and concentration calculations. The use of a language, rather than an expert system shell, has provided the flexibility necessary to do a task that might be inconvenient or impossible for a software package not designed for instrument control. The use of a language founded in logic has allowed the program to be easily structured in a logical manner. This was much more efficient than generating similar logical structures in a language not specifically designed for the purpose. The developmental process was dominated by the concern “how would an expert do it?” rather than the concern “how can this be conveniently programmed?” The logical structure has aided the debugging process significantly. The powerful database features of PROLOG have eliminated or drastically reduced database organization requirements, thereby minimizing one of the major time consumers in a programming task of this type. It is hoped that this will serve as a cornerstone of what will someday be fully automated scanning spectrometers which will self-calibrate, self-optimize, diagnose hardware problems, and initiate analytical methodologies when necessary. The real time response is adequate for many experiments, and the relative ease of implementing the system in PROLOG makes apparently difficult logic based problems much more feasible. Acknowledgements-The authors would like to acknowledge the initial prototyping work done by LISA KERR. The authors thank the Canadian Natural Sciences and Engineering Research Council for support under OPG 1126. D. P. W. acknowledges scholarship support from the Province of Quebec FCAR program. The authors would like to thank Prof. P. W. J. M. BOUMANSfor his keen insight and editorial assistance.
REFERENCES Turbo PROLOG Owner’s Handbook. Borland International, Scotts Valley, U.S.A. (1986). PDP PROLOG User’s Guide. Prolog Development Center, Copenhagen, Denmark (1990). W. F. Clocksin and C. S. Mellish, Programming in PROLOG. Springer, Berlin (1981). A. R. de Monchy, A. R. Forster, J. R. Arretteig, L. Le and S. N. Deming, Anal. Chem. 60, 1355 (1988). (51 G. J. KIeywegt and H. A. Van? Klooster, Trends Anal. Chem. 6, 55 (1987). [6] G. L. Postma, B. G. M. Vandeginste, C. J. G. Van Halen and G. Kateman, Trends Anal. Chem. 6, 27 (1987). [7] H. J. Luinge, G. J. Kleywegt, H. A. Van’t Klooster and J. H. Van der Maas, J. Chem. If. Comput. Sci. 27, 95 (1987). [8] C. W. Moseley, W. D. LaRoe and C. T. Hemphill, ACS Symp. Ser. 306, 231 (1986). [9] H. Gunasingham, B. Srinivasan and A. L. Ananda, Anal. Chim. Acru 182, 193 (1986). (lo] A. LyaII, P. Hammond, D. Brough and D. Glover, Nucleic Acids Res. 12, 633 (1984). [l] [2] [3] [4]
Line selection aid for scanning ICP-AE spectrometers [ll] [12] [13] [14] [15] [16]
61591
F. Darvas, I. Futo and P. Szeredi, ht. J. Bio-Med. Comput. 9, 259 (1978). C. Brunnee, G. Jung, U. Markwardt,R. Pesch and H. WoUnik, Am. L.ab. 18, 1M (1986). C. M. Wong and R. W. Crawford,Znr.J. Mass Spectrom. Ion Process. 60, 107 (1984). P. R. Fielden, R. N. Carr and C. F. Oduoza, Anal. Ckm. Symp. Ser. 25, 55 (1986). F. W. Goff, Proc. R&n. Dep. Am. Pet. Inst. 65, 481 (1986). D. P. Webb and E. D. Salin, J. Anal. At. Spectrom. 4, 793 (1989).
APPENDIX A.l. Technical information (cf. Table 1)
The program was originally written in Turbo PROLOG and has been updated so that it is fully compatible with Turbo PROLOG’s successor: PDC PROLOG. The program is available in compiled form, and portions of the source code which are not copyrighted by Borland International are also supplied, as are the object files derived from copyrighted material which are necessary to compile the program. The data files are ASCII files (see Section A.2). The manual consists of text file, available as both ASCII and Word for Windows 2.0 files (see Section A.2). This material is stored on one diskette (1.44 MB), designated as “disk no. 3”. The program is operational on IBM compatible personal computers and has been tested on an SOS6Zenith ZlSO laptop (640 K RAM, no hard disk, 2-720 K floppy drives), an SO286AST 14OR (640 K RAM, 40 Mb hard disk), and 3 different 803S6DX based IBM clones. No math coprocessor is required to run this program. The program will run on a CGA, EGA, VGA or Hercules compatible video system, and requires DOS 2.11 or higher. Section 4 of the manual provides instructions for running the program. In brief, the program can be run directly from disk no. 3. In the root directory of disk no. 3, there is a subdirectory called LINEX. If currently at the DOS prompt in this subdirectory, the program can be run by typing GEN3 followed by (Enter). A.2. Diskette contents: directories and fires (1) LINEX is the directory containing the program (GEN3.EXB), and the supporting data flies FULL2.LIN and SCALIB.DTA (which are described further in the manual), and the informational files LINSET.ALP and LINSET.SRT and the public domain program TYPERITBEXB, which is used to view the two LINSET.“’ text files. There is a subdirectory to the LINEX directory called TEMPLATE. This directory contains filter templates used by the program. (2) MANUAL contains two versions of the manual in two subdirectories: ASCII and WINWORD, each of which contains a copy of the manual. The difference is in the format of the files: ASCII files (with extension +.ASC) and Word for Windows 2.0 files (with extension *.DOC). Additionally, the figure used in the manual is stored in an encapsulated PostScript file in the EPS subdirectory. (3) SOURCE contains the PROLOG source code for the public domain portions of the program, and *.OBJ files for the code that is copyrighted by Borland International, and for which the source code cannot be released. Table 1. Hardwareand software Computer: AST Model 140R (IBM-PC AT type) CPU: 80286 (10 MI-B) NPU: 80287 (10 MHZ) Memory: 1 MByte no wait state memory (10 MHz) Mass Storage Used: Software: Turbo PROLOG Vl. 1. PDC PROLOG V3.2
AST Research Inc., Irvine, CA, U.S.A.
40 MByte Winchester rigid disk, with 28 ms average access time. Borland International, Scotts Valley, CA, U.S.A. Prolog Development Center, Atlanta, GA, U.S.A.
El592
D. P.
WEBB
and E. D.
SALIN
A.3. Getting started The main menu will be encountered if “GEN3” followed by the (Enter) key are typed at the DOS prompt. Options are selected by moving the highlight bar, using the left and right arrow keys, and then pressing (Enter). Alternately a shortcut for selecting the desired option is to type the highlighted first letter of the option desired. Below is a list of the main menu options, along with a brief explanation of each. (a) Comments. This was to be a place to put in a description of the program and its objectives. It has been left only as a greeting. (b) Thresholds. Allows the operator to define filters which reduce the number of spectral lines that the program must work with, thereby increasing overall spectral analysis speed. (c) Band pass. This permits the users to override the default band pass of 0.1 nm. The band pass remains invariant unless changed. Note that based on geometric arguments (described in Section 4.1.3 of the manual), lines are considered to be overlapping if their wavelengths are separated by less than two times the bandpass. (d) View linebase. This option allows the operator to examine the current line data base. Two forms of the data base can be examined, either sorted alphabetically by element, or sorted by wavelength. (e) Sample analysis. This portion of the program allows the operator to select elements interest (under “partial search”) and then run a simulated atomic analysis.
of
A.4. Option “Threshold? and its submenu Selection of “Thresholds” causes a submenu to appear and the options are selected by either scrolling the highlight bar with the up and down arrows and then pressing enter when the desired selection is highlighted, or by pressing the highlighted first letter of the choice desired as a shortcut. Load. This option pops up a further submenu which allows the selection of a filter template to be used by the program. The template is used to prune the data base of analytical lines, and thereby speed up program operation, and improve the chance of finding satisfactory spectral lines for analysis of the desired elements. Several sample templates are provided, but user defined templates may also be selected. There is also an option to disable the use of filter templates (this is the default course of action). Build. This option pops up a further submenu, which allows new templates to be built, and the additions to be saved to disk for future use. Building a template does not cause it to be used; filter templates must be explicitly loaded. View/edit. This option pops up a further submenu which allows existing templates to be viewed/edited or deleted entirely. Viewing/editing a template does not cause it to be used; filter templates must be explicitly loaded. A.5 Option “Sample analysis” When this option is selected, a single submenu option is presented called “partial search”. If partial search is selected (by pressing (Enter)) a submenu will appear which will allow the creation of a list of elements to be determined. Once the list is made, then the list of calibration data and the spectra1 lines are read in from disk. If a filter template has been loaded then the line filtering is done as the lines are read from disk. Then the simulated analysis can begin. Simulated analysis. When the analysis portion of the program is entered, there is an. option to have everything the program does printed to an attached line printer (or other compatible printer). This is instructive for following the program’s thought process. The screen is split into two windows, the top window, titled “user interface”, gives periodic updates as to what information has been discerned thus far (if tracing is enabled, this information will appear on the printout with the rest of the program’s thought process). The lower window, titled “machine interface” is a simulated link to instrumental hardware, and the operator is queried for the intensity of the spectral line that LINEX thinks currently has the most useful information. The operator must type in a line intensity (any real number, not in scientific notation) when prompted. The machine interface’ is repeatedly queried for line intensities until all elements have been determined, then the program will print out the results, and return to the main menu. It should be noted that this implementation of the program is fairly unsophisticated in its handling of problems not readily solvable using its predefined rules: it gives up.
El593
Line selection aid for scanning ICP-AE spectrometers NOW MVESTIGATING
l******> Cd
EX:
Rufe(2) - We must look to see il Cd%most Intanse unto dfracf$ &x&ate the ~~antm~~n of Cd. ]A]
MI:
Look for Cd’s line at wavelength 326.iO6. What Is the lnfensky? (0.0 for no line) 0
EX:
Rule(O)- We must look for Cd’s most intense line. If nothing is scan then wa know that the concentration of Cd is below the detectable limit.[B]
MI:
Look for Cd’s line at wavelength 214.436. Whet is the intensity (0.0 for no line) 36
EX:
Ruls(4) - We must lo& for Cd% 2nd mast intense line and t the measured ratio between lines 1 6 2 are CompsraMeto the documented vefues then it is assumed that neftfwr line is interfered wlh and the concentration of Cd can bQ calculated directly Irom the lntensily of line 1.[C]
line Is present, b&use
f! II is, then we can
MI:
Look for Cd’s line at WaVQlQnplh
EX:
Rule@) - Line1 was ~fin6el~inted~. with, line 2 may not have been. Look for Cd’s 3rd most intense line and X the 2:3 intensify ratio is comparable to know values, then. as previously fndicatod, the ~~nfrat~n ol Cd ten be determkwd.[D]
MI: EX:
Look for Cd’s line al wavelength 226.502. What is the intensity (0.0 for no line) 12 Rule(S) - Direct measurements, and ratios have failed therefore an attempt will be made to strip away a iingle element which overlaps CdJq
EX: Ex:
- - STRIP - - Affempf
226.602. What is the Intensity (0.0 for no line) 24
to discern concentration of Te so wa can strip ff from and overlap with Cd.]fl
RuleQf . We must look to see if Te’s most intense unotxstructedline is present, becaus8 directly calculate the concantratkxt of Te.[A]
MI:
Look for Te’s line at WaVQlQflglh
EX:
The concentration of TQ is known to be 12.66 ppm
EX:
if il
is then we can
225.902,. What is the intensily (0.0 lor no line) 3
EX:
Rule(l0) - Cdisinterfered wkb So the intensity of the intetferad with fine must be measured so the strtp can be done. Te intederes with Cd at wa~l~b 226.602.[0] Cd’s fiie et 226.502 nm has already been measured. The concenlration of Cd is known to be 15.699 pprn.[t(l
18
12.66 ppm [I]
Cd
15.699 ppm
Fig. 2. Printout of a sample session with LINEX. This example is a determination of Cd using a full data base (i.e. no template, band pass = 0.05 nm). EX is the explanation facility information. MI is the machine interface information and includes wavelength selection information requests for input (observed intensity). Operator input is in bold italics. At the end of the operation the goal is reached and the searched for concentration (Cd) is printed ant with those determined incidentally (Te). This example iliustrates one possible path through the flow chart in Fig. 1. The approximate location in the flow chart (Fig. 1) is marked with the character in the brackets.
Figure 2 contains a sample interaction between the expert system and the machine interface (which is simulated by the user). Table 2 contains a list of the spectral lines pertinent to the example. A.6 LINEX and spectral line data bases The spectral line data base used by LINEX was devised for demonstration purposes only. It contains less than 900 spectral lines, and is by no means comprehensive. This data base does, however, serve to illustrate the principles of the system. Table 2. Cd lines and interferences Cd lines in order of intensity
Relative intensity
in the example data base
Interfere&
214.438 nm
1.0
_J? 214.423 nm Sb 214.486 nm
228.802 nm
0.926
As 228.812 nm Re 228.751 nm Rh 228.857 nm
226.502 nm
0.735
Te 226.555 nm
361.051 nm
0.0109
Pd 360.955 nm Y 361.105 nm
326.106 nm
0.0075
No interferent
*These interferents lines.
are based on our data base of only 847
El594
D. P. Wms and E. D.
SALIN
Present-day spectrometers may have a bandpass of 0.01 nm. If such a bandpass is selected when using LINEX, few spectral overlaps will occur. This does not reflect reality in many regions of the electromagnetic spectrum emitted from an ICP. It is possible to extend the spectral line data base so that it does better reflect reality, and the procedure for doing so is described in Section 6 of the manual. Copyright The program, the data files, the source code, the manual, and the hard copy text, in their totality published as a paper in Spectrochimicu ACM Electronicu, are copyrighted by the Authors. Readers of Spectrochimica Acta Electronica, are permitted by the Publisher, Pergamon Press, to make a copy of the material on the disk for their own private, noncommercial use, and to run the program according to the instructions provided by the Authors. No charge for any copies may be requested, neither may the program nor any modified version of it be sold or used for commercial purposes. Those who wish to use the program and data files in a commercial environment should contact the corresponding Author at the address given in the hard copy paper. Di8chlhner
Neither the Authors nor the Publisher warrant that the program is free from defects, that it operates as designated, or that the documentation is accurate. Neither the Authors nor the Publisher are liable for any damage of whatever kind sustained through copying the disk(s) and/or using the program and the data files. By copying and/or using the program the reader of Spectrochimica Acta Electronica, acting as a user of an electronic publication therein, agrees to the above terms and conditions.