Laser ranging synchronization and anomaly diagnosis method and system based on shared timestamp
By configuring a free-running counter in the industrial laser rangefinder, a unified time reference is provided for the SSI and Ethernet interfaces, and a shared timestamp is generated. This solves the problem of independent SSI and Ethernet data, enabling efficient anomaly diagnosis and synchronous data transmission of the laser rangefinder, ensuring continuous operation and high reliability of the production line.
Patent Information
- Application Number
- CN202611404506.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-06
AI Technical Summary
The SSI and Ethernet interfaces of existing industrial laser rangefinders are independent and cannot be accurately correlated, making it difficult to locate the root cause of anomalies. Furthermore, the diagnostic and real-time modes are mutually exclusive, affecting the continuous operation of the production line.
A free-running counter is configured in the industrial laser rangefinder to provide a unified time reference for the SSI interface and Ethernet interface, generate a shared timestamp, realize the synchronization of SSI frames and diagnostic data, and generate an Ethernet diagnostic packet to be uploaded to the host computer for association when an anomaly is triggered.
It achieves precise correlation between SSI frames and diagnostic data, shortens fault diagnosis time, ensures continuous operation of the production line, and can fully capture occasional anomalies, providing high-reliability operation assurance.
Smart Images

Figure CN123055228A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial sensor data communication and online diagnostic technology, specifically to a laser ranging synchronization and anomaly diagnosis method based on shared timestamps that simultaneously supports SSI real-time distance output and industrial Ethernet diagnostic data transmission. Background Technology
[0002] Currently, mid-to-high-end industrial laser rangefinders (such as the Leuze AMS 348i and Pepperl+Fuchs VDM100) generally adopt a dual-interface architecture of SSI (Synchronous Serial Interface) + Industrial Ethernet for data transmission. However, the aforementioned interface architecture has the following core defects: (1) The data of the two interfaces are independent of each other and cannot be accurately correlated: the SSI output is driven by the external master device clock, and the Ethernet data is sent asynchronously by the protocol stack. There is no unified time reference between the two. The distance value and the diagnostic data at the same time may have a deviation of tens of milliseconds, and they cannot be matched one by one.
[0003] (2) Difficulty in locating the root cause of anomalies: When occasional anomalies such as distance jumps or echo loss occur on site, maintenance personnel cannot associate the abnormal values output by SSI with the original echo waveform corresponding to the laser echo signal (i.e., the SSI frame cannot be associated with the original echo waveform), and can only guess the cause based on experience.
[0004] (3) Diagnostic and real-time modes are mutually exclusive: Existing products need to switch to diagnostic mode to read the original waveform, which will pause or reduce the SSI output, affecting the continuous operation of the production line. Moreover, occasional anomalies often do not reappear after the pause, making it difficult to capture effective data.
[0005] Therefore, given the aforementioned shortcomings, how to provide a laser ranging synchronization and anomaly diagnosis method that can achieve accurate correlation between SSI frames and diagnostic data without interrupting real-time SSI output has become an urgent problem to be solved. Summary of the Invention
[0006] The purpose of this invention is to provide a laser ranging synchronization and anomaly diagnosis method and system based on shared timestamps, in order to solve the problems of existing technologies where dual-interface data are independent, cannot be accurately correlated, are difficult to locate the root cause of anomalies, and are mutually exclusive between diagnosis and real-time modes.
[0007] To achieve the above objectives, the present invention adopts the following technical solution: Firstly, a laser ranging synchronization and anomaly diagnosis method based on shared timestamps is provided, applied to an industrial laser rangefinder. The industrial laser rangefinder communicates with an external PLC device via an SSI interface and with a host computer via an Ethernet interface. The industrial laser rangefinder is equipped with a free-running counter. The SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter. The method includes: After responding to the SSI clock signal sent by the external PLC device, an SSI real-time data stream is generated. The SSI real-time data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and the frame timestamp. The frame timestamp of any SSI frame is obtained based on the free-running counter. Upon receiving the laser echo signal, Ethernet diagnostic data is generated in real time. The Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude, and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter. Based on SSI real-time data stream and Ethernet diagnostic data, laser ranging anomaly diagnosis is performed, and after an anomaly is triggered, an Ethernet diagnostic packet is generated. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform. The Ethernet diagnostic packet is sent to the host computer so that after receiving the Ethernet diagnostic packet, the host computer can read the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, and use it as the abnormal SSI frame, and output it in association with the original waveform.
[0008] Based on the above disclosure, this invention configures a free-running counter in an industrial laser rangefinder to provide a unified time reference for the SSI interface, ranging core, and Ethernet interface. This ensures that the SSI frame and diagnostic data (raw ADC waveform) are synchronized from the same source. This fundamentally solves the problem of tens of milliseconds of deviation caused by the independence of SSI and Ethernet data and the different time references in traditional architectures, ensuring a strict correspondence between the distance value and the diagnostic data at the same moment. Simultaneously, anomaly detection is performed based on the real-time SSI data stream and Ethernet diagnostic data. When an anomaly is triggered, a diagnostic packet containing the anomaly timestamp and the corresponding raw waveform is uploaded to the host computer, thereby enabling the host computer to... The system accurately retrieves and associates SSI frames at the same time, thereby achieving a one-to-one mapping between "distance jumps and waveform characteristics." This allows maintenance personnel to directly analyze the root cause based on waveform analysis, eliminating reliance on experience-based guesses and significantly shortening troubleshooting time. Furthermore, this invention continuously generates diagnostic data during normal ranging and only packages and uploads it after an anomaly is triggered, without needing to switch to a dedicated diagnostic mode or interrupting real-time SSI output. Occasional anomalies can be fully captured under continuous monitoring, completely solving the industry pain points of "diagnosis and real-time mutual exclusion" and "anomalies not recurring after pause" in traditional solutions. Based on this, this invention provides a solid guarantee for high-reliability operation in industrial sites, making it highly suitable for large-scale application and promotion.
[0009] In one possible design, laser ranging anomaly diagnosis is performed based on SSI real-time data stream and Ethernet diagnostic data. Upon an anomaly trigger, an Ethernet diagnostic packet is generated, including: Based on the original ADC waveform and the corresponding signal-to-noise ratio and echo amplitude, signal quality detection is performed, and distance jump detection is performed based on the laser ranging distance corresponding to each SSI frame. If there is a signal quality abnormality and / or a distance jump abnormality, an abnormality trigger is performed to determine the signal timestamp corresponding to the signal quality abnormality and / or the frame timestamp corresponding to the distance jump, which are used as the abnormal timestamp. Based on the abnormal timestamp and the original ADC waveform, the original waveform corresponding to the abnormal timestamp is determined, and the Ethernet diagnostic packet is generated using the abnormal timestamp and the original waveform corresponding to the abnormal timestamp.
[0010] In one possible design, signal quality detection is performed based on the original ADC waveform and the corresponding signal-to-noise ratio and echo amplitude, including: Based on the echo amplitude corresponding to the original ADC waveform, the echo peak value of the laser echo signal is determined; Determine whether the echo peak value is less than a preset peak value, whether the signal-to-noise ratio is less than a signal-to-noise ratio threshold, and / or whether multiple consecutive target waveforms are invalid echoes, wherein the multiple target waveforms are the original ADC waveform corresponding to the laser echo signal and the original ADC waveforms corresponding to two consecutive laser echo signals acquired before the laser echo signal; If so, it is determined that the industrial laser rangefinder has an abnormal signal quality; Accordingly, distance jump detection is performed based on the laser ranging distance corresponding to each SSI frame, which includes: Determine whether there exists any SSI frame where the difference in laser ranging distance between any two adjacent SSI frames is greater than a preset value; If so, the industrial laser rangefinder is determined to have an abnormal distance jump.
[0011] In one possible design, when there are signal quality anomalies and / or distance jump anomalies, the method further includes: generating anomaly types and adding the anomaly types to Ethernet diagnostic packets for joint transmission to a host computer, wherein the anomaly types include echo amplitude anomalies, distance jump anomalies, continuous frame drops, and / or signal-to-noise ratio anomalies.
[0012] In one possible design, based on the abnormal timestamp and the original ADC waveform, the original waveform corresponding to the abnormal timestamp is determined, including: Continue to receive several laser echo signals to generate several target ADC waveforms and store them in a buffer area. The buffer area also stores historical ADC waveforms corresponding to several laser echo signals before the current laser echo signal. Use the original ADC waveform corresponding to the abnormal timestamp as the starting frame waveform; From the waveforms stored in the buffer, extract multiple consecutive historical ADC waveforms before the starting frame waveform and multiple consecutive target ADC waveforms after the starting frame waveform to serve as associated frame waveforms. The original waveform corresponding to the abnormal timestamp is formed by using the starting frame waveform and the associated frame waveform.
[0013] In one possible design, the frame timestamp of any SSI frame is the timestamp output by the free-running counter at the start time of any SSI frame. After generating the SSI real-time data stream, the method further includes: storing the SSI real-time data stream into the circular buffer of the FPGA in the industrial laser rangefinder, so that the host computer can read the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the circular buffer as the abnormal SSI frame. Correspondingly, the timestamp of the laser echo signal is the timestamp output by the free-running counter when the Ethernet diagnostic data is stored in the MAC transmit buffer.
[0014] In one possible design, a minimum allowable time interval is set between two adjacent abnormal triggers, and a maximum trigger frequency is set for the abnormal trigger. When the maximum trigger frequency is exceeded, the abnormal trigger is triggered again, and only the abnormal log is recorded, without generating Ethernet diagnostic packets again.
[0015] Secondly, a laser ranging synchronization and anomaly diagnosis system based on shared timestamps is provided, applied to an industrial laser rangefinder. The industrial laser rangefinder communicates with an external PLC device via an SSI interface and with a host computer via an Ethernet interface. The industrial laser rangefinder is equipped with a free-running counter, and the SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter. The industrial laser rangefinder includes: The SSI interface module is used to generate an SSI real-time data stream in response to an SSI clock signal sent by an external PLC device. The SSI real-time data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and the frame timestamp. The frame timestamp of any SSI frame is obtained based on a free-running counter. The echo receiving and ADC sampling module is used to generate Ethernet diagnostic data in real time after receiving the laser echo signal. The Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter. An anomaly detection module is used to perform laser ranging anomaly diagnosis based on SSI real-time data stream and Ethernet diagnostic data, and generate an Ethernet diagnostic packet after an anomaly is triggered. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform. The Ethernet interface module is used to send Ethernet diagnostic packets to the host computer. After receiving the Ethernet diagnostic packet, the host computer reads the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, and uses it as the abnormal SSI frame. The SSI frame is then associated with the original waveform and output.
[0016] Thirdly, a laser ranging synchronization and anomaly diagnosis device based on shared timestamps is provided. Taking the device as an electronic device as an example, it includes a memory, a processor, and a transceiver that are connected in sequence. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect or any possible design of the first aspect.
[0017] Fourthly, a storage medium is provided, on which instructions are stored, which, when executed on a computer, perform the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect or any possible design of the first aspect.
[0018] Fifthly, a computer program product containing instructions is provided, which, when executed on a computer, cause the computer to perform the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect or any possible design of the first aspect.
[0019] Beneficial effects: (1) This invention configures a free-running counter in an industrial laser rangefinder to provide a unified time reference for the SSI interface, ranging core, and Ethernet interface. This ensures that the SSI frame and diagnostic data (original ADC waveform) are synchronized from the same source. This fundamentally solves the problem of tens of milliseconds of deviation caused by the independence of SSI and Ethernet data and the different time references in the traditional architecture, ensuring a strict correspondence between the distance value and the diagnostic data at the same moment. At the same time, anomaly detection is performed based on the real-time SSI data stream and Ethernet diagnostic data. When an anomaly is triggered, a diagnostic packet containing the anomaly timestamp and the original waveform corresponding to the anomaly timestamp is uploaded to the host computer, so that the host computer can use this information to perform the corresponding diagnostic data. This invention accurately retrieves and associates SSI frames at the same time, thereby achieving a one-to-one mapping between "distance jumps" and "waveform characteristics." This allows maintenance personnel to directly analyze the root cause based on waveform analysis, eliminating reliance on experience-based guesses and significantly shortening troubleshooting time. Furthermore, this invention continuously generates diagnostic data during normal ranging and only packages and uploads it after an anomaly is triggered, without needing to switch to a dedicated diagnostic mode or interrupting real-time SSI output. Occasional anomalies can be fully captured under continuous monitoring, completely solving the industry pain points of "diagnosis and real-time mutual exclusion" and "anomalies not recurring after pause" in traditional solutions. Based on these, this invention provides a solid guarantee for high-reliability operation in industrial sites, making it highly suitable for large-scale application and promotion. Attached Figure Description
[0020] Figure 1 A flowchart illustrating the steps of a laser ranging synchronization and anomaly diagnosis method based on shared timestamps provided in an embodiment of the present invention; Figure 2 This is an architecture diagram of a laser ranging synchronization and anomaly diagnosis system based on shared timestamps provided in an embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.
[0022] It should be understood that although the terms first, second, etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit, without departing from the scope of the exemplary embodiments of the invention.
[0023] It should be understood that the term "and / or" that may appear in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" that may appear in this document describes another relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the related objects before and after it are in an "or" relationship.
[0024] Example: See Figure 1As shown, the laser ranging synchronization and anomaly diagnosis method based on shared timestamps provided in the first aspect of this embodiment can be applied to, but is not limited to, industrial laser rangefinders. In specific implementation, the industrial laser rangefinder is connected to an external PLC device via an SSI interface and to a host computer via an Ethernet interface. The industrial laser rangefinder is equipped with a free-running counter (which can be configured in the FPGA of the industrial laser rangefinder; it is a continuously incrementing 64-bit hardware counter that does not automatically stop; for example, its resolution is N). The SSI interface (N value can be set according to actual use), driven by the system clock, runs automatically after power-on and does not overflow throughout its entire life cycle. The SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter (the counter value can be read through a Gray code synchronizer to avoid metastability and make the synchronization delay fixed and compensable). Thus, the core principle of the method provided in this embodiment is: to run a shared free-running hardware counter inside the FPGA as a global time reference. The SSI interface, Ethernet interface, distance calculation, and anomaly detection all read the same counter to print timestamps, so that all data fields share the same time axis. On this basis, anomalies are automatically detected and the original waveforms before and after the anomalies are captured. The accurate correlation between the SSI frame and the diagnostic data is achieved by comparing the timestamps.
[0025] It is understood that the aforementioned execution entity does not constitute a limitation on the embodiments of this application. Accordingly, the operation steps of this method may be, but are not limited to, the steps S1 to S4 below.
[0026] S1. Upon responding to the SSI clock signal sent by the external PLC device, a real-time SSI data stream is generated. This real-time SSI data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and a frame timestamp. The frame timestamp of any SSI frame is obtained based on a free-running counter. In this embodiment, the industrial laser rangefinder acts as an SSI slave, passively responding to the external clock. That is, when the external PLC device sends an SSI clock signal to the industrial laser rangefinder, the FPGA in the industrial laser rangefinder detects the start time of the SSI frame (the first falling edge of the clock). The time value output by the aforementioned free-running counter is latched as the frame timestamp (i.e., the frame timestamp of any SSI frame, which is the timestamp output by the free-running counter at the start time of any SSI frame); at the same time, the FPGA performs distance calculation, retrieves the latest 24-bit distance value (the distance value is calculated in real time by the laser ToF time of flight), and outputs the 24-bit distance value (binary / Gray code optional) bit by bit according to the SSI protocol timing, thereby serving as the laser ranging distance of the current SSI frame; in this way, based on the aforementioned method, the FPGA can generate a real-time SSI data stream.
[0027] Furthermore, after generating the SSI real-time data stream, the SSI real-time data stream is also stored in the circular buffer of the FPGA in the industrial laser rangefinder for subsequent backtracking and querying by the host computer. During caching, the frame number and status flag of each frame can also be cached. For example, the depth of the aforementioned circular buffer can be set to 1024 frames (approximately 1 second of history). Of course, the depth of the circular buffer can be specifically set according to actual use, and this embodiment is not limited to the aforementioned example.
[0028] After generating the real-time SSI data stream, Ethernet diagnostic data can be generated, as shown in step S2 below.
[0029] S2. Upon receiving the laser echo signal, Ethernet diagnostic data is generated in real time. This Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude, and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter. In specific applications, the Ethernet diagnostic data is generated by the FPGA acquiring the laser echo signal of the current frame in real time (i.e., one transmitted pulse and the received echo signal), performing analog-to-digital conversion to obtain the original ADC waveform, calculating its corresponding signal-to-noise ratio, and extracting the echo amplitude of the original ADC waveform at different times. Furthermore, the original ADC waveform can be transmitted via 100BASE-TX (the IEEE 802.3u standard, which defines a Fast Ethernet signaling standard with a rate of up to 100Mbps over Category 5 unshielded twisted pair (UTP) or shielded twisted pair (STP) cable) (when triggered), and additional data such as signal strength, temperature, voltage, and laser status are collected.
[0030] In practice, when each Ethernet diagnostic data is sent into the MAC transmit buffer, the current value of the free-running counter is latched as a signal timestamp; thus, the signal timestamp corresponding to the laser echo signal is the timestamp output by the free-running counter when the Ethernet diagnostic data is stored into the MAC transmit buffer.
[0031] After obtaining the Ethernet diagnostic data, it can be combined with the aforementioned SSI real-time data stream to perform anomaly diagnosis, as shown in step S3 below.
[0032] S3. Based on the SSI real-time data stream and Ethernet diagnostic data, perform laser ranging anomaly diagnosis, and generate an Ethernet diagnostic packet after an anomaly is triggered. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform. In this embodiment, this step is an anomaly detection and trigger capture step, that is, the FPGA monitors the echo signal quality indicators (including echo amplitude, signal-to-noise ratio SNR and consecutive invalid frame count) and jump distance indicators in real time, and triggers an anomaly event when any indicator exceeds its corresponding threshold, thereby capturing the abnormal waveform (i.e., the original waveform corresponding to the anomaly timestamp below).
[0033] Optionally, the abnormality diagnosis process may be, but is not limited to, the steps S31 to S33 below.
[0034] S31. Based on the original ADC waveform and the corresponding signal-to-noise ratio and echo amplitude, perform signal quality detection, and based on the laser ranging distance corresponding to each SSI frame, perform distance jump detection.
[0035] In practical applications, the echo peak value of the laser echo signal is first determined based on the echo amplitude corresponding to the original ADC waveform (i.e., the maximum absolute value is selected from each echo amplitude as the echo peak value). Then, it is determined whether the echo peak value is less than a preset peak value, whether the signal-to-noise ratio is less than a signal-to-noise ratio threshold, and / or whether multiple consecutive target waveforms (such as three consecutive ones) are invalid echoes (in this embodiment, multiple target waveforms are the original ADC waveform corresponding to the laser echo signal and the original ADC waveforms corresponding to the two consecutive laser echo signals acquired before the laser echo signal). If so, it is determined that the industrial laser rangefinder has a signal quality abnormality. Similarly, when performing distance jump detection, it is determined whether there is any difference in laser ranging distance between any two adjacent SSI frames in all SSI frames that is greater than a preset value. If so, it is determined that the industrial laser rangefinder has a distance jump abnormality.
[0036] Furthermore, when there are signal quality anomalies and / or distance jump anomalies, the FPGA will also generate anomaly types and add them to the Ethernet diagnostic packets for transmission to the host computer. For example, the aforementioned anomaly types may include, but are not limited to, echo amplitude anomalies, distance jump anomalies, continuous frame drops, and / or signal-to-noise ratio anomalies.
[0037] Optionally, the detailed process of the aforementioned anomaly detection is disclosed below: In this embodiment, 10% of the full amplitude range (the full amplitude range is a set value) is used as the preset peak value. When the echo peak value is less than 10% of the full amplitude range, it is determined that there is an abnormal echo amplitude. The possible reasons are: the target is too far away, the reflectivity is low, or the optical path is blocked.
[0038] Similarly, if the signal-to-noise ratio (SNR) is less than 6dB, an SNR anomaly (i.e., low SNR) is considered to exist, which may be caused by low measurement confidence. Furthermore, if the peak value of any target waveform is less than 10% of the full-scale amplitude or the SNR is less than 6dB, the FPGA determines that target waveform as an "invalid echo" frame, and the FPGA maintains a counter. When an invalid frame is detected, the counter increments by 1; once any frame is valid, the counter is immediately reset to zero. If three consecutive frames (three target waveforms) are invalid echoes, consecutive frame drops are considered. Optionally, if any target waveform has an incomplete frame or a CRC check error, or other data integrity anomalies, that target waveform is also determined to be an "invalid echo" frame. In practical use, the causes of consecutive frame drops may include: target loss, strong interference, and laser malfunction.
[0039] In addition, in this embodiment, when the difference in laser ranging distance between any two adjacent SSI frames is greater than 50mm, it is determined that there is a distance jump anomaly (i.e., the distance jump is too large). The causes of this anomaly are mostly multipath reflection, target switching and measurement error. In this embodiment, the anomaly detection thresholds of the aforementioned indicators can be remotely configured by the host computer through the Ethernet interface.
[0040] Thus, when an anomaly diagnosis is completed and there are abnormal echo amplitude, abnormal distance jump, continuous frame loss and / or abnormal signal-to-noise ratio, an anomaly trigger will be performed, that is, an Ethernet diagnostic packet with an abnormal timestamp and its corresponding original waveform will be generated. The process can be, but is not limited to, as shown in steps S32 and S33 below.
[0041] S32. If there is a signal quality abnormality and / or a distance jump abnormality, an abnormality trigger is performed to determine the signal timestamp corresponding to the signal quality abnormality and / or the frame timestamp corresponding to the distance jump, which are used as the abnormal timestamp.
[0042] S33. Based on the abnormal timestamp and the original ADC waveform, determine the original waveform corresponding to the abnormal timestamp, and use the abnormal timestamp and the original waveform to generate the Ethernet diagnostic packet. In specific applications, after determining the abnormal timestamp, the original waveform can be captured based on it. The process is as follows: First, the FPGA continues to receive several laser echo signals to generate several target ADC waveforms, which are then stored in a buffer. (The FPGA allocates a buffer specifically for cyclically storing the complete ADC waveform for each frame. Regardless of whether an anomaly occurs, the ADC waveform data for each frame (1000Hz) is written to this buffer in real time, with new data automatically overwriting the oldest data. This buffer also stores historical ADC waveforms corresponding to several laser echo signals preceding the current one.) Therefore, this buffer acts like a "time machine," always preserving the ADC waveforms corresponding to the most recent dozens of frames. Based on this, when the FPGA detects an anomaly, it continues to receive and process the echoes normally, then continuously writes waveforms to the buffer until a preset number is reached (e.g., further buffering). After 16 frames, all 33 sets of original ADC waveform data from frame m-16 to frame m+16 (where m is the sequence number of the original ADC waveform corresponding to the echo signal of the current frame) are read from the buffer to serve as the original waveform corresponding to the abnormal timestamp. That is, the original ADC waveform corresponding to the abnormal timestamp is used as the starting frame waveform. Then, from the waveforms stored in the buffer, multiple consecutive historical ADC waveforms before the starting frame waveform and multiple consecutive target ADC waveforms after the starting frame waveform are extracted to serve as associated frame waveforms. Finally, the starting frame waveform and the associated frame waveforms can be used to form the original waveform corresponding to the abnormal timestamp. In this way, the real-time output of the SSI real-time data stream is not interrupted (i.e., the SSI real-time data stream is continuously sent to the external PLC device through the SSI interface).
[0043] Furthermore, in this embodiment, a trigger silence period and a maximum trigger frequency (10 times / s) are set for abnormal triggers. That is, a minimum allowable time interval (which can be set to 100ms) is set between two adjacent abnormal triggers. When the maximum trigger frequency is exceeded, if an abnormality is triggered again, only an abnormal log is recorded (that is, the timestamp of the abnormal trigger event is recorded), and Ethernet diagnostic packets are not generated repeatedly. In this way, bandwidth can be prevented from being fully occupied.
[0044] Therefore, based on the aforementioned step S3 and its sub-steps, after generating an Ethernet diagnostic packet carrying an abnormal timestamp and its corresponding original waveform, the diagnostic packet can be uploaded, as shown in step S4 below.
[0045] S4. Send the Ethernet diagnostic packet to the host computer so that after receiving the Ethernet diagnostic packet, the host computer can read the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, use it as the abnormal SSI frame, and associate it with the original waveform for output.
[0046] In practice, as mentioned above, when an anomaly is detected, an anomaly type is also generated. Therefore, the anomaly type can also be packaged into the Ethernet diagnostic package for uploading, which facilitates the rapid determination of the cause of the anomaly.
[0047] Furthermore, the aforementioned Ethernet diagnostic packets can be transmitted based on the UDP / IP protocol, or the Ethernet diagnostics can be uploaded as vendor-defined objects encapsulated in PROFINET or EtherNet / IP industrial Ethernet protocols. Of course, the specific upload method can be set according to actual use, and this embodiment does not impose specific limitations.
[0048] In this embodiment, when the host computer receives the Ethernet diagnostic packet, it can extract the abnormal timestamp inside. Then, it queries the circular buffer in the FPGA to find the frame timestamp that matches the abnormal timestamp (if the absolute value of the time difference between a frame timestamp and the abnormal timestamp is less than 1ms, the two are considered to match). Then, the SSI frame corresponding to the matching frame timestamp is taken as the abnormal SSI frame, and thus it is associated with the original waveform of the abnormal timestamp, thereby realizing a one-to-one mapping from the abnormal distance value to the original waveform. Since both share the same hardware counter, the time alignment error is less than 1μs. Therefore, the 33 frames of waveform captured by the abnormality can be mapped to the corresponding SSI frame number, thereby realizing one-click traceability of "abnormal distance value → original waveform". Finally, the associated original waveform and abnormal distance value are output, which allows maintenance personnel to directly locate the root cause based on the waveform characteristics, thereby greatly improving the efficiency of on-site fault diagnosis.
[0049] Therefore, through the laser ranging synchronization and anomaly diagnosis method based on shared timestamps described in detail in steps S1 to S4 above, this invention provides a unified time reference for the SSI interface, ranging core, and Ethernet interface by using a built-in free-running counter. This fundamentally eliminates the tens of millisecond time deviation between the real-time SSI distance value and the Ethernet diagnostic data in the traditional architecture, achieving precise correlation between the distance frame and the original echo waveform at the same moment. Simultaneously, the host computer can accurately retrieve and correlate the corresponding SSI frame and the original waveform based on the anomaly timestamp, enabling maintenance personnel to directly locate the root cause based on waveform characteristics, thereby significantly improving the efficiency of on-site fault diagnosis and thoroughly addressing the issue. This invention addresses the industry pain points of traditional solutions, such as data independence, difficulty in tracing root causes, and the mutual exclusion between diagnosis and real-time monitoring. Furthermore, by continuously caching diagnostic data during normal ranging, and only uploading it in packages after an anomaly is triggered, this invention allows for the complete capture of sporadic jumps or echo loss events without switching diagnostic modes during anomaly monitoring. This ensures uninterrupted SSI output and guarantees continuous operation of the production line. Therefore, this invention provides a laser rangefinder data synchronization and anomaly diagnosis technology that simultaneously supports SSI real-time distance output and industrial Ethernet diagnostic data transmission, providing a solid guarantee for high-reliability operation in industrial settings. Thus, it is highly suitable for large-scale application and promotion.
[0050] like Figure 2 As shown, the second aspect of this embodiment provides a software system for implementing the laser ranging synchronization and anomaly diagnosis method based on shared timestamps described in the first aspect of the embodiment. This system is applied to an industrial laser rangefinder. The industrial laser rangefinder is connected to an external PLC device via an SSI interface and to a host computer via an Ethernet interface. The industrial laser rangefinder is equipped with a free-running counter. The SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter. The industrial laser rangefinder includes: The SSI interface module is used to generate a real-time SSI data stream in response to an SSI clock signal sent by an external PLC device. The real-time SSI data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and the frame timestamp. The frame timestamp of any SSI frame is obtained based on a free-running counter.
[0051] The echo receiving and ADC sampling module is used to generate Ethernet diagnostic data in real time after receiving the laser echo signal. The Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter.
[0052] An anomaly detection module is used to perform laser ranging anomaly diagnosis based on SSI real-time data stream and Ethernet diagnostic data, and generate an Ethernet diagnostic packet after an anomaly is triggered. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform.
[0053] The Ethernet interface module is used to send Ethernet diagnostic packets to the host computer. After receiving the Ethernet diagnostic packet, the host computer reads the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, and uses it as the abnormal SSI frame. The SSI frame is then associated with the original waveform and output.
[0054] The working process, working details and technical effects of the system provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0055] like Figure 3 As shown, the third aspect of this embodiment provides a laser ranging synchronization and anomaly diagnosis device based on shared timestamps. Taking the device as an electronic device as an example, it includes: a memory, a processor, and a transceiver that are connected in sequence. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect of the embodiment.
[0056] For specific examples, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out (FIFO) memory, and / or first-in-last-out (FILO) memory, etc.; specifically, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor, also known as the CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state.
[0057] In some embodiments, the processor may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. For example, the processor may not be limited to microprocessors of the STM32F105 series, reduced instruction set computer (RISC) microprocessors, x86 architecture processors, or processors with integrated neural network processing units (NPUs). The transceiver may be, but is not limited to, a Wi-Fi transceiver, a Bluetooth transceiver, a General Packet Radio Service (GPRS) transceiver, a ZigBee transceiver (a low-power LAN protocol based on the IEEE 802.15.4 standard), a 3G transceiver, a 4G transceiver, and / or a 5G transceiver. Furthermore, the device may also include, but is not limited to, a power module, a display screen, and other necessary components.
[0058] The working process, working details and technical effects of the electronic device provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0059] The fourth aspect of this embodiment provides a storage medium that stores instructions containing the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect of the embodiment. That is, the storage medium stores instructions that, when executed on a computer, perform the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect of the embodiment.
[0060] The storage medium refers to a carrier for storing data, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or memory sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0061] The working process, working details and technical effects of the storage medium provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0062] The fifth aspect of this embodiment provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in the first aspect of this embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0063] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A shared timestamp-based laser ranging synchronization and anomaly diagnosis method, applied to an industrial laser range finder, the industrial laser range finder being connected to an external PLC device through an SSI interface and connected to a host computer through an Ethernet interface, characterized in that, The industrial laser rangefinder is equipped with a free-running counter. The SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter, and the method includes: After responding to the SSI clock signal sent by the external PLC device, an SSI real-time data stream is generated. The SSI real-time data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and the frame timestamp. The frame timestamp of any SSI frame is obtained based on the free-running counter. Upon receiving the laser echo signal, Ethernet diagnostic data is generated in real time. The Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude, and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter. Based on SSI real-time data stream and Ethernet diagnostic data, laser ranging anomaly diagnosis is performed, and after an anomaly is triggered, an Ethernet diagnostic packet is generated. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform. The Ethernet diagnostic packet is sent to the host computer so that after receiving the Ethernet diagnostic packet, the host computer can read the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, and use it as the abnormal SSI frame, and output it in association with the original waveform.
2. The method of claim 1, wherein, Based on SSI real-time data stream and Ethernet diagnostic data, laser ranging anomaly diagnosis is performed, and an Ethernet diagnostic packet is generated after an anomaly is triggered, including: Based on the original ADC waveform and the corresponding signal-to-noise ratio and echo amplitude, signal quality detection is performed, and distance jump detection is performed based on the laser ranging distance corresponding to each SSI frame. If there is a signal quality abnormality and / or a distance jump abnormality, an abnormality trigger is performed to determine the signal timestamp corresponding to the signal quality abnormality and / or the frame timestamp corresponding to the distance jump, which are used as the abnormal timestamp. Based on the abnormal timestamp and the original ADC waveform, the original waveform corresponding to the abnormal timestamp is determined, and the Ethernet diagnostic packet is generated using the abnormal timestamp and the original waveform corresponding to the abnormal timestamp.
3. The method of claim 2, wherein, Based on the original ADC waveform and its corresponding signal-to-noise ratio and echo amplitude, signal quality detection is performed, including: Based on the echo amplitude corresponding to the original ADC waveform, the echo peak value of the laser echo signal is determined; Determine whether the echo peak value is less than a preset peak value, whether the signal-to-noise ratio is less than a signal-to-noise ratio threshold, and / or whether multiple consecutive target waveforms are invalid echoes, wherein the multiple target waveforms are the original ADC waveform corresponding to the laser echo signal and the original ADC waveforms corresponding to two consecutive laser echo signals acquired before the laser echo signal; If so, it is determined that the industrial laser rangefinder has an abnormal signal quality; Accordingly, distance jump detection is performed based on the laser ranging distance corresponding to each SSI frame, which includes: Determine whether there exists any SSI frame where the difference in laser ranging distance between any two adjacent SSI frames is greater than a preset value; If so, the industrial laser rangefinder is determined to have an abnormal distance jump.
4. The method of claim 3, wherein, When there are signal quality abnormalities and / or distance jump abnormalities, the method further includes: generating an abnormality type and adding the abnormality type to the Ethernet diagnostic packet for joint transmission to the host computer, wherein the abnormality type includes echo amplitude abnormality, distance jump abnormality, continuous frame loss and / or signal-to-noise ratio abnormality.
5. The method of claim 2, wherein, Based on the abnormal timestamp and the original ADC waveform, the original waveform corresponding to the abnormal timestamp is determined, including: Continue to receive several laser echo signals to generate several target ADC waveforms and store them in a buffer area. The buffer area also stores historical ADC waveforms corresponding to several laser echo signals before the current laser echo signal. Use the original ADC waveform corresponding to the abnormal timestamp as the starting frame waveform; From the waveforms stored in the buffer, extract multiple consecutive historical ADC waveforms before the starting frame waveform and multiple consecutive target ADC waveforms after the starting frame waveform to serve as associated frame waveforms. The original waveform corresponding to the abnormal timestamp is formed by using the starting frame waveform and the associated frame waveform.
6. The method of claim 1, wherein, The frame timestamp of any SSI frame is the timestamp output by the free-running counter at the start time of any SSI frame. After generating the SSI real-time data stream, the method further includes: storing the SSI real-time data stream in the circular buffer of the FPGA in the industrial laser rangefinder, so that the host computer can read the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the circular buffer as the abnormal SSI frame. Correspondingly, the timestamp of the laser echo signal is the timestamp output by the free-running counter when the Ethernet diagnostic data is stored in the MAC transmit buffer.
7. The method according to claim 1, characterized in that, A minimum allowed time interval is set between two consecutive abnormal triggers, and a maximum trigger frequency is set for abnormal triggers. When the maximum trigger frequency is exceeded, the abnormal trigger will only record the abnormal log and will not generate Ethernet diagnostic packets again.
8. A laser ranging synchronization and anomaly diagnosis system based on shared timestamps, characterized in that, This invention relates to an industrial laser rangefinder, wherein the industrial laser rangefinder communicates with an external PLC device via an SSI interface and with a host computer via an Ethernet interface. The industrial laser rangefinder is equipped with a free-running counter, and the SSI interface, the industrial laser rangefinder, and the Ethernet interface share the timestamp output by the free-running counter. The industrial laser rangefinder includes: The SSI interface module is used to generate an SSI real-time data stream in response to an SSI clock signal sent by an external PLC device. The SSI real-time data stream includes several SSI frames, the laser ranging distance corresponding to each SSI frame, and the frame timestamp. The frame timestamp of any SSI frame is obtained based on a free-running counter. The echo receiving and ADC sampling module is used to generate Ethernet diagnostic data in real time after receiving the laser echo signal. The Ethernet diagnostic data includes the original ADC waveform corresponding to the laser echo signal, as well as the signal-to-noise ratio, echo amplitude and signal timestamp corresponding to the original ADC waveform. The signal timestamp is obtained based on a free-running counter. An anomaly detection module is used to perform laser ranging anomaly diagnosis based on SSI real-time data stream and Ethernet diagnostic data, and generate an Ethernet diagnostic packet after an anomaly is triggered. The Ethernet diagnostic packet includes an anomaly timestamp and the original waveform corresponding to the anomaly timestamp in the original ADC waveform. The Ethernet interface module is used to send Ethernet diagnostic packets to the host computer. After receiving the Ethernet diagnostic packet, the host computer reads the SSI frame corresponding to the frame timestamp that matches the abnormal timestamp from the industrial laser rangefinder based on the abnormal timestamp in the Ethernet diagnostic packet, and uses it as the abnormal SSI frame. The SSI frame is then associated with the original waveform and output.
9. An electronic device, characterized in that, include: A memory, a processor, and a transceiver are sequentially connected in communication, wherein the memory is used to store computer programs, the transceiver is used to send and receive messages, and the processor is used to read the computer programs and execute the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in any one of claims 1 to 7.
10. A computer program product containing instructions, characterized in that, When the instruction is executed on the computer, it causes the computer to perform the laser ranging synchronization and anomaly diagnosis method based on shared timestamps as described in any one of claims 1 to 7.
