Method of calibrating and linearizing the output of fluid measuring instruments
BACKGROUND OF THE INVENTION 
     The present invention relates to fluid measuring instruments and is directed more particularly to a method of calibrating and linearizing the outputs of fluid measuring instruments which utilize transducers that have nonlinear responses. 
     In measuring the magnitude of a property of a fluid, such as the concentration or partial pressure of a component of interest, it is often necessary to utilize a transducer which has a nonlinear response. In non-dispersive infrared analyzers, for example, the concentration of a gas of interest is measured by means of a gas filled cell, commonly known as a Luft detector, which is illuminated by an infrared source through a sample cell that contains a gas of unknown composition. In such analyzers, the output of the Luft detector is an exponential (Beer&#39;s Law) function of the concentration of the gas of interest in the sample cell. Similar nonlinear responses are, however, exhibited by the transducers used in many other types of instruments, such as those which measure the temperature of a gas, the pH of a liquid, etc. 
     The nonlinearity of the response of many types of transducers creates a number of problems for the instruments in which they are used. One of these problems is that the nonlinearity prevents the property of interest from being determined by simply ratioing the output produced by the transducer during exposure to a sample fluid to the output produced by that transducer during exposure to a calibration fluid. This is because ratioing is a linear process and cannot therefore readily be used with nonlinear functions. Another of these problems is the loss of resolution that results from directly displaying the outputs of nonlinear transducers. Using a nonlinear display, for example, causes the resolution of the instrument to be greater at one end of the display range than at the other. Using a nonlinear display also introduces the inconvenience of having to interpolate between scale divisions of variable spacings. 
     The above-described problems are often dealt with by making use of linearization circuits. Analog linearization circuits, for example, make use of the nonlinear response of an analog circuit to compensate for the nonlinear response of the transducers with which they are used. Digital linearizing circuits make use of the mathematical processing ability of computerized instruments to solve equations which compensate for the nonlinear response of the detectors with which they are used. Linearizing circuits of the latter type can also operate by referencing look-up tables which are constructed from the equations to be solved. 
     While the above-mentioned types of linearizing circuits can operate with a moderate degree of accuracy, they can also introduce significant errors into the displayed outputs of the instruments with which they are used. These errors result from the fact that particular transducers often have nonlinear responses which differ from that of the typical transducer for which the linearizing circuit was designed. Such differences can, for example, result from differences in the sensitivity (or gain) of various transducers, or from differences in their zero responses or offsets. Such differences can also arise in a single transducer as its response changes with time, the accumulation of dirt deposits, etc. These differences produce errors by causing linearizing circuits to over- or under-correct for the response of the particular transducers with which they are used. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention there is provided an improved method for calibrating and linearizing the outputs of an instrument that uses nonlinear transducers which is not subject to the above-described problems and errors. 
     Generally speaking, the method of the present invention contemplates the production of two multi-term (preferably polynomial) equations which define the nonlinear response of a typical transducer of the type to be used in the instrument, the taking of measurements which determine the relationship between the response of the particular transducer to be used in the instrument and that of the typical transducer, and the utilization of the determined relationship and the equations to calibrate and linearize the output of the instrument. The use of this method assures the availability, at each calibration, of a linearizing function which accurately reflects the response of the particular transducer in its then current condition. The utilization of this linearizing function during both the calibration of the instrument and the making of measurements thereby, allows measurements upon the unknown fluid to be referenced to the result of calibration, without regard to the nonlinearity of the transducer response. An instrument which utilizes the calibration and linearization method of the invention is therefore able to provide accurate measurements with any of a variety of different transducers or with a transducer having a response which changes with time. 
     One particularly advantageous feature of the method of the invention is that it utilizes equations which describe the response of the transducer in two different ways. More particularly, the response of the transducer is described both in terms of a first equation which gives the output of the transducer as a function of the magnitude of the property of interest, and in terms of a second equation which gives the magnitude of the property of interest as a function of the output of the transducer. Because both of these equations represent the same response, they may be used interchangeably during the course of the calibration and linearization process. Each stage of the latter process may therefore use whichever equation most easily provides the information that is needed during that stage. 
     The availability of two different equations which describe the response of the transducer also makes it possible to determine the magnitude of the property of interest from the transducer output, or vice versa, without having to solve either equation for its roots. Since third and higher order equations may be evaluated much more easily than they may be solved, the practice of the invention provides its benefits without placing a high signal processing burden on the instrument. As a result, the nonlinear response of the transducer may be represented by equations having orders higher than those which could be used heretofore. This, in turn, makes possible the use of equations which more accurately represent the response of the transducer, thereby providing a more accurate linearization. 
     In the preferred embodiment, the method of the present invention also contemplates the determination and use of a scaling factor which assures that the maximum output of the nonlinear transducer does not cause the maximum signal processing capacity of the instrument to be exceeded. This scaling factor assures that the instrument is able to modify its use of the equations so as to provide the highest possible output resolution. The use of this scaling factor therefore makes it possible to service or replace a transducer without adversely affecting the resolution of the instrument in which it is used. 
    
    
     DESCRIPTION OF THE DRAWINGS 
     Other objects and advantages of the present invention will be apparent from the following description and drawingss in which: 
     FIG. 1 is a block diagram of one type of instrument that is suitable for use in practicing the method of the present invention; 
     FIGS. 2a and 2b comprise two graphical and mathematical representations of the response of the transducer used in the instrument of FIG. 1; 
     FIG. 3 is a flow chart which depicts the computer executable parts of the method of the present invention; and 
     FIG. 4 is a partial flow chart which depicts an alternative computer executable part of the method of the invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring to FIG. 1, there is shown a block diagram of a typical instrument of a type which is suitable for use in practicing the method of the invention. In FIG. 1 the instrument is of the type which measures the concentration (or partial pressure) of one gas in another by measuring the quantity of infrared radiation that is absorbed by the gas of interest as it flows through a sample cell that is illuminated by an infrared source of known intensity. Instruments of this type are commonly referred to as non-dispersive infrared analyzers. In general, however, the method of the invention may be applied to any instrument in which the magnitude of a property of interest of a fluid is measured by a transducer that has a nonlinear response to that property. 
     The analyzer of FIG. 1 includes a sample cell 10 for conducting a flow of the gas upon which measurements are to be made. As the gas flows through the sample cell, a beam of infrared radiation from a source (not shown) is transmitted therethrough through windows which are transparent to the portion of the infrared spectrum that is being used for the measurement. The quantity of radiation that is not absorbed by the gas of interest within the sample cell is measured by means of a suitable infrared transducer 12 which may comprise a Luft detector. The output of this detector is preferably demodulated and digitized in a signal interface board 14 before being communicated to a suitable digital computer 16 for further processing and/or for display on a human readable display 18. 
     In order to assure that the instrument accurately measures the concentration of the gas of interest, it is necessary to calibrate the instrument by measuring its response to the flow of a gas having none of the gas of interest (zero gas) and a gas having a known non-zero concentration of the gas of interest (standard or calibration gas). These gases are applied to the sample cell through a set of valves 20 which are controlled by computer 16 through a suitable valve driver board 22. Computer 16 also operates through valve driver board 22 and valve set 20 to control the flow of the unknown or sample gas through sample cell 10 after the calibration process has been completed. The sequence in which the valves of valve set 20 are operated, and the manner in which the output of transducer is received and processed are controlled by computer 16 in accordance with its stored program. A flow chart for the program by which computer 16 controls the operation of devices 10-22 in order to achieve the objectives of the invention will be described later in connection with FIGS. 3 and 4. 
     Computer 16 may comprise a conventional single board digital microcomputer of any of a variety of types. This computer includes a central processing unit or CPU 24 for performing sequencing and data processing operations, a read-only memory or ROM 26 for storing the program to be executed by CPU 24 and a read-write memory or RAM 28 for storing intermediate results and changeable program values and addresses. CPU 24 communicates with ROM 26, RAM 28 and the external devices with which it operates through a bidirectional multi-bit data/address bus 30. CPU 24 may also, however, communicate directly with certain peripheral devices, such as an operator keyboard 32, if it is provided with a port through which it can interface with such external devices. Because the internal structure and operation of a computer of the type shown in FIG. 1 is well known to those skilled in the art, it will not be described in detail herein. 
     As is well known, there is a nonlinear relationship between the output of an infrared transducer, such as Luft detector 12 of FIG. 1, and the concentration of the gas of interest within the associated sample cell. The nonlinearity of this response is illustrated by the curves shown in FIGS. 2a and 2b. In FIG. 2a this response is plotted in terms of the demodulated, digitized output voltage V of transducer 12 (expressed in digital counts) as a function of the concentration C of the gas of interest within the sample cell (expressed as a %). In FIG. 2b this nonlinear response is plotted in terms of the concentration C of the gas of interest as a function of the demodulated, digitized output voltage V of transducer 12. For the sake of convenience, a response curve of the type shown in FIG. 2a will be referred to as defining the direct (or forward) response of the transducer, and a response curve of the type shown in FIG. 2b will be referred to as defining the inverse (or reverse) response of the transducer. As will be explained more fully presently, the method of the present invention makes use of both of the direct and inverse response characteristics of the transducer in calibrating the instrument and linearizing data produced thereby. 
     Because of normal manufacturing variations in the dimensions and compositions of different infrared transducers, the response of a particular transducer may be different from the response shown in FIGS. 2a and 2b. A particular transducer may, for example, have a sensitivity or gain which causes its output to be greater or less than that shown in FIG. 2a for a given concentration of the gas of interest, and/or a response which does not pass through the zero of the axis system. Because of the broad similarity of the responses of transducers of the same type, however, it is possible to define the response of a particular transducer in terms of (i) the response of a typical transducer, and (ii) the relationship between the response of a particular transducer and that of the typical transducer. In accordance with the present invention, there is provided a method which determines items (i) and (ii) and then uses the same to calibrate the instrument for operation with the particular transducer. After calibration, these items are used further to linearize the output of the particular transducer and thereby provide an instrument output of improved accuracy and repeatability. 
     In providing the above-mentioned advantages, the method of the invention contemplates the performance of the following steps. Firstly, there is produced a first equation which gives the direct response of a typical transducer of the type that is to be used in the instrument. In the course of performing this step, a series of measurements are performed on a plurality of representative (randomly selected) transducers of a type that are to be used in the instrument. This series of measurements is preferably made by applying to each of the plurality of transducers a sequence of gases having known concentrations of the gas of interest, and measuring the output voltages (counts) that are associated with those concentrations. After measurements have been performed on a sufficient number of transducers, the resulting data are plotted on the axes shown in FIG. 2a. Once this has been done, an equation that represents, or is characteristic of, the response or output of a typical transducer may be produced by fitting a selected type of curve to the plotted points. In the preferred embodiment, the selected type of curve is a polynomial equation of the type shown in FIG. 2a. The fitting of this curve is accomplished by selecting the value of n to be used in the equation, i.e., selecting the order of the equation, and then calculating the values of the coefficients such as &#34;A n  &#34; which minimize the difference between the curve representing the equation from the plotted points. Since such curve fitting procedures are well known to those skilled in the art, the application thereof will not be described in detail herein. 
     The next step in the practice of the method of the invention comprises the production of a second equation which gives the inverse response of a typical transducer of the type that is to be used in the instrument. This equation, the form of which is shown in FIG. 2b, may be produced in generally the same manner as the equation of FIG. 2a. More particularly, the equation may be produced by plotting the measured sets of points on the axes of FIG. 2b, and by fitting a selected type of curve to the plotted points using a conventional curve fitting technique. As is suggested by the use of different subscripts n and m in the equations of FIGS. 2a and 2b, both the coefficients and the exponents in the inverse response equation will ordinarily be different from those of the direct response equation. With one commonly used infrared transducer, for example, a third order (m=3) polynomial equation has been found adequate to represent the inverse response shown in FIG. 2b, but a fourth order (n=4) polynomial equation has been found necessary to adequately represent the direct response shown in FIG. 2a. 
     The production of equations which represent both the direct and inverse response characteristics of a typical transducer greatly facilitates the signal processing which is incident to the performance of the remaining steps of the method of the invention. This is because the availability of both equations makes it possible to determine either (a) the transducer output which corresponds to a given concentration of the component of interest, or (b) the concentration of the component of interest which corresponds to a given transducer output, without having to solve either of the two equations for its roots. Stated differently, the transducer output which corresponds to a given concentration of the gas of interest, or the concentration which corresponds to a given transducer output may be determined by merely substituting the available one of these variables into the appropriate one of the two equations, and then evaluating that equation by multiplying out and adding together its various terms. Moreover, since both equations represent the response of the same transducer, they may be utilized interchangeably at vraious stages of the calibration and linearization processes, depending upon which equation then most conveniently provides the information that is needed from the information that is then available. The reasons why it is desirable to use different equations at different stages of the calibration and linearization process will be apparent from the following description of the manner in which the method of the invention makes use of the equations of FIGS. 2a and 2b. 
     Once the equations which give the direct and inverse response characteristics of a typical detector have been produced, they are made available to the instrument by storing them within computer 16. If the instrument is used with only a single type of transducer, this may be accomplished by storing the two equations for that type of transducer in ROM 26. If, however, the instrument is to be utilized with different types of transducers, the equations for those types of transducers may be entered via keyboard 32 and stored in RAM 28. Once these equations are stored in the computer, the remainder of the method of the invention may be practiced by causing the computer to execute the program depicted in FIG. 3. 
     Upon beginning the execution of the program shown in FIG. 3, the computer first encounters a block 40 which causes it to read the known concentration value C s1  of the standard gas which will later be applied to the sample cell through valve set 20. If the instrument is always used with a standard gas of the same concentration, this concentration may be permanently stored in ROM 26. Alternatively, if the instrument is to be used with standard gases having a variety of different concentration values (e.g., values which depend upon the type of transducer being used), the concentration of the standard gas may be entered by the operator via keyboard 32. 
     After completing the operation called for by block 40, the computer proceeds to a block 42 which causes it to apply a suitable zero gas to sample cell 10 and read the resulting output V O  of transducer 12. The result of the performance of this step is the determination of the value of any offset or zero offest between the output of transducer 12 and the output of a typical transducer of its type. By determining this zero offset, the computer makes available to itself one of the two quantities that are needed in order to correct for differences between the actual response of transducer 12 and the estimated response thereof that is predicted by the two stored equations. The ability of the computer to correct for a zero offset also makes it possible to correct for any DC bias which is introduced by the circuitry of interface board 14. Such a DC bias may, for example, be desirable to assure that the A/D converter need not handle both positive and negative signal voltages. 
     After determining the offset of the transducer, the computer proceeds to a block 44. Upon encountering this block, the computer is directed to apply the standard gas to the sample cell, and to read the actual transducer output signal V SA  which is associated with the standard gas. Thereafter, upon encountering block 46, the computer is directed to substitute the known concentration C S1  of the standard gas into the direct transfer function equation (FIG. 2a) and evaluate the same in order to determine the calculated or estimated transducer output signal V SE  which is associated with the standard gas. 
     Once both the actual and estimated transducer output signals are available, the computer proceeds via block 48 to determine the relative sensitivity of the particular transducer, i.e., its sensitivity with respect to that of the typical transducer. This is done by calculating the ratio K of the estimated transducer output signal to the actual transducer output signal, after the latter has been corrected for offset voltage V O . By determining the latter ratio, the computer makes available to itself the second of the two quantities that are needed in order to correct for differences between the actual response of the particular transducer and the estimated response thereof that is predicted by the two stored equations. The manner in which sensitivity ratio K and offset voltage V O  are used in this connection will be described later. 
     Upon encountering blocks 50 and 52, the computer performs a series of operations which result in a determination of the scaling factor K&#39; which is necessary in order to assure that the signal processing capacity of the instrument of FIG. 1 is not exceeded when the transducer produces its maximum output signal V MAX . The determination of this scaling factor is desirable because it defines the amplification (or attenuation) that may be safely provided during signal processing. Such amplification (or attenuation) is desirable because it assures that the instrument is operating at its highest potential resolution, thereby assuring a more accurate output reading. 
     The determination of scaling factor K&#39; begins as the computer encounters block 50 and is directed to evaluate the inverse transfer function equation (FIG. 2b) at maximum transducer output V MAX  (as corrected for sensitivity ratio K) to determine the maximum concentration C MAX  that is to be processed by the instrument. Note that this operation is performed by simply evaluating the inverse transfer function equation at the then available value of independent variable V, and is analogous to the operation performed via block 46 using the direct transfer function equation and the then available value of independent variable C. 
     The determination of scaling factor K&#39; then continues as the computer encounters block 52 and is directed to determine the ratio of the signal processing capacity V cap  of the instrument and maximum concentration C MAX . (One factor that limits the processing capacity of the instrument is the number of bits in the digital words used therein.) In forming this ratio, the factor 0.95 is inserted to provide a margin of safety which assures that the capacity of the instrument is not exceeded as a result of rounding errors. 
     Once scaling factor K&#39; has been determined, the computer is directed to a block 54 which causes it to modify or reformulate the inverse transfer function equation so as to correct for the values of offset V O , sensitivity ratio K, and scaling factor K&#39;. The effect of this reformulation generates a linearizing function which allows the response of the particular transducer to be expressed in terms of the equation for a typical transducer. 
     Once this linearizing equation is available, the instrument is calibrated by causing the computer to carry out the steps called for by blocks 56 and 58. Block 56 causes the computer to apply to the sample cell a suitable calibration gas, which may (but need not) be the same as the standard gas used in connection with block 44, and to measure the resulting output V C  of transducer 12. Then, via block 58, the linearizing equation is evaluated for transducer output V C  to determine the calculated calibration gas concentration value C C  which is associated therewith. As will be explained more fully presently, calculated concentration value C C  serves as a standard to which the calculated concentrations of gases of unknown composition may be referenced to determine the concentrations to be displayed at the output of the instrument. Because this calculation process takes into account the nonlinearity of the transducer response, the result of the calculation is free of any nonlinearity and may therefore be used as the linearized concentration value of the component of interest in the calibration gas. 
     Following the completion of the calibration process, the instrument is ready to proceed with the making and linearization of a series of measurements on gases of unknown composition by repeatedly executing a measurement loop which includes blocks 60-66 of FIG. 3. In doing so, the computer first encounters a block 60 which causes it to apply the sample gas to the sample cell and measure the resulting transducer output V u . Thereafter, upon encountering block 62 the computer evaluates the linearizing equation for V=V u  to determine the calculated concentration value C u  that is associated therewith. Because the calculation of concentration C u  takes into account the nonlinearities of the transducer, it is free of any nonlinearity and may therefore be used as the linearized concentration value of the component of interest in the sample gas. 
     After linearized concentration values C C  and C u  are both available, the computer proceeds to a block 64 which causes it to reference unknown concentration value C u  to known concentration value C C  and thereby produce a concentration value C out  for outputting on display 18. This referencing is preferably accomplished by taking the ratio of C u  to C C  and then multiplying the result by the known concentration of the calibration gas C S2 . This use of a simple ratioing step to produce the final output is valid because both of the values used in the ratio have been linearized and may therefore be directly compared to one another in the linear domain. 
     Upon completing and displaying of the results of the first measurement, the computer proceeds to a decision block 66 which causes it to determine whether or not all of the desired measurements requested by the user have been completed. If all measurements have not been completed, the computer is directed back to block 60 to repeat the measurement process on the then available sample gas. If, for example, the sample gas is the gas produced by the operation of a continuous process, the measurement loop may be executed one or more times each second to provide a substantially continuous current indication of the concentration of the component of interest in the process gas. In such cases decision block 66 may serve to cause the computer to repeat the measurement process until it encounters a stop command entered by the operator through keyboard 32. Upon the completion of the desired series of measurements, or upon the receipt of a stop command, the computer will exit the measurement loop and thereby terminate the measurement process. 
     In spite of the fact that the practice of the method of the invention involves evaluating rather than solving of the nonlinear equations which describe the response of the transducer, appreciable amounts of time may be involved in performing the multiplications and additions that are involved in executing the measurement loop. In cases in which the time involved in this execution is objectionable, the execution may be speeded up by using the steps shown in the flow chart of FIG. 4. The latter flow chart depicts an alternative method for evaluating the linearizing equation of block 54, those blocks which perform the same steps in FIGS. 3 and 4 being similarly numbered. 
     The principal difference between the flow chart of FIG. 4 and that of FIG. 3 is that, in the flow chart of FIG. 4, the linearizing second equation is evaluated by reference to a look-up table rather than by repeated multiplications and additions. In the flow chart of FIG. 4, this look-up table is constructed as the computer encounters a block 70 which causes it to (i) evaluate the reformulated second equation for a number of assumed values V which is equal to the number of entries to be included in the table, and (ii) store the resulting evaluations in tabular form. 
     Once the look-up table has been constructed and stored, the computer proceeds to block 56, which causes it to calibrate the instrument in the manner described in connection with FIG. 3. After doing so, however, the instrument determines linearized concentration value C C  by referencing the look-up table rather than by evaluating an equation. The computer then enters the measurement loop, including the blocks 60-74-64, to proceed with the taking of measurements on the sample gas. In executing this measurement loop, the linearized concentration value C u  that is associated with the sample gas is again determined with reference to the look-up table rather than by the evaluation of an equation. Naturally, because a look-up table may be referenced more quickly than an equation may be evaluated, the measurement loop of the flow chart of FIG. 4 may be executed in a much shorter time than that of the embodiment of FIG. 3. The method depicted in the flow chart of FIG. 4 may therefore be used in applications in which measurements must be made much more rapidly than those which can be made using the method depicted in the flow chart of FIG. 3. 
     A possible disadvantage of the embodiment of FIG. 4 is that, because look-up tables include only a discrete number of entries, many of the desired values will fall between the available table entries. It may therefore be necessary to include in the measurement loop steps that allow the interpolation of values between the available table entries. While the time necessary to perform these interpolation steps occupies part of the time saved in eliminating the evaluation of the polynomial equation, it does not occupy so much of that time that the use of the embodiment of FIG. 4 becomes unattractive in comparison with the use of the embodiment of FIG. 3. In other words, even with the inclusion of interpolation steps, the measurement loop of the embodiment of FIG. 4 may be executed more rapidly than that of the embodiment of FIG. 3. 
     In view of the foregoing, it will be seen that the calibration and linearization method of the present invention provides a number of advantages over previously known calibration and/or linearization methods. Firstly, the method of the invention assures that calibration and linearization reflect both the actual response of the particular transducer that is selected for use in the instrument, and the response of a typical transducer of the selected type. Secondly, the method of the invention provides the benefits of linearization without requiring the solution of an equation that represents response of the transducer that is used in the instrument. Finally, the method of the invention contemplates the referencing of measured values to calibration values only after both values have been linearized in accordance with the abovementioned equations. Together these features of the method of the invention assure that the outputs of instruments that are calibrated and linearized in accordance therewith are more accurate and more linear than those of instruments that are calibrated and linearized in accordance with previously known methods.