Optimizing the Parameters of Sliding Mode Controllers for Stepper Motor through Simulink Response Optimizer Application

One of the main features of a stepper motor is that the rotor position can be controlled precisely, which makes it suitable for robotic applications and 3D printing [1]. In open-loop control, the rotor position can be moved in discrete steps by applying a sequence of input voltages. However, the transient response in open-loop control suffers from high oscillation before the desired position is settled. The open-loop control has been discussed in [2], such as poor response, high nonlinearity of the system model, perturbation of load torque, and parameters uncertainty. In [3], an open-loop control simulation was conducted in Simulink where the results showed unsmooth movement (discrete) in the rotor angular displacement, and the movement had stopped when external load exceeded the electromagnetic motor torque. Therefore, the main objective of this paper will be to optimize the parameters for the closedARTICLE INFO ABSTRACT


Introduction
One of the main features of a stepper motor is that the rotor position can be controlled precisely, which makes it suitable for robotic applications and 3D printing [1]. In open-loop control, the rotor position can be moved in discrete steps by applying a sequence of input voltages. However, the transient response in open-loop control suffers from high oscillation before the desired position is settled. The open-loop control has been discussed in [2], such as poor response, high nonlinearity of the system model, perturbation of load torque, and parameters uncertainty. In [3], an open-loop control simulation was conducted in Simulink where the results showed unsmooth movement (discrete) in the rotor angular displacement, and the movement had stopped when external load exceeded the electromagnetic motor torque. Therefore, the main objective of this paper will be to optimize the parameters for the closed- This paper will focus on optimizing parameters of sliding mode controllers (SMC) for hybrid stepper motor models simulated in Matlab/Simulink. The main objective is to achieve a smooth transient and robust, steady-state to track reference rotor position when the stepper motor is subjected to load disturbances. Two different structures of SMC controllers will be studied, which are based on the flat system concept that is applicable to the stepper motor model. The hassle to determine controller parameters will be optimized using the Simulink Response Optimizer application. The performance of the controllers will be evaluated by considering load torque and variation in the model parameters. Although the results showed that an openloop controller could move the rotor to the desired position, however, the transient response had undesired oscillations before the output settled at the steady state. The response was improved by optimizing SMC controllers' parameters to meet the desire step response requirement. Despite both SMC methods have successfully tracked the reference, there are some challenges to deal with each method in regard to the state measurements, the number of optimized controllers' parameters, and the scattering of control inputs. loop controllers to achieve smooth transient and robust performance against disturbances at steady-state operation.
In [4], some attractive features of SMC were mentioned, such as insensitivity to parameters variation, error in the modeling. One of the controlling implementations on hybrid stepper motor to overcome the nonlinearity behavior such as detent torque is the variable structure control (VSC) which is based on the sliding surface [5]. In [5][6][7][8][9], the controllers for motors were developed using Field Programmable Gate Array (FPGA), where its main advantage is the precision for multi-control purposes. Another development is a sensorless speed control for stepper motor with a new control structure that doesn't require state transformation. Neither it required the usage of sigmoid or saturation block in SMC. Instead, it applied an embedded fuzzy logic controller [10]. Similarly, in [11], a smoothed sliding mode controller was developed to reduce the chattering effect by implementing recurrent Elman Neural Network as a replacement of the sigmoid or saturation function. In [12], a new structure of proportionalintegral (PI) controller consists of proportional and integral gains, which are constant and correlated to motor parameters, while an extra time-varying speed gain multiplied into other two gains.
Since the nonlinear model of stepper motor can be classified as a flat system, all its states and all its inputs can be expressed directly in terms of the outputs and the derivatives of the output without integrating any differential equations [2]. When a nonlinear system is flat, the system is said to be controllable as the system model structure is well characterized, which makes it suitable to design controllers for reference tracking and system stabilization [2]. It is worth mentioning that in a flat system, the entire system trajectories can be described in terms of the outputs where the number of required outputs shall be equal to the number of the system inputs [4]. Therefore, the implementation of the SMC controller in this paper will focus on the property of stepper motor flatness.
The first section in this paper will be about the method that introduces the operation principle of a stepper motor, the structure of two sliding mode controllers, and how controllers' parameters can be optimized through Matlab/Simulink. The second section will cover the results & discussion of an open-loop controller and SMC controllers applied on a stepper motor. At the end of the paper, future work will be discussed related to the implementation of the proposed controllers, where the main contribution of this paper was to study the structure of stepper motor controllers and also to evaluate the simulation results obtained from optimizing the controller's parameters.

Operation Principle of Stepper Motor [13]
The magnetic circuit is a hybrid stepper motor that is excited by two sources; from the permanent magnet at the rotor shaft and also from windings at the stator poles. Fig. 1 shows a typical layout for a hybrid stepper motor where the stator has 8 poles with two teeth in each pole. The excitation is applied through two sets of windings (two phases) on stator poles. The first set of windings is placed at poles 1, 3, 5, 7, while the second set of windings is placed at poles 2, 4, 6, 8. Meanwhile, the rotor consists of two cylindrical stacks (stack X and stack Y, as shown in Fig. 1) coupled by a permanent magnet. Each stack has the same number of teeth, but one stack is displaced from the other by one tooth. When positive current applied on winding A (phase A), the stator and rotor teeth are aligned at pole 3,7 in stack X, and at the same time, the teeth are aligned at pole 1,5 in stack Y. To move the rotor in the clockwise direction, it is required to remove the positive current on phase A and apply positive current on phase B. In this case, the teeth will be aligned at pole 4,8 in stack X and at pole 2,6 in stack Y. To continue further clockwise rotation, the positive current at phase B is removed, and negative current at phase A is applied, then negative current at phase A is removed, and negative current at phase B is applied. By exciting the phases one at a time with A+, B+, A-, B-sequence, one rotor tooth is fully rotated in the clockwise direction. To reverse the direction of rotation as counter clockwise, the excitation sequence cycle is reversed (such as A+, B-, A-, B+). The angle rotation of one rotor tooth is equivalent to ( ℎ = 360 / ), where is the number of rotor teeth. While the angle rotation during each phase excitation called "full-step," which is equivalent to ( = 90 / ). In a Hybrid stepper motor, the phase difference between excitation currents (difference between phase A and phase B) shall be ( /2), which is controlled by an electrical drive circuit.

Control System Structure
The proposed controllers will be based on a sliding mode controller (SMC). Two different approaches of SMC structures will be implemented, which are based on the flat system concept that is applicable to the stepper motor model; the state feedback controller approach shown in Fig. 2 [14] and the input-output approach shown in Fig. 3 [15]. More details about these controllers will be discussed in sections 3.4 & 3.5.

Controller Design Optimization
To track reference input and to satisfy design requirements for the controlled system through Simulink, the controller parameters can be optimized by applying three main steps. First, Step Response Characteristics block has to be defined, such as rise time, settling time, and other characteristics, as shown in Fig. 4. Second, the reference tracking specification has to be specified in Check Against Reference block, which will compare the reference input with the actual output response that the controller has to satisfy. Third, in the Simulink Response Optimizer application shown in Fig. 5, the control parameters and the range (maximum, minimum, and scale) of each parameter have to be defined.

Check Against Reference
Step Response Characteristics

Result & Discussion
The objective of this section is to design controllers to stabilize the motor angular displacement at the desired reference angle. Although applying the inputs in the open-loop can move the rotor angle to the desired position. However, the transient response will have high oscillations before the output settled at the steady-state.
Stepper Motor Modelling [16] By combining electrical and mechanical differential equations, the overall hybrid stepper motor model can be described by 4th order differential equations: Where, the parameters and nominal values of the commercial stepper motor are defined in Table 1, while the states and inputs are defined in Table 2.

Flatness System [17]
Stepper Motor model can be classified as a flat system where all states and all inputs can be expressed in terms of outputs and the derivative of the output, which is shown in (5) to (9). To show the system is flat, it is necessary to have a number of outputs and inputs to be the same. Hence, another output besides rotor angular displacement shall be defined where direct current will be chosen. Hence, the first and second outputs are defined as ( 1 = = ̅ 1 ) and ( 2 = = ̅ 4 ). Since the system is flat, the nonlinear model can be said controllable where it is possible to find a controller that steers the desired outputs from the initial state to the final state.
State Feedback Control Approach Since there are two inputs in the system, it is required to design two sliding surfaces. The sliding surface will be designed such that flat output can track reference output which influenced by control input with the following structure was developed base on [17]: Where is the highest derivative of expressed in and 1 , … , ( −1) are constant coefficients and 0 = 1.
From 1 and 2 in (8) and (9), the highest derivatives of flat output are ̇1 and 2 (3) . So, in this case, the sliding surface is a two-dimension vector where the proposed sliding surface can be as the following: The control inputs i will be selected such that the derivative of the sliding surface ̇i = i , where is a sub-control input in . Then, By choosing = 1 2 2 as candidate Lyapunov function, its derivative becomes ̇=. As the surface derivative can be expressed as ̇=̇= − ( ) . This will always satisfy ̇≤ 0, which means that the system is asymptotically stable, and outputs can diverge to the desired reference. To eliminate chatter behavior due to controller switching, can be redefined as the following: The state feedback controllers can be expressed in terms of states as the following: ( 2 ) (19) In this controller structure, it looks that all states have to be measured. However, as a system is flat, only the two flat outputs are required to be measured, while the rest of the states can be computed from flat outputs and their derivatives. It is important to highlight that when Simulink computes the derivatives, it is based on numerical calculations, which generate noise and slows the simulation time. Therefore, all states will be assumed to be available to the controller either by measuring states or by estimating them through the observer.

Input-Output Control Approach
Another SMC method will be implemented, which has a unique controller structure based on Multi-Input Multi-Output (MIMO) flat systems [15]. The proposed SMC controller can overcome the need to measure the entire system states because this method depends only on the measured flat outputs and on the applied inputs. The MIMO flat system can be represented in the following form: where ( ) is the highest ℎ derivative of flat output, is the controlled input, and is all state terms which can be treated as unknown or as a disturbance. The stepper motor model can be represented as two decoupled flat outputs with the highest derivative ̇1 and 2 (3) as the following: The models can also be expressed as output tracking errors ( ) in the following form: where and are reference outputs and inputs, respectively.
As per the controller sliding surface defined in [15], two sliding surfaces can be defined as the following: where the coefficients 1 , 0 and 4 , 3 , 2 , 1 , 0 can be selected such that the polynomials in the following −domain equations are Hurwitz polynomials (stable). For the open-loop controller shown in Appendix A, the inputs were chosen to move the rotor 4 steps in the clockwise direction, then reverse the rotation counterclockwise, so the rotor can go back to its original position. This can be achieved by applying phase voltages in A+, B+, A-, B-, A-, B+, A+ sequence, as shown in Fig. 6. As the rated input voltage of the selected commercial stepper motor is 12V when 12V voltage and higher is applied, the steady-state response of angular position will remain the same (step-length =0.0315 radian), but with higher applied voltage will cause higher oscillation in transient response. Meanwhile, when the input is below 12V (for instant 6V), the system behaved differently as shown in Fig. 7.
For SMC state feedback controller shown in Appendix B, the selection of the controllers' coefficients in "(13)" ( 0 , 1 , 2 , 1 , 2 , ) can be optimized using the Simulink Response Optimizer application. When step response characteristics determined as per Fig. 4, the parameters can be optimized as shown in Table 3. The response of the states is shown in Fig. 8. These results were obtained when referencing inputs , , , were applied as shown in Fig. 9. In this case, the load torque was neglected from both the model and the controller. To evaluate the impact of load torque ( ) on the system response, three cases were considered as shown in Fig. 10. It is important to emphasize that the reference voltages have to be continuously exciting the motor when it is loaded. Otherwise, once the excitation is removed, the motor will not maintain its angular position. Hence, the and have to be set at 12V all the time. The steady-state error will be almost zero as long as the applied load torque is 0.001 or less. Any torque beyond 0.001 will cause a noticeable steady-state error. Fig. 11 shows the impact of variation in model parameters when ( 1 , 2 , 3 , 4 ) are multiplied by a factor of 100 and 200. With this large variation applied to all parameters, the impact on the transient and steady-state can be observed.
For SMC input-output controller, the proposed coefficients in [15] will be selected, which are for an asynchronous motor with two pairs of poles in the rotor, unlike the stepper motor in this case study which has 50 pairs of poles. The complete system modeling with the controllers has been built in the Simulink, which can be seen in appendix C1. The angular motor position 2 can track the reference when chosen to be very small ( = 2 −52 ). However, in this case, the output always has a steady-state error, and the error magnitude is varying depends on the level of applied step reference, as shown in Fig. 12. This could be explained due to the existence of nonlinear terms in the model and also due to DC gain in the closed-loop transfer function at the steady-state, which could be eliminated by feedforward gain if the model was fully linearized. To improve the system response, the model was slightly modified to include reference input ( 1 ) in the 1 st controller as shown in appendix C2, and the parameters were optimized by Response Optimizer application in Simulink. The optimized parameters couldn't converge to the desired step response characteristic as indicated in Fig. 4, but the output response shown in Fig. 13 is for the best-optimized parameters obtained in Table 4. With these new parameters,

218
International Journal of Robotics and Control Systems ISSN 2775-2658 Vol. 1, No. 2, 2021, pp. 209-225 the steady-state error has been enhanced even at different levels of step inputs, but output response becomes slower with slight oscillation before settling at a steady state. It is interesting to highlight that the newly optimized parameters in the first controllers ( 1 ) are negative while in the second controller ( 2 ) are positive, and the overall system remained stable. Also, the controllers have more parameters comparing to the first SMC state feedback controller, and its response suffered from high switching frequency with high controllers gains that must be put into consideration.

Conclusion and Future Work
This paper has reviewed the nonlinear model of a hybrid stepper motor where the motor has shown stable response in the open-loop as the desired rotor position can be reached by applying proper voltage sequences. However, open-loop response suffered from high oscillation before the desired position is met, which is not preferred in stepper motor applications. Since the stepper motor model can be recognized as a flat system, the paper has focused on studying the behavior of the stepper motor responses by optimizing the parameters of controllers based SMC flat output approach. Two different SMC control structures were proposed where the first SMC approach is based on state feedback while the second SMC approach is based on input-output. Both controllers showed the ability to track reference input, and also they overcame oscillation problems during transient response. However, the main challenge was to select proper controller parameters where the Simulink Response Optimizer application was utilized to satisfied desired step response requirement. From the obtained responses, it can be concluded that the controllers can perform better when full step change of rotor angle (1.8 in this case study) applied as reference. This paper focused on simulation outcomes to optimize the parameters for SMC controllers through Simulink. It is important to validate the results on the real stepper motor. Hence separate paper will be developed to focus on the implementation of SMC controllers. In [18,19], the required components to control a stepper motor were achieved using Arduino and NodeMcu Microcontrollers. The future work will be to configure hardware including; controller in Arduino Microcontroller, motor drive, stepper motor, position, and electrical current sensors. Also, the optimized parameters in this paper will be implemented and compared with newly optimized parameters to achieve better performance.