1. Introduction
Aircraft play a major role in various fields today, and their safety and control are crucial. A twin rotor multi-input multi-output system is a type of aircraft that resembles a helicopter in structure but differs in terms of its aerodynamic force control, which is achieved through DC motors. The two DC motors in the system face control challenges due to coupling dynamics during their movements. The system’s controller regulates the voltage supplied to the DC motors to achieve the desired horizontal and vertical positions [
1,
2]. Unlike a helicopter, a TRMS lacks flight capability and cyclic control [
3]. A TRMS comprises two DC motors and a balance beam structure that creates a biaxial state in the plane of motion. One of the DC motors controls the main rotor, allowing the system to move up or down, while the other DC motor in the tail rotor enables the system to move right or left. The main purpose is to keep the pitch and yaw angles in the TRMS in the equilibrium position. To achieve this, four different variables are measured on the TRMS: the vertical angle, horizontal angle, and their individual angular velocities. The system is modeled using Newton’s laws of motion and can be linearized under certain conditions in a helicopter, a type of TRMS used in real-life scenarios [
4]. A TRMS can be operated as a single-axis or two-axis system [
5]. If the system is operated in two axes, two PID controllers and six values should be obtained [
6].
These systems can be controlled by determining the parameters of the proportional–integral–derivative (PID) controller, a classical control method. The parameters of the PID controller can be determined using classical methods such as the Ziegler–Nichols and Astrom–Hagglund methods, as well as other methods [
7,
8]. PID controllers have recently been used for several different systems by converting these controllers to discrete-time controllers; at the same time, metaheuristic algorithms such as the particle swarm optimization algorithm have been used to determine the parameters of discrete-time PID controllers [
9,
10].
Solving complex optimization problems requires advanced techniques beyond traditional and classical methods. These techniques include metaheuristic algorithms, which are computational intelligence paradigms capable of handling high-dimensional, nonlinear, and hybrid problems. Metaheuristic algorithms are classified based on their types, such as swarm-based, evolutionary, physics-based, or human-based algorithms, as well as their nature-inspired or non-nature-inspired approach. Additionally, they can be categorized as population-based or single-solution-based algorithms [
11,
12].
Related studies of TRMSs have aimed to increase robustness by reducing the impact of external disturbances encountered in daily life, such as wind, and minimizing the uncertainties of the TRMS itself [
13]. With controllers that increase the system’s robustness, the TRMS’s position can also be adjusted [
3].
The different transfer functions TRMSs are applied to are the horizontal angle and the vertical angle and their effects on each other. These effects determine the coupling dynamics. Different discrete-time values can be determined for the sampling times of these transfer functions. With these discrete-time transfer functions, the efficiency of the PID controller can be increased, and more robust control can be provided. Therefore, the system should be controlled in discrete time to reduce the effect of coupling dynamics on TRMSs [
14,
15].
Metaheuristic algorithms can be used in nonlinear systems, such as an inverted-pendulum system. PID controller parameters are optimized using ant colony optimization to control the inverted pendulum. First, the system state is modeled in state space by considering the physical properties of the system. A PID controller controls the system variables specified in the state space in the best way possible and works to minimize the error in closed-loop control systems. The ant colony optimization algorithm determines the values that will achieve the best response in the system for the controllers. The performance of the inverted pendulum is evaluated based on the integral square error values. The ant colony optimization algorithm mainly ensures that each iteration achieves a cost function lower than the previous one. The integral squared error is then used as the fitness function to find the PID controller values [
16].
Evolutionary computation methods and metaheuristic optimization algorithms have been used in many studies to find PID controller parameters for TRMSs. These studies have been carried out with classical swarm-based optimization algorithms, such as particle swarm optimization. In these studies, IAE, ITAE, ITSE, and ISE have been used as the performance measures for the fitness function value, and these performance values can be expressed as the sum of the main rotor and tail rotor errors [
17,
18,
19].
2. A Mathematical Model of the Twin Rotor MIMO System
A TRMS uses two DC motors and a balance beam, and its mathematical model is based on its electrical and mechanical properties. Separate equations can be written for the main rotor and the tail rotor.
Figure 1 shows the parameters that affect TRMSs on the horizontal and vertical axes [
20,
21,
22]. To understand the flight dynamics and behavior of a TRMS, it is necessary to know the dynamic equations of the system.
A TRMS consists of a main rotor and a tail rotor, as shown in
Figure 1. The twin DC motors that power these rotors are connected to a voltage input from an electrical unit beneath the TRMS. This electrical unit is a communication switch between the TRMS and the computer and contains an emergency shutdown unit. The twin rotors are connected to DC inputs that produce torques τ1 and τ2, which turn the rotors.
The TRMS provides two position measurements—the pitch (ψ) angle and the yaw (ϕ) angle. The TRMS model can be divided into two parts: a DC motor model for the main and tail rotors and a mechanical model for the TRMS in the horizontal and vertical planes. Equations (1) and (2) refer to the torque of the pitch and yaw angles, respectively [
16,
20,
21].
In Equations (1) and (2), T10, T11, T20, and T21 are the denominator parameters, and k1 and k2 represent the motor gains. The torque equations give rise to mechanical equations that describe the TRMS’s vertical and horizontal movements. These are expressed in Equations (3) and (4).
The horizontal and vertical expressions are provided in Equations (5)–(11).
The TRMS model parameters are provided in Equations (1)–(11). I
1 and I
2 are moments of inertia for the vertical and horizontal movements of the rotors, respectively; M
1 and M
2 reflect the nonlinear static characteristics;
i and bi (1, 2) are the static characteristic parameters; M
FG is momentum due to gravity; M
g is the moment of gravitational force; M
Bψ and M
Bϕ are the momentum caused by friction forces; B
1ψ and B
1ϕ are the friction momentum function parameters for the respective rotors; M
G is the momentum from the gyroscopic effects; and k
gy is the gyroscopic momentum parameter. The cross-reaction momentum between the two axes, M
R, is the output of a linear system [
20].
Table 1 defines the expressions and numerical parameter values used in the TRMS equations.
Equations (12)–(15) describe the state-space model [
5,
23].
Equations (12) and (13) correspond to the values for matrices A and B in Equations (16) and (17) [
5,
23]:
The state space model of the TRMS includes the pitch, yaw, and the impact of these angles on each other. If desired, it can be expressed using transfer functions.
Figure 2 illustrates this coupling effect with a block diagram [
24,
25].
In
Figure 2, U1 and U2 are the controller outputs; the transfer function of the TRMS can be represented by a 2 × 2 matrix, comprising four transfer functions. Equation (18) expresses the transfer functions in the Laplace (s) domain, expressed as a 2 × 2 matrix denoted by G(s) [
25,
26,
27].
Four transfer functions were created in the literature to study the main rotor and tail rotor angles of TRMSs. Among these, G
11 represents the transfer function of the pitch angle, G
22 represents the transfer function of the yaw angle, G
12 represents the transfer function of the yaw angle to the pitch angle, and G
22 represents the transfer function of the pitch angle to the yaw angle. To improve system control and increase the PID controller’s efficiency, we converted the transfer functions written in the Laplace domain to the z-domain, i.e., a discrete-time form based on the sampling time Ts = 0.001. Equation (19) provides the z-transfer function of the TRMS as a 2 × 2 matrix.
The reason for the z-domain conversion is that the TRMS is connected to a computer during real-time operation. This transformation ensures that the data flow correctly between the TRMS and the computer, the difficulties encountered in the s domain are overcome, and efficiency is increased. The selected sampling time was first simulated on the computer, and then the controller parameters were found and run in the real system. Since the Ts (sampling time) value was quite small, the parameters were obtained on the computer, and experimental studies were carried out. In this way, metaheuristic algorithms can cope with the sampling time against the real system.
3. Metaheuristic Algorithms
A TRMS is a complex system that takes in multiple inputs and produces multiple outputs. In all of the algorithms presented below, the fitness function is computed by summing up the integral time squared errors (ITSEs) resulting from differences between the real-time data values obtained from the pitch and yaw angles (the output values) and the reference value. This approach identifies the parameter values that result in the least error during system operation. The mathematical expression of the cost function is provided in Equation (20).
In Equation (20), epitch indicates the amount of error between the reference value and the instantaneous pitch angle value, and eyaw indicates the amount of error between the reference value and the instantaneous yaw angle value. Modeling the system in discrete time allows the nonlinear TRMS to be controlled using linear modeling. The sampling time in discrete time more clearly shows the influence of the main rotor and the tail rotor on each other. Accounting for this, since the main rotor has a greater impact on the system’s operation and reaching the reference value, 70% of the error weight is assigned to the main rotor and 30% to the tail rotor. This decision is based on the coupling effect. In this study, we compared the performance of traditional and old metaheuristic algorithms—previously studied on another TRMS—and a new algorithm inspired by a viral infection that causes death by hijacking the new-generation immune system on our TRMS. This new algorithm responded with less overshoot at the first launch than the previous algorithms.
3.1. Particle Swarm Optimization
Nature has been an inspiration for scientific development throughout the years. For instance, the biological behavior of animal herds has led to innovations such as artificial intelligence. Optimization methods derived from the joint action of herds have provided substantial benefits in solving complex computational problems. One optimization method is the particle swarm optimization (PSO) algorithm, which is widely used in various studies by developing variants, mainly in engineering and computer sciences. In the PSO algorithm, initial parameters are defined. Then, a swarm is created, and each particle is compared with the others to determine the best position in the search space within the specified range. The movement of each particle varies according to its previous position and its determined velocity. Each particle placed in the search space updates its position in each iteration. As a result of these updates, the optimal fitness function can be approached [
28,
29]. The mathematical expressions of particle swarm optimization are presented in Equations (21) and (22).
Equation (21) consists of three components: w × vk represents the initial velocity, c1r1 is the cognitive component, and c2r2 is the social component. The current position of xk is also a part of this equation. Equation (22), on the other hand, refers to the fast updating of the optimization’s position.
3.2. Dragonfly Algorithm
The dragonfly algorithm is an optimization method that has inspired metaheuristic algorithms. It is based on the behavior of dragonflies in nature, specifically how they hunt and prey. Dragonflies have approximately 3000 species in nature, and they tend to live in flocks and become predators and hunters when they reach the adult stage [
30].
The dragonfly algorithm involves various behaviors, such as alignment, separation, cohesion, attraction to food, and distraction from enemies. These behaviors determine the movements of the algorithm’s particles and help achieve its objective. To create artificial dragonflies, these behaviors are integrated into a computer program, as described in Equation (23).
In Equation (23), s is the separation weight, a is the alignment weight, c is the alignment weight, f is the food factor, and e is the enemy factor. The indented expressions S
i, A
i, C
i, F
i, and E
i denote the ith individual’s separation, alignment, cohesion, food, and enemy factors at instantaneous iterations in computer simulations [
31,
32,
33]. Every algorithm has a flow diagram that shows the sequence of operations performed by the computer. The dragonfly algorithm is widely used to solve optimization problems in various fields, such as power and energy systems, medical systems, and audio and image processing. Moreover, there are different versions of the dragonfly algorithm, including single-objective problems, the binary dragonfly algorithm, the multi-objective version, and hybrid versions [
34].
3.3. Cuckoo Search Algorithm
The cuckoo algorithm is a swarm intelligence-based optimization algorithm developed in recent years. Cuckoos are one of many bird species found in nature, but what sets them apart is their parasitic lifestyle. They are also known for their beautiful sounds and aggressive breeding behavior. Cuckoos can lay their eggs in the nests of other host birds, and this algorithm is based on their parasitic, Levy flight behavior. The breeding and nesting behaviors of cuckoos optimize the breeding and reproduction conditions for the algorithm, solving difficult optimization problems [
35,
36].
The cuckoo algorithm is a simple algorithm that follows three basic rules. Each cuckoo lays one egg at a time and randomly places it in a nest. The nests with high-quality eggs are considered the best and are passed on to the next generation. The number of available host nests is fixed, and the hosts have a probability of discovering a foreign egg [0, 1] [
37]. The cuckoo algorithm uses Levy flight to help birds find new solutions during optimization. This flight pattern directs the cuckoos to their next position. Equation (24) determines the movement of a cuckoo to the next position using Levy flight.
Equation (24) defines α as the step size that can expand or contract the search space. Equation (25) provides the Levy distribution from which the Levy flight is obtained.
The cuckoo algorithm belongs to a class of population-based swarm intelligence algorithms. It utilizes a step length that randomizes the process and, therefore, enhances its efficiency. The algorithm requires fewer parameter inputs than particle swarm optimization, providing an edge. Before running the cuckoo optimization algorithm, the optimization habitat must first be created. The habitat is obtained by defining an Nvar dimensional optimization model based on the size of the problem. The habitat is created as a 1 × Nvar array that represents the location of the cuckoos. The array is represented by Equation (26) [
35].
The cuckoo search algorithm maximizes a profit function (Equation (27)) that depends on habitat and cost.
In an optimization problem, var
hi and var
low are set as the lower and upper bounds. These bounds define the “laying radius” of the cuckoo flocks in the search space. Each cuckoo has its own laying radius, calculated using Equation (28).
3.4. Genetic Algorithm
Animal herds can adapt their bodies to the environments they live in. This process is known as adaptation. The genetic algorithm involved in this process comprises stages such as natural selection, crossover, and mutation. These stages bring about changes in the genotypes and phenotypes of animals. The ability of living organisms to adapt to changing environmental and climatic factors is crucial. Individuals who fail to adapt to their surroundings cannot pass on their genes to the next generation through natural selection. Therefore, the fittest individuals survive and thrive in animal herds [
38,
39,
40].
The genetic algorithm involves a population of individuals living in a habitat. Each individual has chromosomes in its cellular structure, which contain genes. The gene sequences within chromosomes determine an organism’s genotype and phenotype. The genetic algorithm follows a flow diagram similar to that of other metaheuristic algorithms. In the population creation stage, genes are created using binary values of 0 and 1. These genes are then placed in chromosomes to form a population of individuals. The chromosomes are evaluated to ensure they meet predetermined conditions. Next, the crossover process begins, where gene sequences from different chromosomes are combined to create new chromosomes without affecting their biological properties. The crossover process can be single-point or multi-point depending on the specific requirements [
41]. During the mutation stage of genetic algorithms, gene sequences in chromosomes undergo alteration. The mutation process takes place at a particular rate, usually defined within a range of 0–1. In the final stage, before reaching the maximum number of iterations, selection is performed. This selection process involves choosing individuals to be matched using various methods, such as the roulette wheel and tournament method [
42].
3.5. Coronavirus Disease Optimization Algorithm (COVIDOA)
The COVIDOA is an optimization algorithm inspired by the coronavirus disease that emerged in late 2019 and affected the whole world. As a structure, the coronavirus microbe contains RNA and the N protein glycoprotein. It also harbors its genetic structure in an oily membrane as a cellular structure. This genetic structure is encoded in RNA and is read by the infected cell in the body [
43]. The coronavirus consists of four structural proteins. The coronavirus can be transmitted from person to person through coughs and sneezes and causes death with conditions such as septic shock and multiple organ failure.
The biggest danger this virus poses to human health is its rapid replication. Here, the replication mechanism of the coronavirus was used for the proposed algorithm to achieve a specific goal.
Figure 3 shows the flow diagram of the COVIDOA used to find the PID parameter for TRMS [
44].
The PID controller values were determined using metaheuristic algorithms, and their codes were generated. These values were then used to conduct physical experiments on the TRMS. The results section of this paper includes graphs and their respective ISE, IAE, ITSE, and ITAE values for the 2 DOF system.
Figure 3 shows an example diagram of the COVIDOA for the TRMS. The flow diagram in
Figure 3 shows that the cost function for all algorithms is placed in them and weighted for the TRMS.
In the COVIDOA, first of all, a population is created randomly, and the cost is calculated for each solution. When we look at the mathematical equations for each structural protein mentioned, if there is a +1 frameshift,
If there is a −1 frameshift,
S
k refers to the kth generated protein, P is the parent solution, and D is the problem dimension (the number of variables in each solution). The frameshifting results represent a new protein sequence. The COVIDOA’s cost is noted in
Figure 4 as an example of minimizing cost (fitness) values for the above metaheuristic algorithms over iterations.
4. Tuning PID with Metaheuristic Algorithms and Discrete PID Controller
To obtain PID values, the system should load values obtained from metaheuristic algorithms. Then, the iterations should be improved using the fitness function provided in Equation (20). A PID-tuning block diagram is provided in
Figure 5.
The discrete-time PID controller is used to control digital systems. To use transfer functions and PID controllers continuously, they must be transformed from the s-domain into the z-domain. The z-transfer function changes with the sampling time, obtaining different transfer functions. The metaheuristic algorithm block in
Figure 5 indicates the codes written for the algorithms. With these codes, six discrete-time PID parameters are obtained in each iteration (simulation) according to the amount of error in the system. Three parameters are obtained as the pitch angle and three as the yaw angle. The PID controller used in continuous time consists of K
p (proportional), K
i (integral), and K
d (derivative). It is converted into discrete time through the backward difference method. Using this method, the discrete transfer functions of a numerical integrator and numerical differentiator are determined.
Equation (33) is a mathematical expression for the discrete-time PID controller [
9].
Equation (33) is a discrete-time PID formula based on the difference between times z and z − 1 within the sampling time. Ts is the sampling time, and e[z] is the error in the system. e[z] is also the input of the discrete-time PID controller. A block diagram of the discrete-time PID controller in the Matlab (2019) program was used. Unlike a traditional PID controller formula, there is a difference concerning the sampling time. z is any moment in the sampling time. The graphs from the simulation model were accessed through the block diagram of the model parameters of the TRMS in the Matlab program. The Kp1, Ki1, and Kd1 and Kp2, Ki2, and Kd2 parameters obtained for pitch and yaw were generated in each iteration by searching within a solution space (lower and upper bounds) determined for the algorithms. During the iterations, the interaction between the parameters, i.e., the estimated mean value range (0–10), emerges by minimizing the Fitness function value. For simulation calculations, the m-file was used for coding in connection with Matlab/Simulink (2019).
6. Results
Experimental studies were conducted on a physical TRMS, and the values obtained from each algorithm were compared for the pitch and yaw angles. The results are analyzed and compared in
Figure 6 (pitch angle) and
Figure 7 (yaw angle). The algorithm values were obtained by setting the maximum iteration number average to 25 iterations and the value search range to 0–10 for the PID parameters. We selected PID parameters in this range to prevent excessive disturbances in the system’s dynamic behavior. In other words, we aimed to reduce the percentage of exceedance amounts. For TRMS, the actuator condition (ITSE) was caused by the main rotor, and its ratio in the fitness function is taken more than in the tail rotor (Equation (20)).
The ISE, IAE, ITAE, and error performance values were obtained for the pitch and yaw angles with the different algorithms.
Table 2 shows the error performance values for the ISE, IAE, ITAE, and ITSE.
Table 3 shows the K
p, K
i, and K
d values obtained from the PSO, dragonfly, cuckoo, genetic, and coronavirus optimization algorithms.
Table 4 shows the rise time, settling time, peak value, and percentage overshoot amounts.
7. Discussion
After an analysis of
Table 2, the following results were obtained for the different optimization algorithms: For the main rotor angle, the genetic algorithm provided the lowest ISE value of 0.3219, the lowest IAE value of 1.425, and the lowest ITSE value of 0.4602. The coronavirus optimization algorithm provided the lowest ITAE value of 12.16. For the tail rotor angle, the particle swarm optimization algorithm provided the lowest ISE value of 0.3105, the lowest IAE value of 1.479, and the lowest ITSE value of 1.86. The lowest ITAE value was obtained from the particle swarm optimization algorithm. After analyzing the ITSE value used in the cost function and other error performance analyses, we determined that the genetic algorithm outperformed the other algorithms.
After analyzing the data in
Table 4, which include the rise, settlement, and percentage overshoot amounts, we found that the particle swarm optimization algorithm had the lowest overshoot amount of 0.5062 for the main rotor angle, while the genetic algorithm had the highest overshoot amount of 0.6750. The fastest rise time occurred in the genetic algorithm with 1.5040, while the particle swarm optimization algorithm had the fastest settling time of 10.27. Additionally, the lowest percentage overshoot occurred in the particle swarm optimization algorithm at 1.227%. Comparing these values, we concluded that the PID parameters obtained from the genetic algorithm provided the fastest reaction, but it was behind the particle swarm optimization algorithm in terms of settlement and percentage overshoot. For the tail rotor angle, the cuckoo algorithm had the lowest overshoot of 0.7026, while the genetic algorithm had the highest overshoot of 0.8437. The fastest rise time was observed in the genetic algorithm at 0.7845, while the particle swarm optimization algorithm had the fastest settling time of 8.974. Moreover, the cuckoo algorithm had the lowest percentage overshoot at 41.35%. Comparing these values, we concluded that the PID parameters obtained from the genetic algorithm provided the fastest reaction, but it was behind the particle swarm optimization and cuckoo algorithms regarding settlement and percentage overshoot. Determining which values obtained from the algorithms have the best or worst response will provide an advantage in knowing what kind of control response TRMS users want. At this point, the user should choose the algorithm for the TRMS. Whether the system reaches the reference value safely or the reference value of fast and sudden take-off should be determined by the user. This will naturally directly affect the comfort of the system. If the TRMS user does not care about high overshoots at the first take-off moment of the system, they should use the coefficients obtained from the genetic algorithm; if the user does not want high overshoots, they should use the coronavirus optimization algorithm.
8. Conclusions
Our study shows that the TRMS moves suddenly to reach the reference value determined at the first take-off moment. With the PID controller parameters used, although there was a problem at the input moment, the reference value was reached shortly. In the last case, the reference value was reached, and robust control was provided with small overshoots. In a real-time experimental study, the coronavirus optimization algorithm showed that the TRMS slowly and safely reached the reference value. The main rotor made fewer overshoots than the genetic and dragonfly algorithms. For the tail rotor, the genetic algorithm made fewer overshoots than the cuckoo algorithm. Since the coronavirus optimization algorithm is a new algorithm, its performance was close to that of the particle and cuckoo algorithms in terms of the main rotor and close to that of the dragonfly and cuckoo algorithms in terms of the tail rotor.
From this point of view, the coronavirus algorithm provided successful results for the TRMS. However, it needs to be improved. The discrete-time PID controller parameters were determined by reducing the cost function value below 0.05 for each algorithm for the TRMS to fit the specified reference value. As a result, if the system needs to settle to the reference value safely and slowly, the parameters obtained from the coronavirus optimization algorithm should be used. If it is thought that the system moving quickly at the first start will not cause a problem, the parameters obtained from the genetic algorithm should be used. From these perspectives, the genetic algorithm and the coronavirus optimization algorithm come to the fore. The graphs obtained from the PSO, cuckoo, and dragon algorithms provided intermediate values between the genetic algorithm and the coronavirus optimization algorithm. It cannot be said that these algorithms are very good or very bad because they are between the comfort values provided by the coronavirus algorithm or the fast movement values of the genetic algorithm. In terms of the performance measures, since the system is nonlinear, it is not possible to reach the optimal value in all aspects. On the other hand, a gain in the rise or settlement time causes losses in terms of overshoot. In addition, a high gain in one angle can cause losses in the other.
When considering aircraft with two degrees of freedom, such as TRMSs, the coronavirus optimization algorithm can be used to reach reference values for a safe journey. In practice, the discrete-time PID controller provided better results in controlling nonlinear systems with a suitable sampling time than the classical PID controller. It is advantageous to digitize a PID controller for a specific sampling time.