Vector Control Strategy for Halbach Linear Motor Implemented in a Commercial Control Hardware

: Halbach linear motors are selected as actuators in positioning stages because they present numerous advantages in precision engineering. These motors generate a horizontal and a vertical force. Whereas the horizontal force is used to perform the movement, the vertical force can be leveraged for the levitation of the moving part of the stage. This paper proposes a vector control strategy that enables the positioning of the motor while regulating the generated vertical force. In contrast to other research projects, this work implements the control strategy in a commercial control hardware. The use of commercial hardware facilitates the applicability and replication of the developed control strategy. The selected hardware is a generic Digital Motor Control Kit of Texas Instruments. The hardware implementation of the control strategy is analysed in detail in order to understand and optimize the control system. The developed control is ﬁrst validated by simulation, where the error contributors are included. Then, an experimental validation is carried out. The results demonstrate that the control strategy enables the positioning of the motor along its complete operating range and the regulation of the vertical force when the motor is static, as well as while it is moving to a target position.


Introduction
Positioning stages are critical in applications such as measuring at a nanoscale or nano-manufacturing, where they act as a supplementary unit for precisely positioning the sample or the tool [1,2]. The available options can be classified by their precision and their operating range. In addition, in 2D nano-positioning stages, the structure can be defined by its motion, i.e., either stacked or plane [3]. A plane structure is preferred in precision engineering applications [4]. The selection of the actuators directly depends on the positioning stage precision, operating range, and structure.
There are several types of actuators capable of generating linear motion. Thus, it is necessary to analyse their advantages and disadvantages to select the most suitable for each application. On one hand, piezoelectric transducers are capable of providing precise operation; however, they cannot carry out large travels [5,6]. On the other hand, electromagnetic linear motors are capable of transforming electrical energy into linear motion without the requirement for mechanical transmission elements. Within this category, brushless DC motors are among the most applied solutions. Each of these motors is a combination of a coil and a permanent magnet assembly that generates a relative, contactless motion. The absence of friction between the parts presents numerous advantages, e.g., absence of mechanical wear and less number of elements. However, these linear motors require a guiding system (e.g., linear rails), which introduces disadvantages such as friction. In addition, the guiding system, or even the motor design in certain cases (i.e., magnet array scheme), impedes the displacement of the motor along the orthogonal direction of its driving axes, which renders the implementation of planar motion unfeasible. Halbach linear motors designed by Trumper et al. [7] are considered to be a solution to this issue because the size of the effective winding area permits the interaction between the stator and magnet array in all the positions along the plane moving range.
Apart from enabling planar motion without contact between parts, Halbach linear motors present certain highly effective advantages in precision engineering. Therefore, they have been integrated in various high-precision nano-positioning stages that implement planar motion [8,9]. They have a large operating range that is limited only by the length of the stator winding. In addition, they generate a vertical force that can be leveraged to favour the levitation of the moving part. Although most nano-positioning stages using these motors [3,10,11] implement a hybrid suspension combing the magnetic suspension with air bearings, Halbach motors are capable of providing complete suspension of the moving platen [12].
The use of unguided Halbach linear motors is not yet widespread, and they are not commercialized. On the contrary, they are custom-made for each application. Consequently, a commercial solution to perform the control task of these motors is not available. That is [11,13], the authors specifically designed and developed the software and hardware of the control system consisting of linear transconductance power amplifiers that act directly on the phase currents of the motor.
This article proposes a vector control strategy that permits the positioning of the motor while regulating the generated vertical force. The control of the two orthogonal forces is decoupled by performing a Clarke-Park transformation, generally applied in rotative motors for decoupling the control of the magnetic flux and the torque. In contrast to other research projects, this work implements the control strategy in a commercial control-hardware. The selected hardware is a generic Digital Motor Control Kit for rotative permanent magnet synchronous motors of Texas Instruments. The two main functions of the hardware that define the performance of the system are the voltage generation and the current sampling. Therefore, they are analysed in detail in order to understand their effect and to optimize the implementation. It should be highlighted that the proposed vector control strategy is implemented in a commercial hardware without either any modification or additional custom-made electronics. The purpose of this is to facilitate the applicability and replication of the developed control strategy. This paper is divided as follows: First, the operating principle and the dynamics of Halbach linear motors are analysed, and the experimental setup is described. Then, the proposed vector control strategy is presented. Following this, the implementation of the control strategy in the control hardware is described. The implementation of the control system in the hardware is simulated in order to be virtually analysed. Finally, the experimental results are obtained, and conclusions are drawn.

Halbach Linear Motor
The Halbach linear motor case of this study was developed by Trumper et al. [7] and custom-made in the University of North Carolina at Charlotte (U.S.A.). It consists of two main parts: A Halbach magnet array and the stator (see Figure 1). The Halbach magnet array comprises eight permanent magnets bounded into an aluminium housing. On the other side, the stator comprises three coils that are wrapped around an aluminium mandrel. It should be noted that the absence of a ferrous core eliminates the presence of the cogging force. When DC flows through the coils, this motor generates two orthogonal forces, as represented in Figure 1. In this section, first, the operating principle of Halbach linear motors is described. Then, the system is analysed and the experimental setup defined.

Halbach Linear Motor Operating Principle
The operating principle of Halbach linear motors is based on the electromagnetic interaction between the magnetic field of the Halbach array and each of the currents flowing through the coils. Each phase generates two orthogonal forces: One horizontal and the other vertical. In Figure 2a, the horizontal forces along the X-axis (F x1 , F x2 , and F x3 ) generated by the three different-phase currents (I a , I b , and I c ) have been represented. The sum of all the horizontal forces generated by the three phases is the total horizontal force F x acting on the motor (continuous line graph). Similarly, the sum of all the vertical forces generated by the three phases is the total vertical force F z acting on the motor (Figure 2b). This specific combination of currents generates a maximum total force (horizontal and vertical) of 1 N.  Figure 2 illustrates that the magnitude of the generated forces is dependent on the relative position between the stator and magnet array, and it presents a sinusoidal shape. The period corresponds to one pitch of the motor (l). It is also apparent that the forces generated by each phase current exhibit a phase difference of 2π/3. In addition, the total horizontal force (F x ) and the total vertical force (F z ) exhibit a phase difference of π/2.
The motor law (Equation (1)) is the mathematical representation of the relationship between the total resultant vertical and horizontal forces and the phase currents, depending on the relative position between the stator and magnet array (x 0 ). In this equation, A is a constant that depends on the design parameters of the motor, as represented in Equation (2).
In Equation (2), N m is the number of spatial periods of the magnet array, η 0 is the winding density of the stator coil, µ 0 M 0 is the remanence of the permanent magnets, G represents the effects of the motor geometry, k is the fundamental wave number, and z o is the separation gap between the stator and the magnet array. The parameter k is calculated according to Equation (3), where l is the pitch or the spatial period of the array wavelength. The parameters A, k, and l can be experimentally calculated by measuring with a load cell, along the travel range of the motor, the vertical and horizontal force generated by certain known phase currents. Specifically, for the motor case of this study, A was experimentally calculated and is equal to 1.6067 N/A, while l is equal to 29.778 mm and, thus, k is equal to 211.0001 rad/m.

Servosystem
When functioning as a positioning actuator, the motor should move to the target position and remain motionless at this point (F x = 0). It is feasible to identify the position where this condition is fulfilled, in Figure 3a. It is observed that when the slope of the horizontal force is negative, under marginal perturbations, the moving part returns to the target position. Therefore, the motor is at a stable equilibrium state. Thus, around the stable equilibrium position, the open-loop system replicates a servosystem, with the stable equilibrium position as the reference position. This servosystem consists of the electromagnetic force that depends on the position, and of the load elements that depend on the setup. In addition, as is shown in Figure 3a, around the equilibrium position (X eq = 0 mm) F x is linear and behaves as a proportional controller (K). The value of the proportional constant K is calculated as the slope on the linear zone of the curve representing F x as a function of the position. It depends on the magnitude defined for the vertical force at the target position. For example, when the value of F z is set to 1 N at the target position as the initial condition, the electromagnetic proportional controller has a constant K of approximately 205 N/m. Figure 3b is a simplified representation of the system inside the linear zone.
The transfer function between the electromagnetic force generated by the motor F x (s) and the final position X(s) includes the mass of the moving part (m) and the viscous-friction elements of the setup (b), as expressed by Equation (4): The closed-loop transfer function of this system relates the equilibrium position X eq (s) to the final position X(s) in the linear zone, and it is obtained as expressed by Equation (5):

Experimental Setup
The experimental setup has been mounted in a metrology laboratory of the University of Zaragoza, as shown in Figure 4a. The stator of the linear motor is the moving part, and it is mounted over a pneumatic linear guide in order to facilitate frictionless movement. The magnet array is fixed to the arm of a coordinate measuring machine (CMM). In addition, a load cell has been placed between the magnet array and the CMM arm in order to measure the vertical force generated by the motor. The arm of the CMM is used only for positioning the magnet array above the stator, leaving a 400-µm air gap. Then, the arm stays static. The Renishaw XL80 laser system (Renishaw, Gloucestershire, UK) has been selected as the positioning sensor for its precision; it measures the position of the moving stator. A scheme of the setup has been represented in Figure 4b.
The control hardware is a Digital Motor Control Kit (DMC) of Texas Instruments, DRV8302-HC-C2-KIT (Dallas, TX, USA). The three-phase power stage of the control hardware is wired to the stator phases, and the control card is connected to a computer by USB. According to the previous subsection, the transfer function between the horizontal force F x (s) and the final position X(s) includes the mass of the stator (m) and the viscous-friction elements of the setup (b). Therefore, by experimentally obtaining the transfer function, the viscous-friction elements of the setup can be estimated. For simplicity, the closed-loop transfer function (Equation (5)) has been assessed; this equation relates the equilibrium position X eq (s) to the final position X(s) in the linear zone. By acting on the phase currents and for a F z set to 1 N, the equilibrium position has been displaced by 2 mm; the resultant movement of the motor has been recorded by the laser system. In Equation (5), the parameter K is known, and the viscous element b and the mass m can be experimentally adjusted until the simulated response matches the actual response of the system. The obtained values are b = 9.41 N·s/m and m = 3.75 kg.

Vector Control Strategy
Halbach linear motors are used for positioning in precision engineering; moreover, typically, there are two parameters that need to be regulated: The position of the moving part of the motor and the vertical force generated by the motor. It is important to regulate the vertical force generated by the motor because, in certain applications, it provides support for levitation [12]. This force could be either positive or negative depending on the design of the positioning stage, where the motor could be inverted, that is, the stator would be above the magnet array [3].
As described in the previous section, the position of the motor is defined by the horizontal force because it is the only force acting on the axis of movement. Therefore, in order to regulate the position and the vertical force separately, it is necessary to decouple the control of the vertical and the horizontal forces. However, on the basis of Equation (1), it is infeasible to regulate the two forces independently by acting directly on the phase currents.
In rotatory motors, a Clarke-Park transformation (Equation (6)) permits the decoupling of the rotor magnetizing flux and the torque. The Clarke-Park transformation defines the direct and quadrature (d-q) virtual axes that rotate with the spinning rotor at a speed identical to that of the rotating flux vector [14]. In these motors, the quadrature axis component (I q ) produces the torque, and the direct axis component (I d ) exerts a magnetising effect on the reference flux. Then, the common practice is to magnify the torque production and minimize the magnetic flux [15].
To understand the effect that the Clarke-Park transformation exerts on a Halbach linear motor, Equations (1) and (6) are combined to obtain: As implied by Equation (7), the direct axis component (I d ) is proportional to the horizontal force generated by the motor (F x ), as also is the quadrature axis component (I q ) to the vertical force (F z ) [16]. It must be highlighted that in a linear motor, the Clarke-Park transformation exerts a different effect than in a rotatory motor. The linear motor moves when F x is non-zero; moreover, once it arrives at the target position, F x should be zero for the motor to remain motionless. Thus, the reference input for I d naturally tends to zero. The magnitude of F z (I q ) does not affect the movement because it is orthogonal to the movement axis and it attains its maximum value when F x is zero. On the contrary, in rotatory motors, I q produces the torque that performs the movement. Moreover, in rotatory motors, the reference input of I d is set to zero to optimize the torque production.
Therefore, in a Halbach linear motor, a Clarke-Park transformation permits the decoupling of the control of the two orthogonal forces; this is called vector control. This control can be performed by two independent proportional-integral (PI) controllers for I d and I q . The outputs of these two PI controllers are the direct and quadrature virtual voltages, V d and V q . Nevertheless, the phase voltages (V a , V b , and V c ) that correspond to V d and V q at a certain position, must be calculated. This can be achieved by performing an inverse Clarke-Park transformation. The inverse of Equation (6) has more than one solution (one degree of freedom). In the case of this study, the control hardware forces the star connection of the phases, which implies that the sum of the three phase currents must be zero (Equation (8)). Applying this constraint, Equation (9) is obtained: The resultant control strategy, implementing the vector control, is shown in Figure 5. The main proportional-integral-derivative (PID) controller has the desired position X ref as the reference input and the real position X s as the feedback; the output is the required horizontal force F x . The two PI controllers regulate F x and F z independently and in real time. These controllers have I dref and I qref , respectively, as the reference input. I dref is proportional to the output of the main PID controller (F x ). I qref is proportional to the desired vertical force F z . The outputs of the PI controllers are the voltages V d and V q , and, by an inverse Clarke-Parke transformation, the corresponding phase voltages that need to be generated for the current position can be calculated. The actual I d and I q currents must be fed back to the PI controllers to be compared to the reference inputs. Therefore, the control hardware must be capable of reading the phase currents and obtaining the values of I d and I q in real time by a Clarke-Park transformation. It must be noted that in order to perform the Clarke-Park transformation and its inverse, the position of the linear motor X s as well as the value of the phase currents must be specified at each moment. The operating speed of the main PID is defined by the sampling speed of the positioning sensor, whereas the operating speed of the d-q controllers is defined by the sampling speed of the current sensors that is typically faster.

Control Hardware Implementation
This work proposes to facilitate control using a commercial hardware solution. The selected device is a Texas Instruments (DRV8302-HC-C2-KIT) Digital Motor Control Kit (DMC) designed for regulating generic three-phase rotative permanent magnet synchronous motors and brushless DC motors. The use of this hardware facilitates the implementation and reproducibility of the developed control strategy. Nevertheless, being a commercial control hardware for general purposes, it presents certain limitations when implementing it into our specific application. These limitations can be overcome or minimized by optimizing the control implementation.
The DMC comprises the 32-bit Digital Signal Processor (DSP) TMS320F28035 that executes the closed-loop digital control algorithm with the C2000 Micro Controller Unit (MCU), Analog to Digital Converters (ADC), and PWM outputs. The DMC also comprises current sense amplifiers and the required inverter stage for commutation.
The control program was developed in Simulink that includes a Texas Instruments Target Support Package for Embedded Code library. In addition, Texas Instruments library for MCU C2000 includes optimized blocks for fixed-point mathematical operations (IQ Math) and for digital motor control (DMC). It has been experimentally observed that although the processor is capable of operating with other 32-bit data types and math operation Simulink blocks, it operates faster with its optimized blocks and fixed point or integer data type. The units of the variables are adapted in order to minimize the dynamic range of the data values that the MCU has to process and thus, maximize the precision. Hence, the error derived from the use of the 32-bit data is negligible (<1 nm).
The implementation of the control system in the control hardware is represented in Figure 6. The controller setpoint parameters are the motor position (X ref ) and the required vertical force (F zref ). The selected hardware generates phase voltages in an inverter stage by pulse width modulation (PWM) of the required phase voltages (V an *, V bn *, and V cn *). The voltage difference between the phase terminals and the neutral point of the motor (N) creates the phase currents (I a , I b , and I c ), from which the two orthogonal forces (F x and F z ) are generated. According to the motor law, their magnitudes depend on the relative position between the stator and the magnet array (X s ). To perform the vector control, the phase currents must be measured by the analogue to digital converters (ADC). The hardware reads two of the phase currents and the third one is calculated according to Equation (8). Position is measured by an XL-80 Renishaw laser interferometer, transferred to Simulink, and directly transmitted to the control card through the serial communication interface (SCI) as 32-bit data, in conjunction with the reference position (X ref) and vertical force (F zref ) commands. The movement of the motor is generated when the phase currents flowing through the coils of the stator are varied. The displacement is directly related to the magnitude of this variation. For example, for a reference vertical force set to 5 N, a displacement of 1 µm requires a variation in the phase currents of approximately 1 × 10 −4 A. Thus, the precision of the positioning control depends on the precision with which the control hardware is capable of controlling the phase currents. There are two main functions of the hardware that affect the control of the phase currents: The voltage generation and the current sampling. In Sections 4.1 and 4.2, these two functions are described and analysed.

Voltage Generation
The selected control hardware generates phase voltages by pulse width modulation (PWM). For this application, the PWM signal frequency is constant and defined by the timer period. In contrast, the magnitude of the generated voltage varies and is defined by the duty cycle. When the neutral of the stator is floating, a duty cycle of 100% generates the maximum phase-to-neutral voltage, this is equivalent to half of the supply voltage (PVDD/2) that is being fed to the hardware. A duty cycle of 0% generates the minimum phase voltage (−PVDD/2) due to the inversion of the current flow.
In practice, a PWM signal produces undesirable current ripple. To minimize this ripple, the phase pulses must be center-aligned [17]. Therefore, the count is defined as up and down, which implies that in a period the timer base is counted two times (one-time up and one-time down) [18].
The resolution of the PWM depends on its timer period, which must be an integer of up to 16 bits. The higher the timer period is, the higher is its resolution. Nevertheless, the timer period is limited by the switching frequency. According to the manufacturer, setting the PWM switching frequency below 10 kHz is likely to adversely affect the inverter output and is not recommended. This implies that the highest timer period can be 2 11 (2048), which corresponds to a lowest acceptable frequency of 14.64 kHz (up-down count). For that timer period, the PWM input is an integer of up to 11 bits and capable of defining the phase voltage with a resolution of PVDD/2048. In this study, the selected supply voltage is 12 V, and the PWM signal resolution is 0.006 V corresponding to 0.006 A in phase current for the 1 Ω resistance stator winding.
The DSP includes a high resolution PWM (HRPWM) function that is capable of extending the time resolution capabilities of the PWM module [19]. HRPWM is based on micro edge positioning (MEP) that divides each coarse step of the PWM into fine steps of 150 ps, which in our case corresponds to a resolution of 2.62 × 10 −5 V. The digital input of the HRPWM is a 16-bit integer for the coarse steps and 8-bit fraction length for the MEP steps. As it was mentioned, owing to the PWM frequency requirements, the integer input has a maximum of 11 bits. Therefore, the input of the HRPWM is a fixed point of 19 bits (11 + 8 bits). This data type implies a resolution of 2.29 × 10 −5 V. Hence, the resolution of the HRPWM is defined by the fine MEP steps, that is 2.62 × 10 −5 V, rather than by the number of bits of the digital input. A disadvantage of the HRPWM is that it does not cover the complete duty cycle working range; i.e., the MEP is not operational for duty cycles near 0% and 100%. The reference value of F z defines the operating range of the phase currents. In the case of this study, the vertical force is set to a maximum of 5 N. Therefore, the operating range of the phase currents is ±2.1 A, which corresponds to a duty cycle value between 32.5% and 67.5%. Therefore, the HRPWM function can be used in this application, which improves the resolution of the system, as it is shown in the virtual analysis, in Section 5.1.

Current Sampling
The phase currents are sensed by the shunt resistors that are placed in the inverter legs of the three-phase transistor bridge, where the phase current flows when the low-side switch is on. Therefore, the current sampling must be synchronized with the PWM. The MCU includes ADCs that convert the analog measurements into a 12-bit integer. Only two phase currents are read, and the third one is calculated.
The ADCs are based on start of conversion (SOC). Thus, the ADC modules are set to read once in each PWM signal period. In addition, in order to measure the average current, the shunt voltage must be sampled at the centre of the low-side on-period.
Considering that the maximum and minimum currents that the current shunt is capable of reading are 20.625 A (4095) and −20.625 A (0), respectively, the ADC resolution is 0.01 A. In a previous work [20], a current sampling stability analysis was performed, and the noise was measured for different current values. The observed noise was similar for all the currents within the operating range, exhibiting a root mean square deviation (RMSD) equal to ±0.022 A; moreover, the difference between the maximum and minimum recorded value in a sampling was 0.12 A. The deviations from the actual value are caused by the current sampling noise. This noise can be reduced by using a filter, similar to a rolling average. In this study, the average of 32 sampled values is determined. Applying this filter, the RMSD is reduced to ±0.0032 A, and the difference between the maximum and minimum recorded value in a sampling is reduced to 0.02 A.

Validation of Control System Performance
Once the control strategy has been defined and implemented in the control hardware, its performance can be validated. First, the whole system was virtually analysed in Simulink; the results obtained are presented in the first part of this section. In the second part of the section, the experimental verification of the performance of the implemented control system is described.
In this control system, the phase currents' operating range is defined by the reference value set for the vertical force. For all the experiments described in this section, the reference value for the vertical force is set to 5 N so that all the results are comparable.

Virtual Analysis
The system that is represented in Figure 6 has been completely simulated in Simulink. The plant was modelled according to the transfer function calculated in Section 2.3. In the model, the data type of the variables was set to be identical to that in the program compiled in the MCU. In addition, Texas Instrument's IQ Math and DMC blocks were used to perform the operations, similarly as in the compiled program. The sample times of the ADC and the positioning sensor were also taken into account apart from the errors and noise of the modules that could be characterized. The ADCs operate once in each switching period, i.e., every 68 µs. Renishaw XL80 laser system has a sample time of 0.055 s and a resolution of 1 nm, and its noise has a range of 400 nm. The sample time of the positioning sensor defines the speed of the outer loop, while the sample time of the ADCs defines the speed of the inner loops. In addition, the model includes the limitation of the resolution of the PWM modules and the resolution and noise of the current sensing. The simulation of the model permits us to determine the effects of each error that is introduced and of tuning the controllers in advance, which facilitates the task during the actual implementation.
As mentioned in Section 2.2, the electromagnetic horizontal force behaves as a servosystem, the target position of which is at an equilibrium state, wherein the horizontal force is zero. The equilibrium state of the motor is generated by a certain combination of the phase currents, which is different for each position inside a pitch. Therefore, the minimum incremental motion of the system is directly related to the phase current resolution. In turn, the resolution of the phase currents depends on the resolution of the voltage generation. The simulated model enables a better understanding of the system dependence on the voltage generation resolution, which is defined by the PWM module and the HRPWM function, if applied.
In order to study the effect of the voltage generation resolution in the system, the other error contributors were cancelled in the simulated model. First, the voltage generation resolution was set to be 0.006 V without using the HRPWM function. It was observed that when the system operates in an open-loop, the resultant minimum incremental motion is approximately 15 µm. This is owing to the fact that the inverter stage is not capable of generating the exact combination of the phase currents that generates a zero horizontal force in the intermediate positions. In Figure 7a, the response in open-loop (red) to a stair case of 10 µm steps (blue) has been simulated. It is observed that the system cannot react to the second step. Nevertheless, when the control strategy is implemented in the system, the positioning error is corrected. The simulation demonstrates that the controller switches between combinations of the phase currents, maintaining the motor at the target position. As a consequence, the motor does not remain motionless, but marginally oscillates around the target position. The amplitude of the oscillation depends on numerous variables such as the target position, the sample time of the positioning sensor and the reference vertical force. This is apparent in Figure 7b, which represents the response of the closed-loop system (red) to a stair case of 10 µm steps (blue). When the HRPWM function is applied, the voltage generation resolution improves to 2.62 × 10 −5 V. This resolution is sufficient to perform a minimum incremental motion of approximately 700 nm in open-loop. Similarly, as in the previous case, the positioning error is corrected by implementing the closed-loop control strategy. Nevertheless, the controller switches between combinations of the phase currents that are closer to each other, and thus, the derived oscillation becomes imperceptible. Therefore, when using the HRPWM function, in closed-loop, the voltage generation resolution contributes negligibly to the positioning error. The response to the stair case of 10 µm steps (blue) when using the HRPWM function in closed-loop (red) is represented in Figure 7c. All the results are calculated for a vertical force set to 5 N. For other values it should be taken in to account that the higher the vertical force is, the higher is the dynamic operating range of the phase currents and the lower is the precision that is required. The simulation reveals that the two main contributors to the positioning error are the positioning sensor noise and the resolution and noise of the current sampling. The noise of the positioning sensor is not a subject of this work because it is external to the control hardware, and the selection of the positioning sensor does not affect the control system. The resolution of the ADCs is limited to 12 bits, and they present a noise that the previous section proposed to minimize by applying a rolling mean filter. It has been verified that the delay introduced by the filter does not affect the performance of the control system, due to the difference between the sample speed of the laser system (0.055 s per readout) and the sample speed of the ADCs (68 µs per readout). In addition, the simulation reveals that the rolling mean filter improves the resolution of the ADCs by approximately two additional bits. In this control hardware, the performance of the ADCs cannot be improved any further. If better results are required, another control card with higher performance ADCs should be selected.
The controllers were simulated and tuned in Matlab, taking into account all the error contributors and the sample times. The operating requirements that were taken into account when tuning the controllers were a maximum response time of 1 min to prevent oscillation. As mentioned in Section 2.2, around the equilibrium position, where the horizontal force is linear, the system behaves as a second-order servosystem. In order to facilitate the tuning of the controllers, the controllers were set to work in the linear zone by limiting the output in the saturation parameters.

Experimental Results
Once the system has been virtually validated, the control system is implemented in the hardware. The PID controller for the position and the PI controllers for I d and I q , which had already been tuned in the simulated system, have been experimentally fine-tuned in the setup. The saturation parameters have been also set to work in the linear zone.
One of the main advantages of Halbach linear motors is that the operating range is limited only by the design. The Halbach linear motor case of this study is designed to operate in a range of 50 mm. In order to verify that the control system is capable of operating in the complete operating range, the target reference was set to be a ramp that moves the motor 50 mm from the zero position. The response is represented in Figure 8, which shows that the position of the motor (red line) follows the reference position (blue line) along the whole working range at constant speed. Halbach linear motors are mainly applied in precision engineering, functioning as actuators in positioning stages. In Figure 9, the response to a 100 µm step is represented. In addition, in a positioning stage, the vertical force generated by the motors can be leveraged. As mentioned in the introduction, in most positioning stages, the levitation is performed by airbearings, whereas Halbach linear motors favour the levitation of the moving part [3,8,11]. Nevertheless, there are other designs that propose the vertical force of the linear motors as the only sustainable system for the levitation [12]. In both the cases, the vertical force should remain constant as the mass of the moving part does not vary. According to the motor law, the vertical force depends on the relative position between the stator and magnet array. Therefore, when the motor is moving to a target position (transient state), the vertical force varies marginally from its reference value. The vector control strategy that is proposed in this work enables the control of the transient response of the vertical force. In order to verify its performance, the vertical force was measured with a load cell fixed to the magnet array, as shown in Figure 4. The variation of the vertical force when the motor from being static moves to a target position having a separation of 5 mm has been represented in Figure 10a for three cases: Open-loop without applying any controller (dashed line), closed-loop with a position controller (dotted line), and closed-loop with the vector control strategy defined in this work (dash-dot line). Similarly, the displacement of the motor for each case has been represented in Figure 10b. In each case, the reference value for the vertical force was set to be 5 N (solid line). Nevertheless, if the vector control is not applied, the vertical force is not regulated, and its difference from the reference value is not corrected. As a result, in the first two cases, F z does not attain its target value (5 N). As is evident, when the stator starts to move toward the target position (t = 1 s), the vertical force moves from its reference position. In the open-loop system, F z decreases by 18%, whereas when a position controller is applied, it increases by 7%. This is owing to the fact that in both the cases, the vertical force is coupled to the horizontal force. A position controller acts on the horizontal force, and that explains the difference between the variation of the vertical force in the first two cases. When applying a vector control, the two forces are decoupled and regulated by separate controllers. The first consequence of this is that when vector control is applied, the measured value of the vertical force is coincident with its target value, i.e., the error is eliminated owing to the integral term of the controller. Moreover, as it can be observed, the effect on the position control result is minimal. In addition, the variation of the vertical force during the transient response can be adjusted by tuning its controller. As a consequence, the variation of the vertical force when applying vector control is smoother. In cases where the variation needs to be minimized, a derivative term could be added in the controller of the vertical force (I q ).

Conclusions
Halbach linear motors present numerous advantages in precision engineering. Consequently, they have already been implemented in a number of positioning stages. In these stages, the horizontal force that is generated by the motor is used for positioning and the vertical force for favouring the levitation of the moving part of the stage. In order to regulate these two forces separately, this work proposes a vector control that decouples the forces by applying a Clarke-Park transform. This control strategy includes a main PID controller for the position and a PI controller for each of the forces. In addition, the control strategy has been implemented in a commercial control hardware: A Digital Motor Control Kit of Texas Instruments. Using commercial hardware presents numerous advantages such as facilitation of the future replication of the system. Nevertheless, the control hardware presents certain constraints and limitations that need to be overcome by optimizing the system design.
The two main functions of the control hardware that affect the precision of the system are the voltage generation and the current sampling. These two functions have been analysed in detail in order to improve the performance. This work proposes the implementation of the HRPWM function in the voltage generation and a rolling mean filter in the current sampling, in order to improve the resolution and reduce the noise of the phase currents.
In addition, a virtual simulation of the whole control system has been carried out in Simulink using the transfer function obtained for the plant of the experimental setup. The simulation includes operations, data types, resolution, sample times, and noise identical to those of the actual system implemented in the control hardware. This simulation has enabled a better understanding of the system. In addition, the controllers have been tuned in the simulated plant, which has facilitated the task in the experimental setup.
The performance of the control system developed in this work has been verified in an experimental setup. The capability of the control system to operate in the complete operating range permitted by its design, that is 50 mm, and its suitability for precision engineering applications were tested. In addition, the vertical force has been measured with a load cell in order to verify the advantages that the vector control introduces. The variation of the vertical force when the motor is moving was compared to the variation of the vertical force in the open-loop system and that in the system with a positioning control albeit without vector control. The improvement is evident; vector control eliminates the difference between the generated vertical force and the reference value, and it was observed that the transient response of the vertical force can be adjusted by tuning its controller.