# A Real-Time Numerical Decoupling Method for Multi-DoF Magnetic Levitation Rotary Table
## 3 Real-Time Decoupling Unit Implemented on FPGA  
### Implementation on FPGA via High-Level Synthesis (HLS) Tool  
The matched controller of the maglev system regulates the currents on each coil phase to produce the required magnetic force and torque for the desired movement. Because the contribution of each coil contains different force and torque components, the solution of the proposed wrench model, the current-wrench transformation matrix \(\boldsymbol{\Gamma}\), is necessary to decouple force and torque in different directions by reasonably distributing the current of each coil. Current vector \(\boldsymbol{\mathbf{I}}\) is solved by Equation (12):  
\[\boldsymbol{\mathbf{I}}=\boldsymbol{\mathbf{\Gamma}}^{\mathrm{T}}\cdot\left( \boldsymbol{\mathbf{\Gamma}}\cdot\boldsymbol{\mathbf{\Gamma}}^{\mathrm{T}} \right)^{-1}\cdot\mathbf{w}_{\mathrm{desire}}, \tag{12}\]  
where \(\mathbf{w}_{\mathrm{desire}}\) represents the desired force and torque from the control algorithm at each sampling cycle, which is a \(6\times 1\) column vector written as \(\left[{}^{s}F_{x}{}_{x}{}^{s}\,F_{y}{}_{s}{}^{s}\,F_{z}{}^{s}\,T_{x}{}_{s}{} ^{s}\,T_{y}{}^{s}\,T_{z}\right]^{\mathrm{T}}\). Additionally, these computation tasks should be implemented in the real control system, as illustrated in Figure 3. In this case, the magnetically levitated stage is equivalent to six independent second-order systems, so six independent single-input single-output (SISO) linear control algorithms, such as PID or the lead-lag method, can be used in the design. On the other hand, for implementation in the real controller, the processing delay of the proposed numerical decoupling unit needs to be less than the sampling cycle of the controller. Observing Equation (12), the decoupling unit contains two parts, calculating the transformation matrix \(\boldsymbol{\mathbf{\Gamma}}\) and the matrix operation, including matrix inversion and multiplication. Obtaining \(\boldsymbol{\mathbf{\Gamma}}\)  
Figure 3: Control block of the magnetic levitation rotary table with force and torque decoupling unit. Figure 2: (**a**) Diagram of the actuator to analyze the relative angle \(\theta_{e}\) of **Coil 5** in the rotor coordinate system. (**b**) Intensity of magnetic flux density along the testing arc line from **Magnet 0** in (**a**). due to the numerical wrench model is time-consuming because it requires many computations. Normal single-thread processors, like the digital signal processor, processor with ARM (Advanced RISC Machines) architecture, or real-time kernel, cannot realize real-time processing with numerous computation branches. Under this circumstance, the FPGA is considered because of the high working frequency and flexible hardware reconfiguration. Evaluating the features of the wrench model given in Equation (3), the pipelined program structure is suitable to realize computation. Meanwhile, the FPGA is not only convenient to interface with the device, such as the AD-DA adapter and data bus, but is also able to construct the built-in processor to run the control algorithm. Therefore, in this work, the FPGA is employed as the computation platform for the real-time current decoupling unit for the maglev rotary actuator. In general, programs running on FPGA are the digital circuits in a register-transfer level (RTL) structure designed by a hardware description language (HDL). The programming language directly manipulates the register like the assembler language, which is suitable for the timing sequence control and bus design, but it is difficult and error-prone to lay out the complicated algorithm for dates in a floating-point type. Xilinx(r) has introduced the High-Level Synthesis (HLS) TM tool to directly translate a C specification into an RTL implementation. As a highly abstract language, C++ has many library functions, so the coding effort for floating-point data processing is substantially reduced compared with HDL.