# Design and Implementation of a System-on-Chip for Self-Calibration of an Angular Position Sensor
## 4 Simulation and Experimental Results
### RTL Simulation of the Self-Calibration Coprocessor  
According to the overall scheme design, the architecture of Figure 2 is described using the Verilog hardware description language [27]. The purpose of the RTL simulation is to study the error ratio that the algorithm can reduce errors involving quantization and rounding errors of fixed-point calculation modules (multiplication, root number, and arctangent operations). The RTL view of the coprocessor after synthesis with Altera Quartus II [28] is shown in Figure 11.  
The resource overhead results obtained from Quartus synthesis tool and power estimation results from Quartus PowerPlay Power Analyzer Tool are summarized in Table 7.  
For a sampling frequency of 250 Hz and an angular frequency of 0.05 Hz, the step factor of signal \(U\) is set to \(W_{1}=(0.2,0.2,0.2)^{T}\) and the step factor of signal \(V\) is set to \(W_{2}=(0.5,0.3,0.1)^{T}\). The data is quantized using a 32-bit signed fixed-point number with a simulation time set to 400 s. Simulation results are shown in Figure 12.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Category** & **Results** \\ \hline Logic Utilization (in ALMs) & 12,192 \\ Total Registers & 7106 \\ Total Pins & 233 \\ Total DSP Blocks & 125 \\ Thermal Power Estimation (mW) & 361.875 \\ \hline \hline \end{tabular}
\end{table}
Table 7: Resource overhead and power estimation results.  
Figure 11: Register-Transfer Level (RTL) view of the designed coprocessor.  
The identification values of the amplitude and DC offset are obtained after dividing the identified machine value by \(2^{31}-1\). The identification values of the phase shift are obtained after multiplying the identified machine value by \(2/(2^{32}-1)\cdot\pi\).  
Figure 13 shows the error curve of the angle output by the coprocessor, while the error without calibration is shown in Figure 8a.  
The maximum value of the absolute angular error after calibration was \(9.50\times 10^{-3\circ}\), while the value without calibration was \(30.38^{\circ}\), the error reduces to \(0.03\%\) of the non-calibration value.  
Table 8 shows that the angle-related estimates are not as accurate as the amplitude and DC bias estimates. The angle is calculated by the arctangent module and the calculation error of the arctangent operation is shown in Figure 14. The error is \(10^{-4}\) orders of magnitude when the operands are sine and cosine functions of magnitude 1.  
The accuracy loss in the signal calibration and arctangent modules is one factor that causes the circuit simulation results to be inferior to the MATLAB simulation results. This is mainly related to the multiplication calculation's rounding error, especially in the arctangent module where 30 multiplication operations are iteratively performed. The circuit optimization of these two parts will be the focus of future work. The results show that the accuracy loss of the calculation modules limits the further improvement of the calibration accuracy. The optimization of these modules is a means for further improved accuracy.