1. Introduction
Obtaining accurate angle information is crucial for many control systems [
1,
2,
3]. Therefore, angle position sensors (APSs) are widely used in the aerospace and automotive industries, navigation, and other fields. Ideally, sensors including resolvers [
4,
5] and capacitive angular position sensors (CAPSs) [
6,
7] modulate the angle signals and output sets of orthogonal sine and cosine signals. In practical applications, due to processing error, installation error, circuit mismatch, etc., output signals may be disturbed, resulting in unexpected errors such as amplitude deviations, direct-current (DC) offsets, and phase offsets. To obtain an accurate angle signal, it is necessary to identify the signal model parameters and calibrate the output signals. The calibration yields an accurate signal based on the identified parameters.
To improve the angle signal accuracy, many research methods have been proposed in recent years. Le et al. [
8] presented a quadrature digital phase-locked loop method and used interpolation to improve the accuracy of the position information. Kim et al. [
1] obtained additional reference signals for calibration and demodulation through a D-Q transform of the motor. Both calibration methods attempt to suppress the error sources in the signal model and require additional hardware costs. Hoang et al. [
9] proposed establishing a look-up table for compensation. This method requires additional hardware storage space and does not provide accurate parameter values. Dhar et al. [
10] used an artificial neural network to compensate for angle errors, and Tan et al. [
11] employed a radial basis function neural network for angle calibration. These methods do not identify the parameter values either. All of the above techniques require obtaining an accurate reference input signal, making it difficult to perform parameter self-calibration, which limits the use of these methods in practical applications.
Selecting an appropriate optimization algorithm is another method of parameter identification and calibration. The optimization technique is essentially based on the least squares method. An optimal solution extraction process for parameters was first introduced in [
12]. On this basis, gradient-based identification algorithms with model linearization have also been proposed [
9,
13]. These methods permit self-calibration. However, new parameters are coupled to the original independent parameters after linearization. The parameters do not maintain independence and may result in large identification errors. In addition, the traditional gradient descent method does not have the ability to escape local optima. According to the method described by Hou [
14] for parameter identification of sinusoidal signals, self-calibration methods based on observers have been presented. Zhang et al. [
15] proposed an automatic calibration scheme based on a state observer, and Wu et al. [
16] introduced a two-step identification improvement scheme for the above method. This kind of scheme entails more stringent output signal requirements. The output signal must be continuous and second-order differentiable. For applications in which the angle measurement range is less than 360° and the output signal is not smooth, its usability is limited. A method based on Fourier analysis has also been introduced for self-calibration [
17,
18]. This technique is effective and can be used for online calibration, but the influences harmonic contents are ignored, and there is no discussion of this approach in the literature.
In this article, a novel offline self-calibration scheme is introduced. The new method is data driven, and there are no special requirements on the data, such as input signal continuity. This method also does not impose linearization on the model. By establishing optimization operation pipelines, the scheme has the ability to guarantee that the iterative learning process moves toward the global optimum. In this paper, this approach is called calibration based on a signal flow network (CSFN) method. In this technique, the relationship between the output signal of the sensors and the angle signal to be measured is converted into a signal flow network structure. According to the CSFN, the sensor output is used as a new input, the relationship between two sensor outputs is transferred to the network structure. The parameters are set as the nodes of the network. The network output is related to the parameters and the network input signal. The CSFN model was designed in a deep learning framework [
19], using an optimization algorithm to conduct the identification process, and experimental data were collected for offline identification and calibration. Simulations and experiments demonstrated that this method can provide effective calibration.
The remainder of this paper is organized as follows: in
Section 2, the signal model and error model are discussed.
Section 3 presents the signal flow network construction method and parameter identification scheme. In
Section 4, the simulation and experiments conducted to verify the validity of the CSFN method are described.
Section 5 and
Section 6 respectively provide a discussion of the results and our conclusions.
2. Signal Model and Problem Statement
2.1. Signal Model
Figure 1 shows the classic model of an APS, including resolvers and a CAPS. Under the influence of an excitation voltage, the sensor outputs two signals, denoted as
and
. The two output signals of the sensor can be expressed as [
6,
20]:
In Equation (1), is the gain coefficient of the sensor, is the frequency of the excitation voltage, is the amplitude of the excitation voltage, and is the angle to be measured.
Ideally, the sensor output signals are envelope-detected [
6] and can be expressed as follows:
Then, the two output signals are sent to the digital demodulation circuit shown in
Figure 2. The angle to be measured can be obtained using a proportional-integral controller module [
6].
2.2. Problem Statement
In practical applications, the imbalance of the mechanical and circuit structure of the sensor will cause amplitude deviation. Zero offset of the sensor can cause DC offset of the output signals. There also exists a phase shift between the output signals [
21]. Thus, the actual forms of the output signals are:
In Equation (3), and are the real amplitudes, and are the DC offsets, and is the non-orthogonal phase shift between the two output signals.
If the above forms of the signals are used to perform angle demodulation, there will be measurement error. Therefore, it is necessary to identify the amplitudes, DC offsets, and phase shift of the output signals to obtain an accurate demodulation angle.
As shown in
Figure 3, the proposed scheme includes three main parts.
Firstly, the CSFN is designed, and the network outputs the loss values associated with the parameters. Secondly, the optimizer uses the loss values from the network to update the parameters. Thirdly, when the loss value converges or is less than a certain preset threshold, the parameters are output. Then, the signal calibration is conducted according to the following formulas:
In Equation (4), and are the identified amplitudes, and are the identified DC offsets, and is the identified phase shift between the two output signals.
3. CSFN Design and Parameter Update Principles
Figure 4 shows the structure of the signal flow network. Since the parameters and reference angle signals are unknown, this method attempts to identify some mappings so that the problem can be solved in the new mapping space. The independence of the parameters is maintained in the mapping process, which is the basis for the optimization analysis.
The basic working principle of this network is as follows. By performing function transformations, the network outputs a function value that is related to the parameters. The output function value is unrelated to the angle to be measured. This function is called a loss function. During the network training process, the loss function value gradually decreases and the updated parameter values from the back-propagation gradient flow can be obtained.
3.1. CSNF Design
The CSNF design is hierarchical. The outputs
and
of the sensor have the form shown in Equation (3). As the network input data, through an affine transformation layer, the outputs
and
can be expressed as follows:
In Equation (5),
and
are the elliptic parametric equations for
. The following relationship can be verified:
The structures of the input layer and first transformation layer are shown in
Figure 5a. The circles in the figure indicate the net nodes, and the symbols in the circles represent the structural parameters. The lines between the nodes indicate that there exist function transformations.
The angle between the major axis of the ellipse and the
-axis is 45°. This ellipse can be mapped to a unit circle by performing a rotation transformation and another affine transformation. The rotation matrix is:
The output of the rotation transformation layer can be expressed as:
Figure 5b depicts the structure of the second transformation layer. By using the outputs of the rotation transformation layer
and
, outputs
and
can be represented as:
Then the expressions can be brought plugged into Equation (6) to obtain the following expression relating
and
:
In practical applications,
has a small numerical value. Assuming that
is less than 90°, the formulas for calculating the major and minor axes are:
Equation (10) shows that the relationship between and takes the form of a standard ellipse equation.
Above are the coefficient transformation formulas.
Figure 6a shows the structure of the third translation layer. After the third affine transformation, the outputs can be expressed as:
However, the transformation parameters of this layer are related to and are not independent. In the subsequent back propagation of the gradient, the last stage of the gradient propagation should have independent parameters. Therefore, a coefficient layer is included to convert . The affine transform coefficients and are output by the coefficient layer.
To create the coefficient layer,
is defined as the new node. The following relationships between the transform coefficients and node parameter
can be obtained:
After all of the layers have been constructed, the network output is defined as:
The network output value should equal 1. Therefore, the loss function is defined as:
All of the designs are layered, which makes gradient back propagation and parameter updating simple. The parameter identification procedure is an optimization process that minimizes the loss function values. The next section introduces the identification method, including the parameter update guidelines and network training methods.
3.2. Parameter Identification Process
3.2.1. Parameter Update Formula
Stochastic gradient descent is commonly used in optimization theory, but it is difficult to find a suitable learning rate. In addition, it is easy to obtain a local optimal solution. In contrast, the momentum method [
22] can escape local optima. In the review presented in [
23], the Adam optimization algorithm [
24] was chosen for parameter updating. The Adam optimization algorithm can adjust the learning rate adaptively, and it has a certain ability to avoid local optima. By calculating the first and second moment estimates of the gradient, an independent adaptive learning rate is designed for different parameters. This algorithm has significant advantages over other kinds of random optimization algorithms in practice.
The parameter vector is defined as
, and
is defined as the input vector. There exists a mapping function
, so the output loss value
can be expressed as:
The gradient formula of the loss function related to the parameters is: .
The Adam optimization algorithm [
24] firstly sets four parameters:
is the step size,
and
are the exponential decay rates for moment estimation, and
is a constant for numerical stability. The default settings are:
The calculated gradient value is defined as
. Then, the parameters can be updated according to the following principles:
In Equation (18), is the updated biased first moment estimate, is the bias-corrected first moment estimate, is the updated biased second moment estimate, and is the bias-corrected second moment estimate. The subscript (time step) represents the parameter value for the iterations. After the termination condition has been satisfied, the optimizer will return the parameter values.
3.2.2. Backward Propagation Formula
Rumelhar et al. [
25] introduced the back-propagation rule. This method involves calculating the gradient of the output related to the input of each network layer. According to the chain rule, the gradient of the loss value related to the parameter is the product of the calculated gradients of all of the layers.
The back-propagation method can simplify the gradient calculation of a complex function model, and the intermediate variables are also used to calculate the gradient values, enabling better control of the entire iteration and convergence process.
The CSNF gradient calculation process is also based on the principle of back propagation. To simplify the expression, the output of the three transformation layers is defined as:
The amplitude and DC offset parameters have the same gradient calculation formula:
The output
is a scalar, and the input
is a column vector. The gradient of the output with respect to the input for each layer can be calculated according to following formulas:
The expressions of the first layer output related to the parameter are:
All of the intermediate quantities required for the gradient calculations are obtained in the forward-propagation process.
Regarding the coefficient layer, the intermediate output is defined as:
An operation symbol for two vectors is defined. This operation generates a new vector. The elements of the new vector are equal to the products of the two corresponding elements of the previous vectors. Thus .
The parameter related to
is
. Its gradient calculation formula is:
The gradient of the output with respect to the input for each layer can be calculated by using
After obtaining the convergence value of , can be obtained by using the formula .
3.3. Summary
In this section, the design of the CSNF model was presented, where the input and output of the network do not provide explicit angle information, the network input consists of the measured signals, and the loss value of the output is set according to the structure. Then, the use of the back-propagation method to derive gradient formulas for the loss value with respect to the parameters to be identified was described. Finally, the parameter update process based on the Adam optimization algorithm was discussed.
4. Simulation and Experiment
4.1. Simulation Without Noise
To verify the feasibility of the identification algorithm, a simulation experiment was conducted using a software platform. The amplitudes, DC offsets, and phase shift were set based on the signal model of the sensor. An unordered angle signal was then generated, and the two sets of output values were saved, which could simulate the discontinuity of the input angle. In the simulation,
a1 and
a2 were set to 0.3428 and 0.2537, respectively;
b1 and
b2 were set to 0.0485 and −0.0224, respectively; and
β was set to 0.9032. The signals for the simulation are depicted in
Figure 7.
Signal flow network, back-propagation gradient calculation, and Adam optimization methods were followed for the algorithm design and simulation experiment. In the training data initialization process, the maximum absolute values of the two output signals were used as the initial amplitudes, the initial DC offsets and phase shift were set to 0. Using a small batch of gradient descent can both ensure accuracy and improve the training speed [
23]. Batch training was used to update the weights, using a batch size of 100.
During the parameter updating process, the learning rate
was set to 0.01 to speed up the convergence rate, while all of the other parameters were in accordance with the recommended values in [
24].
The parameter and loss function values were collected during the network training process to analyze their convergence. The amplitude variation during the CSNF training process is depicted in
Figure 8.
The variation of the DC offset during the CSNF training process is illustrated in
Figure 9.
The changes in the phase shift and loss values during the training process are shown in
Figure 10.
According to the training results, the calibrated signals and Lissajous figure were obtained and are presented in
Figure 11.
The parameter information is summarized in
Table 1. The results show that the CSNF method could provide high-precision parameter identification results, confirming the theoretical feasibility and effectiveness of the CSNF method.
The residual values of the demodulation angle are depicted in
Figure 12.
Before calibration, the peak-to-peak angle error was 73.72°. After calibration, it was reduced to about 0.09 arc sec, corresponding to an error of 0.00003%.
4.2. Simulation with Harmonic Components
The next simulation verified the feasibility of the scheme. Specifically, the calibration effects with harmonic components present were verified for practical applications.
Harmonic components are common in sensor output signals. To verify the effects of the harmonic components on the compensation, triple frequency components were added to the simulation model. The amplitude of the triple frequency components was set to 0.01 of the fundamental frequency. The signals for the simulation are presented in
Figure 13.
The CSFN method was used for parameter identification and signal calibration. The angle demodulation errors are depicted in
Figure 14.
With harmonic components, the peak-to-peak angle error was 74.17° before calibration and was reduced to 3.77°, or 5.08%, after compensation. Thus, the compensation effect became worse than it was without harmonic components.
4.3. Experimental Results
To verify the effectiveness of the proposed technique in practical applications, experiments were conducted using a CAPS and a turntable.
Figure 15 illustrates the experimental equipment used for verification.
In the experiment, a CAPS [
6] was mounted on a turntable, which rotated at 0.5°/s. During the rotation process, the signal processing circuit processed the signals and sent the data to the upper computer at a sampling frequency of 250 Hz. The exact values of the rotation angles were obtained through the turntable, and parameter identification was performed offline.
The output signals of the sensor are presented in
Figure 16.
The previous experimental data were continuous. To verify that the proposed scheme can be used for non-continuous data, the data were randomly shuffled. The shuffled signals are shown in
Figure 17.
The presence of noise is not conducive to stable gradient changes. Since larger batches can make the gradient change process smoother, the batch size was set to 1000. The parameter and loss function values were collected to analyze the convergence of the parameters and loss functions.
The amplitude identification process is illustrated in
Figure 18.
The DC offset identification process is shown in
Figure 19.
The changes in phase shift and loss during training process are shown in
Figure 20.
According to the training results, the calibrated output signal and its Lissajous figure were obtained and are presented in
Figure 21.
The parameter identification results are summarized in
Table 2.
The residual values of the demodulation angle are shown in
Figure 22.
Before calibration, the peak-to-peak angle error 42.57°. After calibration, it was reduced 2.97°, representing an error of only 6.98%. The experimental results demonstrate that this scheme can effectively calibrate output signals and improve the angle resolution accuracy.
The experimental results are similar to the simulation results obtained with harmonic components. For further analysis, a Fourier transform of the experimental data with the signal model
was performed. The results are presented in
Figure 23.
The spectrum analysis chart shows that the output signal contained high frequency components, indicating that the actual signal differed from the signal model in the literature [
6,
17]. Considering the existence of harmonic components, the experimental results are consistent with the simulation results.
The experimental results show that the demodulation error was reduced to only 6.98%. To improve the compensation accuracy further, the effects of the harmonic components must be analyzed. The suppression of harmonic components requires more complete and complex models, and future work will focus on using the CSFN method to address this problem.