Method and apparatus for determining weighted average of process variable
BACKGROUND OF THE INVENTION 
     This invention relates to the measurement of process variables by sensors, and particularly to the processing of sensor signals to obtain an accurate weighted average based on sensor signals provided by three or more sensors which are measuring the same process variable. 
     There are, in existence, many sensing systems for measuring a variety of variables including, for example, temperature, pressure, level, flow rate, amplitude, voltage, current, power, etc. In those circumstances where it is particularly critical that the measured value be accurate and protected against failure, it is common practice to employ three redundant sensors to measure the same variable. This is often referred to as triple redundancy. 
     One environment in which triple redundancy is employed is a nuclear power plant. In a nuclear power plant, certain process variables are measured by three redundant sensors in order to ensure the continuous availability of an accurate sensing signal, without any down time due to a failure of the sensor itself. The reliability of such systems employing triple redundancy is significantly enhanced if the accuracy of the final numerical value which is obtained can be maintained even if one of the three sensors fails to operate. Failure of a sensor typically occurs in one of three modes with approximately equal probability. The first mode is a failure with a zero output, the second mode is a failure with a very high output, and the third mode is a failure in such a way that a value is produced which drifts (in finite time) away from the correct value, due to a component or material failure. 
     Prior art methods and apparatus have applied consistency tests to the three sensed values, and as soon as one of the three values fails a consistency test, that value is removed from any influence on the final numerical value. For example, the inconsistent value may be immediately removed from an averaging calculation. The discontinuous nature of this abrupt removal of the inconsistent value can produce steps in the output value, which may in turn produce deleterious effects in downstream operations. Further, oscillations may be generated when a given signal is on the verge of a change of state from one set of averages to another at the time an inconsistent value is removed from the averaging calculation. Thus, there is a need in the art for a method and apparatus for redundant measurement of variables, which produces a continuous output and which takes into account the fact that transients may occur in the system being monitored. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a method and apparatus for determining a weighted average of three input values which overcomes the deficiencies of the prior art. 
     In particular, it is an object of the present invention to provide a method and apparatus for determining a weighted average wherein when one of a plurality of inputs deviates sufficiently from the median of the inputs, its influence on the output shall diminish in accordance with the amount of its deviation. 
     It is a further object of the present invention to provide a method and apparatus for determining a weighted average which may be applied to the monitoring of process variables in a nuclear power plant. 
     The method of determining a weighted average of three input values in accordance with the present invention includes determining which of the three input values is the median value, with the remaining input values being first and second input values. First and second weighting factors are calculated based on a predetermined median weighting factor and the three input values. Then, a weighted average is calculated based on the first and second weighting factors, the median weighting factor, the first and second input values and the median value. 
     The apparatus of the present invention includes means for sensing the same variable and for providing three sensed values. A processor receives the three sensed values, and determines which of the sensed values is the median value, with the remaining sensed values being first and second sensed values. The processor calculates first and second weighting factors based on a predetermined median weighting factor and the three sensed values. The processor calculates a weighted average based on the first and second weighting factors, the median weighting factor, the first and second sensed values, and the median value. 
     These together with other objects and advantages which will become subsequently apparent, reside in the details of construction and operation as more fully hereinafter described and claimed, reference being had to the accompanying drawings forming a part hereof, wherein like numerals refer to like parts throughout. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of an apparatus for determining a weighted average of three input values in accordance with an embodiment of the present invention; and 
     FIG. 2 is a flowchart for describing the operation of the microprocessor 16 of FIG. 1, and for describing the method for determining a weighted average in accordance with the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 1, sensors 10, 12 and 14 produce input values X A , X B  and X C , respectively. While the means for producing the input values X A , X B  and X C  are, in the preferred embodiments, sensors which produce measured values, in fact, the method and apparatus of the present invention may be employed to process input values produced by any suitable means. In one embodiment of the invention, the sensors 10, 12 and 14 are sensors for sensing the same process variable in a nuclear power plant. For example, the sensors 10, 12 and 14 may be for sensing temperature, pressure, vessel level or fluid flow rate, so that the input values X A , X B  and X C  represent separate sensing signals from the three redundant sensors 10, 12 and 14. The input values X A , X B  and X C  are provided to a microprocessor 16 which processes the input values X A , X B  and X C  to produce a weighted average signal in accordance with the method of the present invention. If, for example, the input values X A , X B  and X C  are temperature sensing signals, the microprocessor 16 will generate a single temperature sensing signal which is the weighted average of the three temperature sensing signals X A , X B  and X C  input to the microprocessor 16. The weighted average signal may be used for control purposes or may be provided to a display to display the weighted average. 
     The method of the present invention is a nonlinear method of exaggerating a deviation from the median by one of the input values. As a result, a large error in one of the input values will have substantially no effect on the weighted average which is output. In accordance with the method of the present invention, the one of the input values X A , X B  and X C  which is the median value is identified. Then, three weighting factors a, b and c are determined based on a predetermined median weighting factor corresponding to the median input value, and first and second absolute values which are equal to the absolute values of the differences between the median value and the remaining two of the input values X A , X B  and X C . Finally, the weighted average Y is calculated in accordance with the following equation: 
     
         Y=aX.sub.A +bX.sub.B +cX.sub.C                             (1) 
    
     FIG. 2 is a flowchart for describing the operation of the microprocessor 16 of FIG. 1 and for describing the steps of the method of the present invention. First, the input values X A , X B  and X C  are input to the microprocessor 16 and a predetermined median weighting factor f is determined in a step Sl. In the preferred embodiment, f is selected to be equal to 0.5 in order to ensure that when an output is at an extreme value (i.e., either zero or a very high value), the weighted average which is generated will consist of the average of the two remaining &#34;good&#34; values. Of course, f can be set to a different fractional value if different results are desired to be achieved. Then it is determined if the input value X A  is the median one of the input values in a step S2. If X A  is the median value, then the weighting factor a is set equal to the predetermined median weighting factor f in a step S3. Next, the absolute values of the differences between X B  and X A  , and between X C  and X A  are calculated to determine absolute values eB and eC in a step S4. Next, the remaining weighting factors b and c are calculated in a step S5. The weighting factors b and c are calculated in accordance with the following equations: 
     
         b=f/(1+(eB/eC).sup.2)                                      (2) 
    
     
         c=f/(1+(eC/eB).sup.2)                                      (3) 
    
     Alternatively, weighting factor c may be calculated based on the equation a+b+c=1. 
     If it is determined in step S2 that X A  is not the median value, then it is determined whether X B  is the median value in a step S6. If X B  is the median value then weighting factor b is set equal to the predetermined median weighting factor f in a step S7. Next, the absolute values of the differences between X C  and X B  (eC), and between X A  and X B  (eA) are determined in a step S8 to obtain the absolute values eC and eA, respectively. Then, in a step S9 the remaining weighting factors c and a are determined in accordance with the following equations: 
     
         c=f/(1+(eC/eA).sup.2)                                      (4) 
    
     
         a=f/(1+(eA/eC).sup.2)                                      (5) 
    
     If it is determined in step S6 that X B  is not the median value, then it is determined that X C  is the median value in a step S10 and the weighting factor c is set equal to the predetermined median weighting factor f in a step S11. Next, the absolute values of the differences between X A  and X C  (eA), and between X B  and X C  (eB) are calculated in a step S12 in order to obtain absolute values eA and eB. Then, in a step S13, weighting factors a and b are calculated in accordance with the following equations: 
     
         a=f/(1+(eA/eB).sup.2)                                      (6) 
    
     
         b=f/(1+(eB/eA).sup.2)                                      (7) 
    
     As indicated above with respect to S5, the calculations for steps S9 and S13 can be simplified based on the fact that the sum of the weighting factors a+b+c=1. 
     After the weighting factors a, b and c have been determined in step S5, step S9 or step S13, then the weighted average Y is calculated in a step S14 in accordance with equation (1) above. 
     As explained above, there is some flexibility in the method of the present invention to achieve the desired results for the particular types of sensors used or the system being monitored, by varying the value of the predetermined median weighting factor f. The weighted average value which is generated in accordance with the method of the present invention is more accurate than any single one of the input values. As a result of random variation, each of the sensing signals is typically off by some amount from the weighted average, but this would also be true in the case where the values are simply averaged. 
     Examples of the application of the method of the present invention are set forth below. 
     EXAMPLE 1: 
     In the following example, input value X A  is assumed to have a value of 500 and input value X B  is assumed to have a value of 500.5 which may result from a normal random inaccuracy. In this example, the input value X C  is assumed to start off with a normal random inaccuracy (Case 1) and then fail suddenly to produce a zero output (Case 2). The weighted average Y is calculated for each case using the method of the present invention. 
     Case 1: 
     X A  =500, X B  =500.5, X C  =499.5; 
     Y=500.0 
     Case 2: 
     X A  =500, X B  =500.5, X C  =0; 
     Y=500.25 
     Thus, whether input X C  indicates normal operation (Case 1) or a sudden failure (Case 2), the weighted average remains substantially the same and no discontinuity is produced in the weighted average which is generated. It should be noted that the result for Case 2 is the average of X A  and X B . 
     EXAMPLE 2: 
     In the following, input value X A  is assumed to have a value of 500, and input value X B  is assumed to have a value of 499.5 which may result from a normal random inaccuracy. The input value X C  is assumed to start off with a normal random inaccuracy (Case 1) and then drift to progressively higher values (Cases 2-4), as it might under conditions of a progressive failure. The weighted average Y is calculated for each case using the method of the present invention. 
     Case 1: 
     X A  =500, X B  =499.5, X C  =500.5; 
     Y=500.0 
     Case 2: 
     X A  =500, X B  =499.5, X C  =505; 
     Y=499.78 
     Case 3: 
     X A  =500, X B  =499.5, X C  =510; 
     Y=499.76 
     Case 4: 
     X A  =500, X B  =499.5, X C  =600; 
     Y=499.75 
     From the above, it is clear that the influence of the drifting input value X C  upon the weighted average diminishes quickly as X C  departs from the median, until the result finally becomes the average of X A  and X B . 
     As indicated above, the method and apparatus of the invention can be applied to a temperature monitoring system in a nuclear power plant. For example, the sensors 10, 12 and 14 in FIG. 1 may be resistance thermometers which produce, as the input values X A , X B  and X C , temperature signals. For example, resistance thermometers are used extensively in nuclear power plants to monitor the temperature of fluids which flow throughout the system. 
     The method and apparatus of the present invention provide significant advantages. When all three inputs agree within a tolerance that might be expected from random variation without actual failure, the output is a statistically significant function of the inputs; that is, it is a value that is statistically more accurate than each of the inputs alone. Further, when one of the inputs deviates sufficiently from the median value of the inputs, its influence on the output is diminished in accordance with the amount of its deviation. There is no discontinuity or step in the output such as that which results in the prior art from a sudden decision by the system being monitored to operate in a new mode; for example, when one of the outputs is removed. This is because in the method of the present invention none of the input values is discarded from consideration. Instead, when a particular input is at an extreme value (e.g., either zero or very high) the weighted average essentially consists of the average of the two remaining &#34;good&#34; values. However, if a value departs from the median, it is not locked out but instead remains a candidate for influencing the output should it later return to normal. Further, the method of the present invention does not require that a detected error be continuously present in order to maintain corrective action. Since the method of the present invention is a non-linear method for exaggerating a deviation from the median, a large error will have no effect on the weighted average which is output by the microprocessor 16. If a sensor drifts away from the median value and then corrects itself (e.g., in the case of a transient or a self-correcting malfunction) it will be weighted accordingly (i.e., the drifting sensor will have little impact on the weighted average when it is far away from the median, and greater impact on the weighted average when it is close to the median). 
     The method and apparatus of the present invention may be implemented in numerous ways. For example, a variety of types of sensors and measurement devices may be used to provide input values to the microprocessor 16 in order to produce a weighted average as an output. Further, although the method of the present invention is illustrated as being implemented by a processor, it could also be implemented by discrete circuitry. While the weighted average is disclosed as being produced with respect to three input values, the weighted average may be produced for a larger number of input values if desired. 
     The many features and advantages of the invention are apparent from the detailed specification, and thus it is intended by the appended claims to cover all such features and advantages of the system which fall within the true spirit and scope of the invention. Further, since numerous modifications and changes will readily occur to those skilled in the art, it is not desired to limit the invention to the exact construction and operation shown and described and, accordingly, all suitable modifications and equivalents may be resorted to, falling within the scope of the invention.