## 2 Modeling of Magnetic Field
### Mathematical Model of the Set of Coils  
We have considered the following two points when designing the system configuration. First, we are more concerned with the force control of milli/microbots, which is related to the gradient of the field, compared to the torque control. Second, the focus of the paper is on the potential of rectangular coils for remote control applications of milli/microbots. The choice to be consistent with one typical configuration will allow for a comparison of system performance and experimental results with the previous system (Octomag). The magnetic milli/microbot needs at least eight stationary electromagnets to obtain the desired torque and force at any point in the workspace. To date, a variety of manipulation systems have been developed, in terms of the generation of a spatial derivative in the field, which corresponds to force-generation capability, the Octomag configuration is the strongest [28]. Eight rectangular electromagnetic coils have been used to build a rectangular electromagnetic coil set actuation platform. The numbering sequence divided into two groups is shown in Figure 5. Since the actuation system does not have a priority level for each control direction of the milli/microbot, there is no difference between the upper and lower sets of electromagnetic coil designs. For an isotropic system, eight electromagnetic coils are distributed around the \(Z\)-axis angle of 45 degrees considering the symmetry of the upper and lower groups, while the upper and lower coils and the \(Z\)-axis form an angle of 45 degrees and 90 degrees, respectively. Each electromagnetic coil acts as an independent magnetic field generating device. The central axis of the long axis of each coil intersects at a point, that is, the global coordinate system origin. The origin of the local coordinate system of the single-coil is separated from the global coordinate origin by 165 mm. The size of a single coil is 48 mm \(\times\) 48 mm \(\times\) 200 mm, which is \(l\) = 100 mm, \(w\) = 24 mm, \(h\) = 24 mm in the magnetic field mathematical model. Using the measured calibration values for the respective electromagnet, the magnetic field and gradient of the rectangular coil set in the workspace can be calculated through homogeneous transformation matrix, which will provide a basis for generating the milli/microrobot actuation matrix. According to the coil set design layout, the origin of the global coordinate system is \(R_{off}=[X_{off}\quad Y_{off}\quad Z_{off}]^{T}=[0.165\quad 0\quad 0]^{T}\) (\(mm\)) in the local coordinate system of a single rectangular electromagnetic coil. Equations (15) and (16) is the transformation matrix of the global coordinate system to the local coordinate system of the magnetic actuation system. The position of the point in the global coordinate system under the local coordinate system of each coil is obtained by solving the above equation. The magnetic induction intensity and gradient at a unit current are obtained by using the magnetic field model of the rectangular electromagnetic coil, and then the magnetic induction intensity and the gradient component for the superposition operation in the global coordinate system are obtained by the inverse rotation matrix. \[TR_{\delta}= \begin{bmatrix}R_{z}(\varepsilon)&R_{off}\\ 0&1\end{bmatrix}  \tag{15}\]  
For \(\delta=(1;2;3;4)\), \(\varepsilon=(-3\pi/4;3\pi/4;\pi/4;-\pi/4)\). \[TR_{\delta}= \begin{bmatrix}R_{y}(-\pi/4)R_{z}(\varepsilon)&R_{off}\\ 0&1\end{bmatrix}  \tag{16}\]  
For \(\delta=(5;6;7;8)\), \(\varepsilon=(-\pi/2;-\pi;\pi/2;\pi)\). Where \(R_{x}(\alpha)\in SO(3)\) is the rotation matrix around \(X\) axis of the global coordinate system by an angle \((\alpha)\); \(R_{y}(\beta)\in SO(3)\) is the rotation matrix around \(Y\) axis of the global coordinate system by an angle \((\beta)\); \(R_{z}(\gamma)\in SO(3)\) is the rotation matrix around \(Z\) axis of the global coordinate system by an angle \((\gamma)\).