Method for calculating the rate of frequency of random events
BACKGROUND OF THE INVENTION 
     This invention relates to a method of determining the rate of change in frequency of random events and, more particularly, to such method when used to measure the rate of change of random neutron activity in nuclear reactors. 
     The frequency of a periodic signal is typically measured by counting the number of events (pulses, zero crossings, etc.) that have occurred over some fixed sample period, T. If C events are counted over this interval, the measured frequency of the signal, F, is simply calculated from the equation: 
     
         F=C/T 
    
     The rate of change in frequency can be calculated from two successive measurements of frequency F 1  and F 2  from the relationship: 
     
         Rate=(F.sub.2 -F.sub.1)/T 
    
     Graphically, the rate is depicted as the slope of a graph where a vertical axis, y-axis, is the number of events as a horizontal axis, x-axis, is the time. This equation works to calculate rate when the number of occurrences of the event is accurately known. But when the number of occurrences is varying statistically, inaccuracies result. For example, if an input from a source of random pulses has a Poisson distribution, the rate of change of mean frequency may be zero, but the observed rate of change may vary substantially for small numbers of counts per sample. The error in the measurement in slope can be reduced to an arbitrarily small value by increasing the length of the sample interval to a sufficiently large value or by averaging successive sample intervals to effectively increase the length of the sample interval. Thus it is apparent that averaging the inputs will produce a calculated rate that is much closer to the mean rate. This method works extremely well as long as a sufficient number of samples are used in the averages to offset the effects of randomness. At low levels of occurrences, this number is quite large and at high levels of occurrences, this number becomes substantially reduced. The exact number of readings needed to achieve a specified accuracy can be calculated using standard statistical methods. The response time of an instrument to the rate of change in the frequency of incoming pulses is directly related to the number of input samples used to calculate the pulse frequency. If N samples are used in this calculation, then the response time of the instrument will be between 2N and 2N+1 sample times. Therefore, accuracy and response time can be traded off in a straight forward manner. 
     Within a nuclear reactor, neutron activity is an indication of the power being generated by the reactor and an indication of the rate of change of neutron activity is important for both control and safety systems. With a very wide range of neutron activity, which may vary from a few pulses per second to millions of pulses per second, rather than measuring the linear rate of change of activity as described above, the measurement of exponential rate of change (typically in decades per minute) is more appropriate. The equation used for the exponential rate of change of neutron activity is given by 
     
         Rate=(log (F.sub.2)-log (F.sub.1))/T 
    
     
         or 
    
     
         Rate =(log (F.sub.2 /F.sub.1))/T 
    
     where F 1  and F 2  are two consecutive measurements of the frequency of neutron activity and T is the sample interval between the two frequency measurements. The resulting rate has units of decades per sample interval. 
     Instruments which measure neutron activity up to a few million pulses per second are commonly referred to as source range instruments. Such source range instruments, which are typically designed to cover a range of neutron activity from a few pulses per second to millions of pulses per second must meet specified response time criteria as well as specified accuracy and stability of measurement with respect to the measurement of the rate of change of frequency of neutron activity. To meet accuracy and stability requirements, the instrument must use a sufficiently long sampling interval so that variations in the reading due to the random nature of neutron activity are minimized. To meet response time requirements, the instrument must provide an accurate and stable reading in a timely fashion. The response time requirements generally vary over the operating range of the instrument from ten&#39;s of seconds at the low end to one second or less in the upper operating range. Different response times are also generally specified based on the type of input presented to the instrument. For example, response time requirements may be separately specified for exponentially increasing inputs and step change inputs. Therefore, the instrument may be required to distinguish between exponential changes in inputs and step changes in inputs. This feature is needed so that a small step change in input does not produce an indication of an abnormally high rate of change that may needlessly cause a trip in the reactor. 
     If a source range instrument continuously monitors neutron activity and stores the received number of counts for successive 100 ma intervals as count values X 1 , X 2 , . . . X 16 ,640, where X 1  represents the number of counts received during the most recent 100 ma sample interval and X 16 ,640 represents the oldest sample, then an estimate of the mean value of frequency, or level L, is calculated from the equation: 
     
         L=10(X.sub.1 +. . . +X.sub.N)/N 
    
     where L has units of counts per second. The value of N is chosen to meet the specific accuracy, response time and statistical stability requirements of the source range instrument. In previous instruments, the exponential rate, R, was typically calculated from two successive values of L. For example, if: 
     
         L.sub.1 =10(X.sub.1 +. . . +X.sub.N)/N 
    
     
         and 
    
     
         L.sub.2 =10(X.sub.2 +. . . +X.sub.M+1)/M 
    
     that is, L 1  is the most recent calculation of level and L 2  is the next most recent calculation of level, then a common method of calculating the exponential rate, R, is to use the equation: 
     
         R=600 log (L.sub.1 /L.sub.2) 
    
     where R has units of decades per minute. 
     This method can give acceptable results when N equals M, but this method is unsuitable where the number of samples used in the level calculation is dynamically changing to meet the various response time and accuracy requirements of the instrument. During exponential increases in the level, while N is changing, the consecutive sample periods in which N and M are not equal will cause the above calculation of rate to substantially overshoot the true value. This problem can be overcome by requiring that N equal M at all times for the purposes of the rate calculation. However, this method has additional problems. Since many terms used in the calculation of L 1  are common to the calculation of L 2 , the two values are not statistically independent samples. This maximum overlap in terms causes the statistical fluctuations in the rate calculation to be considerably larger than if the calculation was done with statistically independent samples of the same number of terms. Furthermore, the number of terms used to provide the best estimate of level is not necessarily the optimum number used for the rate calculation. 
     It is therefore desired to provide an improved method of calculating the rate of change of frequency of random events which reduces statistical fluctuations in the calculated rate and readily distinguish between exponential changes in the inputs and step changes in the inputs. 
     SUMMARY OF THE INVENTION 
     This invention encompasses a method of determining the rate of change of frequency of a plurality of randomly occurring events wherein the number of the events which occur within a plurality of predetermined sampling intervals is counted to obtain a plurality of count values, each corresponding to one of the sampling intervals. These count values are stored in a memory table and the count values which correspond to the most recent of N of the sampling intervals are summed to obtain a first accumulated count, S 1 . The count values which correspond to a second set of N of the sampling intervals preceding the most recent set, are summed to obtain a second accumulated count, S 2 . The rate of change of event frequency is then calculated by dividing the logarithm of (S 1  /S 2 ), by the number N. 
     The value of N used in the rate calculation is dynamically adjusted in response to the measured frequency of events. If the measured frequency of events exceeds a predetermined threshold, and the frequency is determined to be increasing at an exponential rate, then the value of N is decreased by a preselected amount for successive rate calculations until the value of N reaches a preselected minimum or the calculated rate of change is less than a preselected exponential rate of change. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a source range instrument which may be used to perform the method of the present invention; 
     FIG. 2 is a series of curves which illustrate elements of the present invention; and 
     FIG. 3 is a flow diagram which illustrates a portion of the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring to the drawings, FIG. 1 is a block diagram of a source range instrument which may be used to perform the method of the present invention. A suitable neutron detector 10 generates a pulse of current each time a neutron enters the detector and delivers this current pulse to the front end circuit 12 of the instrument. This front end circuit includes an amplifier 14, discriminator 16, signal shaping circuit 18, and counting circuit 20. The amplifier 14 amplifies the detector current and the discriminator compares the amplified current to a reference level and distinguishes between current pulses due to neutron acitivity and those pulses caused by external noise in the system. The pulses which pass the discriminator are then shaped by the signal shaping circuit 18 and passed to a counting circuit 20. The counting circuit counts pulses for a fixed period of, for example, 100 milliseconds and then interrupts a microprocessor 22 in the instrument microcomputer 24. The counting circuit is double buffered so that counting continues during the next sampling period while the microprocessor performs its tasks of determining the frequency of the incoming pulses and the rate of change of frequency of the incoming pulses and displays the results on an operator console 26. The microcomputer includes standard components such as an Intel 8086 microprocessor, and suitable programmable read-only memory 28 and random access memory 30. Suitable digital parallel and serial interface circuitry 32 and 34 provides communications between the processor, the front end circuit and the operator&#39;s console. 
     When the processor receives an interrupt signal from the front end counting circuit, the processor reads the total number of counts that occurred during the previous sampling interval. This sample count is stored in a table in memory that contains a historical record of the number of counts received during the last 16,640 sample periods. The large number of stored historical samples allows both the frequency of incoming pulses (the level) and the rate of change in frequency in incoming pulses (the rate) to be calculated by a novel adaptive method that dynamically adjusts the effective sampling period over which the level and rate are calculated. 
     The rate is calculated according to the equation: 
     
         R=(1/N)600 log (S.sub.1 /S.sub.2)                          (1) 
    
     where N is the number of terms used for each summation, S 1  is the sum of the last N historical terms (1 through N) and S 2  is the sum of the last N historical terms (N+1 through 2N). With a sample period of 100 milliseconds, R will have units of decades per minute. 
     Using standard methods of statistical analysis, it is possible to calculate the value of N in the above rate equation that will satisfy the system&#39;s specifications. For example, if the incoming pulses have a Poisson distribution, then the standard deviation of the rate, σ, is given by: ##EQU1## where N is the number of terms used for each summation,   1  is the mean number of counts of the last N historical terms (1 through N), and  2  is the mean number of counts of the last N historical terms (N+1 through 2N). With a sample period of 100 milliseconds, σ will have units of decades per minute. 
     If σ represents the mean of the input over a 100 millisecond sampling period and if the input is held constant such that   equals Nλ, then the standard deviation, σ, becomes: ##EQU2## Solving for N, the result is: ##EQU3## From equation (4), a minimum number of samples needed to maintain the specified statistical stability can be easily determined. For example, if it is desired to have the statistical stability within accuracy specifications of 1.5 decades per minute 95% of the time (i.e. two standard deviations), then a value of 0.25 is used for σ in the above equation. 
     Similarly the equation for the peak rate to a step response can be derived. The peak calculated rate will occur N samples after the step input occurs. If the constant input before the step had a mean value of λ counts per 100 milliseconds sample, and the constant input after the input is rλ counts per 100 milliseconds sample, then   1  equals Nrλ and   2  equals Nλ and the standard deviation, σ, is: ##EQU4## and the peak rate, R p  is: ##EQU5## Therefore, to satisfy a peak rate specification within two standard deviations, the relationship R p  +2σ≦K must be met, where K is the peak rate allowed. This equation does not have a closed form solution, but can be solved iteratively using standard numerical methods. The response time to an exponential input is simply 2N. 
     The above calculation of N is based on a confidence interval of two standard deviations, so that the specifications will be met approximately 95% of the time. FIG. 2 is a graphical representation of the required system specifications. Curve 36 represents the minimum number of samples required versus count level to meet the two standard deviation requirement for normal statistical fluctuations. Curve 38 represents the number of samples fluctuations. Curve 38 represents the number of samples required versus count level for an allowable peak rate for a step input change. Any value of N above these curves will produce a result which is within specifications. Therefore, a break point curve 40 represents acceptable numbers of required samples versus count level for most applications. However, in some applications the desired response time requirements will fall below the line set by the peak rate allowed for a step input requirement. These response time requirements are illustrated by points 42, 44 and 46 in FIG. 2. Although the number of samples specified by curve 40 would meet the response time requirement set by point 42, it would not meet the response time requirements set by points 44 and 46. Therefore, any system which determines a value of N based solely on count level, cannot satisfy the response time requirements for an exponential input and a peak rate allowed for a step input. 
     To overcome this problem, a unique step input filter has been added to the source range instrument. Until the level of activity reaches 500 counts per second, this function is disabled and the value of N used in the rate calculation is based on the measured level as shown by the break point curve 40 in FIG. 2, labeled with the values (1152), (640), (256), etc. The break points in this curve are set to meet the worse case criteria of the system. In this system, these values are determined by the peak rate allowed for a step input. 
     Once the level of activity gets beyond 500 counts per second (or 50 counts per sample) the step input filter function is activated. The main components of this function include a fast rate calculator, an exponential input detector, and a time base slew limiter. The fast rate calculator calculates a rough estimate of the rate using equation 1 with N equals 10. This value is passed to the exponential input detector. If the exponential input detector calculates a rate greater than a predetermined threshold (for example, three decades per minute) then it will recheck the rate in 0.6 second increments. If after two additional checks the rate is still above the threshold, then at the next sample time, the change is declared to be exponential and the time base slew limiter is enabled. 
     The time base slew limiter is specifically designed to reduce the number of samples over which the rate calculation is performed, i.e. the value of N used in equation 1, and thus the effective time base over which the rate calculation is performed. It performs this function quickly enough to meet the time response specifications of the system and slowly enough to avoid large discontinuities in the rate calculations. When activated, the time base slew limiter decreases the number of samples used in each average by a predetermined number (for example six) for every sample period. This continues until the number of samples reaches a predetermined minimum allowed value or until the fast rate calculator detects a rate less than the threshold rate. This minimum is determined by the input level as shown by staircase curve 48 labeled (56), (40), (24) and (20). Once the rate falls below the threshold, the exponential input detector is disabled. It can be re-enabled only by repeating the entire enabling procedure. When the exponential input detector is disabled, the time base slew limiter increases the number of samples used in the rate calculation by one every other sample period until a normal mode value (N=152) is reached. 
     FIG. 3 is a flow diagram which illustrates the operation of the step input filter function input. In block 50, the number of counts in the most recent sample interval is entered. Block 52 shows that this count level is then compared to a predetermined threshold, which is 500 counts per second in this example. If the level is less than this threshold, then the break point curve 40 in FIG. 2 is used in the subsequent rate calculations as illustrated by block 56. If the level does exceed the predetermined threshold, block 58 illustrates that a rate of change of frequency calculation is performed. If there is no rate change, the input is determined to be static as illustrated in block 60 and the break point curve 40 is used. If a rate change did occur, then block 62 shows that a determination is made as to whether or not this rate change is exponential. If it is not exponential, the input is again determined to be a static input as shown in block 64 and the break point curve 40 is used. If the rate of change is exponential, block 68 shows that the time base slew limiter function is enabled. 
     It should be understood that the step input filter function and its component parts, including the fast rate calculator, exponential input detector and time base slew limiter can be incorporated into the software used in the microcomputer 24 in FIG. 1. With the present invention, the instrument of FIG. 1 can be used to measure both the frequency and rate of change of frequency of random events with a different effective sampling time for the two measurements. The rate of change of frequency calculation can differentiate between exponentially increasing inputs and step inputs and dynamically adjust the effective sampling time of the instrument to improve response time and accuracy based on the type of input received. 
     Although the present invention has been described in terms of what is at present believed to be its preferred embodiment, it will be apparent to those skilled in the art that various changes may be made without departing from the scope of the invention. It is therefore intended that the appended claims cover such changes.