1. Introduction
Linear motor motion controllers are presented in many industrial applications, including sliding door closers, assambly, conveyor systems, electronic manufacturing, material handling, industrial test, and robotic applications [
1]. Motion control is a sub-field of automation that involves controlling mechanical movements of load and it is applied directly to the actuator to manage physical variables, such as torque, acceleration, velocity and position of an axis or axes, depending of the degree of freedom (DoF) of the system [
2]. Motion control is applied to avoid the stress that is produced by a fast movement and to reduce the vibrations that are caused by the high rate of change in acceleration; also, trajectories are created to reach a desired position that the actuators must achieve [
3,
4]. Most commercial motion controllers that are available for industrial processes are based on classic controllers, such as Proportional-Integral-Derivative (PID) controller, and they are of closed architecture [
5].
The radical advances in technology have changed human life perception and intensified the problem of man-machine interaction with the use of intelligent control algorithms that are capable of translating human behavior into numerical representation applied to industrial applications. In 1965, Zadeh proposed a theory of creating and processing models that are similar to those used by a human brain, called fuzzy logic (FL) [
6]. This theory was never intended for use in control systems. FL tries to emulate the imprecise human reasoning of physical processes into information that is capable of being handled by an embedded system or computer [
7]. The FL has been judged over the years, because of its ability to face the complex problems with no models needed. Furthermore, FL has been implemented in problems where it was believed to be impossible to find a solution [
8]. The logic applied to fuzzy systems consists of sets; a fuzzy set is a class of objects with a continuum of grades of membership, whereas a classic set is composed by true or false values [
9].
FL-based controllers are more flexible and complex than PID controllers, since they cover a broader range of operating conditions and they can work with inner and external disturbances of different natures. The design of fuzzy controllers is easier than developing a model-based controller, and it is customizable, due to one being able modify the structure, rule base, and display them as a human being would do to control a system. There are a vast number of applications of FL, such as simplified control of robots [
10], control of car engines [
11], cruise-control for automobiles [
12], prediction systems for early recognition of earthquakes [
13], anti-lock braking systems [
14], renewable energy systems [
15], aircraft engines [
16], energy allocation [
17,
18], demand forecasting [
19], predictive maintenance [
20], and material handling [
21], just to mention a few.
PID, state-space controllers, artificial neural networks, and FL based controllers are the techniques applied for motion control. Huang et al. [
22] proposed a nonlinear adaptive controller for a linear position tracking. The end effect of the linear induction motor is used in the design, and the impact of friction dynamics is considered to design an observer-based compensation to face the friction force. The results of this work are satisfactory, but the control algorithm was implemented in MatLab/Simulink, which is a payment program and it is necessary for a license to work with it.
Kung et al. [
23] proposed a controller for a two DoF platform based on Field Programmable Gate Array (FPGA). The proposed motion control has two modules. The first module generates the motion profiles and a fuzzy controller with 49 rules. The second module performs the functions of two current vector controllers of permanent-magnet synchronous motor drives. The experimental results reported good performance in the response of the controller, even with a step signal, but the number of rules increase the performance capacity.
Boualleégue et al. [
24] proposed a strategy to tune a PID-type fuzzy logic controller (FLC) using the particle swarm optimization (PSO) algorithm. The scaling factors are used as constraints of the optimization algorithm. The PID-type FLC presents a suitable response using nine rules for the inference system. The convergence of the cost function satisfies the design parameters established, it converges with only 30 iterations. The paper present two disadvantages, a Matlab/Simulink license is required to implement the algorithm and the controller tuning is offline.
Bassi et al. [
25] developed a self tuning PID controller while using the PSO algorithm. The reported results show its performance as compared to a PID controller tuning by the Ziegler-Nichols method, which is an empirical approach. The PSO algorithm is used to compute the controller gains minimizing a cost function compund by the integral absolute error (IAE), integral square error (ISE), and integral of time multiplied by absolute error (ITAE). The results that are presented in this paper are simulations without experimental results displayed. Khan et al. [
26] designed a 49-rules FLC using the genetic algorithm (GA) to optimize the membership functions, FL rules, and scaling gains. The GA is implemented offline to obtain the design parameters, Matlab/Simulink is used for simulation. When the controller parameters are well defined the M-files, generated by Matlab, are translated into C/C++ language to be programmed in a microcontroller to control a DC motor.
A PID-type FLC is proposed by Fereidouni et al. [
27]. The configuration developed is this paper is called adaptive, because the scaling factors at output are dynamically tuned while the controller is functioning. To update the denormalization factors, a stochastic hybrid bacterial foraging particle swarm optimization algorithm is used. Furthermore, several control architectures are reported. Simulation results are only proposed using a database of 49 rules. In [
28], Bejarbaneh et al. submitted an adjusting technique for a PID-type FLC based on an hybrid PSO search algorithm called PSOSCALF. The controller is applied to an inverted pendulum. The design of the PID-type FLC is based on 25 rules to compute the control signal. The simulation results demonstrate that this algorithm can be well used in non-linear plants, since the control law is obtained considering the problem as an optimization one. A possible disadvantage of these kinds of combinations, optimization algorithms, and FLC is that the control signal can be trapped in a local minimum due to this being a inner characteristic of the evolutionary algorithms or optimization algorithms [
29,
30]. On the other hand, the design and simulation of a self-tuning PID-type FLC for an expert heating, ventilating, and air-conditioning (HVAC) system is reported by Soyguder et al. in [
31].The models of the variable flow-rate HVAC system are generated using Matlab/Simulink. In this paper, three rule bases are proposed for the variables
,
and
. Each rule base is composed by 25 rules, in terms of processing this is a disadvantage, since three deffuzification stages are evaluated.
In this paper a PID-type FLC is developed and implemented in a linear platform. The control algorithm has the ability to adapt itself according to the system variations. On the other hand, the fuzzy controller can be implemented in a low-cost embedded system, since the code it is easy to modify and adapt. The control algorithm is programmed in C/C++, it means that a license is not required to reproduce it. Furthermore, a profile generator is developed to design smooth trajectories that the chart must follow. The article is divided into the following sections:
Section 2 and
Section 3 present a FL and S-curve motion profile background, respectively. In
Section 4, the PID-type FLC is designed.
Section 5 presents a design methodology to implement the control algorithm based on user experience. The results and discussion are written in
Section 6. Finally, the conclusion is presented in
Section 7.
3. S-Curve Profile
This section presents the background of the S-curve velocity profile. In
Figure 2, the position, S-curve velocity profile, trapezoidal acceleration, and square jerk are displayed. As is well known, the S-curve is a seven-segment profile, where the total time displacement can be symmetric or asymmetric distributed. The acceleration and deceleration phases have the same length of time,
and they are represented by three stages. The design of a trajectory is based on the desired position
and the time displacement
T. The maximum velocity reached by the profile is computed in Equation (
11).
The constant factor
is proposed in order to vary the duration of acceleration phase
, which is limited by
. The maximum magnitude of the acceleration is obtained from Equation (
12). In
Figure 2, one can notice that the jerk shape is modeled by a square signal placed upon the acceleration variations.
where
is a constant factor used to calculate the length of the jerk pulse,
. The duration of
must be less than
to ensure continuity. The constant jerk value is calculated in Equation (
13).
Once the jerk constant value is computed, the acceleration can be calculated for any instant of time while using the Euler integral method of the Equation (
14).
The S-curve velocity profile is obtained from Equation (
15).
The desired position is reached integrating the velocity. The Equation (
16) is used to compute the position.
4. PID-Type FLC Design
The PID controller is commonly used in several industrial processes and it is presented in Equation (
17). A big disadvantage of this algorithms consist in the computing of the controller gains [
37,
38].
Figure 3 depicts the methodology proposed to compute the PID controller gains while using a fuzzy logic system. It basically consists of measuring the error, which is presented as a crisp value, and fuzzifier in order to inferred the
value and then multiplied by the error signal. The same procedure is applied to the
. The change of rate in error is the input to the fuzzifier selected to compute
. Variables
and
offer a fast response to the plant, the term
is constant, since it is only required to reduce the error to zero when the steady state is reached.
The labels of the linguistic-values are presented in
Table 1 with their respective ranges. Seven-linguistic-values are selected to compute the
and
gains.
Figure 4 presents the linguistic variable of the error and change of rate in error; they are composed by seven-linguistic-values.
Figure 4a presents an interval that goes to [−1, 1] m for error, this range is sufficient, since a trajectory is applied and the variation tends to small values upon the set point, also a step input can be applied among this interval. The linguistic variable, that represent the change of rate of error is depicted in
Figure 4b and its domain goes to [−10, 10] m/s, this range of values are selected since the change of rate in error can present a high magnitude if a step input is applied. Both of the variables are composed by triangular and gaussian membership functions.
Figure 5a shows the range of values that the
variable can take. Notice that these parameters cannot present negative values.
can be computed in a range of [0.5, 10], according to the measured error. On the other hand,
has values from a small range [0.0, 0.5]. This consideration is proposed, since the
gain in a PID controller can increase the error variation and make unstable the system.
Table 2 presents the location of the singletons used to calculate the controller gains and their respective linguistic values.
Table 3 displays the rule base used for the computation of the controller gains. The total number of rules used for computing
and
gains is seven. Besides, one can see in
Table 3 the relationship between the measured input signal, with its respective linguistic variables, and the output relationship. The inference process corresponds to a one-to-one relationship. Furthermore, it can be seen that four-input linguistic variables NM, NS, PS, and PM point to a single output variable S. These fuzzy relationships are used in order to ensure that the earnings values work on a range of adequate values.
The singleton is used as a membership function in the defuzzification stage to reduce the computational cost at the moment to compute and . This is important, since, in the conventional fuzzy controller, just one defuzzification stage is required, whereas, in this proposal, two defuzzification stages are implemented to simultaneously compute both controller gains.
Once the values of the relations are founded, Equation (
18) is used to transform the fuzzy set into the crisp value of the control gains. One can see in
Figure 3 that
and
values are independently obtained.
where
represents the controller gains,
is the membership degree of the singleton, and
is the position of the singleton in the output variables
and
. All of the possible values computed from
are depicted in
Figure 6. The use of gaussian and triangular functions in the fuzzification stage are considered for approximating the response into a linear representation of all possible values that the gains must take. Additionally, it can be observed that the gains never present negative values, even if error is negative.
5. Design Methodology
The
Figure 7 shows the steps to implement the control algorithm based on user experience. The first step consist of recognizing the parameters of the motor as the maximum voltage, current, torque, and velocity. In some cases, these parameters are not available; when this happens, experimentation is required to detect the values to start the system design [
5]. When the variables needed to system design are known, the next step is to select the embedded system to interface the computer, where is the control algorithm be implemented, and the electronic platform.
The next three steps correspond to a loop, which is used to adjust the operation range for the fuzzification method and select the appropriate membership functions, generally the trapezoidal and triangular membership functions are used in microcontrollers due to their ease of processing. This is important, since the controller inputs must be well defined to be capable to perform the signals that will be mapped to fuzzy values.
The control algorithm is implemented when the ranges of operation are proposed. The algorithm computes the error and the derivative of error to be used as input to the control system. These signals are related to generate the system response by the defuzzifier and send it to the embedded system. The embedded system process the control signal and generates a Pulse-Width-Modulation (PWM) signal to move the shaft of the motor. The voltage applied to the motor does not have to exceed the maximum value permitted and proposed in first step. On the other hand, if there is not a control signal generated, then it is possible that the ranges of operation cannot detect the input signals and it is necessary to adjust the ranges until the control signal is generated. Finally, if the control signal presents a response that meets the proposed requirements, those working ranges are maintained and the control algorithm will find the gain values of the controller.
6. Results and Discussion
The algorithms are implemented in a HP-Omen computer (Intel Core I7 8th Generation, Santa Clara, CA, USA) and programmed in C/C++. An FPGA is used to measure the position of the encoder and send it to the computer using the RS232 communication protocol. Additionally, a PWM module was implemented in the FPGA to apply the control signal to the servo amplifier. The sample time is 0.005 s.
The linear motion system a BLM-N23-50-1000-B brushless motor was mechanically coupled whose torque constant is
Nm/A with a current and continuous torque of 4.9 A and 3.9 Nm, respectively. This system has a maximum angular speed of 5000 Revolutions Per Minute (RPM) and an encoder with a resolution of 1024 Pulse Per Revolution (PPR).
Figure 8 displays the linear platform used for test the control performance.
A step input signal of magnitude 0.064 m, this value is proposed, since the maximum voltage of the motor does not be exceed when the algorithm is running, is applied to the system to prove the controller performance when it is applied to the plant. Furthermore, an integral constant
is used for the step input signal. Regularly, this type of test signals are the most used to test the response of the controllers to sudden changes in the reference signal, giving a general overview of what would happen whether a load is added to the plant. If the controller, which is faced with an aggressive test input, is not well tuned, the control response would fall into a zone of instability, which could cause permanent damage to the mechanical and electrical structure. In
Figure 9a, it can be observed that the controller presents a fast response, since the system reaches the steady state in 0.248 s and the overshoot is
.
Figure 9b shows the error signal and it tends to zero.
The control signal,
Figure 10, is the voltage applied to the system. The maximum voltage value obtained is beneath 24 V. When a controller is applied in a real application, the most important parameter to limit is the control signal, since, if the system demands a greater quantity of the variable that is being controlled than allowed, the control algorithm must be capable of protecting itself to avoid generating values not allowed by the plant.
Figure 11a shows the behaviour of
gains for a step input signal. The maximum value obtained is
and is decreasing until it reaches a constant value
. On the other hand,
reaches a maximum magnitude of
, after that, it tends to converge to zero, since there is not variations in the shaft of the DC motor.
Table 4 shows the performance of different control architectures comparing the rise time, overshoot, and settling time. The response of the PID-type FLC presented in this paper has a fast response, since the first time the position signal crosses the reference for the first time is in 0.124 s and the time that it takes for the system to stabilize is 0.248 s.
Motion Control Implementation
A S-curve velocity profile is implemented to reach a desired position instead of using a step signal. Motion control systems are compounded by a motion profile to avoid stress and reduce vibrations in the mechanical structure [
41]. The cart has to move 0.53 m in 2 s, these parameters were chosen to test the controller performance; one can introduce another set-point. For smooth inputs the integral constant used is
. In Algorithm 1, the psudocode is presented to illustrate how the algorithm in C/C++ language is programmed.
![Sensors 20 05323 i001]()
Figure 12a,b present the position and error signals, respectively. For
Figure 12a, the position follows a reference to compare the desired trajectory against the system position. The amplitude error oscillates between
and
m. Note in
Figure 12b that the error is zero at 2.65 s.
In
Figure 13b, the control signal shows a maximum voltage peak of 16 V to achieve the desired position. The control signal is computed by the PID-like FLC relation of the controller gains. On the other hand, according to
Figure 13a, one can observe that the velocity follows the reference properly, the maximum velocity computed by the trajectory algorithm is 0.94 m/s.
The controller gains tend to vary according to the error measure and rate of change of error. The variation when the controller follows as the trajectory oscillates from 3 to 6.5 in magnitude for
and from 0 to 0.052 for
. Notice in
Figure 14 that the controller gains do not have units.
In real conditions, the servo systems are in contact with loads that must move smoothly in order to prevent what they are transporting from falling; for this reason, a cylindrical load of 1.9 kg is added on the carriage and, thus, prove that the control algorithm complies with the proposed specifications. In addition, the responses obtained when the load is transported are compared, again the S-curve movement profile and the parameters that were used in the previous test are implemented, in relation to when there is no load on the cart. As one can see, the trajectory presented a similar behaviour in error whether it is compared with the signal from
Figure 13b; this means that the controller is robust and it can adapt itself to variations of the system. The position follows properly the trajectory proposed, as one can see in
Figure 15.
The velocity follows the trajectory properly, as one can see in
Figure 16a, in stages when the acceleration and deceleration are computed, but when it must be constant, the velocity present a transient response that is induced by the load applied to the shaft of the motor. The control signal increased up to 23 V and oscillated under this value, as presented in
Figure 16b.
One can see in
Figure 17 that the controller gains contain aggressive oscillations after the load is applied as compared with the behaviour when no load is added, as in
Figure 14, it can be justified according to the voltage response from
Figure 16b.
Table 5 displays a brief comparison of motion controllers presented in the literature. As can be seen, some authors choose to use Matlab/Simulink and LabVIEW NI for the design of their algorithms, the problem with using this type of tools is that you must have a license to be able to use the software in a complete way, increasing the cost, in monetary terms, of the control system and, therefore, the algorithm is restricted to the use of embedded systems compatible with these programs. The idea of using a free programming language, which does not need licenses, for the design of motion control systems makes the system affordable and easy to apply in other programming languages and even different embedded systems. In this paper, three C/C++ functions were created in order to compute the motion profile, the membership functions, and PID-type FLC, respectively. Algorithm 1 depicts the real structure of the motion control algorithm.