An error correction method for ultra-precision measurement of grating displacement
By using time convolutional neural network (TCN) to correct the error of grating signals, the problem of grating sensors being disturbed by environmental factors in displacement measurement is solved, achieving higher measurement accuracy and smaller errors.
Patent Information
- Application Number
- CN202411021801.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-07-29
AI Technical Summary
During the displacement measurement process, the grating sensor is susceptible to interference from temperature, humidity, vibration and pressure in the environment, resulting in inaccurate measurement results.
The time convolutional neural network (TCN) is used to correct the error of the grating signal. By analyzing and collecting environmental factors, such as temperature, humidity, vibration and pressure, the initial data set is constructed and pre-processed, and the TCN model is trained to output the displacement value after the environmental error is corrected.
It significantly improves the measurement accuracy of the grating sensor, alleviates the impact of environmental factors on the measurement results, and reduces measurement errors.
Smart Images

Figure CN118857114B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the relevant field of grating signal measurement, and in particular to a grating signal error correction method. Background Art
[0002] Grating sensors have been widely used in ultra-precision displacement measurement due to their high accuracy, high resolution, low cost, compact structure and many other advantages. Grating displacement sensors can obtain high-precision displacement measurement results. However, in actual ultra-precision displacement measurement, grating sensors will inevitably be interfered by signals from the surrounding environment, resulting in measurement errors and negatively affecting the displacement measurement accuracy of grating sensors.
[0003] The main sources of environmental signal errors include factors such as temperature, humidity, vibration, and pressure. Although the grating sensor has good resistance to environmental interference, in actual displacement measurement, the influence of factors such as temperature, humidity, vibration, and pressure in the surrounding environment cannot be ignored. For example, temperature changes cause thermal expansion of the grating, humidity and pressure changes affect the refractive index of the air and thus the wavelength of the light source, and vibration causes amplitude errors in the grating signal. Therefore, in order to improve the precision and accuracy of the measurement, it is particularly important to correct the environmental errors of the grating sensor signal. Summary of the invention
[0004] The present invention provides an error correction method for ultra-precision measurement of grating displacement, which aims to solve the problem that the grating sensor displacement measurement process is easily disturbed by the temperature, humidity, vibration and pressure in the environment, thus causing inaccurate measurement results.
[0005] To solve the above technical problems, the embodiments of the present invention provide the following technical solutions:
[0006] A first aspect of the present invention provides an error correction method for ultra-precision measurement of grating displacement, comprising the following steps:
[0007] S10. Analyze the influence of environmental factors in the environment on the displacement measurement of the grating sensor, including temperature, vibration, humidity and pressure;
[0008] S20. Collecting signals from the grating sensor, and using the sensor to collect temperature, humidity, vibration and pressure signals in the surrounding environment when the grating sensor is measuring, while constructing an initial data set and preprocessing the initial data set;
[0009] S30. Construct a TCN network structure, and use evaluation indicators to select TCN parameters. After obtaining the optimal parameters, train the TCN based on the obtained parameters, and form an improved TCN network by replacing the activation function and train it;
[0010] S40. Construct a validation dataset, input the grating signal and the environmental signal in the validation dataset into the TCN model together, and output the displacement value corrected by the environmental error based on the trained TCN model.
[0011] In some modified implementation manners of the first aspect of the present invention, S11. Analyze the influence principle of temperature on the grating sensor and the influence relationship on the displacement measurement result; the expression is as follows:
[0012]
[0013] Among them, t0 is the initial working temperature of the grating; when the working temperature becomes t, the change amounts of the grating pitch d and the measuring length L of the grating sensor are Δd and ΔL;
[0014] S12. Analyze the influence principle of vibration on the grating sensor and the influence relationship on the displacement measurement result; the expression is:
[0015] When 0 < t < (T / 4):
[0016]
[0017] When (2i - 1)T / 4 < t ≤ (2i + 1)T / 4:
[0018]
[0019] Among them, i = 1, 2, 3…, T is the period of the grating signal, f exc is the frequency of the vibration excitation, f is the fundamental frequency of the signal output by the grating sensor, sinc is the normalized cardinal sine function, is the phase difference between the vibration signal and the measurement signal, δ is the amplitude factor, if the signal changes between 0 and 1, then δ is directly related to the amplitude of the measurement signal, and S0 represents the signal output by the grating sensor when the initial phase is 0.
[0020] S13. Analyze the influence of humidity and pressure on the measurement process of the grating sensor and the influence relationship on the displacement measurement result; humidity and pressure mainly affect the displacement measurement result of the grating sensor by causing changes in the refractive index of air. The expression of the Edlén formula describing the change in the refractive index of air is:
[0021]
[0022] (n - 1) x =(n - 1) s [1 + 0.5327(x - 0.0004)];
[0023]
[0024] ntpf -n tp =-f(3.8020-0.0384σ 2 )×10 -10 ;
[0025] Among them, (n-1) s represents the refractive index in dry air, σ is the reciprocal of the wavelength of light in vacuum, which is used to represent the wave number; (n-1) x To consider the refractive index of air with respect to CO2 concentration, x represents the CO2 concentration. (n-1) tp represents the refractive index of air under the influence of temperature T and pressure P; n tpf Represents the refractive index of air affected by temperature, humidity and pressure.
[0026] Assuming the wavelength of the light source in vacuum is λ0, and the wavelength of the light source in air is λ, the relationship between the refractive index n of air and it can be expressed as:
[0027] n=λ0 / λ
[0028] Changes in the wavelength of the light source will affect the grating diffraction effect. When the incident angle is α and the diffraction angle is β, the grating diffraction equation is:
[0029] d(sinα+sinβ)=mλ
[0030] Where: d represents the grating pitch, m represents the diffraction order, and λ is the wavelength of the light source.
[0031] In some modified implementations of the first aspect of the present invention, in step S20, the following steps are included:
[0032] S21. Use the data acquisition card to collect the output signal of the grating sensor; use the corresponding sensor to collect the temperature, humidity, vibration and pressure signals of the grating sensor in the surrounding environment;
[0033] S22. Differentiate the four grating sensor signals collected to obtain two orthogonal differential grating signals. Based on the two grating signals and the environmental signal as the first few columns of the data set, calculate the displacement value corresponding to the grating signal using the displacement calculation formula, that is, the ideal displacement value, and put the ideal displacement value into the last column of the data set. All signals and the ideal displacement value constitute a complete initial data set;
[0034] The ideal displacement value is calculated as follows:
[0035] X=d·(arctanθ / 360)
[0036] Where: X represents the displacement value, d is the grating pitch, and θ is the grating sensor signal phase;
[0037] S23. Data preprocessing includes data normalization, data set partitioning, and iterator loading;
[0038] Specifically, the data in the dataset is first min-max normalized, and then the normalized dataset is divided into a training set and a test set using a sliding window. The data is then converted into a PyTorch (an open source deep learning framework) tensor and finally loaded as a data iterator.
[0039] In some modified implementations of the first aspect of the present invention, the data preprocessing in step S23 includes data normalization, data set division and iterator loading, including:
[0040] S231. Perform minimum-maximum normalization processing on the data in the data set, converting the data in the data set into data between 0 and 1;
[0041] S232. Use the sliding window method to construct input-output pairs to complete the division of the data set, and divide the data set into a training set and a test set. The setting of the time step size timestep in the sliding window method can be selected and set together with other parameters;
[0042] S233. Convert the training set and test set data into PyTorch tensors and load them as data iterators;
[0043] In some modified implementations of the first aspect of the present invention, in step S30, the following steps are included:
[0044] S31. The standard TCN network structure built, TCN is mainly composed of two parts: dilated convolution and residual connection. The dilated convolution introduces holes on the basis of standard convolution. The residual connection of TCN is composed of dilated convolution, weight normalization, activation function ReLU, discard layer Dropout and direct mapping of 1×1 convolution;
[0045] S32. Select parameters. Select mean absolute error (MAE), mean square error (MSE) and root mean square error (RMSE) to compare and select the hyperparameters of the TCN network. After selection, set the optimal parameters as the training parameters of the TCN network;
[0046] S33. Model training. Use the constructed data set as the input of the network, perform multiple iterations of training, observe the changes of the three indicators in S32, and use the mean square error as the loss function. Observe that the network effect is best when the loss function has no downward trend, and save the network weight parameters when the minimum loss value is obtained;
[0047] S34. The activation function of the standard TCN is replaced with eight activation functions including SReLU, SELU, ELU, PReLU, Leaky ReLU, SiLU, ReLU, and Mish in sequence, and MAE, MSE, and RMSE are used as evaluation indicators. Other parameters are set the same, and the three indicator values after the same number of iterations are observed. The best activation function SReLU is selected to replace the activation function of the standard TCN to form an improved TCN, and the residual connection of TCN is improved;
[0048] S35. Compare the loss value curves, MAE changes, and test set correction results of the two TCN models under the same number of training iterations.
[0049] In some modified implementations of the first aspect of the present invention, the residual connection of the TCN in step S31 includes an expanded convolution layer, a weight normalization layer, a shear layer, an activation function layer, a drop layer, and a 1×1 convolution layer, including:
[0050] The dilated convolution layer is used to perform the convolution operation, which expands the receptive field by adding holes so that it contains a wider range of historical data;
[0051] The weight normalization layer is used to normalize the convolution results to improve the convergence speed of the network;
[0052] The clipping layer is used to clip the gradient to ensure numerical stability and prevent excessive gradients from causing memory overflow or numerical instability.
[0053] The activation function layer is used to improve the nonlinearity of the network structure;
[0054] The dropout layer is used to reduce network overfitting by randomly dropping some neurons;
[0055] The 1×1 convolutional layer is used to achieve dimensionality reduction and ensure that the input and output have the same number of channels.
[0056] In some modified implementations of the first aspect of the present invention, in step S32, the following steps are included:
[0057] S321. Maintain the single variable principle, change only one parameter value, use MAE, MSE and RMSE as evaluation indicators, and observe the values of the three evaluation indicators under the same number of rounds;
[0058] S322. Compare and select all TCN hyperparameters according to the method in S321, and save the selected optimal parameters;
[0059] In some modified implementations of the first aspect of the present invention, in step S33, selecting the optimal TCN network model includes the following steps:
[0060] S331. Select MSE as the loss function in the iteration process, and increase the number of iterations at fixed intervals, and observe the loss value curve obtained;
[0061] S332. If the loss value shows a downward trend, continue to increase the number of iterations and continue training;
[0062] If the loss value does not show a downward trend, it means that the model training effect has reached the optimal level in this process;
[0063] When the loss value has no downward trend, record the minimum loss value and its round number, and save the model weight parameters corresponding to the minimum loss value.
[0064] In some modified implementations of the first aspect of the present invention, in step S34, the following steps are included:
[0065] S341. Take MAE, MSE and RMSE as evaluation indicators, perform the same number of training rounds, and observe the values of the three evaluation indicators obtained by replacing the activation function of the standard TCN with eight activation functions: SReLU, SELU, ELU, PReLU, Leaky ReLU, SiLU, ReLU, and Mish;
[0066] S342. Select the best SReLU activation function to improve TCN and obtain an improved TCN;
[0067] In some modified implementations of the first aspect of the present invention, in step S35, the following steps are included:
[0068] S351. Compare the loss value curves and MAE value changes of the standard TCN and the TCN improved by SReLU under the same number of rounds of training;
[0069] S352. Compare the test set correction results of the two TCN models;
[0070] In some modified implementations of the first aspect of the present invention, in S40, the grating signal and the environmental signal are input into the TCN model together, and the measured displacement value corrected for the environmental error is output based on the trained TCN model, including:
[0071] S41. Construct a verification data set including grating signals and environmental signals to verify the error correction effect of the TCN model, wherein the data in the verification data set is composed of the collected grating signals, environmental signals and corresponding ideal displacement values outside the initial data set;
[0072] S42. performing minimum-maximum normalization processing on the constructed validation data set;
[0073] S43. Import the saved optimal weight parameters, call the standard TCN and improved TCN models respectively to correct the errors of the data set, obtain the corrected displacement values, and calculate the values of MAE, MSE and RMSE to observe the correction effect of TCN.
[0074] The present invention is an error correction method for ultra-precision measurement of grating displacement. Compared with the prior art, the present invention adopts TCN to perform error correction on grating signals for environmental factors including temperature, humidity, vibration and pressure, thereby greatly improving the measurement accuracy of the grating sensor. At the same time, by constructing a TCN network structure and adopting evaluation indicators to select TCN parameters, after obtaining the optimal parameters, the TCN is trained based on the obtained parameters, and an improved TCN network is formed and trained by replacing the activation function; a verification data set is constructed, and then the measurement errors caused by the temperature, humidity, vibration and pressure in the grating sensor measurement result environment are corrected, and the measurement errors are greatly reduced after the TCN correction; the technical problem that the grating sensor displacement measurement process is easily affected by the temperature, humidity, vibration and pressure in the environment, thereby causing inaccurate measurement results, which is existing in the prior art, is alleviated, and the technical effect of improving the measurement accuracy of the grating sensor is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required to be used in the embodiments are briefly introduced below.
[0076] Figure 1 A schematic diagram of an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0077] Figure 2 A schematic flow chart of an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0078] Figure 3 Four grating signals partially collected in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0079] Figure 4 A partially collected environmental signal in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0080] Figure 5 A standard TCN network structure in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0081] Figure 6 An improved TCN residual connection in which the activation function in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention is changed to SReLU;
[0082] Figure 7 Loss value variation curves of standard TCN and improved TCN under the same data set and the same number of iterations of training in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0083] Figure 8 The MAE changes of the standard TCN and the improved TCN under the same data set and the same number of iterations of training in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0084] Fig. 9 A comparison curve of the corrected displacement values and the ideal displacement values of the standard TCN and the improved TCN under the same data set and the same number of iterations of training in an error correction method for ultra-precision measurement of grating displacement provided by an embodiment of the present invention;
[0085] Fig.10 In an error correction method for ultra-precision measurement of grating displacement provided in an embodiment of the present invention, a comparison curve between a corrected displacement value and an ideal displacement value is obtained by calling the trained standard TCN and improved TCN model parameters to correct the grating signal environment error. DETAILED DESCRIPTION
[0086] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0087] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0088] Embodiment 1
[0089] like Figure 1 As shown, an error correction method for ultra-precision measurement of grating displacement mainly includes the acquisition of grating sensor signals and environmental signals, the construction and improvement of TCN (temporal convolutional neural network) network structure, and finally outputs the displacement value after environmental error correction through TCN.
[0090] The specific process is as follows Figure 2 As shown, an error correction method for ultra-precision measurement of grating displacement includes the following steps:
[0091] S10. Analyze the specific effects of environmental factors including temperature, humidity, vibration and pressure on the displacement measurement of grating sensors.
[0092] S11. Analyze the influence of temperature change on grating displacement measurement
[0093] When the temperature changes, it will cause thermal deformation of optical elements and also change the output wavelength of the light source, ultimately affecting the measurement accuracy.
[0094] If the initial working temperature of the grating is t0, when the working temperature becomes t, the change amounts Δd and ΔL of the grating pitch d and the measurement length L of the grating sensor are expressed as follows:
[0095]
[0096] S12. Analyze the influence of vibration change on grating displacement measurement
[0097] Vibration factors include overall vibration and independent vibration of the guide rail. Overall vibration is mainly caused by changes in the external environment. If the reading head moves relative to the grating guide rail, it will have a negative impact on the measurement accuracy. The independent vibration of the guide rail is mainly caused by the straightness of the grating guide rail and the non-uniformity of the movement speed. This vibration usually contains multiple components with different frequencies. The influence of actual vibration on the sensor output signal can be expressed by the following formula.
[0098] When 0 < t < (T / 4):
[0099]
[0100] When (2i - 1)T / 4 < t ≤ (2i + 1)T / 4:
[0101]
[0102] where i = 1, 2, 3…, T is the period of the grating signal, f exc is the frequency of the vibration excitation, f is the fundamental frequency of the signal output by the grating sensor, sinc is the normalized cardinal sine function, is the phase difference between the vibration signal and the measurement signal, δ is the amplitude factor. If the signal changes between 0 and 1, then δ is directly related to the amplitude of the measurement signal, and S0 represents the output signal of the grating sensor when the initial phase is 0.
[0103] S13. Analyze the influence of humidity and pressure changes on grating displacement measurement
[0104] The main effects of humidity are: when the humidity is too high, moisture may condense on the surface of the optical element of the grating ruler, causing the refractive index of the air to change, affecting the transmission of the optical signal, causing the signal received by the photoelectric converter to attenuate or distort, thereby affecting the accuracy of the displacement measurement. When the humidity of the working environment is too low, static electricity may accumulate, which will also have a negative impact on the displacement measurement of the grating sensor. The effect of pressure is manifested as follows: when the pressure in the environment changes, it will affect the change of the refractive index of the air, and ultimately affect the output waveform of the sensor. Analyze the effects of humidity and pressure on the measurement process of the grating sensor and the relationship between their effects on the displacement measurement results; humidity and pressure mainly affect the displacement measurement results of the grating sensor by causing changes in the refractive index of the air.
[0105] The calculation formula for the refractive index of air can be expressed by the following Edlén formula.
[0106]
[0107] (n-1) x =(n-1) s [1+0.5327(x-0.0004)]
[0108]
[0109] n tpf -n tp =-f(3.8020-0.0384σ 2 )×10 -10
[0110] Where (n-1) s represents the refractive index in dry air, and σ is the reciprocal of the wavelength of light in vacuum, which is used to represent the wave number. In formula (6), (n-1) x To take into account the refractive index of air with respect to CO2 concentration, x represents the CO2 concentration.
[0111] (n-1) tp Represents the refractive index of air under the influence of temperature T and pressure P.
[0112] n tpf Represents the refractive index of air affected by temperature, humidity and pressure.
[0113] Assuming the wavelength of the light source in vacuum is λ0, and the wavelength of the light source in air is λ, the relationship between the refractive index n of air and it can be expressed as:
[0114] n=λ0 / λ
[0115] Changes in the wavelength of the light source will affect the grating diffraction effect. When the incident angle is α and the diffraction angle is β, the grating diffraction equation is:
[0116] d(sinα+sinβ)=mλ
[0117] Where: d represents the grating pitch, m represents the diffraction order, and λ is the wavelength of the light source.
[0118] Therefore, when humidity changes cause the refractive index of the air to change, it will cause the wavelength of the light source to change, which will ultimately affect the light intensity distribution received by the photoelectric converter and thus affect the displacement measurement results.
[0119] S20. Collect the grating sensor signal, and the corresponding sensor collects the temperature, humidity, vibration and pressure signals in the surrounding environment when the grating sensor measures, and at the same time constructs an initial data set and preprocesses the initial data set.
[0120] S21. Data acquisition includes the acquisition of grating sensor signals, temperature and humidity, vibration and pressure signals. Select grating sensors with 50 lines / mm or more. To achieve nanometer-level measurement, grating sensor signals are acquired through 16-bit or more data acquisition cards, temperature and humidity signals are acquired through temperature and humidity sensors with an accuracy of ±2°C, ±5%RH or more, vibration signals are acquired through vibration sensors with an accuracy of 5% or more, and pressure signals are acquired using atmospheric pressure sensors with an accuracy of 0.66Pa or more.
[0121] Some of the four-way grating sensor signals are collected, such as Figure 3 As shown in Figure 2, some of the collected environmental signals are as follows: Figure 4 As shown, Figure 4 (a) represents the collected temperature signal, Figure 4 (b) represents the collected humidity signal, Figure 4 (c) represents the collected vibration signal, Figure 4 (d) represents the collected pressure signal.
[0122] S22. In order to facilitate the use of improved TCN for subdivision and error correction, the collected grating sensor signals need to be processed. The two signals with a phase difference of 180° in the four grating sensor signals are differentially subtracted to obtain two differential signals. The six data types of temperature and humidity, vibration, pressure and two differential signals are used as input, and the ideal displacement value is used as output to construct a data set. The ideal displacement value corresponding to the grating signal is calculated using the displacement calculation formula. The calculation of the ideal displacement value is as follows:
[0123] X=d·(arctanθ / 360)
[0124] Where: X represents the displacement value, d is the grating pitch, and θ is the grating sensor signal phase.
[0125] S23. Data preprocessing includes data normalization, data set partitioning, and iterator loading
[0126] Specifically, the data in the dataset is first min-max normalized, and then the normalized dataset is divided into a training set and a test set using a sliding window. The data is then converted into a PyTorch (an open source deep learning framework) tensor and finally loaded as a data iterator.
[0127] S30, construct the TCN network structure, send the constructed data set into the TCN network for training, and improve the performance of TCN by adjusting parameters and changing the activation function.
[0128] S31. The standard TCN network structure is as follows Figure 5 As shown in the figure, TCN mainly consists of two parts: dilated convolution and residual connection. The dilated convolution introduces holes on the basis of standard convolution. The residual connection of TCN consists of dilated convolution, weight normalization, activation function ReLU, discard layer Dropout and direct mapping of 1×1 convolution.
[0129] S32. Select parameters. Select mean absolute error (MAE), mean square error (MSE) and root mean square error (RMSE) to compare and select the hyperparameters of the TCN network. After selection, set the optimal parameters as the training parameters of the TCN network.
[0130] S33. Model training. Use the constructed dataset as the input of the network, perform multiple iterations of training, observe the changes of the three indicators in S32, and use the mean square error as the loss function. Observe that the network effect is best when the loss function has no downward trend, and save the network weight parameters when the minimum loss value is obtained.
[0131] Specifically, the method for selecting the optimal TCN network model is to select MSE as the loss function in the iterative process, and increase the number of iterations at fixed intervals, and observe the loss value curve obtained;
[0132] If the loss value shows a downward trend, continue to increase the number of iterations and continue training;
[0133] If the loss value does not show a downward trend, it means that the model training effect has reached the optimal level in this process;
[0134] When the loss value has no downward trend, record the minimum loss value and its round number, and save the model weight parameters corresponding to the minimum loss value.
[0135] S34. The activation function of the standard TCN is replaced with eight activation functions including SReLU, SELU, ELU, PReLU, Leaky ReLU, SiLU, ReLU, and Mish in turn. MAE, MSE, and RMSE are used as evaluation indicators. The other parameters are set the same. The values of the three indicators after the same number of iterations are observed. The best activation function SReLU is selected to replace the activation function of the standard TCN to form an improved TCN, and the residual connection of TCN is improved.
[0136] like Figure 6 As shown, after obtaining the improved TCN, it is trained in the same way as S33, and the model parameters with the best effect are saved.
[0137] S35. Compare the loss curves, MAE changes and test set correction results of the two TCN models under the same number of iterations. The loss curves of the two models are as follows: Figure 7 As shown in Figure 2, the MAE changes as follows: Figure 8 As shown in the figure, the comparison between the test set correction result and the ideal displacement value is Fig. 9 shown.
[0138] S40. Construct a verification data set, input the grating signal and environmental signal in the verification data set into the TCN model, and output the displacement value after environmental error correction based on the trained TCN model.
[0139] S41. Construct a verification data set including grating signals and environmental signals to verify the error correction effect of the TCN model. The data in the verification data set consists of the collected grating signals, environmental signals and corresponding ideal displacement values outside the initial data set.
[0140] S42. Perform minimum-maximum normalization on the constructed validation dataset
[0141] S43. Import the saved optimal model parameters respectively, and call the standard TCN model and the improved TCN model respectively to complete the environmental error correction, and obtain the corrected displacement value. The comparison curve between the displacement value obtained by the two models for the environmental error correction of the grating signal in the verification data set and the ideal displacement value is shown in Fig.10 The values of MAE, MSE and RMSE are calculated at the same time to observe the correction effect of TCN.
[0142] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. An error correction method for ultra-precision measurement of grating displacement, characterized in that: It includes the following steps: S10. Analyze the influence of environmental factors in the environment on the displacement measurement of the grating sensor. The environmental factors include temperature, vibration, humidity, and pressure; In step S10, the environmental factors include the following steps: S11. Analyze the influence relationship between temperature and the grating sensor and the displacement measurement result; The expression is as follows: Where, t0 is the initial working temperature of the grating; When the working temperature becomes t, the Change amounts of the grating pitch d and the measurement length L of the grating sensor are Δd and ΔL; S12. Analyze the influence relationship between vibration and the grating sensor and the displacement measurement result; The expression is: When 0 < t < (T / 4): When (2i - 1)T / 4 < t ≤ (2i + 1)T / 4: Where i = 1, 2, 3…, T is the period of the grating signal, f exc is the frequency of vibration excitation, f is the fundamental frequency of the signal output by the grating sensor, sinc is the normalized cardinality sine function, δ is the amplitude factor, if the signal varies between 0 and 1, then δ is directly related to the amplitude of the measured signal, S0 represents the output signal of the grating sensor when the initial phase is 0; S13. Analyze the influence relationship between humidity and pressure on the measurement process of the grating sensor and the displacement measurement result; Humidity and pressure mainly affect the displacement measurement result of the grating sensor by causing changes in the refractive index of air. The expression of the Edlén formula describing the change in the refractive index of air is: (n-1) x =(n-1) s [1+0.5327(x-0.0004)]; n tpf -n tp =-f(3.8020-0.0384σ 2 )×10 -10 ; Among them, (n-1) s represents the refractive index in dry air, σ is the reciprocal of the wavelength of light in vacuum, which is used to represent the wave number; (n-1) x To consider the refractive index of air with respect to CO2 concentration, x represents the CO2 concentration; (n-1) tp represents the refractive index of air under the influence of temperature T and pressure P; n tpf Indicates the refractive index of air affected by temperature, humidity and pressure; Assume that the wavelength of the light source in vacuum is λ0, and the wavelength of the light source in air is λ. Then the relationship between the refractive index n of air and it can be expressed as: n = λ0 / λ The change in the wavelength of the light source will affect the grating diffraction effect. When the incident angle is α and the diffraction angle is β, the grating diffraction equation is: d(sinα + sinβ) = mλ In the formula: d represents the grating pitch, m represents the diffraction order, and λ is the wavelength of the light source; S20. Collect the signals of the grating sensor, and use the sensor to collect the temperature, humidity, vibration, and pressure signals in the surrounding environment during the measurement of the grating sensor. At the same time, construct an initial data set and preprocess the initial data set; S30. Construct a TCN network structure, and use evaluation indicators to select TCN parameters. After obtaining the optimal parameters, train the TCN based on the obtained parameters, and form an improved TCN network by replacing the activation function and train it; S40. Construct a validation data set, input the grating signal and the environmental signal in the validation data set into the TCN model together, and output the displacement value after environmental error correction based on the trained TCN model.
2. The error correction method for ultra-precision measurement of grating displacement according to claim 1, characterized in that: In step S20, it includes the following steps: S21. Use a data acquisition card to collect the output signal of the grating sensor; Use the corresponding sensor to collect the temperature, humidity, vibration, and pressure signals in the surrounding environment during the measurement of the grating sensor; S22. Differentiate the four-channel grating sensor signals collected to obtain two orthogonal differential grating signals. Based on the two grating signals and the environmental signals as the first few columns of the data set, calculate the displacement value corresponding to the grating signal, that is, the ideal displacement value, using the displacement calculation formula, and put the ideal displacement value in the last column of the data set. The complete initial data set is composed of all signals and the ideal displacement value; The calculation of the ideal displacement value is as follows: X = d·(arctanθ / 360) In the formula: X represents the magnitude of the displacement value, d is the grating pitch, and θ is the phase of the grating sensor signal; S23. Data preprocessing includes data normalization, data set division, and iterator loading; First, the data in the dataset is normalized using the minimum-maximum method, and then the normalized dataset is divided into a training set and a test set using a sliding window. The data is then converted into a PyTorch tensor and loaded as a data iterator.
3. The error correction method for ultra-precision measurement of grating displacement according to claim 2, characterized in that: In step S23, the following steps are included: S231. Perform minimum-maximum normalization processing on the data in the data set, converting the data in the data set into data between 0 and 1; S232. Use the sliding window method to construct input-output pairs to complete the division of the data set, and divide the data set into a training set and a test set. The setting of the time step size timestep in the sliding window method can be selected and set together with other parameters; S233. Convert the training set and test set data into PyTorch tensors and load them as data iterators.
4. The error correction method for ultra-precision measurement of grating displacement according to claim 1, characterized in that: In step S30, the following steps are included: S31. The standard TCN network structure built, TCN is mainly composed of two parts: dilated convolution and residual connection. The dilated convolution introduces holes on the basis of standard convolution. The residual connection of TCN is composed of dilated convolution, weight normalization, activation function ReLU, discard layer Dropout and direct mapping of 1×1 convolution; S32. Select parameters; select mean absolute error, mean square error and root mean square error as three evaluation indicators, and compare and select the hyperparameters of the TCN network; after selection, set the optimal parameters as the training parameters of the TCN network; S33. Model training: Use the constructed data set as the input of the network, perform multiple iterations of training, observe the changes of the three indicators in S32, and use the mean square error as the loss function. Observe that the network effect is best when the loss function has no downward trend, and save the network weight parameters when the minimum loss value is obtained; S34. The activation function of the standard TCN is replaced with eight activation functions including SReLU, SELU, ELU, PReLU, Leaky ReLU, SiLU, ReLU, and Mish in sequence, and MAE, MSE, and RMSE are used as evaluation indicators. Other parameters are set the same, and the three indicator values after the same number of iterations are observed. The best activation function SReLU is selected to replace the activation function of the standard TCN to form an improved TCN, and the residual connection of TCN is improved. After obtaining the improved TCN, it is trained in the same way as S33, and the model parameters with the best effect are saved; S35. Compare the loss value curves, MAE changes, and test set correction results of the two TCN models under the same number of training iterations.
5. The error correction method for ultra-precision measurement of grating displacement according to claim 4, characterized in that: The residual connection of TCN in step S31 includes an expansion convolution layer, a weight normalization layer, a clipping layer, an activation function layer, a dropout layer, and a 1×1 convolution layer, where: The dilated convolution layer is used to perform the convolution operation, which expands the receptive field by adding holes so that it can include a wide range of historical data; The weight normalization layer is used to normalize the convolution results to improve the convergence speed of the network; The clipping layer is used to clip the gradient to ensure numerical stability and prevent excessive gradients from causing memory overflow or numerical instability. The activation function layer is used to improve the nonlinearity of the network structure; The dropout layer is used to reduce network overfitting by randomly dropping some neurons; The 1×1 convolutional layer is used to achieve dimensionality reduction and ensure that the input and output have the same number of channels.
6. The error correction method for ultra-precision measurement of grating displacement according to claim 4, characterized in that: In step S34, the activation function of the standard TCN is replaced with eight activation functions, SReLU, SELU, ELU, PReLU, Leaky ReLU, SiLU, ReLU, and Mish, in turn. MAE, MSE, and RMSE are used as evaluation indicators. The other parameters are set the same. The three indicator values after the same number of iterations are observed, and the best activation function SReLU is selected to replace the activation function of the standard TCN to form an improved TCN.
7. The error correction method for ultra-precision measurement of grating displacement according to claim 4, characterized in that: In step S33, the method for selecting the optimal TCN network model is to select MSE as the loss function in the iterative process, and increase the number of iterations at fixed intervals in sequence, and observe the loss value curve obtained; If the loss value shows a downward trend, continue to increase the number of iterations and continue training; If the loss value does not show a downward trend, it means that the model training effect has reached the optimal level in this process; When the loss value has no downward trend, record the minimum loss value and its round number, and save the model weight parameters corresponding to the minimum loss value.
8. The error correction method for ultra-precision measurement of grating displacement according to claim 6, characterized in that: The grating signal and the environmental signal are input into the TCN model together, and the measured displacement value corrected for the environmental error is output based on the trained TCN model, including: S41. Construct a verification data set including grating signals and environmental signals to verify the error correction effect of the TCN model, wherein the data in the verification data set is composed of the collected grating signals, environmental signals and corresponding ideal displacement values outside the initial data set; S42. performing minimum-maximum normalization processing on the constructed validation data set; S43. Import the saved optimal weight parameters, call the standard TCN and improved TCN models respectively to correct the errors of the data set, obtain the corrected displacement values, and calculate the values of MAE, MSE and RMSE to observe the correction effect of TCN.
Citation Information
Patent Citations
Grating ruler and measuring method and system thereof
CN116817759A
Wind power ultra-short-term prediction and error correction method based on RF-TCN-SA
CN117408369A