Real-time compensation method for dynamic error of contact type displacement sensor
By dynamically calibrating and preprocessing the contact displacement sensor and designing an IIR digital filter using the Grey Wolf optimization algorithm, the problem of insufficient dynamic response of the sensor is solved, and fast and accurate signal capture and measurement are achieved.
Patent Information
- Application Number
- CN202510875977.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-09-05
AI Technical Summary
Existing contact displacement sensors have insufficient dynamic response capabilities in high-precision and high-profile displacement test systems and are unable to quickly and accurately capture instantaneous changes in the measured signal, resulting in inaccurate test results.
By dynamically calibrating the displacement sensor and performing data preprocessing, the transfer function of the dynamic compensator is obtained using the Grey Wolf optimization algorithm, and an IIR digital filter is deployed for real-time compensation, including the construction of a cascaded IIR digital filter and quantization coefficient analysis to improve the dynamic response capability of the sensor.
It realizes real-time dynamic compensation of the sensor, shortens the response time, reduces overshoot, and increases the measurement working frequency band to meet test requirements.
Smart Images

Figure CN120593679A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of displacement sensors, and in particular relates to a real-time compensation method for dynamic errors of contact displacement sensors. Background Art
[0002] In high-precision and high-profile displacement testing systems, contact displacement sensors, at the forefront of signal acquisition, assume the core function of directly sensing the measured variable. Their dynamic response capability is a key factor in determining the accuracy and precision of test results. Ideally, displacement sensors must be able to quickly and accurately reproduce the dynamic changes of the measured signal to ensure the reliability of test data.
[0003] However, currently, due to limitations in manufacturing processes and technological advancements, these sensors suffer from slow dynamic response and a narrow operating frequency band, making it difficult to capture instantaneous changes in the measured signal and unable to meet the demands of complex test scenarios. According to test theory, the operating bandwidth of the test system must fully cover the highest frequency component of the measured signal to achieve accurate measurements. However, existing displacement sensors have a relatively narrow operating frequency band, making it difficult to cover the full range of frequency components contained in dynamic signals. This fundamental factor restricts their dynamic response speed. Therefore, an efficient dynamic error compensation method is urgently needed. Summary of the Invention
[0004] The purpose of the present invention is to provide a real-time compensation method for the dynamic error of a contact displacement sensor, so as to solve the problem that the existing contact displacement sensor cannot provide accurate displacement information, cannot achieve real-time response, and cannot quickly and accurately reflect the measured value.
[0005] The technical solution adopted by the present invention is a real-time compensation method for dynamic error of a contact displacement sensor, comprising the following steps: Step 1: dynamically calibrate the displacement sensor to obtain input and output signals of the dynamic calibration of the displacement sensor; Step 2: Perform data preprocessing based on the output signal of the dynamic calibration; Step 3: Obtain the transfer function of the dynamic compensator based on the output signal of the dynamic calibration after data preprocessing. Step 4: deploy an IIR digital filter based on the transfer function of the dynamic compensator, and use the IIR digital filter to perform real-time compensation on the displacement sensor.
[0006] The present invention is also characterized in that In step 1, the displacement sensor is dynamically calibrated, specifically including: dynamically calibrating the displacement sensor using one of a negative step method and a hammer method.
[0007] Data preprocessing in step 2 includes removing gross errors and amplitude normalization.
[0008] In step 3, the transfer function of the dynamic compensator is obtained based on the output signal of the dynamic calibration after data preprocessing, which specifically includes: According to the output signal of dynamic calibration after data preprocessing, the transfer function of the displacement sensor dynamic compensator is obtained using the Grey Wolf optimization algorithm.
[0009] The Grey Wolf optimization algorithm is used to obtain the transfer function of the displacement sensor dynamic compensator. Specifically, the output signal of the displacement sensor is used as the input of the Grey Wolf optimization algorithm, the input signal of the displacement sensor is used as the output of the Grey Wolf optimization algorithm, and the mean square error between the input and output of the algorithm is used as the objective function. The transfer function coefficient of the displacement sensor dynamic compensator is obtained by the Grey Wolf optimization algorithm, and the transfer function of the torque sensor dynamic compensator is obtained. Among them, the differential equation of the displacement sensor is shown as follows: ; Where, For ideal sensor output data, Output data for actual sensors; is the fitting error; 、 Indicates order; It is a parameter determined by the sensor system and structure; represents the delay operator; The above equation is expressed as a compensation form in vector form, as shown below: ; in, ; ; Where, is the spatial position of the particle in the gray wolf optimization algorithm, and its initial value is randomly generated; is a constant; The gray wolf optimization algorithm is to search for a set of Minimize the fitness function; The fitness function is shown as follows: ; Where, Dynamically calibrated output signal of the displacement sensor.
[0010] In step 4, an IIR digital filter is deployed based on the transfer function of the dynamic compensator, specifically including: Step 4.1: Construct an IIR digital filter with a cascade structure. The transfer function of the cascade IIR digital filter is as follows: ; Where, is a constant, , , 、 are real zeros and poles respectively, and are the complex conjugate pairs of zeros and poles respectively; Step 4.2: Convert the transfer function of the IIR digital filter in step 4.1 into two second-order section cascade structures to obtain two subsystems, which are shown in the following formula: ; Step 4.3: Analyze the zero-pole distribution of the two subsystems obtained in step 4.2 and the original transfer function system before decomposition using MATLAB tools to verify whether the zeros and poles of each subsystem are all within the unit circle and analyze whether the filter performance is stable. Step 4.4, analyze the quantized coefficients of the transfer functions of the two subsystems respectively; In step 4.5, based on the quantized coefficients of the subsystem transfer functions analyzed in step 4.4, the two subsystems are quantized and converted into differential equations to obtain an IIR digital filter, which is expressed as follows: .
[0011] Step 4.3 is to use the MATLAB Control System Toolbox to draw the zero-pole diagram of each subsystem and observe whether all the zeros and poles are located within the unit circle; If all zero-order points in the obtained subsystem zero-pole diagram are located within the unit circle, the filter performance is stable; otherwise, the filter performance is unstable.
[0012] In step 4.4, the quantization coefficients of the transfer functions of the two subsystems are analyzed respectively. Specifically, the transfer functions of the two subsystems are discretized and quantized to obtain an amplitude-frequency characteristic curve. The deviation between the amplitude-frequency characteristic curve and the curve without coefficient quantization is compared, and the quantization coefficient with the smaller phase offset is selected. The beneficial effects of the present invention are: The present invention provides a real-time compensation method for the dynamic error of a contact displacement sensor. The method dynamically calibrates the sensor, preprocesses the output signal of the dynamic calibration, designs a dynamic compensator using the Gray Wolf optimization algorithm, and uses an FPGA to design a digital filter. This method shortens the response time and adjustment time of the sensor, reduces the overshoot of the displacement sensor, increases the measurement operating frequency band, and realizes real-time dynamic compensation of the displacement sensor, thereby meeting testing requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 Schematic diagram of the flow chart of the real-time compensation method for dynamic error of the contact displacement sensor of the present invention; Figure 2 This is a time domain effect diagram of the displacement sensor before and after dynamic compensation of the present invention; Figure 3 The structure diagram of the IIR-based cascaded IIR digital filter of the present invention; Figure 4 It is the zero-pole distribution diagram of the subsystem and the overall system of the present invention; Figure 5 For the present invention Comparison chart of different quantization coefficients of subsystems; Figure 6 For the present invention Comparison chart of different quantization coefficients of subsystems; Figure 7 The top-level file RTL schematic diagram of the digital filter of the present invention; Figure 8 This is a simulation effect diagram of the digital filter of the present invention. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0015] Example 1 The real-time compensation method for the dynamic error of the contact displacement sensor of the present invention is as follows: Figure 1 As shown, the specific steps include: Step 1: Dynamically calibrate the displacement sensor, specifically including: dynamically calibrating the displacement sensor using one of a negative step method and a hammering method. Obtain input and output signals of the dynamic calibration of the displacement sensor; Step 2: Perform data preprocessing based on the output signal of the dynamic calibration; data preprocessing includes removing gross errors and amplitude normalization.
[0016] Step 3: Obtain the transfer function of the dynamic compensator based on the output signal of the dynamic calibration after data preprocessing. Step 4: deploy an IIR digital filter based on the transfer function of the dynamic compensator, and use the IIR digital filter to perform real-time compensation on the displacement sensor.
[0017] By utilizing dynamic calibration data and using a swarm intelligence optimization algorithm to determine the order and coefficients of the dynamic compensation filter under established comparison rules, the system's frequency response can be optimized within the target frequency range, improving the sensor's dynamic performance. Taking the Gray Wolf Optimization Algorithm as an example, the displacement sensor's output data is used as the algorithm's input, and the displacement sensor's input data is used as the algorithm's output. The mean square error between the algorithm's input and output is used as the objective function. The Gray Wolf Optimization Algorithm is used to determine the transfer function coefficients of the displacement sensor's dynamic compensator, resulting in the transfer function of the displacement sensor's dynamic compensator.
[0018] The present invention provides a real-time compensation method for the dynamic error of a contact displacement sensor. The method dynamically calibrates the sensor, preprocesses the output signal of the dynamic calibration, designs a dynamic compensator using the Gray Wolf optimization algorithm, and uses an FPGA to design a digital filter. This method shortens the response time and adjustment time of the sensor, reduces the overshoot of the displacement sensor, increases the measurement operating frequency band, and realizes real-time dynamic compensation of the displacement sensor, thereby meeting testing requirements.
[0019] Example 2 The real-time compensation method for the dynamic error of the contact displacement sensor of the present invention specifically comprises the following steps: Step 1: Dynamically calibrate the displacement sensor, specifically including: dynamically calibrating the displacement sensor using one of a negative step method and a hammering method. Obtain input and output signals of the dynamic calibration of the displacement sensor; Step 2: Perform data preprocessing based on the output signal of the dynamic calibration; data preprocessing includes removing gross errors and amplitude normalization.
[0020] Step 3: Obtain the transfer function of the dynamic compensator based on the output signal of the dynamic calibration after data preprocessing. Step 4: deploy an IIR digital filter based on the transfer function of the dynamic compensator, and use the IIR digital filter to perform real-time compensation on the displacement sensor.
[0021] Furthermore, in step 3, the transfer function of the dynamic compensator is obtained according to the output signal of the dynamic calibration after data preprocessing, which specifically includes: According to the output signal of dynamic calibration after data preprocessing, the transfer function of the displacement sensor dynamic compensator is obtained using the Grey Wolf optimization algorithm.
[0022] Specifically, the output signal of the displacement sensor is used as the input of the Grey Wolf optimization algorithm, the input signal of the displacement sensor is used as the output of the Grey Wolf optimization algorithm, and the mean square error between the input and output of the algorithm is used as the objective function. The transfer function coefficient of the displacement sensor dynamic compensator is obtained through the Grey Wolf optimization algorithm, and the transfer function of the torque sensor dynamic compensator is obtained.
[0023] Among them, the differential equation of the displacement sensor is shown as follows: ; Where, For ideal sensor output data, Output data for actual sensors; is the fitting error; 、 Indicates order; It is a parameter determined by the sensor system and structure; represents the delay operator; The above equation is expressed as a compensation form in vector form, as shown below: ; in, ; ; Where, is the spatial position of the particle in the gray wolf optimization algorithm, and its initial value is randomly generated; is a constant; The gray wolf optimization algorithm is to search for a set of Minimize the fitness function; The fitness function is shown as follows: ; Where, Dynamically calibrated output signal of the displacement sensor.
[0024] Its time domain compensation effect is as follows Figure 2 shown.
[0025] Depend on Figure 2 It can be seen that the sensor's time domain response is significantly improved by the dynamic compensation of the Gray Wolf optimization algorithm. The output signal can quickly respond to changes in the input signal, the overshoot zero is greatly reduced, the rise time is significantly shortened, and the steady-state error is controlled within a very small range.
[0026] Example 3 This embodiment is based on the above embodiment 2. The real-time compensation method for the dynamic error of the contact displacement sensor of the present invention needs to design the required IIR filter structure according to the transfer function of the dynamic compensator obtained by the gray wolf optimization algorithm. The design of the IIR digital filter is based on a series of parameters. and order to construct the transfer function and difference equations ; For example, as shown below: Transfer function: ; Difference equation: ; The present invention selects a cascade structure according to design requirements and combines the advantages and disadvantages of each structure, such as Figure 3 As shown, it has good stability and the poles and zeros of each section can be flexibly adjusted.
[0027] That is, in step 4 of the present invention, deploying an IIR digital filter based on the transfer function of the dynamic compensator specifically includes: Step 4.1: Construct an IIR digital filter with a cascade structure. The transfer function of the cascade IIR digital filter is as follows: ; Where, is a constant, , , 、 are real zeros and poles respectively, and are the complex conjugate pairs of zeros and poles respectively; Decomposing it into the product form of several second-order systems, it can be expressed as follows: ; Where, is the number of second-order nodes, by taking greater than or equal to The smallest integer.
[0028] Step 4.2: Convert the transfer function of the IIR digital filter in step 4.1 into two second-order section cascade structures to obtain two subsystems, which are shown in the following formula: ; ; Step 4.3: Analyze the zero-pole distribution of the two subsystems obtained in step 4.2 and the original transfer function system before decomposition using MATLAB tools, verify whether the zero poles of each subsystem are within the unit circle, and analyze whether the filter performance is stable; Figure 4 As shown, it can be seen that the zeros and poles of each subsystem are all within the unit circle, and the performance of the array filter is stable; Step 4.4, analyze the quantized coefficients of the transfer functions of the two subsystems respectively; In step 4.5, the two subsystems are quantized according to the quantized coefficients of the subsystem transfer functions obtained in step 4.3, and converted into differential equations to obtain IIR digital filters, which are expressed as follows: .
[0029] Example 4 In this embodiment, based on the above embodiment 3, step 4.3 of the present invention specifically involves using the MATLAB control system toolbox to draw a zero-pole diagram of each subsystem and observe whether all the zeros and poles are located within the unit circle; If all zero-order points in the obtained subsystem zero-pole diagram are located within the unit circle, the filter performance is stable. Otherwise, the filter performance is unstable. If it is unstable, it is necessary to adjust the system coefficients, change the filter structure, or use MATLAB tools to optimize the filter coefficients.
[0030] Example 5 In this embodiment, based on the above embodiment 3, the quantization coefficient of the transfer function is generally set to 8 bits and 12 bits. In step 4.4 of the present invention, the transfer functions of the two subsystems are discretized and quantized to model the amplitude-frequency characteristic curves. The MATLAB tool is used to respectively and The transfer function coefficients of the two subsystems are quantified to obtain Figure 5 and Figure 6 The quantization coefficient comparison chart shows that 12-bit quantization coefficients have better amplitude-frequency characteristics than 8-bit quantization coefficients. Their amplitude-frequency curve is essentially the same as that of the unquantized coefficients, with no phase shift. By varying the number of quantization bits, the minimum word length that meets design requirements can be determined, balancing accuracy and hardware implementation complexity. Based on this analysis, 12-bit quantization coefficients were selected.
[0031] Example 6 The real-time compensation method for the dynamic error of the contact displacement sensor of the present invention specifically comprises the following steps: Step 1: Dynamically calibrate the displacement sensor, specifically including: dynamically calibrating the displacement sensor using one of a negative step method and a hammering method. Obtain input and output signals of the dynamic calibration of the displacement sensor; Step 2: Perform data preprocessing based on the output signal of the dynamic calibration; data preprocessing includes removing gross errors and amplitude normalization.
[0032] Step 3: Obtain the transfer function of the dynamic compensator based on the output signal of the dynamic calibration after data preprocessing. The transfer function of the dynamic compensator is solved as follows: ; Step 4: deploy an IIR digital filter based on the transfer function of the dynamic compensator, and use the IIR digital filter to perform real-time compensation on the displacement sensor.
[0033] In this embodiment, the two subsystems are quantized separately and converted into a difference equation form to obtain an IIR digital filter, which is expressed as follows: ; ; According to the quantized differential equation, the IIR digital filters of the two subsystems are designed respectively, and then they are cascaded to obtain the top-level file RTL view as shown below: Figure 7 As shown, the input step signal is saved in binary format as the input signal of the filter, and the filter simulation result is as shown in the figure Figure 8 As shown in the figure, it can be seen that the time domain response of the sensor is significantly improved after digital filter compensation, the output signal can quickly respond to changes in the input signal, the overshoot is greatly reduced, the rise time is significantly shortened, and the steady-state error is controlled within a very small range.
[0034] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0035] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A real-time compensation method for dynamic errors of contact displacement sensors, characterized in that: The following steps are involved: Step 1: dynamically calibrate the displacement sensor to obtain input and output signals of the dynamic calibration of the displacement sensor; Step 2: Perform data preprocessing based on the output signal of the dynamic calibration; Step 3, obtaining a transfer function of a dynamic compensator according to the output signal of the dynamic calibration after data preprocessing; Step 4: deploy an IIR digital filter based on the transfer function of the dynamic compensator, and use the IIR digital filter to perform real-time compensation on the displacement sensor.
2. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 1, characterized in that: The step 1 of dynamically calibrating the displacement sensor specifically includes: dynamically calibrating the displacement sensor using one of a negative step method and a hammer method.
3. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 1, characterized in that: The data preprocessing in step 2 includes removing gross errors and amplitude normalization.
4. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 1, characterized in that: In step 3, the transfer function of the dynamic compensator is obtained according to the output signal of the dynamic calibration after data preprocessing, which specifically includes: According to the output signal of dynamic calibration after data preprocessing, the transfer function of the displacement sensor dynamic compensator is obtained using the Grey Wolf optimization algorithm.
5. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 4, characterized in that: The method of using the Gray Wolf optimization algorithm to obtain the transfer function of the displacement sensor dynamic compensator specifically comprises the following steps: using the output signal of the displacement sensor as the input of the Gray Wolf optimization algorithm, using the input signal of the displacement sensor as the output of the Gray Wolf optimization algorithm, and using the mean square error between the input and output of the algorithm as the objective function, thereby obtaining the transfer function coefficient of the displacement sensor dynamic compensator through the Gray Wolf optimization algorithm, and obtaining the transfer function of the torque sensor dynamic compensator; Among them, the differential equation of the displacement sensor is shown as follows: ; Where, For ideal sensor output data, Output data for actual sensors; is the fitting error; 、 Indicates order; It is a parameter determined by the sensor system and structure; represents the delay operator; The above equation is expressed as a compensation form in vector form, as shown below: ; in, ; ; Where, is the spatial position of the particle in the gray wolf optimization algorithm, and its initial value is randomly generated; is a constant; The gray wolf optimization algorithm is to search for a set of Minimize the fitness function; The fitness function is shown as follows: ; Where, Dynamically calibrated output signal of the displacement sensor.
6. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 1, characterized in that: In step 4, deploying an IIR digital filter based on the transfer function of the dynamic compensator specifically includes: Step 4.1, construct an IIR digital filter with a cascade structure. The transfer function of the cascade IIR digital filter is as follows: ; Where, is a constant, , , 、 are real zeros and poles respectively, and are the complex conjugate pairs of zeros and poles respectively; Step 4.2: Convert the transfer function of the IIR digital filter in step 4.1 into two second-order section cascade structures to obtain two subsystems, which are shown in the following formula: ; Step 4.3: Analyze the zero-pole distribution of the two subsystems obtained in step 4.2 and the original transfer function system before decomposition using MATLAB tools to verify whether the zeros and poles of each subsystem are within the unit circle and analyze whether the filter performance is stable. Step 4.4, analyze the quantized coefficients of the transfer functions of the two subsystems respectively; In step 4.5, based on the quantized coefficients of the subsystem transfer functions analyzed in step 4.4, the two subsystems are quantized and converted into differential equations to obtain an IIR digital filter, which is expressed as follows: 。 7. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 6, characterized in that: Step 4.3 specifically involves using the MATLAB control system toolbox to draw a zero-pole diagram of each subsystem and observing whether all the zero poles are located within the unit circle; If all zero-order points in the obtained subsystem zero-pole diagram are located within the unit circle, the filter performance is stable; otherwise, the filter performance is unstable.
8. The real-time compensation method for dynamic error of a contact displacement sensor according to claim 6, characterized in that: The analysis of the quantization coefficients of the transfer functions of the two subsystems in step 4.4 is specifically to discretize and quantize the transfer functions of the two subsystems to obtain an amplitude-frequency characteristic curve, compare the deviation between the amplitude-frequency characteristic curve and the curve without coefficient quantization, and select the quantization coefficient with the smaller phase offset.