## 3 Design of Algorithm
### Algorithm for Pulse Signal Processing  
In the PL, we have designed six function blocks: the lower-level discriminator (LLD), counter, count-rate converter, zero counter, time-constant selector, and integrator.  
The LLD receives the digital signal that has been converted by the ADC. It discriminates the pulse signal derived from neutrons from other signals, such as gamma rays or electrical noise, using a logic function. This discrimination is based on determining whether the pulse height exceeds a preset threshold. If the pulse height exceeds the threshold, the LLD identifies the signal as being derived from neutrons. The LLD then outputs rectangular pulses depending on the number of signals that exceed the threshold. The LLD also has a peak hold function and outputs the maximum pulse height at each inputted pulse to use in creating the discrimination characteristics graph at the PC.  
The counter counts the pulses that are output by the LLD when the signals exceed the threshold every 1 ms.  
The zero counter counts the periods when the counter's count is zero every 1 ms to select a time constant in the case of a low count rate.  
The count-rate converter converts the pulse counts to a count rate (X) by multiplying a constant coefficient of 1000 (coef\({}_{\text{const}}\)) and preset variable coefficients (coef\({}_{\text{var}}\)) in lookup tables (LUTs) shown in Figure 3 with the latest counter's output (C\({}_{\text{n}}\)) as represented in Equation (1). The preset variable coefficients are used for inhibiting the fluctuation of neutron and disturbance signals, such as electromagnetic noise, and are controlled with C\({}_{\text{n}}\) and the previous counter's output (C\({}_{\text{n-1}}\)), as shown in Figure 4. The variable coefficients are set with 14 values, ranging from 0.05 to 1, and  
The time-constant selector automatically selects a preset time constant from the LUTs to be used for the first-order lag calculation implemented in the integrator. The time constants need to be long during a reactor shutdown when there is a relatively low count rate to ensure measurement reliability, but they need to be short under startup to normal operations when there is a relatively high count rate to quickly detect any abnormal change in reactor power. The time-constant selector contributes to this responsiveness by selecting a time constant on the basis of the output from the count-rate converter. Figure 5 shows all time constants set for this study, totaling approximately 200. Time constants \(10^{3}\) to \(10^{6}\) cps, when an output from the count-rate converter will be non-zero, were set on the basis of Equation (2), and time constants for other count-rate ranges when an output from the count-rate converter will be zero or non-zero were set on the basis of Equations (2) and (3).  
\[\tau=\frac{1}{2\cdot\mathrm{n}\cdot\sigma^{2}}, \tag{2}\]  
where \(\tau\) is a time constant, \(\mathrm{n}\) is a count rate, and \(\sigma\) is the relative standard deviation.  
\[\mathrm{n}=\frac{1000}{C_{0}+1}, \tag{3}\]  
where \(C_{0}\) is the period during which the output from the count-rate converter is zero.  
Figure 4: Flow chart of selecting variable coefficients.  
The integrator implements a first-order lag calculation using Equation (4) with a count rate and time constant from the count-rate converter and the time-constant selector, respectively.  
\[\mathrm{Y_{i}=Y_{i-1}e^{-\frac{T}{\mathrm{i}_{1}}}+\left(1-e^{-\frac{T}{\mathrm{ i}_{1}}}\right)\cdot X_{i}}, \tag{4}\]  
where \(\mathrm{Y_{i}}\) is the output at the i-th sampling time, \(\mathrm{Y_{i-1}}\) is the output at the previous i-th sampling time, \(\mathrm{X_{i}}\) is the output from the count-rate converter at the i-th sampling time, T is the sampling time, and \(\mathrm{\tau_{i}}\) is the i-th time constant.  
The resource utilization which includes six function blocks and ADC control logics is shown in Table 2. The resource utilization was approximately 30%, indicating that there was sufficient margin available.