This section describes the foundations of DC motor transfer function development, identification as a first-order system, a PID controller development, and the analysis of time series and its application to re-tune PID gains offline as an adaptive control alternative.
2.1. Theoretical Basis
A DC motor uses magnetic flux, and the current is carried through a conductor, which produces a force on the shaft to generate an angular speed [
9]. DC motors can be modeled through the relationship involving electrical and mechanical interactions to develop an electro-mechanical model. This model involves the electrical parameters such as voltage, current, inductance, and resistance, and the mechanical parameters such as friction, torque, and damping ratio, among other features [
10]. The model can deduce how these aspects have been associated with each other through the torque-current and voltage constant [
11].
The torque is proportional to the current. This relationship relies on the torque sensitivity constant ().
The back electromotive force voltage is proportional to the angular velocity. This proportion depends on the voltage constant ().
DC motors are exposed to variations (parametric uncertainties) that hinder their operation over time. Strategies such as robust control, optimal control, or offline correction of gains to update controller parameters, among others, are options to meet control requirements. Although these techniques focus on correcting some aspects of the system, sometimes the variations are not well understood or predictable, thus the problem may happen again in the short term. There are few studies to understand how those variations will impact, much less how to anticipate them.
Adaptive and modern control are alternatives for re-tuning the controller gains to current conditions. Several methods for catching the changes in the system can be applied, such as specific algorithms for updating controller parameters, the use of Artificial Intelligence (AI), Fuzzy Logic Controllers (FLC), Neural Networks (NN) for tuning gains, etc. Not all the methods are suitable for all the applications. It is necessary to consider resource consumption and pre-work needed, i.e., training of NNs. In addition, another methodology uses bio-inspired meta-heuristic algorithms that have produced an excellent cost-benefit ratio in terms of resource use contrasted to controller operation [
2]. A precise DC motor model is needed for analytical control system design and optimization. Sometimes, reference parameter values of the DC motor detailed in the specification are inadequate. This is the case for cheaper DC motors with relatively large tolerances in the electrical and mechanical parameters. Other identification methods are algebraic and open-loop identification for estimating motor parameters [
12], a particular methodology is the identification of the DC motor as a first-order system.
2.1.1. Transfer Function (TF) for a Direct Current (DC) Motor
Properly controlled DC motors can achieve precise position, good angular speed regulation, and torque control. Control methods produce the desired response by adjusting gain values that depend on physical parameters; therefore, precisely identifying these parameters becomes relevant. Before any motion, the armature resistance
, the armature inductance
, the back-EMF
, and the torque ratio
are constant, but once a DC motor is in operation, these values might change due to magnetic effects, among other reasons. In addition, other parameters such as the moment of inertia
J, change due to the addition or subtractions of mass in the motor shaft [
13].
Figure 1 shows a schematic of a DC motor.
The model comprises input voltage , motor damping B attached to the mechanical constituents in the motor, the angular speed , and the electrical current i (or ) flowing in the circuit.
The governing equation—based on Kirchhoff’s law—for the electrical part is
while, for the mechanical part, the governing equation is
The torque at shaft
is generally defined as a combination of different torques such as the cogging torque, the kinetic friction, and the viscous friction (also known as viscous damping force) [
12]. It is necessary to express the torque in the shaft as a function of current and the input voltage as a function of angular speed. This results in the following equations:
Equations (
1)–(
4) are rewritten as a single system of equations in the Laplace domain as follows:
By substituting
from Equation (
7) into Equation (
6) and substituting
from Equation (
6) into Equation (
5), the system can be expressed as the relationship that exists between the angular speed (output—
) and the input voltage
, that is,
where
is defined as
The system’s time response is composed of the electrical time constant and the mechanical time constant (intrinsic to each motor). Assuming the electrical time constant is small versus the mechanical time constant, the terms in Equation (
9) related to the electrical time constant can be neglected [
14]. Equation (
9) can be expressed as
where
is defined as
The model can be described in the block diagram shown in
Figure 2. It is possible to identify each component (the block diagram does not include nonlinearities). The back-EMF and the torque constant play a vital role in the motor operation and the control definition.
2.1.2. DC Motor Identification
Understanding a system before trading it is essential. A system uses modeling and identification and is understood after analysis. Those are a conjugate pair of activities that should be considered in any system. Physical principles in modeling provide a mathematical description with key parameters in a generic form. The resulting model with generic parameters represents a class of models from which a particular element is defined through the identification and estimation of parameters [
15].
There are different methods for DC motor model identification:
The challenge in preparing a state-space-oriented control model is that most of the system identification techniques available are for the input–output model. Experiments are therefore proposed to estimate the parameters of an n-order state-space system. It is critical to split the n-order system into n-first order systems as necessary to obtain equivalent discrete-time models for those first-order systems [
16]. A typical transfer function of a first-order system with a time constant
and steady-state gain
K, assuming no time delay, is given by:
Equation (
13) is equivalent to Equation (
11); therefore, both are appropriate representations of a first-order system model used for DC motor identification. Parameter identification is used to obtain an accurate model of a real system. A complete model provides a suitable platform for further developments of the design or control. The online parameter identification schemes are used to estimate system parameters and monitor changes in parameters and characteristics of the system for a diagnosis related to various technology areas. The identification schemes can be used to update the value of the design parameters specified by manufacturers [
17]. It is important to remember that electrical dynamics can be neglected because they are faster than the mechanical dynamics in the motor [
18]. Control engineers rely on using the manufacturer parameters from the datasheets to sketch an initial approach. In this study, the DC motor used is 36JX30K/38ZY63-1230 from Dongyangcorp. This motor integrates a gearbox that adds torque capacity but reduces speed in a ratio of 50.8 to 1, which is not considered in the modeling. The manufacturer indicated some parameters that are detailed in
Table 1.
2.1.3. Controller Approach
Most of the commercial controllers available for industrial processes are based on classic control theories such as Proportional-Integral-Derivative (PID), and they are of closed architecture [
19], as mentioned in [
20]. In addition, the authors in [
20] explained the use of Fuzzy Logic (FL) as trying to emulate the imprecise human reasoning of physical processes into information that is capable of being handled by an embedded system or computer [
21]. Fuzzy Logic has been judged over the years because of its ability to face complex problems without the need for models. These controllers (FL-based) are more flexible albeit more complex than PID controllers since they cover a broader range of operating conditions. They can work with internal and external disturbances of different natures. The design of Fuzzy Logic controllers is more accessible than developing a customized model-based controller. In other words, it is possible to modify the structure, rule base, and display it as a human-performed task for controlling. In addition to the previously mentioned, the authors in [
20] established that PID, state-space controllers, artificial neural networks, and FL-based controllers are techniques applied to motion control. The PID controller is defined as follows:
where
is the proportional gain,
is the derivative gain, and
is the integral gain. A significant disadvantage of this algorithm is the computing of the controller gains [
21], as mentioned in [
20].
The DC motor requires a feedback system to be controlled. When a DC motor includes a feedback system, it can be considered a servo system. Servo systems can have either the position, speed, acceleration outputs, or a combination of these [
22]. The PID controllers are programmed based on the original estimation of a TF and cannot be changed during the operation until a software update is loaded if the system allows it. The authors in [
22] proposed using an open architecture controller using reconfigurable hardware and a Genetic Algorithm (GA) for an online self-tuning strategy for positioning a linear motion system. The PID algorithm was discretized; then, the gains were calculated using Ziegler–Nichols without needing any model.
In [
23], a testing methodology was developed for creating control systems. It helped to discover and implement a mathematical model, estimate different motor model parameters, get familiar with the hardware and software to develop the controller, and use the ATMega328 microprocessor Unit (MCU) as the Central Processing Unit (CPU) device capable of handling the fuzzy logic controller. Using and controlling the motor current besides the motor speed utilizing an FLC is crucial to reaching a more robust controller. This is mentioned in [
24]. The authors based this on a review of different proposed control systems. Then, they used FLC with an optimization based on Genetic Algorithms to provide a softer system that can be interpreted as better protecting motor gear-pair, the mechanics, and the feed. The fuzzy logic controller achieved the required behavior by meeting the control requirements. Its robustness was proved by better values from the simulation of the testing scenarios, i.e., the current behaved more smoothly than the PID controller.
2.2. Modeling and Controlling the DC Motor through Its Transfer Function (TF)
The transfer function of the DC motor is deduced from the model shown in
Figure 2. It is developed considering the manufacturer’s datasheet. Then, the transfer function is simplified and shown in
Figure 3, which determines the angular speed produced by the voltage input. This is also known as the open-loop transfer function that estimates the angular speed vs. voltage ratio.
The DC motor response is compared to the proposed model, and the results are shown in
Figure 4. The input voltage is 12 volts at no-load conditions, and the expected angular speed equals 314.16 rad/s.
The model representation is close to the actual data but not exact. The difference might be due to the moment of inertia and viscous friction not matching actual values. Electrical component values might not be as precise as the real values, and nonlinearities are not included (although this might influence much more at low voltages), among others. This testing shows that the simplified transfer function allows an accurate representation which confirms that neglecting some aspects of the complete version is permitted.
is the inverse of
. This is relevant since this definition and considering the DC motor will change its efficiency in time, then
will be estimated in time. Equation (10) can be rewritten as follows:
2.2.1. Open-Loop Simulation for Gathering Data
The open-loop model helps to simulate scenarios where the electrical resistance and inductance values vary in time by as much as 1% and 0.5%, respectively. This resulted in producing a set of
values to build a time series, then using it to forecast
for re-tuning purposes. Simulation is carried out considering a 9 volts step input, seed 0 for electrical component, and seed 1 for inductance component.
Figure 5 shows the schematic, and
Figure 6 shows the resulting data.
Collecting data can be replicated as often as needed, including changing input steps and percentages of variation and seeds.
2.2.2. PID Controller Design for Closed-Loop Simulation
PID controllers or their combinations are used to control either BDC or BLDC motors. PI controller controls the angular speed, current, and commutation [
25]. PID controller developed for the closed-loop simulation based on the stability analysis that shows the system is stable and controllable (the poles are both negative and on the real axis (
and
). The Routh–Hurwitz matrix confirmed stability (no sign changes in the first column). PID gains are calculated using the auto-tune function in Simulink™ values selected to avoid actuator saturation as follows:
,
and
. Those gains produce an under-damped response, not exceeding 10% of overshoot and they reach settling time in approximately 0.2 s when a step of 9 volts is used as input. The closed-loop block diagram is shown in
Figure 7, and its response to 9 volts step input is shown in
Figure 8.
2.3. The Time Series (TS) Analysis and Stationary Check for the Proposed Model
A time series is a set of observations taken equally in time, and its analysis is concerned with understanding the dependency intrinsic to the data in it. This requires the development of stochastic and dynamic models. A discrete system is one from which observations are taken at equally spaced time intervals [
26]. The application of time series and dynamic models is found in areas such as:
Forecasting a time series’s future values from current and past values.
The determination of the transfer function of a system is subject to inertia.
The design of simple control schemes utilizing potential deviations in the system output is compensated by adjusting the input variables.
The collected data from the simulation can be considered a time series. Verifying the dataset is essential to determine the model that fits better to forecast Back EMF. Stationary criteria are critical to selecting a model, depending on the statistically significant lags, from either the following: Auto-Regressive (AR), Moving Average (MA), including the Integrated (I) aspect (lag reduction), Auto-Regressive Moving Range (ARMA) or Auto-Regressive Integrated Moving Range (ARIMA). Forecasting data is a challenge when it goes far from the last sample. Going back to the stationary check, the data’s nature can be determined. The data’s mean (
) is constant (this can be interpreted as the mean contrasted to subgroups averages and is not changing drastically). The standard deviation (
) is also constant. There is no seasonality (not an evident repetitive pattern in time). The inspection of input data is shown in
Figure 9. The mean equals 0.0386 and local averages are close. The standard deviation equals 0.00327 with no excessive variabilities in data along the total sampling. All these are shown in
Figure 9.
Even though this gives enough evidence of the stationary, there are a couple of additional forms to check it: (1) the global versus local tests and (2) the Augmented Dickey–Fuller (ADF) test. Further details are found in [
26].
The stationary requirement has been checked for the dataset; therefore, it is used for extrapolation. The model type can be either the AR or the MA or a combination including the I (ensuring the mean is equal to 0 as a condition to improve fitting). Regression models use past values to predict current values; they are assisted using coefficients inferred from the dataset and the error. The general form has the following equation:
where
is the
pth degree polynomial,
a is the random error term, the
is the independent variable (past values), and the
is the dependent value.
In the Auto-Regressive (AR) model, the current value is expressed as a finite, linear aggregate of previous values and a random constant element
when the values of a process are at an equally spaced time
t,
,
, … by
,
,
, …In addition, let
be the series of deviation from
. It can be defined as follows:
In the Moving Average (MA) model, the first consideration is the fact that it is finite. The
is linearly dependent on a finite number of
q of previous
’s.
is the
qth degree polynomial; therefore, the MA model is written as:
and
are defined as follows:
So, Equation (
17) is known as the AR model of order
p and Equation (
18) is known as the MA process of order
q [
26].
In the AR models, the weights (
) are forced to follow an exponential decay form with
as the decay rate. Since the weights are only restricted to the condition
, it might not be possible to approximate them by an exponential decay pattern. There is a need to increase the order of the AR model to approximate any pattern these weights might exhibit. Adjusting to the exponential decay pattern is sometimes possible by adding a few terms to have a more economical model. In the case of an AR model, disregarding the order is not enough in fulfilling this pattern condition. Instead of increasing its order, it is preferred to add an MA term that will adjust the
while not affecting the rate of the exponential decay pattern for the rest of the weights [
27].
A combination of AR(
p) with MA(
q) is named Auto-Regressive Moving Average ARMA(
) model [
26] and it is defined as follows:
The Auto-Correlation Function (ACF) and the Partial Auto-Correlation Function (PACF) are used to determine the number of components the model will include, see
Figure 10. The ACF helps more for MA models, while PACF is better for finding the number of elements for AR models. ACF is a good tool for checking the randomness of the data; this is appropriately defined as the Box–Jenkins Auto-Regressive formulation. In MA(
q), the ACF helps to determine which lags are statistically significant, then define the order of the MA model [
28]. PACF can be seen as the correlation between two variables after being adjusted for a common factor affecting them. Considering the formulation proposed by Yule–Walker, which accounts for the formal definition for PACF, for an AR(
p) process, it is understood that the vector of
for any
uses the last
coefficient, called the partial Auto-Correlation of the process at lag
k, as the cut off after lag
p. This suggests that the PACF can be used in identifying the order of the AR(
p) model [
27].
Coefficients determined, see R™ script used in
Appendix A, are AR(1) = 0.0499 with a constant = 0.2289 and MA(1) = 0.3940 and a constant = 0.1997 with a non-zero mean. The fit and wellness of the model are shown in
Figure 11 and
Figure 12, respectively.
Item 1 from
Table 2 is selected for simulation testing to exercise PID gains re-tuning off-line. A detailed description is given in
Section 2.4.
2.4. Proposed Testing for Simulation
In this test, 3 out of 15 forecast Back EMF (
) values were selected for testing scenarios. Those are: (1)
, (2)
, (3)
. The testing simulation uses
, according to
Table 3, to add perturbations into the system and verify the PID controller behavior. Proposed
, as predictions, used to re-do the TF and re-tune PID gains from selected scenarios were also used. The input step is set to 9 volts producing an output velocity of approximately 247 rad/s.
Torque values for the perturbation are selected considering the maximum permissible load before a stall condition occurs from the manufacturer’s datasheet. The results for item 1—samples 1, 2, and 5, are shown in
Figure 14,
Figure 15 and
Figure 16 respectively.
With the change of the , the efficiency has changed, and the resulting angular velocity is different; the current controller is based on regulating voltage for controlling action but not observing any reference angular velocity as a setting. However, comparing the performance back-to-back of the current controller gains is desired, including the change in Back EMF versus the re-tuned (proposed) gains using the auto-tune Simulink ™ function to the new .
Re-tuned gains improved the damping. The system response is over-damped at a higher level than the original controller at the beginning. However, the load acceptance and load rejection testing scenarios demand more from the system. The gain changes produced a smoother response than that of the original.