An FPGA, method, and system for plotting energy spectra of a digital nuclear spectrometer
By integrating signal preprocessing, feature event extraction and analysis into an FPGA chip, and employing parallel event detection and state machine logic filtering, the problems of high algorithm complexity and slow data processing speed of digital nuclear spectrometers are solved, achieving efficient and accurate energy spectrum plotting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-04-03
AI Technical Summary
Existing digital nuclear spectrometers have high algorithm complexity and large computational load in the process of energy spectrum plotting, making it difficult to achieve on-site processing. Traditional filtering methods are sensitive to noise and lack flexibility, and the data processing speed is limited, making it difficult to meet the requirements of high speed and real-time operation.
Signal preprocessing, feature event extraction and analysis are integrated into a single FPGA chip. Parallel event detection and state machine logic filtering are adopted, a dual-path verification mechanism is introduced, and interaction with external processors is achieved through the AXI4 interface to realize integrated optimization of energy spectrum construction.
It significantly simplifies the system structure, reduces hardware costs and power consumption, improves data throughput and computing speed, enhances measurement accuracy and robustness, and has nanosecond-level time synchronization capabilities, making it suitable for high-speed real-time processing.
Smart Images

Figure CN121387822B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of nuclear radiation detection technology, and in particular to an FPGA, method, and system for plotting energy spectra of a digital nuclear spectrometer. Background Technology
[0002] A digital nuclear spectrometer is a key device for monitoring and analyzing radioactive environments. It acquires radiation pulse signals and plots energy spectra. By analyzing the area, kurtosis, and peak position of the waveforms within the energy spectra, it can qualitatively identify and quantitatively analyze radionuclides.
[0003] One method for plotting energy spectra using existing digital nuclear spectrometers is as follows: Figure 1 As shown, the system mainly consists of a detector module, a front-end signal conditioning module, an ADC module, an FPGA module, a PC module, and a DSP module. The detector module linearly converts nuclear radiation energy into a corresponding electrical signal. The front-end signal conditioning module includes a preamplifier circuit and a gain amplifier circuit, primarily for fidelity and amplification of the signal acquired by the detector module. The ADC module performs analog-to-digital signal conversion. The FPGA module acquires the digital pulse data stream acquired and converted by the ADC module and performs signal processing, including filtering, baseline restoration, stacking identification, and amplitude extraction. The FPGA module outputs the processed signal to the PC module, where software constructs and analyzes the energy spectrum of the digital pulses, and performs testing and verification. This digital nuclear spectrometer architecture has the following shortcomings:
[0004] 1. The various functions implemented by the FPGA module in the digital nuclear spectrometer, including filtering and shaping, stacking identification, baseline recovery and amplitude extraction, are implemented using independent algorithms, resulting in a large overall computational load and high algorithm complexity. At the same time, the FPGA ultimately only transmits the extracted features to the host computer, and then the algorithm in the host computer is used to draw the energy spectrum, which fails to achieve on-site processing and on-site plotting.
[0005] 2. When FPGA modules process pulse signals using trapezoidal filtering, triangular filtering, etc., repeated experiments and summarizing of optimal parameters are necessary to gradually improve data accuracy and reduce data distortion. For example, when processing pulse accumulation in the FPGA module after data is filtered by trapezoidal filtering, the waveforms are closely stacked and overlapped, which can easily lead to missed or misjudged peaks, resulting in amplitude extraction errors. Ultimately, false peaks or peak position shifts appear in the energy spectrum, resulting in poor flexibility.
[0006] 3. Traditional filtering methods are sensitive to noise. For example, baseline recovery relies on fixed parameters and is difficult to adapt to dynamically changing noise environments, resulting in unstable energy spectrum quality.
[0007] 4. The pulse data processed by the FPGA module needs to be transmitted to the PC module through the communication line. The final energy spectrum construction time will be limited by the transmission speed limit of the hardware line. At the same time, since the energy spectrum construction function needs to be implemented in the PC through multiple steps such as software reception, decoding and recognition, and is limited by software computing power, it is difficult to meet the requirements of high-speed and real-time processing.
[0008] Therefore, there is an urgent need for a digital nuclear spectrometer implementation scheme that can realize complete energy spectrum construction in FPGA, has adaptability, strong robustness and is easy to integrate. Summary of the Invention
[0009] The purpose of this invention is to overcome the problems of complex algorithms, insufficient data processing speed, and easy loss of real data in the existing technology, and to provide an FPGA, method and system for drawing energy spectrum diagrams of digital nuclear spectrometers, so as to help users construct energy spectra faster and more accurately.
[0010] The objective of this invention is achieved through the following technical solution:
[0011] In a first aspect, an FPGA for plotting energy spectra of a digital nuclear spectrometer is provided, comprising:
[0012] The data preprocessing module is used to filter, calibrate amplitude, and eliminate baseline of the raw pulse signal output by the detector to output a preprocessed signal.
[0013] The pulse feature event extraction module is used to decompose the preprocessed signal into multiple events that characterize the pulse waveform features, perform logical judgment and filtering on the decomposed events, perform parallel detection on the filtered events, and convert the parallel events into a serial event stream arranged in chronological order.
[0014] The pulse feature event analysis module is used to perform logical filtering and discrimination on the serial event stream to output feature data that characterizes valid pulses;
[0015] The energy spectrum plotting module is used to convert the feature data into an energy spectrum diagram.
[0016] In some embodiments, the pulse feature event extraction module includes:
[0017] The pulse feature extraction module is used to detect and classify pulse events, and to linearly record multiple events that characterize pulse waveform features over time; the multiple events that characterize pulse waveform features include 6 independent events: pulse start event, pulse rise event, peak event, pulse fall event, trough event, and pulse end event;
[0018] The event logic control module is used to make logical judgments on the events extracted by the pulse feature extraction module and to filter error information.
[0019] In some embodiments, the detection and classification of pulse events includes:
[0020] Pulse accumulation identification: Determine whether the trough value of the trough event is higher than the expected baseline level established for the current pulse;
[0021] If so, pulse accumulation is determined to have occurred, and the trough value of the trough event is used as the baseline level corresponding to the subsequent peak event, which is then used to calculate the peak value of the next peak event.
[0022] In some embodiments, the pulse feature event extraction module further includes:
[0023] The pulse event recording module, connected to the event logic control module, includes multiple parallel event detection circuits and a central processing unit. Each event detection circuit is used to detect a specific type of event and is equipped with an independent first-in-first-out (FIFO) buffer. The central processing unit is used to poll the FIFO buffers of each event detection circuit and read them out in the order of the events occurring, merging them into the serial event stream.
[0024] In some embodiments, the pulse characteristic event analysis module includes:
[0025] The pulse feature event filtering module is used to perform logical judgment processing on the pulse events recorded in the central processing unit. The logical judgment processing includes:
[0026] The validity of peak and trough events is determined by a preset continuous counting threshold, and only valid event data is retained.
[0027] In some embodiments, the pulse characteristic event analysis module further includes:
[0028] A pulse feature event discrimination module, connected to the pulse feature event filtering module, is used to determine the validity of pulses based on the valid event data. The pulse validity determination includes:
[0029] The pulse maximum value is compared with the signal's true maximum value for verification. When the maximum value matches the true maximum value, the output mode is intelligently selected based on the number of extreme values. When the maximum value does not match the true maximum value, a safety net mechanism is activated, prioritizing the output of the physical maximum value and marking a warning sign.
[0030] The spectrum data recording module is used to store the data identified by the pulse feature event identification module in a first-in-first-out buffer.
[0031] In some embodiments, converting the feature data into an energy spectrum includes:
[0032] The energy information in the feature data is mapped to energy spectrum channel addresses and accumulated statistically to generate and store energy spectrum data.
[0033] Secondly, a method for plotting energy spectrum using a digital nuclear spectrometer is provided, the method being executed by the FPGA described in the first aspect, comprising the following steps:
[0034] S1. The raw pulse signal from the detector is received through the data preprocessing module, and the raw pulse signal is filtered, amplitude calibrated and baseline eliminated to output the preprocessed signal;
[0035] S2. The preprocessed signal is decomposed into multiple events that characterize the pulse waveform features by the pulse feature event extraction module. Logical judgment and filtering are performed on the decomposed events, the filtered events are detected in parallel, and the parallel events are converted into a serial event stream arranged in chronological order.
[0036] S3. The serial event stream is logically filtered and identified by the pulse feature event analysis module to output feature data representing valid pulses;
[0037] S4. Convert the feature data into an energy spectrum using the energy spectrum plotting module.
[0038] Thirdly, a digital nuclear spectrometer system is provided, comprising:
[0039] FPGA as described in the first aspect;
[0040] Detectors are used to convert nuclear radiation into multiple raw pulse signals;
[0041] An analog-to-digital conversion and cross-clock domain processing module is connected between the detector and the FPGA, and is used to sequentially perform analog-to-digital conversion, cross-clock domain data synchronization, buffering and merging on the multiple raw pulse signals.
[0042] A hardware delay and data filtering module is connected between the detector and the FPGA to synchronize and filter multiple raw pulse signals.
[0043] The central processing unit is connected to the FPGA via a communication bus interface. It is used to receive energy spectrum diagrams, perform advanced energy spectrum analysis, and dynamically configure the FPGA parameters.
[0044] In some embodiments, the system further includes a display module connected to the central processing unit for displaying the energy spectrum locally; the communication bus interface is a standard AXI4 interface.
[0045] It should be further noted that the technical features corresponding to the above-mentioned options and embodiments can be combined or substituted with each other to form new technical solutions without conflict.
[0046] Compared with the prior art, the beneficial effects of the present invention are:
[0047] 1. This invention integrates the entire process of signal preprocessing, feature event extraction and analysis, and energy spectrum plotting algorithms into a single FPGA chip. It interacts with external processors through standardized interfaces (such as AXI4), achieving integrated optimization of the energy spectrum construction steps within the FPGA. This eliminates the need for a PC and dedicated communication links required in traditional architectures, significantly simplifying the system structure and reducing hardware costs, power consumption, and size. At the same time, the hardware parallel processing capability of the FPGA far surpasses the serial software execution of the CPU, greatly improving the system's data throughput and freeing data transmission speed from line limitations, thus significantly increasing data computation speed.
[0048] 2. This invention abandons traditional mathematical algorithms such as trapezoidal filtering and triangular filtering, and adopts an event-flow-based pulse analysis method. It deconstructs continuous waveforms into discrete event streams through parallel event detection, and filters and identifies the event sequences based on state machine logic. Since the data is not processed by mathematical algorithms, the internal information of the waveform remains unchanged, avoiding the elimination of extreme values that may occur after trapezoidal filtering. Compared to methods like trapezoidal fitting, it does not make idealized assumptions about the waveform, but adaptively identifies the true feature points of the waveform. It has better robustness to real waveforms with various imperfections such as pulse accumulation, significantly improving the measurement accuracy of complex waveforms. Simultaneously, the event stream is cleaned and reconstructed through a hardware pipeline, completely breaking away from the traditional DSP algorithm (such as convolution and fitting) approach, making it highly suitable for parallel processing on FPGAs.
[0049] 3. In pulse accumulation identification, this invention intelligently identifies accumulation by analyzing trough depth and uses the trough as a new baseline for pulse separation. This logic judgment method based on physical features has a much higher accuracy and separation capability for partially overlapping and irregularly shaped accumulated pulses than traditional shape fitting algorithms.
[0050] 4. This invention introduces a dual-path verification and backup mechanism, maintaining two paths in parallel: the pulse maximum value obtained from event flow logic analysis and the true maximum value obtained directly from the raw data. A consistency comparison is performed at the end of the pulse. On one hand, when the algorithm misjudges due to extreme noise or abnormal waveforms, the true maximum value path serves as a backup output, ensuring that at least one reliable energy value is recorded for each pulse, greatly reducing the risk of data loss. Simultaneously, the consistency comparison result between the pulse maximum value and the true maximum value of the signal is itself an important quality indicator, ensuring the reliability of waveform analysis.
[0051] 5. The FPGA of this invention can be used as a standalone module to interact with other systems via the AXI4 interface, making it more versatile.
[0052] 6. This invention incorporates a hardware delay chain and a coincidence condition decision module, which work in conjunction with the FPGA algorithm to improve the accuracy of the digital nuclear spectrometer. This provides the system with high-precision time synchronization and coincidence measurement capabilities at the nanosecond and even picosecond levels. This is crucial for applications requiring precise time correlation (such as coincidence measurement, particle identification, and radiation imaging), which is difficult to achieve with pure software algorithms or low-speed digital systems. Attached Figure Description
[0053] Figure 1 A schematic diagram of an existing digital nuclear spectrometer;
[0054] Figure 2 This is a schematic diagram of the structure of an FPGA for plotting energy spectra of a digital nuclear spectrometer according to the present invention;
[0055] Figure 3 This is a schematic diagram of the data preprocessing module of the present invention;
[0056] Figure 4 This is a flowchart of the amplitude calibration process of the present invention;
[0057] Figure 5 This is a schematic diagram illustrating the baseline mean finding method in this invention.
[0058] Figure 6 This is a schematic diagram of the pulse feature event extraction module of the present invention;
[0059] Figure 7 This is a schematic diagram of the feature event data flow of the pulse feature event extraction module of the present invention;
[0060] Figure 8 This is a schematic diagram illustrating the relationship between independent and related events in this invention;
[0061] Figure 9 This is a schematic diagram of the state machine transition relationship for feature extraction in this invention;
[0062] Figure 10 This is a schematic diagram illustrating the use of the trough as the baseline for the next pulse extremum point in this invention.
[0063] Figure 11 This is a schematic diagram of the event recording process of the present invention;
[0064] Figure 12 This is a schematic diagram of the pulse characteristic event analysis module of the present invention;
[0065] Figure 13 This is a state machine transition diagram for the feature event analysis of this invention;
[0066] Figure 14 This is a comparison diagram of the single-peak pulse and stacked pulse processing sequences of the present invention;
[0067] Figure 15 This is a flowchart of the verification process for comparing extreme values and maximum values in this invention;
[0068] Figure 16 This is a schematic diagram of the data output of the present invention;
[0069] Figure 17 This is a schematic diagram of a digital nuclear spectrometer system according to the present invention;
[0070] Figure 18 This is a functional flowchart of the ADC module of the present invention. Detailed Implementation
[0071] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0072] It should be noted that the defects in the solutions in the prior art are all the results of the inventors' practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed by the embodiments of this application in the following text should be the inventors' contributions to this application in the process of invention and creation, and should not be understood as technical content known to those skilled in the art.
[0073] Based on the above statements, and since this embodiment involves energy dispersive spectroscopy (EDS) related technologies, the following explanations are provided to clarify the objectives, technical solutions, and advantages of this embodiment:
[0074] ADC: Analog-to-Digital Converter; FPGA: Field-Programmable Gate Array; DSP: Digital Signal Processor; PC: Personal Computer; FIFO: First-In-First-Out Memory; LCD: Liquid Crystal Display; FIR: Finite Impulse Response; AXI4: High-Speed Data Interaction Protocol; TDC: Time Delay Compensation for Different Channels.
[0075] Filter shaping: Using digital filters to shape fast and chaotic sharp pulses into smooth and regular pulses. Currently, this includes trapezoidal filtering, triangular filtering, and Gaussian filtering.
[0076] Baseline recovery: A large number of objective factors can cause the DC reference (i.e., the "baseline") of the signal to shift vertically. The average baseline value is calculated through the "quiet" area between high-speed sampling pulses, and then this value is subtracted from the pulse signal.
[0077] Pulse stacking: The next pulse arrives immediately before the current pulse has completely ended, causing the waveforms of the two pulses to overlap. On the one hand, the peak value of the second pulse may be inflated due to the superposition of the peak value of the second pulse at the end of the first pulse, resulting in an inflated energy measurement value; on the other hand, the two pulses may be misjudged as a single pulse because they are close together.
[0078] Amplitude extraction: From the processed pulse, find the value that best represents the "intensity" and accurately measure its peak value (or integrate the waveform to obtain the area). This value is proportional to the energy of the incident particle.
[0079] Robustness: refers to the ability of a system to maintain normal operation when encountering abnormal conditions, interference, or input errors.
[0080] Moving average calculation: The input signal is continuously monitored. When a stable signal interval occurs, a fixed-length "time window" is used to slide across the data points, and the arithmetic mean of all data points within the window is always calculated. Real-time tracking is achieved; the window moves forward one step each time a new data point is acquired, enabling adaptive operation.
[0081] Noise standard deviation: When a pure noise signal is acquired without pulse input, the standard deviation of this data is calculated. It is a statistic that measures the magnitude of random noise fluctuations in a signal, representing the "average distance" of the noise from its mean. The larger the value, the greater the noise fluctuation amplitude.
[0082] Pulse width: The duration of the pulse. It reflects the pulse duration broadening characteristics, typically ranging from 1 microsecond to 2 microseconds or hundreds of nanoseconds.
[0083] Maximum value: The maximum data found by an additional module after traversing every point within the pulse. This maximum value is not subject to any logical judgment and is the true maximum value.
[0084] Extreme values: The amplitude of the peak or trough of a pulse waveform after logical judgment. Multiple peaks and troughs can exist within a single pulse.
[0085] Maximum value: The amplitude of the largest peak in the entire pulse waveform. Since the waveform shape, amplitude reference or peak value correspondence may change after the pulse is judged by the algorithm logic, the maximum value of the pulse waveform is not necessarily the maximum value.
[0086] Non-critical errors: Some abnormal conditions that do not affect the validity of the pulse, such as slight baseline drift or clock jitter.
[0087] Number of valid extrema: The total number of valid extrema (peaks and troughs) within a pulse waveform. Ideally, there should be one peak and one trough. If there are more than two extrema, there may be oscillations and interference on the surface.
[0088] Maximum position: The time offset of the maximum point relative to the pulse start time, used to reflect the pulse rise time effect. For pulses with a fixed shape, this value should be relatively stable.
[0089] In view of the technical problems pointed out in the background art, the present invention provides the following embodiments:
[0090] In one exemplary embodiment, an FPGA is provided for plotting energy spectra of a digital nuclear spectrometer, such as... Figure 2 As shown, it includes:
[0091] The data preprocessing module is used to filter, calibrate amplitude, and eliminate baseline of the raw pulse signal output by the detector to output a preprocessed signal.
[0092] The pulse feature event extraction module is used to decompose the preprocessed signal into multiple events that characterize the pulse waveform features, perform logical judgment and filtering on the decomposed events, perform parallel detection on the filtered events, and convert the parallel events into a serial event stream arranged in chronological order.
[0093] The pulse feature event analysis module is used to perform logical filtering and discrimination on the serial event stream to output feature data that characterizes valid pulses;
[0094] The energy spectrum plotting module is used to convert the feature data into an energy spectrum diagram.
[0095] Specifically, the FPGA integrates high-speed signal processing and intelligent pulse analysis. First, the raw pulse signal output from the detector is preprocessed, effectively suppressing noise and glitches through parallel pipelined finite impulse response (FIR) low-pass filtering. Then, combined with adaptive baseline cancellation and amplitude calibration techniques, a high-quality, baseline-stable signal source is provided for subsequent analysis. The preprocessed signal is then input into a pulse feature event extraction module, which decomposes the waveform into six independent feature events, achieving digital deconstruction of the pulse waveform characteristics.
[0096] In the feature analysis phase, the pulse feature event analysis module filters and intelligently identifies the extracted events, ensuring that only valid physical pulses are used for energy spectrum generation by judging the local and overall validity of the pulses. Finally, all identified pulses are used in the energy spectrum plotting module to generate energy spectra through energy mapping. The entire process adopts a hybrid architecture of preprocessing + feature extraction + feature identification, balancing processing speed and analysis depth, significantly improving the system's data throughput capacity and the accuracy and reliability of energy spectrum measurements under high-speed requirements.
[0097] For example, the structure of the data preprocessing module is as follows: Figure 3 As shown, it includes an FIR low-pass filter module, an amplitude calibration module, and a baseline cancellation module connected in sequence. The implementation of each module is described in detail below.
[0098] The FIR low-pass filter module addresses the issue of glitches and noise in the acquired raw pulse signals, particularly those at waveform peaks that can severely impact accuracy. Therefore, an FIR low-pass filter is employed for smoothing and noise reduction. This filter utilizes a parallel pipelined processing architecture (offering superior data processing capabilities compared to non-pipelined filters, which may suffer from packet loss due to timing constraints or data backlog due to insufficient serial processing power). This architecture decomposes lengthy multiplication operations into multiple pipeline stages, inserting registers between stages to temporarily store intermediate results. This approach achieves high-speed parallel processing, ensuring uninterrupted data flow during pulse signal filtering, effectively preventing data loss, and meeting the system's high processing speed requirements.
[0099] Amplitude calibration module: Provides programmable gain and offset parameters to obtain accurate energy values. For example... Figure 4 As shown, the calibration method is as follows: Measurements are performed using a standard radioactive source with known energy. The characteristic peak positions of the standard source are compared with the peak amplitude measured by the system, and calibration parameters are calculated accordingly. In subsequent measurements, all pulse amplitudes are calibrated using the formula: Energy = (Original Amplitude + Offset) * Gain. This process effectively compensates for the nonlinearity and errors of the front-end acquisition link, ensuring the accuracy of the energy spectrum measurement.
[0100] Baseline Elimination Module: Since the input pulse is a continuous wave, its baseline position is affected by environmental changes, including upward and downward offsets. This module aims to adaptively find and eliminate the baseline. The specific implementation method involves designing a moving average filter and employing a delay queue technique to cache the baseline mean in real time. When the pulse start event trigger signal is generated, the baseline mean from N clock cycles ago is read from the delay queue, thus "backtracking" in time to the stable region before the pulse takeoff, effectively avoiding contamination of the baseline calculation during the pulse rise phase. This hardware implementation of "time backtracking" is more technically sophisticated than a simple "skip" description. Specifically, a configurable offset N is set, skipping N points forward from the pulse start point t0 to eliminate leading-edge interference. Then, a data segment of length L (delay queue length) before that point is selected for moving average calculation, and the resulting average value is the estimated baseline level. Finally, this baseline value is subtracted from the pulse signal to complete the calibration. The delay queue continuously caches the latest historical data, providing a dynamic data window for baseline calculation. A schematic diagram of finding the moving average calculation time period L is shown below. Figure 5As shown.
[0101] For example, the structure of the pulse feature event extraction module is as follows: Figure 6 As shown, the system includes a pulse feature extraction module, an event logic control module, and a pulse event recording module connected in sequence. The preprocessed pulse data is input into the pulse feature event extraction module. Instead of using the traditional trapezoidal fitting algorithm to determine the highest point through a trapezoidal plane, it defines multiple states / events to dynamically track the pulse contour, ultimately depicting a complete pulse. The module identifies the pulse's energy and extreme values through event judgment. It extracts pulse feature events, judges them, and records the data. Compared to trapezoidal fitting, it does not make ideal assumptions about the waveform but adaptively identifies the waveform's true feature points, exhibiting better robustness to real waveforms with imperfections such as pulse stacking. The overall data flow is as follows: Figure 7 As shown below, the implementation of each module will be explained in detail.
[0102] Pulse Feature Event Extraction Module: Eight events are defined, including six independent events and two related events. The event relationships are as follows: Figure 8 As shown. The 6 independent events are:
[0103] 1. Pulse Start Event: A valid pulse begins when the pulse signal amplitude is greater than or equal to the set start threshold. If the start threshold requirement is not met, the pulse is discarded. The minimum set value of the start threshold is the baseline mean plus four times the noise standard deviation, effectively suppressing noise and ensuring effective suppression of noise-induced false triggering. Furthermore, the start threshold can be dynamically adjusted according to the detector sensitivity and count rate requirements, for example, by increasing it to 5 / 10 times the noise standard deviation, achieving a balance between detection efficiency and system anti-interference capability.
[0104] 2. Pulse rise event: indicates that the pulse is in the rising phase, at which time the pulse slope is greater than 1.
[0105] 3. Peak event: The maximum amplitude value that appears after the "pulse rise event" and before the "pulse fall event", indicating that the pulse has reached a peak value; if there are noise phenomena such as spikes in the local waveform, it may cause a separate peak.
[0106] 4. Pulse Falling Event: This indicates that the pulse is in the falling phase, at which point the pulse slope is less than 1.
[0107] 5. Trough Event: The minimum amplitude value appearing after the "pulse drop event" and before the "pulse rise event," indicating the occurrence of a pulse trough. Similar to the pulse start event, since the overall pulse must be greater than or equal to the starting threshold, the trough value must also be greater than the starting threshold. If the trough value is less than the starting threshold, it is discarded. The trough value can be used to detect pulse accumulation by determining whether the trough has fallen back to the expected depth (expected baseline level). If the trough does not reach the expected depth, it indicates that the next pulse arrives prematurely, and pulse accumulation has occurred.
[0108] 6. Pulse End Event: When the energy and peak value of the pulse exceed the set starting threshold in opposite directions, it marks the end of a valid pulse.
[0109] Following the pulse end event, two related events occur. These two events are not directly related to the original pulse waveform. They are:
[0110] 1. Pulse start time event: Sent via associated event, suitable for multiple channels running independently at the same time. The pulse start time is sent via associated event to synchronize the time of different channels.
[0111] 2. Total Pulse Energy Event: By eliminating the baseline, the signal over the entire pulse interval is digitally integrated to calculate the total pulse energy.
[0112] The main functions of the pulse feature extraction module include pulse event detection and classification, linearly recording 6 independent events + 2 related events over time, and the state machine process transition relationship is as follows: Figure 9 As shown.
[0113] Event logic control module: Performs logical judgments on the above events and filters error messages, including:
[0114] 1. When the pulse is in its rising phase, the waveform continues to rise with a slope greater than 1, thus capturing a large number of "pulse rising events." These events are counted, but not recorded individually, as too many of the same event would be meaningless and would put pressure on subsequent processing. When the pulse is in its falling phase, the recording of "pulse falling events" is handled in the same way as described above.
[0115] 2. When the pulse start event occurs, record the current time t0, take the data segment of length L from the previous N+L clock cycles as the baseline, and calculate the baseline mean. The starting threshold must be greater than the baseline mean.
[0116] 3. Look for "peak events," which may contain "pulse rise events." The pulse maximum is determined by comparing all the peaks within a pulse. Then look for "pulse fall events" or "trough events." Troughs lie between two peaks and are used as the baseline for the next peak, as described below. Figure 10As shown, when the trough value c is higher than the expected baseline level, pulse accumulation is determined, and c is used as the baseline of peak 2. Before peak 1 begins, the baseline calculation area is selected and the baseline mean y is calculated. The true amplitude value of peak 1 is ay. However, due to the influence of pulse accumulation, trough 1 is used as the baseline of peak 2, so the true amplitude value of peak 2 is bc.
[0117] 4. A trough event must occur after a peak event; without a peak, there is no trough.
[0118] 5. The current time information must be recorded for each event. The time of the "pulse start event" is 0, and then it is accumulated for each clock cycle. The time information is refreshed when the pulse ends.
[0119] 6. Record the number of pulse accumulations for debugging information, including: (1) assessing the real-time load of the system and determining the optimal working count rate range; (2) optimizing the pulse processing algorithm, such as the accumulation threshold; (3) diagnosing the cause of energy spectrum quality degradation and distinguishing between excessively high count rates and other causes; (4) conducting long-term system health checks to determine baseline stability and front-end electronics status.
[0120] 7. Too many extreme values are not allowed between the pulse start event and the pulse end event. If the number of extreme values is ≥2, the pulse will be discarded.
[0121] 8. When multiple events occur at the same time, select the event with the highest priority, and sort them from highest to lowest priority as follows:
[0122] Pulse end event - peak event - pulse rise event - trough event - pulse fall event - pulse start event.
[0123] 9. When performing coincidence comparisons across multiple channels, users can set a coincidence threshold. If the energy difference between different channels at the same time exceeds the coincidence threshold, it is determined that the pulses from different channels near the same timestamp do not originate from the same real event, and the coincidence event is discarded. The coincidence threshold can be set by the user according to the system's own characteristics and application requirements.
[0124] Pulse event recording module: such as Figure 11As shown, there are 6 independent event processing units. To avoid data loss, multiple parallel event detection circuits are set up. Each event detection circuit is equipped with an independent small-capacity asynchronous first-in-first-out (FIFO) buffer, namely FIFO1 to FIFO6. After identifying the pulse data, it is decomposed into data points. All data points are sent synchronously to the 6 independent event processing units. The independent processing units start to identify the data points according to their order and determine whether there is a corresponding event in the data value. If so, the event is temporarily stored in the corresponding FIFO. In addition, the central processing unit monitors the 6 independent event processing units in real time through the event scheduler and converts the parallel occurrence of characteristic events into a serial event stream arranged in time order. Specifically, when data is detected in any of the memorys in FIFO1 to FIFO6, the data is immediately saved to the FIFO in the central processing unit, namely FIFO7. Because the identification is performed according to the order of the pulses, the time when each event detection circuit detects an independent event is sorted according to the time of the event occurrence. For example, the pulse start event is earlier than the pulse rise event in the waveform. Therefore, the pulse start event detected by event detection circuit 1 will be detected earlier than the pulse rise event detected by event detection circuit 2. Subsequently, the central processing unit will monitor whether there is data in FIFO1 to FIFO6 within a nanosecond time period. If data appears in any memory, it will be immediately saved to FIFO7 to ensure that the order of the events is correct. At the same time, it solves the problem that under high-speed sampling, multiple feature events (such as wave peaks and signal rises) may occur simultaneously in a very short time, causing a single state machine to be unable to process them and resulting in packet loss.
[0125] For example, the structure of the pulse feature event analysis module is as follows: Figure 12 As shown, the system includes a pulse characteristic event filtering module, a pulse characteristic event discrimination module, and a spectrum data recording module connected in sequence. The pulse characteristic event filtering module continuously reads event data from FIFO7 of the central processing unit through a filter, and performs data analysis to determine the local validity of the pulse. Electronic noise and interference can generate multiple meaningless local extrema, leading to false triggering, amplitude measurement inaccuracies, and degraded spectrum quality. At this stage, strict pre- and post-condition discrimination effectively filters out noise from pulse events, ensuring that the output extremum events are genuine and valid pulse characteristics. The module employs a cyclic state machine design, capable of handling up to three stacked pulses, providing a high-quality event sequence for the subsequent discrimination module. The overall state machine transition relationship for characteristic event analysis is as follows: Figure 13 As shown below, the implementation of each module will be explained in detail.
[0126] Pulse Feature Event Filtering Module: Performs logical judgment and processing on the pulse events recorded in FIFO7 above, as follows:
[0127] 1. Event noise filtering
[0128] Wait for the pulse start event to occur; if the pulse start event is not a pulse start event, discard it directly.
[0129] Filter out local extreme noise by discarding multiple consecutive small peaks / troughs that appear locally through logical judgment;
[0130] By using a window function sliding filter, adjacent invalid extrema are merged:
[0131] Ensure that the extreme events output are real and valid impulse characteristics.
[0132] 2. Extreme value validity judgment
[0133] All valid peaks are recorded, but each time a new valid peak appears, it is compared with the largest valid peak of the current pulse, and only the largest valid peak is retained as the true peak.
[0134] Consecutive extreme value events are not allowed, and extreme values cannot occur independently. Specifically:
[0135] For peak validity determination, a valid peak must be preceded by N valid rising events and followed by M valid falling events; otherwise, it may be noise and will not be counted as a valid peak. There must be a trough between two consecutive peaks. If a second peak exists but has no trough, it is considered invalid. A second peak requires at least S rising events to be counted. Here, N, M, and S are preset consecutive counting thresholds that can be configured to adapt to the noise characteristics of different detectors. In this embodiment, N is 5, M is 10, and S is 10.
[0136] The validity determination of a trough is based on the premise that a valid peak has been identified, and the trough immediately following the valid peak needs to be counted for at least S rising events. At the same time, the smallest local minimum value is recorded as the valid trough.
[0137] 3. Pulse Accumulation Processing
[0138] Within a single pulse window, valid peaks and troughs are searched alternately until a pulse end event occurs or the maximum stacking depth limit is reached. For example, if the maximum number of consecutive pulses the system can process is set to 3, the system will attempt to identify a maximum of 3 pulses stacked together. This is in contrast to single-peak pulse processing. Figure 14 As shown.
[0139] 4. Guaranteed minimum return mechanism
[0140] The pulse end event carries the true maximum value information. Even if the extreme value identification fails, the pulse can still be identified through the maximum value, serving as a backup method for determining whether the extreme value is correct and in case of unexpected situations.
[0141] Feature event filtering removes redundant events that are irrelevant to energy spectrum mapping, retaining only valid event data for easier subsequent processing.
[0142] Pulse Feature Event Identification Module: Receives the filtered event sequence of pulse feature events, performs validity checks on multiple consecutive feature points, identifies the waveform, and determines whether the pulse is a genuine pulse. Main functions include:
[0143] Identify and collect complete pulse characteristic information, including control information (maximum value hit extreme value, non-critical error, number of effective extreme values, maximum value location, etc.), pulse width, maximum value, pulse start time and total pulse energy;
[0144] Pulse validity determination: Verification is achieved by comparing the maximum value with the true maximum value to ensure the reliability of the maximum value. If the maximum value is equal to the highest peak found, it indicates that the waveform and analysis are perfect and can be used to evaluate the detection performance. Baseline elimination processing: Each extreme value corresponds to a baseline, and the corresponding baseline value is subtracted from each extreme value. Pulse accumulation identification: A single pulse has a maximum of three valid peaks, and the number of output data is intelligently determined according to the extreme value situation.
[0145] Comparative verification, such as Figure 15 As shown, the pulse processing flow begins when the system is in an idle state. Upon reading an event, the flow determines whether it is a pulse start event: if it is not a pulse start, it returns to the idle state; if it is an abnormal pulse start, it proceeds to the rejection stage; if it is confirmed as a valid pulse start, it enters the signal processing stage. The system first obtains event data from the FIFO, collects extreme value information (including peaks, troughs, and other features) and associates it with timestamp events, and performs pulse identification judgment after the pulse ends: if no valid extreme value exists, the maximum value is directly used to perform a single FIFO write and complete the pulse processing; if a valid extreme value exists, it enters the core verification stage to check the extreme value hit status. When the maximum value identified by the algorithm does not coincide with the true maximum value of the sampled data (i.e., "miss"), the maximum value is directly used to perform a single FIFO write and complete the pulse processing.
[0146] The system effectively improves its robustness through a dual-path verification mechanism, which is crucial for industrial applications. Specifically, the system maintains two extreme value statistical paths: one is the logical peak extracted based on waveform geometric features (rising / falling), and the other is the physical maximum value obtained through full-window scanning. At the end of the pulse, the consistency between the two is compared. If they are inconsistent, a safety net mechanism is activated, prioritizing the output of the physical maximum value and marking a warning. When the maximum value identified by the algorithm coincides with the true maximum value of the sampled data (i.e., a "hit"), the system intelligently selects the output mode based on the number of extreme values (using the maximum value for a single write when a hit occurs, and activating a cyclic write mechanism when multiple valid extreme values exist). Finally, the pulse processing is completed and the system returns to an idle state, thus completing the entire process of ensuring the reliability of waveform analysis through maximum and maximum value consistency verification.
[0147] Spectrum data recording module: Output data encapsulation, data output example as follows Figure 16 As shown, the complete information of a single pulse is encapsulated. Depending on the number of extreme values, a pulse may generate 1-3 output data points. These data are then stored in FIFO8, providing high-quality, structured pulse characteristic data for subsequent multichannel spectrum analysis. Each valid pulse occupies one data position in FIFO8, and each data point carries all the pulse's information. This information includes control information, pulse width, maximum value, pulse start time, and total pulse energy.
[0148] Furthermore, the energy spectrum plotting module, as the final output stage of the core algorithm module of the digital nuclear spectrometer FPGA, is responsible for converting the pulse events after feature analysis and screening into energy spectrum diagrams and providing a standardized system interface. The core functions and implementation path are as follows:
[0149] 1. Pulse validity assessment
[0150] Before the energy spectrum is accumulated, the pulse event stream is checked again based on the state machine to ensure logical consistency.
[0151] 2. Energy Spectrum Data Generation Process
[0152] Energy value mapping (channel conversion) linearly maps the total energy or peak amplitude of each pulse that passes the validity test to the corresponding channel value in the energy spectrum, according to a preset energy scale system (e.g., channel value = gain * energy value + offset). For example, a 0-10V amplitude quantization is quantized into channels 0-8191.
[0153] A dual-port RAM is used as a multichannel analyzer in the FPGA. When a valid pulse energy channel value is received, a read-modify-write operation is performed. This enables pulse statistical counting within a specific energy range. Accumulated energy spectrum data blocks are stored, supporting operations such as clearing the energy spectrum, freezing (pausing accumulation), and segmented reading.
[0154] 3. Standardized AXI4 interface and system integration
[0155] This nuclear spectrometer algorithm module is a complete and reusable IP core that uses a standard AXI4 interface to communicate with external processors or other host devices.
[0156] In another exemplary embodiment, a method for plotting energy spectrum of a digital nuclear spectrometer is provided, the method being executed by the FPGA, comprising the following steps:
[0157] S1. The raw pulse signal from the detector is received through the data preprocessing module, and the raw pulse signal is filtered, amplitude calibrated and baseline eliminated to output the preprocessed signal;
[0158] S2. The preprocessed signal is decomposed into multiple events that characterize the pulse waveform features by the pulse feature event extraction module. Logical judgment and filtering are performed on the decomposed events, the filtered events are detected in parallel, and the parallel events are converted into a serial event stream arranged in chronological order.
[0159] S3. The serial event stream is logically filtered and identified by the pulse feature event analysis module to output feature data representing valid pulses;
[0160] S4. Convert the feature data into an energy spectrum using the energy spectrum plotting module.
[0161] In another exemplary embodiment, a digital nuclear spectrometer system is provided, such as Figure 17 As shown, it includes:
[0162] As described in the first aspect, the FPGA is used to implement the core algorithm processing of the digital nuclear spectrometer;
[0163] The detector (not shown in the diagram) is used to convert nuclear radiation into multiple raw pulse signals.
[0164] An analog-to-digital conversion and cross-clock domain processing module is connected between the detector and the FPGA, and is used to sequentially perform analog-to-digital conversion, cross-clock domain data synchronization, buffering and merging on the multiple raw pulse signals.
[0165] A hardware delay and data filtering module is connected between the detector and the FPGA to synchronize and filter multiple raw pulse signals.
[0166] The central processing unit is connected to the FPGA via a communication bus interface. It is used to receive energy spectrum diagrams, perform advanced energy spectrum analysis, and dynamically configure the FPGA parameters.
[0167] The analog-to-digital conversion and cross-clock domain processing module includes an ADC module and a cross-clock domain data synchronization, buffering, and merging module connected in sequence; the hardware delay and data filtering module includes a hardware delay chain module, a condition-based decision module, and a condition-based event statistics module connected in sequence.
[0168] Specifically, in this system, the pulse signal is divided into two paths, entering the hardware delay chain module and the ADC module respectively. The hardware delay chain module ensures that the associated signals from different detectors can be synchronized, and then sent to the condition judgment module, which judges whether multiple signals produce approximately equal energy within nanoseconds. The event statistics module counts the events that meet the conditions, assisting the digital nuclear spectrometer algorithm processing module in data filtering. In addition, after the pulse signal enters the ADC module for analog-to-digital conversion, it is subjected to a cross-clock domain data synchronization, buffering, and merging module (FIFO) to solve the clock domain asynchrony problem, realize the merging and packaging of multi-channel data, and then input into the digital nuclear spectrometer algorithm processing module to perform data processing and generate energy spectrum. Finally, it enters the central processing unit (such as CPU) through the communication bus for advanced energy spectrum analysis, while simultaneously performing dynamic parameter configuration, algorithm optimization, and adjustment of front-end hardware parameters.
[0169] Furthermore, in order for the input pulse signal to be recognized and processed by the FIR low-pass filter, the ADC module needs to perform analog-to-digital conversion on the acquired signal. Simultaneously, by setting calibration parameters, the signal with missing code errors is complemented. The functional flow of the ADC module is as follows: Figure 18 As shown.
[0170] The above detailed embodiments are a description of the present invention. It should not be considered that the specific embodiments of the present invention are limited to these descriptions. For those skilled in the art, several simple deductions and substitutions can be made without departing from the concept of the present invention, and all of these should be considered to fall within the protection scope of the present invention.
Claims
1. An FPGA for plotting energy spectrum of a digital nuclear spectrometer, characterized in that, include: The data preprocessing module is used to filter, calibrate amplitude, and eliminate baseline of the raw pulse signal output by the detector to output a preprocessed signal. The pulse feature event extraction module is used to decompose the preprocessed signal into multiple events that characterize the pulse waveform features, perform logical judgment and filtering on the decomposed events, perform parallel detection on the filtered events, and convert the parallel events into a serial event stream arranged in chronological order. The pulse feature event extraction module includes: The pulse feature extraction module is used to detect and classify pulse events, and to linearly record multiple events that characterize pulse waveform features over time; the multiple events that characterize pulse waveform features include 6 independent events: pulse start event, pulse rise event, peak event, pulse fall event, trough event, and pulse end event; The event logic control module is used to perform logical judgments on the events extracted by the pulse feature extraction module and to filter error messages; The detection and classification pulse events include: Pulse accumulation identification: Determine whether the trough value of the trough event is higher than the expected baseline level established for the current pulse; If so, pulse accumulation is determined to have occurred, and the trough value of the trough event is used as the baseline level corresponding to the subsequent peak event, which is then used to calculate the peak value of the next peak event. The pulse feature event extraction module also includes: The pulse event recording module, connected to the event logic control module, includes multiple parallel event detection circuits and a central processing unit. Each event detection circuit is used to detect a specific type of event and is equipped with an independent first-in-first-out (FIFO) buffer. The central processing unit is used to poll the FIFO buffers of each event detection circuit and read them out in the order of the events occurring, merging them into the serial event stream. The pulse feature event analysis module is used to perform logical filtering and discrimination on the serial event stream to output feature data that characterizes valid pulses; The energy spectrum plotting module is used to convert the feature data into an energy spectrum diagram.
2. The FPGA for plotting energy spectrum of a digital nuclear spectrometer according to claim 1, characterized in that, The pulse characteristic event analysis module includes: The pulse feature event filtering module is used to perform logical judgment processing on the pulse events recorded in the central processing unit. The logical judgment processing includes: The validity of peak and trough events is determined by a preset continuous counting threshold, and only valid event data is retained.
3. The FPGA for plotting energy spectrum of a digital nuclear spectrometer according to claim 2, characterized in that, The pulse feature event analysis module also includes: A pulse feature event discrimination module, connected to the pulse feature event filtering module, is used to determine the validity of pulses based on the valid event data. The pulse validity determination includes: The pulse maximum value is compared with the signal's true maximum value for verification. When the maximum value matches the true maximum value, the output mode is intelligently selected based on the number of extreme values. When the maximum value does not match the true maximum value, a safety net mechanism is activated, prioritizing the output of the physical maximum value and marking a warning sign. The spectrum data recording module is used to store the data identified by the pulse feature event identification module in a first-in-first-out buffer.
4. The FPGA for plotting energy spectrum of a digital nuclear spectrometer according to claim 1, characterized in that, The step of converting the feature data into an energy spectrum includes: The energy information in the feature data is mapped to energy spectrum channel addresses and accumulated statistically to generate and store energy spectrum data.
5. A method for plotting energy spectrum using a digital nuclear spectrometer, characterized in that, The method is executed by the FPGA according to any one of claims 1-4, and includes the following steps: S1. The raw pulse signal from the detector is received through the data preprocessing module, and the raw pulse signal is filtered, amplitude calibrated and baseline eliminated to output the preprocessed signal; S2. The preprocessed signal is decomposed into multiple events that characterize the pulse waveform features by the pulse feature event extraction module. Logical judgment and filtering are performed on the decomposed events, the filtered events are detected in parallel, and the parallel events are converted into a serial event stream arranged in chronological order. S3. The serial event stream is logically filtered and identified by the pulse feature event analysis module to output feature data representing valid pulses; S4. Convert the feature data into an energy spectrum using the energy spectrum plotting module.
6. A digital nuclear spectrometer system, characterized in that, include: The FPGA as described in any one of claims 1-4; Detectors are used to convert nuclear radiation into multiple raw pulse signals; An analog-to-digital conversion and cross-clock domain processing module is connected between the detector and the FPGA, and is used to sequentially perform analog-to-digital conversion, cross-clock domain data synchronization, buffering and merging on the multiple raw pulse signals. A hardware delay and data filtering module is connected between the detector and the FPGA to synchronize and filter multiple raw pulse signals. The central processing unit is connected to the FPGA via a communication bus interface. It is used to receive energy spectrum diagrams, perform advanced energy spectrum analysis, and dynamically configure the FPGA parameters.
7. A digital nuclear spectrometer system according to claim 6, characterized in that, The system also includes a display module connected to the central processing unit for displaying the energy spectrum locally; the communication bus interface is a standard AXI4 interface.
Citation Information
Patent Citations
Pulsing signal recognition device and method
CN101136624A
Nuclear pulse signal energy spectrum forming method and multichannel pulse analyzer
CN115902996A